@alexgorbatchev/shadcn 0.0.161 → 0.0.163

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 (32) hide show
  1. package/dist/{chunk-1j2hz3w9.js → chunk-3kb1gkke.js} +5 -7
  2. package/dist/{chunk-zh1vby37.js → chunk-aw5f97jz.js} +1 -1
  3. package/dist/{chunk-dv0rz8r9.js → chunk-cjfd69vt.js} +2 -2
  4. package/dist/{chunk-g2amqz9q.js → chunk-crvagbjs.js} +1 -1
  5. package/dist/chunk-dpedhp0c.js +5 -0
  6. package/dist/{chunk-ajnmzqsv.js → chunk-jkjq1jkd.js} +1 -1
  7. package/dist/{chunk-fnfaa0zx.js → chunk-nx931ac3.js} +1 -1
  8. package/dist/{chunk-j0sw6cn8.js → chunk-rghpa4yc.js} +1 -1
  9. package/dist/{chunk-wvap51y9.js → chunk-vvt6y9j4.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/ImageComparison.d.ts +3 -1
  20. package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +5 -2
  21. package/dist/components/image-viewer/hooks/useMermaidTheme.d.ts +11 -0
  22. package/dist/components/image-viewer/index.d.ts +10 -0
  23. package/dist/components/image-viewer/index.js +780 -250
  24. package/dist/components/image-viewer/mermaidTheme.d.ts +58 -0
  25. package/dist/components/image-viewer/prepareDiagramSvg.d.ts +21 -0
  26. package/dist/components/json-render/index.js +4 -3
  27. package/dist/components/sonner/index.js +2 -1
  28. package/dist/index.js +4 -3
  29. package/dist/prototype.js +1 -1
  30. package/llms/components/data-display/DiagramViewer.md +66 -0
  31. package/llms.txt +1 -0
  32. 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-cjfd69vt.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/75 dark:via-black/30 dark:shadow-[inset_8px_0_12px_-8px_rgba(255,255,255,0.28)]"
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/75 dark:via-black/30 dark:shadow-[inset_-8px_0_12px_-8px_rgba(255,255,255,0.28)]"
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/75 dark:via-black/30 dark:shadow-[inset_0_8px_12px_-8px_rgba(255,255,255,0.28)]"
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/75 dark:via-black/30 dark:shadow-[inset_0_-8px_12px_-8px_rgba(255,255,255,0.28)]"
428
431
  })
429
432
  ]
430
433
  });
