@alexgorbatchev/shadcn 0.0.160 → 0.0.162

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.
Files changed (30) hide show
  1. package/dist/{chunk-1j2hz3w9.js → chunk-3kb1gkke.js} +5 -7
  2. package/dist/{chunk-fnfaa0zx.js → chunk-46p9pkw1.js} +1 -1
  3. package/dist/{chunk-g2amqz9q.js → chunk-crvagbjs.js} +1 -1
  4. package/dist/chunk-dpedhp0c.js +5 -0
  5. package/dist/{chunk-dv0rz8r9.js → chunk-hev911n9.js} +1 -1
  6. package/dist/{chunk-ajnmzqsv.js → chunk-jkjq1jkd.js} +1 -1
  7. package/dist/{chunk-wvap51y9.js → chunk-vvt6y9j4.js} +1 -1
  8. package/dist/{chunk-j0sw6cn8.js → chunk-y7jv23qt.js} +1 -1
  9. package/dist/{chunk-zh1vby37.js → chunk-zyt63zrh.js} +1 -1
  10. package/dist/components/assistant-ui/elements/ElicitationForm.js +2 -2
  11. package/dist/components/assistant-ui/elements/ScheduleCard.js +2 -2
  12. package/dist/components/assistant-ui/elements/SettingsPanel.js +2 -2
  13. package/dist/components/assistant-ui/elements/VoiceOrb.js +3 -2
  14. package/dist/components/assistant-ui/index.js +7 -6
  15. package/dist/components/assistant-ui/native/VoiceOrb.js +4 -3
  16. package/dist/components/assistant-ui/native/index.js +4 -3
  17. package/dist/components/image-viewer/DiagramSurface.d.ts +22 -0
  18. package/dist/components/image-viewer/DiagramViewer.d.ts +42 -0
  19. package/dist/components/image-viewer/hooks/useMermaidTheme.d.ts +11 -0
  20. package/dist/components/image-viewer/index.d.ts +10 -0
  21. package/dist/components/image-viewer/index.js +700 -193
  22. package/dist/components/image-viewer/mermaidTheme.d.ts +58 -0
  23. package/dist/components/image-viewer/prepareDiagramSvg.d.ts +21 -0
  24. package/dist/components/json-render/index.js +4 -3
  25. package/dist/components/sonner/index.js +2 -1
  26. package/dist/index.js +4 -3
  27. package/dist/prototype.js +1 -1
  28. package/llms/components/data-display/DiagramViewer.md +66 -0
  29. package/llms.txt +1 -0
  30. package/package.json +1 -1
@@ -17,6 +17,9 @@ import {
17
17
  ToggleGroup2,
18
18
  ToggleGroupItem2
19
19
  } from "../../chunk-pbyj8rja.js";
20
+ import {
21
+ ThemeContext
22
+ } from "../../chunk-dpedhp0c.js";
20
23
  import"../../chunk-4m2x9jfb.js";
21
24
  import {
22
25
  Separator2
@@ -45,7 +48,7 @@ import {
45
48
  } from "../../chunk-d22t4qx6.js";
46
49
  import {
47
50
  Switch2
48
- } from "../../chunk-dv0rz8r9.js";
51
+ } from "../../chunk-hev911n9.js";
49
52
  import"../../chunk-5mydsjp3.js";
50
53
 
51
54
  // src/components/image-viewer/ImageViewer.tsx
@@ -406,25 +409,25 @@ function ImageViewport({
406
409
  "data-slot": "image-viewport-scroll-hint",
407
410
  "data-edge": "left",
408
411
  "aria-hidden": "true",
409
- className: "pointer-events-none absolute inset-y-0 left-0 w-5 border-l border-foreground/30 bg-gradient-to-r from-black/35 via-black/15 to-transparent dark:from-black/55 dark:via-black/20"
412
+ className: "pointer-events-none absolute inset-y-0 left-0 w-5 bg-gradient-to-r from-black/45 via-black/15 to-transparent dark:from-black/65 dark:via-black/25"
410
413
  }),
411
414
  scrollHints.right && /* @__PURE__ */ jsx("div", {
412
415
  "data-slot": "image-viewport-scroll-hint",
413
416
  "data-edge": "right",
414
417
  "aria-hidden": "true",
415
- className: "pointer-events-none absolute inset-y-0 right-0 w-5 border-r border-foreground/30 bg-gradient-to-l from-black/35 via-black/15 to-transparent dark:from-black/55 dark:via-black/20"
418
+ className: "pointer-events-none absolute inset-y-0 right-0 w-5 bg-gradient-to-l from-black/45 via-black/15 to-transparent dark:from-black/65 dark:via-black/25"
416
419
  }),
417
420
  scrollHints.top && /* @__PURE__ */ jsx("div", {
418
421
  "data-slot": "image-viewport-scroll-hint",
419
422
  "data-edge": "top",
420
423
  "aria-hidden": "true",
421
- className: "pointer-events-none absolute inset-x-0 top-0 h-5 border-t border-foreground/30 bg-gradient-to-b from-black/35 via-black/15 to-transparent dark:from-black/55 dark:via-black/20"
424
+ className: "pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-black/45 via-black/15 to-transparent dark:from-black/65 dark:via-black/25"
422
425
  }),
423
426
  scrollHints.bottom && /* @__PURE__ */ jsx("div", {
424
427
  "data-slot": "image-viewport-scroll-hint",
425
428
  "data-edge": "bottom",
426
429
  "aria-hidden": "true",
427
- className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 border-b border-foreground/30 bg-gradient-to-t from-black/35 via-black/15 to-transparent dark:from-black/55 dark:via-black/20"
430
+ className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-black/45 via-black/15 to-transparent dark:from-black/65 dark:via-black/25"
428
431
  })
429
432
  ]
430
433
  });
@@ -633,8 +636,499 @@ function ImageViewer({
633
636
  ]
634
637
  });
635
638
  }
