@ascentsparksoftware/angular-image-editor 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ascentsparksoftware-angular-image-editor.mjs","sources":["../../../projects/angular-image-editor/src/lib/theme/color.ts","../../../projects/angular-image-editor/src/lib/engine/crop.ts","../../../projects/angular-image-editor/src/lib/engine/shapes.ts","../../../projects/angular-image-editor/src/lib/engine/svg-fonts.ts","../../../projects/angular-image-editor/src/lib/engine/image-decode.ts","../../../projects/angular-image-editor/src/lib/engine/crop-session.ts","../../../projects/angular-image-editor/src/lib/types/editor.types.ts","../../../projects/angular-image-editor/src/lib/registry/tool-registry.ts","../../../projects/angular-image-editor/src/lib/engine/filter-map.ts","../../../projects/angular-image-editor/src/lib/engine/fabric-filters.ts","../../../projects/angular-image-editor/src/lib/engine/fabric-loader.ts","../../../projects/angular-image-editor/src/lib/engine/export-config.ts","../../../projects/angular-image-editor/src/lib/engine/delta-history.ts","../../../projects/angular-image-editor/src/lib/engine/editor-engine.ts","../../../projects/angular-image-editor/src/lib/engine/rulers.ts","../../../projects/angular-image-editor/src/lib/icons/lucide-icons.ts","../../../projects/angular-image-editor/src/lib/icons/asp-icon.ts","../../../projects/angular-image-editor/src/lib/registry/resolve-tools.ts","../../../projects/angular-image-editor/src/lib/registry/toolbar-groups.ts","../../../projects/angular-image-editor/src/lib/theme/apply-theme.ts","../../../projects/angular-image-editor/src/lib/theme/oklch.ts","../../../projects/angular-image-editor/src/lib/theme/tokens.ts","../../../projects/angular-image-editor/src/lib/theme/derive-theme.ts","../../../projects/angular-image-editor/src/lib/ui/history/history-list.ts","../../../projects/angular-image-editor/src/lib/ui/history/history-list.html","../../../projects/angular-image-editor/src/lib/ui/controls/color-field.ts","../../../projects/angular-image-editor/src/lib/ui/controls/color-field.html","../../../projects/angular-image-editor/src/lib/ui/options-panel/options-panel.ts","../../../projects/angular-image-editor/src/lib/ui/options-panel/options-panel.html","../../../projects/angular-image-editor/src/lib/ui/layers/layer-list.ts","../../../projects/angular-image-editor/src/lib/ui/layers/layer-list.html","../../../projects/angular-image-editor/src/lib/ui/rail/tool-rail.ts","../../../projects/angular-image-editor/src/lib/ui/rail/tool-rail.html","../../../projects/angular-image-editor/src/lib/ui/image-editor/fonts.ts","../../../projects/angular-image-editor/src/lib/ui/image-editor/sample-images.ts","../../../projects/angular-image-editor/src/lib/ui/image-editor/image-editor.ts","../../../projects/angular-image-editor/src/lib/ui/image-editor/image-editor.html","../../../projects/angular-image-editor/src/lib/dialog/image-editor-dialog.ts","../../../projects/angular-image-editor/src/lib/engine/history.ts","../../../projects/angular-image-editor/src/public-api.ts","../../../projects/angular-image-editor/src/ascentsparksoftware-angular-image-editor.ts"],"sourcesContent":["/**\n * Small, dependency-free color utilities used by the theme deriver.\n *\n * Everything here is pure (no DOM, no globals) so it is trivially unit-testable\n * and safe to run during SSR. Colors are represented as 8-bit sRGB channels.\n */\n\n/** An sRGB color with 8-bit channels (0–255, not necessarily integral until formatted). */\nexport interface Rgb {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n}\n\nconst clamp = (value: number, min: number, max: number): number =>\n value < min ? min : value > max ? max : value;\n\n/** Clamp to [0,255] and round to the nearest integer. */\nconst clampChannel = (value: number): number => clamp(Math.round(value), 0, 255);\n\nconst HEX_RE = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/**\n * Parse a hex color string (`#rgb`, `#rrggbb`, with or without the leading `#`,\n * case-insensitive) into an {@link Rgb}.\n *\n * @throws {Error} if the string is not a valid 3- or 6-digit hex color.\n */\nexport function parseHex(hex: string): Rgb {\n const match = HEX_RE.exec(hex.trim());\n if (!match) {\n throw new Error(`Invalid hex color: \"${hex}\"`);\n }\n let body = match[1];\n if (body.length === 3) {\n body = body[0] + body[0] + body[1] + body[1] + body[2] + body[2];\n }\n return {\n r: parseInt(body.slice(0, 2), 16),\n g: parseInt(body.slice(2, 4), 16),\n b: parseInt(body.slice(4, 6), 16),\n };\n}\n\n/** Format an {@link Rgb} as a lowercase `#rrggbb` string, clamping/rounding channels. */\nexport function formatHex(rgb: Rgb): string {\n const toHex = (value: number): string => clampChannel(value).toString(16).padStart(2, '0');\n return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;\n}\n\n/** Convert an 8-bit channel to its linear-light value per the sRGB transfer function. */\nconst linearize = (channel8: number): number => {\n const c = clamp(channel8, 0, 255) / 255;\n return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n};\n\n/** WCAG 2.x relative luminance of an sRGB color, in [0,1]. */\nexport function relativeLuminance(rgb: Rgb): number {\n return 0.2126 * linearize(rgb.r) + 0.7152 * linearize(rgb.g) + 0.0722 * linearize(rgb.b);\n}\n\n/** WCAG contrast ratio between two colors, in [1,21]. Symmetric in its arguments. */\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const la = relativeLuminance(a);\n const lb = relativeLuminance(b);\n const lighter = Math.max(la, lb);\n const darker = Math.min(la, lb);\n return (lighter + 0.05) / (darker + 0.05);\n}\n\n/** Produce a CSS `rgba(...)` string from an color and an alpha (clamped to [0,1]). */\nexport function withAlpha(rgb: Rgb, alpha: number): string {\n const a = clamp(alpha, 0, 1);\n return `rgba(${clampChannel(rgb.r)}, ${clampChannel(rgb.g)}, ${clampChannel(rgb.b)}, ${a})`;\n}\n","/**\n * Crop geometry. Pure functions that translate an aspect preset and image\n * dimensions into the largest centered crop rectangle of that ratio.\n */\n\nimport type { AspAspectPreset } from '../types/editor.types';\n\nexport interface CropRect {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\nconst FIXED_RATIOS: Partial<Record<AspAspectPreset, number>> = {\n '1:1': 1,\n '4:3': 4 / 3,\n '16:9': 16 / 9,\n '3:2': 3 / 2,\n};\n\n/**\n * The numeric width/height ratio for a preset, or `null` when the crop should\n * be free (`'free'`, or `'original'` with unknown dimensions).\n */\nexport function aspectRatioValue(\n preset: AspAspectPreset,\n imageW?: number,\n imageH?: number,\n): number | null {\n if (preset === 'free') {\n return null;\n }\n if (preset === 'original') {\n return imageW && imageH ? imageW / imageH : null;\n }\n return FIXED_RATIOS[preset] ?? null;\n}\n\n/**\n * The largest rectangle of the given aspect `ratio` that fits inside the image,\n * centered. A `null` ratio yields the full image.\n */\nexport function centeredCropRect(imageW: number, imageH: number, ratio: number | null): CropRect {\n if (ratio === null) {\n return { left: 0, top: 0, width: imageW, height: imageH };\n }\n\n const imageRatio = imageW / imageH;\n let width: number;\n let height: number;\n if (ratio > imageRatio) {\n // Target is wider than the image → constrained by width.\n width = imageW;\n height = imageW / ratio;\n } else {\n // Target is taller (or equal) → constrained by height.\n height = imageH;\n width = imageH * ratio;\n }\n\n return {\n left: (imageW - width) / 2,\n top: (imageH - height) / 2,\n width,\n height,\n };\n}\n","/**\n * Pure geometry helpers for the shape tools. Kept free of Fabric so they can be\n * unit-tested in isolation.\n */\n\n/**\n * The largest meaningful corner radius for a `width`×`height` rectangle. A fully\n * rounded rectangle becomes a pill/stadium when the radius reaches half the\n * shorter side, so that is the cap.\n */\nexport function maxCornerRadius(width: number, height: number): number {\n return Math.max(0, Math.min(width, height) / 2);\n}\n\n/**\n * Clamp a requested corner radius into the valid `[0, maxCornerRadius]` range for\n * a `width`×`height` rectangle. Non-finite or negative input yields a sharp\n * corner (`0`).\n */\nexport function clampCornerRadius(radius: number, width: number, height: number): number {\n if (Number.isNaN(radius) || radius <= 0) {\n return 0;\n }\n // A finite over-large radius (or +Infinity) caps at the pill radius.\n return Math.min(radius, maxCornerRadius(width, height));\n}\n","/**\n * Embed the web fonts used by an exported SVG so it renders the true typeface\n * everywhere — not just in a viewer that happens to have the font installed.\n *\n * Fabric's `toSVG()` emits `<text font-family=\"Lato\">`; standalone SVG viewers\n * that lack \"Lato\" silently fall back to a generic family. We fix that by\n * fetching each web font, inlining its bytes as a base64 `data:` URI inside an\n * `@font-face`, and injecting that CSS into the SVG's `<defs>`. The text stays\n * real, selectable text and the SVG stays self-contained.\n *\n * Pure parsing/encoding helpers are separated from the async network step (which\n * takes an injected `fetch`) so everything here is unit-testable.\n */\n\n/** Minimal structural type for the bits of `fetch`'s Response we use. */\nexport interface FetchResponseLike {\n readonly ok: boolean;\n text(): Promise<string>;\n arrayBuffer(): Promise<ArrayBuffer>;\n}\n\nexport type FetchLike = (url: string, init?: RequestInit) => Promise<FetchResponseLike>;\n\n/** A generic/system stack needs no embedding — the viewer already has it. */\nfunction isGenericFontStack(family: string): boolean {\n return /,|system-ui|sans-serif|serif|monospace/i.test(family);\n}\n\n/**\n * The distinct, embeddable web-font family names among `families`. Generic stacks\n * and blanks are dropped; order of first appearance is preserved.\n */\nexport function webFontFamilies(families: Iterable<string>): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const raw of families) {\n const name = (raw ?? '').trim();\n if (name && !isGenericFontStack(name) && !seen.has(name)) {\n seen.add(name);\n out.push(name);\n }\n }\n return out;\n}\n\n/**\n * Insert a `<style>` block into an SVG document, preferring an existing `<defs>`\n * and creating one right after the opening `<svg …>` otherwise. Returns the SVG\n * unchanged when there is no CSS to add.\n */\nexport function injectSvgFontCss(svg: string, css: string): string {\n if (!css.trim()) {\n return svg;\n }\n const style = `<style type=\"text/css\">\\n${css}\\n</style>`;\n if (/<defs[\\s>]/.test(svg)) {\n return svg.replace(/<defs([\\s>])/, `<defs$1${style}`);\n }\n return svg.replace(/(<svg\\b[^>]*>)/, `$1<defs>${style}</defs>`);\n}\n\n/** Base64-encode an ArrayBuffer (chunked so large fonts don't blow the call stack). */\nexport function base64FromArrayBuffer(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n const chunk = 0x8000;\n for (let i = 0; i < bytes.length; i += chunk) {\n binary += String.fromCharCode(...bytes.subarray(i, i + chunk));\n }\n return btoa(binary);\n}\n\n/**\n * Build self-contained `@font-face` CSS for one Google font family: fetch its\n * CSS2 stylesheet, then inline every referenced `.woff2`/`.woff` as a base64\n * `data:` URI. Returns `''` (and embeds nothing) if the font can't be fetched, so\n * export degrades to the previous font-family behavior rather than failing.\n */\nexport async function embedGoogleFontCss(family: string, fetchFn: FetchLike): Promise<string> {\n const param = family.trim().replace(/\\s+/g, '+');\n const cssUrl = `https://fonts.googleapis.com/css2?family=${param}:wght@400;600;700&display=swap`;\n let css: string;\n try {\n const res = await fetchFn(cssUrl);\n if (!res.ok) {\n return '';\n }\n css = await res.text();\n } catch {\n return '';\n }\n\n const urlRe = /url\\((https:\\/\\/[^)'\"]+\\.(?:woff2|woff))\\)/g;\n const urls = [...new Set([...css.matchAll(urlRe)].map((m) => m[1]))];\n let out = css;\n for (const url of urls) {\n try {\n const fres = await fetchFn(url);\n if (!fres.ok) {\n continue;\n }\n const b64 = base64FromArrayBuffer(await fres.arrayBuffer());\n const mime = url.endsWith('.woff2') ? 'font/woff2' : 'font/woff';\n out = out.split(url).join(`data:${mime};base64,${b64}`);\n } catch {\n // Leave this url() as-is; the rest of the embed still helps.\n }\n }\n // Drop @font-face blocks that still reference the network (failed inlines), so\n // the SVG never depends on a remote fetch to render.\n return out.replace(/@font-face\\s*\\{[^}]*\\}/g, (block) =>\n /url\\(https?:\\/\\//.test(block) ? '' : block,\n );\n}\n\n/**\n * Embed every web font used in `svg` (given the `families` collected from the\n * scene's text) as inlined `@font-face` CSS. Network fetches use the injected\n * `fetchFn`. On any failure the original SVG is returned unchanged.\n */\nexport async function embedFontsInSvg(\n svg: string,\n families: Iterable<string>,\n fetchFn: FetchLike,\n): Promise<string> {\n const webFonts = webFontFamilies(families);\n if (!webFonts.length) {\n return svg;\n }\n const blocks = await Promise.all(webFonts.map((f) => embedGoogleFontCss(f, fetchFn)));\n const css = blocks.filter((b) => b.trim()).join('\\n');\n return injectSvgFontCss(svg, css);\n}\n","/**\n * Robust raster decoding for imported images.\n *\n * Decodes a Blob into a downscaled data URL, honoring EXIF orientation (phone\n * photos are frequently rotated only via EXIF) and converting formats the\n * browser can't decode natively — HEIC/HEIF — through a lazily-loaded optional\n * dependency. Every failure throws a descriptive Error so the caller can surface\n * it, instead of the old `<img>` path that silently produced nothing for HEIC\n * and for images past the browser's decode limits.\n *\n * Pure size/format helpers are separated from the browser decode so they can be\n * unit-tested.\n */\n\nconst HEIC_RE = /\\.(heic|heif)$/i;\n\n/** True when the source is HEIC/HEIF, which browsers cannot decode in `<img>`. */\nexport function isHeic(type: string, name = ''): boolean {\n const t = (type ?? '').toLowerCase();\n return t === 'image/heic' || t === 'image/heif' || HEIC_RE.test(name);\n}\n\n/**\n * Dimensions that fit within `maxDim` on the longest edge, preserving aspect\n * ratio. Returns the input unchanged when already within bounds (or zero-sized).\n */\nexport function fitWithin(\n width: number,\n height: number,\n maxDim: number,\n): { width: number; height: number } {\n const longest = Math.max(width, height);\n if (longest <= maxDim || longest === 0) {\n return { width, height };\n }\n const scale = maxDim / longest;\n return {\n width: Math.max(1, Math.round(width * scale)),\n height: Math.max(1, Math.round(height * scale)),\n };\n}\n\n/**\n * Output encoding for a re-drawn import. JPEG sources (and HEIC, which we convert\n * to JPEG) have no alpha, so JPEG keeps big photos small; anything that may carry\n * transparency (PNG/WebP/GIF/unknown) is kept as PNG so alpha survives.\n */\nexport function outputType(sourceType: string): 'image/jpeg' | 'image/png' {\n return /jpe?g/i.test(sourceType ?? '') ? 'image/jpeg' : 'image/png';\n}\n\n/** Convert a HEIC/HEIF blob to a JPEG blob via the optional `heic2any` decoder. */\nasync function decodeHeic(blob: Blob): Promise<Blob> {\n let heic2any: (opts: { blob: Blob; toType?: string; quality?: number }) => Promise<Blob | Blob[]>;\n try {\n const mod = await import('heic2any');\n heic2any = mod.default ?? (mod as unknown as typeof mod.default);\n } catch {\n throw new Error(\n 'HEIC/HEIF images need the optional \"heic2any\" dependency. Install it to import this format.',\n );\n }\n const out = await heic2any({ blob, toType: 'image/jpeg', quality: 0.92 });\n return Array.isArray(out) ? out[0] : out;\n}\n\n/**\n * Decode an image Blob into a downscaled data URL whose longest edge is at most\n * `maxDim`, applying EXIF orientation. HEIC/HEIF is converted first. Throws a\n * descriptive Error when the image can't be decoded (unsupported, corrupt, or\n * past the browser's limits) or when no canvas context is available.\n */\nexport async function decodeImageBlob(blob: Blob, maxDim: number, name = ''): Promise<string> {\n const heic = isHeic(blob.type, name);\n const source = heic ? await decodeHeic(blob) : blob;\n\n let bitmap: ImageBitmap;\n try {\n bitmap = await createImageBitmap(source, { imageOrientation: 'from-image' });\n } catch {\n throw new Error('This image could not be decoded — the format may be unsupported or the file too large.');\n }\n\n try {\n const { width, height } = fitWithin(bitmap.width, bitmap.height, maxDim);\n if (width === 0 || height === 0) {\n throw new Error('This image has no pixel data.');\n }\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('No 2D canvas context is available for image import.');\n }\n ctx.imageSmoothingQuality = 'high';\n ctx.drawImage(bitmap, 0, 0, width, height);\n // HEIC was converted to JPEG, so report that type for the output choice.\n return canvas.toDataURL(outputType(heic ? 'image/jpeg' : blob.type), 0.92);\n } finally {\n bitmap.close();\n }\n}\n","/**\n * Pure geometry for the interactive crop tool. The crop frame is a rectangle in\n * scene (canvas) coordinates; these helpers keep it inside the canvas and honor\n * an optional aspect ratio. Kept free of Fabric so they can be unit-tested.\n */\n\nexport interface FrameRect {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * The starting crop frame: the largest rectangle of `ratio` (width/height) that\n * fits the canvas, scaled by `inset` and centered. A `null` ratio uses the\n * canvas aspect (so the frame is an inset of the whole canvas).\n */\nexport function defaultCropFrame(\n cw: number,\n ch: number,\n ratio: number | null,\n inset = 0.8,\n): FrameRect {\n let width = cw;\n let height = ch;\n if (ratio) {\n if (cw / ch > ratio) {\n height = ch;\n width = ch * ratio;\n } else {\n width = cw;\n height = cw / ratio;\n }\n }\n width *= inset;\n height *= inset;\n return { left: (cw - width) / 2, top: (ch - height) / 2, width, height };\n}\n\n/**\n * Clamp a frame so it stays fully within `cw`×`ch`, shrinking it if it is larger\n * than the canvas and then nudging its origin so it fits.\n */\nexport function clampFrame(frame: FrameRect, cw: number, ch: number): FrameRect {\n const width = Math.min(Math.max(frame.width, 1), cw);\n const height = Math.min(Math.max(frame.height, 1), ch);\n const left = Math.min(Math.max(frame.left, 0), cw - width);\n const top = Math.min(Math.max(frame.top, 0), ch - height);\n return { left, top, width, height };\n}\n\n/**\n * Resize a frame to `ratio` (width/height) keeping its center, then fit it inside\n * the canvas. A `null` ratio just clamps the frame unchanged.\n */\nexport function applyRatio(\n frame: FrameRect,\n ratio: number | null,\n cw: number,\n ch: number,\n): FrameRect {\n if (!ratio) {\n return clampFrame(frame, cw, ch);\n }\n const cx = frame.left + frame.width / 2;\n const cy = frame.top + frame.height / 2;\n let width = frame.width;\n let height = width / ratio;\n if (height > ch) {\n height = ch;\n width = height * ratio;\n }\n if (width > cw) {\n width = cw;\n height = width / ratio;\n }\n return clampFrame({ left: cx - width / 2, top: cy - height / 2, width, height }, cw, ch);\n}\n","/**\n * Public type contract for the editor.\n *\n * The tool and filter unions are derived from `as const` source arrays so the\n * registry (and any exhaustiveness check) is structurally guaranteed to cover\n * every member — there is one source of truth, not a union plus a parallel list\n * that can drift.\n */\n\n/** Layout/baseline preset — sets the chrome and a default tool set. */\nexport type AspMode = 'viewer' | 'basic' | 'advanced' | 'full';\n\n/**\n * A host-controllable size: a number (interpreted as `px`) or any CSS length —\n * `'600px'`, `'70%'`, `'80vh'`, `'calc(100vh - 120px)'`. Used for the editor's\n * `width`/`height` inputs. A per-mode minimum is always enforced on top so the\n * toolbars and panels keep enough room to render.\n */\nexport type AspSize = number | string;\n\n/** Every tool the editor can expose, grouped by capability. Source of truth for {@link AspTool}. */\nexport const ALL_TOOLS = [\n // transform\n 'crop',\n 'rotate',\n 'straighten',\n 'flip',\n 'resize',\n // draw / annotate\n 'pen',\n 'highlighter',\n 'eraser',\n 'shapes',\n 'arrow',\n 'line',\n 'text',\n 'sticker',\n 'redact',\n 'magicwand',\n 'removebg',\n 'selectsubject',\n // adjust / color\n 'adjust',\n 'filters',\n // object ops (Fabric object model)\n 'select',\n 'layers',\n 'duplicate',\n 'delete',\n 'opacity',\n 'align',\n 'group',\n // canvas\n 'background',\n 'frame',\n] as const;\n\nexport type AspTool = (typeof ALL_TOOLS)[number];\n\n/** Fabric.js built-in filters exposed by the editor. Source of truth for {@link AspFilter}. */\nexport const ALL_FILTERS = [\n 'brightness',\n 'contrast',\n 'saturation',\n 'vibrance',\n 'hue',\n 'blur',\n 'sharpen',\n 'grayscale',\n 'sepia',\n 'invert',\n 'pixelate',\n 'noise',\n 'gamma',\n 'blendColor',\n] as const;\n\nexport type AspFilter = (typeof ALL_FILTERS)[number];\n\n/** Export formats. `json` serializes the re-editable Fabric scene; `pdf` embeds a raster. */\nexport type AspExportFormat = 'png' | 'jpeg' | 'webp' | 'svg' | 'json' | 'pdf';\n\n/** A structured error surfaced via the `errorOccurred` output. */\nexport interface AspEditorError {\n /** Stable machine code, e.g. `'load-failed'`, `'export-failed'`, `'engine-init-failed'`. */\n readonly code: string;\n readonly message: string;\n}\n\n/** Crop aspect-ratio presets. */\nexport type AspAspectPreset = 'free' | '1:1' | '4:3' | '16:9' | '3:2' | 'original';\n\n/**\n * A host-defined crop aspect option — e.g. a CMS target like a 1200×630 social\n * image. `ratio` is width / height; build it from explicit dimensions with\n * {@link aspectOption}.\n */\nexport interface AspAspectOption {\n readonly label: string;\n readonly ratio: number;\n}\n\n/** Build an {@link AspAspectOption} from explicit pixel dimensions. */\nexport function aspectOption(width: number, height: number, label?: string): AspAspectOption {\n return { label: label ?? `${width}×${height}`, ratio: width / height };\n}\n","/**\n * Data-driven tool and filter catalog.\n *\n * The rail, options panels, and resolution all read from these tables — there\n * is no per-tool branching anywhere else. `mode`/`tools`/`disabledTools`/\n * `filters` resolve against this metadata (see `resolve-tools.ts`).\n */\n\nimport {\n ALL_FILTERS,\n ALL_TOOLS,\n type AspFilter,\n type AspMode,\n type AspTool,\n} from '../types/editor.types';\n\nexport type AspToolGroup = 'transform' | 'annotate' | 'color' | 'object' | 'canvas';\n\nexport interface ToolMeta {\n readonly key: AspTool;\n readonly label: string;\n /** Iconify/Lucide icon id. */\n readonly icon: string;\n readonly group: AspToolGroup;\n}\n\n/** A filter is either a continuous \"adjustment\" (slider) or a one-tap \"look\". */\nexport type FilterKind = 'adjustment' | 'look';\n\nexport interface FilterMeta {\n readonly key: AspFilter;\n readonly label: string;\n readonly kind: FilterKind;\n /** Slider bounds + default for adjustments (omitted for looks). */\n readonly min?: number;\n readonly max?: number;\n readonly defaultValue?: number;\n readonly unit?: string;\n}\n\nexport const TOOL_REGISTRY: Record<AspTool, ToolMeta> = {\n crop: { key: 'crop', label: 'Crop', icon: 'lucide:crop', group: 'transform' },\n rotate: { key: 'rotate', label: 'Rotate', icon: 'lucide:rotate-cw', group: 'transform' },\n straighten: { key: 'straighten', label: 'Straighten', icon: 'lucide:ruler', group: 'transform' },\n flip: { key: 'flip', label: 'Flip', icon: 'lucide:flip-horizontal-2', group: 'transform' },\n resize: { key: 'resize', label: 'Resize', icon: 'lucide:scaling', group: 'transform' },\n pen: { key: 'pen', label: 'Draw', icon: 'lucide:pencil', group: 'annotate' },\n highlighter: {\n key: 'highlighter',\n label: 'Highlight',\n icon: 'lucide:highlighter',\n group: 'annotate',\n },\n eraser: { key: 'eraser', label: 'Eraser', icon: 'lucide:eraser', group: 'annotate' },\n shapes: { key: 'shapes', label: 'Shapes', icon: 'lucide:square', group: 'annotate' },\n arrow: { key: 'arrow', label: 'Arrow', icon: 'lucide:arrow-up-right', group: 'annotate' },\n line: { key: 'line', label: 'Line', icon: 'lucide:minus', group: 'annotate' },\n text: { key: 'text', label: 'Text', icon: 'lucide:type', group: 'annotate' },\n sticker: { key: 'sticker', label: 'Sticker', icon: 'lucide:sticker', group: 'annotate' },\n redact: {\n key: 'redact',\n label: 'Redact',\n icon: 'lucide:square-dashed-mouse-pointer',\n group: 'annotate',\n },\n magicwand: { key: 'magicwand', label: 'Magic wand', icon: 'lucide:wand-2', group: 'annotate' },\n removebg: { key: 'removebg', label: 'Remove background', icon: 'lucide:scissors', group: 'annotate' },\n selectsubject: {\n key: 'selectsubject',\n label: 'Cut out subject',\n icon: 'lucide:person-standing',\n group: 'annotate',\n },\n adjust: { key: 'adjust', label: 'Adjust', icon: 'lucide:sliders-horizontal', group: 'color' },\n filters: { key: 'filters', label: 'Filters', icon: 'lucide:contrast', group: 'color' },\n select: { key: 'select', label: 'Select', icon: 'lucide:mouse-pointer-2', group: 'object' },\n layers: { key: 'layers', label: 'Layers', icon: 'lucide:layers', group: 'object' },\n duplicate: { key: 'duplicate', label: 'Duplicate', icon: 'lucide:copy', group: 'object' },\n delete: { key: 'delete', label: 'Delete', icon: 'lucide:trash-2', group: 'object' },\n opacity: { key: 'opacity', label: 'Opacity', icon: 'lucide:droplet', group: 'object' },\n align: {\n key: 'align',\n label: 'Align',\n icon: 'lucide:align-horizontal-distribute-center',\n group: 'object',\n },\n group: { key: 'group', label: 'Group', icon: 'lucide:group', group: 'object' },\n background: {\n key: 'background',\n label: 'Background',\n icon: 'lucide:paint-bucket',\n group: 'canvas',\n },\n frame: { key: 'frame', label: 'Frame', icon: 'lucide:frame', group: 'canvas' },\n};\n\nexport const FILTER_REGISTRY: Record<AspFilter, FilterMeta> = {\n brightness: {\n key: 'brightness',\n label: 'Brightness',\n kind: 'adjustment',\n min: -100,\n max: 100,\n defaultValue: 0,\n },\n contrast: {\n key: 'contrast',\n label: 'Contrast',\n kind: 'adjustment',\n min: -100,\n max: 100,\n defaultValue: 0,\n },\n saturation: {\n key: 'saturation',\n label: 'Saturation',\n kind: 'adjustment',\n min: -100,\n max: 100,\n defaultValue: 0,\n },\n vibrance: {\n key: 'vibrance',\n label: 'Vibrance',\n kind: 'adjustment',\n min: -100,\n max: 100,\n defaultValue: 0,\n },\n hue: { key: 'hue', label: 'Hue', kind: 'adjustment', min: -180, max: 180, defaultValue: 0, unit: '°' },\n blur: { key: 'blur', label: 'Blur', kind: 'adjustment', min: 0, max: 100, defaultValue: 0 },\n sharpen: { key: 'sharpen', label: 'Sharpen', kind: 'look' },\n grayscale: { key: 'grayscale', label: 'B&W', kind: 'look' },\n sepia: { key: 'sepia', label: 'Sepia', kind: 'look' },\n invert: { key: 'invert', label: 'Invert', kind: 'look' },\n pixelate: {\n key: 'pixelate',\n label: 'Pixelate',\n kind: 'adjustment',\n min: 1,\n max: 40,\n defaultValue: 1,\n },\n noise: { key: 'noise', label: 'Noise', kind: 'adjustment', min: 0, max: 200, defaultValue: 0 },\n gamma: { key: 'gamma', label: 'Gamma', kind: 'adjustment', min: 20, max: 220, defaultValue: 100 },\n blendColor: { key: 'blendColor', label: 'Tint', kind: 'look' },\n};\n\n/**\n * Curated default tool set per mode (ordered for the rail). `viewer` has no edit\n * tools; `basic` is the modal's crop/rotate/flip; `advanced` is the everyday\n * rail; `full` exposes the entire catalog.\n */\nconst ADVANCED_TOOLS: readonly AspTool[] = [\n 'select',\n 'adjust',\n 'filters',\n 'crop',\n 'rotate',\n 'pen',\n 'highlighter',\n 'eraser',\n 'shapes',\n 'text',\n 'redact',\n 'magicwand',\n 'removebg',\n 'selectsubject',\n 'frame',\n 'background',\n];\n\nexport const DEFAULT_TOOLS: Record<AspMode, readonly AspTool[]> = {\n viewer: [],\n basic: ['crop', 'rotate', 'flip'],\n advanced: ADVANCED_TOOLS,\n // full = advanced rail first, then every remaining catalog tool, in catalog order.\n full: [...ADVANCED_TOOLS, ...ALL_TOOLS.filter((t) => !ADVANCED_TOOLS.includes(t))],\n};\n\nconst ADVANCED_FILTERS: readonly AspFilter[] = [\n 'brightness',\n 'contrast',\n 'saturation',\n 'vibrance',\n 'hue',\n 'blur',\n 'sharpen',\n 'grayscale',\n 'sepia',\n 'invert',\n];\n\n/** Default filter set per mode. `'all'` means every Fabric filter. */\nexport const DEFAULT_FILTERS: Record<AspMode, readonly AspFilter[] | 'all'> = {\n viewer: [],\n basic: [],\n advanced: ADVANCED_FILTERS,\n full: 'all',\n};\n\nexport const ALL_FILTERS_LIST: readonly AspFilter[] = ALL_FILTERS;\nexport const ALL_TOOLS_LIST: readonly AspTool[] = ALL_TOOLS;\n","/**\n * Map the editor's UI adjustment values to Fabric.js filter parameters.\n *\n * Pure: produces normalized parameter specs the engine turns into Fabric filter\n * instances. Continuous \"adjustment\" filters live here; one-tap \"look\" filters\n * (grayscale/sepia/invert/sharpen/tint) carry no value and are handled by the\n * engine directly. Identity adjustments (at their registry default) are skipped\n * so the filter chain stays minimal.\n */\n\nimport { FILTER_REGISTRY } from '../registry/tool-registry';\nimport { ALL_FILTERS, type AspFilter } from '../types/editor.types';\n\nexport interface AdjustmentSpec {\n readonly key: AspFilter;\n /** Parameter value in Fabric's units. */\n readonly param: number;\n}\n\n/** UI-unit → Fabric-unit converters, by adjustment filter. */\nconst TO_FABRIC: Partial<Record<AspFilter, (ui: number) => number>> = {\n brightness: (ui) => ui / 100,\n contrast: (ui) => ui / 100,\n saturation: (ui) => ui / 100,\n vibrance: (ui) => ui / 100,\n blur: (ui) => ui / 100,\n hue: (ui) => (ui * Math.PI) / 180,\n pixelate: (ui) => ui,\n noise: (ui) => ui,\n gamma: (ui) => ui / 100,\n};\n\nconst isAdjustment = (key: AspFilter): boolean => FILTER_REGISTRY[key]?.kind === 'adjustment';\n\n/** Convert a UI adjustment value to its Fabric parameter. */\nexport function toFabricParam(key: AspFilter, uiValue: number): number {\n const convert = TO_FABRIC[key];\n return convert ? convert(uiValue) : uiValue;\n}\n\n/** Whether an adjustment differs from its registry default (i.e. has an effect). */\nexport function isAdjustmentActive(key: AspFilter, uiValue: number): boolean {\n return isAdjustment(key) && uiValue !== FILTER_REGISTRY[key].defaultValue;\n}\n\n/**\n * The non-default adjustments from a value map, in catalog order, each mapped to\n * its Fabric parameter. Non-adjustment keys are ignored.\n */\nexport function activeAdjustments(values: Readonly<Record<string, number>>): AdjustmentSpec[] {\n const specs: AdjustmentSpec[] = [];\n for (const key of ALL_FILTERS) {\n if (!isAdjustment(key)) {\n continue;\n }\n const value = values[key];\n if (value === undefined) {\n continue;\n }\n if (isAdjustmentActive(key, value)) {\n specs.push({ key, param: toFabricParam(key, value) });\n }\n }\n return specs;\n}\n","/**\n * Instantiate Fabric.js filter objects from the editor's adjustment/look state.\n *\n * This is the single place that knows the concrete Fabric filter classes; the\n * rest of the engine works in our normalized terms. Adjustment params come from\n * the pure {@link activeAdjustments} mapping; \"looks\" are parameter-less effects.\n */\n\nimport type * as Fabric from 'fabric';\n\nimport { activeAdjustments } from './filter-map';\nimport type { FabricModule } from './fabric-loader';\nimport type { AspFilter } from '../types/editor.types';\n\ntype FabricFilter = Fabric.filters.BaseFilter<string>;\n\n/** \"Look\" filters that are toggled on/off (no per-look slider). */\nexport const LOOK_FILTERS: readonly AspFilter[] = [\n 'grayscale',\n 'sepia',\n 'invert',\n 'sharpen',\n 'blendColor',\n];\n\nconst SHARPEN_MATRIX = [0, -1, 0, -1, 5, -1, 0, -1, 0];\n\n/** Default tint color for the blendColor \"Tint\" look (host can refine later). */\nconst TINT_COLOR = '#3b82f6';\n\n/**\n * Build the ordered Fabric filter chain for the current state: active\n * adjustments first (so looks compose on top of tonal corrections), then looks.\n */\nexport function buildFabricFilters(\n fabric: FabricModule,\n adjustments: Readonly<Record<string, number>>,\n looks: ReadonlySet<AspFilter>,\n): FabricFilter[] {\n const f = fabric.filters;\n const chain: FabricFilter[] = [];\n\n for (const { key, param } of activeAdjustments(adjustments)) {\n switch (key) {\n case 'brightness':\n chain.push(new f.Brightness({ brightness: param }));\n break;\n case 'contrast':\n chain.push(new f.Contrast({ contrast: param }));\n break;\n case 'saturation':\n chain.push(new f.Saturation({ saturation: param }));\n break;\n case 'vibrance':\n chain.push(new f.Vibrance({ vibrance: param }));\n break;\n case 'hue':\n chain.push(new f.HueRotation({ rotation: param }));\n break;\n case 'blur':\n chain.push(new f.Blur({ blur: param }));\n break;\n case 'pixelate':\n chain.push(new f.Pixelate({ blocksize: Math.max(1, Math.round(param)) }));\n break;\n case 'noise':\n chain.push(new f.Noise({ noise: Math.round(param) }));\n break;\n case 'gamma':\n chain.push(new f.Gamma({ gamma: [param, param, param] }));\n break;\n default:\n break;\n }\n }\n\n for (const look of looks) {\n switch (look) {\n case 'grayscale':\n chain.push(new f.Grayscale());\n break;\n case 'sepia':\n chain.push(new f.Sepia());\n break;\n case 'invert':\n chain.push(new f.Invert());\n break;\n case 'sharpen':\n chain.push(new f.Convolute({ matrix: SHARPEN_MATRIX }));\n break;\n case 'blendColor':\n chain.push(new f.BlendColor({ color: TINT_COLOR, mode: 'tint', alpha: 0.5 }));\n break;\n default:\n break;\n }\n }\n\n return chain;\n}\n","/**\n * Lazily and SSR-safely load Fabric.js.\n *\n * Fabric is `import()`-ed on demand so it stays out of the initial bundle (the\n * `simple`/`basic` path can avoid pulling it until an editor actually mounts),\n * and never evaluated during server-side rendering where `document` is absent.\n * The promise is memoized so the module is fetched at most once per app.\n */\n\nimport type * as Fabric from 'fabric';\n\nexport type FabricModule = typeof Fabric;\n\nlet cached: Promise<FabricModule> | null = null;\n\n/** Resolve the Fabric module, or reject if not running in a browser. */\nexport function loadFabric(): Promise<FabricModule> {\n if (typeof document === 'undefined') {\n return Promise.reject(new Error('@ascentsparksoftware/angular-image-editor: Fabric.js requires a browser environment.'));\n }\n if (cached === null) {\n cached = import('fabric');\n }\n return cached;\n}\n","/**\n * Resolve an export request into a concrete, validated configuration.\n *\n * Pure: turns the public `exportFormats`/`exportQuality` inputs plus a chosen\n * format into the mime type, normalized quality, and export \"kind\" the engine\n * needs. Guards against a requested format that the host did not allow.\n */\n\nimport type { AspExportFormat } from '../types/editor.types';\n\nexport type ExportKind = 'raster' | 'vector' | 'json' | 'pdf';\n\nexport interface ResolvedExport {\n readonly format: AspExportFormat;\n readonly mimeType: string;\n /** 0–1 for raster formats; always 1 for vector/json. */\n readonly quality: number;\n readonly kind: ExportKind;\n}\n\nconst MIME: Record<AspExportFormat, string> = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n webp: 'image/webp',\n svg: 'image/svg+xml',\n json: 'application/json',\n pdf: 'application/pdf',\n};\n\nconst KIND: Record<AspExportFormat, ExportKind> = {\n png: 'raster',\n jpeg: 'raster',\n webp: 'raster',\n svg: 'vector',\n json: 'json',\n pdf: 'pdf',\n};\n\nconst clamp = (v: number, min: number, max: number): number =>\n v < min ? min : v > max ? max : v;\n\n/**\n * @param format requested export format.\n * @param qualityPct quality on the public 10–100 scale.\n * @param allowed formats the host permits; the first is the fallback.\n */\nexport function resolveExport(\n format: AspExportFormat,\n qualityPct: number,\n allowed: readonly AspExportFormat[],\n): ResolvedExport {\n const resolvedFormat = allowed.includes(format) ? format : (allowed[0] ?? 'png');\n const kind = KIND[resolvedFormat];\n const quality = kind === 'raster' || kind === 'pdf' ? clamp(qualityPct, 10, 100) / 100 : 1;\n return {\n format: resolvedFormat,\n mimeType: MIME[resolvedFormat],\n quality,\n kind,\n };\n}\n","/**\n * A bounded linear undo/redo history that stores **diffs**, not full snapshots.\n *\n * The editor serializes its whole scene (often hundreds of KB once an image is\n * loaded) on every edit. Keeping 50 full snapshots would cost tens of MB. This\n * history keeps one full base plus a chain of jsondiffpatch deltas — each\n * incremental edit (move a shape, tweak a color) is a sub-KB delta — and\n * reconstructs any state on demand by replaying deltas from the base.\n *\n * Behavior is identical to a full-snapshot stack: `current`/`undo`/`redo`\n * return the exact serialized state, branches truncate on push, and the oldest\n * entries drop once the cap is exceeded (the new oldest is re-materialized into\n * the base so the chain stays valid). Pure and unit-testable — no Fabric refs.\n */\n\nimport { create, type DiffPatcher, type Delta } from 'jsondiffpatch';\n\nimport type { HistoryEntry } from './history';\n\n/** Minimal projection of an entry for the History panel (labels only). */\nexport interface HistoryStep {\n readonly label: string;\n}\n\n/** Parsed snapshot object; opaque to this module (it only diffs/patches it). */\ntype SceneState = Record<string, unknown>;\n\n/**\n * One node in the chain. The first node is a *base* (`full` set, `delta`\n * undefined); every later node is a *delta* against its predecessor's\n * reconstructed state (`full` undefined, `delta` set — or undefined when the\n * edit produced no change).\n */\ninterface Node {\n label: string;\n full: SceneState | null;\n delta: Delta | undefined;\n}\n\nconst DEFAULT_MAX_ENTRIES = 50;\n\nexport class DeltaHistory {\n private readonly differ: DiffPatcher;\n private readonly stack: Node[];\n private cursor = 0;\n private readonly maxEntries: number;\n\n constructor(initialLabel: string, initialState: string, maxEntries: number = DEFAULT_MAX_ENTRIES) {\n this.maxEntries = Math.max(1, maxEntries);\n this.differ = create({\n // Match array items by their stable editor id so reordering/edits produce\n // small deltas; fall back to positional matching when an item has no id.\n objectHash: (item: unknown, index?: number) => {\n const id = (item as Record<string, unknown> | null)?.['aspId'];\n return typeof id === 'string' ? id : `$$index:${index}`;\n },\n // Text diffing is opt-in (needs a diff-match-patch instance) and brings no\n // benefit for our short scene fields, so it is left off by omitting it.\n });\n this.stack = [{ label: initialLabel, full: parse(initialState), delta: undefined }];\n }\n\n /** Labels for every retained entry, oldest first (for the History panel). */\n get entries(): readonly HistoryStep[] {\n return this.stack.map((n) => ({ label: n.label }));\n }\n\n get index(): number {\n return this.cursor;\n }\n\n get length(): number {\n return this.stack.length;\n }\n\n get current(): HistoryEntry<string> {\n return this.entryAt(this.cursor);\n }\n\n /** The base entry (index 0) — used by the engine's full \"reset edits\" action. */\n get first(): HistoryEntry<string> {\n return this.entryAt(0);\n }\n\n get canUndo(): boolean {\n return this.cursor > 0;\n }\n\n get canRedo(): boolean {\n return this.cursor < this.stack.length - 1;\n }\n\n /**\n * Record a new state. The redo branch ahead of the cursor is discarded, and\n * the oldest entries drop once the cap is exceeded.\n */\n push(label: string, state: string): void {\n const prev = this.reconstruct(this.cursor);\n const next = parse(state);\n const delta = this.differ.diff(prev, next);\n this.stack.splice(this.cursor + 1);\n this.stack.push({ label, full: null, delta });\n while (this.stack.length > this.maxEntries) {\n this.dropOldest();\n }\n this.cursor = this.stack.length - 1;\n }\n\n /** Step back one entry, or return `null` if already at the start. */\n undo(): HistoryEntry<string> | null {\n if (!this.canUndo) {\n return null;\n }\n this.cursor -= 1;\n return this.current;\n }\n\n /** Step forward one entry, or return `null` if already at the end. */\n redo(): HistoryEntry<string> | null {\n if (!this.canRedo) {\n return null;\n }\n this.cursor += 1;\n return this.current;\n }\n\n /** Replace the entire history with a single fresh base entry. */\n reset(label: string, state: string): void {\n this.stack.splice(0, this.stack.length, { label, full: parse(state), delta: undefined });\n this.cursor = 0;\n }\n\n /** Serialized byte length of the delta retained for an entry (for tests/metrics). */\n retainedDeltaBytes(index: number): number {\n const node = this.stack[index];\n if (!node || node.delta === undefined) {\n return 0;\n }\n return JSON.stringify(node.delta).length;\n }\n\n /** Reconstruct the serialized state at an index by replaying deltas from the base. */\n private entryAt(index: number): HistoryEntry<string> {\n return { label: this.stack[index].label, state: stringify(this.reconstruct(index)) };\n }\n\n /**\n * Replay the delta chain from the base (index 0) up to `targetIndex`. The\n * base is deep-cloned first so patching never mutates retained state.\n */\n private reconstruct(targetIndex: number): SceneState {\n let obj = this.differ.clone(this.stack[0].full) as SceneState;\n for (let i = 1; i <= targetIndex; i++) {\n const delta = this.stack[i].delta;\n if (delta !== undefined) {\n obj = this.differ.patch(obj, delta) as SceneState;\n }\n }\n return obj;\n }\n\n /**\n * Drop the base entry and promote the next one to a fresh base by\n * materializing its full state (its delta no longer has a predecessor).\n */\n private dropOldest(): void {\n if (this.stack.length <= 1) {\n return;\n }\n const newBase = this.reconstruct(1);\n this.stack.shift();\n this.stack[0] = { label: this.stack[0].label, full: newBase, delta: undefined };\n this.cursor = Math.max(0, this.cursor - 1);\n }\n}\n\n/** Parse a serialized snapshot into a mutable object the differ can work with. */\nfunction parse(state: string): SceneState {\n return JSON.parse(state) as SceneState;\n}\n\n/** Deterministically re-serialize a reconstructed state. */\nfunction stringify(state: SceneState): string {\n return JSON.stringify(state);\n}\n","/**\n * EditorEngine — the only component that talks to Fabric.js directly.\n *\n * It owns a Fabric `Canvas` holding one base `FabricImage` (the photo) plus\n * annotation objects on top, and exposes high-level editor operations: load,\n * zoom/pan, rotate/flip/straighten, crop, adjustments/filters, shapes/text/\n * free-draw, undo/redo (serialized-scene snapshots), and export. UI components\n * call these methods and never import Fabric themselves.\n *\n * Not unit-tested in jsdom (Fabric needs a real canvas/WebGL); verified through\n * the demo with Playwright screenshots, per the project's visual-truth rule.\n */\n\nimport type * as Fabric from 'fabric';\n\nimport { parseHex, withAlpha } from '../theme/color';\nimport { centeredCropRect, aspectRatioValue } from './crop';\nimport { clampCornerRadius, maxCornerRadius } from './shapes';\nimport { embedFontsInSvg } from './svg-fonts';\nimport { decodeImageBlob } from './image-decode';\nimport { type FrameRect, defaultCropFrame, clampFrame, applyRatio } from './crop-session';\nimport { buildFabricFilters, LOOK_FILTERS } from './fabric-filters';\nimport { loadFabric, type FabricModule } from './fabric-loader';\nimport { resolveExport } from './export-config';\nimport { DeltaHistory, type HistoryStep } from './delta-history';\nimport { FILTER_REGISTRY } from '../registry/tool-registry';\nimport { ALL_FILTERS, type AspAspectPreset, type AspExportFormat, type AspFilter } from '../types/editor.types';\n\nexport interface EngineOptions {\n readonly width: number;\n readonly height: number;\n}\n\nexport type ShapeKind =\n | 'rect'\n | 'ellipse'\n | 'line'\n | 'arrow'\n | 'triangle'\n | 'diamond'\n | 'pentagon'\n | 'hexagon'\n | 'star';\n\nexport type RedactMode = 'blur' | 'pixelate' | 'solid';\n\nexport interface AnnotationStyle {\n readonly color: string;\n readonly strokeWidth: number;\n /** Rectangle corner radius (px, in object coordinates). `0`/absent = sharp corners. */\n readonly cornerRadius?: number;\n}\n\nexport interface TextStyle {\n readonly color: string;\n readonly fontSize: number;\n readonly fontFamily?: string;\n}\n\n/** Rich-text attributes of the selected text, for the Text panel toggles. */\nexport interface TextStyleInfo {\n readonly bold: boolean;\n readonly italic: boolean;\n readonly underline: boolean;\n readonly strike: boolean;\n readonly align: string;\n /** The text's current font family, so the panel can reflect it on selection. */\n readonly fontFamily: string;\n}\n\n/** Editable style of the current selection, surfaced to the host UI. */\nexport interface SelectionStyleInfo {\n /** `'text'` → color is fill + size is fontSize; `'stroke'` → color is stroke + size is strokeWidth. */\n readonly kind: 'text' | 'stroke';\n readonly color: string;\n readonly size: number;\n /** Present when a single text object is selected. */\n readonly textStyle?: TextStyleInfo;\n /** Present when a single rectangle is selected: its current corner radius. */\n readonly cornerRadius?: number;\n /** Present when a single rectangle is selected: the pill-cap radius for its size. */\n readonly cornerRadiusMax?: number;\n}\n\n/** One entry in the layers panel (top of the z-stack first). */\nexport interface LayerInfo {\n readonly id: string;\n readonly label: string;\n readonly locked: boolean;\n readonly visible: boolean;\n readonly selected: boolean;\n /** Object opacity, 0–1. */\n readonly opacity: number;\n /** False for the base image, which should not be deletable. */\n readonly removable: boolean;\n}\n\n/** Full serialized editor state stored in each history entry. */\ninterface EditorSnapshot {\n json: Record<string, unknown>;\n rotation: number;\n straighten: number;\n adjustments: Record<AspFilter, number>;\n looks: AspFilter[];\n frame: string;\n guides?: ManualGuide[];\n}\n\n/** A versioned template: a full editor snapshot plus the artboard. */\ninterface SceneTemplate {\n snapshot: EditorSnapshot;\n artboard: ArtboardSize | null;\n}\n\n/** Narrow untrusted parsed JSON to a usable template (only checks the fields we rely on). */\nfunction isSceneTemplate(value: unknown): value is SceneTemplate {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const v = value as Record<string, unknown>;\n const snapshot = v['snapshot'];\n if (typeof snapshot !== 'object' || snapshot === null) {\n return false;\n }\n const json = (snapshot as Record<string, unknown>)['json'];\n if (typeof json !== 'object' || json === null) {\n return false;\n }\n const artboard = v['artboard'];\n if (artboard !== null && artboard !== undefined) {\n if (typeof artboard !== 'object') {\n return false;\n }\n const a = artboard as Record<string, unknown>;\n if (typeof a['width'] !== 'number' || typeof a['height'] !== 'number') {\n return false;\n }\n }\n return true;\n}\n\nconst ZOOM_MIN = 25;\nconst ZOOM_MAX = 400;\nconst FIT_PADDING = 0.92;\n/** Imported images larger than this (longest edge, px) are downscaled to cap memory. */\nconst MAX_IMPORT_DIM = 4096;\n\nconst clamp = (v: number, min: number, max: number): number => (v < min ? min : v > max ? max : v);\n\n/** Default adjustment values (the registry default for each adjustment filter). */\nfunction defaultAdjustments(): Record<AspFilter, number> {\n const values = {} as Record<AspFilter, number>;\n for (const key of ALL_FILTERS) {\n const meta = FILTER_REGISTRY[key];\n values[key] = meta.kind === 'adjustment' ? (meta.defaultValue ?? 0) : 0;\n }\n return values;\n}\n\n/** A target output size in pixels for the artboard / export region. */\nexport interface ArtboardSize {\n readonly width: number;\n readonly height: number;\n}\n\n/** Progress of an in-browser AI operation (model fetch + inference). */\nexport interface AiProgress {\n /** `'loading'` while fetching the model, `'processing'` during inference, `'done'`. */\n readonly stage: 'loading' | 'processing' | 'done';\n /** 0–1 within the current stage (best-effort; some stages report no total). */\n readonly progress: number;\n}\n\n/** A user-placed guide line at a fixed scene coordinate. */\nexport interface ManualGuide {\n readonly id: string;\n /** `h` = horizontal line at scene-y `pos`; `v` = vertical line at scene-x `pos`. */\n readonly orientation: 'h' | 'v';\n readonly pos: number;\n}\n\n/** The current view transform plus canvas size — everything a ruler needs. */\nexport interface Viewport {\n readonly zoom: number;\n readonly panX: number;\n readonly panY: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** A snap guide segment, expressed in scene (canvas) coordinates. */\ninterface GuideLine {\n readonly x1: number;\n readonly y1: number;\n readonly x2: number;\n readonly y2: number;\n}\n\n/** Axis-aligned bounding box in scene coordinates, with derived centers. */\ninterface SceneBox {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly cx: number;\n readonly cy: number;\n}\n\nexport class EditorEngine {\n private readonly canvas: Fabric.Canvas;\n private readonly fabric: FabricModule;\n private readonly history: DeltaHistory;\n\n private baseImage: Fabric.FabricImage | null = null;\n private rotation = 0; // 0/90/180/270, in degrees\n private straighten = 0; // -45..45\n private zoomPct = 100;\n private adjustments: Record<AspFilter, number> = defaultAdjustments();\n private looks = new Set<AspFilter>();\n private frame = 'none';\n private idCounter = 0;\n private clipboard: Fabric.FabricObject[] = [];\n private panMode = false;\n private panLast: { x: number; y: number } | null = null;\n private snapEnabled = true;\n private activeGuides: GuideLine[] = [];\n private artboard: ArtboardSize | null = null;\n /** Committed crop region (scene coords) — drives the dim mask and raster/PDF export. */\n private cropRegion: FrameRect | null = null;\n /** The interactive crop frame while the Crop tool is active, else null. */\n private cropFrame: Fabric.Rect | null = null;\n /** Aspect ratio (w/h) constraining the crop frame, or null for free crop. */\n private cropRatio: number | null = null;\n /** Per-object interactivity saved while a crop session locks the rest of the scene. */\n private cropPrevState = new Map<Fabric.FabricObject, { selectable: boolean; evented: boolean }>();\n private cropPrevUniformScaling = true;\n private rulersEnabled = false;\n private manualGuides: ManualGuide[] = [];\n /** Live preview of a guide being dragged from a ruler (not yet committed). */\n private guideDraft: ManualGuide | null = null;\n /** Id of an existing manual guide being dragged on the canvas, if any. */\n private draggingGuideId: string | null = null;\n private guideIdCounter = 0;\n private selectionListener: ((info: SelectionStyleInfo | null) => void) | null = null;\n private layersListener: (() => void) | null = null;\n private viewportListener: (() => void) | null = null;\n private guidesListener: (() => void) | null = null;\n private textMode = false;\n private textPlacementListener: ((point: { x: number; y: number }) => void) | null = null;\n private textFinishListener: (() => void) | null = null;\n private pendingFinishText: Fabric.FabricObject | null = null;\n private redactPlacement = false;\n private magicMode = false;\n private magicListener: ((point: { x: number; y: number }) => void) | null = null;\n private aiProgressListener: ((info: AiProgress) => void) | null = null;\n private onFontsLoaded: (() => void) | null = null;\n private lastViewportKey = '';\n\n /** Snap distance in *screen* pixels; divided by zoom to get a scene threshold. */\n private static readonly SNAP_PX = 7;\n /** Pointer proximity (screen px) for grabbing a manual guide on the canvas. */\n private static readonly GUIDE_GRAB_PX = 6;\n\n private constructor(fabric: FabricModule, canvas: Fabric.Canvas) {\n this.fabric = fabric;\n this.canvas = canvas;\n this.history = new DeltaHistory('Opened editor', this.snapshot());\n const notify = (): void => {\n this.notifySelection();\n this.notifyLayers();\n };\n this.canvas.on('selection:created', notify);\n this.canvas.on('selection:updated', notify);\n this.canvas.on('selection:cleared', notify);\n // Capture whether an empty-canvas text-mode click lands on an already-active\n // text BEFORE Fabric clears the selection in its own mouse:down handling.\n this.canvas.on('mouse:down:before', (opt) => {\n if (this.textMode && !opt.target) {\n const active = this.canvas.getActiveObject();\n this.pendingFinishText =\n active && active.isType('textbox', 'i-text', 'text') ? active : null;\n } else {\n this.pendingFinishText = null;\n }\n });\n // Space-drag panning (only touches the viewport transform).\n this.canvas.on('mouse:down', (opt) => {\n if (this.panMode) {\n this.panLast = { x: opt.viewportPoint.x, y: opt.viewportPoint.y };\n this.canvas.setCursor('grabbing');\n return;\n }\n // Magic wand: a click anywhere reports the scene point to flood-fill erase.\n if (this.magicMode) {\n this.magicListener?.(opt.scenePoint);\n return;\n }\n // Text tool: click empty canvas. If a text box was already placed/active,\n // this click finishes it and hands control back to Select (intuitive — no\n // surprise second box). Otherwise it drops a new text box at that point.\n // `pendingFinishText` is captured in `mouse:down:before` because Fabric has\n // already cleared the active object by the time this `mouse:down` fires.\n if (this.textMode && !opt.target) {\n if (this.pendingFinishText) {\n const itext = this.pendingFinishText as Fabric.IText;\n if (itext.isEditing) {\n itext.exitEditing();\n }\n this.pendingFinishText = null;\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.textFinishListener?.();\n return;\n }\n this.textPlacementListener?.(opt.scenePoint);\n return;\n }\n // Redact tool: click empty canvas to place a marquee (unless one exists,\n // in which case the click just repositions/selects it).\n if (this.redactPlacement && !opt.target && !this.findByRole('redact-marquee')) {\n this.addRedactionMarqueeAt(opt.scenePoint.x, opt.scenePoint.y);\n return;\n }\n // Grab an existing manual guide when clicking empty canvas near its line.\n if (this.rulersEnabled && !opt.target) {\n const guide = this.guideAtViewport(opt.viewportPoint.x, opt.viewportPoint.y);\n if (guide) {\n this.draggingGuideId = guide.id;\n this.canvas.selection = false;\n }\n }\n });\n // Drop a text box that was left empty (e.g. placed then dismissed without\n // typing), so the canvas never accrues invisible empty layers.\n this.canvas.on('text:editing:exited', (e) => {\n const target = (e as { target?: Fabric.FabricObject }).target;\n if (target && typeof target.get('text') === 'string' && target.get('text').trim() === '') {\n this.canvas.remove(target);\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.notifySelection();\n this.notifyLayers();\n } else {\n this.commit('Text');\n }\n });\n this.canvas.on('mouse:move', (opt) => {\n if (this.panMode && this.panLast) {\n const p = opt.viewportPoint;\n this.canvas.relativePan(new this.fabric.Point(p.x - this.panLast.x, p.y - this.panLast.y));\n this.panLast = { x: p.x, y: p.y };\n return;\n }\n if (this.draggingGuideId) {\n this.dragGuideTo(opt.viewportPoint.x, opt.viewportPoint.y);\n return;\n }\n // Resize cursor when hovering a grabbable guide.\n if (this.rulersEnabled && !opt.target) {\n const guide = this.guideAtViewport(opt.viewportPoint.x, opt.viewportPoint.y);\n if (guide) {\n this.canvas.setCursor(guide.orientation === 'h' ? 'row-resize' : 'col-resize');\n }\n }\n });\n this.canvas.on('mouse:up', (opt) => {\n if (this.panMode) {\n this.panLast = null;\n this.canvas.setCursor('grab');\n }\n if (this.draggingGuideId) {\n this.endGuideDrag(opt.viewportPoint.x, opt.viewportPoint.y);\n }\n this.clearGuides();\n });\n // Edge/center snapping with alignment guides while dragging an object.\n this.canvas.on('object:moving', (e) => {\n if (e.target && e.target === this.cropFrame) {\n this.constrainCropFrame();\n return;\n }\n this.applySnap(e.target);\n });\n this.canvas.on('object:scaling', (e) => {\n if (e.target && e.target === this.cropFrame) {\n this.constrainCropFrame();\n }\n });\n this.canvas.on('object:modified', (e) => {\n if (e.target && e.target === this.cropFrame) {\n this.constrainCropFrame();\n return;\n }\n this.clearGuides();\n });\n // The artboard mask, manual guides, and snap guides live on the top (overlay)\n // context, redrawn after every render so they survive Fabric clearing the\n // overlay to repaint selection controls. Mask first, then guides on top.\n this.canvas.on('after:render', () => {\n // Clear stale overlay paint first; during a drag Fabric does not clear the\n // top context between renders, so the mask/thirds would otherwise smear.\n if (this.cropFrame) {\n this.clearOverlay();\n }\n this.drawArtboardMask();\n this.drawGuides();\n this.notifyViewportIfChanged();\n });\n // A freehand stroke becomes a Path on mouse-up — tag it, record it, and\n // surface it as a layer (otherwise drawings would not be undoable).\n this.canvas.on('path:created', (event) => {\n const path = (event as { path?: Fabric.FabricObject }).path;\n if (path) {\n path.set('aspId', this.nextId());\n }\n this.commit('Draw');\n this.notifyLayers();\n });\n // When a web font finishes loading, re-render so any text already set to it\n // updates from its fallback to the real glyphs (font load is async).\n if (typeof document !== 'undefined' && document.fonts) {\n this.onFontsLoaded = (): void => {\n // Drop Fabric's global char-width cache: any metrics measured while the\n // font was still loading were the fallback's and are now wrong. Then\n // recompute each text's bounds so the cursor/selection match the glyphs.\n this.fabric.cache?.clearFontCache?.();\n this.canvas.getObjects().forEach((o) => {\n if (o.isType('textbox', 'i-text', 'text')) {\n (o as Fabric.Textbox).initDimensions?.();\n o.set('dirty', true);\n }\n });\n this.canvas.requestRenderAll();\n };\n document.fonts.addEventListener('loadingdone', this.onFontsLoaded);\n }\n }\n\n private nextId(): string {\n this.idCounter += 1;\n return `o${this.idCounter}`;\n }\n\n /** Register a callback fired when the active selection (and its style) changes. */\n setSelectionListener(cb: (info: SelectionStyleInfo | null) => void): void {\n this.selectionListener = cb;\n }\n\n /** Register a callback fired when the layer set or its state changes. */\n setLayersListener(cb: () => void): void {\n this.layersListener = cb;\n }\n\n private notifyLayers(): void {\n this.layersListener?.();\n }\n\n private notifySelection(): void {\n const active = this.canvas.getActiveObject();\n this.selectionListener?.(active ? this.describeSelection(active) : null);\n }\n\n private describeSelection(object: Fabric.FabricObject): SelectionStyleInfo {\n if (object.isType('textbox', 'i-text', 'text')) {\n const fill = object.get('fill');\n const fontSize = object.get('fontSize');\n const weight = object.get('fontWeight');\n const align = object.get('textAlign');\n const family = object.get('fontFamily');\n return {\n kind: 'text',\n color: typeof fill === 'string' ? fill : '#000000',\n size: typeof fontSize === 'number' ? fontSize : 24,\n textStyle: {\n bold: weight === 'bold' || weight === 700,\n italic: object.get('fontStyle') === 'italic',\n underline: object.get('underline') === true,\n strike: object.get('linethrough') === true,\n align: typeof align === 'string' ? align : 'left',\n fontFamily: typeof family === 'string' ? family : '',\n },\n };\n }\n let target = object;\n if (object.isType('group', 'activeselection')) {\n const children = (object as Fabric.Group).getObjects();\n target = children.find((c) => typeof c.get('stroke') === 'string') ?? children[0] ?? object;\n }\n const stroke = target.get('stroke');\n const fill = target.get('fill');\n const strokeWidth = target.get('strokeWidth');\n const base: SelectionStyleInfo = {\n kind: 'stroke',\n color: typeof stroke === 'string' ? stroke : typeof fill === 'string' ? fill : '#000000',\n size: typeof strokeWidth === 'number' ? strokeWidth : 4,\n };\n // A single selected rectangle also exposes its corner radius so the Shapes\n // panel can show (and drive) the sharp → pill slider.\n if (object.isType('rect')) {\n const w = (object.width ?? 0) * (object.scaleX ?? 1);\n const h = (object.height ?? 0) * (object.scaleY ?? 1);\n const rx = object.get('rx');\n return {\n ...base,\n cornerRadius: typeof rx === 'number' ? rx * (object.scaleX ?? 1) : 0,\n cornerRadiusMax: maxCornerRadius(w, h),\n };\n }\n return base;\n }\n\n /**\n * Set the corner radius of the currently selected rectangle. The value is in\n * on-screen pixels and is clamped to the rectangle's pill cap. No-op (returns\n * false) when the selection is not a single rectangle. Pass `commit: false`\n * for live slider drags; commit once on release.\n */\n setSelectedCornerRadius(radius: number, commit = true): boolean {\n const active = this.canvas.getActiveObject();\n if (!active || !active.isType('rect')) {\n return false;\n }\n // rx/ry live in unscaled object space; convert the on-screen request back.\n const scaleX = active.scaleX ?? 1;\n const scaleY = active.scaleY ?? 1;\n const w = (active.width ?? 0) * scaleX;\n const h = (active.height ?? 0) * scaleY;\n const screenRadius = clampCornerRadius(radius, w, h);\n active.set({ rx: screenRadius / scaleX, ry: screenRadius / scaleY });\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Corner radius');\n }\n this.notifySelection();\n return true;\n }\n\n /**\n * Apply a color and/or size to the currently selected object(s), routing by\n * object type (text → fill/fontSize, shapes & paths → stroke/strokeWidth, and\n * recursing into groups such as arrows). Returns false if nothing is selected.\n * Pass `commit: false` for live slider drags; commit once on release.\n */\n styleActiveObject(\n style: { color?: string; size?: number; fontFamily?: string },\n commit = true,\n ): boolean {\n const active = this.canvas.getActiveObject();\n if (!active) {\n return false;\n }\n this.styleOne(active, style);\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Restyle');\n }\n this.notifySelection();\n return true;\n }\n\n private styleOne(\n object: Fabric.FabricObject,\n style: { color?: string; size?: number; fontFamily?: string },\n ): void {\n if (object.isType('group', 'activeselection')) {\n for (const child of (object as Fabric.Group).getObjects()) {\n this.styleOne(child, style);\n }\n return;\n }\n const isText = object.isType('textbox', 'i-text', 'text');\n if (style.color !== undefined) {\n if (isText || typeof object.get('stroke') !== 'string') {\n object.set('fill', style.color);\n } else {\n object.set('stroke', style.color);\n }\n }\n if (style.size !== undefined) {\n if (isText) {\n object.set('fontSize', Math.max(6, style.size));\n } else {\n object.set('strokeWidth', style.size);\n }\n }\n if (style.fontFamily !== undefined && isText) {\n object.set('fontFamily', style.fontFamily);\n // Drop any cached char widths for this family and re-measure, so the\n // change shows even if the family was set before the web font loaded.\n this.fabric.cache?.clearFontCache?.(style.fontFamily);\n const textbox = object as Fabric.Textbox;\n textbox.initDimensions?.();\n object.set('dirty', true);\n }\n object.setCoords();\n }\n\n // ---- snapping & alignment guides ----------------------------------------\n\n /** Enable/disable edge & center snapping. Clears any visible guides when off. */\n setSnapping(enabled: boolean): void {\n this.snapEnabled = enabled;\n if (!enabled) {\n this.clearGuides();\n }\n }\n\n /** Scene-space bounding box of an object from its absolute corner coords. */\n private sceneBox(object: Fabric.FabricObject): SceneBox {\n object.setCoords();\n const c = object.aCoords;\n const xs = [c.tl.x, c.tr.x, c.bl.x, c.br.x];\n const ys = [c.tl.y, c.tr.y, c.bl.y, c.br.y];\n const left = Math.min(...xs);\n const right = Math.max(...xs);\n const top = Math.min(...ys);\n const bottom = Math.max(...ys);\n return { left, top, right, bottom, cx: (left + right) / 2, cy: (top + bottom) / 2 };\n }\n\n /**\n * Nudge a dragged object so a near edge/center aligns to the canvas or another\n * object, and record the guide lines to draw. Snap threshold is constant in\n * *screen* pixels (zoom-aware) so it feels the same at any zoom.\n */\n private applySnap(target?: Fabric.FabricObject): void {\n if (!target || !this.snapEnabled) {\n this.activeGuides = [];\n return;\n }\n const threshold = EditorEngine.SNAP_PX / this.canvas.getZoom();\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const box = this.sceneBox(target);\n\n // Candidate lines to snap to: canvas edges/center plus every other object's\n // edges/centers. The redaction marquee is transient and never a snap target.\n const xLines = [0, cw / 2, cw];\n const yLines = [0, ch / 2, ch];\n for (const other of this.canvas.getObjects()) {\n if (other === target || other.get('aspRole') === 'redact-marquee') {\n continue;\n }\n const ob = this.sceneBox(other);\n xLines.push(ob.left, ob.cx, ob.right);\n yLines.push(ob.top, ob.cy, ob.bottom);\n }\n // User-placed guides are snap targets too.\n for (const guide of this.manualGuides) {\n (guide.orientation === 'v' ? xLines : yLines).push(guide.pos);\n }\n\n const snapX = this.bestSnap([box.left, box.cx, box.right], xLines, threshold);\n const snapY = this.bestSnap([box.top, box.cy, box.bottom], yLines, threshold);\n\n const guides: GuideLine[] = [];\n if (snapX) {\n target.set('left', (target.left ?? 0) + snapX.delta);\n guides.push({ x1: snapX.line, y1: 0, x2: snapX.line, y2: ch });\n }\n if (snapY) {\n target.set('top', (target.top ?? 0) + snapY.delta);\n guides.push({ x1: 0, y1: snapY.line, x2: cw, y2: snapY.line });\n }\n if (snapX || snapY) {\n target.setCoords();\n }\n this.activeGuides = guides;\n }\n\n /** Pick the smallest within-threshold offset from any anchor to any line. */\n private bestSnap(\n anchors: readonly number[],\n lines: readonly number[],\n threshold: number,\n ): { delta: number; line: number } | null {\n let best: { delta: number; line: number } | null = null;\n for (const anchor of anchors) {\n for (const line of lines) {\n const delta = line - anchor;\n if (Math.abs(delta) <= threshold && (!best || Math.abs(delta) < Math.abs(best.delta))) {\n best = { delta, line };\n }\n }\n }\n return best;\n }\n\n /** Paint active guides onto the overlay context, mapped through the viewport. */\n private drawGuides(): void {\n if (!this.activeGuides.length) {\n return;\n }\n const ctx = this.canvas.contextTop;\n if (!ctx) {\n return;\n }\n const vpt = this.canvas.viewportTransform;\n ctx.save();\n ctx.lineWidth = 1;\n ctx.strokeStyle = '#ff2d78';\n ctx.setLineDash([5, 4]);\n for (const g of this.activeGuides) {\n const p1 = this.fabric.util.transformPoint(new this.fabric.Point(g.x1, g.y1), vpt);\n const p2 = this.fabric.util.transformPoint(new this.fabric.Point(g.x2, g.y2), vpt);\n ctx.beginPath();\n ctx.moveTo(p1.x, p1.y);\n ctx.lineTo(p2.x, p2.y);\n ctx.stroke();\n }\n ctx.restore();\n }\n\n /** Drop the guides and repaint so the overlay is clean. */\n private clearGuides(): void {\n if (!this.activeGuides.length) {\n return;\n }\n this.activeGuides = [];\n this.clearOverlay();\n this.canvas.requestRenderAll();\n }\n\n /**\n * Erase the overlay (top) context. `contextTop` can be momentarily undefined\n * outside a render cycle, so this guards before touching it; clearing by the\n * backing canvas's pixel size is correct regardless of retina scaling.\n */\n private clearOverlay(): void {\n const ctx = this.canvas.contextTop;\n if (ctx) {\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n }\n }\n\n // ---- rulers & manual guides ---------------------------------------------\n\n /** Register a callback fired when the view transform or canvas size changes. */\n setViewportListener(cb: () => void): void {\n this.viewportListener = cb;\n }\n\n /** Register a callback fired when manual guides (or the live draft) change. */\n setGuidesListener(cb: () => void): void {\n this.guidesListener = cb;\n }\n\n private notifyGuides(): void {\n this.guidesListener?.();\n }\n\n /** Current view transform + canvas size, in CSS pixels / scene units. */\n getViewport(): Viewport {\n const vpt = this.canvas.viewportTransform;\n return {\n zoom: vpt[0],\n panX: vpt[4],\n panY: vpt[5],\n width: this.canvas.getWidth(),\n height: this.canvas.getHeight(),\n };\n }\n\n private notifyViewportIfChanged(): void {\n if (!this.viewportListener) {\n return;\n }\n const v = this.getViewport();\n const key = `${v.zoom}|${v.panX}|${v.panY}|${v.width}|${v.height}`;\n if (key !== this.lastViewportKey) {\n this.lastViewportKey = key;\n this.viewportListener();\n }\n }\n\n /** Show/hide rulers; when off, an in-progress guide draft is dropped. */\n setRulersEnabled(enabled: boolean): void {\n this.rulersEnabled = enabled;\n if (!enabled) {\n this.guideDraft = null;\n }\n this.notifyGuides();\n }\n\n isRulersEnabled(): boolean {\n return this.rulersEnabled;\n }\n\n getManualGuides(): readonly ManualGuide[] {\n return this.manualGuides;\n }\n\n /** The live guide preview during a ruler drag, or null. */\n getGuideDraft(): ManualGuide | null {\n return this.guideDraft;\n }\n\n /** Map a viewport (screen, CSS-px) point to scene coordinates. */\n viewportToScene(vx: number, vy: number): { x: number; y: number } {\n const vpt = this.canvas.viewportTransform;\n // vpt = [scaleX, skewY, skewX, scaleY, panX, panY]; divide by the *scale*\n // components (indices 0 and 3), not the skew components (1 and 2).\n return { x: (vx - vpt[4]) / vpt[0], y: (vy - vpt[5]) / vpt[3] };\n }\n\n /** Map a client (page) point to canvas viewport (CSS-px) coordinates. */\n clientToViewport(clientX: number, clientY: number): { x: number; y: number } {\n const rect = this.canvas.getElement().getBoundingClientRect();\n return { x: clientX - rect.left, y: clientY - rect.top };\n }\n\n /**\n * Show a live guide preview at a scene position (during a ruler drag).\n * Pass `null` to clear the preview. Does not touch history.\n */\n setGuideDraft(orientation: 'h' | 'v', scenePos: number | null): void {\n this.guideDraft =\n scenePos === null ? null : { id: 'draft', orientation, pos: Math.round(scenePos) };\n this.notifyGuides();\n }\n\n /** Commit a new manual guide at a scene position and record it in history. */\n addManualGuide(orientation: 'h' | 'v', scenePos: number): void {\n this.guideDraft = null;\n this.guideIdCounter += 1;\n this.manualGuides = [\n ...this.manualGuides,\n { id: `g${this.guideIdCounter}`, orientation, pos: Math.round(scenePos) },\n ];\n this.notifyGuides();\n this.commit('Add guide');\n }\n\n /** Remove every manual guide and record it in history (no-op if already empty). */\n clearManualGuides(): void {\n if (this.manualGuides.length === 0) {\n return;\n }\n this.manualGuides = [];\n this.notifyGuides();\n this.commit('Clear guides');\n }\n\n /** The manual guide whose line is within grab range of a screen point, or null. */\n private guideAtViewport(vx: number, vy: number): ManualGuide | null {\n const zoom = this.canvas.getZoom();\n const threshold = EditorEngine.GUIDE_GRAB_PX;\n const scene = this.viewportToScene(vx, vy);\n let best: ManualGuide | null = null;\n let bestDist = threshold;\n for (const guide of this.manualGuides) {\n const distScene = guide.orientation === 'h' ? scene.y - guide.pos : scene.x - guide.pos;\n const distPx = Math.abs(distScene) * zoom;\n if (distPx <= bestDist) {\n bestDist = distPx;\n best = guide;\n }\n }\n return best;\n }\n\n /** Live-move the guide being dragged to the scene coordinate under the pointer. */\n private dragGuideTo(vx: number, vy: number): void {\n if (!this.draggingGuideId) {\n return;\n }\n const scene = this.viewportToScene(vx, vy);\n this.manualGuides = this.manualGuides.map((g) => {\n if (g.id !== this.draggingGuideId) {\n return g;\n }\n const pos = Math.round(g.orientation === 'h' ? scene.y : scene.x);\n return { ...g, pos };\n });\n this.canvas.setCursor('grabbing');\n this.notifyGuides();\n }\n\n /**\n * Finish a guide drag. Dropping the line outside the canvas removes it;\n * otherwise the move is committed to history. Restores object selection.\n */\n private endGuideDrag(vx: number, vy: number): void {\n const id = this.draggingGuideId;\n this.draggingGuideId = null;\n this.canvas.selection = true;\n if (!id) {\n return;\n }\n const outside = vx < 0 || vy < 0 || vx > this.canvas.getWidth() || vy > this.canvas.getHeight();\n if (outside) {\n this.manualGuides = this.manualGuides.filter((g) => g.id !== id);\n this.notifyGuides();\n this.commit('Remove guide');\n } else {\n this.notifyGuides();\n this.commit('Move guide');\n }\n }\n\n // ---- artboard / output size ---------------------------------------------\n\n /**\n * Set (or clear) the artboard — a fixed output region. Content outside the\n * region is dimmed on screen and excluded from raster/PDF export, which is\n * rendered at exactly the artboard's pixel dimensions. `null` exports the\n * whole canvas (the default).\n */\n setArtboard(size: ArtboardSize | null): void {\n this.artboard = size && size.width > 0 && size.height > 0 ? size : null;\n this.clearOverlay();\n // Render synchronously so the overlay (top) context is realized this frame\n // and the mask repaints immediately, rather than on a later deferred render.\n this.canvas.renderAll();\n }\n\n getArtboard(): ArtboardSize | null {\n return this.artboard;\n }\n\n // ---- interactive crop ----------------------------------------------------\n\n /** True while the interactive crop frame is on the canvas. */\n isCropping(): boolean {\n return this.cropFrame !== null;\n }\n\n /** True once a crop region has been applied (drives the dim mask + export). */\n hasCropRegion(): boolean {\n return this.cropRegion !== null;\n }\n\n /**\n * Begin an interactive crop. Drops a draggable, resizable frame over the canvas\n * (rule-of-thirds + dimmed surroundings), starting from any existing crop region\n * or a centered default for the given aspect `ratio` (null = free). The rest of\n * the scene is made non-interactive until {@link applyCropRegion} or\n * {@link cancelCrop}.\n */\n beginCrop(ratio: number | null): void {\n if (this.cropFrame) {\n this.setCropRatio(ratio);\n return;\n }\n this.cropRatio = ratio;\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const start = applyRatio(this.cropRegion ?? defaultCropFrame(cw, ch, ratio), ratio, cw, ch);\n\n this.canvas.discardActiveObject();\n this.cropPrevState.clear();\n for (const o of this.canvas.getObjects()) {\n this.cropPrevState.set(o, { selectable: o.selectable ?? true, evented: o.evented ?? true });\n o.selectable = false;\n o.evented = false;\n }\n this.cropPrevUniformScaling = this.canvas.uniformScaling ?? true;\n this.canvas.uniformScaling = ratio !== null;\n\n const frame = new this.fabric.Rect({\n left: start.left,\n top: start.top,\n width: start.width,\n height: start.height,\n originX: 'left',\n originY: 'top',\n // Near-zero alpha fill so the interior is grabbable for moving the frame.\n fill: 'rgba(0,0,0,0.001)',\n stroke: '#ffffff',\n strokeWidth: 1,\n strokeUniform: true,\n cornerColor: '#ffffff',\n cornerStrokeColor: '#1f6feb',\n transparentCorners: false,\n cornerSize: 12,\n borderColor: 'rgba(255,255,255,0.9)',\n lockRotation: true,\n objectCaching: false,\n });\n frame.set('aspId', 'cropframe');\n frame.set('excludeFromExport', true);\n this.applyCropControls(frame, ratio);\n frame.setControlsVisibility({ mtr: false });\n this.cropFrame = frame;\n this.canvas.add(frame);\n this.canvas.setActiveObject(frame);\n this.canvas.renderAll();\n }\n\n /** Reshape the active crop frame to a new aspect `ratio` (null = free). */\n setCropRatio(ratio: number | null): void {\n this.cropRatio = ratio;\n const f = this.cropFrame;\n if (!f) {\n return;\n }\n this.canvas.uniformScaling = ratio !== null;\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const rect = applyRatio(this.cropFrameRect() ?? defaultCropFrame(cw, ch, ratio), ratio, cw, ch);\n f.set({ left: rect.left, top: rect.top, width: rect.width, height: rect.height, scaleX: 1, scaleY: 1 });\n this.applyCropControls(f, ratio);\n f.setCoords();\n this.canvas.renderAll();\n }\n\n /** Only corner handles when an aspect ratio is locked; all handles when free. */\n private applyCropControls(frame: Fabric.Rect, ratio: number | null): void {\n const free = ratio === null;\n frame.setControlsVisibility({\n tl: true,\n tr: true,\n bl: true,\n br: true,\n ml: free,\n mr: free,\n mt: free,\n mb: free,\n });\n }\n\n /** Keep the dragged/resized crop frame within the canvas (and on-ratio). */\n private constrainCropFrame(): void {\n const f = this.cropFrame;\n if (!f) {\n return;\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const raw: FrameRect = {\n left: f.left ?? 0,\n top: f.top ?? 0,\n width: (f.width ?? 0) * (f.scaleX ?? 1),\n height: (f.height ?? 0) * (f.scaleY ?? 1),\n };\n const rect = this.cropRatio ? applyRatio(raw, this.cropRatio, cw, ch) : clampFrame(raw, cw, ch);\n f.set({ left: rect.left, top: rect.top, width: rect.width, height: rect.height, scaleX: 1, scaleY: 1 });\n f.setCoords();\n this.canvas.requestRenderAll();\n }\n\n /** Commit the crop frame as the output region and end the session. */\n applyCropRegion(): void {\n const rect = this.cropFrameRect();\n this.endCropSession();\n if (rect) {\n this.cropRegion = rect;\n // A crop region supersedes a centered artboard preset.\n this.artboard = null;\n }\n this.clearOverlay();\n this.canvas.renderAll();\n }\n\n /** End the crop session without applying (the previous region is kept). */\n cancelCrop(): void {\n this.endCropSession();\n this.clearOverlay();\n this.canvas.renderAll();\n }\n\n /** Clear any committed crop region (back to the full canvas). */\n clearCropRegion(): void {\n this.cropRegion = null;\n this.clearOverlay();\n this.canvas.renderAll();\n }\n\n /** Remove the crop frame and restore the rest of the scene's interactivity. */\n private endCropSession(): void {\n const frame = this.cropFrame;\n this.cropFrame = null;\n if (frame) {\n this.canvas.remove(frame);\n }\n this.canvas.uniformScaling = this.cropPrevUniformScaling;\n for (const [o, state] of this.cropPrevState) {\n o.selectable = state.selectable;\n o.evented = state.evented;\n }\n this.cropPrevState.clear();\n this.canvas.discardActiveObject();\n }\n\n /**\n * The artboard's on-canvas rectangle in scene coordinates: the largest\n * centered rectangle of the artboard's aspect ratio that fits the canvas.\n * Returns null when no artboard is set.\n */\n private artboardRect(): { left: number; top: number; width: number; height: number } | null {\n if (!this.artboard) {\n return null;\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const ar = this.artboard.width / this.artboard.height;\n let width = cw;\n let height = cw / ar;\n if (height > ch) {\n height = ch;\n width = ch * ar;\n }\n return { left: (cw - width) / 2, top: (ch - height) / 2, width, height };\n }\n\n /** Render the output region to a data URL at its target pixel size. */\n private artboardDataUrl(format: 'png' | 'jpeg' | 'webp', quality: number): string {\n const rect = this.outputRect();\n if (!rect) {\n return this.canvas.toDataURL({ format, quality, multiplier: 1 });\n }\n // A centered artboard targets its preset pixel width; a crop region exports at\n // scene resolution (multiplier 1).\n const multiplier = !this.cropRegion && this.artboard ? this.artboard.width / rect.width : 1;\n return this.canvas.toDataURL({\n format,\n quality,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n multiplier,\n });\n }\n\n /** Output pixel size of the current region (crop region in scene px, else artboard preset). */\n private outputSize(): { width: number; height: number } | null {\n if (this.cropRegion) {\n return {\n width: Math.round(this.cropRegion.width),\n height: Math.round(this.cropRegion.height),\n };\n }\n return this.artboard;\n }\n\n /**\n * Dim the canvas outside the current output region and outline it, on the\n * overlay context. During an interactive crop the region is the live crop\n * frame (with a rule-of-thirds grid and no extra outline, since Fabric draws\n * the frame and its handles); otherwise it is the committed crop/artboard.\n */\n private drawArtboardMask(): void {\n const cropping = this.cropFrame !== null;\n const rect = cropping ? this.cropFrameRect() : this.outputRect();\n if (!rect) {\n return;\n }\n const ctx = this.canvas.contextTop;\n if (!ctx) {\n return;\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const vpt = this.canvas.viewportTransform;\n const tl = this.fabric.util.transformPoint(new this.fabric.Point(rect.left, rect.top), vpt);\n const br = this.fabric.util.transformPoint(\n new this.fabric.Point(rect.left + rect.width, rect.top + rect.height),\n vpt,\n );\n const x = tl.x;\n const y = tl.y;\n const w = br.x - tl.x;\n const h = br.y - tl.y;\n ctx.save();\n // Dim the four bands around the region (not a composite punch-through, so it\n // is independent of any prior overlay content).\n ctx.fillStyle = 'rgba(17, 21, 30, 0.46)';\n ctx.fillRect(0, 0, cw, y);\n ctx.fillRect(0, y + h, cw, ch - (y + h));\n ctx.fillRect(0, y, x, h);\n ctx.fillRect(x + w, y, cw - (x + w), h);\n if (cropping) {\n // Rule-of-thirds grid; the frame's own stroke + Fabric handles are the outline.\n ctx.strokeStyle = 'rgba(255, 255, 255, 0.5)';\n ctx.lineWidth = 1;\n ctx.setLineDash([]);\n for (let i = 1; i <= 2; i += 1) {\n const gx = x + (w * i) / 3;\n const gy = y + (h * i) / 3;\n ctx.beginPath();\n ctx.moveTo(gx, y);\n ctx.lineTo(gx, y + h);\n ctx.moveTo(x, gy);\n ctx.lineTo(x + w, gy);\n ctx.stroke();\n }\n } else {\n // Two-tone outline reads on any background.\n ctx.lineWidth = 1;\n ctx.strokeStyle = 'rgba(0, 0, 0, 0.45)';\n ctx.setLineDash([]);\n ctx.strokeRect(x + 0.5, y + 0.5, w - 1, h - 1);\n ctx.strokeStyle = '#ffffff';\n ctx.setLineDash([5, 4]);\n ctx.strokeRect(x + 0.5, y + 0.5, w - 1, h - 1);\n }\n ctx.restore();\n }\n\n /** The current output region (committed crop, else centered artboard), scene coords. */\n private outputRect(): FrameRect | null {\n if (this.cropRegion) {\n return this.cropRegion;\n }\n return this.artboardRect();\n }\n\n /** The live crop frame's rectangle in scene coordinates (bakes its scale). */\n private cropFrameRect(): FrameRect | null {\n const f = this.cropFrame;\n if (!f) {\n return null;\n }\n return {\n left: f.left ?? 0,\n top: f.top ?? 0,\n width: (f.width ?? 0) * (f.scaleX ?? 1),\n height: (f.height ?? 0) * (f.scaleY ?? 1),\n };\n }\n\n /** Create an engine bound to a `<canvas>` element. */\n static async create(canvasEl: HTMLCanvasElement, options: EngineOptions): Promise<EditorEngine> {\n const fabric = await loadFabric();\n const canvas = new fabric.Canvas(canvasEl, {\n width: options.width,\n height: options.height,\n preserveObjectStacking: true,\n backgroundColor: undefined,\n selection: true,\n });\n return new EditorEngine(fabric, canvas);\n }\n\n // ---- image loading -------------------------------------------------------\n\n /**\n * Resolve an import source into a canvas-ready URL.\n *\n * - SVG → rasterized at high resolution (Fabric's vector parser mangles complex\n * SVGs and a raw `<img>` misreads their intrinsic size).\n * - Blob / data URL → decoded with EXIF orientation and downscaled, converting\n * formats the browser can't decode natively (HEIC/HEIF). Throws a descriptive\n * error on undecodable input rather than silently yielding nothing.\n * - Remote URL → returned as-is and left to Fabric, since canvas-resampling a\n * cross-origin image would taint it.\n */\n private async resolveImportUrl(src: string | Blob): Promise<string> {\n const svgText = await svgTextFrom(src);\n if (svgText) {\n return rasterizeSvg(svgText, MAX_IMPORT_DIM);\n }\n if (typeof src === 'string') {\n return src.startsWith('data:')\n ? decodeImageBlob(dataUrlToBlob(src), MAX_IMPORT_DIM)\n : src;\n }\n return decodeImageBlob(src, MAX_IMPORT_DIM, (src as File).name ?? '');\n }\n\n /**\n * Load an image from a URL or Blob, fit it to the canvas, and reset history.\n *\n * A Blob is first decoded into a data URL so the image's serialized `src`\n * survives in history snapshots (a transient object URL would be revoked and\n * break undo).\n */\n async loadImage(src: string | Blob): Promise<void> {\n const url = await this.resolveImportUrl(src);\n const loadOptions = url.startsWith('data:') ? {} : { crossOrigin: 'anonymous' as const };\n const image = await this.fabric.FabricImage.fromURL(url, loadOptions, {});\n if (!image.width || !image.height) {\n throw new Error('The image could not be loaded.');\n }\n this.canvas.remove(...this.canvas.getObjects());\n this.baseImage = image;\n this.rotation = 0;\n this.straighten = 0;\n this.zoomPct = 100;\n this.adjustments = defaultAdjustments();\n this.looks.clear();\n this.frame = 'none';\n image.set({ selectable: false, evented: false, hasControls: false });\n image.set('aspId', 'base');\n this.fitBaseImage();\n this.canvas.add(image);\n this.canvas.setZoom(1);\n this.canvas.requestRenderAll();\n this.history.reset('Opened image', this.snapshot());\n }\n\n get hasImage(): boolean {\n return this.baseImage !== null;\n }\n\n private fitBaseImage(): void {\n const image = this.baseImage;\n if (!image) {\n return;\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const iw = image.width ?? 1;\n const ih = image.height ?? 1;\n const scale = Math.min(cw / iw, ch / ih) * FIT_PADDING;\n image.set({\n originX: 'center',\n originY: 'center',\n left: cw / 2,\n top: ch / 2,\n scaleX: scale,\n scaleY: scale,\n angle: this.rotation + this.straighten,\n });\n image.setCoords();\n }\n\n // ---- transforms ----------------------------------------------------------\n\n /** Rotate the image by a signed multiple of 90°. */\n rotateBy(deg: number): void {\n this.rotation = (((this.rotation + deg) % 360) + 360) % 360;\n this.applyAngle();\n this.commit(deg > 0 ? 'Rotate right' : 'Rotate left');\n }\n\n /** Fine straighten angle, −45..45°. */\n setStraighten(deg: number, commit = false): void {\n this.straighten = clamp(deg, -45, 45);\n this.applyAngle();\n if (commit) {\n this.commit('Straighten');\n }\n }\n\n private applyAngle(): void {\n this.baseImage?.set({ angle: this.rotation + this.straighten });\n this.baseImage?.setCoords();\n this.canvas.requestRenderAll();\n }\n\n /** Flip the image horizontally or vertically. */\n flip(axis: 'h' | 'v'): void {\n const image = this.baseImage;\n if (!image) {\n return;\n }\n if (axis === 'h') {\n image.set({ flipX: !image.flipX });\n } else {\n image.set({ flipY: !image.flipY });\n }\n this.canvas.requestRenderAll();\n this.commit(`Flip ${axis.toUpperCase()}`);\n }\n\n // ---- zoom ----------------------------------------------------------------\n\n get zoom(): number {\n return this.zoomPct;\n }\n\n setZoom(pct: number): void {\n this.zoomPct = clamp(Math.round(pct), ZOOM_MIN, ZOOM_MAX);\n const center = new this.fabric.Point(this.canvas.getWidth() / 2, this.canvas.getHeight() / 2);\n this.canvas.zoomToPoint(center, this.zoomPct / 100);\n this.canvas.requestRenderAll();\n }\n\n zoomBy(deltaPct: number): void {\n this.setZoom(this.zoomPct + deltaPct);\n }\n\n resetView(): void {\n this.zoomPct = 100;\n this.canvas.setZoom(1);\n this.canvas.setViewportTransform([1, 0, 0, 1, 0, 0]);\n this.canvas.requestRenderAll();\n }\n\n // ---- crop ----------------------------------------------------------------\n\n /** Crop the base image to a centered rectangle of the given aspect preset. */\n applyCrop(preset: AspAspectPreset): void {\n const image = this.baseImage;\n if (!image) {\n return;\n }\n const naturalW = (image.width ?? 0) + (image.cropX ?? 0);\n const naturalH = (image.height ?? 0) + (image.cropY ?? 0);\n this.applyCropRatio(aspectRatioValue(preset, naturalW, naturalH));\n }\n\n /**\n * Crop the base image to a centered rectangle of an arbitrary width/height\n * ratio (`null` = full image). Use this for host-defined / CMS aspect targets.\n */\n applyCropRatio(ratio: number | null): void {\n const image = this.baseImage;\n if (!image) {\n return;\n }\n const naturalW = (image.width ?? 0) + (image.cropX ?? 0);\n const naturalH = (image.height ?? 0) + (image.cropY ?? 0);\n const rect = centeredCropRect(naturalW, naturalH, ratio);\n image.set({ cropX: rect.left, cropY: rect.top, width: rect.width, height: rect.height });\n this.fitBaseImage();\n this.canvas.requestRenderAll();\n this.commit('Crop');\n }\n\n // ---- color: adjustments + looks -----------------------------------------\n\n /** Merge adjustment values and re-render. Pass `commit` on slider release. */\n setAdjustments(values: Partial<Record<AspFilter, number>>, commit = false): void {\n this.adjustments = { ...this.adjustments, ...values };\n this.rebuildFilters();\n if (commit) {\n this.commit('Adjust');\n }\n }\n\n /** Toggle a one-tap look filter (grayscale/sepia/invert/sharpen). */\n toggleLook(look: AspFilter): void {\n if (!LOOK_FILTERS.includes(look)) {\n return;\n }\n if (this.looks.has(look)) {\n this.looks.delete(look);\n } else {\n this.looks.add(look);\n }\n this.rebuildFilters();\n this.commit(`Filter: ${FILTER_REGISTRY[look].label}`);\n }\n\n isLookActive(look: AspFilter): boolean {\n return this.looks.has(look);\n }\n\n getAdjustment(key: AspFilter): number {\n return this.adjustments[key];\n }\n\n private rebuildFilters(): void {\n const image = this.baseImage;\n if (!image) {\n return;\n }\n image.filters = buildFabricFilters(this.fabric, this.adjustments, this.looks);\n image.applyFilters();\n this.canvas.requestRenderAll();\n }\n\n // ---- annotations ---------------------------------------------------------\n\n /** Add a shape at the canvas center. */\n addShape(kind: ShapeKind, style: AnnotationStyle): void {\n const cx = this.canvas.getWidth() / 2;\n const cy = this.canvas.getHeight() / 2;\n const common = {\n left: cx,\n top: cy,\n originX: 'center' as const,\n originY: 'center' as const,\n stroke: style.color,\n strokeWidth: style.strokeWidth,\n fill: 'transparent',\n };\n let object: Fabric.FabricObject;\n switch (kind) {\n case 'rect': {\n const radius = clampCornerRadius(style.cornerRadius ?? 0, 160, 110);\n object = new this.fabric.Rect({ ...common, width: 160, height: 110, rx: radius, ry: radius });\n break;\n }\n case 'ellipse':\n object = new this.fabric.Ellipse({ ...common, rx: 90, ry: 60 });\n break;\n case 'line':\n object = new this.fabric.Line([cx - 90, cy, cx + 90, cy], {\n stroke: style.color,\n strokeWidth: style.strokeWidth,\n originX: 'center',\n originY: 'center',\n });\n break;\n case 'arrow':\n object = this.buildArrow(cx, cy, style);\n break;\n case 'triangle':\n object = new this.fabric.Triangle({ ...common, width: 150, height: 130 });\n break;\n case 'diamond':\n object = new this.fabric.Polygon(polygonPoints(4, 80), common);\n break;\n case 'pentagon':\n object = new this.fabric.Polygon(polygonPoints(5, 80), common);\n break;\n case 'hexagon':\n object = new this.fabric.Polygon(polygonPoints(6, 80), common);\n break;\n case 'star':\n object = new this.fabric.Polygon(starPoints(5, 85, 38), common);\n break;\n default:\n return;\n }\n object.set('aspId', this.nextId());\n this.canvas.add(object);\n this.canvas.setActiveObject(object);\n this.canvas.requestRenderAll();\n this.commit('Add shape');\n this.notifySelection();\n }\n\n private buildArrow(cx: number, cy: number, style: AnnotationStyle): Fabric.FabricObject {\n const line = new this.fabric.Line([-90, 0, 70, 0], {\n stroke: style.color,\n strokeWidth: style.strokeWidth,\n });\n const head = new this.fabric.Triangle({\n left: 70,\n top: 0,\n originX: 'center',\n originY: 'center',\n angle: 90,\n width: style.strokeWidth * 4 + 8,\n height: style.strokeWidth * 4 + 8,\n fill: style.color,\n });\n return new this.fabric.Group([line, head], {\n left: cx,\n top: cy,\n originX: 'center',\n originY: 'center',\n });\n }\n\n /** Add an editable text box at the canvas center. */\n addText(text: string, style: TextStyle): void {\n this.placeText(text, this.canvas.getWidth() / 2, this.canvas.getHeight() / 2, style, false);\n }\n\n /**\n * Enable/disable the \"click to place text\" mode (the Text tool). While on, the\n * cursor is a text caret and clicking empty canvas drops an editable box.\n */\n setTextMode(enabled: boolean): void {\n this.textMode = enabled;\n this.canvas.defaultCursor = enabled ? 'text' : 'default';\n }\n\n /** Register the callback fired with a scene point when text mode is clicked. */\n setTextPlacementListener(cb: (point: { x: number; y: number }) => void): void {\n this.textPlacementListener = cb;\n }\n\n /** Enable/disable magic-wand mode (a canvas click flood-fill erases a region). */\n setMagicMode(enabled: boolean): void {\n this.magicMode = enabled;\n this.canvas.defaultCursor = enabled ? 'crosshair' : 'default';\n }\n\n /** Register the callback fired with a scene point when magic mode is clicked. */\n setMagicListener(cb: (point: { x: number; y: number }) => void): void {\n this.magicListener = cb;\n }\n\n /**\n * Register the callback fired when an empty-canvas click in text mode finishes\n * an already-placed text (so the host can switch back to the Select tool).\n */\n setTextFinishListener(cb: () => void): void {\n this.textFinishListener = cb;\n }\n\n /**\n * Add a text box at a scene point and immediately enter in-place editing with\n * the placeholder pre-selected, so the user just starts typing (Photoshop-style).\n */\n addTextAt(x: number, y: number, style: TextStyle): void {\n this.placeText('Your text', x, y, style, true);\n }\n\n private placeText(\n text: string,\n x: number,\n y: number,\n style: TextStyle,\n edit: boolean,\n ): void {\n const textbox = new this.fabric.Textbox(text, {\n left: x,\n top: y,\n originX: 'center',\n originY: 'center',\n fontSize: style.fontSize,\n fill: style.color,\n fontFamily: style.fontFamily ?? 'system-ui, sans-serif',\n width: 220,\n textAlign: 'center',\n });\n textbox.set('aspId', this.nextId());\n this.canvas.add(textbox);\n this.canvas.setActiveObject(textbox);\n if (edit) {\n // Enter editing with the placeholder selected so the first keystroke\n // replaces it. History is recorded on editing-exit (and an untouched,\n // empty box is discarded there), so we don't commit the placement itself.\n textbox.enterEditing();\n textbox.selectAll();\n } else {\n this.commit('Add text');\n }\n this.canvas.requestRenderAll();\n this.notifySelection();\n }\n\n /**\n * Add a movable/resizable redaction marquee centered on the canvas. The user\n * positions it over the area to conceal; transient until {@link applyRedaction}\n * bakes it.\n */\n addRedactionMarquee(): void {\n this.addRedactionMarqueeAt(this.canvas.getWidth() / 2, this.canvas.getHeight() / 2);\n }\n\n /** Add a redaction marquee centered at a scene point (used by click-to-place). */\n addRedactionMarqueeAt(cx: number, cy: number): void {\n this.cancelRedaction();\n const w = 220;\n const h = 120;\n const rect = new this.fabric.Rect({\n left: cx - w / 2,\n top: cy - h / 2,\n originX: 'left',\n originY: 'top',\n width: w,\n height: h,\n fill: 'rgba(15, 23, 42, 0.18)',\n stroke: '#ffffff',\n strokeWidth: 1.5,\n strokeDashArray: [6, 4],\n strokeUniform: true,\n });\n rect.set('aspRole', 'redact-marquee');\n this.canvas.add(rect);\n this.canvas.setActiveObject(rect);\n this.canvas.requestRenderAll();\n }\n\n /**\n * Enable/disable click-to-place for redaction: while on, clicking empty canvas\n * drops a new marquee there (but only when one isn't already present, so you\n * reposition the existing box rather than spawning duplicates).\n */\n setRedactPlacement(enabled: boolean): void {\n this.redactPlacement = enabled;\n }\n\n /** Remove the redaction marquee without applying it. */\n cancelRedaction(): void {\n this.removeTagged('redact-marquee');\n this.canvas.requestRenderAll();\n }\n\n /**\n * Bake the redaction: conceal the COMPOSITED content under the marquee. `solid`\n * lays an opaque box; `blur`/`pixelate` sample the rendered pixels in the region\n * (so all underlying layers are hidden) and place a filtered, opaque patch.\n */\n async applyRedaction(mode: RedactMode): Promise<void> {\n const marquee = this.findByRole('redact-marquee');\n if (!marquee) {\n return;\n }\n const region = {\n left: marquee.left ?? 0,\n top: marquee.top ?? 0,\n width: (marquee.width ?? 0) * (marquee.scaleX ?? 1),\n height: (marquee.height ?? 0) * (marquee.scaleY ?? 1),\n };\n this.canvas.remove(marquee);\n\n if (mode === 'solid') {\n const rect = new this.fabric.Rect({\n left: region.left,\n top: region.top,\n originX: 'left',\n originY: 'top',\n width: region.width,\n height: region.height,\n fill: '#0b0f1a',\n });\n rect.set('aspRole', 'redaction');\n rect.set('aspId', this.nextId());\n this.canvas.add(rect);\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.commit('Redact');\n this.notifySelection();\n return;\n }\n\n // Sample the composited region at identity viewport (so region == pixels).\n const vpt = [...this.canvas.viewportTransform] as Fabric.TMat2D;\n this.canvas.setViewportTransform([1, 0, 0, 1, 0, 0]);\n const dataUrl = this.canvas.toDataURL({\n format: 'png',\n left: region.left,\n top: region.top,\n width: region.width,\n height: region.height,\n multiplier: 1,\n });\n this.canvas.setViewportTransform(vpt);\n this.canvas.requestRenderAll();\n\n const patch = await this.fabric.FabricImage.fromURL(dataUrl, {}, {});\n patch.set({ left: region.left, top: region.top, originX: 'left', originY: 'top' });\n patch.filters = [\n mode === 'blur'\n ? new this.fabric.filters.Blur({ blur: 0.5 })\n : new this.fabric.filters.Pixelate({ blocksize: 16 }),\n ];\n patch.applyFilters();\n patch.set('aspRole', 'redaction');\n patch.set('aspId', this.nextId());\n this.canvas.add(patch);\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.commit('Redact');\n this.notifySelection();\n }\n\n private findByRole(role: string): Fabric.FabricObject | null {\n return this.canvas.getObjects().find((o) => o.get('aspRole') === role) ?? null;\n }\n\n /**\n * Apply a decorative frame around the image. Each style maps to a distinct,\n * real border rendering (`none` clears it). The frame is a non-interactive\n * rectangle tagged with `aspRole: 'frame'` so it can be re-found and replaced\n * even after a history restore rebuilds every canvas object.\n */\n applyFrame(style: string, color: string): void {\n this.removeTagged('frame');\n this.frame = style;\n const image = this.baseImage;\n if (image && style !== 'none') {\n const width = (image.width ?? 0) * (image.scaleX ?? 1);\n const height = (image.height ?? 0) * (image.scaleY ?? 1);\n const spec = FRAME_STYLES[style] ?? FRAME_STYLES['line'];\n const rect = new this.fabric.Rect({\n left: image.left ?? this.canvas.getWidth() / 2,\n top: image.top ?? this.canvas.getHeight() / 2,\n originX: 'center',\n originY: 'center',\n width: width - spec.strokeWidth,\n height: height - spec.strokeWidth,\n fill: 'transparent',\n stroke: spec.useColor ? color : spec.stroke,\n strokeWidth: spec.strokeWidth,\n strokeDashArray: spec.dash ? [...spec.dash] : null,\n rx: spec.radius,\n ry: spec.radius,\n selectable: false,\n evented: false,\n strokeUniform: true,\n });\n rect.set('aspRole', 'frame');\n rect.set('aspId', this.nextId());\n this.canvas.add(rect);\n }\n this.canvas.requestRenderAll();\n this.commit('Frame');\n }\n\n /**\n * Set the canvas background to a solid color (`'transparent'` clears it, showing\n * the checkerboard). Fabric serializes `backgroundColor`, so it survives undo.\n */\n setBackground(color: string): void {\n this.canvas.backgroundImage = undefined;\n this.canvas.backgroundColor = color === 'transparent' ? '' : color;\n this.canvas.requestRenderAll();\n this.commit('Background');\n }\n\n /** Set the canvas background to a linear gradient of the given color stops. */\n setBackgroundGradient(colors: readonly string[]): void {\n const stops = colors.map((color, index) => ({\n offset: colors.length === 1 ? 0 : index / (colors.length - 1),\n color,\n }));\n this.canvas.backgroundImage = undefined;\n this.canvas.backgroundColor = new this.fabric.Gradient({\n type: 'linear',\n gradientUnits: 'pixels',\n coords: { x1: 0, y1: 0, x2: this.canvas.getWidth(), y2: this.canvas.getHeight() },\n colorStops: stops,\n });\n this.canvas.requestRenderAll();\n this.commit('Background');\n }\n\n /** Set an uploaded image as the canvas background, scaled to cover. */\n async setBackgroundImage(src: string | Blob): Promise<void> {\n const url = await this.resolveImportUrl(src);\n const loadOptions = url.startsWith('data:') ? {} : { crossOrigin: 'anonymous' as const };\n const image = await this.fabric.FabricImage.fromURL(url, loadOptions, {});\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const scale = Math.max(cw / (image.width || 1), ch / (image.height || 1));\n image.set({ originX: 'left', originY: 'top', left: 0, top: 0, scaleX: scale, scaleY: scale });\n this.canvas.backgroundImage = image;\n this.canvas.requestRenderAll();\n this.commit('Background image');\n }\n\n /** Remove every canvas object tagged with the given `aspRole`. */\n private removeTagged(role: string): void {\n const tagged = this.canvas.getObjects().filter((o) => o.get('aspRole') === role);\n if (tagged.length > 0) {\n this.canvas.remove(...tagged);\n }\n }\n\n /**\n * Enable or disable freehand drawing. When `highlighter` is set, the brush is\n * translucent and wider so strokes read as a highlight over the underlying\n * content rather than an opaque line.\n */\n setFreeDraw(enabled: boolean, style: AnnotationStyle, highlighter = false): void {\n this.canvas.isDrawingMode = enabled;\n if (!enabled) {\n return;\n }\n const brush = new this.fabric.PencilBrush(this.canvas);\n if (highlighter) {\n brush.color = translucent(style.color, 0.35);\n brush.width = style.strokeWidth * 2;\n } else {\n brush.color = style.color;\n brush.width = style.strokeWidth;\n }\n this.canvas.freeDrawingBrush = brush;\n }\n\n /** Apply rich-text attributes (weight/style/underline/align/spacing/bg) to the active text. */\n applyTextStyle(props: Record<string, string | number | boolean>, commit = true): boolean {\n const active = this.canvas\n .getActiveObjects()\n .filter((o) => o.isType('textbox', 'i-text', 'text'));\n if (active.length === 0) {\n return false;\n }\n for (const object of active) {\n object.set(props);\n }\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Text style');\n }\n this.notifySelection();\n return true;\n }\n\n /** Set the fill of the active non-text object(s) (`'transparent'` clears it). */\n setActiveFill(color: string, commit = true): boolean {\n const active = this.canvas.getActiveObjects();\n if (active.length === 0) {\n return false;\n }\n for (const object of active) {\n if (!object.isType('textbox', 'i-text', 'text')) {\n object.set('fill', color);\n }\n }\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Fill');\n }\n return true;\n }\n\n /** Set opacity (0–1) on the active object(s). Returns false if nothing selected. */\n setOpacity(value: number, commit = true): boolean {\n const active = this.canvas.getActiveObjects();\n if (active.length === 0) {\n return false;\n }\n const opacity = Math.max(0, Math.min(1, value));\n for (const object of active) {\n object.set('opacity', opacity);\n }\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Opacity');\n }\n this.notifySelection();\n this.notifyLayers();\n return true;\n }\n\n /** Set opacity (0–1) on a specific layer. */\n setLayerOpacity(id: string, value: number, commit = false): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n object.set('opacity', Math.max(0, Math.min(1, value)));\n this.canvas.requestRenderAll();\n if (commit) {\n this.commit('Opacity');\n }\n this.notifyLayers();\n }\n\n /** Delete the currently selected object(s). */\n deleteActive(): void {\n const active = this.canvas.getActiveObjects();\n if (active.length === 0) {\n return;\n }\n if (active.some((o) => o.get('aspId') === 'base')) {\n this.baseImage = null;\n }\n this.canvas.remove(...active);\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.commit('Delete');\n this.notifySelection();\n }\n\n /** Clear the active selection. */\n discardSelection(): void {\n this.canvas.discardActiveObject();\n this.canvas.requestRenderAll();\n this.notifySelection();\n }\n\n /** Select all editable (unlocked, non-base) objects. */\n selectAll(): void {\n const objects = this.canvas\n .getObjects()\n .filter((o) => o.selectable !== false && o.get('aspId') !== 'base');\n if (objects.length === 0) {\n return;\n }\n this.canvas.discardActiveObject();\n this.setActive(objects);\n this.canvas.requestRenderAll();\n this.notifySelection();\n }\n\n /** Copy the current selection to the internal clipboard. */\n async copy(): Promise<void> {\n const active = this.canvas.getActiveObjects();\n this.clipboard = await Promise.all(active.map((o) => o.clone()));\n }\n\n /** Paste the clipboard contents, offset and selected. */\n async paste(): Promise<void> {\n if (this.clipboard.length === 0) {\n return;\n }\n const clones = await Promise.all(this.clipboard.map((o) => o.clone()));\n this.addClones(clones, 'Paste');\n }\n\n /** Add an image (e.g. pasted from the OS clipboard) as a movable object. */\n async addImageObject(src: string | Blob): Promise<void> {\n const url = await this.resolveImportUrl(src);\n const loadOptions = url.startsWith('data:') ? {} : { crossOrigin: 'anonymous' as const };\n const image = await this.fabric.FabricImage.fromURL(url, loadOptions, {});\n if (!image.width || !image.height) {\n throw new Error('The image could not be loaded.');\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const scale = Math.min(1, (cw * 0.6) / (image.width || 1), (ch * 0.6) / (image.height || 1));\n image.set({\n left: cw / 2,\n top: ch / 2,\n originX: 'center',\n originY: 'center',\n scaleX: scale,\n scaleY: scale,\n });\n image.set('aspId', this.nextId());\n this.canvas.add(image);\n this.canvas.setActiveObject(image);\n this.canvas.requestRenderAll();\n this.commit('Paste image');\n this.notifySelection();\n }\n\n /**\n * Magic-wand erase: from a scene point, flood-fill the image under the pointer\n * and clear (make transparent) every contiguous pixel within `tolerance`\n * (0–100) of the clicked color. Great for knocking out a solid background.\n * Operates on the base image, or a selected image layer if one is active.\n */\n async magicErase(scenePoint: { x: number; y: number }, tolerance: number): Promise<boolean> {\n const active = this.canvas.getActiveObject();\n const target =\n active && active.isType('image') ? (active as Fabric.FabricImage) : this.baseImage;\n if (!target) {\n return false;\n }\n const el = target.getElement() as CanvasImageSource & { width: number; height: number };\n const srcW = (el as HTMLImageElement).naturalWidth || el.width;\n const srcH = (el as HTMLImageElement).naturalHeight || el.height;\n if (!srcW || !srcH) {\n return false;\n }\n const off = document.createElement('canvas');\n off.width = srcW;\n off.height = srcH;\n const ctx = off.getContext('2d', { willReadFrequently: true });\n if (!ctx) {\n return false;\n }\n ctx.drawImage(el, 0, 0, srcW, srcH);\n const image = ctx.getImageData(0, 0, srcW, srcH);\n\n // Map the scene click into source-pixel coordinates (undo the object's\n // transform, then offset by the cropped region's origin).\n const inv = this.fabric.util.invertTransform(target.calcTransformMatrix());\n const local = this.fabric.util.transformPoint(\n new this.fabric.Point(scenePoint.x, scenePoint.y),\n inv,\n );\n const px = Math.round(local.x + (target.width ?? srcW) / 2 + (target.cropX ?? 0));\n const py = Math.round(local.y + (target.height ?? srcH) / 2 + (target.cropY ?? 0));\n if (px < 0 || py < 0 || px >= srcW || py >= srcH) {\n return false;\n }\n\n const cleared = floodFillClear(image, px, py, Math.round((tolerance / 100) * 255));\n if (cleared === 0) {\n return false;\n }\n ctx.putImageData(image, 0, 0);\n\n // Rebuild the image element in place so the cleared pixels show through.\n const replacement = await this.fabric.FabricImage.fromURL(off.toDataURL('image/png'), {}, {});\n replacement.set({\n left: target.left,\n top: target.top,\n originX: target.originX,\n originY: target.originY,\n scaleX: target.scaleX,\n scaleY: target.scaleY,\n angle: target.angle,\n cropX: target.cropX,\n cropY: target.cropY,\n width: target.width,\n height: target.height,\n flipX: target.flipX,\n flipY: target.flipY,\n });\n replacement.set('aspId', target.get('aspId') ?? this.nextId());\n replacement.filters = target.filters;\n replacement.applyFilters();\n const wasBase = target === this.baseImage;\n this.canvas.remove(target);\n this.canvas.add(replacement);\n if (wasBase) {\n this.baseImage = replacement;\n }\n this.canvas.setActiveObject(replacement);\n this.canvas.requestRenderAll();\n this.commit('Magic erase');\n this.notifySelection();\n this.notifyLayers();\n return true;\n }\n\n /** Register a callback for AI-operation progress (model fetch + inference). */\n setAiProgressListener(cb: (info: AiProgress) => void): void {\n this.aiProgressListener = cb;\n }\n\n /**\n * In-browser AI background removal. Segments the target image (the base image,\n * or a selected image layer) and either replaces it with the cut-out subject\n * (`mode: 'replace'`) or adds the cut-out as a new layer (`mode: 'subject'`).\n * The model is fetched and cached on first use; progress is reported via the AI\n * progress listener. Returns false if there's no image to process.\n */\n async removeImageBackground(mode: 'replace' | 'subject'): Promise<boolean> {\n const active = this.canvas.getActiveObject();\n const target =\n active && active.isType('image') ? (active as Fabric.FabricImage) : this.baseImage;\n if (!target) {\n return false;\n }\n const source = this.imageToBlob(target);\n if (!source) {\n return false;\n }\n this.aiProgressListener?.({ stage: 'loading', progress: 0 });\n const { removeBackground } = await import('@imgly/background-removal');\n const cutoutBlob = await removeBackground(source, {\n progress: (key: string, current: number, total: number) => {\n const stage = key.startsWith('fetch') ? 'loading' : 'processing';\n this.aiProgressListener?.({ stage, progress: total > 0 ? current / total : 0 });\n },\n });\n const cutout = await this.fabric.FabricImage.fromURL(await blobToDataUrl(cutoutBlob), {}, {});\n\n if (mode === 'replace') {\n cutout.set({\n left: target.left,\n top: target.top,\n originX: target.originX,\n originY: target.originY,\n scaleX: target.scaleX,\n scaleY: target.scaleY,\n angle: target.angle,\n flipX: target.flipX,\n flipY: target.flipY,\n });\n cutout.set('aspId', target.get('aspId') ?? this.nextId());\n const wasBase = target === this.baseImage;\n this.canvas.remove(target);\n this.canvas.add(cutout);\n if (wasBase) {\n this.baseImage = cutout;\n }\n this.canvas.setActiveObject(cutout);\n } else {\n // Subject as a new movable layer, aligned over the source.\n cutout.set({\n left: target.left,\n top: target.top,\n originX: target.originX,\n originY: target.originY,\n scaleX: target.scaleX,\n scaleY: target.scaleY,\n angle: target.angle,\n });\n cutout.set('aspId', this.nextId());\n this.canvas.add(cutout);\n this.canvas.setActiveObject(cutout);\n }\n this.canvas.requestRenderAll();\n this.aiProgressListener?.({ stage: 'done', progress: 1 });\n this.commit(mode === 'replace' ? 'Remove background' : 'Cut out subject');\n this.notifySelection();\n this.notifyLayers();\n return true;\n }\n\n /** Draw an image object's source bitmap to a fresh canvas and return a PNG blob. */\n private imageToBlob(image: Fabric.FabricImage): Blob | null {\n const el = image.getElement() as CanvasImageSource & { width: number; height: number };\n const w = (el as HTMLImageElement).naturalWidth || el.width;\n const h = (el as HTMLImageElement).naturalHeight || el.height;\n if (!w || !h) {\n return null;\n }\n const off = document.createElement('canvas');\n off.width = w;\n off.height = h;\n const ctx = off.getContext('2d');\n if (!ctx) {\n return null;\n }\n ctx.drawImage(el, 0, 0, w, h);\n return dataUrlToBlob(off.toDataURL('image/png'));\n }\n\n /** Duplicate the current selection in place (offset). */\n async duplicateActive(): Promise<void> {\n const active = this.canvas.getActiveObjects();\n if (active.length === 0) {\n return;\n }\n const clones = await Promise.all(active.map((o) => o.clone()));\n this.addClones(clones, 'Duplicate');\n }\n\n private addClones(clones: Fabric.FabricObject[], label: string): void {\n for (const clone of clones) {\n clone.set({ left: (clone.left ?? 0) + 16, top: (clone.top ?? 0) + 16 });\n clone.set('aspId', this.nextId());\n this.canvas.add(clone);\n }\n this.canvas.discardActiveObject();\n this.setActive(clones);\n this.canvas.requestRenderAll();\n this.commit(label);\n this.notifySelection();\n }\n\n private setActive(objects: Fabric.FabricObject[]): void {\n if (objects.length === 1) {\n this.canvas.setActiveObject(objects[0]);\n } else if (objects.length > 1) {\n this.canvas.setActiveObject(new this.fabric.ActiveSelection(objects, { canvas: this.canvas }));\n }\n }\n\n /** Group the current multi-selection into a single object. */\n groupActive(): void {\n const active = this.canvas.getActiveObject();\n if (!active || !active.isType('activeselection')) {\n return;\n }\n const objects = (active as Fabric.ActiveSelection).getObjects();\n this.canvas.discardActiveObject();\n this.canvas.remove(...objects);\n const group = new this.fabric.Group(objects);\n group.set('aspId', this.nextId());\n this.canvas.add(group);\n this.canvas.setActiveObject(group);\n this.canvas.requestRenderAll();\n this.commit('Group');\n this.notifySelection();\n }\n\n /** Ungroup the selected group back into individual objects. */\n ungroupActive(): void {\n const active = this.canvas.getActiveObject();\n if (!active || !active.isType('group')) {\n return;\n }\n const group = active as Fabric.Group;\n const objects = group.removeAll();\n this.canvas.remove(group);\n for (const object of objects) {\n object.set('aspId', this.nextId());\n this.canvas.add(object);\n }\n this.canvas.discardActiveObject();\n this.setActive(objects);\n this.canvas.requestRenderAll();\n this.commit('Ungroup');\n this.notifySelection();\n }\n\n /** Align the active object/selection to an edge or center of the canvas. */\n alignActive(mode: 'left' | 'center-h' | 'right' | 'top' | 'center-v' | 'bottom'): void {\n const active = this.canvas.getActiveObject();\n if (!active) {\n return;\n }\n const cw = this.canvas.getWidth();\n const ch = this.canvas.getHeight();\n const box = active.getBoundingRect();\n let dx = 0;\n let dy = 0;\n switch (mode) {\n case 'left':\n dx = -box.left;\n break;\n case 'center-h':\n dx = (cw - box.width) / 2 - box.left;\n break;\n case 'right':\n dx = cw - box.width - box.left;\n break;\n case 'top':\n dy = -box.top;\n break;\n case 'center-v':\n dy = (ch - box.height) / 2 - box.top;\n break;\n case 'bottom':\n dy = ch - box.height - box.top;\n break;\n default:\n break;\n }\n active.set({ left: (active.left ?? 0) + dx, top: (active.top ?? 0) + dy });\n active.setCoords();\n this.canvas.requestRenderAll();\n this.commit('Align');\n }\n\n /** Enable/disable space-drag panning (disables selection while active). */\n setPanMode(enabled: boolean): void {\n if (this.panMode === enabled) {\n return;\n }\n this.panMode = enabled;\n this.canvas.selection = !enabled;\n this.canvas.defaultCursor = enabled ? 'grab' : 'default';\n this.canvas.setCursor(enabled ? 'grab' : 'default');\n if (!enabled) {\n this.panLast = null;\n }\n }\n\n // ---- history -------------------------------------------------------------\n\n get canUndo(): boolean {\n return this.history.canUndo;\n }\n\n get canRedo(): boolean {\n return this.history.canRedo;\n }\n\n get historyEntries(): readonly HistoryStep[] {\n return this.history.entries;\n }\n\n get historyIndex(): number {\n return this.history.index;\n }\n\n async undo(): Promise<void> {\n const entry = this.history.undo();\n if (entry) {\n await this.restore(entry.state);\n }\n }\n\n async redo(): Promise<void> {\n const entry = this.history.redo();\n if (entry) {\n await this.restore(entry.state);\n }\n }\n\n // ---- templates (save / load scene) --------------------------------------\n\n /**\n * Serialize the whole editor — scene objects, transform/adjustment/look/frame\n * state, and the artboard — into a portable, versioned template string. The\n * inverse of {@link loadScene}.\n */\n exportScene(): string {\n const template = {\n version: 1 as const,\n snapshot: JSON.parse(this.snapshot()) as EditorSnapshot,\n artboard: this.artboard,\n };\n return JSON.stringify(template);\n }\n\n /**\n * Restore a template produced by {@link exportScene}. Resets the history to\n * the loaded state so it becomes the new undo baseline. Throws on malformed\n * input rather than loading a partial scene.\n */\n async loadScene(json: string): Promise<void> {\n const parsed: unknown = JSON.parse(json);\n if (!isSceneTemplate(parsed)) {\n throw new Error('Not a valid editor template');\n }\n await this.restore(JSON.stringify(parsed.snapshot));\n this.setArtboard(parsed.artboard ?? null);\n this.history.reset('Loaded template', this.snapshot());\n this.notifyLayers();\n this.notifySelection();\n }\n\n /**\n * Serialize the full editor state — the Fabric scene PLUS the engine's own\n * transform/adjustment/look/frame state — so a restore puts both back in sync\n * (the canvas alone does not capture rotation buckets, slider values, etc).\n */\n private snapshot(): string {\n const composite: EditorSnapshot = {\n json: this.canvas.toObject(['aspRole', 'aspId', 'aspLocked', 'aspName']),\n rotation: this.rotation,\n straighten: this.straighten,\n adjustments: { ...this.adjustments },\n looks: [...this.looks],\n frame: this.frame,\n guides: [...this.manualGuides],\n };\n return JSON.stringify(composite);\n }\n\n private commit(label: string): void {\n this.history.push(label, this.snapshot());\n this.notifyLayers();\n }\n\n private async restore(state: string): Promise<void> {\n const composite = JSON.parse(state) as EditorSnapshot;\n await this.canvas.loadFromJSON(composite.json);\n this.baseImage = this.findBaseImage();\n this.rotation = composite.rotation;\n this.straighten = composite.straighten;\n this.adjustments = { ...defaultAdjustments(), ...composite.adjustments };\n this.looks = new Set(composite.looks);\n this.frame = composite.frame;\n this.manualGuides = composite.guides ? [...composite.guides] : [];\n // Re-apply per-object lock state (serialized via aspLocked).\n for (const object of this.canvas.getObjects()) {\n if (object.get('aspLocked') === true) {\n this.setLocked(object, true);\n }\n }\n this.canvas.requestRenderAll();\n this.notifyLayers();\n this.notifyGuides();\n }\n\n private findBaseImage(): Fabric.FabricImage | null {\n // The background is the image tagged `aspId: 'base'`; matching by id (not\n // \"first image\") keeps a pasted image from being mistaken for it, and\n // returns null once the background has been deleted.\n const base = this.canvas\n .getObjects()\n .find((o) => o.isType('image') && o.get('aspId') === 'base');\n return (base as Fabric.FabricImage) ?? null;\n }\n\n /** Reset all edits back to the freshly-loaded image. */\n async reset(): Promise<void> {\n const first = this.history.first;\n this.history.reset(first.label, first.state);\n this.resetView();\n await this.restore(first.state);\n }\n\n // ---- state accessors (for the host UI to resync after undo/redo/reset) ----\n\n get rotationAngle(): number {\n return this.rotation;\n }\n\n get straightenAngle(): number {\n return this.straighten;\n }\n\n /** A copy of the current adjustment values. */\n getAdjustments(): Record<AspFilter, number> {\n return { ...this.adjustments };\n }\n\n /** The single active look (UI is single-select), or null. */\n get activeLook(): AspFilter | null {\n return this.looks.size === 1 ? [...this.looks][0] : null;\n }\n\n get activeFrame(): string {\n return this.frame;\n }\n\n // ---- layers --------------------------------------------------------------\n\n /** The layer stack, top of the z-order first (matching visual stacking). */\n getLayers(): LayerInfo[] {\n const active = this.canvas.getActiveObjects();\n const layers = this.canvas.getObjects().map((object): LayerInfo => {\n const id = typeof object.get('aspId') === 'string' ? (object.get('aspId') as string) : '';\n return {\n id,\n label: layerLabel(object),\n locked: object.get('aspLocked') === true,\n visible: object.visible !== false,\n selected: active.includes(object),\n opacity: typeof object.opacity === 'number' ? object.opacity : 1,\n removable: true,\n };\n });\n return layers.filter((l) => l.id !== '' && l.id !== 'cropframe').reverse();\n }\n\n private findById(id: string): Fabric.FabricObject | null {\n return this.canvas.getObjects().find((o) => o.get('aspId') === id) ?? null;\n }\n\n /**\n * Select a layer by id (no-op if it is locked or missing). When `additive`\n * (shift/cmd/ctrl-click in the panel), toggle the layer in/out of a\n * multi-selection instead of replacing it.\n */\n selectLayer(id: string, additive = false): void {\n const object = this.findById(id);\n // Locked layers can't be selected; the background is selectable from the\n // panel (so it can be deleted/adjusted) even though it ignores canvas clicks.\n if (!object || object.get('aspLocked') === true) {\n return;\n }\n if (additive) {\n const current = this.canvas.getActiveObjects();\n const next = current.includes(object)\n ? current.filter((o) => o !== object)\n : [...current, object];\n this.canvas.discardActiveObject();\n if (next.length > 0) {\n this.setActive(next);\n }\n } else {\n this.canvas.discardActiveObject();\n this.canvas.setActiveObject(object);\n }\n this.canvas.requestRenderAll();\n this.notifySelection();\n this.notifyLayers();\n }\n\n /**\n * Reorder the whole z-stack to match a display order (front-most first, as the\n * Layers panel shows it). Used by drag-and-drop reordering.\n */\n reorderLayers(displayOrderIds: readonly string[]): void {\n // The panel lists front→back; the canvas stack is back→front.\n const canvasOrder = [...displayOrderIds].reverse();\n let changed = false;\n canvasOrder.forEach((id, index) => {\n const object = this.findById(id);\n if (object && this.canvas.getObjects().indexOf(object) !== index) {\n this.canvas.moveObjectTo(object, index);\n changed = true;\n }\n });\n if (!changed) {\n return;\n }\n this.canvas.requestRenderAll();\n this.commit('Reorder layers');\n this.notifyLayers();\n }\n\n /** Rename a layer; an empty/blank name clears back to the auto label. */\n renameLayer(id: string, name: string): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n const trimmed = name.trim();\n object.set('aspName', trimmed === '' ? undefined : trimmed);\n this.commit('Rename layer');\n this.notifyLayers();\n }\n\n /** Lock/unlock a layer. Locked layers are not selectable, so clicks pass through. */\n toggleLayerLock(id: string): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n const locked = object.get('aspLocked') !== true;\n this.setLocked(object, locked);\n if (locked && this.canvas.getActiveObjects().includes(object)) {\n this.canvas.discardActiveObject();\n }\n this.canvas.requestRenderAll();\n this.commit(locked ? 'Lock layer' : 'Unlock layer');\n this.notifySelection();\n }\n\n private setLocked(object: Fabric.FabricObject, locked: boolean): void {\n object.set('aspLocked', locked);\n object.set({\n selectable: !locked,\n evented: !locked,\n lockMovementX: locked,\n lockMovementY: locked,\n lockScalingX: locked,\n lockScalingY: locked,\n lockRotation: locked,\n });\n }\n\n /** Show/hide a layer. */\n toggleLayerVisible(id: string): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n object.visible = object.visible === false;\n this.canvas.requestRenderAll();\n this.commit('Toggle visibility');\n }\n\n /** Move a layer up (forward) or down (backward) in the z-order. */\n moveLayer(id: string, direction: 'up' | 'down'): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n if (direction === 'up') {\n this.canvas.bringObjectForward(object);\n } else {\n this.canvas.sendObjectBackwards(object);\n }\n this.canvas.requestRenderAll();\n this.commit('Reorder layer');\n }\n\n /** Delete a layer (the base image is protected). */\n deleteLayer(id: string): void {\n const object = this.findById(id);\n if (!object) {\n return;\n }\n if (id === 'base') {\n this.baseImage = null;\n }\n this.canvas.remove(object);\n this.canvas.requestRenderAll();\n this.commit('Delete layer');\n this.notifySelection();\n }\n\n // ---- export --------------------------------------------------------------\n\n /** Export the current scene to a Blob in the requested format. */\n async exportImage(\n format: AspExportFormat,\n qualityPct: number,\n allowedFormats: readonly AspExportFormat[],\n ): Promise<Blob> {\n const cfg = resolveExport(format, qualityPct, allowedFormats);\n if (cfg.kind === 'json') {\n return new Blob([JSON.stringify(this.canvas.toJSON())], { type: cfg.mimeType });\n }\n if (cfg.kind === 'vector') {\n // Embed the web fonts used by text so the SVG renders the true typeface in\n // any viewer instead of falling back to a generic family.\n const svg = await this.embedSvgFonts(this.canvas.toSVG());\n return new Blob([svg], { type: cfg.mimeType });\n }\n if (cfg.kind === 'pdf') {\n return this.exportPdf(cfg.quality);\n }\n const rasterFormat = cfg.format === 'jpeg' ? 'jpeg' : cfg.format === 'webp' ? 'webp' : 'png';\n return dataUrlToBlob(this.artboardDataUrl(rasterFormat, cfg.quality));\n }\n\n /**\n * Inline the web fonts used by the scene's text into the SVG so it is\n * self-contained. Network failures fall back to the original SVG (text keeps\n * its font-family). No-op outside a browser (no `fetch`).\n */\n private async embedSvgFonts(svg: string): Promise<string> {\n if (typeof fetch !== 'function') {\n return svg;\n }\n try {\n return await embedFontsInSvg(svg, this.collectTextFontFamilies(), (url, init) =>\n fetch(url, init),\n );\n } catch {\n return svg;\n }\n }\n\n /** Distinct `fontFamily` values across all text objects (recursing into groups). */\n private collectTextFontFamilies(): string[] {\n const families = new Set<string>();\n const visit = (object: Fabric.FabricObject): void => {\n if (object.isType('textbox', 'i-text', 'text')) {\n const family = object.get('fontFamily');\n if (typeof family === 'string' && family) {\n families.add(family);\n }\n }\n if (object.isType('group', 'activeselection')) {\n (object as Fabric.Group).getObjects().forEach(visit);\n }\n };\n this.canvas.getObjects().forEach(visit);\n return [...families];\n }\n\n /**\n * Render into a single-page PDF. The page is sized to the artboard (when set)\n * or the full canvas, and the image is the matching region. jsPDF is lazy-loaded.\n */\n private async exportPdf(quality: number): Promise<Blob> {\n const out = this.outputSize();\n const width = out ? out.width : this.canvas.getWidth();\n const height = out ? out.height : this.canvas.getHeight();\n const dataUrl = this.artboardDataUrl('jpeg', quality);\n const { jsPDF } = await import('jspdf');\n const pdf = new jsPDF({\n orientation: width >= height ? 'landscape' : 'portrait',\n unit: 'px',\n format: [width, height],\n });\n pdf.addImage(dataUrl, 'JPEG', 0, 0, width, height);\n return pdf.output('blob');\n }\n\n /** Pixel data of the current canvas, or null if no rendering context. */\n getImageData(): ImageData | null {\n const ctx = this.canvas.getContext();\n return ctx ? ctx.getImageData(0, 0, this.canvas.getWidth(), this.canvas.getHeight()) : null;\n }\n\n // ---- lifecycle -----------------------------------------------------------\n\n /** Resize the editing surface. */\n setSize(width: number, height: number): void {\n this.canvas.setDimensions({ width, height });\n this.fitBaseImage();\n this.canvas.requestRenderAll();\n }\n\n /** Tear down the Fabric canvas and release resources. */\n async destroy(): Promise<void> {\n if (this.onFontsLoaded && typeof document !== 'undefined' && document.fonts) {\n document.fonts.removeEventListener('loadingdone', this.onFontsLoaded);\n }\n await this.canvas.dispose();\n }\n}\n\ninterface FrameSpec {\n readonly strokeWidth: number;\n readonly radius: number;\n readonly useColor: boolean;\n readonly stroke: string;\n readonly dash?: readonly number[];\n}\n\n/** Distinct, real frame renderings keyed by the panel's frame option. */\nconst FRAME_STYLES: Record<string, FrameSpec> = {\n line: { strokeWidth: 8, radius: 0, useColor: true, stroke: '#000000' },\n mat: { strokeWidth: 20, radius: 0, useColor: false, stroke: '#ffffff' },\n inset: { strokeWidth: 6, radius: 10, useColor: true, stroke: '#000000' },\n hook: { strokeWidth: 12, radius: 0, useColor: true, stroke: '#000000' },\n bead: { strokeWidth: 7, radius: 0, useColor: true, stroke: '#000000', dash: [2, 7] },\n};\n\n/** Vertices of a regular polygon centered at the origin (first vertex pointing up). */\nfunction polygonPoints(sides: number, radius: number): { x: number; y: number }[] {\n return Array.from({ length: sides }, (_, i) => {\n const angle = -Math.PI / 2 + (i * 2 * Math.PI) / sides;\n return { x: radius * Math.cos(angle), y: radius * Math.sin(angle) };\n });\n}\n\n/** Vertices of an N-point star alternating outer/inner radius. */\nfunction starPoints(points: number, outer: number, inner: number): { x: number; y: number }[] {\n return Array.from({ length: points * 2 }, (_, i) => {\n const radius = i % 2 === 0 ? outer : inner;\n const angle = -Math.PI / 2 + (i * Math.PI) / points;\n return { x: radius * Math.cos(angle), y: radius * Math.sin(angle) };\n });\n}\n\n/** Convert a hex color to an `rgba()` string at the given alpha; passes other values through. */\nfunction translucent(color: string, alpha: number): string {\n try {\n return withAlpha(parseHex(color), alpha);\n } catch {\n return color;\n }\n}\n\n/** A human label for a layer row, derived from its role/type. */\nfunction layerLabel(object: Fabric.FabricObject): string {\n const custom = object.get('aspName');\n if (typeof custom === 'string' && custom.trim() !== '') {\n return custom;\n }\n const role = object.get('aspRole');\n if (role === 'frame') {\n return 'Frame';\n }\n if (role === 'redaction') {\n return 'Redaction';\n }\n if (object.isType('image')) {\n return object.get('aspId') === 'base' ? 'Background' : 'Image';\n }\n if (object.isType('textbox', 'i-text', 'text')) {\n return 'Text';\n }\n if (object.isType('rect')) {\n return 'Rectangle';\n }\n if (object.isType('ellipse', 'circle')) {\n return 'Ellipse';\n }\n if (object.isType('line')) {\n return 'Line';\n }\n if (object.isType('group', 'activeselection')) {\n return 'Group';\n }\n if (object.isType('path')) {\n return 'Drawing';\n }\n return 'Object';\n}\n\n/** Load a data URL into an HTMLImageElement. */\nfunction loadHtmlImage(src: string): Promise<HTMLImageElement> {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const img = new Image();\n img.onload = () => resolve(img);\n img.onerror = () => reject(new Error('Failed to decode image'));\n img.src = src;\n });\n}\n\n/** Read a Blob into a data URL (so it persists in serialized history). */\nfunction blobToDataUrl(blob: Blob): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(reader.error ?? new Error('Failed to read image blob'));\n reader.readAsDataURL(blob);\n });\n}\n\n/** Return the SVG markup if the source is an SVG (by MIME, name, or data-URL), else null. */\nasync function svgTextFrom(src: string | Blob): Promise<string | null> {\n if (typeof src !== 'string') {\n const name = (src as File).name ?? '';\n const isSvg = src.type === 'image/svg+xml' || /\\.svg$/i.test(name);\n if (!isSvg) {\n return null;\n }\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(reader.error ?? new Error('Failed to read SVG'));\n reader.readAsText(src);\n });\n }\n if (/^data:image\\/svg\\+xml/i.test(src)) {\n return (await fetch(src)).text();\n }\n return null;\n}\n\n/** Intrinsic pixel size of an SVG: its width/height attrs, else its viewBox, else 512². */\nfunction svgIntrinsicSize(svgText: string): { width: number; height: number } {\n const svg = new DOMParser().parseFromString(svgText, 'image/svg+xml').documentElement;\n let w = parseFloat(svg.getAttribute('width') ?? '');\n let h = parseFloat(svg.getAttribute('height') ?? '');\n if (!Number.isFinite(w) || !Number.isFinite(h)) {\n const vb = (svg.getAttribute('viewBox') ?? '').split(/[\\s,]+/).map(Number);\n if (vb.length === 4 && vb[2] > 0 && vb[3] > 0) {\n w = vb[2];\n h = vb[3];\n }\n }\n return {\n width: Number.isFinite(w) && w > 0 ? w : 512,\n height: Number.isFinite(h) && h > 0 ? h : 512,\n };\n}\n\n/** Rasterize SVG markup to a PNG data URL, sized from its real dimensions (≤2× for crispness). */\nasync function rasterizeSvg(svgText: string, maxDim: number): Promise<string> {\n const { width, height } = svgIntrinsicSize(svgText);\n // Pin explicit width/height so the <img> renders the full content, not a default box.\n const svg = new DOMParser().parseFromString(svgText, 'image/svg+xml').documentElement;\n svg.setAttribute('width', String(width));\n svg.setAttribute('height', String(height));\n const url = URL.createObjectURL(\n new Blob([new XMLSerializer().serializeToString(svg)], { type: 'image/svg+xml' }),\n );\n try {\n const img = await loadHtmlImage(url);\n // Render at high resolution for crispness when scaled on the canvas: aim for\n // a ≥1536px long edge (vector source upscales cleanly), capped at maxDim.\n const longest = Math.max(width, height);\n const targetLong = Math.min(maxDim, Math.max(longest * 2, 1536));\n const scale = targetLong / longest;\n const cw = Math.max(1, Math.round(width * scale));\n const ch = Math.max(1, Math.round(height * scale));\n const canvas = document.createElement('canvas');\n canvas.width = cw;\n canvas.height = ch;\n canvas.getContext('2d')?.drawImage(img, 0, 0, cw, ch);\n return canvas.toDataURL('image/png');\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n\n/**\n * Flood-fill the alpha channel to 0 starting at (sx, sy), spreading to 4-connected\n * neighbours whose RGB is within `tol` (per channel) of the seed color. Mutates\n * `image` in place and returns the number of pixels cleared. Pure + unit-testable.\n */\nexport function floodFillClear(image: ImageData, sx: number, sy: number, tol: number): number {\n const { width: w, height: h, data } = image;\n const idx = (x: number, y: number): number => (y * w + x) * 4;\n const seed = idx(sx, sy);\n if (data[seed + 3] === 0) {\n return 0; // already transparent\n }\n const sr = data[seed];\n const sg = data[seed + 1];\n const sb = data[seed + 2];\n const visited = new Uint8Array(w * h);\n const stack: number[] = [sx, sy];\n let cleared = 0;\n while (stack.length > 0) {\n const y = stack.pop() as number;\n const x = stack.pop() as number;\n if (x < 0 || y < 0 || x >= w || y >= h) {\n continue;\n }\n const flat = y * w + x;\n if (visited[flat]) {\n continue;\n }\n visited[flat] = 1;\n const p = flat * 4;\n if (data[p + 3] === 0) {\n continue;\n }\n if (\n Math.abs(data[p] - sr) > tol ||\n Math.abs(data[p + 1] - sg) > tol ||\n Math.abs(data[p + 2] - sb) > tol\n ) {\n continue;\n }\n data[p + 3] = 0;\n cleared += 1;\n stack.push(x + 1, y, x - 1, y, x, y + 1, x, y - 1);\n }\n return cleared;\n}\n\n/** Convert a data URL to a Blob without a network round-trip. */\nfunction dataUrlToBlob(dataUrl: string): Blob {\n const [header, data] = dataUrl.split(',');\n const mimeMatch = /data:([^;]+)/.exec(header);\n const mime = mimeMatch ? mimeMatch[1] : 'image/png';\n const binary = atob(data);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return new Blob([bytes], { type: mime });\n}\n","/**\n * Ruler rendering — pure drawing helpers for the measurement rulers that frame\n * the canvas. The engine owns the viewport; these functions just turn a\n * viewport into crisp tick marks and labels on a small strip canvas.\n */\n\n/** The view transform a ruler needs: scene→screen is `scene * zoom + pan`. */\nexport interface RulerView {\n readonly zoom: number;\n readonly pan: number;\n}\n\nexport interface RulerColors {\n readonly bg: string;\n readonly tick: string;\n readonly label: string;\n}\n\n/**\n * Choose a \"nice\" spacing (in scene units) between major ruler ticks so labels\n * land roughly `targetPx` apart on screen. Always a 1/2/5 × 10ⁿ value, so the\n * numbers read cleanly at any zoom.\n */\nexport function niceStep(zoom: number, targetPx = 70): number {\n const raw = targetPx / zoom;\n const pow = Math.pow(10, Math.floor(Math.log10(raw)));\n const norm = raw / pow; // 1 ≤ norm < 10\n const nice = norm < 1.5 ? 1 : norm < 3 ? 2 : norm < 7 ? 5 : 10;\n return nice * pow;\n}\n\n/**\n * Draw a horizontal or vertical ruler onto `ctx`. The canvas backing store is\n * assumed pre-scaled by `dpr`; all coordinates here are in CSS pixels.\n *\n * @param lengthPx ruler length along the canvas (its width for `h`, height for `v`).\n * @param thickness ruler thickness (the short dimension).\n */\nexport function drawRuler(\n ctx: CanvasRenderingContext2D,\n orientation: 'h' | 'v',\n lengthPx: number,\n thickness: number,\n view: RulerView,\n colors: RulerColors,\n): void {\n ctx.clearRect(0, 0, lengthPx, thickness);\n ctx.fillStyle = colors.bg;\n ctx.fillRect(0, 0, lengthPx, thickness);\n\n const step = niceStep(view.zoom);\n const subStep = step / 5;\n\n // Scene coordinates visible along this ruler: screen 0..lengthPx.\n const sceneStart = (0 - view.pan) / view.zoom;\n const sceneEnd = (lengthPx - view.pan) / view.zoom;\n const first = Math.floor(sceneStart / subStep) * subStep;\n\n ctx.strokeStyle = colors.tick;\n ctx.fillStyle = colors.label;\n ctx.lineWidth = 1;\n ctx.font = '9px system-ui, -apple-system, sans-serif';\n ctx.textBaseline = orientation === 'h' ? 'alphabetic' : 'top';\n\n // A small epsilon avoids dropping a major tick to float error.\n const eps = subStep / 1000;\n\n for (let s = first; s <= sceneEnd; s += subStep) {\n const screen = Math.round(s * view.zoom + view.pan) + 0.5;\n const isMajor = Math.abs(s / step - Math.round(s / step)) < eps / step;\n const tickLen = isMajor ? thickness * 0.62 : thickness * 0.32;\n\n ctx.beginPath();\n if (orientation === 'h') {\n ctx.moveTo(screen, thickness);\n ctx.lineTo(screen, thickness - tickLen);\n } else {\n ctx.moveTo(thickness, screen);\n ctx.lineTo(thickness - tickLen, screen);\n }\n ctx.stroke();\n\n if (isMajor) {\n const label = String(Math.round(s));\n if (orientation === 'h') {\n ctx.fillText(label, screen + 2, thickness - tickLen - 1);\n } else {\n // Vertical ruler: rotate the label to read along the strip.\n ctx.save();\n ctx.translate(thickness - tickLen - 1, screen + 2);\n ctx.rotate(-Math.PI / 2);\n ctx.fillText(label, 0, 0);\n ctx.restore();\n }\n }\n }\n}\n","/**\n * Inline Lucide icon paths (ISC license, lucide-static v1.21.0).\n *\n * Only the 63 icons the editor actually uses are baked in, so there is no\n * runtime icon dependency or network fetch — the bundle stays light and the\n * exact design icons are used (never a generic substitute). Each value is the\n * inner markup of a 24×24 \\`viewBox\\`, stroke \\`currentColor\\`; rendered by AspIcon.\n */\n\nexport const LUCIDE_ICONS: Readonly<Record<string, string>> = {\n 'align-center': '<path d=\"M21 5H3\" /><path d=\"M17 12H7\" /><path d=\"M19 19H5\" />',\n 'align-horizontal-distribute-center': '<rect width=\"6\" height=\"14\" x=\"4\" y=\"5\" rx=\"2\" /><rect width=\"6\" height=\"10\" x=\"14\" y=\"7\" rx=\"2\" /><path d=\"M17 22v-5\" /><path d=\"M17 7V2\" /><path d=\"M7 22v-3\" /><path d=\"M7 5V2\" />',\n 'align-left': '<path d=\"M21 5H3\" /><path d=\"M15 12H3\" /><path d=\"M17 19H3\" />',\n 'align-right': '<path d=\"M21 5H3\" /><path d=\"M21 12H9\" /><path d=\"M21 19H7\" />',\n 'arrow-up-right': '<path d=\"M7 7h10v10\" /><path d=\"M7 17 17 7\" />',\n 'bold': '<path d=\"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8\" />',\n 'check': '<path d=\"M20 6 9 17l-5-5\" />',\n 'chevron-down': '<path d=\"m6 9 6 6 6-6\" />',\n 'chevron-up': '<path d=\"m18 15-6-6-6 6\" />',\n 'circle': '<circle cx=\"12\" cy=\"12\" r=\"10\" />',\n 'contrast': '<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 18a6 6 0 0 0 0-12v12z\" />',\n 'copy': '<rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" /><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />',\n 'crop': '<path d=\"M6 2v14a2 2 0 0 0 2 2h14\" /><path d=\"M18 22V8a2 2 0 0 0-2-2H2\" />',\n 'diamond': '<path d=\"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z\" />',\n 'dot': '<circle cx=\"12.1\" cy=\"12.1\" r=\"1\" />',\n 'download': '<path d=\"M12 15V3\" /><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" /><path d=\"m7 10 5 5 5-5\" />',\n 'droplet': '<path d=\"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z\" />',\n 'eraser': '<path d=\"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21\" /><path d=\"m5.082 11.09 8.828 8.828\" />',\n 'eye-off': '<path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" /><path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" /><path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" /><path d=\"m2 2 20 20\" />',\n 'eye': '<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />',\n 'flip-horizontal-2': '<path d=\"m3 7 5 5-5 5V7\" /><path d=\"m21 7-5 5 5 5V7\" /><path d=\"M12 20v2\" /><path d=\"M12 14v2\" /><path d=\"M12 8v2\" /><path d=\"M12 2v2\" />',\n 'flip-vertical-2': '<path d=\"m17 3-5 5-5-5h10\" /><path d=\"m17 21-5-5-5 5h10\" /><path d=\"M4 12H2\" /><path d=\"M10 12H8\" /><path d=\"M16 12h-2\" /><path d=\"M22 12h-2\" />',\n 'frame': '<line x1=\"22\" x2=\"2\" y1=\"6\" y2=\"6\" /><line x1=\"22\" x2=\"2\" y1=\"18\" y2=\"18\" /><line x1=\"6\" x2=\"6\" y1=\"2\" y2=\"22\" /><line x1=\"18\" x2=\"18\" y1=\"2\" y2=\"22\" />',\n 'group': '<path d=\"M3 7V5c0-1.1.9-2 2-2h2\" /><path d=\"M17 3h2c1.1 0 2 .9 2 2v2\" /><path d=\"M21 17v2c0 1.1-.9 2-2 2h-2\" /><path d=\"M7 21H5c-1.1 0-2-.9-2-2v-2\" /><rect width=\"7\" height=\"5\" x=\"7\" y=\"7\" rx=\"1\" /><rect width=\"7\" height=\"5\" x=\"10\" y=\"12\" rx=\"1\" />',\n 'hexagon': '<path d=\"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z\" />',\n 'highlighter': '<path d=\"m9 11-6 6v3h9l3-3\" /><path d=\"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4\" />',\n 'history': '<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" /><path d=\"M3 3v5h5\" /><path d=\"M12 7v5l4 2\" />',\n 'grip-vertical': '<circle cx=\"9\" cy=\"12\" r=\"1\" /><circle cx=\"9\" cy=\"5\" r=\"1\" /><circle cx=\"9\" cy=\"19\" r=\"1\" /><circle cx=\"15\" cy=\"12\" r=\"1\" /><circle cx=\"15\" cy=\"5\" r=\"1\" /><circle cx=\"15\" cy=\"19\" r=\"1\" />',\n 'magnet': '<path d=\"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15\" /><path d=\"m5 8 4 4\" /><path d=\"m12 15 4 4\" />',\n 'wand-2': '<path d=\"m14 7 3 3\" /><path d=\"M5 6v4\" /><path d=\"M19 14v4\" /><path d=\"M10 2v2\" /><path d=\"M7 8H3\" /><path d=\"M21 16h-4\" /><path d=\"M11 3H9\" /><path d=\"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72\" />',\n 'scissors': '<circle cx=\"6\" cy=\"6\" r=\"3\" /><path d=\"M8.12 8.12 12 12\" /><path d=\"M20 4 8.12 15.88\" /><circle cx=\"6\" cy=\"18\" r=\"3\" /><path d=\"M14.8 14.8 20 20\" />',\n 'person-standing': '<circle cx=\"12\" cy=\"5\" r=\"1\" /><path d=\"m9 20 3-6 3 6\" /><path d=\"m6 8 6 2 6-2\" /><path d=\"M12 10v4\" />',\n 'image-plus': '<path d=\"M16 5h6\" /><path d=\"M19 2v6\" /><path d=\"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5\" /><path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" /><circle cx=\"9\" cy=\"9\" r=\"2\" />',\n 'image': '<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" /><circle cx=\"9\" cy=\"9\" r=\"2\" /><path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />',\n 'info': '<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 16v-4\" /><path d=\"M12 8h.01\" />',\n 'italic': '<line x1=\"19\" x2=\"10\" y1=\"4\" y2=\"4\" /><line x1=\"14\" x2=\"5\" y1=\"20\" y2=\"20\" /><line x1=\"15\" x2=\"9\" y1=\"4\" y2=\"20\" />',\n 'layers': '<path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" /><path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" /><path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" />',\n 'lock-open': '<rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" /><path d=\"M7 11V7a5 5 0 0 1 9.9-1\" />',\n 'lock': '<rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" /><path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />',\n 'minus': '<path d=\"M5 12h14\" />',\n 'mouse-pointer-2': '<path d=\"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z\" />',\n 'paint-bucket': '<path d=\"M11 7 6 2\" /><path d=\"M18.992 12H2.041\" /><path d=\"M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595\" /><path d=\"m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33\" />',\n 'pencil': '<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" /><path d=\"m15 5 4 4\" />',\n 'pentagon': '<path d=\"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z\" />',\n 'plus': '<path d=\"M5 12h14\" /><path d=\"M12 5v14\" />',\n 'redo-2': '<path d=\"m15 14 5-5-5-5\" /><path d=\"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13\" />',\n 'rotate-ccw': '<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" /><path d=\"M3 3v5h5\" />',\n 'rotate-cw': '<path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" /><path d=\"M21 3v5h-5\" />',\n 'ruler': '<path d=\"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z\" /><path d=\"m14.5 12.5 2-2\" /><path d=\"m11.5 9.5 2-2\" /><path d=\"m8.5 6.5 2-2\" /><path d=\"m17.5 15.5 2-2\" />',\n 'scaling': '<path d=\"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\" /><path d=\"M14 15H9v-5\" /><path d=\"M16 3h5v5\" /><path d=\"M21 3 9 15\" />',\n 'sliders-horizontal': '<path d=\"M10 5H3\" /><path d=\"M12 19H3\" /><path d=\"M14 3v4\" /><path d=\"M16 17v4\" /><path d=\"M21 12h-9\" /><path d=\"M21 19h-5\" /><path d=\"M21 5h-7\" /><path d=\"M8 10v4\" /><path d=\"M8 12H3\" />',\n 'square-dashed-mouse-pointer': '<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\" /><path d=\"M5 3a2 2 0 0 0-2 2\" /><path d=\"M19 3a2 2 0 0 1 2 2\" /><path d=\"M5 21a2 2 0 0 1-2-2\" /><path d=\"M9 3h1\" /><path d=\"M9 21h2\" /><path d=\"M14 3h1\" /><path d=\"M3 9v1\" /><path d=\"M21 9v2\" /><path d=\"M3 14v1\" />',\n 'square': '<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />',\n 'star': '<path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />',\n 'sticker': '<path d=\"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z\" /><path d=\"M15 3v5a1 1 0 0 0 1 1h5\" /><path d=\"M8 13h.01\" /><path d=\"M16 13h.01\" /><path d=\"M10 16s.8 1 2 1c1.3 0 2-1 2-1\" />',\n 'strikethrough': '<path d=\"M16 4H9a3 3 0 0 0-2.83 4\" /><path d=\"M14 12a4 4 0 0 1 0 8H6\" /><line x1=\"4\" x2=\"20\" y1=\"12\" y2=\"12\" />',\n 'trash-2': '<path d=\"M10 11v6\" /><path d=\"M14 11v6\" /><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" /><path d=\"M3 6h18\" /><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />',\n 'triangle': '<path d=\"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />',\n 'type': '<path d=\"M12 4v16\" /><path d=\"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2\" /><path d=\"M9 20h6\" />',\n 'underline': '<path d=\"M6 4v6a6 6 0 0 0 12 0V4\" /><line x1=\"4\" x2=\"20\" y1=\"20\" y2=\"20\" />',\n 'undo-2': '<path d=\"M9 14 4 9l5-5\" /><path d=\"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\" />',\n 'upload': '<path d=\"M12 3v12\" /><path d=\"m17 8-5-5-5 5\" /><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />',\n 'x': '<path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" />',\n};\n\nexport type LucideIconName = keyof typeof LUCIDE_ICONS;\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\n\nimport { LUCIDE_ICONS } from './lucide-icons';\n\n/**\n * Renders one of the baked-in Lucide icons as an inline SVG.\n *\n * The icon name may be given bare (`'crop'`) or prefixed (`'lucide:crop'`, as the\n * tool registry stores it). The inner markup comes only from {@link LUCIDE_ICONS}\n * — a closed set of trusted constants, never user input — so passing it through\n * the sanitizer's bypass is safe and Trusted-Types compatible. Unknown names\n * render nothing (and warn in dev) rather than throwing.\n */\n@Component({\n selector: 'asp-icon',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `<svg\n [attr.width]=\"size()\"\n [attr.height]=\"size()\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n [innerHTML]=\"inner()\"\n ></svg>`,\n styles: [\n `\n :host {\n display: inline-flex;\n line-height: 0;\n }\n `,\n ],\n})\nexport class AspIcon {\n /** Lucide icon name, with or without a `lucide:` prefix. */\n readonly name = input.required<string>();\n /** Rendered width/height in px. */\n readonly size = input<number>(20);\n\n private readonly sanitizer = inject(DomSanitizer);\n\n protected readonly inner = computed<SafeHtml>(() => {\n const key = this.name().replace(/^lucide:/, '');\n const markup = LUCIDE_ICONS[key];\n if (markup === undefined) {\n console.warn(`[asp-image-editor] unknown icon: \"${key}\"`);\n return this.sanitizer.bypassSecurityTrustHtml('');\n }\n return this.sanitizer.bypassSecurityTrustHtml(markup);\n });\n}\n","/**\n * Resolve the visible tool and filter sets from the public inputs.\n *\n * Tools: `tools` (explicit allowlist) ?? default-for-`mode`, then minus `disabledTools`.\n * Filters: `filters` (`'all'` | explicit list) ?? default-for-`mode`.\n *\n * In all cases the output is de-duplicated and restricted to known catalog\n * members, so a stray or misspelled entry can never crash the UI or render a\n * phantom control. Explicit lists preserve their given order; an explicit empty\n * list is honored as \"show nothing\" (it is an override, not a fall-through).\n */\n\nimport { ALL_FILTERS, ALL_TOOLS, type AspFilter, type AspMode, type AspTool } from '../types/editor.types';\nimport { DEFAULT_FILTERS, DEFAULT_TOOLS } from './tool-registry';\n\nconst TOOL_SET = new Set<AspTool>(ALL_TOOLS);\nconst FILTER_SET = new Set<AspFilter>(ALL_FILTERS);\n\n/** Keep only known members, de-duplicating while preserving first-seen order. */\nfunction sanitize<T>(items: readonly T[], known: ReadonlySet<T>): T[] {\n const seen = new Set<T>();\n const out: T[] = [];\n for (const item of items) {\n if (known.has(item) && !seen.has(item)) {\n seen.add(item);\n out.push(item);\n }\n }\n return out;\n}\n\n/**\n * Resolve the ordered set of enabled tools.\n *\n * @param mode baseline preset.\n * @param tools explicit allowlist, or `null` to use the mode default.\n * @param disabledTools tools to subtract from the resolved set.\n */\nexport function resolveTools(\n mode: AspMode,\n tools: readonly AspTool[] | null,\n disabledTools: readonly AspTool[],\n): AspTool[] {\n const source = tools === null ? DEFAULT_TOOLS[mode] : tools;\n const allowed = sanitize(source, TOOL_SET);\n const disabled = new Set(sanitize(disabledTools, TOOL_SET));\n return allowed.filter((tool) => !disabled.has(tool));\n}\n\n/**\n * Resolve the ordered set of enabled filters.\n *\n * @param mode baseline preset.\n * @param filters explicit list, the literal `'all'`, or `null` for the mode default.\n */\nexport function resolveFilters(\n mode: AspMode,\n filters: readonly AspFilter[] | 'all' | null,\n): AspFilter[] {\n if (filters === 'all') {\n return [...ALL_FILTERS];\n }\n const source = filters === null ? DEFAULT_FILTERS[mode] : filters;\n if (source === 'all') {\n return [...ALL_FILTERS];\n }\n return sanitize(source, FILTER_SET);\n}\n","/**\n * Toolbar grouping — maps the resolved tool set into a small number of toolbar\n * slots, Photoshop-style. Each group occupies one slot; a group with more than\n * one resolved member and `flyout: true` shows a flyout to switch between them.\n *\n * Tools NOT represented here (layers, object-ops like group/align/duplicate/\n * delete/opacity) are intentionally absent — they live in the persistent Layers\n * panel, not the toolbar.\n */\n\nimport type { AspTool } from '../types/editor.types';\n\nexport interface ToolGroup {\n readonly id: string;\n readonly label: string;\n /** Lucide icon for the slot. */\n readonly icon: string;\n /** Tools that belong to this slot, in display order. */\n readonly members: readonly AspTool[];\n /** Whether multiple members are switched via a toolbar flyout (vs in-panel tabs). */\n readonly flyout: boolean;\n}\n\nexport interface ResolvedGroup {\n readonly id: string;\n readonly label: string;\n readonly icon: string;\n /** The subset of members present in the resolved tool set, in order. */\n readonly members: AspTool[];\n readonly flyout: boolean;\n}\n\nexport const TOOLBAR_GROUPS: readonly ToolGroup[] = [\n { id: 'select', label: 'Select', icon: 'mouse-pointer-2', members: ['select'], flyout: false },\n {\n id: 'transform',\n label: 'Crop & rotate',\n icon: 'crop',\n members: ['crop', 'rotate', 'straighten', 'resize'],\n flyout: false,\n },\n {\n id: 'color',\n label: 'Color',\n icon: 'sliders-horizontal',\n members: ['adjust', 'filters'],\n flyout: false,\n },\n { id: 'draw', label: 'Draw', icon: 'pencil', members: ['pen', 'highlighter'], flyout: true },\n { id: 'eraser', label: 'Eraser', icon: 'eraser', members: ['eraser'], flyout: false },\n { id: 'shapes', label: 'Shapes', icon: 'square', members: ['shapes'], flyout: false },\n { id: 'text', label: 'Text', icon: 'type', members: ['text'], flyout: false },\n {\n id: 'redact',\n label: 'Redact',\n icon: 'square-dashed-mouse-pointer',\n members: ['redact'],\n flyout: false,\n },\n {\n id: 'magic',\n label: 'Magic',\n icon: 'wand-2',\n members: ['magicwand', 'removebg', 'selectsubject'],\n flyout: true,\n },\n { id: 'canvas', label: 'Canvas', icon: 'image', members: ['frame', 'background'], flyout: true },\n];\n\n/** Resolve toolbar slots for a tool set: keep groups with ≥1 member, members in order. */\nexport function resolveGroups(tools: readonly AspTool[]): ResolvedGroup[] {\n const present = new Set(tools);\n const groups: ResolvedGroup[] = [];\n for (const group of TOOLBAR_GROUPS) {\n const members = group.members.filter((m) => present.has(m));\n if (members.length > 0) {\n groups.push({ id: group.id, label: group.label, icon: group.icon, members, flyout: group.flyout });\n }\n }\n return groups;\n}\n\n/** The group a tool belongs to (or null). */\nexport function groupForTool(tool: AspTool): ToolGroup | null {\n return TOOLBAR_GROUPS.find((g) => g.members.includes(tool)) ?? null;\n}\n","import type { AspThemeTokens } from './tokens';\n\n/**\n * Apply a derived theme to an element as scoped CSS custom properties.\n *\n * Tokens are set on the element's inline `style`, so they cascade only to the\n * editor's own subtree and never leak into (or clash with) the host page. Hosts\n * can still override any individual `--asp-*` variable with higher specificity.\n */\nexport function applyTheme(element: HTMLElement, tokens: AspThemeTokens): void {\n for (const [name, value] of Object.entries(tokens)) {\n element.style.setProperty(name, value);\n }\n}\n","/**\n * OKLab / OKLCH conversions and perceptual color operations.\n *\n * OKLCH is used for theme derivation because its lightness axis is perceptually\n * uniform — lifting/lowering `l` produces visually even steps, and adjusting `l`\n * alone (preserving hue/chroma) is exactly what we need to hit WCAG contrast\n * targets without shifting the brand hue. Math after Björn Ottosson's OKLab.\n *\n * All functions are pure and SSR-safe.\n */\n\nimport { contrastRatio, type Rgb } from './color';\n\n/** A color in OKLCH: `l` (lightness 0–1), `c` (chroma ≥ 0), `h` (hue degrees 0–360). */\nexport interface Oklch {\n readonly l: number;\n readonly c: number;\n readonly h: number;\n}\n\nconst clamp = (value: number, min: number, max: number): number =>\n value < min ? min : value > max ? max : value;\n\n/** sRGB 8-bit channel → linear-light [0,1]. */\nconst toLinear = (channel8: number): number => {\n const c = clamp(channel8, 0, 255) / 255;\n return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n};\n\n/** linear-light [0,1] → sRGB 8-bit channel (clamped). */\nconst fromLinear = (linear: number): number => {\n const c = clamp(linear, 0, 1);\n const encoded = c <= 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;\n return clamp(Math.round(encoded * 255), 0, 255);\n};\n\ninterface Oklab {\n readonly L: number;\n readonly a: number;\n readonly b: number;\n}\n\nfunction srgbToOklab(rgb: Rgb): Oklab {\n const r = toLinear(rgb.r);\n const g = toLinear(rgb.g);\n const b = toLinear(rgb.b);\n\n const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;\n const m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;\n const s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;\n\n const l_ = Math.cbrt(l);\n const m_ = Math.cbrt(m);\n const s_ = Math.cbrt(s);\n\n return {\n L: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,\n a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,\n b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_,\n };\n}\n\ninterface LinearRgb {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n}\n\n/** OKLab → linear-light sRGB, WITHOUT clamping (channels may fall outside [0,1]). */\nfunction oklabToLinear(lab: Oklab): LinearRgb {\n const l_ = lab.L + 0.3963377774 * lab.a + 0.2158037573 * lab.b;\n const m_ = lab.L - 0.1055613458 * lab.a - 0.0638541728 * lab.b;\n const s_ = lab.L - 0.0894841775 * lab.a - 1.291485548 * lab.b;\n\n const l = l_ * l_ * l_;\n const m = m_ * m_ * m_;\n const s = s_ * s_ * s_;\n\n return {\n r: 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n g: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n };\n}\n\nfunction oklabToSrgb(lab: Oklab): Rgb {\n const lin = oklabToLinear(lab);\n return { r: fromLinear(lin.r), g: fromLinear(lin.g), b: fromLinear(lin.b) };\n}\n\nconst GAMUT_EPS = 1e-4;\n\nconst inGamut = (lin: LinearRgb): boolean =>\n lin.r >= -GAMUT_EPS &&\n lin.r <= 1 + GAMUT_EPS &&\n lin.g >= -GAMUT_EPS &&\n lin.g <= 1 + GAMUT_EPS &&\n lin.b >= -GAMUT_EPS &&\n lin.b <= 1 + GAMUT_EPS;\n\n/**\n * Reduce an OKLCH color's chroma (preserving lightness and hue) by binary search\n * until it fits inside the sRGB gamut. This keeps the requested perceptual\n * lightness exact — at the cost of some saturation — which is precisely the\n * trade-off wanted when generating light/dark tints from a saturated accent.\n */\nfunction gamutMapChroma(oklch: Oklch): Oklch {\n const toLin = (c: number): LinearRgb => {\n const hr = (oklch.h * Math.PI) / 180;\n return oklabToLinear({ L: oklch.l, a: c * Math.cos(hr), b: c * Math.sin(hr) });\n };\n\n if (inGamut(toLin(oklch.c))) {\n return oklch;\n }\n\n let lo = 0;\n let hi = oklch.c;\n for (let i = 0; i < 24; i++) {\n const mid = (lo + hi) / 2;\n if (inGamut(toLin(mid))) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return { l: oklch.l, c: lo, h: oklch.h };\n}\n\nconst DEG = 180 / Math.PI;\n\n/** Convert an sRGB color to OKLCH. */\nexport function srgbToOklch(rgb: Rgb): Oklch {\n const { L, a, b } = srgbToOklab(rgb);\n const c = Math.sqrt(a * a + b * b);\n let h = Math.atan2(b, a) * DEG;\n if (h < 0) {\n h += 360;\n }\n return { l: L, c, h };\n}\n\n/** Convert an OKLCH color to sRGB (gamut-clamped to valid channels). */\nexport function oklchToSrgb(oklch: Oklch): Rgb {\n const hr = (oklch.h * Math.PI) / 180;\n return oklabToSrgb({\n L: oklch.l,\n a: oklch.c * Math.cos(hr),\n b: oklch.c * Math.sin(hr),\n });\n}\n\n/**\n * Construct an sRGB color from explicit lightness, chroma, and hue, reducing\n * chroma as needed so the requested lightness is preserved within sRGB. This is\n * the building block for generating tinted neutral scales from a hue.\n */\nexport function oklchColor(l: number, c: number, h: number): Rgb {\n return oklchToSrgb(gamutMapChroma({ l: clamp(l, 0, 1), c: Math.max(0, c), h }));\n}\n\n/**\n * Return `rgb` with its OKLCH lightness set to `l` (0–1), preserving hue and (as\n * much as the gamut allows) chroma. Chroma is reduced only when the requested\n * lightness would otherwise push the color out of sRGB, so the target lightness\n * is hit exactly.\n */\nexport function withLightness(rgb: Rgb, l: number): Rgb {\n const oklch = srgbToOklch(rgb);\n return oklchToSrgb(gamutMapChroma({ l: clamp(l, 0, 1), c: oklch.c, h: oklch.h }));\n}\n\n/** Perceptual blend of two colors in OKLab space; `t` is clamped to [0,1]. */\nexport function mixOklab(a: Rgb, b: Rgb, t: number): Rgb {\n const tt = clamp(t, 0, 1);\n const la = srgbToOklab(a);\n const lb = srgbToOklab(b);\n return oklabToSrgb({\n L: la.L + (lb.L - la.L) * tt,\n a: la.a + (lb.a - la.a) * tt,\n b: la.b + (lb.b - la.b) * tt,\n });\n}\n\n/**\n * Adjust `fg`'s OKLCH lightness (only) until it reaches `targetRatio` contrast\n * against `bg`, preserving hue/chroma so the brand color family is kept. Search\n * direction is chosen by the background's luminance: darken the foreground on a\n * light background, lighten it on a dark one. If the target is unreachable even\n * at the lightness extreme, returns the best (extreme) attempt.\n */\nexport function ensureContrastAA(fg: Rgb, bg: Rgb, targetRatio = 4.5): Rgb {\n if (contrastRatio(fg, bg) >= targetRatio) {\n return fg;\n }\n\n const base = srgbToOklch(fg);\n const bgIsLight = srgbToOklch(bg).l >= 0.5;\n const step = 0.02;\n\n let best = fg;\n let bestRatio = contrastRatio(fg, bg);\n\n for (let l = base.l; l >= 0 && l <= 1; l += bgIsLight ? -step : step) {\n const candidate = oklchToSrgb({ l, c: base.c, h: base.h });\n const ratio = contrastRatio(candidate, bg);\n if (ratio > bestRatio) {\n best = candidate;\n bestRatio = ratio;\n }\n if (ratio >= targetRatio) {\n return candidate;\n }\n }\n\n // Try the absolute extreme (pure black/white via this hue) as a final attempt.\n const extreme = oklchToSrgb({ l: bgIsLight ? 0 : 1, c: 0, h: base.h });\n return contrastRatio(extreme, bg) > bestRatio ? extreme : best;\n}\n","/**\n * The editor's scoped CSS custom-property contract.\n *\n * Every visual style in the library references one of these `--asp-*` variables,\n * and {@link deriveTheme} produces a value for each from the three theming inputs.\n * Hosts may override any individual variable in their own CSS for fine control.\n */\n\n/** Color tokens derived at runtime from `baseColor` + `accentColor` + `themeMode`. */\nexport const COLOR_TOKEN_NAMES = [\n '--asp-bg',\n '--asp-surface',\n '--asp-surface-2',\n '--asp-surface-sunk',\n '--asp-ink',\n '--asp-ink-700',\n '--asp-ink-muted',\n '--asp-ink-faint',\n '--asp-line',\n '--asp-line-strong',\n '--asp-accent',\n '--asp-accent-ink',\n '--asp-accent-hover',\n '--asp-accent-soft',\n '--asp-accent-soft-ink',\n '--asp-ring',\n '--asp-scrim',\n '--asp-success',\n '--asp-warning',\n '--asp-error',\n] as const;\n\n/** Non-color tokens: fixed dimensional/typographic values, the same in every theme. */\nexport const STATIC_TOKEN_NAMES = [\n '--asp-radius-sm',\n '--asp-radius-md',\n '--asp-radius-lg',\n '--asp-radius-pill',\n '--asp-ctl-h',\n '--asp-ctl-h-sm',\n '--asp-font-mono',\n] as const;\n\n/** Every token name the editor sets on its root element. */\nexport const THEME_TOKEN_NAMES = [...COLOR_TOKEN_NAMES, ...STATIC_TOKEN_NAMES] as const;\n\nexport type ColorTokenName = (typeof COLOR_TOKEN_NAMES)[number];\nexport type StaticTokenName = (typeof STATIC_TOKEN_NAMES)[number];\nexport type ThemeTokenName = (typeof THEME_TOKEN_NAMES)[number];\n\n/** A fully-resolved theme: every token name mapped to a CSS value string. */\nexport type AspThemeTokens = Record<ThemeTokenName, string>;\n\n/** Fixed values for the non-color tokens. */\nexport const STATIC_TOKENS: Record<StaticTokenName, string> = {\n '--asp-radius-sm': '6px',\n '--asp-radius-md': '9px',\n '--asp-radius-lg': '14px',\n '--asp-radius-pill': '999px',\n '--asp-ctl-h': '38px',\n '--asp-ctl-h-sm': '30px',\n '--asp-font-mono':\n \"ui-monospace, 'SF Mono', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace\",\n};\n","/**\n * Derive the full `--asp-*` token set from the three theming inputs.\n *\n * Strategy: surfaces, ink, and lines are generated as a perceptually-even\n * lightness scale tinted toward the BASE hue (so the editor blends with the\n * host's neutral palette); interactive tokens are generated from the ACCENT.\n * Text tokens are then run through {@link ensureContrastAA} against their actual\n * background so WCAG AA (AAA for primary ink) is GUARANTEED for any input pair,\n * in both light and dark — the 3 inputs alone always yield a legible result.\n */\n\nimport { contrastRatio, formatHex, parseHex, withAlpha, type Rgb } from './color';\nimport { ensureContrastAA, mixOklab, oklchColor, srgbToOklch, withLightness } from './oklch';\nimport { STATIC_TOKENS, type AspThemeTokens } from './tokens';\n\n/** Light or dark derivation. */\nexport type AspThemeMode = 'light' | 'dark';\n\ninterface ModeConfig {\n /** Lightness (OKLCH) for the surface scale. */\n readonly surface: { bg: number; surface: number; surface2: number; sunk: number };\n /** Target lightness for the ink scale BEFORE AA enforcement. */\n readonly ink: { ink: number; ink700: number; muted: number; faint: number };\n /** Lightness for hairlines. */\n readonly line: { line: number; strong: number };\n /** Cap on the chroma of tinted neutrals (keeps surfaces subtle). */\n readonly neutralChroma: number;\n /** Mix toward the surface when building the soft-accent background. */\n readonly accentSoftMix: number;\n /** Lightness delta applied to the accent for its hover state. */\n readonly accentHoverDelta: number;\n /** Alpha for the focus ring. */\n readonly ringAlpha: number;\n /** Modal scrim. */\n readonly scrim: string;\n /** Semantic status colors (brand-independent). */\n readonly semantic: { success: string; warning: string; error: string };\n}\n\nconst LIGHT: ModeConfig = {\n surface: { bg: 0.972, surface: 1.0, surface2: 0.986, sunk: 0.935 },\n ink: { ink: 0.22, ink700: 0.4, muted: 0.55, faint: 0.7 },\n line: { line: 0.9, strong: 0.82 },\n neutralChroma: 0.02,\n accentSoftMix: 0.86,\n accentHoverDelta: -0.06,\n ringAlpha: 0.35,\n scrim: 'rgba(15, 23, 42, 0.4)',\n semantic: { success: '#117a52', warning: '#9a6700', error: '#c01c28' },\n};\n\nconst DARK: ModeConfig = {\n surface: { bg: 0.15, surface: 0.205, surface2: 0.25, sunk: 0.29 },\n ink: { ink: 0.97, ink700: 0.82, muted: 0.66, faint: 0.48 },\n line: { line: 0.33, strong: 0.42 },\n neutralChroma: 0.025,\n accentSoftMix: 0.8,\n accentHoverDelta: 0.07,\n ringAlpha: 0.42,\n scrim: 'rgba(0, 0, 0, 0.55)',\n semantic: { success: '#4ade80', warning: '#fbbf24', error: '#f87171' },\n};\n\nconst AA = 4.5;\nconst AAA = 7;\n\n/**\n * Build the complete theme token map.\n *\n * @param baseColor neutral anchor (hex) — surfaces/ink/lines tint toward its hue.\n * @param accentColor interactive accent (hex) — kept exactly as the brand color.\n * @param mode `'light'` or `'dark'`.\n * @throws {Error} if either color is not valid hex.\n */\nexport function deriveTheme(\n baseColor: string,\n accentColor: string,\n mode: AspThemeMode,\n): AspThemeTokens {\n const base = parseHex(baseColor);\n const accent = parseHex(accentColor);\n const cfg = mode === 'dark' ? DARK : LIGHT;\n\n const baseOklch = srgbToOklch(base);\n const baseHue = baseOklch.h;\n const neutralChroma = Math.min(baseOklch.c, cfg.neutralChroma);\n\n /** A neutral, tinted toward the base hue, at the given OKLCH lightness. */\n const tint = (l: number): Rgb => oklchColor(l, neutralChroma, baseHue);\n\n const surface = tint(cfg.surface.surface);\n const bg = tint(cfg.surface.bg);\n const surface2 = tint(cfg.surface.surface2);\n const sunk = tint(cfg.surface.sunk);\n\n const ink = ensureContrastAA(tint(cfg.ink.ink), surface, AAA);\n const ink700 = ensureContrastAA(tint(cfg.ink.ink700), surface, AA);\n const inkMuted = ensureContrastAA(tint(cfg.ink.muted), surface, AA);\n const inkFaint = tint(cfg.ink.faint);\n\n const line = tint(cfg.line.line);\n const lineStrong = tint(cfg.line.strong);\n\n const accentL = srgbToOklch(accent).l;\n const white: Rgb = { r: 255, g: 255, b: 255 };\n const black: Rgb = { r: 0, g: 0, b: 0 };\n const betterExtreme = contrastRatio(white, accent) >= contrastRatio(black, accent) ? white : black;\n const accentInk = ensureContrastAA(betterExtreme, accent, AA);\n const accentHover = withLightness(accent, accentL + cfg.accentHoverDelta);\n const accentSoft = mixOklab(accent, surface, cfg.accentSoftMix);\n const accentSoftInk = ensureContrastAA(accent, accentSoft, AA);\n\n return {\n '--asp-bg': formatHex(bg),\n '--asp-surface': formatHex(surface),\n '--asp-surface-2': formatHex(surface2),\n '--asp-surface-sunk': formatHex(sunk),\n '--asp-ink': formatHex(ink),\n '--asp-ink-700': formatHex(ink700),\n '--asp-ink-muted': formatHex(inkMuted),\n '--asp-ink-faint': formatHex(inkFaint),\n '--asp-line': formatHex(line),\n '--asp-line-strong': formatHex(lineStrong),\n '--asp-accent': formatHex(accent),\n '--asp-accent-ink': formatHex(accentInk),\n '--asp-accent-hover': formatHex(accentHover),\n '--asp-accent-soft': formatHex(accentSoft),\n '--asp-accent-soft-ink': formatHex(accentSoftInk),\n '--asp-ring': withAlpha(accent, cfg.ringAlpha),\n '--asp-scrim': cfg.scrim,\n '--asp-success': cfg.semantic.success,\n '--asp-warning': cfg.semantic.warning,\n '--asp-error': cfg.semantic.error,\n ...STATIC_TOKENS,\n };\n}\n","import { ChangeDetectionStrategy, Component, input, signal } from '@angular/core';\n\nimport { AspIcon } from '../../icons/asp-icon';\nimport type { HistoryStep } from '../../engine/delta-history';\n\n/**\n * The History panel (bottom of the options column). Presentational: shows the\n * engine's edit entries, highlighting the current one and dimming any redo\n * branch ahead of the cursor. The user can collapse it via the header chevron.\n */\n@Component({\n selector: 'asp-history-list',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AspIcon],\n templateUrl: './history-list.html',\n styleUrl: './history-list.css',\n})\nexport class AspHistoryList {\n readonly entries = input.required<readonly HistoryStep[]>();\n readonly currentIndex = input.required<number>();\n\n protected readonly collapsed = signal(false);\n\n protected toggle(): void {\n this.collapsed.update((v) => !v);\n }\n}\n","<button\n type=\"button\"\n class=\"asp-history__head\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggle()\"\n>\n <span class=\"asp-history__title\">History</span>\n <asp-icon [name]=\"collapsed() ? 'plus' : 'minus'\" [size]=\"14\" />\n</button>\n@if (!collapsed()) {\n <div class=\"asp-history__scroll\">\n @for (entry of entries(); track $index) {\n <div\n class=\"asp-history__row\"\n [class.asp-history__row--current]=\"$index === currentIndex()\"\n [class.asp-history__row--future]=\"$index > currentIndex()\"\n >\n <asp-icon name=\"dot\" [size]=\"16\" />\n <span class=\"asp-history__label\">{{ entry.label }}</span>\n </div>\n }\n </div>\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\n\n/**\n * A color chooser: preset swatches plus a custom-color control (the native OS\n * picker). Used everywhere a color is set — draw, shapes (stroke + fill), text,\n * arrows, frame, background. Emits the chosen color string on selection.\n */\n@Component({\n selector: 'asp-color-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './color-field.html',\n styleUrl: './color-field.css',\n})\nexport class AspColorField {\n /** Preset swatches. `'transparent'` renders a checker swatch. */\n readonly colors = input.required<readonly string[]>();\n /** Currently selected color. */\n readonly value = input<string>('');\n readonly colorChange = output<string>();\n\n /** A valid `#rrggbb` for the native picker (falls back to black for non-hex values). */\n protected readonly pickerValue = computed(() => {\n const v = this.value();\n return /^#[0-9a-fA-F]{6}$/.test(v) ? v : '#000000';\n });\n\n protected onPick(event: Event): void {\n this.colorChange.emit((event.target as HTMLInputElement).value);\n }\n}\n","<div class=\"asp-cf\">\n @for (color of colors(); track color) {\n <button\n type=\"button\"\n class=\"asp-cf__swatch\"\n [class.asp-cf__swatch--active]=\"value() === color\"\n [class.asp-cf__swatch--white]=\"color === '#ffffff'\"\n [class.asp-cf__swatch--transparent]=\"color === 'transparent'\"\n [style.background]=\"color === 'transparent' ? null : color\"\n [attr.aria-label]=\"color === 'transparent' ? 'Transparent' : 'Color ' + color\"\n [attr.title]=\"color === 'transparent' ? 'Transparent' : color\"\n [attr.aria-pressed]=\"value() === color\"\n (click)=\"colorChange.emit(color)\"\n ></button>\n }\n <label class=\"asp-cf__custom\" title=\"Custom color\">\n <input type=\"color\" [value]=\"pickerValue()\" (input)=\"onPick($event)\" aria-label=\"Custom color\" />\n </label>\n</div>\n","import { ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core';\n\nimport { AspIcon } from '../../icons/asp-icon';\nimport { AspColorField } from '../controls/color-field';\nimport type { ArtboardSize, RedactMode, ShapeKind } from '../../engine/editor-engine';\nimport type { FilterMeta } from '../../registry/tool-registry';\nimport type { AspAspectOption, AspAspectPreset, AspFilter, AspTool } from '../../types/editor.types';\nimport type { FontOption } from '../image-editor/fonts';\n\nexport type { RedactMode } from '../../engine/editor-engine';\n\n/** Frame styles offered in the frame panel. */\nexport interface FrameOption {\n readonly key: string;\n readonly label: string;\n}\n\nexport const FRAME_OPTIONS: readonly FrameOption[] = [\n { key: 'none', label: 'None' },\n { key: 'mat', label: 'Mat' },\n { key: 'line', label: 'Line' },\n { key: 'inset', label: 'Inset' },\n { key: 'hook', label: 'Hook' },\n { key: 'bead', label: 'Bead' },\n];\n\nexport type PanelKind =\n | 'color'\n | 'transform'\n | 'annotate'\n | 'frame'\n | 'background'\n | 'magic'\n | 'ai'\n | 'select'\n | 'none';\n\n/** Background color swatches (`transparent` clears to the checkerboard). */\nexport const BACKGROUND_COLORS: readonly string[] = [\n 'transparent',\n '#ffffff',\n '#000000',\n '#f4f6f9',\n '#1f6feb',\n '#0b0f1a',\n];\n\n/** A named artboard / output-size preset. */\nexport interface ArtboardPreset {\n readonly label: string;\n readonly size: ArtboardSize;\n}\n\n/** Common social / CMS output sizes offered in the Canvas panel. */\nexport const ARTBOARD_PRESETS: readonly ArtboardPreset[] = [\n { label: 'Square 1080', size: { width: 1080, height: 1080 } },\n { label: 'Portrait 4:5', size: { width: 1080, height: 1350 } },\n { label: 'Story 9:16', size: { width: 1080, height: 1920 } },\n { label: 'HD 16:9', size: { width: 1920, height: 1080 } },\n { label: 'OG 1200×630', size: { width: 1200, height: 630 } },\n];\n\n/** Named linear-gradient background presets. */\nexport const BACKGROUND_GRADIENTS: readonly { label: string; colors: string[] }[] = [\n { label: 'Sunset', colors: ['#f59e0b', '#ec4899', '#7c3aed'] },\n { label: 'Ocean', colors: ['#0ea5e9', '#2563eb', '#1e3a8a'] },\n { label: 'Forest', colors: ['#84cc16', '#15803d', '#064e3b'] },\n];\n\nexport interface AdjustChange {\n readonly key: AspFilter;\n readonly value: number;\n}\n\n/** Preset swatch colors offered for annotations (matches the design reference). */\nexport const ANNOTATION_COLORS: readonly string[] = [\n '#f1416c',\n '#009ef6',\n '#50cd89',\n '#181c32',\n '#ffffff',\n];\n\n/**\n * The right-hand contextual options panel. Presentational: it renders the\n * controls for the active tool and emits intent; the container applies changes\n * to the engine. Live slider drags emit `adjustInput`; the final value emits\n * `adjustCommit` (so a drag is one undo step, not dozens).\n */\n@Component({\n selector: 'asp-options-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AspIcon, AspColorField],\n templateUrl: './options-panel.html',\n styleUrl: './options-panel.css',\n})\nexport class AspOptionsPanel {\n readonly activeTool = input.required<AspTool | null>();\n readonly toolTitle = input<string>('');\n\n // adjust\n readonly adjustmentDefs = input<readonly FilterMeta[]>([]);\n readonly adjustments = input<Readonly<Record<string, number>>>({});\n\n // filters (looks)\n readonly lookDefs = input<readonly FilterMeta[]>([]);\n readonly activeLook = input<AspFilter | null>(null);\n\n // crop\n readonly aspectPresets = input<readonly AspAspectPreset[]>([]);\n readonly activeCrop = input<AspAspectPreset>('free');\n readonly aspectRatios = input<readonly AspAspectOption[]>([]);\n readonly activeAspectLabel = input<string>('');\n\n // transform\n readonly straighten = input<number>(0);\n\n // annotate\n readonly annotationColor = input<string>(ANNOTATION_COLORS[0]);\n readonly annotationWidth = input<number>(4);\n readonly fontSize = input<number>(28);\n readonly fonts = input<readonly FontOption[]>([]);\n readonly activeFont = input<string>('');\n /** Google font family names offered as autocomplete in the \"add font\" box. */\n readonly googleFonts = input<readonly string[]>([]);\n /** True while the chosen web font is still loading (shows a spinner). */\n readonly fontLoading = input<boolean>(false);\n /**\n * Kind of the current canvas selection (`null` when nothing is selected). When\n * the neutral Select tool is active, the panel reflects this so a selected text\n * shows its type controls and a selected shape shows fill/stroke.\n */\n readonly selectionKind = input<'text' | 'stroke' | null>(null);\n readonly textBold = input<boolean>(false);\n readonly textItalic = input<boolean>(false);\n readonly textUnderline = input<boolean>(false);\n readonly textStrike = input<boolean>(false);\n readonly textAlign = input<string>('left');\n readonly lineHeight = input<number>(1.16);\n readonly letterSpacing = input<number>(0);\n /** Current rectangle corner radius (px) — drives the sharp → pill slider. */\n readonly cornerRadius = input<number>(0);\n /** Pill-cap radius: the slider's maximum for the current rectangle. */\n readonly cornerRadiusMax = input<number>(55);\n /** Show the corner-radius slider (new rectangle, or a selected rectangle). */\n readonly showCornerRadius = input<boolean>(false);\n readonly redactMode = input<RedactMode>('pixelate');\n readonly magicTolerance = input<number>(32);\n /** True while an in-browser AI op is running (disables the button, shows progress). */\n readonly aiBusy = input<boolean>(false);\n /** AI stage label + 0–1 progress for the status line. */\n readonly aiStage = input<string>('');\n readonly aiProgress = input<number>(0);\n\n readonly frameOptions = input<readonly FrameOption[]>(FRAME_OPTIONS);\n readonly activeFrame = input<string>('none');\n\n readonly resetRequested = output<void>();\n readonly adjustInput = output<AdjustChange>();\n readonly adjustCommit = output<AdjustChange>();\n readonly selectLook = output<AspFilter | null>();\n readonly selectCrop = output<AspAspectPreset>();\n readonly selectCustomCrop = output<AspAspectOption>();\n /** True once a crop region is applied — enables the Reset control. */\n readonly hasCropRegion = input<boolean>(false);\n readonly applyCrop = output<void>();\n readonly cancelCrop = output<void>();\n readonly resetCrop = output<void>();\n readonly rotate = output<number>();\n readonly flip = output<'h' | 'v'>();\n readonly straightenInput = output<number>();\n readonly straightenCommit = output<number>();\n readonly addShape = output<ShapeKind>();\n readonly addText = output<string>();\n readonly fontChange = output<string>();\n /** Add + apply a custom Google font family by name. */\n readonly addFont = output<string>();\n readonly toggleBold = output<void>();\n readonly toggleItalic = output<void>();\n readonly toggleUnderline = output<void>();\n readonly toggleStrike = output<void>();\n readonly textAlignChange = output<string>();\n readonly lineHeightChange = output<number>();\n readonly letterSpacingChange = output<number>();\n readonly textBgChange = output<string>();\n readonly redactModeChange = output<RedactMode>();\n readonly applyRedaction = output<void>();\n readonly magicToleranceChange = output<number>();\n readonly runAi = output<void>();\n readonly annotationColorChange = output<string>();\n /** Live size change (slider drag) — apply without committing history. */\n readonly sizeInput = output<number>();\n /** Final size change (slider release) — commit to history. */\n readonly sizeCommit = output<number>();\n /** Live corner-radius change (slider drag). */\n readonly cornerRadiusInput = output<number>();\n /** Final corner-radius change (slider release) — commit to history. */\n readonly cornerRadiusCommit = output<number>();\n readonly selectFrame = output<string>();\n /** Switch the Color panel sub-tool (Adjust ⟷ Filters tabs). */\n readonly requestTool = output<AspTool>();\n /** Fill color for the selected shape. */\n readonly fillChange = output<string>();\n readonly setBackgroundColor = output<string>();\n readonly setBackgroundGradient = output<string[]>();\n readonly setBackgroundImageFile = output<File>();\n /** Current artboard size (null = full canvas), and changes to it. */\n readonly artboard = input<ArtboardSize | null>(null);\n readonly artboardChange = output<ArtboardSize | null>();\n\n protected readonly colors = ANNOTATION_COLORS;\n /** Shape-fill swatches — includes transparent (no fill). */\n protected readonly fillColors: readonly string[] = ['transparent', ...ANNOTATION_COLORS];\n protected readonly backgroundColors = BACKGROUND_COLORS;\n protected readonly backgroundGradients = BACKGROUND_GRADIENTS;\n protected readonly artboardPresets = ARTBOARD_PRESETS;\n protected readonly textValue = signal('Add a label');\n protected readonly customFontValue = signal('');\n protected readonly customW = signal('1080');\n protected readonly customH = signal('1080');\n\n /** True when the given preset is the active artboard (exact W×H match). */\n protected isArtboardActive(size: ArtboardSize): boolean {\n const a = this.artboard();\n return a !== null && a.width === size.width && a.height === size.height;\n }\n\n protected onCustomW(event: Event): void {\n this.customW.set((event.target as HTMLInputElement).value);\n }\n\n protected onCustomH(event: Event): void {\n this.customH.set((event.target as HTMLInputElement).value);\n }\n\n /** Apply the custom width/height, clamped to a sane 1–10000px range. */\n protected applyCustomArtboard(): void {\n const w = Math.round(Number(this.customW()));\n const h = Math.round(Number(this.customH()));\n if (Number.isFinite(w) && Number.isFinite(h) && w >= 1 && h >= 1 && w <= 10000 && h <= 10000) {\n this.artboardChange.emit({ width: w, height: h });\n }\n }\n\n protected onTextInput(event: Event): void {\n this.textValue.set((event.target as HTMLInputElement).value);\n }\n\n protected onCustomFontInput(event: Event): void {\n this.customFontValue.set((event.target as HTMLInputElement).value);\n }\n\n protected onAddFont(): void {\n const name = this.customFontValue().trim();\n if (name.length > 0) {\n this.addFont.emit(name);\n this.customFontValue.set('');\n }\n }\n\n protected onAddText(): void {\n const text = this.textValue().trim();\n this.addText.emit(text.length > 0 ? text : 'Text');\n }\n\n protected readonly kind = computed<PanelKind>(() => {\n const tool = this.activeTool();\n if (tool === null) {\n return 'none';\n }\n // With the neutral Select tool, reflect the selection: a selected text or\n // shape shows its editing controls instead of the bare \"select\" hint.\n if (tool === 'select') {\n const sel = this.selectionKind();\n return sel === 'text' || sel === 'stroke' ? 'annotate' : 'select';\n }\n switch (tool) {\n case 'adjust':\n case 'filters':\n return 'color';\n case 'crop':\n case 'rotate':\n case 'straighten':\n case 'flip':\n case 'resize':\n return 'transform';\n case 'frame':\n return 'frame';\n case 'background':\n return 'background';\n case 'magicwand':\n return 'magic';\n case 'removebg':\n case 'selectsubject':\n return 'ai';\n case 'pen':\n case 'highlighter':\n case 'eraser':\n case 'shapes':\n case 'arrow':\n case 'line':\n case 'text':\n case 'sticker':\n case 'redact':\n return 'annotate';\n default:\n return 'none';\n }\n });\n\n protected readonly isColorFilters = computed(() => this.activeTool() === 'filters');\n\n /** True for the Text tool, or a selected text under the Select tool. */\n protected readonly isText = computed(\n () =>\n this.activeTool() === 'text' ||\n (this.activeTool() === 'select' && this.selectionKind() === 'text'),\n );\n /** True for the Shapes tool, or a selected shape under the Select tool. */\n protected readonly isShape = computed(\n () =>\n this.activeTool() === 'shapes' ||\n (this.activeTool() === 'select' && this.selectionKind() === 'stroke'),\n );\n protected readonly isRedact = computed(() => this.activeTool() === 'redact');\n /** Label for the AI action button, by which AI tool is active. */\n protected readonly aiActionLabel = computed(() =>\n this.activeTool() === 'selectsubject' ? 'Cut out subject' : 'Remove background',\n );\n protected readonly aiPercent = computed(() => Math.round(this.aiProgress() * 100));\n /** Whether the panel is reflecting a selection rather than an active tool. */\n protected readonly fromSelection = computed(() => this.activeTool() === 'select');\n\n protected readonly strokeLabel = computed(() => (this.isText() ? 'Font size' : 'Thickness'));\n protected readonly sizeValue = computed(() => (this.isText() ? this.fontSize() : this.annotationWidth()));\n protected readonly sizeMin = computed(() => (this.isText() ? 8 : 1));\n protected readonly sizeMax = computed(() => (this.isText() ? 120 : 48));\n\n protected displayValue(def: FilterMeta): string {\n const value = this.adjustments()[def.key] ?? def.defaultValue ?? 0;\n if (def.unit) {\n return `${value}${def.unit}`;\n }\n return String(value);\n }\n\n protected valueOf(def: FilterMeta): number {\n return this.adjustments()[def.key] ?? def.defaultValue ?? 0;\n }\n\n protected onAdjustInput(def: FilterMeta, event: Event): void {\n const value = Number((event.target as HTMLInputElement).value);\n this.adjustInput.emit({ key: def.key, value });\n }\n\n protected onAdjustCommit(def: FilterMeta, event: Event): void {\n const value = Number((event.target as HTMLInputElement).value);\n this.adjustCommit.emit({ key: def.key, value });\n }\n\n protected onStraightenInput(event: Event): void {\n this.straightenInput.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onStraightenCommit(event: Event): void {\n this.straightenCommit.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onMagicTolerance(event: Event): void {\n this.magicToleranceChange.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onFontChange(event: Event): void {\n this.fontChange.emit((event.target as HTMLSelectElement).value);\n }\n\n protected onLineHeight(event: Event): void {\n this.lineHeightChange.emit(Number((event.target as HTMLInputElement).value) / 100);\n }\n\n protected onLetterSpacing(event: Event): void {\n this.letterSpacingChange.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onBackgroundImage(event: Event): void {\n const input = event.target as HTMLInputElement;\n const file = input.files?.[0];\n if (file) {\n this.setBackgroundImageFile.emit(file);\n }\n input.value = '';\n }\n\n protected onSizeInput(event: Event): void {\n this.sizeInput.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onSizeCommit(event: Event): void {\n this.sizeCommit.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onCornerRadiusInput(event: Event): void {\n this.cornerRadiusInput.emit(Number((event.target as HTMLInputElement).value));\n }\n\n protected onCornerRadiusCommit(event: Event): void {\n this.cornerRadiusCommit.emit(Number((event.target as HTMLInputElement).value));\n }\n}\n","<div class=\"asp-panel__head\">\n <div class=\"asp-panel__title\">{{ toolTitle() }}</div>\n <button type=\"button\" class=\"asp-panel__reset\" (click)=\"resetRequested.emit()\">\n <asp-icon name=\"rotate-ccw\" [size]=\"13\" />\n Reset\n </button>\n</div>\n\n<div class=\"asp-panel__body\">\n @switch (kind()) {\n @case ('color') {\n <div class=\"asp-tabs\">\n <button\n type=\"button\"\n class=\"asp-tab\"\n [class.asp-tab--active]=\"!isColorFilters()\"\n (click)=\"requestTool.emit('adjust')\"\n >\n Adjust\n </button>\n <button\n type=\"button\"\n class=\"asp-tab\"\n [class.asp-tab--active]=\"isColorFilters()\"\n (click)=\"requestTool.emit('filters')\"\n >\n Filters\n </button>\n </div>\n\n @if (!isColorFilters()) {\n <div class=\"asp-stack\">\n @for (def of adjustmentDefs(); track def.key) {\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">{{ def.label }}</span>\n <span class=\"asp-field-value\">{{ displayValue(def) }}</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n [min]=\"def.min ?? 0\"\n [max]=\"def.max ?? 100\"\n [value]=\"valueOf(def)\"\n (input)=\"onAdjustInput(def, $event)\"\n (change)=\"onAdjustCommit(def, $event)\"\n [attr.aria-label]=\"def.label\"\n />\n </div>\n }\n </div>\n } @else {\n <div class=\"asp-filter-grid\">\n <button\n type=\"button\"\n class=\"asp-filter\"\n [class.asp-filter--active]=\"activeLook() === null\"\n (click)=\"selectLook.emit(null)\"\n >\n <span class=\"asp-filter__thumb asp-filter__thumb--none\"></span>\n <span class=\"asp-filter__label\">Original</span>\n </button>\n @for (def of lookDefs(); track def.key) {\n <button\n type=\"button\"\n class=\"asp-filter\"\n [class.asp-filter--active]=\"activeLook() === def.key\"\n (click)=\"selectLook.emit(def.key)\"\n >\n <span class=\"asp-filter__thumb\" [attr.data-look]=\"def.key\"></span>\n <span class=\"asp-filter__label\">{{ def.label }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('transform') {\n <div class=\"asp-stack\">\n <div>\n <div class=\"asp-section-label\">Aspect ratio</div>\n <div class=\"asp-chip-row\">\n @for (preset of aspectPresets(); track preset) {\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"activeCrop() === preset && !activeAspectLabel()\"\n (click)=\"selectCrop.emit(preset)\"\n >\n {{ preset === 'free' ? 'Free' : preset === 'original' ? 'Original' : preset }}\n </button>\n }\n @for (option of aspectRatios(); track option.label) {\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"activeAspectLabel() === option.label\"\n (click)=\"selectCustomCrop.emit(option)\"\n >\n {{ option.label }}\n </button>\n }\n </div>\n </div>\n\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n Drag the frame and its handles to choose the area to keep, then Apply.\n </p>\n <div class=\"asp-btn-row\">\n <button type=\"button\" class=\"asp-btn-accent\" (click)=\"applyCrop.emit()\">Apply crop</button>\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"cancelCrop.emit()\">Cancel</button>\n </div>\n @if (hasCropRegion()) {\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"resetCrop.emit()\">Reset crop</button>\n }\n\n <div class=\"asp-section-label asp-mt\">Rotate &amp; flip</div>\n <div class=\"asp-btn-row\">\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"rotate.emit(-90)\">\n <asp-icon name=\"rotate-ccw\" [size]=\"16\" /> 90°\n </button>\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"rotate.emit(90)\">\n <asp-icon name=\"rotate-cw\" [size]=\"16\" /> 90°\n </button>\n </div>\n <div class=\"asp-btn-row\">\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"flip.emit('h')\">\n <asp-icon name=\"flip-horizontal-2\" [size]=\"16\" /> Flip H\n </button>\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"flip.emit('v')\">\n <asp-icon name=\"flip-vertical-2\" [size]=\"16\" /> Flip V\n </button>\n </div>\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">Straighten</span>\n <span class=\"asp-field-value\">{{ straighten() }}°</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"-45\"\n max=\"45\"\n [value]=\"straighten()\"\n (input)=\"onStraightenInput($event)\"\n (change)=\"onStraightenCommit($event)\"\n aria-label=\"Straighten angle\"\n />\n </div>\n </div>\n }\n\n @case ('annotate') {\n <div class=\"asp-stack\">\n @if (isText()) {\n @if (!fromSelection()) {\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n Click anywhere on the canvas to add text, then type. Or add a labelled box below.\n </p>\n <div>\n <label class=\"asp-field-label\" for=\"asp-text-input\">Text</label>\n <div class=\"asp-text-add\">\n <input\n id=\"asp-text-input\"\n class=\"asp-input\"\n [value]=\"textValue()\"\n (input)=\"onTextInput($event)\"\n />\n <button type=\"button\" class=\"asp-btn-accent\" (click)=\"onAddText()\">Add</button>\n </div>\n </div>\n }\n @if (fonts().length) {\n <div>\n <div class=\"asp-field-row\">\n <label class=\"asp-field-label\" for=\"asp-font-select\">Font</label>\n @if (fontLoading()) {\n <span class=\"asp-font-loading\">\n <span class=\"asp-spinner\" aria-hidden=\"true\"></span>\n Loading…\n </span>\n }\n </div>\n <select\n id=\"asp-font-select\"\n class=\"asp-input asp-select\"\n (change)=\"onFontChange($event)\"\n >\n @for (font of fonts(); track font.value) {\n <option [value]=\"font.value\" [selected]=\"font.value === activeFont()\">\n {{ font.label }}\n </option>\n }\n </select>\n <div class=\"asp-text-add asp-mt\">\n <input\n class=\"asp-input\"\n list=\"asp-gfonts\"\n placeholder=\"Search Google fonts…\"\n [value]=\"customFontValue()\"\n (input)=\"onCustomFontInput($event)\"\n (keydown.enter)=\"onAddFont()\"\n aria-label=\"Search and add a Google font\"\n />\n <datalist id=\"asp-gfonts\">\n @for (name of googleFonts(); track name) {\n <option [value]=\"name\"></option>\n }\n </datalist>\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"onAddFont()\">Add</button>\n </div>\n </div>\n }\n\n <div class=\"asp-btn-row\">\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textBold()\" title=\"Bold\" (click)=\"toggleBold.emit()\">\n <asp-icon name=\"bold\" [size]=\"16\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textItalic()\" title=\"Italic\" (click)=\"toggleItalic.emit()\">\n <asp-icon name=\"italic\" [size]=\"16\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textUnderline()\" title=\"Underline\" (click)=\"toggleUnderline.emit()\">\n <asp-icon name=\"underline\" [size]=\"16\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textStrike()\" title=\"Strikethrough\" (click)=\"toggleStrike.emit()\">\n <asp-icon name=\"strikethrough\" [size]=\"16\" />\n </button>\n </div>\n <div class=\"asp-btn-row\">\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textAlign() === 'left'\" title=\"Align left\" (click)=\"textAlignChange.emit('left')\">\n <asp-icon name=\"align-left\" [size]=\"16\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textAlign() === 'center'\" title=\"Align center\" (click)=\"textAlignChange.emit('center')\">\n <asp-icon name=\"align-center\" [size]=\"16\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" [class.asp-icon-btn--on]=\"textAlign() === 'right'\" title=\"Align right\" (click)=\"textAlignChange.emit('right')\">\n <asp-icon name=\"align-right\" [size]=\"16\" />\n </button>\n </div>\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">Line height</span>\n <span class=\"asp-field-value\">{{ lineHeight().toFixed(2) }}</span>\n </div>\n <input type=\"range\" class=\"asp-range\" min=\"80\" max=\"300\" [value]=\"lineHeight() * 100\" (input)=\"onLineHeight($event)\" aria-label=\"Line height\" />\n </div>\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">Letter spacing</span>\n <span class=\"asp-field-value\">{{ letterSpacing() }}</span>\n </div>\n <input type=\"range\" class=\"asp-range\" min=\"-50\" max=\"800\" [value]=\"letterSpacing()\" (input)=\"onLetterSpacing($event)\" aria-label=\"Letter spacing\" />\n </div>\n <div>\n <span class=\"asp-field-label\">Text background</span>\n <asp-color-field class=\"asp-mt\" [colors]=\"fillColors\" [value]=\"''\" (colorChange)=\"textBgChange.emit($event)\" />\n </div>\n }\n\n <div>\n <span class=\"asp-field-label\">{{ isText() ? 'Text color' : 'Color' }}</span>\n <asp-color-field\n class=\"asp-mt\"\n [colors]=\"colors\"\n [value]=\"annotationColor()\"\n (colorChange)=\"annotationColorChange.emit($event)\"\n />\n </div>\n\n @if (isShape()) {\n <div>\n <span class=\"asp-field-label\">Fill</span>\n <asp-color-field\n class=\"asp-mt\"\n [colors]=\"fillColors\"\n [value]=\"''\"\n (colorChange)=\"fillChange.emit($event)\"\n />\n </div>\n }\n\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">{{ strokeLabel() }}</span>\n <span class=\"asp-field-value\">{{ sizeValue() }} px</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n [min]=\"sizeMin()\"\n [max]=\"sizeMax()\"\n [value]=\"sizeValue()\"\n (input)=\"onSizeInput($event)\"\n (change)=\"onSizeCommit($event)\"\n [attr.aria-label]=\"strokeLabel()\"\n />\n </div>\n\n @if (showCornerRadius()) {\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">Corner radius</span>\n <span class=\"asp-field-value\">{{ cornerRadius() }} px</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"0\"\n [max]=\"cornerRadiusMax()\"\n [value]=\"cornerRadius()\"\n (input)=\"onCornerRadiusInput($event)\"\n (change)=\"onCornerRadiusCommit($event)\"\n aria-label=\"Corner radius\"\n />\n </div>\n }\n\n @if (isShape() && !fromSelection()) {\n <div class=\"asp-shape-grid\">\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Rectangle\" (click)=\"addShape.emit('rect')\">\n <asp-icon name=\"square\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Ellipse\" (click)=\"addShape.emit('ellipse')\">\n <asp-icon name=\"circle\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Triangle\" (click)=\"addShape.emit('triangle')\">\n <asp-icon name=\"triangle\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Diamond\" (click)=\"addShape.emit('diamond')\">\n <asp-icon name=\"diamond\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Pentagon\" (click)=\"addShape.emit('pentagon')\">\n <asp-icon name=\"pentagon\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Hexagon\" (click)=\"addShape.emit('hexagon')\">\n <asp-icon name=\"hexagon\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Star\" (click)=\"addShape.emit('star')\">\n <asp-icon name=\"star\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Line\" (click)=\"addShape.emit('line')\">\n <asp-icon name=\"minus\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-icon-btn\" title=\"Arrow\" (click)=\"addShape.emit('arrow')\">\n <asp-icon name=\"arrow-up-right\" [size]=\"17\" />\n </button>\n </div>\n }\n\n @if (isRedact()) {\n <div class=\"asp-chip-row\">\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"redactMode() === 'blur'\"\n (click)=\"redactModeChange.emit('blur')\"\n >\n Blur\n </button>\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"redactMode() === 'pixelate'\"\n (click)=\"redactModeChange.emit('pixelate')\"\n >\n Pixelate\n </button>\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"redactMode() === 'solid'\"\n (click)=\"redactModeChange.emit('solid')\"\n >\n Solid\n </button>\n </div>\n <button type=\"button\" class=\"asp-btn-accent asp-redact-apply\" (click)=\"applyRedaction.emit()\">\n Apply redaction\n </button>\n }\n\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n @if (fromSelection()) {\n Editing the selected {{ isText() ? 'text' : 'object' }}. Adjust its\n properties here; use the Layers panel to reorder or delete.\n } @else if (isShape()) {\n Pick a shape to drop it on the canvas, then drag to position or resize.\n } @else if (isRedact()) {\n Position the box over the area, then Apply to conceal it. After\n applying, click the canvas to place another box.\n } @else if (isText()) {\n Click the canvas to add text and edit in place. Double-click later to re-edit.\n } @else {\n Draw directly on the canvas. Manage objects in the Layers panel.\n }\n </p>\n </div>\n }\n\n @case ('frame') {\n <div class=\"asp-stack\">\n <div class=\"asp-frame-grid\">\n @for (frame of frameOptions(); track frame.key) {\n <button\n type=\"button\"\n class=\"asp-chip asp-frame\"\n [class.asp-chip--active]=\"activeFrame() === frame.key\"\n (click)=\"selectFrame.emit(frame.key)\"\n >\n {{ frame.label }}\n </button>\n }\n </div>\n <div>\n <span class=\"asp-field-label\">Frame color</span>\n <asp-color-field\n class=\"asp-mt\"\n [colors]=\"colors\"\n [value]=\"annotationColor()\"\n (colorChange)=\"annotationColorChange.emit($event)\"\n />\n </div>\n </div>\n }\n\n @case ('background') {\n <div class=\"asp-stack\">\n <div>\n <div class=\"asp-section-label\">Output size</div>\n <div class=\"asp-chip-row\">\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"artboard() === null\"\n (click)=\"artboardChange.emit(null)\"\n >\n Full canvas\n </button>\n @for (preset of artboardPresets; track preset.label) {\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"isArtboardActive(preset.size)\"\n (click)=\"artboardChange.emit(preset.size)\"\n >\n {{ preset.label }}\n </button>\n }\n </div>\n <div class=\"asp-dim-row\">\n <input\n type=\"number\"\n class=\"asp-dim-input\"\n min=\"1\"\n max=\"10000\"\n aria-label=\"Output width in pixels\"\n [value]=\"customW()\"\n (input)=\"onCustomW($event)\"\n />\n <span class=\"asp-dim-x\">×</span>\n <input\n type=\"number\"\n class=\"asp-dim-input\"\n min=\"1\"\n max=\"10000\"\n aria-label=\"Output height in pixels\"\n [value]=\"customH()\"\n (input)=\"onCustomH($event)\"\n />\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"applyCustomArtboard()\">Set</button>\n </div>\n </div>\n <div>\n <div class=\"asp-section-label\">Color</div>\n <asp-color-field\n [colors]=\"backgroundColors\"\n [value]=\"''\"\n (colorChange)=\"setBackgroundColor.emit($event)\"\n />\n </div>\n <div>\n <div class=\"asp-section-label\">Gradient</div>\n <div class=\"asp-chip-row\">\n @for (gradient of backgroundGradients; track gradient.label) {\n <button type=\"button\" class=\"asp-chip\" (click)=\"setBackgroundGradient.emit(gradient.colors)\">\n {{ gradient.label }}\n </button>\n }\n </div>\n </div>\n <div>\n <div class=\"asp-section-label\">Image</div>\n <label class=\"asp-upload\">\n <asp-icon name=\"image-plus\" [size]=\"15\" /> Upload background image\n <input type=\"file\" accept=\"image/*\" (change)=\"onBackgroundImage($event)\" />\n </label>\n </div>\n </div>\n }\n\n @case ('ai') {\n <div class=\"asp-stack\">\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n {{ aiActionLabel() }} runs an AI model entirely in your browser — no\n upload. The model (~tens of MB) downloads once on first use, then is\n cached.\n </p>\n <button\n type=\"button\"\n class=\"asp-btn-accent asp-redact-apply\"\n [disabled]=\"aiBusy()\"\n (click)=\"runAi.emit()\"\n >\n {{ aiBusy() ? 'Working…' : aiActionLabel() }}\n </button>\n @if (aiBusy()) {\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">\n {{ aiStage() === 'loading' ? 'Downloading model…' : 'Processing…' }}\n </span>\n <span class=\"asp-field-value\">{{ aiPercent() }}%</span>\n </div>\n <div class=\"asp-ai-bar\"><span [style.width.%]=\"aiProgress() * 100\"></span></div>\n </div>\n }\n </div>\n }\n\n @case ('magic') {\n <div class=\"asp-stack\">\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n Click a color region on the image to erase it (e.g. a solid background).\n Raise the tolerance to catch more shades; undo if it grabs too much.\n </p>\n <div>\n <div class=\"asp-field-row\">\n <span class=\"asp-field-label\">Tolerance</span>\n <span class=\"asp-field-value\">{{ magicTolerance() }}</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"1\"\n max=\"100\"\n [value]=\"magicTolerance()\"\n (input)=\"onMagicTolerance($event)\"\n aria-label=\"Magic wand tolerance\"\n />\n </div>\n </div>\n }\n\n @case ('select') {\n <p class=\"asp-hint\">\n <asp-icon name=\"info\" [size]=\"13\" />\n Click an object on the canvas to select it. Use the Layers panel to lock,\n reorder, group, align, or change opacity. Shift-click to multi-select.\n </p>\n }\n\n @default {\n <p class=\"asp-hint\">Select a tool to see its options.</p>\n }\n }\n</div>\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport type { LayerInfo } from '../../engine/editor-engine';\nimport { AspIcon } from '../../icons/asp-icon';\n\nexport type AlignMode = 'left' | 'center-h' | 'right' | 'top' | 'center-v' | 'bottom';\n\nexport interface LayerOpacityChange {\n readonly id: string;\n readonly value: number;\n}\n\n/** A layer click, carrying whether a modifier (shift/cmd/ctrl) was held. */\nexport interface LayerSelectEvent {\n readonly id: string;\n readonly additive: boolean;\n}\n\n/** A layer rename request. */\nexport interface LayerRenameEvent {\n readonly id: string;\n readonly name: string;\n}\n\n/**\n * The persistent Layers panel: the object z-stack plus the object-ops that act on\n * the current selection (group/ungroup/align/duplicate/delete + opacity). Lives\n * in the right column below the tool Options, available regardless of the active\n * tool — locking a layer makes clicks pass through, fixing overlap mis-selection.\n *\n * Rows support shift/cmd/ctrl-click multi-select, drag-and-drop reordering, and\n * double-click to rename. Presentational; the container owns the engine.\n */\n@Component({\n selector: 'asp-layer-list',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AspIcon],\n templateUrl: './layer-list.html',\n styleUrl: './layer-list.css',\n})\nexport class AspLayerList {\n readonly layers = input.required<readonly LayerInfo[]>();\n\n readonly selectLayer = output<LayerSelectEvent>();\n readonly toggleLock = output<string>();\n readonly toggleVisible = output<string>();\n readonly moveUp = output<string>();\n readonly moveDown = output<string>();\n readonly removeLayer = output<string>();\n readonly groupSelection = output<void>();\n readonly ungroupSelection = output<void>();\n readonly duplicateSelection = output<void>();\n readonly deleteSelection = output<void>();\n readonly alignSelection = output<AlignMode>();\n readonly opacityInput = output<LayerOpacityChange>();\n readonly opacityCommit = output<LayerOpacityChange>();\n /** New front-to-back order of layer ids after a drag-and-drop reorder. */\n readonly reorderLayers = output<readonly string[]>();\n readonly renameLayer = output<LayerRenameEvent>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n protected readonly collapsed = signal(false);\n protected readonly alignOpen = signal(false);\n\n // drag-and-drop reorder state\n protected readonly draggingId = signal<string | null>(null);\n protected readonly dropTargetId = signal<string | null>(null);\n /** Whether the drop indicator sits above (vs below) the hovered row. */\n protected readonly dropAbove = signal(true);\n\n // inline rename state\n protected readonly editingId = signal<string | null>(null);\n protected readonly editValue = signal('');\n\n protected readonly selected = computed<LayerInfo | undefined>(() =>\n this.layers().find((l) => l.selected),\n );\n protected readonly hasSelection = computed(() => this.selected() !== undefined);\n protected readonly selectionCount = computed(() => this.layers().filter((l) => l.selected).length);\n protected readonly opacityPct = computed(() => Math.round((this.selected()?.opacity ?? 1) * 100));\n\n protected toggle(): void {\n this.collapsed.update((v) => !v);\n }\n\n protected toggleAlign(): void {\n this.alignOpen.update((v) => !v);\n }\n\n protected emitAlign(mode: AlignMode): void {\n this.alignSelection.emit(mode);\n this.alignOpen.set(false);\n }\n\n protected onSelect(id: string, event: MouseEvent): void {\n const additive = event.shiftKey || event.metaKey || event.ctrlKey;\n this.selectLayer.emit({ id, additive });\n }\n\n protected onOpacityInput(event: Event): void {\n const id = this.selected()?.id;\n if (id) {\n this.opacityInput.emit({ id, value: Number((event.target as HTMLInputElement).value) / 100 });\n }\n }\n\n protected onOpacityCommit(event: Event): void {\n const id = this.selected()?.id;\n if (id) {\n this.opacityCommit.emit({ id, value: Number((event.target as HTMLInputElement).value) / 100 });\n }\n }\n\n // ---- drag-and-drop reordering -------------------------------------------\n\n protected onDragStart(id: string, event: DragEvent): void {\n // Don't start a row drag from the action buttons (lock/show/move/etc).\n if ((event.target as HTMLElement).closest('.asp-layers__actions')) {\n event.preventDefault();\n return;\n }\n this.draggingId.set(id);\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = 'move';\n // Firefox requires data to be set for a drag to begin.\n event.dataTransfer.setData('text/plain', id);\n }\n }\n\n protected onDragOver(id: string, event: DragEvent): void {\n const dragged = this.draggingId();\n if (dragged === null || dragged === id) {\n return;\n }\n event.preventDefault();\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = 'move';\n }\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n this.dropAbove.set(event.clientY - rect.top < rect.height / 2);\n this.dropTargetId.set(id);\n }\n\n protected onDrop(id: string, event: DragEvent): void {\n event.preventDefault();\n const dragged = this.draggingId();\n if (dragged === null || dragged === id) {\n this.clearDragState();\n return;\n }\n const order = this.layers()\n .map((l) => l.id)\n .filter((layerId) => layerId !== dragged);\n const targetIndex = order.indexOf(id);\n const insertAt = this.dropAbove() ? targetIndex : targetIndex + 1;\n order.splice(insertAt, 0, dragged);\n this.reorderLayers.emit(order);\n this.clearDragState();\n }\n\n protected onDragEnd(): void {\n this.clearDragState();\n }\n\n private clearDragState(): void {\n this.draggingId.set(null);\n this.dropTargetId.set(null);\n }\n\n // ---- inline rename -------------------------------------------------------\n\n protected startRename(layer: LayerInfo): void {\n this.editingId.set(layer.id);\n this.editValue.set(layer.label);\n // Focus + select the input once it has rendered.\n queueMicrotask(() => {\n const input = this.host.nativeElement.querySelector<HTMLInputElement>(\n '.asp-layers__rename-input',\n );\n input?.focus();\n input?.select();\n });\n }\n\n protected onRenameInput(event: Event): void {\n this.editValue.set((event.target as HTMLInputElement).value);\n }\n\n protected commitRename(layer: LayerInfo): void {\n if (this.editingId() !== layer.id) {\n return;\n }\n const name = this.editValue().trim();\n this.editingId.set(null);\n if (name !== '' && name !== layer.label) {\n this.renameLayer.emit({ id: layer.id, name });\n }\n }\n\n protected cancelRename(): void {\n this.editingId.set(null);\n }\n}\n","<button\n type=\"button\"\n class=\"asp-layers__head\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggle()\"\n>\n <span class=\"asp-layers__title\">Layers</span>\n <asp-icon [name]=\"collapsed() ? 'chevron-up' : 'chevron-down'\" [size]=\"15\" />\n</button>\n\n@if (!collapsed()) {\n <!-- object-ops act on the current selection -->\n <div class=\"asp-layers__ops\">\n <div class=\"asp-layers__opsrow\">\n <button\n type=\"button\"\n class=\"asp-layers__op\"\n title=\"Group\"\n aria-label=\"Group selection\"\n [disabled]=\"!hasSelection()\"\n (click)=\"groupSelection.emit()\"\n >\n <asp-icon name=\"group\" [size]=\"15\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-layers__op\"\n title=\"Ungroup\"\n aria-label=\"Ungroup\"\n [disabled]=\"!hasSelection()\"\n (click)=\"ungroupSelection.emit()\"\n >\n <asp-icon name=\"layers\" [size]=\"15\" />\n </button>\n <div class=\"asp-layers__align\">\n <button\n type=\"button\"\n class=\"asp-layers__op\"\n title=\"Align\"\n aria-label=\"Align\"\n [attr.aria-expanded]=\"alignOpen()\"\n [disabled]=\"!hasSelection()\"\n (click)=\"toggleAlign()\"\n >\n <asp-icon name=\"align-horizontal-distribute-center\" [size]=\"15\" />\n </button>\n @if (alignOpen()) {\n <button type=\"button\" class=\"asp-layers__scrim\" aria-label=\"Close\" (click)=\"toggleAlign()\"></button>\n <div class=\"asp-layers__alignmenu\" role=\"menu\">\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('left')\">Left</button>\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('center-h')\">Center</button>\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('right')\">Right</button>\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('top')\">Top</button>\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('center-v')\">Middle</button>\n <button type=\"button\" role=\"menuitem\" (click)=\"emitAlign('bottom')\">Bottom</button>\n </div>\n }\n </div>\n <button\n type=\"button\"\n class=\"asp-layers__op\"\n title=\"Duplicate\"\n aria-label=\"Duplicate\"\n [disabled]=\"!hasSelection()\"\n (click)=\"duplicateSelection.emit()\"\n >\n <asp-icon name=\"copy\" [size]=\"15\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-layers__op asp-layers__op--danger\"\n title=\"Delete\"\n aria-label=\"Delete\"\n [disabled]=\"!hasSelection()\"\n (click)=\"deleteSelection.emit()\"\n >\n <asp-icon name=\"trash-2\" [size]=\"15\" />\n </button>\n </div>\n\n <div class=\"asp-layers__opacity\">\n <span class=\"asp-layers__opacity-label\">Opacity</span>\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"0\"\n max=\"100\"\n [value]=\"opacityPct()\"\n [disabled]=\"!hasSelection()\"\n (input)=\"onOpacityInput($event)\"\n (change)=\"onOpacityCommit($event)\"\n aria-label=\"Layer opacity\"\n />\n <span class=\"asp-layers__opacity-value\">{{ opacityPct() }}</span>\n </div>\n </div>\n\n <div class=\"asp-layers__scroll\">\n @for (layer of layers(); track layer.id) {\n <div\n class=\"asp-layers__row\"\n [class.asp-layers__row--selected]=\"layer.selected\"\n [class.asp-layers__row--dragging]=\"draggingId() === layer.id\"\n [class.asp-layers__row--drop-above]=\"dropTargetId() === layer.id && dropAbove()\"\n [class.asp-layers__row--drop-below]=\"dropTargetId() === layer.id && !dropAbove()\"\n [draggable]=\"editingId() !== layer.id\"\n (dragstart)=\"onDragStart(layer.id, $event)\"\n (dragover)=\"onDragOver(layer.id, $event)\"\n (drop)=\"onDrop(layer.id, $event)\"\n (dragend)=\"onDragEnd()\"\n >\n <span class=\"asp-layers__grip\" aria-hidden=\"true\" title=\"Drag to reorder\">\n <asp-icon name=\"grip-vertical\" [size]=\"14\" />\n </span>\n @if (editingId() === layer.id) {\n <input\n class=\"asp-layers__rename-input\"\n type=\"text\"\n [value]=\"editValue()\"\n (input)=\"onRenameInput($event)\"\n (keydown.enter)=\"commitRename(layer)\"\n (keydown.escape)=\"cancelRename()\"\n (blur)=\"commitRename(layer)\"\n aria-label=\"Layer name\"\n />\n } @else {\n <button\n type=\"button\"\n class=\"asp-layers__name\"\n [disabled]=\"layer.locked\"\n (click)=\"onSelect(layer.id, $event)\"\n (dblclick)=\"startRename(layer)\"\n [attr.aria-pressed]=\"layer.selected\"\n title=\"Click to select · double-click to rename\"\n >\n {{ layer.label }}\n </button>\n }\n <div class=\"asp-layers__actions\">\n <button\n type=\"button\"\n class=\"asp-layers__btn\"\n [attr.title]=\"layer.visible ? 'Hide' : 'Show'\"\n [attr.aria-label]=\"layer.visible ? 'Hide layer' : 'Show layer'\"\n (click)=\"toggleVisible.emit(layer.id)\"\n >\n <asp-icon [name]=\"layer.visible ? 'eye' : 'eye-off'\" [size]=\"15\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-layers__btn\"\n [class.asp-layers__btn--on]=\"layer.locked\"\n [attr.title]=\"layer.locked ? 'Unlock' : 'Lock'\"\n [attr.aria-label]=\"layer.locked ? 'Unlock layer' : 'Lock layer'\"\n (click)=\"toggleLock.emit(layer.id)\"\n >\n <asp-icon [name]=\"layer.locked ? 'lock' : 'lock-open'\" [size]=\"15\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-layers__btn\"\n title=\"Bring forward\"\n aria-label=\"Bring forward\"\n (click)=\"moveUp.emit(layer.id)\"\n >\n <asp-icon name=\"chevron-up\" [size]=\"15\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-layers__btn\"\n title=\"Send backward\"\n aria-label=\"Send backward\"\n (click)=\"moveDown.emit(layer.id)\"\n >\n <asp-icon name=\"chevron-down\" [size]=\"15\" />\n </button>\n </div>\n </div>\n }\n </div>\n}\n","import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core';\n\nimport { AspIcon } from '../../icons/asp-icon';\nimport { TOOL_REGISTRY } from '../../registry/tool-registry';\nimport type { ResolvedGroup } from '../../registry/toolbar-groups';\nimport type { AspTool } from '../../types/editor.types';\n\n/**\n * The tool rail: one slot per resolved toolbar group. A group with several\n * members and `flyout: true` shows a ▸ that opens a flyout to switch sub-tools\n * (Photoshop-style). The slot shows the group's currently active member's icon.\n */\n@Component({\n selector: 'asp-tool-rail',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AspIcon],\n templateUrl: './tool-rail.html',\n styleUrl: './tool-rail.css',\n})\nexport class AspToolRail {\n readonly groups = input.required<readonly ResolvedGroup[]>();\n readonly activeTool = input.required<AspTool | null>();\n /** Per-group last-selected member, so a flyout slot shows the right icon. */\n readonly activeMembers = input<Record<string, AspTool>>({});\n readonly toolSelect = output<AspTool>();\n\n protected readonly openGroup = signal<string | null>(null);\n /** Fixed-position coords for the open flyout (the rail clips overflow). */\n protected readonly flyoutPos = signal<{ top: number; left: number }>({ top: 0, left: 0 });\n\n protected memberLabel(member: AspTool): string {\n return TOOL_REGISTRY[member].label;\n }\n\n protected memberIcon(member: AspTool): string {\n return TOOL_REGISTRY[member].icon;\n }\n\n protected activeMemberOf(group: ResolvedGroup): AspTool {\n const tool = this.activeTool();\n if (tool !== null && group.members.includes(tool)) {\n return tool;\n }\n const remembered = this.activeMembers()[group.id];\n if (remembered !== undefined && group.members.includes(remembered)) {\n return remembered;\n }\n return group.members[0];\n }\n\n protected isActive(group: ResolvedGroup): boolean {\n const tool = this.activeTool();\n return tool !== null && group.members.includes(tool);\n }\n\n protected hasFlyout(group: ResolvedGroup): boolean {\n return group.flyout && group.members.length > 1;\n }\n\n protected toggleFlyout(id: string, event: Event): void {\n event.stopPropagation();\n const slot = (event.currentTarget as HTMLElement).closest('.asp-rail__slot');\n if (slot) {\n const rect = slot.getBoundingClientRect();\n this.flyoutPos.set({ top: rect.top, left: rect.right + 6 });\n }\n this.openGroup.update((open) => (open === id ? null : id));\n }\n\n protected closeFlyout(): void {\n this.openGroup.set(null);\n }\n\n protected pick(tool: AspTool): void {\n this.toolSelect.emit(tool);\n this.closeFlyout();\n }\n}\n","@for (group of groups(); track group.id) {\n <div class=\"asp-rail__slot\">\n <button\n type=\"button\"\n class=\"asp-rail__tool\"\n [class.asp-rail__tool--active]=\"isActive(group)\"\n [attr.aria-pressed]=\"isActive(group)\"\n [attr.title]=\"group.label\"\n (click)=\"pick(activeMemberOf(group))\"\n >\n <asp-icon [name]=\"memberIcon(activeMemberOf(group))\" [size]=\"21\" />\n <span class=\"asp-rail__label\">{{ group.label }}</span>\n </button>\n\n @if (hasFlyout(group)) {\n <button\n type=\"button\"\n class=\"asp-rail__flyout-toggle\"\n [class.asp-rail__flyout-toggle--open]=\"openGroup() === group.id\"\n [attr.aria-label]=\"group.label + ' — more tools'\"\n [attr.aria-expanded]=\"openGroup() === group.id\"\n title=\"More tools\"\n (click)=\"toggleFlyout(group.id, $event)\"\n ></button>\n\n @if (openGroup() === group.id) {\n <button type=\"button\" class=\"asp-rail__scrim\" aria-label=\"Close\" (click)=\"closeFlyout()\"></button>\n <div\n class=\"asp-rail__flyout\"\n role=\"menu\"\n [style.top.px]=\"flyoutPos().top\"\n [style.left.px]=\"flyoutPos().left\"\n >\n @for (member of group.members; track member) {\n <button\n type=\"button\"\n class=\"asp-rail__flyout-item\"\n [class.asp-rail__flyout-item--active]=\"member === activeTool()\"\n role=\"menuitem\"\n (click)=\"pick(member)\"\n >\n <asp-icon [name]=\"memberIcon(member)\" [size]=\"17\" />\n {{ memberLabel(member) }}\n </button>\n }\n </div>\n }\n }\n </div>\n}\n","/**\n * Lazy web-font loading for the text tool.\n *\n * A chosen family is loaded by injecting the Google Fonts stylesheet once and\n * awaiting the CSS Font Loading API, so text renders in the correct font rather\n * than a fallback. System/generic stacks need no loading. SSR-safe (no-op when\n * `document` is absent), idempotent, and resolves even if loading fails (the\n * fallback simply renders).\n */\n\nexport interface FontOption {\n readonly label: string;\n /** CSS `font-family` value applied to the text object. */\n readonly value: string;\n}\n\n/** Default font choices: a system stack plus popular Google families. */\nexport const DEFAULT_FONTS: readonly FontOption[] = [\n { label: 'System', value: 'system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif' },\n { label: 'Inter', value: 'Inter' },\n { label: 'Roboto', value: 'Roboto' },\n { label: 'Open Sans', value: 'Open Sans' },\n { label: 'Lato', value: 'Lato' },\n { label: 'Montserrat', value: 'Montserrat' },\n { label: 'Poppins', value: 'Poppins' },\n { label: 'Raleway', value: 'Raleway' },\n { label: 'Nunito', value: 'Nunito' },\n { label: 'Work Sans', value: 'Work Sans' },\n { label: 'Rubik', value: 'Rubik' },\n { label: 'Oswald', value: 'Oswald' },\n { label: 'Bebas Neue', value: 'Bebas Neue' },\n { label: 'Merriweather', value: 'Merriweather' },\n { label: 'Playfair Display', value: 'Playfair Display' },\n { label: 'Lobster', value: 'Lobster' },\n { label: 'Pacifico', value: 'Pacifico' },\n { label: 'Dancing Script', value: 'Dancing Script' },\n { label: 'Caveat', value: 'Caveat' },\n { label: 'Roboto Mono', value: 'Roboto Mono' },\n];\n\n/**\n * A searchable catalog of popular Google Fonts for the \"Add a Google font\" box.\n * Names match Google's exact family names so the CSS API resolves them; the\n * input offers them as native autocomplete suggestions, so users don't have to\n * remember the precise full name.\n */\nexport const GOOGLE_FONTS: readonly string[] = [\n 'Abril Fatface', 'Alegreya', 'Anton', 'Archivo', 'Archivo Black', 'Arvo',\n 'Asap', 'Assistant', 'Barlow', 'Barlow Condensed', 'Bebas Neue', 'Bitter',\n 'Bree Serif', 'Cabin', 'Cairo', 'Cardo', 'Caveat', 'Comfortaa', 'Cormorant',\n 'Cormorant Garamond', 'Courier Prime', 'Crimson Text', 'DM Sans', 'DM Serif Display',\n 'Dancing Script', 'Dosis', 'EB Garamond', 'Exo', 'Exo 2', 'Figtree', 'Fira Sans',\n 'Fjalla One', 'Frank Ruhl Libre', 'Fraunces', 'Gelasio', 'Hind', 'IBM Plex Mono',\n 'IBM Plex Sans', 'IBM Plex Serif', 'Inconsolata', 'Inter', 'Josefin Sans',\n 'Jost', 'Kanit', 'Karla', 'Lato', 'Lexend', 'Libre Baskerville', 'Libre Franklin',\n 'Lobster', 'Lobster Two', 'Lora', 'Manrope', 'Marcellus', 'Merriweather',\n 'Merriweather Sans', 'Montserrat', 'Montserrat Alternates', 'Mukta', 'Mulish',\n 'Noto Sans', 'Noto Serif', 'Nunito', 'Nunito Sans', 'Old Standard TT', 'Open Sans',\n 'Oswald', 'Outfit', 'Overpass', 'PT Sans', 'PT Serif', 'Pacifico', 'Permanent Marker',\n 'Playfair Display', 'Poppins', 'Prompt', 'Quicksand', 'Raleway', 'Roboto',\n 'Roboto Condensed', 'Roboto Mono', 'Roboto Slab', 'Rubik', 'Sacramento', 'Sora',\n 'Source Code Pro', 'Source Sans 3', 'Source Serif 4', 'Space Grotesk', 'Space Mono',\n 'Spectral', 'Tajawal', 'Teko', 'Titillium Web', 'Ubuntu', 'Urbanist', 'Varela Round',\n 'Vollkorn', 'Work Sans', 'Yanone Kaffeesatz', 'Zilla Slab',\n];\n\nconst requested = new Set<string>();\n\nfunction isGenericStack(family: string): boolean {\n return /,|system-ui|sans-serif|serif|monospace/i.test(family);\n}\n\n/** A loadable web font (not a generic/system stack that needs no fetching). */\nexport function isWebFont(family: string): boolean {\n return typeof document !== 'undefined' && !isGenericStack(family);\n}\n\n/** Ensure a font family is loaded; resolves immediately for generic/system stacks. */\nexport function ensureFontLoaded(family: string): Promise<void> {\n if (typeof document === 'undefined' || isGenericStack(family)) {\n return Promise.resolve();\n }\n const key = family.toLowerCase();\n if (!requested.has(key)) {\n requested.add(key);\n const id = `asp-font-${key.replace(/[^a-z0-9]+/g, '-')}`;\n if (!document.getElementById(id)) {\n const link = document.createElement('link');\n link.id = id;\n link.rel = 'stylesheet';\n const param = family.trim().replace(/\\s+/g, '+');\n link.href = `https://fonts.googleapis.com/css2?family=${param}:wght@400;600;700&display=swap`;\n document.head.appendChild(link);\n }\n }\n const fonts = document.fonts;\n if (!fonts) {\n return Promise.resolve();\n }\n return fonts\n .load(`16px \"${family}\"`)\n .then(() => undefined)\n .catch(() => undefined);\n}\n","/**\n * Built-in sample images for the image picker, generated at runtime as\n * same-origin data URLs (so filters and export are never tainted by CORS).\n */\n\nexport interface SampleImage {\n readonly key: string;\n readonly label: string;\n readonly dataUrl: string;\n}\n\ninterface GradientStop {\n readonly offset: number;\n readonly color: string;\n}\n\nconst GRADIENTS: readonly { key: string; label: string; stops: readonly GradientStop[] }[] = [\n {\n key: 'sunset',\n label: 'Sunset',\n stops: [\n { offset: 0, color: '#f59e0b' },\n { offset: 0.5, color: '#ec4899' },\n { offset: 1, color: '#7c3aed' },\n ],\n },\n {\n key: 'ocean',\n label: 'Ocean',\n stops: [\n { offset: 0, color: '#0ea5e9' },\n { offset: 0.5, color: '#2563eb' },\n { offset: 1, color: '#1e3a8a' },\n ],\n },\n {\n key: 'forest',\n label: 'Forest',\n stops: [\n { offset: 0, color: '#84cc16' },\n { offset: 0.5, color: '#15803d' },\n { offset: 1, color: '#064e3b' },\n ],\n },\n {\n key: 'dusk',\n label: 'Dusk',\n stops: [\n { offset: 0, color: '#1e293b' },\n { offset: 0.5, color: '#7c3aed' },\n { offset: 1, color: '#db2777' },\n ],\n },\n];\n\nfunction renderGradient(stops: readonly GradientStop[]): string {\n const canvas = document.createElement('canvas');\n canvas.width = 900;\n canvas.height = 600;\n const ctx = canvas.getContext('2d');\n if (ctx) {\n const grad = ctx.createLinearGradient(0, 0, 900, 600);\n for (const stop of stops) {\n grad.addColorStop(stop.offset, stop.color);\n }\n ctx.fillStyle = grad;\n ctx.fillRect(0, 0, 900, 600);\n // A couple of soft shapes so transforms/filters are visible.\n ctx.fillStyle = 'rgba(255,255,255,0.16)';\n ctx.beginPath();\n ctx.arc(250, 200, 120, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = 'rgba(0,0,0,0.12)';\n ctx.beginPath();\n ctx.arc(660, 420, 150, 0, Math.PI * 2);\n ctx.fill();\n }\n return canvas.toDataURL('image/png');\n}\n\n/** Build the sample image set. Call lazily (needs the DOM). */\nexport function buildSampleImages(): SampleImage[] {\n return GRADIENTS.map((g) => ({ key: g.key, label: g.label, dataUrl: renderGradient(g.stops) }));\n}\n","import { NgTemplateOutlet, UpperCasePipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild,\n type OnDestroy,\n} from '@angular/core';\n\nimport {\n EditorEngine,\n type ArtboardSize,\n type LayerInfo,\n type RedactMode,\n type SelectionStyleInfo,\n type ShapeKind,\n} from '../../engine/editor-engine';\nimport type { HistoryStep } from '../../engine/delta-history';\nimport { aspectRatioValue } from '../../engine/crop';\nimport { drawRuler, type RulerColors } from '../../engine/rulers';\nimport { AspIcon } from '../../icons/asp-icon';\nimport { FILTER_REGISTRY, TOOL_REGISTRY, type FilterMeta, type ToolMeta } from '../../registry/tool-registry';\nimport { resolveFilters, resolveTools } from '../../registry/resolve-tools';\nimport { groupForTool, resolveGroups, type ResolvedGroup } from '../../registry/toolbar-groups';\nimport { applyTheme } from '../../theme/apply-theme';\nimport { deriveTheme, type AspThemeMode } from '../../theme/derive-theme';\nimport type {\n AspAspectOption,\n AspAspectPreset,\n AspEditorError,\n AspExportFormat,\n AspFilter,\n AspMode,\n AspSize,\n AspTool,\n} from '../../types/editor.types';\nimport { AspHistoryList } from '../history/history-list';\nimport {\n ANNOTATION_COLORS,\n AspOptionsPanel,\n FRAME_OPTIONS,\n type AdjustChange,\n} from '../options-panel/options-panel';\nimport {\n AspLayerList,\n type LayerRenameEvent,\n type LayerSelectEvent,\n} from '../layers/layer-list';\nimport { AspToolRail } from '../rail/tool-rail';\nimport {\n DEFAULT_FONTS,\n GOOGLE_FONTS,\n ensureFontLoaded,\n isWebFont,\n type FontOption,\n} from './fonts';\nimport { buildSampleImages, type SampleImage } from './sample-images';\n\ntype AlignMode = 'left' | 'center-h' | 'right' | 'top' | 'center-v' | 'bottom';\n\nconst FALLBACK_BASE = '#f4f6f9';\nconst FALLBACK_ACCENT = '#1f6feb';\nconst ZOOM_STEP = 25;\n\n/**\n * Minimum host size per mode, so the chrome (rail, options panel, layers,\n * top bar) always has room to render no matter what size the host requests.\n * `advanced`/`full` carry the rail + canvas + options column; the simpler\n * modes need much less.\n */\nconst MODE_MIN: Record<AspMode, { width: string; height: string }> = {\n viewer: { width: '240px', height: '200px' },\n basic: { width: '300px', height: '360px' },\n advanced: { width: '640px', height: '460px' },\n full: { width: '640px', height: '460px' },\n};\n\n/** Resolve a host-supplied size to a CSS length (number → px), or a fallback. */\nfunction toCssSize(value: AspSize | null | undefined, fallback: string): string {\n if (value === null || value === undefined || value === '') {\n return fallback;\n }\n return typeof value === 'number' ? `${value}px` : value;\n}\n\n/**\n * `<asp-image-editor>` — the editor's root/container component.\n *\n * Owns the {@link EditorEngine}, the resolved tool/filter sets, theming, and all\n * workspace state. Presentational children (rail, options panel, history) render\n * data and emit intent; this container is the only place that drives the engine.\n *\n * Phase 4 implements the `advanced`/`full` workspace; `basic`/`viewer` layouts\n * arrive in Phase 5.\n */\n@Component({\n selector: 'asp-image-editor',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgTemplateOutlet,\n UpperCasePipe,\n AspIcon,\n AspToolRail,\n AspOptionsPanel,\n AspHistoryList,\n AspLayerList,\n ],\n templateUrl: './image-editor.html',\n styleUrl: './image-editor.css',\n})\nexport class AspImageEditor implements OnDestroy {\n // ---- public API ----------------------------------------------------------\n readonly src = input<string | Blob | null>(null);\n readonly mode = input<AspMode>('advanced');\n /**\n * Editor width — a number (px) or any CSS length (`'70%'`, `'80vh'`,\n * `'calc(100vw - 320px)'`). Defaults to filling the host's container. A\n * per-mode minimum is always enforced so the chrome stays usable.\n */\n readonly width = input<AspSize | null>(null);\n /** Editor height — same shape as {@link width}. */\n readonly height = input<AspSize | null>(null);\n readonly tools = input<AspTool[] | null>(null);\n readonly disabledTools = input<AspTool[]>([]);\n readonly filters = input<AspFilter[] | 'all' | null>(null);\n readonly aspectPresets = input<AspAspectPreset[]>(['free', '1:1', '4:3', '16:9']);\n /** Host-defined crop aspect targets (e.g. CMS sizes); shown after the presets. */\n readonly aspectRatios = input<AspAspectOption[]>([]);\n readonly exportFormats = input<AspExportFormat[]>(['png', 'jpeg', 'webp']);\n readonly exportQuality = input<number>(90);\n\n readonly baseColor = input<string>(FALLBACK_BASE);\n readonly accentColor = input<string>(FALLBACK_ACCENT);\n readonly themeMode = input<AspThemeMode>('light');\n\n /** Heading shown by the `basic` modal layout. */\n readonly heading = input<string>('Edit image');\n\n /** Show the edit-history panel in the workspace (hosts that don't want it set false). */\n readonly showHistory = input<boolean>(true);\n\n /** Enable keyboard shortcuts while the pointer is over the editor. */\n readonly keyboardEnabled = input<boolean>(true);\n\n readonly saved = output<Blob>();\n readonly canceled = output<void>();\n /** Fired after an image successfully loads (initial, picker, or upload). */\n readonly imageLoaded = output<void>();\n /** Fired with the exported Blob when the user downloads from the Export menu. */\n readonly exported = output<Blob>();\n /** Fired on a recoverable error (load/export/engine init) instead of throwing. */\n readonly errorOccurred = output<AspEditorError>();\n\n // ---- view refs -----------------------------------------------------------\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly canvasRef = viewChild<ElementRef<HTMLCanvasElement>>('canvasEl');\n private readonly stageRef = viewChild<ElementRef<HTMLElement>>('stageEl');\n private readonly rulerTopRef = viewChild<ElementRef<HTMLCanvasElement>>('rulerTopEl');\n private readonly rulerLeftRef = viewChild<ElementRef<HTMLCanvasElement>>('rulerLeftEl');\n private readonly guidesOverlayRef = viewChild<ElementRef<HTMLCanvasElement>>('guidesOverlayEl');\n\n // ---- engine + readiness --------------------------------------------------\n private engine: EditorEngine | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private boundCanvas: HTMLCanvasElement | null = null;\n private lastSource: string | Blob | null | undefined = undefined;\n protected readonly engineReady = signal(false);\n\n // ---- resolved configuration ----------------------------------------------\n protected readonly resolvedToolKeys = computed<AspTool[]>(() =>\n resolveTools(this.mode(), this.tools(), this.disabledTools()),\n );\n protected readonly resolvedTools = computed<ToolMeta[]>(() =>\n this.resolvedToolKeys().map((t) => TOOL_REGISTRY[t]),\n );\n protected readonly resolvedGroups = computed<ResolvedGroup[]>(() =>\n resolveGroups(this.resolvedToolKeys()),\n );\n protected readonly activeMembers = signal<Record<string, AspTool>>({});\n protected readonly resolvedFilters = computed<AspFilter[]>(() =>\n resolveFilters(this.mode(), this.filters()),\n );\n protected readonly adjustmentDefs = computed<FilterMeta[]>(() =>\n this.resolvedFilters()\n .map((f) => FILTER_REGISTRY[f])\n .filter((m) => m.kind === 'adjustment'),\n );\n protected readonly lookDefs = computed<FilterMeta[]>(() =>\n this.resolvedFilters()\n .map((f) => FILTER_REGISTRY[f])\n .filter((m) => m.kind === 'look'),\n );\n\n protected readonly frameOptions = FRAME_OPTIONS;\n\n // ---- workspace state -----------------------------------------------------\n protected readonly activeTool = signal<AspTool | null>(null);\n protected readonly zoomPct = signal(100);\n protected readonly canUndo = signal(false);\n protected readonly canRedo = signal(false);\n protected readonly historyEntries = signal<readonly HistoryStep[]>([]);\n protected readonly historyIndex = signal(0);\n\n protected readonly adjustments = signal<Record<string, number>>(defaultAdjustmentValues());\n protected readonly activeLook = signal<AspFilter | null>(null);\n protected readonly activeCrop = signal<AspAspectPreset>('free');\n protected readonly activeAspectLabel = signal('');\n protected readonly straighten = signal(0);\n /** Available text fonts (host-overridable). */\n readonly fonts = input<FontOption[]>([...DEFAULT_FONTS]);\n\n protected readonly annotationColor = signal(ANNOTATION_COLORS[0]);\n protected readonly annotationWidth = signal(4);\n protected readonly fontSize = signal(28);\n protected readonly fontFamily = signal(DEFAULT_FONTS[0].value);\n protected readonly textBold = signal(false);\n protected readonly textItalic = signal(false);\n protected readonly textUnderline = signal(false);\n protected readonly textStrike = signal(false);\n protected readonly textAlign = signal('left');\n protected readonly lineHeight = signal(1.16);\n protected readonly letterSpacing = signal(0);\n /** Custom fonts added at runtime, merged after the host-provided list. */\n protected readonly customFonts = signal<FontOption[]>([]);\n protected readonly allFonts = computed<FontOption[]>(() => {\n const base = this.fonts();\n const extra = this.customFonts().filter((c) => !base.some((b) => b.value === c.value));\n return [...base, ...extra];\n });\n /** Google font names offered as autocomplete suggestions in the add-font box. */\n protected readonly googleFonts = GOOGLE_FONTS;\n protected readonly hasSelection = signal(false);\n /** Kind of the current selection, so the panel can reflect it under Select. */\n protected readonly selectionKind = signal<'text' | 'stroke' | null>(null);\n /** True while a web font for the current choice is still loading. */\n protected readonly fontLoading = signal(false);\n /** Transient error message shown as an in-editor toast (null = hidden). */\n protected readonly errorToast = signal<string | null>(null);\n private errorToastTimer: ReturnType<typeof setTimeout> | null = null;\n protected readonly activeFrame = signal('none');\n /** Corner radius (px) for the next rectangle, and the selected rectangle. */\n protected readonly shapeRadius = signal(0);\n /** Pill-cap radius driving the corner-radius slider's max. */\n protected readonly shapeRadiusMax = signal(55);\n /** True when the current selection is a single rectangle. */\n protected readonly selectedIsRect = signal(false);\n /**\n * Show the corner-radius slider when defining the next rectangle (Shapes tool,\n * nothing selected) or when a rectangle is selected.\n */\n protected readonly showCornerRadius = computed(\n () => (this.activeTool() === 'shapes' && !this.hasSelection()) || this.selectedIsRect(),\n );\n protected readonly redactMode = signal<RedactMode>('pixelate');\n protected readonly magicTolerance = signal(32);\n protected readonly aiBusy = signal(false);\n protected readonly aiStage = signal('');\n protected readonly aiProgress = signal(0);\n /** True once a crop region has been applied (enables the panel's Reset). */\n protected readonly hasCropRegion = signal(false);\n private redactActive = false;\n private cropActive = false;\n\n protected onMagicTolerance(value: number): void {\n this.magicTolerance.set(value);\n }\n\n /** Run the active AI tool (background removal / subject cut-out) on the image. */\n protected runAi(): void {\n const engine = this.engine;\n if (!engine || this.aiBusy()) {\n return;\n }\n const mode = this.activeTool() === 'selectsubject' ? 'subject' : 'replace';\n this.aiBusy.set(true);\n this.aiProgress.set(0);\n this.aiStage.set('loading');\n void engine\n .removeImageBackground(mode)\n .then((ok) => {\n if (!ok) {\n this.emitError('ai-no-image', new Error('No image to process'));\n }\n this.sync();\n })\n .catch((error) => this.emitError('ai-failed', error))\n .finally(() => this.aiBusy.set(false));\n }\n\n protected readonly layers = signal<LayerInfo[]>([]);\n\n protected readonly pickerOpen = signal(false);\n protected readonly exportOpen = signal(false);\n protected readonly historyOpen = signal(false);\n protected readonly snapEnabled = signal(true);\n protected readonly rulersEnabled = signal(false);\n /** Bumped by the engine's viewport listener to re-render rulers on zoom/pan/resize. */\n private readonly rulerVersion = signal(0);\n /** Bumped by the engine's guides listener to repaint the guides overlay. */\n private readonly guidesVersion = signal(0);\n /** Tears down an in-flight ruler→guide drag; also called on destroy. */\n private guideDraftCleanup: (() => void) | null = null;\n protected readonly artboard = signal<ArtboardSize | null>(null);\n protected readonly exportFormat = signal<AspExportFormat>('png');\n protected readonly exportQ = signal(90);\n protected readonly samples = signal<SampleImage[]>([]);\n\n protected readonly activeToolMeta = computed<ToolMeta | null>(() => {\n const tool = this.activeTool();\n return tool ? TOOL_REGISTRY[tool] : null;\n });\n protected readonly toolTitle = computed(() => {\n // Under the neutral Select tool, title the panel by what's selected.\n if (this.activeTool() === 'select') {\n const kind = this.selectionKind();\n if (kind === 'text') {\n return 'Text';\n }\n if (kind === 'stroke') {\n return 'Object';\n }\n }\n return this.activeToolMeta()?.label ?? '';\n });\n protected readonly zoomLabel = computed(() => `${this.zoomPct()}%`);\n protected readonly layout = computed<'workspace' | 'basic' | 'viewer'>(() => {\n const mode = this.mode();\n if (mode === 'basic') {\n return 'basic';\n }\n if (mode === 'viewer') {\n return 'viewer';\n }\n return 'workspace';\n });\n\n /**\n * The resolved theme. Invalid hex inputs are a developer error; rather than\n * throwing and breaking the host app, we fall back to the default palette\n * (keeping the requested mode) and warn once. Declared before the constructor\n * so it is initialized before any effect that reads it.\n */\n private readonly theme = computed(() => {\n try {\n return deriveTheme(this.baseColor(), this.accentColor(), this.themeMode());\n } catch (error) {\n console.warn('[asp-image-editor] invalid theme color, using defaults:', error);\n return deriveTheme(FALLBACK_BASE, FALLBACK_ACCENT, this.themeMode());\n }\n });\n\n /** Serializes engine (re)binding/loading so concurrent effect fires can't race. */\n private opChain: Promise<void> = Promise.resolve();\n\n constructor() {\n // Apply the derived theme to the host element whenever inputs change.\n effect(() => applyTheme(this.host.nativeElement, this.theme()));\n\n // Apply the host-requested size, with a per-mode minimum so the chrome\n // always renders. Default fills the container; an explicit width/height\n // (px / % / vh / calc) overrides it. The stage's ResizeObserver picks up\n // the change and resizes the canvas.\n effect(() => {\n const el = this.host.nativeElement;\n const min = MODE_MIN[this.mode()];\n el.style.width = toCssSize(this.width(), '100%');\n el.style.height = toCssSize(this.height(), '100%');\n // Cap the min-width to the available space so the editor never forces\n // horizontal overflow on a narrow screen; the layout reflows instead.\n el.style.minWidth = `min(${min.width}, 100%)`;\n el.style.minHeight = min.height;\n });\n\n // Show a progress cursor over the editor while a web font is fetching.\n effect(() => {\n this.host.nativeElement.style.cursor = this.fontLoading() ? 'progress' : '';\n });\n\n // Default the active tool to Color (adjust) when available, else the first\n // resolved tool; keep it valid as the resolved set changes.\n effect(() => {\n const keys = this.resolvedToolKeys();\n const current = untracked(this.activeTool);\n if (keys.length === 0) {\n if (current !== null) {\n this.activeTool.set(null);\n }\n } else if (current === null || !keys.includes(current)) {\n this.activeTool.set(keys.includes('adjust') ? 'adjust' : keys[0]);\n }\n });\n\n // Sync export defaults from inputs.\n effect(() => {\n this.exportQ.set(this.exportQuality());\n const formats = this.exportFormats();\n if (formats.length > 0 && !formats.includes(untracked(this.exportFormat))) {\n this.exportFormat.set(formats[0]);\n }\n });\n\n // Bind the engine to the rendered canvas and (re)load the source. Runs on\n // first render and again whenever the layout swaps the canvas element\n // (mode change) or the `src` input changes.\n effect(() => {\n const canvas = this.canvasRef()?.nativeElement;\n const stage = this.stageRef()?.nativeElement;\n const src = this.src();\n if (!canvas || !stage) {\n return;\n }\n this.opChain = this.opChain\n .catch(() => undefined)\n .then(() => untracked(() => this.ensureEngineAndLoad(canvas, stage, src)));\n });\n\n // Free-draw follows the active tool + current brush settings.\n effect(() => {\n const tool = this.activeTool();\n const color = this.annotationColor();\n const width = this.annotationWidth();\n if (!this.engineReady() || !this.engine) {\n return;\n }\n const drawing = tool === 'pen' || tool === 'highlighter' || tool === 'eraser';\n this.engine.setFreeDraw(drawing, { color, strokeWidth: width }, tool === 'highlighter');\n // Text tool: click the canvas to drop an editable text box.\n this.engine.setTextMode(tool === 'text');\n // Magic wand: click a region of the image to flood-fill erase it.\n this.engine.setMagicMode(tool === 'magicwand');\n });\n\n // Re-render the rulers whenever they are toggled on, their canvases appear,\n // or the viewport changes (rulerVersion is bumped by the engine listener).\n effect(() => {\n this.rulerVersion();\n const on = this.rulersEnabled();\n const top = this.rulerTopRef()?.nativeElement;\n const left = this.rulerLeftRef()?.nativeElement;\n if (on && top && left && this.engineReady() && this.engine) {\n this.renderRulers(top, left);\n }\n });\n\n // Repaint the guides overlay on guide changes or viewport changes.\n effect(() => {\n this.guidesVersion();\n this.rulerVersion();\n const el = this.guidesOverlayRef()?.nativeElement;\n if (this.rulersEnabled() && el && this.engineReady() && this.engine) {\n this.renderGuidesOverlay(el);\n }\n });\n\n // Crop tool shows an interactive frame; entering begins a session at the\n // current aspect, leaving without Apply discards the frame (the committed\n // region, if any, persists).\n effect(() => {\n const isCrop = this.activeTool() === 'crop' && this.engineReady();\n untracked(() => {\n if (isCrop && !this.cropActive) {\n this.engine?.beginCrop(this.ratioFromPreset(this.activeCrop()));\n this.cropActive = true;\n } else if (!isCrop && this.cropActive) {\n this.engine?.cancelCrop();\n this.cropActive = false;\n }\n });\n });\n\n // Redact tool shows a positioning marquee; leaving it discards an unapplied\n // one. While active, clicking the canvas places a fresh box (click-to-place).\n effect(() => {\n const isRedact = this.activeTool() === 'redact' && this.engineReady();\n untracked(() => {\n this.engine?.setRedactPlacement(isRedact);\n if (isRedact && !this.redactActive) {\n this.engine?.addRedactionMarquee();\n this.redactActive = true;\n } else if (!isRedact && this.redactActive) {\n this.engine?.cancelRedaction();\n this.redactActive = false;\n }\n });\n });\n }\n\n ngOnDestroy(): void {\n this.guideDraftCleanup?.();\n this.resizeObserver?.disconnect();\n if (this.errorToastTimer !== null) {\n clearTimeout(this.errorToastTimer);\n }\n void this.engine?.destroy();\n }\n\n // ---- keyboard + pointer scope --------------------------------------------\n private pointerInside = false;\n\n @HostListener('mouseenter')\n protected onPointerEnter(): void {\n this.pointerInside = true;\n }\n\n @HostListener('mouseleave')\n protected onPointerLeave(): void {\n this.pointerInside = false;\n this.engine?.setPanMode(false);\n }\n\n @HostListener('document:keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.keyboardEnabled() || !this.pointerInside || isTypingTarget(event.target)) {\n return;\n }\n const meta = event.ctrlKey || event.metaKey;\n const key = event.key.toLowerCase();\n\n if (event.key === ' ') {\n event.preventDefault();\n this.engine?.setPanMode(true);\n return;\n }\n if (key === 'escape') {\n if (this.layout() === 'basic') {\n this.cancel();\n } else {\n this.engine?.discardSelection();\n }\n return;\n }\n if (key === 'delete' || key === 'backspace') {\n event.preventDefault();\n this.deleteSelection();\n return;\n }\n if (!meta) {\n return;\n }\n switch (key) {\n case 'z':\n event.preventDefault();\n void (event.shiftKey ? this.redo() : this.undo());\n break;\n case 'y':\n event.preventDefault();\n void this.redo();\n break;\n case 'c':\n event.preventDefault();\n void this.engine?.copy();\n break;\n // Paste (Ctrl/Cmd+V) is handled by the `paste` event so OS-clipboard\n // images can be detected; do not preventDefault here.\n case 'd':\n event.preventDefault();\n void this.engine?.duplicateActive().then(() => this.sync());\n break;\n case 'a':\n event.preventDefault();\n this.engine?.selectAll();\n break;\n default:\n break;\n }\n }\n\n @HostListener('document:keyup', ['$event'])\n protected onKeyup(event: KeyboardEvent): void {\n if (event.key === ' ') {\n this.engine?.setPanMode(false);\n }\n }\n\n @HostListener('document:paste', ['$event'])\n protected onPaste(event: ClipboardEvent): void {\n if (!this.keyboardEnabled() || !this.pointerInside || isTypingTarget(event.target)) {\n return;\n }\n let imageFile: File | null = null;\n const items = event.clipboardData?.items;\n if (items) {\n for (const item of items) {\n if (item.type.startsWith('image/')) {\n imageFile = item.getAsFile();\n break;\n }\n }\n }\n event.preventDefault();\n if (imageFile) {\n void this.engine?.addImageObject(imageFile).then(() => this.sync());\n } else {\n void this.engine?.paste().then(() => this.sync());\n }\n }\n\n /** Reset zoom + viewport so the image fits the stage. */\n protected fitToScreen(): void {\n this.engine?.resetView();\n this.sync();\n }\n\n protected toggleSnap(): void {\n const next = !this.snapEnabled();\n this.snapEnabled.set(next);\n this.engine?.setSnapping(next);\n }\n\n protected onArtboardChange(size: ArtboardSize | null): void {\n this.artboard.set(size);\n this.engine?.setArtboard(size);\n }\n\n protected toggleRulers(): void {\n const next = !this.rulersEnabled();\n this.rulersEnabled.set(next);\n this.engine?.setRulersEnabled(next);\n }\n\n /** Clear all user-placed guides (the ruler corner button). */\n protected clearGuides(): void {\n this.engine?.clearManualGuides();\n }\n\n /**\n * Begin dragging a new guide out of a ruler. The top ruler pulls a horizontal\n * guide; the left ruler a vertical one. A live preview tracks the pointer;\n * releasing over the canvas commits it, releasing outside cancels.\n */\n protected startGuideDraft(orientation: 'h' | 'v', event: PointerEvent): void {\n const engine = this.engine;\n if (!engine || !this.rulersEnabled()) {\n return;\n }\n event.preventDefault();\n this.guideDraftCleanup?.();\n\n const scenePosAt = (clientX: number, clientY: number): number => {\n const vp = engine.clientToViewport(clientX, clientY);\n const scene = engine.viewportToScene(vp.x, vp.y);\n return orientation === 'h' ? scene.y : scene.x;\n };\n const onMove = (e: PointerEvent): void => {\n engine.setGuideDraft(orientation, scenePosAt(e.clientX, e.clientY));\n };\n const onUp = (e: PointerEvent): void => {\n this.guideDraftCleanup?.();\n const vp = engine.clientToViewport(e.clientX, e.clientY);\n const view = engine.getViewport();\n const overCanvas = vp.x >= 0 && vp.y >= 0 && vp.x <= view.width && vp.y <= view.height;\n if (overCanvas) {\n engine.addManualGuide(orientation, scenePosAt(e.clientX, e.clientY));\n } else {\n engine.setGuideDraft(orientation, null);\n }\n };\n this.guideDraftCleanup = (): void => {\n document.removeEventListener('pointermove', onMove);\n document.removeEventListener('pointerup', onUp);\n this.guideDraftCleanup = null;\n };\n document.addEventListener('pointermove', onMove);\n document.addEventListener('pointerup', onUp);\n onMove(event);\n }\n\n /** Paint both ruler strips from the engine's viewport, scaled for the display. */\n private renderRulers(top: HTMLCanvasElement, left: HTMLCanvasElement): void {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n const view = engine.getViewport();\n const styles = getComputedStyle(this.host.nativeElement);\n const colors: RulerColors = {\n bg: styles.getPropertyValue('--asp-surface-sunk').trim() || '#f1f3f6',\n tick: styles.getPropertyValue('--asp-ink-faint').trim() || '#9aa4b2',\n label: styles.getPropertyValue('--asp-ink-muted').trim() || '#6b7280',\n };\n const dpr = window.devicePixelRatio || 1;\n\n const paint = (el: HTMLCanvasElement, orientation: 'h' | 'v'): void => {\n const cssW = el.clientWidth;\n const cssH = el.clientHeight;\n if (cssW === 0 || cssH === 0) {\n return;\n }\n el.width = Math.round(cssW * dpr);\n el.height = Math.round(cssH * dpr);\n const ctx = el.getContext('2d');\n if (!ctx) {\n return;\n }\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n if (orientation === 'h') {\n drawRuler(ctx, 'h', cssW, cssH, { zoom: view.zoom, pan: view.panX }, colors);\n } else {\n drawRuler(ctx, 'v', cssH, cssW, { zoom: view.zoom, pan: view.panY }, colors);\n }\n };\n paint(top, 'h');\n paint(left, 'v');\n }\n\n /**\n * Paint the user's guides (and any live draft) onto a dedicated overlay canvas\n * that sits above the Fabric canvas. Drawing here — rather than on Fabric's own\n * overlay context — keeps guides stable, since Fabric clears its overlay on its\n * own schedule (e.g. on mouse-up) without redrawing ours.\n */\n private renderGuidesOverlay(el: HTMLCanvasElement): void {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n const cssW = el.clientWidth;\n const cssH = el.clientHeight;\n if (cssW === 0 || cssH === 0) {\n return;\n }\n const dpr = window.devicePixelRatio || 1;\n el.width = Math.round(cssW * dpr);\n el.height = Math.round(cssH * dpr);\n const ctx = el.getContext('2d');\n if (!ctx) {\n return;\n }\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n ctx.clearRect(0, 0, cssW, cssH);\n\n const view = engine.getViewport();\n ctx.lineWidth = 1;\n const paintGuide = (orientation: 'h' | 'v', pos: number, color: string): void => {\n ctx.strokeStyle = color;\n ctx.beginPath();\n if (orientation === 'h') {\n const y = Math.round(pos * view.zoom + view.panY) + 0.5;\n ctx.moveTo(0, y);\n ctx.lineTo(cssW, y);\n } else {\n const x = Math.round(pos * view.zoom + view.panX) + 0.5;\n ctx.moveTo(x, 0);\n ctx.lineTo(x, cssH);\n }\n ctx.stroke();\n };\n for (const guide of engine.getManualGuides()) {\n paintGuide(guide.orientation, guide.pos, '#12b5cb');\n }\n const draft = engine.getGuideDraft();\n if (draft) {\n paintGuide(draft.orientation, draft.pos, '#0a8aa0');\n }\n }\n\n protected duplicate(): void {\n void this.engine?.duplicateActive().then(() => this.sync());\n }\n\n // ---- engine lifecycle ----------------------------------------------------\n private async ensureEngineAndLoad(\n canvas: HTMLCanvasElement,\n stage: HTMLElement,\n src: string | Blob | null,\n ): Promise<void> {\n if (this.samples().length === 0) {\n this.samples.set(buildSampleImages());\n }\n\n // (Re)create the engine when the canvas element changes (e.g. mode switch).\n if (canvas !== this.boundCanvas) {\n try {\n this.resizeObserver?.disconnect();\n await this.engine?.destroy();\n const { width, height } = stageSize(stage);\n this.engine = await EditorEngine.create(canvas, { width, height });\n this.engine.setSelectionListener((info) => this.onSelectionChange(info));\n this.engine.setLayersListener(() => this.refreshLayers());\n this.engine.setViewportListener(() => this.rulerVersion.update((v) => v + 1));\n this.engine.setGuidesListener(() => {\n this.guidesVersion.update((v) => v + 1);\n this.sync();\n });\n this.engine.setTextPlacementListener((point) => {\n this.engine?.addTextAt(point.x, point.y, {\n color: this.annotationColor(),\n fontSize: this.fontSize(),\n fontFamily: this.fontFamily(),\n });\n this.sync();\n });\n // Clicking off a placed text finishes it and returns to the Select tool.\n this.engine.setTextFinishListener(() => {\n this.activeTool.set('select');\n this.sync();\n });\n this.engine.setAiProgressListener((info) => {\n this.aiStage.set(info.stage);\n this.aiProgress.set(info.progress);\n });\n this.engine.setMagicListener((point) => {\n void this.engine\n ?.magicErase(point, this.magicTolerance())\n .then(() => this.sync())\n .catch((error) => this.emitError('magic-erase-failed', error));\n });\n this.engine.setSnapping(this.snapEnabled());\n this.engine.setArtboard(this.artboard());\n this.engine.setRulersEnabled(this.rulersEnabled());\n this.boundCanvas = canvas;\n this.lastSource = undefined;\n this.engineReady.set(true);\n this.observeResize(stage);\n } catch (error) {\n // No 2D/WebGL context (SSR/headless) — chrome still renders; actions inert.\n console.warn('[asp-image-editor] could not initialize the canvas engine:', error);\n this.emitError('engine-init-failed', error);\n return;\n }\n }\n\n const source = src ?? this.samples()[0]?.dataUrl ?? null;\n if (source === null || source === this.lastSource || !this.engine) {\n return;\n }\n this.lastSource = source;\n await this.loadSource(source);\n }\n\n /** Load a source into the engine, emitting imageLoaded / errorOccurred. */\n private async loadSource(source: string | Blob): Promise<void> {\n try {\n await this.engine?.loadImage(source);\n this.resetUiState();\n this.sync();\n this.imageLoaded.emit();\n } catch (error) {\n this.emitError('load-failed', error);\n }\n }\n\n private emitError(code: string, error: unknown): void {\n const message = error instanceof Error ? error.message : String(error);\n this.errorOccurred.emit({ code, message });\n // Also show a transient in-editor toast so failures are never silent — the\n // previous behavior on a bad import looked like \"nothing happened\".\n this.showErrorToast(message);\n }\n\n /** Surface a dismissible error toast, auto-clearing after a few seconds. */\n private showErrorToast(message: string): void {\n this.errorToast.set(message);\n if (this.errorToastTimer !== null) {\n clearTimeout(this.errorToastTimer);\n }\n this.errorToastTimer = setTimeout(() => {\n this.errorToast.set(null);\n this.errorToastTimer = null;\n }, 6000);\n }\n\n protected dismissErrorToast(): void {\n if (this.errorToastTimer !== null) {\n clearTimeout(this.errorToastTimer);\n this.errorToastTimer = null;\n }\n this.errorToast.set(null);\n }\n\n private observeResize(stage: HTMLElement): void {\n this.resizeObserver = new ResizeObserver(() => {\n const { width, height } = stageSize(stage);\n this.engine?.setSize(width, height);\n });\n this.resizeObserver.observe(stage);\n }\n\n private resetUiState(): void {\n this.adjustments.set(defaultAdjustmentValues());\n this.activeLook.set(null);\n this.activeCrop.set('free');\n this.straighten.set(0);\n this.activeFrame.set('none');\n }\n\n private sync(): void {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n this.canUndo.set(engine.canUndo);\n this.canRedo.set(engine.canRedo);\n this.historyEntries.set(engine.historyEntries);\n this.historyIndex.set(engine.historyIndex);\n this.zoomPct.set(engine.zoom);\n this.refreshLayers();\n }\n\n private refreshLayers(): void {\n this.layers.set(this.engine?.getLayers() ?? []);\n }\n\n protected onSelectLayer(event: LayerSelectEvent): void {\n this.engine?.selectLayer(event.id, event.additive);\n }\n protected onReorderLayers(orderedIds: readonly string[]): void {\n this.engine?.reorderLayers(orderedIds);\n this.sync();\n }\n protected onRenameLayer(event: LayerRenameEvent): void {\n this.engine?.renameLayer(event.id, event.name);\n this.sync();\n }\n protected onToggleLayerLock(id: string): void {\n this.engine?.toggleLayerLock(id);\n this.sync();\n }\n protected onToggleLayerVisible(id: string): void {\n this.engine?.toggleLayerVisible(id);\n this.sync();\n }\n protected onMoveLayer(id: string, direction: 'up' | 'down'): void {\n this.engine?.moveLayer(id, direction);\n this.sync();\n }\n protected onDeleteLayer(id: string): void {\n this.engine?.deleteLayer(id);\n this.sync();\n }\n protected onLayerOpacityInput(change: { id: string; value: number }): void {\n this.engine?.setLayerOpacity(change.id, change.value, false);\n }\n protected onLayerOpacityCommit(change: { id: string; value: number }): void {\n this.engine?.setLayerOpacity(change.id, change.value, true);\n this.sync();\n }\n\n // ---- top bar -------------------------------------------------------------\n protected selectTool(tool: AspTool): void {\n this.activeTool.set(tool);\n const group = groupForTool(tool);\n if (group) {\n this.activeMembers.update((members) => ({ ...members, [group.id]: tool }));\n }\n }\n\n protected async undo(): Promise<void> {\n await this.engine?.undo();\n this.sync();\n this.syncUiFromEngine();\n }\n\n protected async redo(): Promise<void> {\n await this.engine?.redo();\n this.sync();\n this.syncUiFromEngine();\n }\n\n /** Pull tool/adjustment/look/frame state from the engine into the panel signals. */\n private syncUiFromEngine(): void {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n this.adjustments.set(engine.getAdjustments());\n this.activeLook.set(engine.activeLook);\n this.straighten.set(engine.straightenAngle);\n this.activeFrame.set(engine.activeFrame);\n // A crop's source aspect is not recoverable from the flattened scene.\n this.activeCrop.set('free');\n this.activeAspectLabel.set('');\n }\n\n protected zoomIn(): void {\n this.engine?.zoomBy(ZOOM_STEP);\n this.sync();\n }\n\n protected zoomOut(): void {\n this.engine?.zoomBy(-ZOOM_STEP);\n this.sync();\n }\n\n protected togglePicker(): void {\n this.pickerOpen.update((v) => !v);\n this.exportOpen.set(false);\n this.historyOpen.set(false);\n }\n\n protected toggleExport(): void {\n this.exportOpen.update((v) => !v);\n this.pickerOpen.set(false);\n this.historyOpen.set(false);\n }\n\n protected toggleHistory(): void {\n this.historyOpen.update((v) => !v);\n this.pickerOpen.set(false);\n this.exportOpen.set(false);\n }\n\n protected async pickSample(sample: SampleImage): Promise<void> {\n this.pickerOpen.set(false);\n this.lastSource = sample.dataUrl;\n await this.loadSource(sample.dataUrl);\n }\n\n protected async onUpload(event: Event): Promise<void> {\n const input = event.target as HTMLInputElement;\n const file = input.files?.[0];\n if (file) {\n this.pickerOpen.set(false);\n this.lastSource = file;\n await this.loadSource(file);\n }\n input.value = '';\n }\n\n /** Add an uploaded image as a new movable layer (composite, not replace). */\n protected async onAddImageLayer(event: Event): Promise<void> {\n const input = event.target as HTMLInputElement;\n const file = input.files?.[0];\n input.value = '';\n if (!file) {\n return;\n }\n this.pickerOpen.set(false);\n try {\n await this.engine?.addImageObject(file);\n this.sync();\n } catch (error) {\n this.emitError('image-add-failed', error);\n }\n }\n\n /** Download the current scene as a reusable template (JSON). */\n protected saveTemplate(): void {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n this.pickerOpen.set(false);\n try {\n const json = engine.exportScene();\n triggerDownload(new Blob([json], { type: 'application/json' }), 'template.json');\n } catch (error) {\n this.emitError('template-save-failed', error);\n }\n }\n\n /** Load a template (JSON) saved by {@link saveTemplate} and sync the UI to it. */\n protected async loadTemplate(event: Event): Promise<void> {\n const input = event.target as HTMLInputElement;\n const file = input.files?.[0];\n input.value = '';\n if (!file) {\n return;\n }\n this.pickerOpen.set(false);\n try {\n await this.engine?.loadScene(await file.text());\n this.artboard.set(this.engine?.getArtboard() ?? null);\n this.sync();\n this.syncUiFromEngine();\n } catch (error) {\n this.emitError('template-load-failed', error);\n }\n }\n\n protected setExportFormat(format: AspExportFormat): void {\n this.exportFormat.set(format);\n }\n\n protected onExportQuality(event: Event): void {\n this.exportQ.set(Number((event.target as HTMLInputElement).value));\n }\n\n protected async download(): Promise<void> {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n this.exportOpen.set(false);\n try {\n const blob = await engine.exportImage(this.exportFormat(), this.exportQ(), this.exportFormats());\n this.exported.emit(blob);\n this.saved.emit(blob);\n triggerDownload(blob, `image.${extensionFor(this.exportFormat())}`);\n } catch (error) {\n this.emitError('export-failed', error);\n }\n }\n\n // ---- basic / viewer layouts ----------------------------------------------\n /** Save (basic modal): export to a Blob and emit `saved` without downloading. */\n protected async save(): Promise<void> {\n const engine = this.engine;\n if (!engine) {\n return;\n }\n const format = this.exportFormats()[0] ?? 'png';\n try {\n // Commit an in-progress crop frame (basic mode crops on Save) before export.\n if (engine.isCropping()) {\n engine.applyCropRegion();\n this.cropActive = false;\n this.hasCropRegion.set(true);\n }\n const blob = await engine.exportImage(format, this.exportQ(), this.exportFormats());\n this.saved.emit(blob);\n } catch (error) {\n this.emitError('export-failed', error);\n }\n }\n\n protected cancel(): void {\n if (this.engine?.isCropping()) {\n this.engine.cancelCrop();\n this.cropActive = false;\n }\n this.canceled.emit();\n }\n\n protected onZoomSlider(event: Event): void {\n const value = Number((event.target as HTMLInputElement).value);\n this.engine?.setZoom(value);\n this.sync();\n }\n\n // ---- options panel handlers ----------------------------------------------\n protected reset(): void {\n void this.engine?.reset().then(() => {\n this.sync();\n this.syncUiFromEngine();\n });\n }\n\n protected onAdjustInput(change: AdjustChange): void {\n this.adjustments.update((a) => ({ ...a, [change.key]: change.value }));\n this.engine?.setAdjustments({ [change.key]: change.value });\n }\n\n protected onAdjustCommit(change: AdjustChange): void {\n this.adjustments.update((a) => ({ ...a, [change.key]: change.value }));\n this.engine?.setAdjustments({ [change.key]: change.value }, true);\n this.sync();\n }\n\n protected selectLook(look: AspFilter | null): void {\n const current = this.activeLook();\n // Toggle: clear the previous look, then apply the new one (single-select UI).\n if (current && current !== look) {\n this.engine?.toggleLook(current);\n }\n if (look === null) {\n if (current) {\n this.engine?.toggleLook(current);\n }\n this.activeLook.set(null);\n } else if (current === look) {\n this.engine?.toggleLook(look);\n this.activeLook.set(null);\n } else {\n this.engine?.toggleLook(look);\n this.activeLook.set(look);\n }\n this.sync();\n }\n\n /** Resolve a crop preset to an aspect ratio (w/h), or null for a free crop. */\n private ratioFromPreset(preset: AspAspectPreset): number | null {\n return aspectRatioValue(preset);\n }\n\n /** Start the crop frame if one isn't already active (e.g. from the basic-mode chips). */\n private ensureCropSession(ratio: number | null): void {\n if (this.engine && !this.engine.isCropping()) {\n this.engine.beginCrop(ratio);\n this.cropActive = true;\n } else {\n this.engine?.setCropRatio(ratio);\n }\n }\n\n /** Choose a crop aspect preset — reshapes (or starts) the live crop frame. */\n protected selectCrop(preset: AspAspectPreset): void {\n this.activeCrop.set(preset);\n this.activeAspectLabel.set('');\n this.ensureCropSession(this.ratioFromPreset(preset));\n this.sync();\n }\n\n /** Choose a custom crop aspect (e.g. a CMS target) — reshapes (or starts) the live frame. */\n protected selectCustomCrop(option: AspAspectOption): void {\n this.activeAspectLabel.set(option.label);\n this.ensureCropSession(option.ratio);\n this.sync();\n }\n\n /** Commit the crop frame as the output region, then return to Select. */\n protected applyCrop(): void {\n this.engine?.applyCropRegion();\n this.hasCropRegion.set(true);\n this.sync();\n this.selectTool('select');\n }\n\n /** Discard the in-progress crop frame and return to Select. */\n protected cancelCrop(): void {\n this.engine?.cancelCrop();\n this.cropActive = false;\n this.selectTool('select');\n }\n\n /** Clear any applied crop region and restart the frame at the current ratio. */\n protected resetCrop(): void {\n this.engine?.clearCropRegion();\n this.hasCropRegion.set(false);\n this.engine?.beginCrop(this.ratioFromPreset(this.activeCrop()));\n this.sync();\n }\n\n protected rotate(deg: number): void {\n this.engine?.rotateBy(deg);\n this.sync();\n }\n\n protected flip(axis: 'h' | 'v'): void {\n this.engine?.flip(axis);\n this.sync();\n }\n\n protected onStraightenInput(value: number): void {\n this.straighten.set(value);\n this.engine?.setStraighten(value);\n }\n\n protected onStraightenCommit(value: number): void {\n this.straighten.set(value);\n this.engine?.setStraighten(value, true);\n this.sync();\n }\n\n protected addShape(kind: ShapeKind): void {\n this.engine?.addShape(kind, {\n color: this.annotationColor(),\n strokeWidth: this.annotationWidth(),\n cornerRadius: kind === 'rect' ? this.shapeRadius() : undefined,\n });\n this.sync();\n }\n\n /** Live corner-radius drag: update a selected rectangle without committing. */\n protected onCornerRadiusInput(radius: number): void {\n this.shapeRadius.set(radius);\n if (this.selectedIsRect()) {\n this.engine?.setSelectedCornerRadius(radius, false);\n }\n }\n\n /** Corner-radius release: commit the selected rectangle's radius to history. */\n protected onCornerRadiusCommit(radius: number): void {\n this.shapeRadius.set(radius);\n if (this.selectedIsRect()) {\n this.engine?.setSelectedCornerRadius(radius, true);\n }\n this.sync();\n }\n\n protected addText(text: string): void {\n this.engine?.addText(text, {\n color: this.annotationColor(),\n fontSize: this.fontSize(),\n fontFamily: this.fontFamily(),\n });\n this.sync();\n }\n\n protected onFontChange(value: string): void {\n this.fontFamily.set(value);\n // Apply right away so the selection updates immediately; the family may\n // briefly render in a fallback until the web font loads, at which point the\n // engine re-renders (fonts 'loadingdone'). Re-apply once loaded so Fabric\n // re-measures with the real metrics.\n this.engine?.styleActiveObject({ fontFamily: value });\n // Surface a loading state (spinner + progress cursor) for web fonts. Hold it\n // for a brief minimum so a fast load still registers visually; system stacks\n // need no fetch and show nothing.\n const web = isWebFont(value);\n this.fontLoading.set(web);\n this.sync();\n const minVisible = web\n ? new Promise<void>((resolve) => setTimeout(resolve, 300))\n : Promise.resolve();\n void Promise.all([ensureFontLoaded(value), minVisible]).then(() => {\n // Only re-apply if this is still the chosen font — otherwise a slow-loading\n // earlier choice would clobber a newer one (the \"2nd change doesn't stick\").\n if (this.fontFamily() !== value) {\n return;\n }\n this.engine?.styleActiveObject({ fontFamily: value });\n this.fontLoading.set(false);\n this.sync();\n });\n }\n\n protected onAddCustomFont(name: string): void {\n if (!this.customFonts().some((f) => f.value === name)) {\n this.customFonts.update((fonts) => [...fonts, { label: name, value: name }]);\n }\n this.onFontChange(name);\n }\n\n protected groupSelection(): void {\n this.engine?.groupActive();\n this.sync();\n }\n\n protected ungroupSelection(): void {\n this.engine?.ungroupActive();\n this.sync();\n }\n\n protected alignSelection(mode: AlignMode): void {\n this.engine?.alignActive(mode);\n this.sync();\n }\n\n /** Reflect the selected object's editable style into the panel signals. */\n private onSelectionChange(info: SelectionStyleInfo | null): void {\n this.hasSelection.set(info !== null);\n this.selectionKind.set(info ? info.kind : null);\n if (!info) {\n this.selectedIsRect.set(false);\n return;\n }\n this.annotationColor.set(info.color);\n // Reflect a selected rectangle's corner radius into the slider.\n const isRect = info.cornerRadiusMax !== undefined;\n this.selectedIsRect.set(isRect);\n if (isRect) {\n this.shapeRadius.set(Math.round(info.cornerRadius ?? 0));\n this.shapeRadiusMax.set(Math.round(info.cornerRadiusMax ?? 55));\n }\n if (info.kind === 'text') {\n this.fontSize.set(Math.round(info.size));\n if (info.textStyle) {\n this.textBold.set(info.textStyle.bold);\n this.textItalic.set(info.textStyle.italic);\n this.textUnderline.set(info.textStyle.underline);\n this.textStrike.set(info.textStyle.strike);\n this.textAlign.set(info.textStyle.align);\n // Reflect the selected text's font in the panel dropdown.\n if (info.textStyle.fontFamily) {\n this.fontFamily.set(info.textStyle.fontFamily);\n }\n }\n } else {\n this.annotationWidth.set(Math.round(info.size));\n }\n }\n\n // ---- rich text ----\n protected toggleBold(): void {\n const v = !this.textBold();\n this.textBold.set(v);\n this.engine?.applyTextStyle({ fontWeight: v ? 'bold' : 'normal' });\n this.sync();\n }\n protected toggleItalic(): void {\n const v = !this.textItalic();\n this.textItalic.set(v);\n this.engine?.applyTextStyle({ fontStyle: v ? 'italic' : 'normal' });\n this.sync();\n }\n protected toggleUnderline(): void {\n const v = !this.textUnderline();\n this.textUnderline.set(v);\n this.engine?.applyTextStyle({ underline: v });\n this.sync();\n }\n protected toggleStrike(): void {\n const v = !this.textStrike();\n this.textStrike.set(v);\n this.engine?.applyTextStyle({ linethrough: v });\n this.sync();\n }\n protected setTextAlign(align: string): void {\n this.textAlign.set(align);\n this.engine?.applyTextStyle({ textAlign: align });\n this.sync();\n }\n protected setLineHeight(value: number): void {\n this.lineHeight.set(value);\n this.engine?.applyTextStyle({ lineHeight: value });\n this.sync();\n }\n protected setLetterSpacing(value: number): void {\n this.letterSpacing.set(value);\n this.engine?.applyTextStyle({ charSpacing: value });\n this.sync();\n }\n protected setTextBg(color: string): void {\n this.engine?.applyTextStyle({ textBackgroundColor: color === 'transparent' ? '' : color });\n this.sync();\n }\n\n protected setRedactMode(mode: RedactMode): void {\n this.redactMode.set(mode);\n }\n\n protected applyRedaction(): void {\n void this.engine?.applyRedaction(this.redactMode()).then(() => {\n // The marquee is consumed. We deliberately do NOT spawn a new one — that\n // made a box \"jump\" onto the canvas. To redact again, click the canvas to\n // place a fresh box where you want it.\n this.sync();\n });\n }\n\n protected setFill(color: string): void {\n if (this.engine?.setActiveFill(color)) {\n this.sync();\n }\n }\n\n protected setAnnotationColor(color: string): void {\n this.annotationColor.set(color);\n // Apply to the current selection (no-op + no history entry if nothing selected).\n if (this.engine?.styleActiveObject({ color })) {\n this.sync();\n }\n }\n\n /** Live size drag — apply to the selection without committing each frame. */\n protected onSizeInput(size: number): void {\n if (this.activeTool() === 'text') {\n this.fontSize.set(size);\n } else {\n this.annotationWidth.set(size);\n }\n this.engine?.styleActiveObject({ size }, false);\n }\n\n /** Size drag released — commit one history entry. */\n protected onSizeCommit(size: number): void {\n if (this.activeTool() === 'text') {\n this.fontSize.set(size);\n } else {\n this.annotationWidth.set(size);\n }\n if (this.engine?.styleActiveObject({ size }, true)) {\n this.sync();\n }\n }\n\n protected selectFrame(frame: string): void {\n this.activeFrame.set(frame);\n this.engine?.applyFrame(frame, this.annotationColor());\n this.sync();\n }\n\n protected setBackgroundColor(color: string): void {\n this.engine?.setBackground(color);\n this.sync();\n }\n\n protected setBackgroundGradient(colors: string[]): void {\n this.engine?.setBackgroundGradient(colors);\n this.sync();\n }\n\n protected setBackgroundImageFromFile(file: File): void {\n void this.engine?.setBackgroundImage(file).then(() => this.sync());\n }\n\n protected deleteSelection(): void {\n this.engine?.deleteActive();\n this.sync();\n }\n}\n\n/** True if the keyboard event originates from an editable field, so editor shortcuts should yield. */\nfunction isTypingTarget(target: EventTarget | null): boolean {\n if (!(target instanceof HTMLElement)) {\n return false;\n }\n const tag = target.tagName;\n return (\n tag === 'INPUT' ||\n tag === 'TEXTAREA' ||\n tag === 'SELECT' ||\n target.isContentEditable\n );\n}\n\nfunction defaultAdjustmentValues(): Record<string, number> {\n const values: Record<string, number> = {};\n for (const meta of Object.values(FILTER_REGISTRY)) {\n if (meta.kind === 'adjustment') {\n values[meta.key] = meta.defaultValue ?? 0;\n }\n }\n return values;\n}\n\nfunction stageSize(stage: HTMLElement): { width: number; height: number } {\n const rect = stage.getBoundingClientRect();\n return {\n width: Math.max(120, Math.floor(rect.width)),\n height: Math.max(120, Math.floor(rect.height)),\n };\n}\n\nfunction extensionFor(format: AspExportFormat): string {\n return format === 'jpeg' ? 'jpg' : format;\n}\n\nfunction triggerDownload(blob: Blob, filename: string): void {\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = filename;\n document.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n // Defer revoke so browsers that initiate the download asynchronously can read it.\n setTimeout(() => URL.revokeObjectURL(url), 1000);\n}\n","@if (errorToast(); as toastMsg) {\n <div class=\"asp-toast\" role=\"alert\">\n <asp-icon name=\"info\" [size]=\"16\" />\n <span class=\"asp-toast__msg\">{{ toastMsg }}</span>\n <button type=\"button\" class=\"asp-toast__close\" aria-label=\"Dismiss\" (click)=\"dismissErrorToast()\">\n <asp-icon name=\"x\" [size]=\"15\" />\n </button>\n </div>\n}\n\n@switch (layout()) {\n @case ('workspace') {\n <div class=\"asp-workspace\">\n <asp-tool-rail\n class=\"asp-workspace__rail\"\n [groups]=\"resolvedGroups()\"\n [activeTool]=\"activeTool()\"\n [activeMembers]=\"activeMembers()\"\n (toolSelect)=\"selectTool($event)\"\n />\n\n <div class=\"asp-workspace__canvas asp-card\">\n <div class=\"asp-topbar\">\n <button\n type=\"button\"\n class=\"asp-iconbtn\"\n [disabled]=\"!canUndo()\"\n title=\"Undo\"\n aria-label=\"Undo\"\n (click)=\"undo()\"\n >\n <asp-icon name=\"undo-2\" [size]=\"17\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-iconbtn\"\n [disabled]=\"!canRedo()\"\n title=\"Redo\"\n aria-label=\"Redo\"\n (click)=\"redo()\"\n >\n <asp-icon name=\"redo-2\" [size]=\"17\" />\n </button>\n <span class=\"asp-divider\"></span>\n <ng-container [ngTemplateOutlet]=\"zoomTpl\" />\n <button type=\"button\" class=\"asp-iconbtn\" title=\"Fit to screen\" aria-label=\"Fit to screen\" (click)=\"fitToScreen()\">\n <asp-icon name=\"scaling\" [size]=\"16\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-iconbtn\"\n [class.asp-iconbtn--on]=\"snapEnabled()\"\n [attr.aria-pressed]=\"snapEnabled()\"\n [title]=\"snapEnabled() ? 'Snapping on' : 'Snapping off'\"\n aria-label=\"Toggle snapping\"\n (click)=\"toggleSnap()\"\n >\n <asp-icon name=\"magnet\" [size]=\"16\" />\n </button>\n <button\n type=\"button\"\n class=\"asp-iconbtn\"\n [class.asp-iconbtn--on]=\"rulersEnabled()\"\n [attr.aria-pressed]=\"rulersEnabled()\"\n [title]=\"rulersEnabled() ? 'Rulers & guides on' : 'Rulers & guides off'\"\n aria-label=\"Toggle rulers and guides\"\n (click)=\"toggleRulers()\"\n >\n <asp-icon name=\"ruler\" [size]=\"16\" />\n </button>\n @if (showHistory()) {\n <div class=\"asp-pop\">\n <button type=\"button\" class=\"asp-iconbtn\" title=\"History\" aria-label=\"Edit history\" (click)=\"toggleHistory()\">\n <asp-icon name=\"history\" [size]=\"17\" />\n </button>\n @if (historyOpen()) {\n <button type=\"button\" class=\"asp-pop__scrim\" aria-label=\"Close history\" (click)=\"toggleHistory()\"></button>\n <div class=\"asp-menu asp-menu--history\">\n <asp-history-list [entries]=\"historyEntries()\" [currentIndex]=\"historyIndex()\" />\n </div>\n }\n </div>\n }\n <span class=\"asp-spacer\"></span>\n <ng-container [ngTemplateOutlet]=\"imageTpl\" />\n <ng-container [ngTemplateOutlet]=\"exportTpl\" />\n </div>\n\n <div class=\"asp-stagewrap\" [class.asp-stagewrap--rulers]=\"rulersEnabled()\">\n @if (rulersEnabled()) {\n <button\n type=\"button\"\n class=\"asp-ruler-corner\"\n title=\"Clear all guides\"\n aria-label=\"Clear all guides\"\n (click)=\"clearGuides()\"\n ></button>\n <canvas\n #rulerTopEl\n class=\"asp-ruler asp-ruler--h\"\n aria-hidden=\"true\"\n (pointerdown)=\"startGuideDraft('h', $event)\"\n ></canvas>\n <canvas\n #rulerLeftEl\n class=\"asp-ruler asp-ruler--v\"\n aria-hidden=\"true\"\n (pointerdown)=\"startGuideDraft('v', $event)\"\n ></canvas>\n }\n <div #stageEl class=\"asp-stage\">\n <canvas #canvasEl></canvas>\n @if (rulersEnabled()) {\n <canvas #guidesOverlayEl class=\"asp-guides-overlay\" aria-hidden=\"true\"></canvas>\n }\n @if (activeTool() === 'crop') {\n <div class=\"asp-crop-overlay\" aria-hidden=\"true\">\n <span class=\"asp-crop-overlay__v\" style=\"left: 33.33%\"></span>\n <span class=\"asp-crop-overlay__v\" style=\"left: 66.66%\"></span>\n <span class=\"asp-crop-overlay__h\" style=\"top: 33.33%\"></span>\n <span class=\"asp-crop-overlay__h\" style=\"top: 66.66%\"></span>\n </div>\n }\n </div>\n </div>\n </div>\n\n <div class=\"asp-workspace__panel asp-card\">\n <asp-options-panel\n class=\"asp-workspace__options\"\n [activeTool]=\"activeTool()\"\n [toolTitle]=\"toolTitle()\"\n [adjustmentDefs]=\"adjustmentDefs()\"\n [adjustments]=\"adjustments()\"\n [lookDefs]=\"lookDefs()\"\n [activeLook]=\"activeLook()\"\n [aspectPresets]=\"aspectPresets()\"\n [activeCrop]=\"activeCrop()\"\n [aspectRatios]=\"aspectRatios()\"\n [activeAspectLabel]=\"activeAspectLabel()\"\n [straighten]=\"straighten()\"\n [annotationColor]=\"annotationColor()\"\n [annotationWidth]=\"annotationWidth()\"\n [fontSize]=\"fontSize()\"\n [fonts]=\"allFonts()\"\n [activeFont]=\"fontFamily()\"\n [googleFonts]=\"googleFonts\"\n [selectionKind]=\"selectionKind()\"\n [fontLoading]=\"fontLoading()\"\n [magicTolerance]=\"magicTolerance()\"\n (magicToleranceChange)=\"onMagicTolerance($event)\"\n [aiBusy]=\"aiBusy()\"\n [aiStage]=\"aiStage()\"\n [aiProgress]=\"aiProgress()\"\n (runAi)=\"runAi()\"\n [textBold]=\"textBold()\"\n [textItalic]=\"textItalic()\"\n [textUnderline]=\"textUnderline()\"\n [textStrike]=\"textStrike()\"\n [textAlign]=\"textAlign()\"\n [lineHeight]=\"lineHeight()\"\n [letterSpacing]=\"letterSpacing()\"\n [frameOptions]=\"frameOptions\"\n [activeFrame]=\"activeFrame()\"\n [redactMode]=\"redactMode()\"\n [cornerRadius]=\"shapeRadius()\"\n [cornerRadiusMax]=\"shapeRadiusMax()\"\n [showCornerRadius]=\"showCornerRadius()\"\n (cornerRadiusInput)=\"onCornerRadiusInput($event)\"\n (cornerRadiusCommit)=\"onCornerRadiusCommit($event)\"\n (resetRequested)=\"reset()\"\n (adjustInput)=\"onAdjustInput($event)\"\n (adjustCommit)=\"onAdjustCommit($event)\"\n (selectLook)=\"selectLook($event)\"\n (requestTool)=\"selectTool($event)\"\n (fillChange)=\"setFill($event)\"\n [hasCropRegion]=\"hasCropRegion()\"\n (selectCrop)=\"selectCrop($event)\"\n (selectCustomCrop)=\"selectCustomCrop($event)\"\n (applyCrop)=\"applyCrop()\"\n (cancelCrop)=\"cancelCrop()\"\n (resetCrop)=\"resetCrop()\"\n (rotate)=\"rotate($event)\"\n (flip)=\"flip($event)\"\n (straightenInput)=\"onStraightenInput($event)\"\n (straightenCommit)=\"onStraightenCommit($event)\"\n (addShape)=\"addShape($event)\"\n (addText)=\"addText($event)\"\n (fontChange)=\"onFontChange($event)\"\n (addFont)=\"onAddCustomFont($event)\"\n (toggleBold)=\"toggleBold()\"\n (toggleItalic)=\"toggleItalic()\"\n (toggleUnderline)=\"toggleUnderline()\"\n (toggleStrike)=\"toggleStrike()\"\n (textAlignChange)=\"setTextAlign($event)\"\n (lineHeightChange)=\"setLineHeight($event)\"\n (letterSpacingChange)=\"setLetterSpacing($event)\"\n (textBgChange)=\"setTextBg($event)\"\n (redactModeChange)=\"setRedactMode($event)\"\n (applyRedaction)=\"applyRedaction()\"\n (annotationColorChange)=\"setAnnotationColor($event)\"\n (sizeInput)=\"onSizeInput($event)\"\n (sizeCommit)=\"onSizeCommit($event)\"\n (selectFrame)=\"selectFrame($event)\"\n (setBackgroundColor)=\"setBackgroundColor($event)\"\n (setBackgroundGradient)=\"setBackgroundGradient($event)\"\n (setBackgroundImageFile)=\"setBackgroundImageFromFile($event)\"\n [artboard]=\"artboard()\"\n (artboardChange)=\"onArtboardChange($event)\"\n />\n <asp-layer-list\n [layers]=\"layers()\"\n (selectLayer)=\"onSelectLayer($event)\"\n (toggleLock)=\"onToggleLayerLock($event)\"\n (toggleVisible)=\"onToggleLayerVisible($event)\"\n (moveUp)=\"onMoveLayer($event, 'up')\"\n (moveDown)=\"onMoveLayer($event, 'down')\"\n (removeLayer)=\"onDeleteLayer($event)\"\n (groupSelection)=\"groupSelection()\"\n (ungroupSelection)=\"ungroupSelection()\"\n (duplicateSelection)=\"duplicate()\"\n (deleteSelection)=\"deleteSelection()\"\n (alignSelection)=\"alignSelection($event)\"\n (opacityInput)=\"onLayerOpacityInput($event)\"\n (opacityCommit)=\"onLayerOpacityCommit($event)\"\n (reorderLayers)=\"onReorderLayers($event)\"\n (renameLayer)=\"onRenameLayer($event)\"\n />\n </div>\n </div>\n }\n\n @case ('viewer') {\n <div class=\"asp-viewer asp-card\">\n <div class=\"asp-topbar\">\n <ng-container [ngTemplateOutlet]=\"zoomTpl\" />\n <span class=\"asp-spacer\"></span>\n <ng-container [ngTemplateOutlet]=\"exportTpl\" />\n </div>\n <div #stageEl class=\"asp-stage\">\n <canvas #canvasEl></canvas>\n </div>\n </div>\n }\n\n @case ('basic') {\n <div class=\"asp-basic asp-card\">\n <div class=\"asp-basic__head\">\n <div class=\"asp-basic__title\">{{ heading() }}</div>\n <button type=\"button\" class=\"asp-iconbtn-plain\" aria-label=\"Close\" (click)=\"cancel()\">\n <asp-icon name=\"x\" [size]=\"19\" />\n </button>\n </div>\n\n <div class=\"asp-basic__body\">\n <div #stageEl class=\"asp-stage asp-stage--rounded\">\n <canvas #canvasEl></canvas>\n </div>\n\n <div>\n <div class=\"asp-section-label\">Aspect ratio</div>\n <div class=\"asp-chip-row\">\n @for (preset of aspectPresets(); track preset) {\n <button\n type=\"button\"\n class=\"asp-chip\"\n [class.asp-chip--active]=\"activeCrop() === preset\"\n (click)=\"selectCrop(preset)\"\n >\n {{ preset === 'free' ? 'Free' : preset === 'original' ? 'Original' : preset }}\n </button>\n }\n </div>\n </div>\n\n <div class=\"asp-basic__controls\">\n <button type=\"button\" class=\"asp-iconbtn\" title=\"Rotate left\" (click)=\"rotate(-90)\">\n <asp-icon name=\"rotate-ccw\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-iconbtn\" title=\"Rotate right\" (click)=\"rotate(90)\">\n <asp-icon name=\"rotate-cw\" [size]=\"17\" />\n </button>\n <button type=\"button\" class=\"asp-iconbtn\" title=\"Flip\" (click)=\"flip('h')\">\n <asp-icon name=\"flip-horizontal-2\" [size]=\"17\" />\n </button>\n <div class=\"asp-zoomslider\">\n <asp-icon name=\"plus\" [size]=\"16\" />\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"100\"\n max=\"300\"\n [value]=\"zoomPct()\"\n (input)=\"onZoomSlider($event)\"\n aria-label=\"Zoom\"\n />\n </div>\n <label class=\"asp-upload asp-upload--inline\">\n <asp-icon name=\"upload\" [size]=\"15\" /> Replace\n <input type=\"file\" accept=\"image/*\" (change)=\"onUpload($event)\" />\n </label>\n </div>\n </div>\n\n <div class=\"asp-basic__foot\">\n <button type=\"button\" class=\"asp-btn-line\" (click)=\"cancel()\">Cancel</button>\n <button type=\"button\" class=\"asp-btn-accent\" (click)=\"save()\">Save</button>\n </div>\n </div>\n }\n}\n\n<!-- shared sub-templates ----------------------------------------------------->\n<ng-template #zoomTpl>\n <div class=\"asp-zoom\">\n <button type=\"button\" class=\"asp-zoom__btn\" aria-label=\"Zoom out\" (click)=\"zoomOut()\">\n <asp-icon name=\"minus\" [size]=\"15\" />\n </button>\n <span class=\"asp-zoom__label\">{{ zoomLabel() }}</span>\n <button type=\"button\" class=\"asp-zoom__btn\" aria-label=\"Zoom in\" (click)=\"zoomIn()\">\n <asp-icon name=\"plus\" [size]=\"15\" />\n </button>\n </div>\n</ng-template>\n\n<ng-template #imageTpl>\n <div class=\"asp-pop\">\n <button type=\"button\" class=\"asp-btn-line asp-topbtn\" (click)=\"togglePicker()\">\n <asp-icon name=\"image-plus\" [size]=\"16\" /> Image\n </button>\n @if (pickerOpen()) {\n <button\n type=\"button\"\n class=\"asp-pop__scrim\"\n aria-label=\"Close image menu\"\n (click)=\"togglePicker()\"\n ></button>\n <div class=\"asp-menu asp-menu--right\">\n <div class=\"asp-menu__title\">Sample images</div>\n <div class=\"asp-sample-grid\">\n @for (sample of samples(); track sample.key) {\n <button\n type=\"button\"\n class=\"asp-sample\"\n [style.background-image]=\"'url(' + sample.dataUrl + ')'\"\n [attr.title]=\"sample.label\"\n [attr.aria-label]=\"sample.label\"\n (click)=\"pickSample(sample)\"\n ></button>\n }\n </div>\n <label class=\"asp-upload\">\n <asp-icon name=\"upload\" [size]=\"15\" /> Replace canvas image\n <input type=\"file\" accept=\"image/*\" (change)=\"onUpload($event)\" />\n </label>\n <label class=\"asp-upload asp-mt-sm\">\n <asp-icon name=\"image-plus\" [size]=\"15\" /> Add image as a layer\n <input type=\"file\" accept=\"image/*\" (change)=\"onAddImageLayer($event)\" />\n </label>\n <div class=\"asp-menu__divider\"></div>\n <div class=\"asp-menu__title\">Template</div>\n <button type=\"button\" class=\"asp-upload asp-upload--btn\" (click)=\"saveTemplate()\">\n <asp-icon name=\"download\" [size]=\"15\" /> Save template\n </button>\n <label class=\"asp-upload\">\n <asp-icon name=\"upload\" [size]=\"15\" /> Load template\n <input type=\"file\" accept=\"application/json,.json\" (change)=\"loadTemplate($event)\" />\n </label>\n </div>\n }\n </div>\n</ng-template>\n\n<ng-template #exportTpl>\n <div class=\"asp-pop\">\n <button type=\"button\" class=\"asp-btn-accent asp-topbtn\" (click)=\"toggleExport()\">\n <asp-icon name=\"download\" [size]=\"16\" /> Export\n </button>\n @if (exportOpen()) {\n <button\n type=\"button\"\n class=\"asp-pop__scrim\"\n aria-label=\"Close export menu\"\n (click)=\"toggleExport()\"\n ></button>\n <div class=\"asp-menu asp-menu--right asp-menu--export\">\n <div class=\"asp-menu__label\">Format</div>\n <div class=\"asp-fmt-row\">\n @for (fmt of exportFormats(); track fmt) {\n <button\n type=\"button\"\n class=\"asp-fmt\"\n [class.asp-fmt--active]=\"exportFormat() === fmt\"\n (click)=\"setExportFormat(fmt)\"\n >\n {{ fmt | uppercase }}\n </button>\n }\n </div>\n <div class=\"asp-menu__row\">\n <span class=\"asp-menu__label\">Quality</span>\n <span class=\"asp-menu__value\">{{ exportQ() }}</span>\n </div>\n <input\n type=\"range\"\n class=\"asp-range\"\n min=\"10\"\n max=\"100\"\n [value]=\"exportQ()\"\n (input)=\"onExportQuality($event)\"\n aria-label=\"Export quality\"\n />\n <button type=\"button\" class=\"asp-btn-accent asp-download\" (click)=\"download()\">\n Download image\n </button>\n </div>\n }\n </div>\n</ng-template>\n","import {\n ApplicationRef,\n EnvironmentInjector,\n Injectable,\n createComponent,\n inject,\n} from '@angular/core';\n\nimport { AspImageEditor } from '../ui/image-editor/image-editor';\nimport type { AspThemeMode } from '../theme/derive-theme';\nimport type { AspAspectPreset, AspExportFormat } from '../types/editor.types';\n\n/** Options for {@link AspImageEditorDialog.open} / {@link openImageEditor}. */\nexport interface OpenImageEditorConfig {\n readonly src?: string | Blob | null;\n readonly heading?: string;\n readonly baseColor?: string;\n readonly accentColor?: string;\n readonly themeMode?: AspThemeMode;\n readonly aspectPresets?: AspAspectPreset[];\n readonly exportFormats?: AspExportFormat[];\n}\n\n/**\n * Opens the editor's `basic` layout in a modal overlay and resolves with the\n * saved image Blob, or `null` if the user cancels (close button, scrim click,\n * or Escape). Implemented without @angular/cdk so the package stays dependency-light.\n */\n@Injectable({ providedIn: 'root' })\nexport class AspImageEditorDialog {\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n\n open(config: OpenImageEditorConfig = {}): Promise<Blob | null> {\n return new Promise<Blob | null>((resolve) => {\n const scrim = document.createElement('div');\n scrim.setAttribute('role', 'dialog');\n scrim.setAttribute('aria-modal', 'true');\n Object.assign(scrim.style, {\n position: 'fixed',\n inset: '0',\n zIndex: '2147483000',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '24px',\n background: 'rgba(15, 23, 42, 0.45)',\n backdropFilter: 'blur(2px)',\n } satisfies Partial<CSSStyleDeclaration>);\n\n const card = document.createElement('div');\n card.style.width = '520px';\n card.style.maxWidth = '100%';\n card.style.maxHeight = 'calc(100vh - 48px)';\n card.style.boxShadow = '0 30px 80px rgba(0, 0, 0, 0.4)';\n card.style.borderRadius = '14px';\n card.style.overflow = 'hidden';\n scrim.appendChild(card);\n document.body.appendChild(scrim);\n\n const ref = createComponent(AspImageEditor, {\n environmentInjector: this.environmentInjector,\n hostElement: card,\n });\n ref.setInput('mode', 'basic');\n ref.setInput('src', config.src ?? null);\n ref.setInput('heading', config.heading ?? 'Edit image');\n ref.setInput('baseColor', config.baseColor ?? '#f4f6f9');\n ref.setInput('accentColor', config.accentColor ?? '#1f6feb');\n ref.setInput('themeMode', config.themeMode ?? 'light');\n if (config.aspectPresets) {\n ref.setInput('aspectPresets', config.aspectPresets);\n }\n if (config.exportFormats) {\n ref.setInput('exportFormats', config.exportFormats);\n }\n\n this.appRef.attachView(ref.hostView);\n\n let settled = false;\n const subscriptions: { unsubscribe(): void }[] = [];\n const finish = (result: Blob | null): void => {\n if (settled) {\n return;\n }\n settled = true;\n for (const sub of subscriptions) {\n sub.unsubscribe();\n }\n document.removeEventListener('keydown', onKeydown);\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n scrim.remove();\n resolve(result);\n };\n\n const onKeydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n finish(null);\n }\n };\n scrim.addEventListener('mousedown', (event) => {\n if (event.target === scrim) {\n finish(null);\n }\n });\n document.addEventListener('keydown', onKeydown);\n\n subscriptions.push(ref.instance.saved.subscribe((blob: Blob) => finish(blob)));\n subscriptions.push(ref.instance.canceled.subscribe(() => finish(null)));\n });\n }\n}\n","/**\n * A bounded linear undo/redo history.\n *\n * Each entry pairs a human label (for the History panel) with an opaque state\n * snapshot (the editor stores serialized Fabric scenes here). Pure and fully\n * unit-testable — it holds no Fabric references.\n */\n\nexport interface HistoryEntry<T> {\n readonly label: string;\n readonly state: T;\n}\n\nconst DEFAULT_MAX_ENTRIES = 50;\n\nexport class EditHistory<T> {\n private readonly stack: HistoryEntry<T>[];\n private cursor = 0;\n private readonly maxEntries: number;\n\n constructor(initialLabel: string, initialState: T, maxEntries: number = DEFAULT_MAX_ENTRIES) {\n this.maxEntries = Math.max(1, maxEntries);\n this.stack = [{ label: initialLabel, state: initialState }];\n }\n\n /** All retained entries, oldest first. */\n get entries(): readonly HistoryEntry<T>[] {\n return this.stack;\n }\n\n /** Index of the current entry within {@link entries}. */\n get index(): number {\n return this.cursor;\n }\n\n get length(): number {\n return this.stack.length;\n }\n\n get current(): HistoryEntry<T> {\n return this.stack[this.cursor];\n }\n\n get canUndo(): boolean {\n return this.cursor > 0;\n }\n\n get canRedo(): boolean {\n return this.cursor < this.stack.length - 1;\n }\n\n /**\n * Record a new state. Any redo branch ahead of the cursor is discarded, and\n * the oldest entries are dropped once the cap is exceeded.\n */\n push(label: string, state: T): void {\n this.stack.splice(this.cursor + 1);\n this.stack.push({ label, state });\n while (this.stack.length > this.maxEntries) {\n this.stack.shift();\n }\n this.cursor = this.stack.length - 1;\n }\n\n /** Step back one entry, or return `null` if already at the start. */\n undo(): HistoryEntry<T> | null {\n if (!this.canUndo) {\n return null;\n }\n this.cursor -= 1;\n return this.current;\n }\n\n /** Step forward one entry, or return `null` if already at the end. */\n redo(): HistoryEntry<T> | null {\n if (!this.canRedo) {\n return null;\n }\n this.cursor += 1;\n return this.current;\n }\n\n /** Replace the entire history with a single fresh entry. */\n reset(label: string, state: T): void {\n this.stack.splice(0, this.stack.length, { label, state });\n this.cursor = 0;\n }\n}\n","/*\n * Public API surface of @ascentsparksoftware/angular-image-editor\n *\n * Only symbols re-exported here are part of the package's semver contract.\n * Additional components, the dialog service, and the tool types are added by\n * later phases (see docs/plans/00-master-plan.md).\n */\n\nexport { AspImageEditor } from './lib/ui/image-editor/image-editor';\n\n// Modal dialog — open the basic editor and await a Blob (or null on cancel).\nexport {\n AspImageEditorDialog,\n type OpenImageEditorConfig,\n} from './lib/dialog/image-editor-dialog';\n\n// Core type contract.\nexport {\n ALL_TOOLS,\n ALL_FILTERS,\n aspectOption,\n type AspMode,\n type AspSize,\n type AspTool,\n type AspFilter,\n type AspExportFormat,\n type AspAspectPreset,\n type AspAspectOption,\n type AspEditorError,\n} from './lib/types/editor.types';\n\n// Tool/filter catalog + resolution (mode → tools allowlist → minus disabledTools; filters).\nexport {\n TOOL_REGISTRY,\n FILTER_REGISTRY,\n DEFAULT_TOOLS,\n DEFAULT_FILTERS,\n type ToolMeta,\n type FilterMeta,\n type AspToolGroup,\n type FilterKind,\n} from './lib/registry/tool-registry';\nexport { resolveTools, resolveFilters } from './lib/registry/resolve-tools';\n\n// Engine — advanced/headless access to the Fabric-backed editing surface.\nexport {\n EditorEngine,\n type EngineOptions,\n type ShapeKind,\n type RedactMode,\n type AnnotationStyle,\n type TextStyle,\n type SelectionStyleInfo,\n type LayerInfo,\n type ArtboardSize,\n type ManualGuide,\n type Viewport,\n type AiProgress,\n} from './lib/engine/editor-engine';\nexport { EditHistory, type HistoryEntry } from './lib/engine/history';\nexport { DeltaHistory, type HistoryStep } from './lib/engine/delta-history';\n\n// Theming — derive and apply the editor's --asp-* palette from 3 inputs.\nexport { deriveTheme, type AspThemeMode } from './lib/theme/derive-theme';\nexport { applyTheme } from './lib/theme/apply-theme';\n\n// Text fonts — default set + type for customizing the font picker.\nexport { DEFAULT_FONTS, type FontOption } from './lib/ui/image-editor/fonts';\nexport {\n THEME_TOKEN_NAMES,\n COLOR_TOKEN_NAMES,\n STATIC_TOKEN_NAMES,\n type AspThemeTokens,\n type ThemeTokenName,\n} from './lib/theme/tokens';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["clamp","DEFAULT_MAX_ENTRIES"],"mappings":";;;;;;AAAA;;;;;AAKG;AASH,MAAMA,OAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,KACpD,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK;AAE/C;AACA,MAAM,YAAY,GAAG,CAAC,KAAa,KAAaA,O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