@@ -633,8 +636,505 @@ 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
+ if (size.width > 0) {
792
+ imported.setAttribute("width", String(size.width));
793
+ imported.style.width = "100%";
794
+ imported.style.maxWidth = `${size.width}px`;
795
+ } else {
796
+ imported.style.maxWidth = "100%";
797
+ }
798
+ imported.style.height = "auto";
799
+ imported.style.marginInline = "auto";
800
+ }
801
+ return imported;
802
+ }
803
+
804
+ // src/components/image-viewer/DiagramSurface.tsx
637
805
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
806
+ function assignRef(ref, value) {
807
+ if (!ref)
808
+ return;
809
+ if (typeof ref === "function")
810
+ ref(value);
811
+ else
812
+ ref.current = value;
813
+ }
814
+ function DiagramSurface({
815
+ svg,
816
+ label,
817
+ labelledBy,
818
+ describedBy,
819
+ description,
820
+ fit = "inline",
821
+ svgRef
822
+ }) {
823
+ const hostRef = useRef3(null);
824
+ const rawId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
825
+ const descriptionId = `diagram-desc-${rawId}`;
826
+ const effectiveDescribedBy = describedBy ?? (description?.trim() ? descriptionId : undefined);
827
+ useIsoLayoutEffect3(() => {
828
+ const host = hostRef.current;
829
+ if (!host)
830
+ return;
831
+ const element = prepareDiagramSvg(svg, host.ownerDocument, {
832
+ idPrefix: `diagram-${rawId}`,
833
+ label,
834
+ labelledBy,
835
+ describedBy: effectiveDescribedBy,
836
+ fit
837
+ });
838
+ host.replaceChildren(element);
839
+ assignRef(svgRef, element);
840
+ return () => {
841
+ assignRef(svgRef, null);
842
+ host.replaceChildren();
843
+ };
844
+ }, [svg, rawId, label, labelledBy, effectiveDescribedBy, fit, svgRef]);
845
+ return /* @__PURE__ */ jsxs4("div", {
846
+ "data-slot": "diagram-surface",
847
+ "data-fit": fit,
848
+ className: cn2("bg-card text-card-foreground", fit === "fill" ? "size-full" : "overflow-x-auto p-panel-sm"),
849
+ children: [
850
+ /* @__PURE__ */ jsx4("div", {
851
+ ref: hostRef,
852
+ className: fit === "fill" ? "size-full" : undefined
853
+ }),
854
+ !describedBy && description?.trim() ? /* @__PURE__ */ jsx4("span", {
855
+ id: descriptionId,
856
+ className: "sr-only",
857
+ children: description.trim()
858
+ }) : null
859
+ ]
860
+ });
861
+ }
862
+ // src/components/image-viewer/DiagramViewer.tsx
863
+ import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
864
+ import { useIsoLayoutEffect as useIsoLayoutEffect4 } from "@base-ui/utils/useIsoLayoutEffect";
865
+ import { useMergedRefs as useMergedRefs3 } from "@base-ui/utils/useMergedRefs";
866
+ import { useMemo, useRef as useRef4, useState as useState4 } from "react";
867
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
868
+ function DiagramViewer({
869
+ svg,
870
+ label,
871
+ description,
872
+ naturalSize: naturalSizeProp,
873
+ zoom: zoomProp,
874
+ defaultZoom,
875
+ onZoomChange,
876
+ openingWidth,
877
+ showZoomControl = false,
878
+ toolbar,
879
+ stageRef,
880
+ onStageKeyDown,
881
+ stageKeyShortcuts,
882
+ density
883
+ }) {
884
+ const [zoom, setZoomState] = useControlled2({
885
+ controlled: zoomProp,
886
+ default: defaultZoom,
887
+ name: "DiagramViewer",
888
+ state: "zoom"
889
+ });
890
+ const center = useRef4({ x: 0.5, y: 0.5 });
891
+ const viewportRef = useRef4(null);
892
+ const mergedStageRef = useMergedRefs3(viewportRef, stageRef);
893
+ const viewportSize = useElementSize(viewportRef);
894
+ const parsedSize = useMemo(() => getDiagramSvgSize(svg), [svg]);
895
+ const naturalSize = naturalSizeProp ?? parsedSize;
896
+ const [openingZoom, setOpeningZoom] = useState4();
897
+ const scales = naturalSize && viewportSize ? getImageZoomScales(naturalSize, viewportSize) : undefined;
898
+ useIsoLayoutEffect4(() => {
899
+ if (zoom !== undefined || openingZoom !== undefined || !naturalSize || !viewportSize)
900
+ return;
901
+ const opening = getOpeningImageZoom(naturalSize, viewportSize, openingWidth);
902
+ const stageHeight = naturalSize.height * resolveImageZoomScale(opening, getImageZoomScales(naturalSize, viewportSize));
903
+ if (stageHeight > viewportSize.height)
904
+ center.current = { x: 0.5, y: viewportSize.height / 2 / stageHeight };
905
+ setOpeningZoom(opening);
906
+ }, [naturalSize, openingWidth, openingZoom, viewportSize, zoom]);
907
+ const shownZoom = zoom ?? openingZoom ?? "fit";
908
+ const scale = scales ? resolveImageZoomScale(shownZoom, scales) : undefined;
909
+ function setZoom(next) {
910
+ setZoomState(next);
911
+ setOpeningZoom(next);
912
+ onZoomChange?.(next);
913
+ }
914
+ return /* @__PURE__ */ jsxs5("div", {
915
+ "data-slot": "diagram-viewer",
916
+ "data-scroll": "none",
917
+ "data-density": density,
918
+ "data-zoom": shownZoom,
919
+ className: "flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
920
+ children: [
921
+ (showZoomControl || toolbar !== undefined) && /* @__PURE__ */ jsxs5("div", {
922
+ "data-slot": "diagram-viewer-toolbar",
923
+ className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0 [@media(max-height:280px)]:flex-nowrap [@media(max-height:280px)]:overflow-x-auto",
924
+ children: [
925
+ showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
926
+ zoom: shownZoom,
927
+ scale,
928
+ scales,
929
+ onZoomChange: setZoom,
930
+ density
931
+ }),
932
+ toolbar
933
+ ]
934
+ }),
935
+ /* @__PURE__ */ jsx5(ImageViewport, {
936
+ label,
937
+ zoom: shownZoom,
938
+ naturalSize,
939
+ center,
940
+ viewportRef: mergedStageRef,
941
+ onZoomChange: setZoom,
942
+ onStageKeyDown,
943
+ stageKeyShortcuts,
944
+ children: /* @__PURE__ */ jsx5("div", {
945
+ "data-slot": "diagram-viewer-frame",
946
+ className: "size-full bg-card",
947
+ children: /* @__PURE__ */ jsx5(DiagramSurface, {
948
+ svg,
949
+ label,
950
+ description,
951
+ fit: "fill"
952
+ })
953
+ })
954
+ })
955
+ ]
956
+ });
957
+ }
958
+ // src/components/image-viewer/mermaidTheme.ts
959
+ var DARK_FALLBACK = {
960
+ card: "#121417",
961
+ foreground: "#eceff3",
962
+ secondary: "#1c1f24",
963
+ muted: "#282c33",
964
+ mutedForeground: "#a3abb6",
965
+ border: "#353b44",
966
+ input: "#6f7783",
967
+ primaryForeground: "#1a0014",
968
+ fontFamily: '"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
969
+ };
970
+ var LIGHT_FALLBACK = {
971
+ card: "#fcfcfd",
972
+ foreground: "#0c0e11",
973
+ secondary: "#eef0f3",
974
+ muted: "#e0e4ea",
975
+ mutedForeground: "#4b535e",
976
+ border: "#c7ccd4",
977
+ input: "#747c88",
978
+ primaryForeground: "#ffffff",
979
+ fontFamily: '"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
980
+ };
981
+ function toHexByte(channel) {
982
+ return Math.max(0, Math.min(255, Math.round(channel))).toString(16).padStart(2, "0");
983
+ }
984
+ function normalizeHex(raw) {
985
+ const trimmed = raw.trim();
986
+ if (/^#[0-9a-f]{6}$/i.test(trimmed))
987
+ return trimmed.toLowerCase();
988
+ const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(trimmed);
989
+ if (short) {
990
+ const [, r, g, b] = short;
991
+ return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();
992
+ }
993
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(trimmed);
994
+ if (rgb)
995
+ return `#${toHexByte(Number(rgb[1]))}${toHexByte(Number(rgb[2]))}${toHexByte(Number(rgb[3]))}`;
996
+ return;
997
+ }
998
+ function resolveCssColorToHex(raw, fallback) {
999
+ const direct = normalizeHex(raw);
1000
+ if (direct)
1001
+ return direct;
1002
+ const trimmed = raw.trim();
1003
+ if (!trimmed || typeof document === "undefined")
1004
+ return fallback;
1005
+ const canvas = document.createElement("canvas");
1006
+ canvas.width = 1;
1007
+ canvas.height = 1;
1008
+ const context = canvas.getContext("2d", { willReadFrequently: true });
1009
+ if (!context)
1010
+ return fallback;
1011
+ context.fillStyle = fallback;
1012
+ context.fillRect(0, 0, 1, 1);
1013
+ context.fillStyle = trimmed;
1014
+ context.fillRect(0, 0, 1, 1);
1015
+ const pixel = context.getImageData(0, 0, 1, 1).data;
1016
+ if (pixel[3] === 0)
1017
+ return fallback;
1018
+ return `#${toHexByte(pixel[0] ?? 0)}${toHexByte(pixel[1] ?? 0)}${toHexByte(pixel[2] ?? 0)}`;
1019
+ }
1020
+ function detectDarkMode(element) {
1021
+ const themed = element?.closest("[data-theme]") ?? (typeof document !== "undefined" ? document.documentElement : null);
1022
+ const attr = themed?.getAttribute("data-theme");
1023
+ if (attr === "light")
1024
+ return false;
1025
+ if (attr === "dark")
1026
+ return true;
1027
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
1028
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
1029
+ }
1030
+ return true;
1031
+ }
1032
+ function getMermaidThemeConfig(element) {
1033
+ const darkMode = detectDarkMode(element);
1034
+ const fallback = darkMode ? DARK_FALLBACK : LIGHT_FALLBACK;
1035
+ const target = element ?? (typeof document !== "undefined" ? document.documentElement : undefined);
1036
+ const style = target && typeof getComputedStyle === "function" ? getComputedStyle(target) : undefined;
1037
+ const color = (token, defaultHex) => resolveCssColorToHex(style?.getPropertyValue(token) ?? "", defaultHex);
1038
+ const card = color("--card", fallback.card);
1039
+ const foreground = color("--foreground", fallback.foreground);
1040
+ const secondary = color("--secondary", fallback.secondary);
1041
+ const muted = color("--muted", fallback.muted);
1042
+ const mutedForeground = color("--muted-foreground", fallback.mutedForeground);
1043
+ const border = color("--border", fallback.border);
1044
+ const input = color("--input", fallback.input);
1045
+ const primaryForeground = color("--primary-foreground", fallback.primaryForeground);
1046
+ const fontFamily = style?.getPropertyValue("--ag-font").trim() || style?.fontFamily.trim() || fallback.fontFamily;
1047
+ return {
1048
+ theme: "base",
1049
+ darkMode,
1050
+ fontFamily,
1051
+ themeVariables: {
1052
+ darkMode,
1053
+ fontFamily,
1054
+ background: card,
1055
+ primaryColor: secondary,
1056
+ primaryTextColor: foreground,
1057
+ primaryBorderColor: input,
1058
+ secondaryColor: muted,
1059
+ secondaryTextColor: foreground,
1060
+ secondaryBorderColor: input,
1061
+ tertiaryColor: card,
1062
+ tertiaryTextColor: foreground,
1063
+ tertiaryBorderColor: border,
1064
+ mainBkg: secondary,
1065
+ nodeBorder: input,
1066
+ nodeTextColor: foreground,
1067
+ textColor: foreground,
1068
+ titleColor: foreground,
1069
+ lineColor: mutedForeground,
1070
+ defaultLinkColor: mutedForeground,
1071
+ edgeLabelBackground: card,
1072
+ clusterBkg: card,
1073
+ clusterBorder: input,
1074
+ actorBkg: secondary,
1075
+ actorBorder: input,
1076
+ actorTextColor: foreground,
1077
+ actorLineColor: input,
1078
+ signalColor: mutedForeground,
1079
+ signalTextColor: foreground,
1080
+ labelBoxBkgColor: secondary,
1081
+ labelBoxBorderColor: input,
1082
+ labelTextColor: foreground,
1083
+ loopTextColor: foreground,
1084
+ noteBkgColor: muted,
1085
+ noteBorderColor: input,
1086
+ noteTextColor: foreground,
1087
+ activationBkgColor: muted,
1088
+ activationBorderColor: mutedForeground,
1089
+ sequenceNumberColor: primaryForeground,
1090
+ errorBkgColor: muted,
1091
+ errorTextColor: foreground
1092
+ }
1093
+ };
1094
+ }
1095
+ // src/components/image-viewer/hooks/useMermaidTheme.ts
1096
+ import { useContext, useEffect as useEffect2, useState as useState5 } from "react";
1097
+ function readThemeState(element) {
1098
+ const config = getMermaidThemeConfig(element);
1099
+ return { themeKey: JSON.stringify(config), config };
1100
+ }
1101
+ function useMermaidTheme(element) {
1102
+ const theme = useContext(ThemeContext);
1103
+ const resolvedTheme = theme?.resolvedTheme;
1104
+ const preset = theme?.preset;
1105
+ const [state, setState] = useState5(() => readThemeState(element ?? undefined));
1106
+ useEffect2(() => {
1107
+ const target = element ?? undefined;
1108
+ const sync = () => {
1109
+ const next = readThemeState(target);
1110
+ setState((current) => current.themeKey === next.themeKey ? current : next);
1111
+ };
1112
+ sync();
1113
+ const observer = typeof MutationObserver !== "undefined" && typeof document !== "undefined" ? new MutationObserver(sync) : undefined;
1114
+ if (observer && typeof document !== "undefined") {
1115
+ observer.observe(document.documentElement, {
1116
+ attributes: true,
1117
+ attributeFilter: ["data-theme", "data-theme-preset", "class", "style"]
1118
+ });
1119
+ const scoped = target?.closest("[data-theme]");
1120
+ if (scoped && scoped !== document.documentElement) {
1121
+ observer.observe(scoped, {
1122
+ attributes: true,
1123
+ attributeFilter: ["data-theme", "data-theme-preset", "class", "style"]
1124
+ });
1125
+ }
1126
+ }
1127
+ const media = typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)") : undefined;
1128
+ media?.addEventListener("change", sync);
1129
+ return () => {
1130
+ observer?.disconnect();
1131
+ media?.removeEventListener("change", sync);
1132
+ };
1133
+ }, [element, resolvedTheme, preset]);
1134
+ return state;
1135
+ }
1136
+ // src/components/image-viewer/ImageZoomToggle.tsx
1137
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
638
1138
  function ImageZoomToggle({
639
1139
  zoom,
640
1140
  onZoomChange,
@@ -645,7 +1145,7 @@ function ImageZoomToggle({
645
1145
  disabled = false,
646
1146
  density
647
1147
  }) {
648
- return /* @__PURE__ */ jsxs4(ToggleGroup2, {
1148
+ return /* @__PURE__ */ jsxs6(ToggleGroup2, {
649
1149
  "aria-label": label,
650
1150
  value: zoom === "fit" ? ["fit"] : zoom === 1 ? ["original"] : [],
651
1151
  onValueChange: (value) => {
@@ -660,11 +1160,11 @@ function ImageZoomToggle({
660
1160
  disabled,
661
1161
  density,
662
1162
  children: [
663
- /* @__PURE__ */ jsx4(ToggleGroupItem2, {
1163
+ /* @__PURE__ */ jsx6(ToggleGroupItem2, {
664
1164
  value: "fit",
665
1165
  children: "Fit to screen"
666
1166
  }),
667
- /* @__PURE__ */ jsx4(ToggleGroupItem2, {
1167
+ /* @__PURE__ */ jsx6(ToggleGroupItem2, {
668
1168
  value: "original",
669
1169
  children: "Original size"
670
1170
  })
@@ -672,7 +1172,7 @@ function ImageZoomToggle({
672
1172
  });
673
1173
  }
674
1174
  // src/components/image-viewer/ImageRegionSelect.tsx
675
- import { useRef as useRef3, useState as useState4 } from "react";
1175
+ import { useRef as useRef5, useState as useState6 } from "react";
676
1176
 
677
1177
  // src/components/image-viewer/getNormalizedImagePoint.ts
678
1178
  function clampUnit2(value) {
@@ -739,13 +1239,13 @@ function formatImageRegion(region) {
739
1239
 
740
1240
  // src/components/image-viewer/ImageRegionMarker.tsx
741
1241
  import { cva } from "class-variance-authority";
742
- import { jsx as jsx5 } from "react/jsx-runtime";
1242
+ import { jsx as jsx7 } from "react/jsx-runtime";
743
1243
  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
1244
  variants: {
745
1245
  variant: {
746
1246
  comment: "bg-primary/10 outline-primary",
747
1247
  draft: "bg-primary/10 outline-dashed outline-primary",
748
- difference: "bg-warning/5 outline-dashed outline-offset-[3px] outline-warning/75"
1248
+ difference: "bg-warning/5 outline-dashed outline-warning/80"
749
1249
  }
750
1250
  },
751
1251
  defaultVariants: { variant: "comment" }
@@ -758,11 +1258,11 @@ function ImageRegionMarker({
758
1258
  style,
759
1259
  ...props
760
1260
  }) {
761
- return /* @__PURE__ */ jsx5("div", {
1261
+ return /* @__PURE__ */ jsx7("div", {
762
1262
  "data-slot": "image-region-marker",
763
1263
  "data-variant": variant ?? "comment",
764
1264
  "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),
1265
+ 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
1266
  style: region ? { ...style, ...region } : style,
767
1267
  ...props
768
1268
  });
@@ -774,7 +1274,7 @@ function ImageRegionMarkerBadge({
774
1274
  style,
775
1275
  ...props
776
1276
  }) {
777
- return /* @__PURE__ */ jsx5("div", {
1277
+ return /* @__PURE__ */ jsx7("div", {
778
1278
  "data-slot": "image-region-marker-badge",
779
1279
  "data-interactive": interactive,
780
1280
  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 +1284,7 @@ function ImageRegionMarkerBadge({
784
1284
  }
785
1285
 
786
1286
  // src/components/image-viewer/ImageRegionSelect.tsx
787
- import { jsx as jsx6 } from "react/jsx-runtime";
1287
+ import { jsx as jsx8 } from "react/jsx-runtime";
788
1288
  var MINIMUM_DRAG = 4;
789
1289
  function toRegion(start, end) {
790
1290
  return {
@@ -803,9 +1303,9 @@ function toBox(region) {
803
1303
  };
804
1304
  }
805
1305
  function ImageRegionSelect({ region, onRegionChange, onStart }) {
806
- const drag = useRef3(null);
807
- const pendingClick = useRef3(null);
808
- const [draft, setDraft] = useState4();
1306
+ const drag = useRef5(null);
1307
+ const pendingClick = useRef5(null);
1308
+ const [draft, setDraft] = useState6();
809
1309
  const point = (event) => getNormalizedImagePoint(event, event.currentTarget.getBoundingClientRect());
810
1310
  function cancel() {
811
1311
  drag.current = null;
@@ -823,7 +1323,7 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
823
1323
  onRegionChange(placed);
824
1324
  }
825
1325
  const shown = draft ?? region;
826
- return /* @__PURE__ */ jsx6("div", {
1326
+ return /* @__PURE__ */ jsx8("div", {
827
1327
  "data-slot": "image-region-select",
828
1328
  className: "absolute inset-0 cursor-crosshair touch-none",
829
1329
  onPointerDown: (event) => {
@@ -865,7 +1365,7 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
865
1365
  onRegionChange(dragged);
866
1366
  },
867
1367
  onPointerCancel: cancel,
868
- children: shown && /* @__PURE__ */ jsx6(ImageRegionMarker, {
1368
+ children: shown && /* @__PURE__ */ jsx8(ImageRegionMarker, {
869
1369
  variant: "draft",
870
1370
  role: draft ? undefined : "img",
871
1371
  "aria-hidden": draft ? "true" : undefined,
@@ -876,8 +1376,8 @@ function ImageRegionSelect({ region, onRegionChange, onStart }) {
876
1376
  });
877
1377
  }
878
1378
  // src/components/image-viewer/ImageRegionFields.tsx
879
- import { useId } from "react";
880
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1379
+ import { useId as useId2 } from "react";
1380
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
881
1381
  var FIELDS = [
882
1382
  ["x", "Left"],
883
1383
  ["y", "Top"],
@@ -894,22 +1394,22 @@ function ImageRegionFields({
894
1394
  className,
895
1395
  density
896
1396
  }) {
897
- const id = useId();
898
- return /* @__PURE__ */ jsxs5("div", {
1397
+ const id = useId2();
1398
+ return /* @__PURE__ */ jsxs7("div", {
899
1399
  role: "group",
900
1400
  "aria-label": label,
901
1401
  "data-slot": "image-region-fields",
902
1402
  "data-density": density,
903
1403
  className: cn2("flex flex-wrap items-end gap-control-gap", className),
904
1404
  children: [
905
- FIELDS.map(([key, name]) => /* @__PURE__ */ jsxs5(Field2, {
1405
+ FIELDS.map(([key, name]) => /* @__PURE__ */ jsxs7(Field2, {
906
1406
  className: "w-20",
907
1407
  children: [
908
- /* @__PURE__ */ jsx7(FieldLabel2, {
1408
+ /* @__PURE__ */ jsx9(FieldLabel2, {
909
1409
  htmlFor: `${id}-${key}`,
910
1410
  children: name
911
1411
  }),
912
- /* @__PURE__ */ jsx7(NumberField2, {
1412
+ /* @__PURE__ */ jsx9(NumberField2, {
913
1413
  id: `${id}-${key}`,
914
1414
  density,
915
1415
  value: toPercent(region[key]),
@@ -923,15 +1423,15 @@ function ImageRegionFields({
923
1423
  return;
924
1424
  onRegionChange(clampImageRegion({ ...region, [key]: value / 100 }));
925
1425
  },
926
- children: /* @__PURE__ */ jsx7(NumberFieldGroup2, {
927
- children: /* @__PURE__ */ jsx7(NumberFieldInput2, {
1426
+ children: /* @__PURE__ */ jsx9(NumberFieldGroup2, {
1427
+ children: /* @__PURE__ */ jsx9(NumberFieldInput2, {
928
1428
  "aria-describedby": `${id}-unit`
929
1429
  })
930
1430
  })
931
1431
  })
932
1432
  ]
933
1433
  }, key)),
934
- /* @__PURE__ */ jsx7("span", {
1434
+ /* @__PURE__ */ jsx9("span", {
935
1435
  id: `${id}-unit`,
936
1436
  className: "sr-only",
937
1437
  children: "percent of the image"
@@ -940,13 +1440,13 @@ function ImageRegionFields({
940
1440
  });
941
1441
  }
942
1442
  // src/components/image-viewer/ImageGallery.tsx
943
- import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
1443
+ import { useControlled as useControlled3 } from "@base-ui/utils/useControlled";
944
1444
  import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
945
1445
  import {
946
- useRef as useRef4,
947
- useState as useState5
1446
+ useRef as useRef6,
1447
+ useState as useState7
948
1448
  } from "react";
949
- import { jsx as jsx8, jsxs as jsxs6, Fragment } from "react/jsx-runtime";
1449
+ import { jsx as jsx10, jsxs as jsxs8, Fragment } from "react/jsx-runtime";
950
1450
  function CompareAllPane({
951
1451
  item,
952
1452
  zoom,
@@ -957,29 +1457,29 @@ function CompareAllPane({
957
1457
  footer
958
1458
  }) {
959
1459
  const [image, imageHandlers] = useImageLoad(item.src);
960
- return /* @__PURE__ */ jsxs6("section", {
1460
+ return /* @__PURE__ */ jsxs8("section", {
961
1461
  "aria-label": item.label,
962
1462
  "data-slot": "image-gallery-compare-pane",
963
1463
  "data-selected": item.selected ? "" : undefined,
964
1464
  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
1465
  children: [
966
- /* @__PURE__ */ jsxs6("div", {
1466
+ /* @__PURE__ */ jsxs8("div", {
967
1467
  "data-slot": "image-gallery-compare-header",
968
1468
  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
1469
  children: [
970
- /* @__PURE__ */ jsx8("span", {
1470
+ /* @__PURE__ */ jsx10("span", {
971
1471
  className: "truncate",
972
1472
  children: item.label
973
1473
  }),
974
- item.selected && /* @__PURE__ */ jsx8(Badge2, {
1474
+ item.selected && /* @__PURE__ */ jsx10(Badge2, {
975
1475
  variant: "default",
976
1476
  children: "Chosen"
977
1477
  })
978
1478
  ]
979
1479
  }),
980
- /* @__PURE__ */ jsx8("div", {
1480
+ /* @__PURE__ */ jsx10("div", {
981
1481
  className: cn2("flex w-full shrink-0 p-2", zoom === "fit" ? "aspect-[16/10]" : "h-[min(60dvh,32rem)]"),
982
- children: /* @__PURE__ */ jsx8(ImageViewport, {
1482
+ children: /* @__PURE__ */ jsx10(ImageViewport, {
983
1483
  label: item.label,
984
1484
  zoom,
985
1485
  naturalSize: image.size,
@@ -988,11 +1488,11 @@ function CompareAllPane({
988
1488
  viewportRef,
989
1489
  onViewportScroll,
990
1490
  allowVerticalScroll: true,
991
- fallback: image.status === "error" ? /* @__PURE__ */ jsx8("p", {
1491
+ fallback: image.status === "error" ? /* @__PURE__ */ jsx10("p", {
992
1492
  className: "m-auto p-panel text-center text-sm text-muted-foreground",
993
1493
  children: "Image could not be loaded."
994
1494
  }) : undefined,
995
- children: /* @__PURE__ */ jsx8("img", {
1495
+ children: /* @__PURE__ */ jsx10("img", {
996
1496
  src: item.src,
997
1497
  alt: item.alt,
998
1498
  draggable: false,
@@ -1003,15 +1503,15 @@ function CompareAllPane({
1003
1503
  })
1004
1504
  })
1005
1505
  }),
1006
- (item.description || footer !== undefined && footer !== null) && /* @__PURE__ */ jsxs6("div", {
1506
+ (item.description || footer !== undefined && footer !== null) && /* @__PURE__ */ jsxs8("div", {
1007
1507
  "data-slot": "image-gallery-compare-footer",
1008
1508
  className: "flex flex-1 shrink-0 flex-col justify-between gap-2 border-t border-border p-panel-sm",
1009
1509
  children: [
1010
- item.description && /* @__PURE__ */ jsx8("p", {
1510
+ item.description && /* @__PURE__ */ jsx10("p", {
1011
1511
  className: "text-xs text-muted-foreground",
1012
1512
  children: item.description
1013
1513
  }),
1014
- footer !== undefined && footer !== null && /* @__PURE__ */ jsx8("div", {
1514
+ footer !== undefined && footer !== null && /* @__PURE__ */ jsx10("div", {
1015
1515
  className: "flex items-center justify-between gap-2",
1016
1516
  children: footer
1017
1517
  })
@@ -1045,17 +1545,17 @@ function ImageGallery({
1045
1545
  renderItemFooter,
1046
1546
  density
1047
1547
  }) {
1048
- const [announcement, setAnnouncement] = useState5("");
1049
- const [compareZoom, setCompareZoom] = useState5("fit");
1050
- const [isComparingAll, setCompareAllState] = useControlled2({
1548
+ const [announcement, setAnnouncement] = useState7("");
1549
+ const [compareZoom, setCompareZoom] = useState7("fit");
1550
+ const [isComparingAll, setCompareAllState] = useControlled3({
1051
1551
  controlled: compareAllProp,
1052
1552
  default: defaultCompareAll,
1053
1553
  name: "ImageGallery",
1054
1554
  state: "compareAll"
1055
1555
  });
1056
- const compareCenter = useRef4({ x: 0.5, y: 0.5 });
1057
- const compareViewports = useRef4(new Map);
1058
- const expectedScrollRef = useRef4(new WeakMap);
1556
+ const compareCenter = useRef6({ x: 0.5, y: 0.5 });
1557
+ const compareViewports = useRef6(new Map);
1558
+ const expectedScrollRef = useRef6(new WeakMap);
1059
1559
  const item = items[index];
1060
1560
  const count = items.length;
1061
1561
  const canCompareAll = count > 1 && (allowCompareAll ?? (compareAllProp !== undefined || onCompareAllChange !== undefined || renderItemFooter !== undefined));
@@ -1098,28 +1598,28 @@ function ImageGallery({
1098
1598
  }
1099
1599
  }
1100
1600
  if (!item)
1101
- return /* @__PURE__ */ jsx8("div", {
1601
+ return /* @__PURE__ */ jsx10("div", {
1102
1602
  "data-slot": "image-gallery",
1103
1603
  "data-density": density
1104
1604
  });
1105
1605
  if (canCompareAll && isComparingAll) {
1106
- return /* @__PURE__ */ jsxs6("div", {
1606
+ return /* @__PURE__ */ jsxs8("div", {
1107
1607
  "data-slot": "image-gallery",
1108
1608
  "data-mode": "compare-all",
1109
1609
  "data-scroll": "none",
1110
1610
  "data-density": density,
1111
1611
  className: "@container flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
1112
1612
  children: [
1113
- /* @__PURE__ */ jsxs6("div", {
1613
+ /* @__PURE__ */ jsxs8("div", {
1114
1614
  "data-slot": "image-gallery-toolbar",
1115
1615
  className: "flex shrink-0 flex-wrap items-center gap-control-gap border-b border-border pb-2 *:shrink-0",
1116
1616
  children: [
1117
- /* @__PURE__ */ jsx8(ImageZoomToggle, {
1617
+ /* @__PURE__ */ jsx10(ImageZoomToggle, {
1118
1618
  zoom: compareZoom,
1119
1619
  onZoomChange: setCompareZoom,
1120
1620
  density
1121
1621
  }),
1122
- /* @__PURE__ */ jsx8(Toggle2, {
1622
+ /* @__PURE__ */ jsx10(Toggle2, {
1123
1623
  variant: "outline",
1124
1624
  size: "sm",
1125
1625
  density,
@@ -1129,10 +1629,10 @@ function ImageGallery({
1129
1629
  })
1130
1630
  ]
1131
1631
  }),
1132
- /* @__PURE__ */ jsx8("div", {
1632
+ /* @__PURE__ */ jsx10("div", {
1133
1633
  "data-slot": "image-gallery-compare-grid",
1134
1634
  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"),
1135
- children: items.map((entry, entryIndex) => /* @__PURE__ */ jsx8(CompareAllPane, {
1635
+ children: items.map((entry, entryIndex) => /* @__PURE__ */ jsx10(CompareAllPane, {
1136
1636
  item: entry,
1137
1637
  zoom: compareZoom,
1138
1638
  center: compareCenter,
@@ -1147,7 +1647,7 @@ function ImageGallery({
1147
1647
  footer: renderItemFooter?.(entry, entryIndex)
1148
1648
  }, entry.key))
1149
1649
  }),
1150
- /* @__PURE__ */ jsx8("p", {
1650
+ /* @__PURE__ */ jsx10("p", {
1151
1651
  role: "status",
1152
1652
  "data-slot": "image-gallery-status",
1153
1653
  className: "sr-only",
@@ -1156,14 +1656,14 @@ function ImageGallery({
1156
1656
  ]
1157
1657
  });
1158
1658
  }
1159
- return /* @__PURE__ */ jsxs6("div", {
1659
+ return /* @__PURE__ */ jsxs8("div", {
1160
1660
  "data-slot": "image-gallery",
1161
1661
  "data-mode": "single",
1162
1662
  "data-scroll": "none",
1163
1663
  "data-density": density,
1164
1664
  className: "flex size-full min-h-0 min-w-0 flex-1 flex-col",
1165
1665
  children: [
1166
- /* @__PURE__ */ jsx8(ImageViewer, {
1666
+ /* @__PURE__ */ jsx10(ImageViewer, {
1167
1667
  src: item.src,
1168
1668
  alt: item.alt,
1169
1669
  label: label ?? item.label,
@@ -1175,24 +1675,24 @@ function ImageGallery({
1175
1675
  onStageKeyDown: handleStageKey,
1176
1676
  stageKeyShortcuts,
1177
1677
  density,
1178
- toolbar: /* @__PURE__ */ jsxs6(Fragment, {
1678
+ toolbar: /* @__PURE__ */ jsxs8(Fragment, {
1179
1679
  children: [
1180
- /* @__PURE__ */ jsxs6("div", {
1680
+ /* @__PURE__ */ jsxs8("div", {
1181
1681
  role: "group",
1182
1682
  "aria-label": "Images",
1183
1683
  "data-slot": "image-gallery-stepper",
1184
1684
  className: "flex items-center gap-control-gap",
1185
1685
  children: [
1186
- /* @__PURE__ */ jsx8(Button2, {
1686
+ /* @__PURE__ */ jsx10(Button2, {
1187
1687
  variant: "outline",
1188
1688
  size: "icon-sm",
1189
1689
  density,
1190
1690
  "aria-label": previousLabel,
1191
1691
  disabledReason: index === 0 ? "This is the first image" : undefined,
1192
1692
  onClick: () => step(index - 1),
1193
- children: /* @__PURE__ */ jsx8(ChevronLeftIcon, {})
1693
+ children: /* @__PURE__ */ jsx10(ChevronLeftIcon, {})
1194
1694
  }),
1195
- /* @__PURE__ */ jsxs6("span", {
1695
+ /* @__PURE__ */ jsxs8("span", {
1196
1696
  "data-slot": "image-gallery-position",
1197
1697
  className: "text-xs text-muted-foreground tabular-nums",
1198
1698
  children: [
@@ -1201,18 +1701,18 @@ function ImageGallery({
1201
1701
  count
1202
1702
  ]
1203
1703
  }),
1204
- /* @__PURE__ */ jsx8(Button2, {
1704
+ /* @__PURE__ */ jsx10(Button2, {
1205
1705
  variant: "outline",
1206
1706
  size: "icon-sm",
1207
1707
  density,
1208
1708
  "aria-label": nextLabel,
1209
1709
  disabledReason: index === count - 1 ? "This is the last image" : undefined,
1210
1710
  onClick: () => step(index + 1),
1211
- children: /* @__PURE__ */ jsx8(ChevronRightIcon, {})
1711
+ children: /* @__PURE__ */ jsx10(ChevronRightIcon, {})
1212
1712
  })
1213
1713
  ]
1214
1714
  }),
1215
- canCompareAll && /* @__PURE__ */ jsx8(Toggle2, {
1715
+ canCompareAll && /* @__PURE__ */ jsx10(Toggle2, {
1216
1716
  variant: "outline",
1217
1717
  size: "sm",
1218
1718
  density,
@@ -1224,7 +1724,7 @@ function ImageGallery({
1224
1724
  ]
1225
1725
  })
1226
1726
  }),
1227
- /* @__PURE__ */ jsx8("p", {
1727
+ /* @__PURE__ */ jsx10("p", {
1228
1728
  role: "status",
1229
1729
  "data-slot": "image-gallery-status",
1230
1730
  className: "sr-only",
@@ -1234,7 +1734,7 @@ function ImageGallery({
1234
1734
  });
1235
1735
  }
1236
1736
  // src/components/image-viewer/MediaShell.tsx
1237
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1737
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1238
1738
  function MediaShell({
1239
1739
  open,
1240
1740
  onOpenChange,
@@ -1243,26 +1743,28 @@ function MediaShell({
1243
1743
  children,
1244
1744
  density
1245
1745
  }) {
1246
- return /* @__PURE__ */ jsx9(Dialog2, {
1746
+ return /* @__PURE__ */ jsx11(Dialog2, {
1247
1747
  open,
1248
1748
  onOpenChange,
1249
- children: /* @__PURE__ */ jsxs7(DialogContent2, {
1749
+ children: /* @__PURE__ */ jsxs9(DialogContent2, {
1250
1750
  size: "fullscreen",
1251
1751
  density,
1252
1752
  "data-slot": "media-shell",
1753
+ className: "[@media(max-height:280px)]:gap-1.5 [@media(max-height:280px)]:p-2",
1253
1754
  children: [
1254
- /* @__PURE__ */ jsxs7(DialogHeader2, {
1755
+ /* @__PURE__ */ jsxs9(DialogHeader2, {
1255
1756
  children: [
1256
- /* @__PURE__ */ jsx9(DialogTitle2, {
1757
+ /* @__PURE__ */ jsx11(DialogTitle2, {
1257
1758
  className: "truncate",
1258
1759
  children: title
1259
1760
  }),
1260
- description !== undefined && /* @__PURE__ */ jsx9(DialogDescription2, {
1761
+ description !== undefined && /* @__PURE__ */ jsx11(DialogDescription2, {
1762
+ className: "[@media(max-height:280px)]:sr-only",
1261
1763
  children: description
1262
1764
  })
1263
1765
  ]
1264
1766
  }),
1265
- /* @__PURE__ */ jsx9("div", {
1767
+ /* @__PURE__ */ jsx11("div", {
1266
1768
  "data-slot": "media-shell-stage",
1267
1769
  "data-scroll": "none",
1268
1770
  className: "flex min-h-0 min-w-0 flex-1 flex-col",
@@ -1273,19 +1775,19 @@ function MediaShell({
1273
1775
  });
1274
1776
  }
1275
1777
  // 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";
1778
+ import { useControlled as useControlled4 } from "@base-ui/utils/useControlled";
1779
+ import { useRef as useRef8, useState as useState9 } from "react";
1278
1780
 
1279
1781
  // src/components/image-viewer/ImageComparisonToolbar.tsx
1280
1782
  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";
1783
+ import { useId as useId3 } from "react";
1784
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1283
1785
  function ToolbarSection({ title, titleId, children }) {
1284
- return /* @__PURE__ */ jsxs8("div", {
1786
+ return /* @__PURE__ */ jsxs10("div", {
1285
1787
  "data-slot": "image-comparison-toolbar-section",
1286
1788
  className: "flex shrink-0 items-center",
1287
1789
  children: [
1288
- /* @__PURE__ */ jsx10("span", {
1790
+ /* @__PURE__ */ jsx12("span", {
1289
1791
  id: titleId,
1290
1792
  className: "sr-only",
1291
1793
  children: title
@@ -1324,6 +1826,9 @@ function ImageComparisonToolbar({
1324
1826
  onOrientationChange,
1325
1827
  zoom,
1326
1828
  onZoomChange,
1829
+ showZoomControl = false,
1830
+ zoomScale,
1831
+ zoomScales,
1327
1832
  showDifferences,
1328
1833
  onShowDifferencesChange,
1329
1834
  differences,
@@ -1338,24 +1843,24 @@ function ImageComparisonToolbar({
1338
1843
  toolbar,
1339
1844
  density
1340
1845
  }) {
1341
- const id = useId2();
1846
+ const id = useId3();
1342
1847
  const isUnavailable = differences.status === "unavailable";
1343
1848
  const regionCount = showDifferences && differences.status === "ready" ? differences.diff.regions.length : 0;
1344
1849
  const hasStepper = regionCount > 0;
1345
1850
  const releasePeek = () => onPeekChange(false);
1346
1851
  const statusText = describeDifferences(differences, showDifferences);
1347
1852
  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", {
1853
+ return /* @__PURE__ */ jsxs10("div", {
1349
1854
  role: "group",
1350
1855
  "aria-label": "Comparison controls",
1351
1856
  "data-slot": "image-comparison-toolbar",
1352
1857
  "data-density": density,
1353
- className: "flex shrink-0 flex-wrap items-center gap-x-2 gap-y-2 border-b border-border py-2",
1858
+ className: "flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border py-2",
1354
1859
  children: [
1355
- /* @__PURE__ */ jsx10(ToolbarSection, {
1860
+ /* @__PURE__ */ jsx12(ToolbarSection, {
1356
1861
  title: "Mode",
1357
1862
  titleId: `${id}-mode`,
1358
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1863
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1359
1864
  "aria-labelledby": `${id}-mode`,
1360
1865
  required: true,
1361
1866
  value: [mode],
@@ -1365,25 +1870,25 @@ function ImageComparisonToolbar({
1365
1870
  spacing: 0,
1366
1871
  density,
1367
1872
  children: [
1368
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1873
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1369
1874
  value: "toggle",
1370
1875
  children: "Toggle"
1371
1876
  }),
1372
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1877
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1373
1878
  value: "swipe",
1374
1879
  children: "Swipe"
1375
1880
  }),
1376
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1881
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1377
1882
  value: "side-by-side",
1378
1883
  children: "Side by side"
1379
1884
  })
1380
1885
  ]
1381
1886
  })
1382
1887
  }),
1383
- mode === "toggle" && /* @__PURE__ */ jsx10(ToolbarSection, {
1888
+ mode === "toggle" && /* @__PURE__ */ jsx12(ToolbarSection, {
1384
1889
  title: "Shown image",
1385
1890
  titleId: `${id}-side`,
1386
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1891
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1387
1892
  "aria-labelledby": `${id}-side`,
1388
1893
  "aria-keyshortcuts": "B A",
1389
1894
  required: true,
@@ -1394,21 +1899,21 @@ function ImageComparisonToolbar({
1394
1899
  spacing: 0,
1395
1900
  density,
1396
1901
  children: [
1397
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1902
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1398
1903
  value: "before",
1399
1904
  children: beforeLabel
1400
1905
  }),
1401
- /* @__PURE__ */ jsx10(ToggleGroupItem2, {
1906
+ /* @__PURE__ */ jsx12(ToggleGroupItem2, {
1402
1907
  value: "after",
1403
1908
  children: afterLabel
1404
1909
  })
1405
1910
  ]
1406
1911
  })
1407
1912
  }),
1408
- mode === "side-by-side" && /* @__PURE__ */ jsx10(ToolbarSection, {
1913
+ mode === "side-by-side" && /* @__PURE__ */ jsx12(ToolbarSection, {
1409
1914
  title: "Orientation",
1410
1915
  titleId: `${id}-orientation`,
1411
- children: /* @__PURE__ */ jsxs8(ToggleGroup2, {
1916
+ children: /* @__PURE__ */ jsxs10(ToggleGroup2, {
1412
1917
  "aria-labelledby": `${id}-orientation`,
1413
1918
  required: true,
1414
1919
  value: [orientation],
@@ -1418,37 +1923,51 @@ function ImageComparisonToolbar({
1418
1923
  spacing: 0,
1419
1924
  density,
1420
1925
  children: [
1421
- /* @__PURE__ */ jsxs8(ToggleGroupItem2, {
1926
+ /* @__PURE__ */ jsxs10(ToggleGroupItem2, {
1422
1927
  value: "horizontal",
1928
+ "aria-label": "Horizontal",
1423
1929
  children: [
1424
- /* @__PURE__ */ jsx10(Columns2Icon, {
1930
+ /* @__PURE__ */ jsx12(Columns2Icon, {
1425
1931
  "data-icon": "inline-start"
1426
1932
  }),
1427
- "Horizontal"
1933
+ /* @__PURE__ */ jsx12("span", {
1934
+ className: "hidden @md:inline",
1935
+ children: "Horizontal"
1936
+ })
1428
1937
  ]
1429
1938
  }),
1430
- /* @__PURE__ */ jsxs8(ToggleGroupItem2, {
1939
+ /* @__PURE__ */ jsxs10(ToggleGroupItem2, {
1431
1940
  value: "vertical",
1941
+ "aria-label": "Vertical",
1432
1942
  children: [
1433
- /* @__PURE__ */ jsx10(Rows2Icon, {
1943
+ /* @__PURE__ */ jsx12(Rows2Icon, {
1434
1944
  "data-icon": "inline-start"
1435
1945
  }),
1436
- "Vertical"
1946
+ /* @__PURE__ */ jsx12("span", {
1947
+ className: "hidden @md:inline",
1948
+ children: "Vertical"
1949
+ })
1437
1950
  ]
1438
1951
  })
1439
1952
  ]
1440
1953
  })
1441
1954
  }),
1442
- /* @__PURE__ */ jsx10(ToolbarSection, {
1955
+ /* @__PURE__ */ jsx12(ToolbarSection, {
1443
1956
  title: "Zoom",
1444
1957
  titleId: `${id}-zoom`,
1445
- children: /* @__PURE__ */ jsx10(ImageZoomToggle, {
1958
+ children: showZoomControl ? /* @__PURE__ */ jsx12(ImageZoomControl, {
1959
+ zoom,
1960
+ scale: zoomScale,
1961
+ scales: zoomScales,
1962
+ onZoomChange,
1963
+ density
1964
+ }) : /* @__PURE__ */ jsx12(ImageZoomToggle, {
1446
1965
  zoom,
1447
1966
  onZoomChange,
1448
1967
  density
1449
1968
  })
1450
1969
  }),
1451
- mode === "toggle" && /* @__PURE__ */ jsx10(Button2, {
1970
+ mode === "toggle" && /* @__PURE__ */ jsx12(Button2, {
1452
1971
  variant: "outline",
1453
1972
  size: "sm",
1454
1973
  density,
@@ -1472,100 +1991,95 @@ function ImageComparisonToolbar({
1472
1991
  onContextMenu: (event) => event.preventDefault(),
1473
1992
  children: `Hold to show ${side === "before" ? "after" : "before"}`
1474
1993
  }),
1475
- /* @__PURE__ */ jsxs8("div", {
1476
- className: "flex min-w-0 flex-wrap items-center gap-2",
1994
+ /* @__PURE__ */ jsxs10("div", {
1995
+ className: "flex shrink-0 items-center gap-1.5",
1477
1996
  children: [
1478
- /* @__PURE__ */ jsxs8("div", {
1479
- className: "flex items-center gap-1.5",
1480
- children: [
1481
- /* @__PURE__ */ jsx10(Switch2, {
1482
- id: `${id}-differences`,
1483
- "aria-describedby": `${id}-differences-status`,
1484
- checked: showDifferences && !isUnavailable,
1485
- disabled: isUnavailable,
1486
- onCheckedChange: onShowDifferencesChange
1487
- }),
1488
- /* @__PURE__ */ jsx10("label", {
1489
- htmlFor: `${id}-differences`,
1490
- className: "cursor-pointer text-sm leading-none font-medium whitespace-nowrap select-none",
1491
- children: "Highlight differences"
1492
- })
1493
- ]
1997
+ /* @__PURE__ */ jsx12(Switch2, {
1998
+ id: `${id}-differences`,
1999
+ "aria-labelledby": `${id}-differences-label`,
2000
+ "aria-describedby": `${id}-differences-status`,
2001
+ checked: showDifferences && !isUnavailable,
2002
+ disabled: isUnavailable,
2003
+ onCheckedChange: onShowDifferencesChange
2004
+ }),
2005
+ /* @__PURE__ */ jsx12("label", {
2006
+ id: `${id}-differences-label`,
2007
+ htmlFor: `${id}-differences`,
2008
+ className: "cursor-pointer text-sm leading-none font-medium whitespace-nowrap select-none",
2009
+ children: "Highlight differences"
1494
2010
  }),
1495
- showDifferences && differences.status === "ready" && /* @__PURE__ */ jsxs8("span", {
2011
+ /* @__PURE__ */ jsx12("p", {
2012
+ id: `${id}-differences-status`,
2013
+ role: "status",
2014
+ className: hasStepper || !statusText ? "sr-only" : "text-xs text-muted-foreground",
2015
+ children: statusText
2016
+ })
2017
+ ]
2018
+ }),
2019
+ hasStepper && /* @__PURE__ */ jsxs10("div", {
2020
+ role: "group",
2021
+ "aria-label": "Changed regions",
2022
+ "data-slot": "image-comparison-stepper",
2023
+ className: "flex flex-wrap items-center gap-1.5",
2024
+ children: [
2025
+ /* @__PURE__ */ jsxs10("span", {
1496
2026
  "data-slot": "image-comparison-legend",
1497
2027
  className: "flex items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground",
1498
2028
  children: [
1499
- /* @__PURE__ */ jsx10("span", {
2029
+ /* @__PURE__ */ jsx12("span", {
1500
2030
  "aria-hidden": "true",
1501
2031
  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
2032
  }),
1503
- "Changed region"
2033
+ /* @__PURE__ */ jsx12("span", {
2034
+ className: "hidden @md:inline",
2035
+ children: "Changed region"
2036
+ })
1504
2037
  ]
1505
2038
  }),
1506
- hasStepper && /* @__PURE__ */ jsxs8("div", {
1507
- role: "group",
1508
- "aria-label": "Changed regions",
1509
- "data-slot": "image-comparison-stepper",
1510
- className: "flex flex-wrap items-center gap-1.5",
2039
+ /* @__PURE__ */ jsxs10("span", {
2040
+ "data-slot": "image-comparison-change-count",
2041
+ className: "text-xs whitespace-nowrap text-muted-foreground tabular-nums",
1511
2042
  children: [
1512
- /* @__PURE__ */ jsx10("span", {
1513
- "aria-hidden": "true",
1514
- className: "text-muted-foreground",
1515
- children: "·"
1516
- }),
1517
- /* @__PURE__ */ jsxs8("span", {
1518
- "data-slot": "image-comparison-change-count",
1519
- className: "text-xs whitespace-nowrap text-muted-foreground tabular-nums",
1520
- children: [
1521
- "Change ",
1522
- activeRegionIndex + 1,
1523
- " of ",
1524
- regionCount
1525
- ]
1526
- }),
1527
- /* @__PURE__ */ jsx10(Button2, {
1528
- variant: "outline",
1529
- size: "icon-sm",
1530
- density,
1531
- "aria-label": "Previous change",
1532
- "aria-keyshortcuts": "Shift+N",
1533
- onClick: () => onStepChange(-1),
1534
- children: /* @__PURE__ */ jsx10(ChevronLeftIcon2, {})
1535
- }),
1536
- /* @__PURE__ */ jsx10(Button2, {
1537
- variant: "outline",
1538
- size: "icon-sm",
1539
- density,
1540
- "aria-label": "Next change",
1541
- "aria-keyshortcuts": "N",
1542
- onClick: () => onStepChange(1),
1543
- children: /* @__PURE__ */ jsx10(ChevronRightIcon2, {})
1544
- }),
1545
- onCommentActiveDifference && /* @__PURE__ */ jsx10(Button2, {
1546
- variant: "outline",
1547
- size: "sm",
1548
- density,
1549
- "aria-label": `Comment on change ${activeRegionIndex + 1} of ${regionCount}`,
1550
- onClick: onCommentActiveDifference,
1551
- children: "Comment on change"
1552
- })
2043
+ "Change ",
2044
+ activeRegionIndex + 1,
2045
+ " of ",
2046
+ regionCount
1553
2047
  ]
1554
2048
  }),
1555
- /* @__PURE__ */ jsx10("p", {
1556
- id: `${id}-differences-status`,
1557
- role: "status",
1558
- className: hasStepper || !statusText ? "sr-only" : "text-xs text-muted-foreground",
1559
- children: statusText
2049
+ /* @__PURE__ */ jsx12(Button2, {
2050
+ variant: "outline",
2051
+ size: "icon-sm",
2052
+ density,
2053
+ "aria-label": "Previous change",
2054
+ "aria-keyshortcuts": "Shift+N",
2055
+ onClick: () => onStepChange(-1),
2056
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
2057
+ }),
2058
+ /* @__PURE__ */ jsx12(Button2, {
2059
+ variant: "outline",
2060
+ size: "icon-sm",
2061
+ density,
2062
+ "aria-label": "Next change",
2063
+ "aria-keyshortcuts": "N",
2064
+ onClick: () => onStepChange(1),
2065
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
2066
+ }),
2067
+ onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
2068
+ variant: "outline",
2069
+ size: "sm",
2070
+ density,
2071
+ "aria-label": `Comment on change ${activeRegionIndex + 1} of ${regionCount}`,
2072
+ onClick: onCommentActiveDifference,
2073
+ children: "Comment on change"
1560
2074
  })
1561
2075
  ]
1562
2076
  }),
1563
- toolbar && /* @__PURE__ */ jsx10("div", {
2077
+ toolbar && /* @__PURE__ */ jsx12("div", {
1564
2078
  "data-slot": "image-comparison-toolbar-extra",
1565
- className: "flex min-w-0 flex-wrap items-center gap-2 @2xl:border-s @2xl:border-border @2xl:ps-2",
2079
+ className: "flex min-w-0 flex-wrap items-center gap-1.5",
1566
2080
  children: toolbar
1567
2081
  }),
1568
- sizeMismatch && /* @__PURE__ */ jsx10("p", {
2082
+ sizeMismatch && /* @__PURE__ */ jsx12("p", {
1569
2083
  "data-slot": "image-comparison-size-mismatch",
1570
2084
  className: "w-full text-xs text-muted-foreground",
1571
2085
  children: sizeMismatch
@@ -1575,16 +2089,16 @@ function ImageComparisonToolbar({
1575
2089
  }
1576
2090
 
1577
2091
  // src/components/image-viewer/ImageDifferenceOverlay.tsx
1578
- import { jsx as jsx11 } from "react/jsx-runtime";
2092
+ import { jsx as jsx13 } from "react/jsx-runtime";
1579
2093
  function toPercent2(value, total) {
1580
2094
  return `${value / total * 100}%`;
1581
2095
  }
1582
2096
  function ImageDifferenceOverlay({ diff, activeIndex }) {
1583
- return /* @__PURE__ */ jsx11("div", {
2097
+ return /* @__PURE__ */ jsx13("div", {
1584
2098
  "data-slot": "image-difference-overlay",
1585
2099
  "aria-hidden": "true",
1586
2100
  className: "pointer-events-none absolute inset-0",
1587
- children: diff.regions.map((region, index) => /* @__PURE__ */ jsx11(ImageRegionMarker, {
2101
+ children: diff.regions.map((region, index) => /* @__PURE__ */ jsx13(ImageRegionMarker, {
1588
2102
  "data-slot": "image-difference-region",
1589
2103
  variant: "difference",
1590
2104
  active: index === activeIndex,
@@ -1602,16 +2116,16 @@ function ImageDifferenceOverlay({ diff, activeIndex }) {
1602
2116
  import { DirectionProvider } from "@base-ui/react/direction-provider";
1603
2117
  import { Slider as SliderPrimitive } from "@base-ui/react/slider";
1604
2118
  import { ChevronsLeftRightIcon } from "lucide-react";
1605
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2119
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
1606
2120
  function ImageSwipeDivider({
1607
2121
  value,
1608
2122
  onValueChange,
1609
2123
  beforeLabel,
1610
2124
  afterLabel
1611
2125
  }) {
1612
- return /* @__PURE__ */ jsx12(DirectionProvider, {
2126
+ return /* @__PURE__ */ jsx14(DirectionProvider, {
1613
2127
  direction: "ltr",
1614
- children: /* @__PURE__ */ jsx12(SliderPrimitive.Root, {
2128
+ children: /* @__PURE__ */ jsx14(SliderPrimitive.Root, {
1615
2129
  dir: "ltr",
1616
2130
  "data-slot": "image-swipe-divider",
1617
2131
  value,
@@ -1621,22 +2135,22 @@ function ImageSwipeDivider({
1621
2135
  step: 1,
1622
2136
  largeStep: 10,
1623
2137
  className: "pointer-events-none absolute inset-0",
1624
- children: /* @__PURE__ */ jsx12(SliderPrimitive.Control, {
2138
+ children: /* @__PURE__ */ jsx14(SliderPrimitive.Control, {
1625
2139
  className: "pointer-events-none absolute inset-0",
1626
- children: /* @__PURE__ */ jsxs9(SliderPrimitive.Thumb, {
2140
+ children: /* @__PURE__ */ jsxs11(SliderPrimitive.Thumb, {
1627
2141
  "data-slot": "image-swipe-divider-handle",
1628
2142
  getAriaLabel: () => "Swipe divider",
1629
2143
  getAriaValueText: (_formatted, current) => `${beforeLabel} ${current}%, ${afterLabel} ${100 - current}%`,
1630
2144
  className: "group/divider pointer-events-auto flex h-full w-6 cursor-ew-resize touch-none flex-col items-center justify-center select-none",
1631
2145
  children: [
1632
- /* @__PURE__ */ jsx12("span", {
2146
+ /* @__PURE__ */ jsx14("span", {
1633
2147
  "aria-hidden": "true",
1634
2148
  className: "absolute inset-y-0 start-1/2 w-0.5 -translate-x-1/2 bg-foreground ring-1 ring-background"
1635
2149
  }),
1636
- /* @__PURE__ */ jsx12("span", {
2150
+ /* @__PURE__ */ jsx14("span", {
1637
2151
  "aria-hidden": "true",
1638
2152
  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",
1639
- children: /* @__PURE__ */ jsx12(ChevronsLeftRightIcon, {
2153
+ children: /* @__PURE__ */ jsx14(ChevronsLeftRightIcon, {
1640
2154
  className: "size-3.5"
1641
2155
  })
1642
2156
  })
@@ -1648,7 +2162,7 @@ function ImageSwipeDivider({
1648
2162
  }
1649
2163
 
1650
2164
  // src/components/image-viewer/hooks/useImageDifferences.ts
1651
- import { useEffect as useEffect2, useRef as useRef5, useState as useState6 } from "react";
2165
+ import { useEffect as useEffect3, useRef as useRef7, useState as useState8 } from "react";
1652
2166
 
1653
2167
  // src/components/image-viewer/computeImageDiff.ts
1654
2168
  var DEFAULT_THRESHOLD = 32;
@@ -1861,11 +2375,11 @@ function useImageDifferences({
1861
2375
  beforeRef,
1862
2376
  afterRef
1863
2377
  }) {
1864
- const [entries, setEntries] = useState6(() => new Map);
1865
- const startedRef = useRef5(new Set);
1866
- const controllerRef = useRef5(undefined);
1867
- useEffect2(() => () => controllerRef.current?.abort(), [pairKey]);
1868
- useEffect2(() => {
2378
+ const [entries, setEntries] = useState8(() => new Map);
2379
+ const startedRef = useRef7(new Set);
2380
+ const controllerRef = useRef7(undefined);
2381
+ useEffect3(() => () => controllerRef.current?.abort(), [pairKey]);
2382
+ useEffect3(() => {
1869
2383
  const before = beforeRef.current;
1870
2384
  const after = afterRef.current;
1871
2385
  if (!loaded || !before || !after)
@@ -1880,7 +2394,7 @@ function useImageDifferences({
1880
2394
  isCurrent = false;
1881
2395
  };
1882
2396
  }, [afterRef, beforeRef, loaded, pairKey]);
1883
- useEffect2(() => {
2397
+ useEffect3(() => {
1884
2398
  const before = beforeRef.current;
1885
2399
  const after = afterRef.current;
1886
2400
  if (!enabled || !loaded || !before || !after || startedRef.current.has(pairKey))
@@ -1902,16 +2416,16 @@ function useImageDifferences({
1902
2416
  }
1903
2417
 
1904
2418
  // src/components/image-viewer/ImageComparison.tsx
1905
- import { jsx as jsx13, jsxs as jsxs10, Fragment as Fragment2 } from "react/jsx-runtime";
2419
+ import { jsx as jsx15, jsxs as jsxs12, Fragment as Fragment2 } from "react/jsx-runtime";
1906
2420
  function ComparisonPane({ header, children }) {
1907
- return /* @__PURE__ */ jsxs10("div", {
2421
+ return /* @__PURE__ */ jsxs12("div", {
1908
2422
  "data-slot": "image-comparison-pane",
1909
2423
  "data-scroll": "none",
1910
2424
  className: "flex min-h-0 min-w-0 flex-1 flex-col",
1911
2425
  children: [
1912
- /* @__PURE__ */ jsx13("div", {
2426
+ /* @__PURE__ */ jsx15("div", {
1913
2427
  "data-slot": "image-comparison-pane-header",
1914
- className: "flex h-control shrink-0 items-center justify-between gap-2 px-control-x text-xs font-medium text-muted-foreground",
2428
+ className: "flex h-control shrink-0 items-center justify-between gap-2 text-xs font-medium text-muted-foreground",
1915
2429
  children: header
1916
2430
  }),
1917
2431
  children
@@ -1945,6 +2459,7 @@ function ImageComparison({
1945
2459
  defaultShowDifferences = false,
1946
2460
  onShowDifferencesChange,
1947
2461
  showToolbar = true,
2462
+ showZoomControl = false,
1948
2463
  toolbar,
1949
2464
  beforeOverlay,
1950
2465
  afterOverlay,
@@ -1956,31 +2471,31 @@ function ImageComparison({
1956
2471
  label = "Image comparison",
1957
2472
  density
1958
2473
  }) {
1959
- const [mode, setModeState] = useControlled3({
2474
+ const [mode, setModeState] = useControlled4({
1960
2475
  controlled: modeProp,
1961
2476
  default: defaultMode,
1962
2477
  name: "ImageComparison",
1963
2478
  state: "mode"
1964
2479
  });
1965
- const [side, setSideState] = useControlled3({
2480
+ const [side, setSideState] = useControlled4({
1966
2481
  controlled: sideProp,
1967
2482
  default: defaultSide,
1968
2483
  name: "ImageComparison",
1969
2484
  state: "side"
1970
2485
  });
1971
- const [chosenOrientation, setOrientationState] = useControlled3({
2486
+ const [chosenOrientation, setOrientationState] = useControlled4({
1972
2487
  controlled: orientationProp,
1973
2488
  default: defaultOrientation,
1974
2489
  name: "ImageComparison",
1975
2490
  state: "orientation"
1976
2491
  });
1977
- const [zoom, setZoomState] = useControlled3({
2492
+ const [zoom, setZoomState] = useControlled4({
1978
2493
  controlled: zoomProp,
1979
2494
  default: defaultZoom,
1980
2495
  name: "ImageComparison",
1981
2496
  state: "zoom"
1982
2497
  });
1983
- const [showDifferences, setShowDifferencesState] = useControlled3({
2498
+ const [showDifferences, setShowDifferencesState] = useControlled4({
1984
2499
  controlled: showDifferencesProp,
1985
2500
  default: defaultShowDifferences,
1986
2501
  name: "ImageComparison",
@@ -1988,12 +2503,12 @@ function ImageComparison({
1988
2503
  });
1989
2504
  const pairKey = `${before.src}
1990
2505
  ${after.src}`;
1991
- const [isPeeking, setIsPeeking] = useState7(false);
1992
- const [position, setPosition] = useState7(50);
1993
- const [activeRegionIndex, setActiveRegionIndex] = useState7(0);
1994
- const [changeAnnouncement, setChangeAnnouncement] = useState7("");
1995
- const [lastPairKey, setLastPairKey] = useState7(pairKey);
1996
- const [lastShowDifferences, setLastShowDifferences] = useState7(showDifferences);
2506
+ const [isPeeking, setIsPeeking] = useState9(false);
2507
+ const [position, setPosition] = useState9(50);
2508
+ const [activeRegionIndex, setActiveRegionIndex] = useState9(0);
2509
+ const [changeAnnouncement, setChangeAnnouncement] = useState9("");
2510
+ const [lastPairKey, setLastPairKey] = useState9(pairKey);
2511
+ const [lastShowDifferences, setLastShowDifferences] = useState9(showDifferences);
1997
2512
  if (lastPairKey !== pairKey || lastShowDifferences !== showDifferences) {
1998
2513
  setLastPairKey(pairKey);
1999
2514
  setLastShowDifferences(showDifferences);
@@ -2002,15 +2517,20 @@ ${after.src}`;
2002
2517
  }
2003
2518
  const [beforeImage, beforeHandlers] = useImageLoad(before.src);
2004
2519
  const [afterImage, afterHandlers] = useImageLoad(after.src);
2005
- const beforeRef = useRef6(null);
2006
- const afterRef = useRef6(null);
2007
- const stageRef = useRef6(null);
2008
- const singleViewportRef = useRef6(null);
2009
- const beforeViewportRef = useRef6(null);
2010
- const afterViewportRef = useRef6(null);
2011
- const expectedScrollRef = useRef6(new WeakMap);
2012
- const center = useRef6({ x: 0.5, y: 0.5 });
2520
+ const beforeRef = useRef8(null);
2521
+ const afterRef = useRef8(null);
2522
+ const stageRef = useRef8(null);
2523
+ const singleViewportRef = useRef8(null);
2524
+ const beforeViewportRef = useRef8(null);
2525
+ const afterViewportRef = useRef8(null);
2526
+ const expectedScrollRef = useRef8(new WeakMap);
2527
+ const center = useRef8({ x: 0.5, y: 0.5 });
2013
2528
  const stageSize = useElementSize(stageRef);
2529
+ const singleViewportSize = useElementSize(singleViewportRef);
2530
+ const afterViewportSize = useElementSize(afterViewportRef);
2531
+ const activeViewportSize = mode === "side-by-side" ? afterViewportSize : singleViewportSize;
2532
+ const zoomScales = afterImage.size && activeViewportSize ? getImageZoomScales(afterImage.size, activeViewportSize) : undefined;
2533
+ const zoomScale = zoomScales ? resolveImageZoomScale(zoom, zoomScales) : undefined;
2014
2534
  const autoOrientation = stageSize && stageSize.height > stageSize.width ? "vertical" : "horizontal";
2015
2535
  const orientation = chosenOrientation ?? autoOrientation;
2016
2536
  const failedLabel = afterImage.status === "error" ? afterLabel : beforeImage.status === "error" ? beforeLabel : undefined;
@@ -2026,13 +2546,13 @@ ${after.src}`;
2026
2546
  const clampedActiveIndex = regions.length > 0 ? Math.min(activeRegionIndex, regions.length - 1) : 0;
2027
2547
  const shownSide = mode !== "toggle" ? "after" : isPeeking ? side === "before" ? "after" : "before" : side;
2028
2548
  const isShowingBefore = shownSide === "before";
2029
- const diffOverlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx13(ImageDifferenceOverlay, {
2549
+ const diffOverlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx15(ImageDifferenceOverlay, {
2030
2550
  diff: differences.diff,
2031
2551
  activeIndex: clampedActiveIndex
2032
2552
  }) : null;
2033
2553
  const activeRegion = regions[clampedActiveIndex];
2034
2554
  const handleCommentActiveDifference = onCommentDifference && showDifferences && differences.status === "ready" && activeRegion ? () => onCommentDifference(activeRegion, clampedActiveIndex, differences.diff) : undefined;
2035
- const fallback = failedLabel ? /* @__PURE__ */ jsxs10("p", {
2555
+ const fallback = failedLabel ? /* @__PURE__ */ jsxs12("p", {
2036
2556
  "data-slot": "image-comparison-error",
2037
2557
  className: "m-auto p-panel text-center text-sm text-muted-foreground",
2038
2558
  children: [
@@ -2135,7 +2655,7 @@ ${after.src}`;
2135
2655
  }
2136
2656
  }
2137
2657
  function renderAfterImage(className) {
2138
- return /* @__PURE__ */ jsx13("img", {
2658
+ return /* @__PURE__ */ jsx15("img", {
2139
2659
  ref: afterRef,
2140
2660
  src: after.src,
2141
2661
  alt: after.alt,
@@ -2148,7 +2668,7 @@ ${after.src}`;
2148
2668
  });
2149
2669
  }
2150
2670
  function renderBeforeImage(className, style) {
2151
- return /* @__PURE__ */ jsx13("img", {
2671
+ return /* @__PURE__ */ jsx15("img", {
2152
2672
  ref: beforeRef,
2153
2673
  src: before.src,
2154
2674
  alt: before.alt,
@@ -2165,15 +2685,15 @@ ${after.src}`;
2165
2685
  const toggleStageKeys = ["B A", sharedStageKeys].filter(Boolean).join(" ");
2166
2686
  let content;
2167
2687
  if (mode === "side-by-side") {
2168
- content = /* @__PURE__ */ jsxs10("div", {
2688
+ content = /* @__PURE__ */ jsxs12("div", {
2169
2689
  "data-slot": "image-comparison-panes",
2170
- className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col" : "flex-row"),
2690
+ className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col gap-2" : "flex-row gap-3"),
2171
2691
  children: [
2172
- /* @__PURE__ */ jsx13(ComparisonPane, {
2173
- header: /* @__PURE__ */ jsx13("span", {
2692
+ /* @__PURE__ */ jsx15(ComparisonPane, {
2693
+ header: /* @__PURE__ */ jsx15("span", {
2174
2694
  children: beforeLabel
2175
2695
  }),
2176
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2696
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2177
2697
  label: beforeLabel,
2178
2698
  zoom,
2179
2699
  naturalSize: afterImage.size,
@@ -2191,14 +2711,14 @@ ${after.src}`;
2191
2711
  ]
2192
2712
  })
2193
2713
  }),
2194
- /* @__PURE__ */ jsx13(Separator2, {
2714
+ /* @__PURE__ */ jsx15(Separator2, {
2195
2715
  orientation: orientation === "vertical" ? "horizontal" : "vertical"
2196
2716
  }),
2197
- /* @__PURE__ */ jsx13(ComparisonPane, {
2198
- header: /* @__PURE__ */ jsx13("span", {
2717
+ /* @__PURE__ */ jsx15(ComparisonPane, {
2718
+ header: /* @__PURE__ */ jsx15("span", {
2199
2719
  children: afterLabel
2200
2720
  }),
2201
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2721
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2202
2722
  label: afterLabel,
2203
2723
  zoom,
2204
2724
  naturalSize: afterImage.size,
@@ -2219,18 +2739,18 @@ ${after.src}`;
2219
2739
  ]
2220
2740
  });
2221
2741
  } else if (mode === "swipe") {
2222
- content = /* @__PURE__ */ jsx13(ComparisonPane, {
2223
- header: /* @__PURE__ */ jsxs10(Fragment2, {
2742
+ content = /* @__PURE__ */ jsx15(ComparisonPane, {
2743
+ header: /* @__PURE__ */ jsxs12(Fragment2, {
2224
2744
  children: [
2225
- /* @__PURE__ */ jsx13("span", {
2745
+ /* @__PURE__ */ jsx15("span", {
2226
2746
  children: beforeLabel
2227
2747
  }),
2228
- /* @__PURE__ */ jsx13("span", {
2748
+ /* @__PURE__ */ jsx15("span", {
2229
2749
  children: afterLabel
2230
2750
  })
2231
2751
  ]
2232
2752
  }),
2233
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2753
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2234
2754
  label: `${beforeLabel} and ${afterLabel}`,
2235
2755
  zoom,
2236
2756
  naturalSize: afterImage.size,
@@ -2246,7 +2766,7 @@ ${after.src}`;
2246
2766
  beforeOverlay,
2247
2767
  afterOverlay,
2248
2768
  diffOverlay,
2249
- /* @__PURE__ */ jsx13(ImageSwipeDivider, {
2769
+ /* @__PURE__ */ jsx15(ImageSwipeDivider, {
2250
2770
  value: position,
2251
2771
  onValueChange: handlePositionChange,
2252
2772
  beforeLabel,
@@ -2258,8 +2778,8 @@ ${after.src}`;
2258
2778
  });
2259
2779
  } else {
2260
2780
  const showingLabel = isShowingBefore ? beforeLabel : afterLabel;
2261
- content = /* @__PURE__ */ jsx13(ComparisonPane, {
2262
- header: /* @__PURE__ */ jsxs10("span", {
2781
+ content = /* @__PURE__ */ jsx15(ComparisonPane, {
2782
+ header: /* @__PURE__ */ jsxs12("span", {
2263
2783
  "data-slot": "image-comparison-showing",
2264
2784
  "aria-live": "polite",
2265
2785
  children: [
@@ -2267,7 +2787,7 @@ ${after.src}`;
2267
2787
  showingLabel
2268
2788
  ]
2269
2789
  }),
2270
- children: /* @__PURE__ */ jsxs10(ImageViewport, {
2790
+ children: /* @__PURE__ */ jsxs12(ImageViewport, {
2271
2791
  label: showingLabel,
2272
2792
  zoom,
2273
2793
  naturalSize: afterImage.size,
@@ -2288,7 +2808,7 @@ ${after.src}`;
2288
2808
  })
2289
2809
  });
2290
2810
  }
2291
- return /* @__PURE__ */ jsxs10("div", {
2811
+ return /* @__PURE__ */ jsxs12("div", {
2292
2812
  role: "group",
2293
2813
  "aria-label": label,
2294
2814
  "data-slot": "image-comparison",
@@ -2300,7 +2820,7 @@ ${after.src}`;
2300
2820
  "data-showing": isShowingBefore ? "before" : "after",
2301
2821
  className: "@container flex size-full min-h-0 min-w-0 flex-1 flex-col",
2302
2822
  children: [
2303
- showToolbar && /* @__PURE__ */ jsx13(ImageComparisonToolbar, {
2823
+ showToolbar && /* @__PURE__ */ jsx15(ImageComparisonToolbar, {
2304
2824
  mode,
2305
2825
  onModeChange: setMode,
2306
2826
  side,
@@ -2309,6 +2829,9 @@ ${after.src}`;
2309
2829
  onOrientationChange: setOrientation,
2310
2830
  zoom,
2311
2831
  onZoomChange: setZoom,
2832
+ showZoomControl,
2833
+ zoomScale,
2834
+ zoomScales,
2312
2835
  showDifferences,
2313
2836
  onShowDifferencesChange: setShowDifferences,
2314
2837
  differences,
@@ -2323,14 +2846,14 @@ ${after.src}`;
2323
2846
  toolbar,
2324
2847
  density
2325
2848
  }),
2326
- /* @__PURE__ */ jsx13("div", {
2849
+ /* @__PURE__ */ jsx15("div", {
2327
2850
  ref: stageRef,
2328
2851
  "data-slot": "image-comparison-stage",
2329
2852
  "data-scroll": "none",
2330
2853
  className: "flex min-h-0 min-w-0 flex-1",
2331
2854
  children: content
2332
2855
  }),
2333
- /* @__PURE__ */ jsx13("p", {
2856
+ /* @__PURE__ */ jsx15("p", {
2334
2857
  role: "status",
2335
2858
  "data-slot": "image-comparison-change-announcement",
2336
2859
  className: "sr-only",
@@ -2340,6 +2863,8 @@ ${after.src}`;
2340
2863
  });
2341
2864
  }
2342
2865
  export {
2866
+ DiagramSurface,
2867
+ DiagramViewer,
2343
2868
  FramedImage2 as FramedImage,
2344
2869
  IMAGE_REGION_STEP,
2345
2870
  IMAGE_ZOOM_STEPS,
@@ -2360,12 +2885,17 @@ export {
2360
2885
  computeImageDiff,
2361
2886
  formatImageRegion,
2362
2887
  formatImageZoom,
2888
+ getDiagramSvgSize,
2363
2889
  getImageRegionFromCorners,
2364
2890
  getImageZoomScales,
2891
+ getMermaidThemeConfig,
2365
2892
  getNextImageZoom,
2366
2893
  getNormalizedImagePoint,
2367
2894
  getOpeningImageZoom,
2368
2895
  getPreviousImageZoom,
2369
2896
  placeImageRegion,
2370
- resolveImageZoomScale
2897
+ prepareDiagramSvg,
2898
+ resolveCssColorToHex,
2899
+ resolveImageZoomScale,
2900
+ useMermaidTheme
2371
2901
  };