636
- // src/components/image-viewer/ImageZoomToggle.tsx
639
+ // src/components/image-viewer/DiagramSurface.tsx
640
+ import { useIsoLayoutEffect as useIsoLayoutEffect3 } from "@base-ui/utils/useIsoLayoutEffect";
641
+ import { useId, useRef as useRef3 } from "react";
642
+
643
+ // src/components/image-viewer/prepareDiagramSvg.ts
644
+ function parseLength(value) {
645
+ if (!value)
646
+ return;
647
+ const trimmed = value.trim();
648
+ if (trimmed.endsWith("%"))
649
+ return;
650
+ const parsed = Number.parseFloat(trimmed);
651
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
652
+ }
653
+ function parseViewBox(value) {
654
+ if (!value)
655
+ return;
656
+ const parts = value.trim().split(/[\s,]+/).map(Number);
657
+ if (parts.length !== 4)
658
+ return;
659
+ const width = parts[2];
660
+ const height = parts[3];
661
+ if (width === undefined || height === undefined || !Number.isFinite(width) || !Number.isFinite(height)) {
662
+ return;
663
+ }
664
+ return width > 0 && height > 0 ? { width, height } : undefined;
665
+ }
666
+ function getDiagramSvgSize(svg) {
667
+ if (typeof DOMParser === "undefined")
668
+ return;
669
+ const parsed = new DOMParser().parseFromString(svg, "image/svg+xml");
670
+ const root = parsed.documentElement;
671
+ if (root.localName !== "svg")
672
+ return;
673
+ const fromViewBox = parseViewBox(root.getAttribute("viewBox"));
674
+ if (fromViewBox)
675
+ return fromViewBox;
676
+ const width = parseLength(root.getAttribute("width"));
677
+ const height = parseLength(root.getAttribute("height"));
678
+ return width && height ? { width, height } : undefined;
679
+ }
680
+ function escapeRegExp(value) {
681
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
682
+ }
683
+ function stripImportRules(root, ownerDocument) {
684
+ const detached = ownerDocument.implementation.createHTMLDocument();
685
+ for (const source of root.querySelectorAll("style")) {
686
+ const style = detached.createElement("style");
687
+ style.textContent = source.textContent;
688
+ detached.head.append(style);
689
+ const sheet = style.sheet;
690
+ if (sheet) {
691
+ for (let index = sheet.cssRules.length - 1;index >= 0; index--) {
692
+ const rule = sheet.cssRules[index];
693
+ if (rule && rule.cssText.trimStart().startsWith("@import"))
694
+ sheet.deleteRule(index);
695
+ }
696
+ source.textContent = Array.from(sheet.cssRules, (rule) => rule.cssText).join(`
697
+ `);
698
+ } else {
699
+ source.textContent = (source.textContent ?? "").replace(/@import\s+[^;]+;/gi, "");
700
+ }
701
+ style.remove();
702
+ }
703
+ }
704
+ function prefixSvgIds(root, prefix) {
705
+ const idMap = new Map;
706
+ const elements = [root, ...Array.from(root.querySelectorAll("[id]"))];
707
+ for (const element of elements) {
708
+ const oldId = element.getAttribute("id");
709
+ if (!oldId || idMap.has(oldId))
710
+ continue;
711
+ const nextId = `${prefix}-${oldId}`;
712
+ idMap.set(oldId, nextId);
713
+ element.setAttribute("id", nextId);
714
+ }
715
+ if (idMap.size === 0)
716
+ return;
717
+ const sortedIds = [...idMap.keys()].sort((a, b) => b.length - a.length);
718
+ const selectorPattern = new RegExp(`#(${sortedIds.map(escapeRegExp).join("|")})(?![A-Za-z0-9_-])`, "g");
719
+ const urlPattern = new RegExp(`url\\(\\s*["']?#(${sortedIds.map(escapeRegExp).join("|")})["']?\\s*\\)`, "g");
720
+ for (const style of root.querySelectorAll("style")) {
721
+ if (!style.textContent)
722
+ continue;
723
+ style.textContent = style.textContent.replace(urlPattern, (_match, id) => `url(#${idMap.get(id) ?? id})`).replace(selectorPattern, (_match, id) => `#${idMap.get(id) ?? id}`);
724
+ }
725
+ for (const element of [root, ...Array.from(root.querySelectorAll("*"))]) {
726
+ for (const attr of Array.from(element.attributes)) {
727
+ if (attr.name === "id")
728
+ continue;
729
+ if (attr.name === "href" || attr.name === "xlink:href") {
730
+ if (attr.value.startsWith("#")) {
731
+ const target = attr.value.slice(1);
732
+ const mapped = idMap.get(target);
733
+ if (mapped)
734
+ element.setAttribute(attr.name, `#${mapped}`);
735
+ }
736
+ continue;
737
+ }
738
+ if (attr.name === "aria-labelledby" || attr.name === "aria-describedby") {
739
+ const replaced = attr.value.split(/\s+/).map((token) => idMap.get(token) ?? token).join(" ");
740
+ if (replaced !== attr.value)
741
+ element.setAttribute(attr.name, replaced);
742
+ continue;
743
+ }
744
+ if (attr.value.includes("url(")) {
745
+ const replaced = attr.value.replace(urlPattern, (_match, id) => `url(#${idMap.get(id) ?? id})`);
746
+ if (replaced !== attr.value)
747
+ element.setAttribute(attr.name, replaced);
748
+ }
749
+ }
750
+ }
751
+ }
752
+ function prepareDiagramSvg(svg, ownerDocument, options) {
753
+ const parsed = new DOMParser().parseFromString(svg, "image/svg+xml");
754
+ const root = parsed.documentElement;
755
+ if (root.localName !== "svg")
756
+ throw new Error("Diagram returned an invalid SVG document.");
757
+ stripImportRules(root, ownerDocument);
758
+ prefixSvgIds(root, options.idPrefix);
759
+ const imported = ownerDocument.importNode(root, true);
760
+ if (!(imported instanceof SVGSVGElement))
761
+ throw new Error("Diagram SVG could not be imported.");
762
+ imported.setAttribute("role", "img");
763
+ imported.removeAttribute("aria-roledescription");
764
+ if (options.labelledBy) {
765
+ imported.setAttribute("aria-labelledby", options.labelledBy);
766
+ imported.removeAttribute("aria-label");
767
+ } else if (options.label) {
768
+ imported.setAttribute("aria-label", options.label);
769
+ imported.removeAttribute("aria-labelledby");
770
+ }
771
+ if (options.describedBy)
772
+ imported.setAttribute("aria-describedby", options.describedBy);
773
+ else
774
+ imported.removeAttribute("aria-describedby");
775
+ const size = parseViewBox(imported.getAttribute("viewBox")) ?? {
776
+ width: parseLength(imported.getAttribute("width")) ?? 0,
777
+ height: parseLength(imported.getAttribute("height")) ?? 0
778
+ };
779
+ if (!imported.getAttribute("viewBox") && size.width > 0 && size.height > 0) {
780
+ imported.setAttribute("viewBox", `0 0 ${size.width} ${size.height}`);
781
+ }
782
+ imported.style.display = "block";
783
+ if (options.fit === "fill") {
784
+ imported.setAttribute("width", "100%");
785
+ imported.setAttribute("height", "100%");
786
+ imported.style.maxWidth = "none";
787
+ imported.style.width = "100%";
788
+ imported.style.height = "100%";
789
+ } else {
790
+ imported.removeAttribute("height");
791
+ imported.style.maxWidth = "100%";
792
+ imported.style.height = "auto";
793
+ imported.style.marginInline = "auto";
794
+ }
795
+ return imported;
796
+ }
797
+
798
+ // src/components/image-viewer/DiagramSurface.tsx
637
799
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
800
+ function assignRef(ref, value) {
801
+ if (!ref)
802
+ return;
803
+ if (typeof ref === "function")
804
+ ref(value);
805
+ else
806
+ ref.current = value;
807
+ }
808
+ function DiagramSurface({
809
+ svg,
810
+ label,
811
+ labelledBy,
812
+ describedBy,
813
+ description,
814
+ fit = "inline",
815
+ svgRef
816
+ }) {
817
+ const hostRef = useRef3(null);
818
+ const rawId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
819
+ const descriptionId = `diagram-desc-${rawId}`;
820
+ const effectiveDescribedBy = describedBy ?? (description?.trim() ? descriptionId : undefined);
821
+ useIsoLayoutEffect3(() => {
822
+ const host = hostRef.current;
823
+ if (!host)
824
+ return;
825
+ const element = prepareDiagramSvg(svg, host.ownerDocument, {
826
+ idPrefix: `diagram-${rawId}`,
827
+ label,
828
+ labelledBy,
829
+ describedBy: effectiveDescribedBy,
830
+ fit
831
+ });
832
+ host.replaceChildren(element);
833
+ assignRef(svgRef, element);
834
+ return () => {
835
+ assignRef(svgRef, null);
836
+ host.replaceChildren();
837
+ };
838
+ }, [svg, rawId, label, labelledBy, effectiveDescribedBy, fit, svgRef]);
839
+ return /* @__PURE__ */ jsxs4("div", {
840
+ "data-slot": "diagram-surface",
841
+ "data-fit": fit,
842
+ className: cn2("bg-card text-card-foreground", fit === "fill" ? "size-full" : "overflow-x-auto p-panel-sm"),
843
+ children: [
844
+ /* @__PURE__ */ jsx4("div", {
845
+ ref: hostRef,
846
+ className: fit === "fill" ? "size-full" : undefined
847
+ }),
848
+ !describedBy && description?.trim() ? /* @__PURE__ */ jsx4("span", {
849
+ id: descriptionId,
850
+ className: "sr-only",
851
+ children: description.trim()
852
+ }) : null
853
+ ]
854
+ });
855
+ }
856
+ // src/components/image-viewer/DiagramViewer.tsx
857
+ import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
858
+ import { useIsoLayoutEffect as useIsoLayoutEffect4 } from "@base-ui/utils/useIsoLayoutEffect";
859
+ import { useMergedRefs as useMergedRefs3 } from "@base-ui/utils/useMergedRefs";
860
+ import { useMemo, useRef as useRef4, useState as useState4 } from "react";
861
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
862
+ function DiagramViewer({
863
+ svg,
864
+ label,
865
+ description,
866
+ naturalSize: naturalSizeProp,
867
+ zoom: zoomProp,
868
+ defaultZoom,
869
+ onZoomChange,
870
+ openingWidth,
871
+ showZoomControl = false,
872
+ toolbar,
873
+ stageRef,
874
+ onStageKeyDown,
875
+ stageKeyShortcuts,
876
+ density
877
+ }) {
878
+ const [zoom, setZoomState] = useControlled2({
879
+ controlled: zoomProp,
880
+ default: defaultZoom,
881
+ name: "DiagramViewer",
882
+ state: "zoom"
883
+ });
884
+ const center = useRef4({ x: 0.5, y: 0.5 });
885
+ const viewportRef = useRef4(null);
886
+ const mergedStageRef = useMergedRefs3(viewportRef, stageRef);
887
+ const viewportSize = useElementSize(viewportRef);
888
+ const parsedSize = useMemo(() => getDiagramSvgSize(svg), [svg]);
889
+ const naturalSize = naturalSizeProp ?? parsedSize;
890
+ const [openingZoom, setOpeningZoom] = useState4();
891
+ const scales = naturalSize && viewportSize ? getImageZoomScales(naturalSize, viewportSize) : undefined;
892
+ useIsoLayoutEffect4(() => {
893
+ if (zoom !== undefined || openingZoom !== undefined || !naturalSize || !viewportSize)
894
+ return;
895
+ const opening = getOpeningImageZoom(naturalSize, viewportSize, openingWidth);
896
+ const stageHeight = naturalSize.height * resolveImageZoomScale(opening, getImageZoomScales(naturalSize, viewportSize));
897
+ if (stageHeight > viewportSize.height)
898
+ center.current = { x: 0.5, y: viewportSize.height / 2 / stageHeight };
899
+ setOpeningZoom(opening);
900
+ }, [naturalSize, openingWidth, openingZoom, viewportSize, zoom]);
901
+ const shownZoom = zoom ?? openingZoom ?? "fit";
902
+ const scale = scales ? resolveImageZoomScale(shownZoom, scales) : undefined;
903
+ function setZoom(next) {
904
+ setZoomState(next);
905
+ setOpeningZoom(next);
906
+ onZoomChange?.(next);
907
+ }
908
+ return /* @__PURE__ */ jsxs5("div", {
909
+ "data-slot": "diagram-viewer",
910
+ "data-scroll": "none",
911
+ "data-density": density,
912
+ "data-zoom": shownZoom,
913
+ className: "flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
914
+ children: [
915
+ (showZoomControl || toolbar !== undefined) && /* @__PURE__ */ jsxs5("div", {
916
+ "data-slot": "diagram-viewer-toolbar",
917
+ className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0",
918
+ children: [
919
+ showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
920
+ zoom: shownZoom,
921
+ scale,
922
+ scales,
923
+ onZoomChange: setZoom,
924
+ density
925
+ }),
926
+ toolbar
927
+ ]
928
+ }),
929
+ /* @__PURE__ */ jsx5(ImageViewport, {
930
+ label,
931
+ zoom: shownZoom,
932
+ naturalSize,
933
+ center,
934
+ viewportRef: mergedStageRef,
935
+ onZoomChange: setZoom,
936
+ onStageKeyDown,
937
+ stageKeyShortcuts,
938
+ children: /* @__PURE__ */ jsx5("div", {
939
+ "data-slot": "diagram-viewer-frame",
940
+ className: "size-full bg-card outline-1 -outline-offset-1 outline-media-edge",
941
+ children: /* @__PURE__ */ jsx5(DiagramSurface, {
942
+ svg,
943
+ label,
944
+ description,
945
+ fit: "fill"
946
+ })
947
+ })
948
+ })
949
+ ]
950
+ });
951
+ }
952
+ // src/components/image-viewer/mermaidTheme.ts
953
+ var DARK_FALLBACK = {
954
+ card: "#121417",
955
+ foreground: "#eceff3",
956
+ secondary: "#1c1f24",
957
+ muted: "#282c33",
958
+ mutedForeground: "#a3abb6",
959
+ border: "#353b44",
960
+ input: "#6f7783",
961
+ primaryForeground: "#1a0014",
962
+ fontFamily: '"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
963
+ };
964
+ var LIGHT_FALLBACK = {
965
+ card: "#fcfcfd",
966
+ foreground: "#0c0e11",
967
+ secondary: "#eef0f3",
968
+ muted: "#e0e4ea",
969
+ mutedForeground: "#4b535e",
970
+ border: "#c7ccd4",
971
+ input: "#747c88",
972
+ primaryForeground: "#ffffff",
973
+ fontFamily: '"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
974
+ };
975
+ function toHexByte(channel) {
976
+ return Math.max(0, Math.min(255, Math.round(channel))).toString(16).padStart(2, "0");
977
+ }
978
+ function normalizeHex(raw) {
979
+ const trimmed = raw.trim();
980
+ if (/^#[0-9a-f]{6}$/i.test(trimmed))
981
+ return trimmed.toLowerCase();
982
+ const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(trimmed);
983
+ if (short) {
984
+ const [, r, g, b] = short;
985
+ return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();
986
+ }
987
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(trimmed);
988
+ if (rgb)
989
+ return `#${toHexByte(Number(rgb[1]))}${toHexByte(Number(rgb[2]))}${toHexByte(Number(rgb[3]))}`;
990
+ return;
991
+ }
992
+ function resolveCssColorToHex(raw, fallback) {
993
+ const direct = normalizeHex(raw);
994
+ if (direct)
995
+ return direct;
996
+ const trimmed = raw.trim();
997
+ if (!trimmed || typeof document === "undefined")
998
+ return fallback;
999
+ const canvas = document.createElement("canvas");
1000
+ canvas.width = 1;
1001
+ canvas.height = 1;
1002
+ const context = canvas.getContext("2d", { willReadFrequently: true });
1003
+ if (!context)
1004
+ return fallback;
1005
+ context.fillStyle = fallback;
1006
+ context.fillRect(0, 0, 1, 1);
1007
+ context.fillStyle = trimmed;
1008
+ context.fillRect(0, 0, 1, 1);
1009
+ const pixel = context.getImageData(0, 0, 1, 1).data;
1010
+ if (pixel[3] === 0)
1011
+ return fallback;
1012
+ return `#${toHexByte(pixel[0] ?? 0)}${toHexByte(pixel[1] ?? 0)}${toHexByte(pixel[2] ?? 0)}`;
1013
+ }
1014
+ function detectDarkMode(element) {
1015
+ const themed = element?.closest("[data-theme]") ?? (typeof document !== "undefined" ? document.documentElement : null);
1016
+ const attr = themed?.getAttribute("data-theme");
1017
+ if (attr === "light")
1018
+ return false;
1019
+ if (attr === "dark")
1020
+ return true;
1021
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
1022
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
1023
+ }
1024
+ return true;
1025
+ }
1026
+ function getMermaidThemeConfig(element) {
1027
+ const darkMode = detectDarkMode(element);
1028
+ const fallback = darkMode ? DARK_FALLBACK : LIGHT_FALLBACK;
1029
+ const target = element ?? (typeof document !== "undefined" ? document.documentElement : undefined);
1030
+ const style = target && typeof getComputedStyle === "function" ? getComputedStyle(target) : undefined;
1031
+ const color = (token, defaultHex) => resolveCssColorToHex(style?.getPropertyValue(token) ?? "", defaultHex);
1032
+ const card = color("--card", fallback.card);
1033
+ const foreground = color("--foreground", fallback.foreground);
1034
+ const secondary = color("--secondary", fallback.secondary);
1035
+ const muted = color("--muted", fallback.muted);
1036
+ const mutedForeground = color("--muted-foreground", fallback.mutedForeground);
1037
+ const border = color("--border", fallback.border);
1038
+ const input = color("--input", fallback.input);
1039
+ const primaryForeground = color("--primary-foreground", fallback.primaryForeground);
1040
+ const fontFamily = style?.getPropertyValue("--ag-font").trim() || style?.fontFamily.trim() || fallback.fontFamily;
1041
+ return {
1042
+ theme: "base",
1043
+ darkMode,
1044
+ fontFamily,
1045
+ themeVariables: {
1046
+ darkMode,
1047
+ fontFamily,
1048
+ background: card,
1049
+ primaryColor: secondary,
1050
+ primaryTextColor: foreground,
1051
+ primaryBorderColor: input,
1052
+ secondaryColor: muted,
1053
+ secondaryTextColor: foreground,
1054
+ secondaryBorderColor: input,
1055
+ tertiaryColor: card,
1056
+ tertiaryTextColor: foreground,
1057
+ tertiaryBorderColor: border,
1058
+ mainBkg: secondary,
1059
+ nodeBorder: input,
1060
+ nodeTextColor: foreground,
1061
+ textColor: foreground,
1062
+ titleColor: foreground,
1063
+ lineColor: mutedForeground,
1064
+ defaultLinkColor: mutedForeground,
1065
+ edgeLabelBackground: card,
1066
+ clusterBkg: card,
1067
+ clusterBorder: input,
1068
+ actorBkg: secondary,
1069
+ actorBorder: input,
1070
+ actorTextColor: foreground,
1071
+ actorLineColor: input,
1072
+ signalColor: mutedForeground,
1073
+ signalTextColor: foreground,
1074
+ labelBoxBkgColor: secondary,
1075
+ labelBoxBorderColor: input,
1076
+ labelTextColor: foreground,
1077
+ loopTextColor: foreground,
1078
+ noteBkgColor: muted,
1079
+ noteBorderColor: input,
1080
+ noteTextColor: foreground,
1081
+ activationBkgColor: muted,
1082
+ activationBorderColor: mutedForeground,
1083
+ sequenceNumberColor: primaryForeground,
1084
+ errorBkgColor: muted,
1085
+ errorTextColor: foreground
1086
+ }
1087
+ };
1088
+ }
1089
+ // src/components/image-viewer/hooks/useMermaidTheme.ts
1090
+ import { useContext, useEffect as useEffect2, useState as useState5 } from "react";
1091
+ function readThemeState(element) {
1092
+ const config = getMermaidThemeConfig(element);
1093
+ return { themeKey: JSON.stringify(config), config };
1094
+ }
1095
+ function useMermaidTheme(element) {
1096
+ const theme = useContext(ThemeContext);
1097
+ const resolvedTheme = theme?.resolvedTheme;
1098
+ const preset = theme?.preset;
1099
+ const [state, setState] = useState5(() => readThemeState(element ?? undefined));
1100
+ useEffect2(() => {
1101
+ const target = element ?? undefined;
1102
+ const sync = () => {
1103
+ const next = readThemeState(target);
1104
+ setState((current) => current.themeKey === next.themeKey ? current : next);
1105
+ };
1106
+ sync();
1107
+ const observer = typeof MutationObserver !== "undefined" && typeof document !== "undefined" ? new MutationObserver(sync) : undefined;
1108
+ if (observer && typeof document !== "undefined") {
1109
+ observer.observe(document.documentElement, {
1110
+ attributes: true,
1111
+ attributeFilter: ["data-theme", "data-theme-preset", "class", "style"]
1112
+ });
1113
+ const scoped = target?.closest("[data-theme]");
1114
+ if (scoped && scoped !== document.documentElement) {
1115
+ observer.observe(scoped, {
1116
+ attributes: true,
1117
+ attributeFilter: ["data-theme", "data-theme-preset", "class", "style"]
1118
+ });
1119
+ }
1120
+ }
1121
+ const media = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)") : undefined;
1122
+ media?.addEventListener("change", sync);
1123
+ return () => {
1124
+ observer?.disconnect();
1125
+ media?.removeEventListener("change", sync);
1126
+ };
1127
+ }, [element, resolvedTheme, preset]);
1128
+ return state;
1129
+ }
1130
+ // src/components/image-viewer/ImageZoomToggle.tsx
1131
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
638
1132
  function ImageZoomToggle({
639
1133
  zoom,
640
1134
  onZoomChange,
@@ -645,7 +1139,7 @@ function ImageZoomToggle({
645
1139
  disabled = false,
646
1140
  density
647
1141
  }) {
648
- return /* @__PURE__ */ jsxs4(ToggleGroup2, {
1142
+ return /* @__PURE__ */ jsxs6(ToggleGroup2, {
649
1143
  "aria-label": label,
650
1144
  value: zoom === "fit" ? ["fit"] : zoom === 1 ? ["original"] : [],
651
1145
  onValueChange: (value) => {
@@ -660,11 +1154,11 @@ function ImageZoomToggle({
660
1154
  disabled,
661
1155
  density,
662
1156
  children: [
663
- /* @__PURE__ */ jsx4(ToggleGroupItem2, {
1157
+ /* @__PURE__ */ jsx6(ToggleGroupItem2, {
664
1158
  value: "fit",
665
1159
  children: "Fit to screen"
666
1160
  }),
667
- /* @__PURE__ */ jsx4(ToggleGroupItem2, {
1161
+ /* @__PURE__ */ jsx6(ToggleGroupItem2, {
668
1162
  value: "original",
669
1163
  children: "Original size"
670
1164
  })
@@ -672,7 +1166,7 @@ function ImageZoomToggle({
672
1166
  });
673
1167
  }
674
1168
  // src/components/image-viewer/ImageRegionSelect.tsx
675
- import { useRef as useRef3, useState as useState4 } from "react";
1169
+ import { useRef as useRef5, useState as useState6 } from "react";
676
1170
 
677
1171
  // src/components/image-viewer/getNormalizedImagePoint.ts
678
1172
  function clampUnit2(value) {
@@ -739,13 +1233,13 @@ function formatImageRegion(region) {
739
1233
 
740
1234
  // src/components/image-viewer/ImageRegionMarker.tsx
741
1235
  import { cva } from "class-variance-authority";
742
- import { jsx as jsx5 } from "react/jsx-runtime";
1236
+ import { jsx as jsx7 } from "react/jsx-runtime";
743
1237
  var imageRegionMarkerVariants = cva("pointer-events-none absolute rounded-xs shadow-[0_0_0_4px_var(--background)] ring-1 ring-background outline-2 outline-offset-1 forced-colors:outline-[Highlight]", {
744
1238
  variants: {
745
1239
  variant: {
746
1240
  comment: "bg-primary/10 outline-primary",
747
1241
  draft: "bg-primary/10 outline-dashed outline-primary",
748
- difference: "bg-warning/5 outline-dashed outline-offset-[3px] outline-warning/75"
1242
+ difference: "bg-warning/5 outline-dashed outline-warning/80"
749
1243
  }
750
1244
  },
751
1245
  defaultVariants: { variant: "comment" }
@@ -758,11 +1252,11 @@ function ImageRegionMarker({
758
1252
  style,
759
1253
  ...props
760
1254
  }) {
761
- return /* @__PURE__ */ jsx5("div", {
1255
+ return /* @__PURE__ */ jsx7("div", {
762
1256
  "data-slot": "image-region-marker",
763
1257
  "data-variant": variant ?? "comment",
764
1258
  "data-active": active ? "" : undefined,
765
- className: cn2(imageRegionMarkerVariants({ variant }), active && "z-10 outline-[3px]", active && variant === "difference" && "bg-warning/25 shadow-[0_0_0_5px_var(--background)] outline-solid outline-warning", className),
1259
+ className: cn2(imageRegionMarkerVariants({ variant }), active && "z-10 outline-[3px]", active && variant === "difference" && "bg-warning/20 shadow-[0_0_0_5px_var(--background)] outline-solid outline-warning", className),
766
1260
  style: region ? { ...style, ...region } : style,
767
1261
  ...props
768
1262
  });
@@ -774,7 +1268,7 @@ function ImageRegionMarkerBadge({
774
1268
  style,
775
1269
  ...props
776
1270
  }) {
777
- return /* @__PURE__ */ jsx5("div", {
1271
+ return /* @__PURE__ */ jsx7("div", {
778
1272
  "data-slot": "image-region-marker-badge",
779
1273
  "data-interactive": interactive,
780
1274
  className: cn2("absolute z-10 rounded-sm shadow-[0_0_0_4px_var(--background)] outline-2 outline-primary forced-colors:outline-[Highlight]", interactive ? "pointer-events-auto" : "pointer-events-none", className),
@@ -784,7 +1278,7 @@ function ImageRegionMarkerBadge({
784
1278
  }
785
1279
 
786
1280
  // src/components/image-viewer/ImageRegionSelect.tsx
787
- import { jsx as jsx6 } from "react/jsx-runtime";
1281
+ import { jsx as jsx8 } from "react/jsx-runtime";
788
1282
  var MINIMUM_DRAG = 4;
789
1283
  function toRegion(start, end) {
790
1284
  return {
@@ -803,9 +1297,9 @@ function toBox(region) {
803
1297
  };
804
1298
  }
805
1299
  function ImageRegionSelect({ region, onRegionChange, onStart }) {
806
- const drag = useRef3(null);
807
- const pendingClick = useRef3(null);
808
- const [draft, setDraft] = useState4();
1300
+ const drag = useRef5(null);
1301
+ const pendingClick = useRef5(null);
1302
+ const [draft, setDraft] = useState6();
809
1303
  const point = (event) => getNormalizedImagePoint(event, event.currentTarget.getBoundingClientRect());
810
1304
  function cancel() {
811
1305
  drag.current = null;
@@ -823,7 +1317,7 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
823
1317
  onRegionChange(placed);
824
1318
  }
825
1319
  const shown = draft ?? region;
826
- return /* @__PURE__ */ jsx6("div", {
1320
+ return /* @__PURE__ */ jsx8("div", {
827
1321
  "data-slot": "image-region-select",
828
1322
  className: "absolute inset-0 cursor-crosshair touch-none",
829
1323
  onPointerDown: (event) => {
@@ -865,7 +1359,7 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
865
1359
  onRegionChange(dragged);
866
1360
  },
867
1361
  onPointerCancel: cancel,
868
- children: shown && /* @__PURE__ */ jsx6(ImageRegionMarker, {
1362
+ children: shown && /* @__PURE__ */ jsx8(ImageRegionMarker, {
869
1363
  variant: "draft",
870
1364
  role: draft ? undefined : "img",
871
1365
  "aria-hidden": draft ? "true" : undefined,
@@ -876,8 +1370,8 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
876
1370
  });
877
1371
  }
878
1372
  // src/components/image-viewer/ImageRegionFields.tsx
879
- import { useId } from "react";
880
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1373
+ import { useId as useId2 } from "react";
1374
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
881
1375
  var FIELDS = [
882
1376
  ["x", "Left"],
883
1377
  ["y", "Top"],
@@ -894,22 +1388,22 @@ function ImageRegionFields({
894
1388
  className,
895
1389
  density
896
1390
  }) {
897
- const id = useId();
898
- return /* @__PURE__ */ jsxs5("div", {
1391
+ const id = useId2();
1392
+ return /* @__PURE__ */ jsxs7("div", {
899
1393
  role: "group",
900
1394
  "aria-label": label,
901
1395
  "data-slot": "image-region-fields",
902
1396
  "data-density": density,
903
1397
  className: cn2("flex flex-wrap items-end gap-control-gap", className),
904
1398
  children: [
905
- FIELDS.map(([key, name]) => /* @__PURE__ */ jsxs5(Field2, {
1399
+ FIELDS.map(([key, name]) => /* @__PURE__ */ jsxs7(Field2, {
906
1400
  className: "w-20",
907
1401
  children: [
908
- /* @__PURE__ */ jsx7(FieldLabel2, {
1402
+ /* @__PURE__ */ jsx9(FieldLabel2, {
909
1403
  htmlFor: `${id}-${key}`,
910
1404
  children: name
911
1405
  }),
912
- /* @__PURE__ */ jsx7(NumberField2, {
1406
+ /* @__PURE__ */ jsx9(NumberField2, {
913
1407
  id: `${id}-${key}`,
914
1408
  density,
915
1409
  value: toPercent(region[key]),
@@ -923,15 +1417,15 @@ function ImageRegionFields({
923
1417
  return;
924
1418
  onRegionChange(clampImageRegion({ ...region, [key]: value / 100 }));
925
1419
  },
926
- children: /* @__PURE__ */ jsx7(NumberFieldGroup2, {
927
- children: /* @__PURE__ */ jsx7(NumberFieldInput2, {
1420
+ children: /* @__PURE__ */ jsx9(NumberFieldGroup2, {
1421
+ children: /* @__PURE__ */ jsx9(NumberFieldInput2, {
928
1422
  "aria-describedby": `${id}-unit`
929
1423
  })
930
1424
  })
931
1425
  })
932
1426
  ]
933
1427
  }, key)),
934
- /* @__PURE__ */ jsx7("span", {
1428
+ /* @__PURE__ */ jsx9("span", {
935
1429
  id: `${id}-unit`,
936
1430
  className: "sr-only",
937
1431
  children: "percent of the image"
@@ -940,13 +1434,13 @@ function ImageRegionFields({
940
1434
  });
941
1435
  }
942
1436
  // src/components/image-viewer/ImageGallery.tsx
943
- import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
1437
+ import { useControlled as useControlled3 } from "@base-ui/utils/useControlled";
944
1438
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
945
1439
  import {
946
- useRef as useRef4,
947
- useState as useState5
1440
+ useRef as useRef6,
1441
+ useState as useState7
948
1442
  } from "react";
949
- import { jsx as jsx8, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
1443
+ import { jsx as jsx10, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
950
1444
  function CompareAllPane({
951
1445
  item,
952
1446
  zoom,
@@ -957,29 +1451,29 @@ function CompareAllPane({
957
1451
  footer
958
1452
  }) {
959
1453
  const [image, imageHandlers] = useImageLoad(item.src);
960
- return /* @__PURE__ */ jsxs6("section", {
1454
+ return /* @__PURE__ */ jsxs8("section", {
961
1455
  "aria-label": item.label,
962
1456
  "data-slot": "image-gallery-compare-pane",
963
1457
  "data-selected": item.selected ? "" : undefined,
964
1458
  className: cn2("flex min-w-0 flex-col overflow-hidden rounded-md border bg-background", item.selected ? "border-primary ring-1 ring-primary" : "border-border"),
965
1459
  children: [
966
- /* @__PURE__ */ jsxs6("div", {
1460
+ /* @__PURE__ */ jsxs8("div", {
967
1461
  "data-slot": "image-gallery-compare-header",
968
1462
  className: "flex h-control shrink-0 items-center justify-between gap-2 border-b border-border px-control-x text-xs font-medium text-foreground",
969
1463
  children: [
970
- /* @__PURE__ */ jsx8("span", {
1464
+ /* @__PURE__ */ jsx10("span", {
971
1465
  className: "truncate",
972
1466
  children: item.label
973
1467
  }),
974
- item.selected && /* @__PURE__ */ jsx8(Badge2, {
1468
+ item.selected && /* @__PURE__ */ jsx10(Badge2, {
975
1469
  variant: "default",
976
1470
  children: "Chosen"
977
1471
  })
978
1472
  ]
979
1473
  }),
980
- /* @__PURE__ */ jsx8("div", {
981
- className: cn2("flex w-full shrink-0", zoom === "fit" ? "aspect-[16/10]" : "h-[min(60dvh,32rem)]"),
982
- children: /* @__PURE__ */ jsx8(ImageViewport, {
1474
+ /* @__PURE__ */ jsx10("div", {
1475
+ className: cn2("flex w-full shrink-0 p-2", zoom === "fit" ? "aspect-[16/10]" : "h-[min(60dvh,32rem)]"),
1476
+ children: /* @__PURE__ */ jsx10(ImageViewport, {
983
1477
  label: item.label,
984
1478
  zoom,
985
1479
  naturalSize: image.size,
@@ -988,11 +1482,11 @@ function CompareAllPane({
988
1482
  viewportRef,
989
1483
  onViewportScroll,
990
1484
  allowVerticalScroll: true,
991
- fallback: image.status === "error" ? /* @__PURE__ */ jsx8("p", {
1485
+ fallback: image.status === "error" ? /* @__PURE__ */ jsx10("p", {
992
1486
  className: "m-auto p-panel text-center text-sm text-muted-foreground",
993
1487
  children: "Image could not be loaded."
994
1488
  }) : undefined,
995
- children: /* @__PURE__ */ jsx8("img", {
1489
+ children: /* @__PURE__ */ jsx10("img", {
996
1490
  src: item.src,
997
1491
  alt: item.alt,
998
1492
  draggable: false,
@@ -1003,15 +1497,15 @@ function CompareAllPane({
1003
1497
  })
1004
1498
  })
1005
1499
  }),
1006
- (item.description || footer !== undefined && footer !== null) && /* @__PURE__ */ jsxs6("div", {
1500
+ (item.description || footer !== undefined && footer !== null) && /* @__PURE__ */ jsxs8("div", {
1007
1501
  "data-slot": "image-gallery-compare-footer",
1008
1502
  className: "flex flex-1 shrink-0 flex-col justify-between gap-2 border-t border-border p-panel-sm",
1009
1503
  children: [
1010
- item.description && /* @__PURE__ */ jsx8("p", {
1504
+ item.description && /* @__PURE__ */ jsx10("p", {
1011
1505
  className: "text-xs text-muted-foreground",
1012
1506
  children: item.description
1013
1507
  }),
1014
- footer !== undefined && footer !== null && /* @__PURE__ */ jsx8("div", {
1508
+ footer !== undefined && footer !== null && /* @__PURE__ */ jsx10("div", {
1015
1509
  className: "flex items-center justify-between gap-2",
1016
1510
  children: footer
1017
1511
  })
@@ -1045,17 +1539,17 @@ function ImageGallery({
1045
1539
  renderItemFooter,
1046
1540
  density
1047
1541
  }) {
1048
- const [announcement, setAnnouncement] = useState5("");
1049
- const [compareZoom, setCompareZoom] = useState5("fit");
1050
- const [isComparingAll, setCompareAllState] = useControlled2({
1542
+ const [announcement, setAnnouncement] = useState7("");
1543
+ const [compareZoom, setCompareZoom] = useState7("fit");
1544
+ const [isComparingAll, setCompareAllState] = useControlled3({
1051
1545
  controlled: compareAllProp,
1052
1546
  default: defaultCompareAll,
1053
1547
  name: "ImageGallery",
1054
1548
  state: "compareAll"
1055
1549
  });
1056
- const compareCenter = useRef4({ x: 0.5, y: 0.5 });
1057
- const compareViewports = useRef4(new Map);
1058
- const expectedScrollRef = useRef4(new WeakMap);
1550
+ const compareCenter = useRef6({ x: 0.5, y: 0.5 });
1551
+ const compareViewports = useRef6(new Map);
1552
+ const expectedScrollRef = useRef6(new WeakMap);
1059
1553
  const item = items[index];
1060
1554
  const count = items.length;
1061
1555
  const canCompareAll = count > 1 && (allowCompareAll ?? (compareAllProp !== undefined || onCompareAllChange !== undefined || renderItemFooter !== undefined));
@@ -1098,28 +1592,28 @@ function ImageGallery({
1098
1592
  }
1099
1593
  }
1100
1594
  if (!item)
1101
- return /* @__PURE__ */ jsx8("div", {
1595
+ return /* @__PURE__ */ jsx10("div", {
1102
1596
  "data-slot": "image-gallery",
1103
1597
  "data-density": density
1104
1598
  });
1105
1599
  if (canCompareAll && isComparingAll) {
1106
- return /* @__PURE__ */ jsxs6("div", {
1600
+ return /* @__PURE__ */ jsxs8("div", {
1107
1601
  "data-slot": "image-gallery",
1108
1602
  "data-mode": "compare-all",
1109
1603
  "data-scroll": "none",
1110
1604
  "data-density": density,
1111
1605
  className: "@container flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
1112
1606
  children: [
1113
- /* @__PURE__ */ jsxs6("div", {
1607
+ /* @__PURE__ */ jsxs8("div", {
1114
1608
  "data-slot": "image-gallery-toolbar",
1115
- className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0",
1609
+ className: "flex shrink-0 flex-wrap items-center gap-control-gap border-b border-border pb-2 *:shrink-0",
1116
1610
  children: [
1117
- /* @__PURE__ */ jsx8(ImageZoomToggle, {
1611
+ /* @__PURE__ */ jsx10(ImageZoomToggle, {
1118
1612
  zoom: compareZoom,
1119
1613
  onZoomChange: setCompareZoom,
1120
1614
  density
1121
1615
  }),
1122
- /* @__PURE__ */ jsx8(Toggle2, {
1616
+ /* @__PURE__ */ jsx10(Toggle2, {
1123
1617
  variant: "outline",
1124
1618
  size: "sm",
1125
1619
  density,
@@ -1129,10 +1623,10 @@ function ImageGallery({
1129
1623
  })
1130
1624
  ]
1131
1625
  }),
1132
- /* @__PURE__ */ jsx8("div", {
1626
+ /* @__PURE__ */ jsx10("div", {
1133
1627
  "data-slot": "image-gallery-compare-grid",
1134
- className: cn2("grid min-h-0 min-w-0 flex-1 auto-rows-max content-start grid-cols-1 gap-3 overflow-y-auto p-0.5 pb-2", count === 2 ? "@2xl:grid-cols-2" : "@xl:grid-cols-2 @3xl:grid-cols-3"),
1135
- children: items.map((entry, entryIndex) => /* @__PURE__ */ jsx8(CompareAllPane, {
1628
+ className: cn2("grid min-h-0 min-w-0 flex-1 auto-rows-max content-start grid-cols-1 gap-3 overflow-y-auto px-0.5 pt-1 pb-2", count === 2 ? "@2xl:grid-cols-2" : "@xl:grid-cols-2 @3xl:grid-cols-3"),
1629
+ children: items.map((entry, entryIndex) => /* @__PURE__ */ jsx10(CompareAllPane, {
1136
1630
  item: entry,
1137
1631
  zoom: compareZoom,
1138
1632
  center: compareCenter,
@@ -1147,7 +1641,7 @@ function ImageGallery({
1147
1641
  footer: renderItemFooter?.(entry, entryIndex)
1148
1642
  }, entry.key))
1149
1643
  }),
1150
- /* @__PURE__ */ jsx8("p", {
1644
+ /* @__PURE__ */ jsx10("p", {
1151
1645
  role: "status",
1152
1646
  "data-slot": "image-gallery-status",
1153
1647
  className: "sr-only",
@@ -1156,14 +1650,14 @@ function ImageGallery({
1156
1650
  ]
1157
1651
  });
1158
1652
  }
1159
- return /* @__PURE__ */ jsxs6("div", {
1653
+ return /* @__PURE__ */ jsxs8("div", {
1160
1654
  "data-slot": "image-gallery",
1161
1655
  "data-mode": "single",
1162
1656
  "data-scroll": "none",
1163
1657
  "data-density": density,
1164
1658
  className: "flex size-full min-h-0 min-w-0 flex-1 flex-col",
1165
1659
  children: [
1166
- /* @__PURE__ */ jsx8(ImageViewer, {
1660
+ /* @__PURE__ */ jsx10(ImageViewer, {
1167
1661
  src: item.src,
1168
1662
  alt: item.alt,
1169
1663
  label: label ?? item.label,
@@ -1175,24 +1669,24 @@ function ImageGallery({
1175
1669
  onStageKeyDown: handleStageKey,
1176
1670
  stageKeyShortcuts,
1177
1671
  density,
1178
- toolbar: /* @__PURE__ */ jsxs6(Fragment, {
1672
+ toolbar: /* @__PURE__ */ jsxs8(Fragment, {
1179
1673
  children: [
1180
- /* @__PURE__ */ jsxs6("div", {
1674
+ /* @__PURE__ */ jsxs8("div", {
1181
1675
  role: "group",
1182
1676
  "aria-label": "Images",
1183
1677
  "data-slot": "image-gallery-stepper",
1184
1678
  className: "flex items-center gap-control-gap",
1185
1679
  children: [
1186
- /* @__PURE__ */ jsx8(Button2, {
1680
+ /* @__PURE__ */ jsx10(Button2, {
1187
1681
  variant: "outline",
1188
1682
  size: "icon-sm",
1189
1683
  density,
1190
1684
  "aria-label": previousLabel,
1191
1685
  disabledReason: index === 0 ? "This is the first image" : undefined,
1192
1686
  onClick: () => step(index - 1),
1193
- children: /* @__PURE__ */ jsx8(ChevronLeftIcon, {})
1687
+ children: /* @__PURE__ */ jsx10(ChevronLeftIcon, {})
1194
1688
  }),
1195
- /* @__PURE__ */ jsxs6("span", {
1689
+ /* @__PURE__ */ jsxs8("span", {
1196
1690
  "data-slot": "image-gallery-position",
1197
1691
  className: "text-xs text-muted-foreground tabular-nums",
1198
1692
  children: [
@@ -1201,18 +1695,18 @@ function ImageGallery({
1201
1695
  count
1202
1696
  ]
1203
1697
  }),
1204
- /* @__PURE__ */ jsx8(Button2, {
1698
+ /* @__PURE__ */ jsx10(Button2, {
1205
1699
  variant: "outline",
1206
1700
  size: "icon-sm",
1207
1701
  density,
1208
1702
  "aria-label": nextLabel,
1209
1703
  disabledReason: index === count - 1 ? "This is the last image" : undefined,
1210
1704
  onClick: () => step(index + 1),
1211
- children: /* @__PURE__ */ jsx8(ChevronRightIcon, {})
1705
+ children: /* @__PURE__ */ jsx10(ChevronRightIcon, {})
1212
1706
  })
1213
1707
  ]
1214
1708
  }),
1215
- canCompareAll && /* @__PURE__ */ jsx8(Toggle2, {
1709
+ canCompareAll && /* @__PURE__ */ jsx10(Toggle2, {
1216
1710
  variant: "outline",
1217
1711
  size: "sm",
1218
1712
  density,
@@ -1224,7 +1718,7 @@ function ImageGallery({
1224
1718
  ]
1225
1719
  })
1226
1720
  }),
1227
- /* @__PURE__ */ jsx8("p", {
1721
+ /* @__PURE__ */ jsx10("p", {
1228
1722
  role: "status",
1229
1723
  "data-slot": "image-gallery-status",
1230
1724
  className: "sr-only",
@@ -1234,7 +1728,7 @@ function ImageGallery({
1234
1728
  });
1235
1729
  }
1236
1730
  // src/components/image-viewer/MediaShell.tsx
1237
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1731
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1238
1732
  function MediaShell({
1239
1733
  open,
1240
1734
  onOpenChange,
@@ -1243,26 +1737,28 @@ function MediaShell({
1243
1737
  children,
1244
1738
  density
1245
1739
  }) {
1246
- return /* @__PURE__ */ jsx9(Dialog2, {
1740
+ return /* @__PURE__ */ jsx11(Dialog2, {
1247
1741
  open,
1248
1742
  onOpenChange,
1249
- children: /* @__PURE__ */ jsxs7(DialogContent2, {
1743
+ children: /* @__PURE__ */ jsxs9(DialogContent2, {
1250
1744
  size: "fullscreen",
1251
1745
  density,
1252
1746
  "data-slot": "media-shell",
1747
+ className: "[@media(max-height:280px)]:gap-1.5 [@media(max-height:280px)]:p-2",
1253
1748
  children: [
1254
- /* @__PURE__ */ jsxs7(DialogHeader2, {
1749
+ /* @__PURE__ */ jsxs9(DialogHeader2, {
1255
1750
  children: [
1256
- /* @__PURE__ */ jsx9(DialogTitle2, {
1751
+ /* @__PURE__ */ jsx11(DialogTitle2, {
1257
1752
  className: "truncate",
1258
1753
  children: title
1259
1754
  }),
1260
- description !== undefined && /* @__PURE__ */ jsx9(DialogDescription2, {
1755
+ description !== undefined && /* @__PURE__ */ jsx11(DialogDescription2, {
1756
+ className: "[@media(max-height:280px)]:sr-only",
1261
1757
  children: description
1262
1758
  })
1263
1759
  ]
1264
1760
  }),
1265
- /* @__PURE__ */ jsx9("div", {
1761
+ /* @__PURE__ */ jsx11("div", {
1266
1762
  "data-slot": "media-shell-stage",
1267
1763
  "data-scroll": "none",
1268
1764
  className: "flex min-h-0 min-w-0 flex-1 flex-col",
@@ -1273,19 +1769,19 @@ function MediaShell({
1273
1769
  });
1274
1770
  }
1275
1771
  // src/components/image-viewer/ImageComparison.tsx
1276
- import { useControlled as useControlled3 } from "@base-ui/utils/useControlled";
1277
- import { useRef as useRef6, useState as useState7 } from "react";
1772
+ import { useControlled as useControlled4 } from "@base-ui/utils/useControlled";
1773
+ import { useRef as useRef8, useState as useState9 } from "react";
1278
1774
 
1279
1775
  // src/components/image-viewer/ImageComparisonToolbar.tsx
1280
1776
  import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2, Columns2Icon, Rows2Icon } from "lucide-react";
1281
- import { useId as useId2 } from "react";
1282
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1777
+ import { useId as useId3 } from "react";
1778
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1283
1779
  function ToolbarSection({ title, titleId, children }) {
1284
- return /* @__PURE__ */ jsxs8("div", {
1780
+ return /* @__PURE__ */ jsxs10("div", {
1285
1781
  "data-slot": "image-comparison-toolbar-section",
1286
1782
  className: "flex shrink-0 items-center",
1287
1783
  children: [
1288
- /* @__PURE__ */ jsx10("span", {
1784
+ /* @__PURE__ */ jsx12("span", {
1289
1785
  id: titleId,
1290
1786
  className: "sr-only",
1291
1787
  children: title
@@ -1338,24 +1834,24 @@ function ImageComparisonToolbar({
1338
1834
  toolbar,
1339
1835
  density
1340
1836
  }) {
1341
- const id = useId2();
1837
+ const id = useId3();
1342
1838
  const isUnavailable = differences.status === "unavailable";
1343
1839
  const regionCount = showDifferences && differences.status === "ready" ? differences.diff.regions.length : 0;
1344
1840
  const hasStepper = regionCount > 0;
1345
1841
  const releasePeek = () => onPeekChange(false);
1346
1842
  const statusText = describeDifferences(differences, showDifferences);
1347
1843
  const sizeMismatch = beforeSize && afterSize && (beforeSize.width !== afterSize.width || beforeSize.height !== afterSize.height) ? `Sizes differ: ${beforeLabel} ${formatSize(beforeSize)}, ${afterLabel} ${formatSize(afterSize)}. ` + `${beforeLabel} is fitted inside the ${afterLabel} image box.` : undefined;
1348
- return /* @__PURE__ */ jsxs8("div", {
1844
+ return /* @__PURE__ */ jsxs10("div", {
1349
1845
  role: "group",
1350
1846
  "aria-label": "Comparison controls",
1351
1847
  "data-slot": "image-comparison-toolbar",
1352
1848
  "data-density": density,
1353
1849
  className: "flex shrink-0 flex-wrap items-center gap-x-2 gap-y-2 border-b border-border py-2",
1354
1850
  children: [
1355
- /* @__PURE__ */ jsx10(ToolbarSection, {
1851
+ /* @__PURE__ */ jsx12(ToolbarSection, {
1356
1852
  title: "Mode",
1357
1853
  titleId: `${id}-mode`,
1358
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1854
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1359
1855
  "aria-labelledby": `${id}-mode`,
1360
1856
  required: true,
1361
1857
  value: [mode],
@@ -1365,25 +1861,25 @@ function ImageComparisonToolbar({
1365
1861
  spacing: 0,
1366
1862
  density,
1367
1863
  children: [
1368
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1864
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1369
1865
  value: "toggle",
1370
1866
  children: "Toggle"
1371
1867
  }),
1372
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1868
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1373
1869
  value: "swipe",
1374
1870
  children: "Swipe"
1375
1871
  }),
1376
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1872
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1377
1873
  value: "side-by-side",
1378
1874
  children: "Side by side"
1379
1875
  })
1380
1876
  ]
1381
1877
  })
1382
1878
  }),
1383
- mode === "toggle" && /* @__PURE__ */ jsx10(ToolbarSection, {
1879
+ mode === "toggle" && /* @__PURE__ */ jsx12(ToolbarSection, {
1384
1880
  title: "Shown image",
1385
1881
  titleId: `${id}-side`,
1386
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1882
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1387
1883
  "aria-labelledby": `${id}-side`,
1388
1884
  "aria-keyshortcuts": "B A",
1389
1885
  required: true,
@@ -1394,21 +1890,21 @@ function ImageComparisonToolbar({
1394
1890
  spacing: 0,
1395
1891
  density,
1396
1892
  children: [
1397
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1893
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1398
1894
  value: "before",
1399
1895
  children: beforeLabel
1400
1896
  }),
1401
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1897
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1402
1898
  value: "after",
1403
1899
  children: afterLabel
1404
1900
  })
1405
1901
  ]
1406
1902
  })
1407
1903
  }),
1408
- mode === "side-by-side" && /* @__PURE__ */ jsx10(ToolbarSection, {
1904
+ mode === "side-by-side" && /* @__PURE__ */ jsx12(ToolbarSection, {
1409
1905
  title: "Orientation",
1410
1906
  titleId: `${id}-orientation`,
1411
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1907
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1412
1908
  "aria-labelledby": `${id}-orientation`,
1413
1909
  required: true,
1414
1910
  value: [orientation],
@@ -1418,19 +1914,19 @@ function ImageComparisonToolbar({
1418
1914
  spacing: 0,
1419
1915
  density,
1420
1916
  children: [
1421
- /* @__PURE__ */ jsxs8(ToggleGroupItem2, {
1917
+ /* @__PURE__ */ jsxs10(ToggleGroupItem2, {
1422
1918
  value: "horizontal",
1423
1919
  children: [
1424
- /* @__PURE__ */ jsx10(Columns2Icon, {
1920
+ /* @__PURE__ */ jsx12(Columns2Icon, {
1425
1921
  "data-icon": "inline-start"
1426
1922
  }),
1427
1923
  "Horizontal"
1428
1924
  ]
1429
1925
  }),
1430
- /* @__PURE__ */ jsxs8(ToggleGroupItem2, {
1926
+ /* @__PURE__ */ jsxs10(ToggleGroupItem2, {
1431
1927
  value: "vertical",
1432
1928
  children: [
1433
- /* @__PURE__ */ jsx10(Rows2Icon, {
1929
+ /* @__PURE__ */ jsx12(Rows2Icon, {
1434
1930
  "data-icon": "inline-start"
1435
1931
  }),
1436
1932
  "Vertical"
@@ -1439,16 +1935,16 @@ function ImageComparisonToolbar({
1439
1935
  ]
1440
1936
  })
1441
1937
  }),
1442
- /* @__PURE__ */ jsx10(ToolbarSection, {
1938
+ /* @__PURE__ */ jsx12(ToolbarSection, {
1443
1939
  title: "Zoom",
1444
1940
  titleId: `${id}-zoom`,
1445
- children: /* @__PURE__ */ jsx10(ImageZoomToggle, {
1941
+ children: /* @__PURE__ */ jsx12(ImageZoomToggle, {
1446
1942
  zoom,
1447
1943
  onZoomChange,
1448
1944
  density
1449
1945
  })
1450
1946
  }),
1451
- mode === "toggle" && /* @__PURE__ */ jsx10(Button2, {
1947
+ mode === "toggle" && /* @__PURE__ */ jsx12(Button2, {
1452
1948
  variant: "outline",
1453
1949
  size: "sm",
1454
1950
  density,
@@ -1472,49 +1968,49 @@ function ImageComparisonToolbar({
1472
1968
  onContextMenu: (event) => event.preventDefault(),
1473
1969
  children: `Hold to show ${side === "before" ? "after" : "before"}`
1474
1970
  }),
1475
- /* @__PURE__ */ jsxs8("div", {
1971
+ /* @__PURE__ */ jsxs10("div", {
1476
1972
  className: "flex min-w-0 flex-wrap items-center gap-2",
1477
1973
  children: [
1478
- /* @__PURE__ */ jsxs8("div", {
1974
+ /* @__PURE__ */ jsxs10("div", {
1479
1975
  className: "flex items-center gap-1.5",
1480
1976
  children: [
1481
- /* @__PURE__ */ jsx10(Switch2, {
1977
+ /* @__PURE__ */ jsx12(Switch2, {
1482
1978
  id: `${id}-differences`,
1483
1979
  "aria-describedby": `${id}-differences-status`,
1484
1980
  checked: showDifferences && !isUnavailable,
1485
1981
  disabled: isUnavailable,
1486
1982
  onCheckedChange: onShowDifferencesChange
1487
1983
  }),
1488
- /* @__PURE__ */ jsx10("label", {
1984
+ /* @__PURE__ */ jsx12("label", {
1489
1985
  htmlFor: `${id}-differences`,
1490
1986
  className: "cursor-pointer text-sm leading-none font-medium whitespace-nowrap select-none",
1491
1987
  children: "Highlight differences"
1492
1988
  })
1493
1989
  ]
1494
1990
  }),
1495
- showDifferences && differences.status === "ready" && /* @__PURE__ */ jsxs8("span", {
1991
+ showDifferences && differences.status === "ready" && /* @__PURE__ */ jsxs10("span", {
1496
1992
  "data-slot": "image-comparison-legend",
1497
1993
  className: "flex items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground",
1498
1994
  children: [
1499
- /* @__PURE__ */ jsx10("span", {
1995
+ /* @__PURE__ */ jsx12("span", {
1500
1996
  "aria-hidden": "true",
1501
1997
  className: "mx-[3px] size-2.5 shrink-0 rounded-xs bg-warning/10 ring-1 ring-background outline-2 outline-offset-1 outline-warning"
1502
1998
  }),
1503
1999
  "Changed region"
1504
2000
  ]
1505
2001
  }),
1506
- hasStepper && /* @__PURE__ */ jsxs8("div", {
2002
+ hasStepper && /* @__PURE__ */ jsxs10("div", {
1507
2003
  role: "group",
1508
2004
  "aria-label": "Changed regions",
1509
2005
  "data-slot": "image-comparison-stepper",
1510
2006
  className: "flex flex-wrap items-center gap-1.5",
1511
2007
  children: [
1512
- /* @__PURE__ */ jsx10("span", {
2008
+ /* @__PURE__ */ jsx12("span", {
1513
2009
  "aria-hidden": "true",
1514
2010
  className: "text-muted-foreground",
1515
2011
  children: "·"
1516
2012
  }),
1517
- /* @__PURE__ */ jsxs8("span", {
2013
+ /* @__PURE__ */ jsxs10("span", {
1518
2014
  "data-slot": "image-comparison-change-count",
1519
2015
  className: "text-xs whitespace-nowrap text-muted-foreground tabular-nums",
1520
2016
  children: [
@@ -1524,35 +2020,35 @@ function ImageComparisonToolbar({
1524
2020
  regionCount
1525
2021
  ]
1526
2022
  }),
1527
- /* @__PURE__ */ jsx10(Button2, {
2023
+ /* @__PURE__ */ jsx12(Button2, {
1528
2024
  variant: "outline",
1529
2025
  size: "icon-sm",
1530
2026
  density,
1531
2027
  "aria-label": "Previous change",
1532
2028
  "aria-keyshortcuts": "Shift+N",
1533
2029
  onClick: () => onStepChange(-1),
1534
- children: /* @__PURE__ */ jsx10(ChevronLeftIcon2, {})
2030
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
1535
2031
  }),
1536
- /* @__PURE__ */ jsx10(Button2, {
2032
+ /* @__PURE__ */ jsx12(Button2, {
1537
2033
  variant: "outline",
1538
2034
  size: "icon-sm",
1539
2035
  density,
1540
2036
  "aria-label": "Next change",
1541
2037
  "aria-keyshortcuts": "N",
1542
2038
  onClick: () => onStepChange(1),
1543
- children: /* @__PURE__ */ jsx10(ChevronRightIcon2, {})
2039
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
1544
2040
  }),
1545
- onCommentActiveDifference && /* @__PURE__ */ jsx10(Button2, {
2041
+ onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
1546
2042
  variant: "outline",
1547
2043
  size: "sm",
1548
2044
  density,
1549
2045
  "aria-label": `Comment on change ${activeRegionIndex + 1} of ${regionCount}`,
1550
2046
  onClick: onCommentActiveDifference,
1551
- children: "Comment"
2047
+ children: "Comment on change"
1552
2048
  })
1553
2049
  ]
1554
2050
  }),
1555
- /* @__PURE__ */ jsx10("p", {
2051
+ /* @__PURE__ */ jsx12("p", {
1556
2052
  id: `${id}-differences-status`,
1557
2053
  role: "status",
1558
2054
  className: hasStepper || !statusText ? "sr-only" : "text-xs text-muted-foreground",
@@ -1560,8 +2056,12 @@ function ImageComparisonToolbar({
1560
2056
  })
1561
2057
  ]
1562
2058
  }),
1563
- toolbar,
1564
- sizeMismatch && /* @__PURE__ */ jsx10("p", {
2059
+ toolbar && /* @__PURE__ */ jsx12("div", {
2060
+ "data-slot": "image-comparison-toolbar-extra",
2061
+ className: "flex min-w-0 flex-wrap items-center gap-2 @2xl:border-s @2xl:border-border @2xl:ps-2",
2062
+ children: toolbar
2063
+ }),
2064
+ sizeMismatch && /* @__PURE__ */ jsx12("p", {
1565
2065
  "data-slot": "image-comparison-size-mismatch",
1566
2066
  className: "w-full text-xs text-muted-foreground",
1567
2067
  children: sizeMismatch
@@ -1571,16 +2071,16 @@ function ImageComparisonToolbar({
1571
2071
  }
1572
2072
 
1573
2073
  // src/components/image-viewer/ImageDifferenceOverlay.tsx
1574
- import { jsx as jsx11 } from "react/jsx-runtime";
2074
+ import { jsx as jsx13 } from "react/jsx-runtime";
1575
2075
  function toPercent2(value, total) {
1576
2076
  return `${value / total * 100}%`;
1577
2077
  }
1578
2078
  function ImageDifferenceOverlay({ diff, activeIndex }) {
1579
- return /* @__PURE__ */ jsx11("div", {
2079
+ return /* @__PURE__ */ jsx13("div", {
1580
2080
  "data-slot": "image-difference-overlay",
1581
2081
  "aria-hidden": "true",
1582
2082
  className: "pointer-events-none absolute inset-0",
1583
- children: diff.regions.map((region, index) => /* @__PURE__ */ jsx11(ImageRegionMarker, {
2083
+ children: diff.regions.map((region, index) => /* @__PURE__ */ jsx13(ImageRegionMarker, {
1584
2084
  "data-slot": "image-difference-region",
1585
2085
  variant: "difference",
1586
2086
  active: index === activeIndex,
@@ -1598,16 +2098,16 @@ function ImageDifferenceOverlay({ diff, activeIndex }) {
1598
2098
  import { DirectionProvider } from "@base-ui/react/direction-provider";
1599
2099
  import { Slider as SliderPrimitive } from "@base-ui/react/slider";
1600
2100
  import { ChevronsLeftRightIcon } from "lucide-react";
1601
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2101
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
1602
2102
  function ImageSwipeDivider({
1603
2103
  value,
1604
2104
  onValueChange,
1605
2105
  beforeLabel,
1606
2106
  afterLabel
1607
2107
  }) {
1608
- return /* @__PURE__ */ jsx12(DirectionProvider, {
2108
+ return /* @__PURE__ */ jsx14(DirectionProvider, {
1609
2109
  direction: "ltr",
1610
- children: /* @__PURE__ */ jsx12(SliderPrimitive.Root, {
2110
+ children: /* @__PURE__ */ jsx14(SliderPrimitive.Root, {
1611
2111
  dir: "ltr",
1612
2112
  "data-slot": "image-swipe-divider",
1613
2113
  value,
@@ -1617,22 +2117,22 @@ function ImageSwipeDivider({
1617
2117
  step: 1,
1618
2118
  largeStep: 10,
1619
2119
  className: "pointer-events-none absolute inset-0",
1620
- children: /* @__PURE__ */ jsx12(SliderPrimitive.Control, {
2120
+ children: /* @__PURE__ */ jsx14(SliderPrimitive.Control, {
1621
2121
  className: "pointer-events-none absolute inset-0",
1622
- children: /* @__PURE__ */ jsxs9(SliderPrimitive.Thumb, {
2122
+ children: /* @__PURE__ */ jsxs11(SliderPrimitive.Thumb, {
1623
2123
  "data-slot": "image-swipe-divider-handle",
1624
2124
  getAriaLabel: () => "Swipe divider",
1625
2125
  getAriaValueText: (_formatted, current) => `${beforeLabel} ${current}%, ${afterLabel} ${100 - current}%`,
1626
2126
  className: "group/divider pointer-events-auto flex h-full w-6 cursor-ew-resize touch-none flex-col items-center justify-center select-none",
1627
2127
  children: [
1628
- /* @__PURE__ */ jsx12("span", {
2128
+ /* @__PURE__ */ jsx14("span", {
1629
2129
  "aria-hidden": "true",
1630
2130
  className: "absolute inset-y-0 start-1/2 w-0.5 -translate-x-1/2 bg-foreground ring-1 ring-background"
1631
2131
  }),
1632
- /* @__PURE__ */ jsx12("span", {
2132
+ /* @__PURE__ */ jsx14("span", {
1633
2133
  "aria-hidden": "true",
1634
2134
  className: "relative flex h-8 w-5 items-center justify-center rounded-sm border border-border bg-background text-foreground shadow-frame group-has-[:focus-visible]/divider:border-ring group-has-[:focus-visible]/divider:ring-1 group-has-[:focus-visible]/divider:ring-ring group-data-dragging/divider:border-ring",
1635
- children: /* @__PURE__ */ jsx12(ChevronsLeftRightIcon, {
2135
+ children: /* @__PURE__ */ jsx14(ChevronsLeftRightIcon, {
1636
2136
  className: "size-3.5"
1637
2137
  })
1638
2138
  })
@@ -1644,7 +2144,7 @@ function ImageSwipeDivider({
1644
2144
  }
1645
2145
 
1646
2146
  // src/components/image-viewer/hooks/useImageDifferences.ts
1647
- import { useEffect as useEffect2, useRef as useRef5, useState as useState6 } from "react";
2147
+ import { useEffect as useEffect3, useRef as useRef7, useState as useState8 } from "react";
1648
2148
 
1649
2149
  // src/components/image-viewer/computeImageDiff.ts
1650
2150
  var DEFAULT_THRESHOLD = 32;
@@ -1857,11 +2357,11 @@ function useImageDifferences({
1857
2357
  beforeRef,
1858
2358
  afterRef
1859
2359
  }) {
1860
- const [entries, setEntries] = useState6(() => new Map);
1861
- const startedRef = useRef5(new Set);
1862
- const controllerRef = useRef5(undefined);
1863
- useEffect2(() => () => controllerRef.current?.abort(), [pairKey]);
1864
- useEffect2(() => {
2360
+ const [entries, setEntries] = useState8(() => new Map);
2361
+ const startedRef = useRef7(new Set);
2362
+ const controllerRef = useRef7(undefined);
2363
+ useEffect3(() => () => controllerRef.current?.abort(), [pairKey]);
2364
+ useEffect3(() => {
1865
2365
  const before = beforeRef.current;
1866
2366
  const after = afterRef.current;
1867
2367
  if (!loaded || !before || !after)
@@ -1876,7 +2376,7 @@ function useImageDifferences({
1876
2376
  isCurrent = false;
1877
2377
  };
1878
2378
  }, [afterRef, beforeRef, loaded, pairKey]);
1879
- useEffect2(() => {
2379
+ useEffect3(() => {
1880
2380
  const before = beforeRef.current;
1881
2381
  const after = afterRef.current;
1882
2382
  if (!enabled || !loaded || !before || !after || startedRef.current.has(pairKey))
@@ -1898,16 +2398,16 @@ function useImageDifferences({
1898
2398
  }
1899
2399
 
1900
2400
  // src/components/image-viewer/ImageComparison.tsx
1901
- import { jsx as jsx13, jsxs as jsxs10, Fragment as Fragment2 } from "react/jsx-runtime";
2401
+ import { jsx as jsx15, jsxs as jsxs12, Fragment as Fragment2 } from "react/jsx-runtime";
1902
2402
  function ComparisonPane({ header, children }) {
1903
- return /* @__PURE__ */ jsxs10("div", {
2403
+ return /* @__PURE__ */ jsxs12("div", {
1904
2404
  "data-slot": "image-comparison-pane",
1905
2405
  "data-scroll": "none",
1906
2406
  className: "flex min-h-0 min-w-0 flex-1 flex-col",
1907
2407
  children: [
1908
- /* @__PURE__ */ jsx13("div", {
2408
+ /* @__PURE__ */ jsx15("div", {
1909
2409
  "data-slot": "image-comparison-pane-header",
1910
- className: "flex h-control shrink-0 items-center justify-between gap-2 px-control-x text-xs font-medium text-muted-foreground",
2410
+ className: "flex h-control shrink-0 items-center justify-between gap-2 text-xs font-medium text-muted-foreground",
1911
2411
  children: header
1912
2412
  }),
1913
2413
  children
@@ -1952,31 +2452,31 @@ function ImageComparison({
1952
2452
  label = "Image comparison",
1953
2453
  density
1954
2454
  }) {
1955
- const [mode, setModeState] = useControlled3({
2455
+ const [mode, setModeState] = useControlled4({
1956
2456
  controlled: modeProp,
1957
2457
  default: defaultMode,
1958
2458
  name: "ImageComparison",
1959
2459
  state: "mode"
1960
2460
  });
1961
- const [side, setSideState] = useControlled3({
2461
+ const [side, setSideState] = useControlled4({
1962
2462
  controlled: sideProp,
1963
2463
  default: defaultSide,
1964
2464
  name: "ImageComparison",
1965
2465
  state: "side"
1966
2466
  });
1967
- const [chosenOrientation, setOrientationState] = useControlled3({
2467
+ const [chosenOrientation, setOrientationState] = useControlled4({
1968
2468
  controlled: orientationProp,
1969
2469
  default: defaultOrientation,
1970
2470
  name: "ImageComparison",
1971
2471
  state: "orientation"
1972
2472
  });
1973
- const [zoom, setZoomState] = useControlled3({
2473
+ const [zoom, setZoomState] = useControlled4({
1974
2474
  controlled: zoomProp,
1975
2475
  default: defaultZoom,
1976
2476
  name: "ImageComparison",
1977
2477
  state: "zoom"
1978
2478
  });
1979
- const [showDifferences, setShowDifferencesState] = useControlled3({
2479
+ const [showDifferences, setShowDifferencesState] = useControlled4({
1980
2480
  controlled: showDifferencesProp,
1981
2481
  default: defaultShowDifferences,
1982
2482
  name: "ImageComparison",
@@ -1984,12 +2484,12 @@ function ImageComparison({
1984
2484
  });
1985
2485
  const pairKey = `${before.src}
1986
2486
  ${after.src}`;
1987
- const [isPeeking, setIsPeeking] = useState7(false);
1988
- const [position, setPosition] = useState7(50);
1989
- const [activeRegionIndex, setActiveRegionIndex] = useState7(0);
1990
- const [changeAnnouncement, setChangeAnnouncement] = useState7("");
1991
- const [lastPairKey, setLastPairKey] = useState7(pairKey);
1992
- const [lastShowDifferences, setLastShowDifferences] = useState7(showDifferences);
2487
+ const [isPeeking, setIsPeeking] = useState9(false);
2488
+ const [position, setPosition] = useState9(50);
2489
+ const [activeRegionIndex, setActiveRegionIndex] = useState9(0);
2490
+ const [changeAnnouncement, setChangeAnnouncement] = useState9("");
2491
+ const [lastPairKey, setLastPairKey] = useState9(pairKey);
2492
+ const [lastShowDifferences, setLastShowDifferences] = useState9(showDifferences);
1993
2493
  if (lastPairKey !== pairKey || lastShowDifferences !== showDifferences) {
1994
2494
  setLastPairKey(pairKey);
1995
2495
  setLastShowDifferences(showDifferences);
@@ -1998,14 +2498,14 @@ ${after.src}`;
1998
2498
  }
1999
2499
  const [beforeImage, beforeHandlers] = useImageLoad(before.src);
2000
2500
  const [afterImage, afterHandlers] = useImageLoad(after.src);
2001
- const beforeRef = useRef6(null);
2002
- const afterRef = useRef6(null);
2003
- const stageRef = useRef6(null);
2004
- const singleViewportRef = useRef6(null);
2005
- const beforeViewportRef = useRef6(null);
2006
- const afterViewportRef = useRef6(null);
2007
- const expectedScrollRef = useRef6(new WeakMap);
2008
- const center = useRef6({ x: 0.5, y: 0.5 });
2501
+ const beforeRef = useRef8(null);
2502
+ const afterRef = useRef8(null);
2503
+ const stageRef = useRef8(null);
2504
+ const singleViewportRef = useRef8(null);
2505
+ const beforeViewportRef = useRef8(null);
2506
+ const afterViewportRef = useRef8(null);
2507
+ const expectedScrollRef = useRef8(new WeakMap);
2508
+ const center = useRef8({ x: 0.5, y: 0.5 });
2009
2509
  const stageSize = useElementSize(stageRef);
2010
2510
  const autoOrientation = stageSize && stageSize.height > stageSize.width ? "vertical" : "horizontal";
2011
2511
  const orientation = chosenOrientation ?? autoOrientation;
@@ -2022,13 +2522,13 @@ ${after.src}`;
2022
2522
  const clampedActiveIndex = regions.length > 0 ? Math.min(activeRegionIndex, regions.length - 1) : 0;
2023
2523
  const shownSide = mode !== "toggle" ? "after" : isPeeking ? side === "before" ? "after" : "before" : side;
2024
2524
  const isShowingBefore = shownSide === "before";
2025
- const diffOverlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx13(ImageDifferenceOverlay, {
2525
+ const diffOverlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx15(ImageDifferenceOverlay, {
2026
2526
  diff: differences.diff,
2027
2527
  activeIndex: clampedActiveIndex
2028
2528
  }) : null;
2029
2529
  const activeRegion = regions[clampedActiveIndex];
2030
2530
  const handleCommentActiveDifference = onCommentDifference && showDifferences && differences.status === "ready" && activeRegion ? () => onCommentDifference(activeRegion, clampedActiveIndex, differences.diff) : undefined;
2031
- const fallback = failedLabel ? /* @__PURE__ */ jsxs10("p", {
2531
+ const fallback = failedLabel ? /* @__PURE__ */ jsxs12("p", {
2032
2532
  "data-slot": "image-comparison-error",
2033
2533
  className: "m-auto p-panel text-center text-sm text-muted-foreground",
2034
2534
  children: [
@@ -2131,7 +2631,7 @@ ${after.src}`;
2131
2631
  }
2132
2632
  }
2133
2633
  function renderAfterImage(className) {
2134
- return /* @__PURE__ */ jsx13("img", {
2634
+ return /* @__PURE__ */ jsx15("img", {
2135
2635
  ref: afterRef,
2136
2636
  src: after.src,
2137
2637
  alt: after.alt,
@@ -2144,7 +2644,7 @@ ${after.src}`;
2144
2644
  });
2145
2645
  }
2146
2646
  function renderBeforeImage(className, style) {
2147
- return /* @__PURE__ */ jsx13("img", {
2647
+ return /* @__PURE__ */ jsx15("img", {
2148
2648
  ref: beforeRef,
2149
2649
  src: before.src,
2150
2650
  alt: before.alt,
@@ -2161,15 +2661,15 @@ ${after.src}`;
2161
2661
  const toggleStageKeys = ["B A", sharedStageKeys].filter(Boolean).join(" ");
2162
2662
  let content;
2163
2663
  if (mode === "side-by-side") {
2164
- content = /* @__PURE__ */ jsxs10("div", {
2664
+ content = /* @__PURE__ */ jsxs12("div", {
2165
2665
  "data-slot": "image-comparison-panes",
2166
- className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col" : "flex-row"),
2666
+ className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col gap-2" : "flex-row gap-3"),
2167
2667
  children: [
2168
- /* @__PURE__ */ jsx13(ComparisonPane, {
2169
- header: /* @__PURE__ */ jsx13("span", {
2668
+ /* @__PURE__ */ jsx15(ComparisonPane, {
2669
+ header: /* @__PURE__ */ jsx15("span", {
2170
2670
  children: beforeLabel
2171
2671
  }),
2172
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2672
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2173
2673
  label: beforeLabel,
2174
2674
  zoom,
2175
2675
  naturalSize: afterImage.size,
@@ -2187,14 +2687,14 @@ ${after.src}`;
2187
2687
  ]
2188
2688
  })
2189
2689
  }),
2190
- /* @__PURE__ */ jsx13(Separator2, {
2690
+ /* @__PURE__ */ jsx15(Separator2, {
2191
2691
  orientation: orientation === "vertical" ? "horizontal" : "vertical"
2192
2692
  }),
2193
- /* @__PURE__ */ jsx13(ComparisonPane, {
2194
- header: /* @__PURE__ */ jsx13("span", {
2693
+ /* @__PURE__ */ jsx15(ComparisonPane, {
2694
+ header: /* @__PURE__ */ jsx15("span", {
2195
2695
  children: afterLabel
2196
2696
  }),
2197
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2697
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2198
2698
  label: afterLabel,
2199
2699
  zoom,
2200
2700
  naturalSize: afterImage.size,
@@ -2215,18 +2715,18 @@ ${after.src}`;
2215
2715
  ]
2216
2716
  });
2217
2717
  } else if (mode === "swipe") {
2218
- content = /* @__PURE__ */ jsx13(ComparisonPane, {
2219
- header: /* @__PURE__ */ jsxs10(Fragment2, {
2718
+ content = /* @__PURE__ */ jsx15(ComparisonPane, {
2719
+ header: /* @__PURE__ */ jsxs12(Fragment2, {
2220
2720
  children: [
2221
- /* @__PURE__ */ jsx13("span", {
2721
+ /* @__PURE__ */ jsx15("span", {
2222
2722
  children: beforeLabel
2223
2723
  }),
2224
- /* @__PURE__ */ jsx13("span", {
2724
+ /* @__PURE__ */ jsx15("span", {
2225
2725
  children: afterLabel
2226
2726
  })
2227
2727
  ]
2228
2728
  }),
2229
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2729
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2230
2730
  label: `${beforeLabel} and ${afterLabel}`,
2231
2731
  zoom,
2232
2732
  naturalSize: afterImage.size,
@@ -2242,7 +2742,7 @@ ${after.src}`;
2242
2742
  beforeOverlay,
2243
2743
  afterOverlay,
2244
2744
  diffOverlay,
2245
- /* @__PURE__ */ jsx13(ImageSwipeDivider, {
2745
+ /* @__PURE__ */ jsx15(ImageSwipeDivider, {
2246
2746
  value: position,
2247
2747
  onValueChange: handlePositionChange,
2248
2748
  beforeLabel,
@@ -2254,8 +2754,8 @@ ${after.src}`;
2254
2754
  });
2255
2755
  } else {
2256
2756
  const showingLabel = isShowingBefore ? beforeLabel : afterLabel;
2257
- content = /* @__PURE__ */ jsx13(ComparisonPane, {
2258
- header: /* @__PURE__ */ jsxs10("span", {
2757
+ content = /* @__PURE__ */ jsx15(ComparisonPane, {
2758
+ header: /* @__PURE__ */ jsxs12("span", {
2259
2759
  "data-slot": "image-comparison-showing",
2260
2760
  "aria-live": "polite",
2261
2761
  children: [
@@ -2263,7 +2763,7 @@ ${after.src}`;
2263
2763
  showingLabel
2264
2764
  ]
2265
2765
  }),
2266
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2766
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2267
2767
  label: showingLabel,
2268
2768
  zoom,
2269
2769
  naturalSize: afterImage.size,
@@ -2284,7 +2784,7 @@ ${after.src}`;
2284
2784
  })
2285
2785
  });
2286
2786
  }
2287
- return /* @__PURE__ */ jsxs10("div", {
2787
+ return /* @__PURE__ */ jsxs12("div", {
2288
2788
  role: "group",
2289
2789
  "aria-label": label,
2290
2790
  "data-slot": "image-comparison",
@@ -2296,7 +2796,7 @@ ${after.src}`;
2296
2796
  "data-showing": isShowingBefore ? "before" : "after",
2297
2797
  className: "@container flex size-full min-h-0 min-w-0 flex-1 flex-col",
2298
2798
  children: [
2299
- showToolbar && /* @__PURE__ */ jsx13(ImageComparisonToolbar, {
2799
+ showToolbar && /* @__PURE__ */ jsx15(ImageComparisonToolbar, {
2300
2800
  mode,
2301
2801
  onModeChange: setMode,
2302
2802
  side,
@@ -2319,14 +2819,14 @@ ${after.src}`;
2319
2819
  toolbar,
2320
2820
  density
2321
2821
  }),
2322
- /* @__PURE__ */ jsx13("div", {
2822
+ /* @__PURE__ */ jsx15("div", {
2323
2823
  ref: stageRef,
2324
2824
  "data-slot": "image-comparison-stage",
2325
2825
  "data-scroll": "none",
2326
2826
  className: "flex min-h-0 min-w-0 flex-1",
2327
2827
  children: content
2328
2828
  }),
2329
- /* @__PURE__ */ jsx13("p", {
2829
+ /* @__PURE__ */ jsx15("p", {
2330
2830
  role: "status",
2331
2831
  "data-slot": "image-comparison-change-announcement",
2332
2832
  className: "sr-only",
@@ -2336,6 +2836,8 @@ ${after.src}`;
2336
2836
  });
2337
2837
  }
2338
2838
  export {
2839
+ DiagramSurface,
2840
+ DiagramViewer,
2339
2841
  FramedImage2 as FramedImage,
2340
2842
  IMAGE_REGION_STEP,
2341
2843
  IMAGE_ZOOM_STEPS,
@@ -2356,12 +2858,17 @@ export {
2356
2858
  computeImageDiff,
2357
2859
  formatImageRegion,
2358
2860
  formatImageZoom,
2861
+ getDiagramSvgSize,
2359
2862
  getImageRegionFromCorners,
2360
2863
  getImageZoomScales,
2864
+ getMermaidThemeConfig,
2361
2865
  getNextImageZoom,
2362
2866
  getNormalizedImagePoint,
2363
2867
  getOpeningImageZoom,
2364
2868
  getPreviousImageZoom,
2365
2869
  placeImageRegion,
2366
- resolveImageZoomScale
2870
+ prepareDiagramSvg,
2871
+ resolveCssColorToHex,
2872
+ resolveImageZoomScale,
2873
+ useMermaidTheme
2367
2874
  };