@almadar/ui 5.25.1 → 5.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/avl/index.cjs +2210 -2295
  2. package/dist/avl/index.js +1159 -1244
  3. package/dist/components/core/atoms/FlipContainer.d.ts +4 -4
  4. package/dist/components/core/atoms/Icon.d.ts +4 -2
  5. package/dist/components/core/atoms/ProgressBar.d.ts +1 -1
  6. package/dist/components/core/atoms/svg/SvgBranch.d.ts +6 -2
  7. package/dist/components/core/atoms/svg/SvgConnection.d.ts +8 -4
  8. package/dist/components/core/atoms/svg/SvgFlow.d.ts +5 -1
  9. package/dist/components/core/atoms/svg/SvgGrid.d.ts +6 -2
  10. package/dist/components/core/atoms/svg/SvgLobe.d.ts +6 -2
  11. package/dist/components/core/atoms/svg/SvgMesh.d.ts +6 -2
  12. package/dist/components/core/atoms/svg/SvgMorph.d.ts +6 -2
  13. package/dist/components/core/atoms/svg/SvgNode.d.ts +6 -2
  14. package/dist/components/core/atoms/svg/SvgPulse.d.ts +6 -2
  15. package/dist/components/core/atoms/svg/SvgRing.d.ts +6 -2
  16. package/dist/components/core/atoms/svg/SvgShield.d.ts +6 -2
  17. package/dist/components/core/atoms/svg/SvgStack.d.ts +6 -2
  18. package/dist/components/core/atoms/types.d.ts +6 -0
  19. package/dist/components/core/molecules/ArrayEditor.d.ts +15 -0
  20. package/dist/components/core/molecules/Carousel.d.ts +8 -2
  21. package/dist/components/core/molecules/Container.d.ts +4 -4
  22. package/dist/components/core/molecules/DateRangeSelector.d.ts +3 -4
  23. package/dist/components/core/molecules/DocSidebar.d.ts +4 -4
  24. package/dist/components/core/molecules/EdgeDecoration.d.ts +3 -2
  25. package/dist/components/core/molecules/Flex.d.ts +4 -4
  26. package/dist/components/core/molecules/FlipCard.d.ts +3 -4
  27. package/dist/components/core/molecules/GradientDivider.d.ts +3 -2
  28. package/dist/components/core/molecules/MapEditor.d.ts +16 -0
  29. package/dist/components/core/molecules/ObjectEditor.d.ts +15 -0
  30. package/dist/components/core/molecules/SidePanel.d.ts +4 -4
  31. package/dist/components/core/molecules/SortableList.d.ts +4 -5
  32. package/dist/components/core/molecules/ViolationAlert.d.ts +4 -9
  33. package/dist/components/core/molecules/index.d.ts +4 -3
  34. package/dist/components/core/molecules/markdown/CodeBlock.d.ts +44 -2
  35. package/dist/components/core/molecules/markdown/MarkdownContent.d.ts +2 -2
  36. package/dist/components/game/atoms/ResourceCounter.d.ts +3 -2
  37. package/dist/components/game/atoms/StateIndicator.d.ts +4 -5
  38. package/dist/components/game/atoms/StatusEffect.d.ts +2 -3
  39. package/dist/components/game/molecules/ActionButtons.d.ts +6 -0
  40. package/dist/components/game/molecules/GameHud.d.ts +2 -3
  41. package/dist/components/game/molecules/StatBadge.d.ts +6 -0
  42. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +16 -0
  43. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  44. package/dist/components/index.cjs +2458 -2092
  45. package/dist/components/index.js +1558 -1192
  46. package/dist/docs/index.cjs +6021 -4606
  47. package/dist/docs/index.css +1252 -0
  48. package/dist/docs/index.d.cts +108 -16
  49. package/dist/docs/index.d.ts +2 -2
  50. package/dist/docs/index.js +5977 -4567
  51. package/dist/hooks/index.cjs +9 -2
  52. package/dist/hooks/index.js +9 -2
  53. package/dist/marketing/index.cjs +32 -9
  54. package/dist/marketing/index.d.cts +30 -20
  55. package/dist/marketing/index.js +32 -9
  56. package/dist/providers/index.cjs +2035 -2120
  57. package/dist/providers/index.js +1134 -1219
  58. package/dist/runtime/index.cjs +2075 -2160
  59. package/dist/runtime/index.js +1138 -1223
  60. package/package.json +1 -1
  61. package/dist/components/core/molecules/CodeViewer.d.ts +0 -70
  62. package/dist/components/core/molecules/DocCodeBlock.d.ts +0 -14
  63. package/dist/components/game/organisms/puzzles/state-architect/CodeView.d.ts +0 -24
@@ -1,5 +1,5 @@
1
- import * as React87 from 'react';
2
- import React87__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId, useSyncExternalStore } from 'react';
1
+ import * as React85 from 'react';
2
+ import React85__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId, useSyncExternalStore } from 'react';
3
3
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
@@ -657,7 +657,7 @@ var init_Box = __esm({
657
657
  fixed: "fixed",
658
658
  sticky: "sticky"
659
659
  };
660
- Box = React87__default.forwardRef(
660
+ Box = React85__default.forwardRef(
661
661
  ({
662
662
  padding,
663
663
  paddingX,
@@ -707,7 +707,7 @@ var init_Box = __esm({
707
707
  onMouseLeave?.(e);
708
708
  }, [hoverEvent, eventBus, onMouseLeave]);
709
709
  const isClickable = action || onClick;
710
- return React87__default.createElement(
710
+ return React85__default.createElement(
711
711
  Component,
712
712
  {
713
713
  ref,
@@ -1446,12 +1446,20 @@ function doResolve(name) {
1446
1446
  if (asIs && typeof asIs === "object") return asIs;
1447
1447
  return LucideIcons2.HelpCircle;
1448
1448
  }
1449
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1449
+ var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1450
1450
  var init_Icon = __esm({
1451
1451
  "components/core/atoms/Icon.tsx"() {
1452
1452
  "use client";
1453
1453
  init_cn();
1454
1454
  init_iconFamily();
1455
+ colorTokenClasses = {
1456
+ primary: "text-primary",
1457
+ secondary: "text-secondary",
1458
+ success: "text-success",
1459
+ warning: "text-warning",
1460
+ error: "text-error",
1461
+ muted: "text-muted-foreground"
1462
+ };
1455
1463
  iconAliases = {
1456
1464
  "close": LucideIcons2.X,
1457
1465
  "trash": LucideIcons2.Trash2,
@@ -1490,7 +1498,7 @@ var init_Icon = __esm({
1490
1498
  const directIcon = typeof icon === "string" ? void 0 : icon;
1491
1499
  const effectiveName = typeof icon === "string" ? icon : name;
1492
1500
  const family = useIconFamily();
1493
- const RenderedComponent = React87__default.useMemo(() => {
1501
+ const RenderedComponent = React85__default.useMemo(() => {
1494
1502
  if (directIcon) return null;
1495
1503
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1496
1504
  }, [directIcon, effectiveName, family]);
@@ -1499,10 +1507,11 @@ var init_Icon = __esm({
1499
1507
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
1500
1508
  ...style
1501
1509
  };
1510
+ const resolvedColor = color ? color in colorTokenClasses ? colorTokenClasses[color] : color : "text-current";
1502
1511
  const composedClassName = cn(
1503
1512
  sizeClasses[size],
1504
1513
  animationClasses[animation],
1505
- color ? color : "text-current",
1514
+ resolvedColor,
1506
1515
  className
1507
1516
  );
1508
1517
  if (directIcon) {
@@ -1548,7 +1557,7 @@ function resolveIconProp(value, sizeClass) {
1548
1557
  const IconComp = value;
1549
1558
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1550
1559
  }
1551
- if (React87__default.isValidElement(value)) {
1560
+ if (React85__default.isValidElement(value)) {
1552
1561
  return value;
1553
1562
  }
1554
1563
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1624,7 +1633,7 @@ var init_Button = __esm({
1624
1633
  md: "h-icon-default w-icon-default",
1625
1634
  lg: "h-icon-default w-icon-default"
1626
1635
  };
1627
- Button = React87__default.forwardRef(
1636
+ Button = React85__default.forwardRef(
1628
1637
  ({
1629
1638
  className,
1630
1639
  variant = "primary",
@@ -1689,7 +1698,7 @@ var Dialog;
1689
1698
  var init_Dialog = __esm({
1690
1699
  "components/core/atoms/Dialog.tsx"() {
1691
1700
  init_cn();
1692
- Dialog = React87__default.forwardRef(
1701
+ Dialog = React85__default.forwardRef(
1693
1702
  ({
1694
1703
  role = "dialog",
1695
1704
  "aria-modal": ariaModal = true,
@@ -1830,43 +1839,6 @@ var init_Typography = __esm({
1830
1839
  Typography.displayName = "Typography";
1831
1840
  }
1832
1841
  });
1833
- var Overlay;
1834
- var init_Overlay = __esm({
1835
- "components/core/atoms/Overlay.tsx"() {
1836
- "use client";
1837
- init_cn();
1838
- init_useEventBus();
1839
- Overlay = ({
1840
- isVisible = true,
1841
- onClick,
1842
- className,
1843
- blur = false,
1844
- action
1845
- }) => {
1846
- const eventBus = useEventBus();
1847
- if (!isVisible) return null;
1848
- const handleClick = (e) => {
1849
- if (action) {
1850
- eventBus.emit(`UI:${action}`, {});
1851
- }
1852
- onClick?.(e);
1853
- };
1854
- return /* @__PURE__ */ jsx(
1855
- "div",
1856
- {
1857
- className: cn(
1858
- "fixed inset-0 z-40",
1859
- blur && "backdrop-blur-sm",
1860
- className
1861
- ),
1862
- style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1863
- onClick: action || onClick ? handleClick : void 0,
1864
- "aria-hidden": "true"
1865
- }
1866
- );
1867
- };
1868
- }
1869
- });
1870
1842
  var sizeClasses2, minWidthClasses, lookStyles, Modal;
1871
1843
  var init_Modal = __esm({
1872
1844
  "components/core/molecules/Modal.tsx"() {
@@ -1875,7 +1847,6 @@ var init_Modal = __esm({
1875
1847
  init_Button();
1876
1848
  init_Dialog();
1877
1849
  init_Typography();
1878
- init_Overlay();
1879
1850
  init_cn();
1880
1851
  init_useEventBus();
1881
1852
  sizeClasses2 = {
@@ -1965,130 +1936,160 @@ var init_Modal = __esm({
1965
1936
  }
1966
1937
  };
1967
1938
  return createPortal(
1968
- /* @__PURE__ */ jsxs(Fragment, { children: [
1969
- /* @__PURE__ */ jsx(
1970
- Overlay,
1971
- {
1972
- isVisible: isOpen,
1973
- onClick: handleOverlayClick,
1974
- className: "z-[1000]"
1975
- }
1976
- ),
1977
- /* @__PURE__ */ jsx(
1978
- Box,
1979
- {
1980
- className: cn(
1981
- "fixed inset-0 z-[1001] pointer-events-none",
1982
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
1983
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
1984
- ),
1985
- children: /* @__PURE__ */ jsxs(
1986
- Dialog,
1987
- {
1988
- ref: modalRef,
1989
- open: true,
1990
- className: cn(
1991
- // Reset browser-default dialog chrome — we own styling. `static`
1992
- // overrides the user-agent `position: absolute` so the parent
1993
- // flex container's `justify-center` actually centers the dialog
1994
- // (without this, the dialog drops out of flex flow and `m-0`
1995
- // kills the user-agent's `margin: auto` centering, pinning the
1996
- // dialog to top-left).
1997
- "static m-0 p-0 border-0 bg-transparent",
1998
- // Pre-existing dialog frame
1999
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
2000
- // Desktop sizing + viewport-aware floor.
2001
- sizeClasses2[size],
2002
- minWidthClasses[size],
2003
- "max-h-[80vh]",
2004
- // Mobile: take the entire screen. Override desktop max-w cap,
2005
- // full height, no rounded corners, no min-width.
2006
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
2007
- lookStyles[look],
2008
- className
1939
+ /* @__PURE__ */ jsx(
1940
+ "div",
1941
+ {
1942
+ className: cn(
1943
+ "fixed inset-0 z-[1000]",
1944
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
1945
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
1946
+ ),
1947
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
1948
+ onClick: handleOverlayClick,
1949
+ "aria-hidden": "true",
1950
+ children: /* @__PURE__ */ jsxs(
1951
+ Dialog,
1952
+ {
1953
+ ref: modalRef,
1954
+ open: true,
1955
+ className: cn(
1956
+ // Reset browser-default dialog chrome — we own styling. `static`
1957
+ // overrides the user-agent `position: absolute` so the parent
1958
+ // flex container's `justify-center` actually centers the dialog
1959
+ // (without this, the dialog drops out of flex flow and `m-0`
1960
+ // kills the user-agent's `margin: auto` centering, pinning the
1961
+ // dialog to top-left).
1962
+ "static m-0 p-0 border-0 bg-transparent",
1963
+ // Pre-existing dialog frame
1964
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
1965
+ // Desktop sizing + viewport-aware floor.
1966
+ sizeClasses2[size],
1967
+ minWidthClasses[size],
1968
+ "max-h-[80vh]",
1969
+ // Mobile: take the entire screen. Override desktop max-w cap,
1970
+ // full height, no rounded corners, no min-width.
1971
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
1972
+ lookStyles[look],
1973
+ className
1974
+ ),
1975
+ style: dragY > 0 ? {
1976
+ transform: `translateY(${dragY}px)`,
1977
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
1978
+ } : void 0,
1979
+ ...title && { "aria-labelledby": "modal-title" },
1980
+ children: [
1981
+ /* @__PURE__ */ jsx(
1982
+ Box,
1983
+ {
1984
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
1985
+ onPointerDown: (e) => {
1986
+ if (!swipeDownToClose) return;
1987
+ dragStartY.current = e.clientY;
1988
+ isDragging.current = true;
1989
+ e.target.setPointerCapture(e.pointerId);
1990
+ },
1991
+ onPointerMove: (e) => {
1992
+ if (!isDragging.current) return;
1993
+ const dy = Math.max(0, e.clientY - dragStartY.current);
1994
+ setDragY(dy);
1995
+ },
1996
+ onPointerUp: () => {
1997
+ if (!isDragging.current) return;
1998
+ isDragging.current = false;
1999
+ if (dragY > 100) {
2000
+ handleClose();
2001
+ }
2002
+ setDragY(0);
2003
+ },
2004
+ onPointerCancel: () => {
2005
+ isDragging.current = false;
2006
+ setDragY(0);
2007
+ },
2008
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
2009
+ }
2009
2010
  ),
2010
- style: dragY > 0 ? {
2011
- transform: `translateY(${dragY}px)`,
2012
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
2013
- } : void 0,
2014
- ...title && { "aria-labelledby": "modal-title" },
2015
- children: [
2016
- /* @__PURE__ */ jsx(
2017
- Box,
2018
- {
2019
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
2020
- onPointerDown: (e) => {
2021
- if (!swipeDownToClose) return;
2022
- dragStartY.current = e.clientY;
2023
- isDragging.current = true;
2024
- e.target.setPointerCapture(e.pointerId);
2025
- },
2026
- onPointerMove: (e) => {
2027
- if (!isDragging.current) return;
2028
- const dy = Math.max(0, e.clientY - dragStartY.current);
2029
- setDragY(dy);
2030
- },
2031
- onPointerUp: () => {
2032
- if (!isDragging.current) return;
2033
- isDragging.current = false;
2034
- if (dragY > 100) {
2035
- handleClose();
2011
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
2012
+ Box,
2013
+ {
2014
+ className: cn(
2015
+ "px-6 py-4 flex items-center justify-between",
2016
+ "border-b-[length:var(--border-width)] border-border"
2017
+ ),
2018
+ children: [
2019
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
2020
+ showCloseButton && /* @__PURE__ */ jsx(
2021
+ Button,
2022
+ {
2023
+ variant: "ghost",
2024
+ size: "sm",
2025
+ icon: "x",
2026
+ onClick: handleClose,
2027
+ "data-event": "CLOSE",
2028
+ "aria-label": t("aria.closeModal")
2036
2029
  }
2037
- setDragY(0);
2038
- },
2039
- onPointerCancel: () => {
2040
- isDragging.current = false;
2041
- setDragY(0);
2042
- },
2043
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
2044
- }
2045
- ),
2046
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
2047
- Box,
2048
- {
2049
- className: cn(
2050
- "px-6 py-4 flex items-center justify-between",
2051
- "border-b-[length:var(--border-width)] border-border"
2052
- ),
2053
- children: [
2054
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
2055
- showCloseButton && /* @__PURE__ */ jsx(
2056
- Button,
2057
- {
2058
- variant: "ghost",
2059
- size: "sm",
2060
- icon: "x",
2061
- onClick: handleClose,
2062
- "data-event": "CLOSE",
2063
- "aria-label": t("aria.closeModal")
2064
- }
2065
- )
2066
- ]
2067
- }
2068
- ),
2069
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
2070
- footer && /* @__PURE__ */ jsx(
2071
- Box,
2072
- {
2073
- className: cn(
2074
- "px-6 py-4 bg-muted",
2075
- "border-t-[length:var(--border-width)] border-border"
2076
- ),
2077
- children: footer
2078
- }
2079
- )
2080
- ]
2081
- }
2082
- )
2083
- }
2084
- )
2085
- ] }),
2030
+ )
2031
+ ]
2032
+ }
2033
+ ),
2034
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
2035
+ footer && /* @__PURE__ */ jsx(
2036
+ Box,
2037
+ {
2038
+ className: cn(
2039
+ "px-6 py-4 bg-muted",
2040
+ "border-t-[length:var(--border-width)] border-border"
2041
+ ),
2042
+ children: footer
2043
+ }
2044
+ )
2045
+ ]
2046
+ }
2047
+ )
2048
+ }
2049
+ ),
2086
2050
  document.body
2087
2051
  );
2088
2052
  };
2089
2053
  Modal.displayName = "Modal";
2090
2054
  }
2091
2055
  });
2056
+ var Overlay;
2057
+ var init_Overlay = __esm({
2058
+ "components/core/atoms/Overlay.tsx"() {
2059
+ "use client";
2060
+ init_cn();
2061
+ init_useEventBus();
2062
+ Overlay = ({
2063
+ isVisible = true,
2064
+ onClick,
2065
+ className,
2066
+ blur = false,
2067
+ action
2068
+ }) => {
2069
+ const eventBus = useEventBus();
2070
+ if (!isVisible) return null;
2071
+ const handleClick = (e) => {
2072
+ if (action) {
2073
+ eventBus.emit(`UI:${action}`, {});
2074
+ }
2075
+ onClick?.(e);
2076
+ };
2077
+ return /* @__PURE__ */ jsx(
2078
+ "div",
2079
+ {
2080
+ className: cn(
2081
+ "fixed inset-0 z-40",
2082
+ blur && "backdrop-blur-sm",
2083
+ className
2084
+ ),
2085
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
2086
+ onClick: action || onClick ? handleClick : void 0,
2087
+ "aria-hidden": "true"
2088
+ }
2089
+ );
2090
+ };
2091
+ }
2092
+ });
2092
2093
  var sizeWidths, Drawer;
2093
2094
  var init_Drawer = __esm({
2094
2095
  "components/core/molecules/Drawer.tsx"() {
@@ -2311,7 +2312,7 @@ var init_Badge = __esm({
2311
2312
  md: "px-2.5 py-1 text-sm",
2312
2313
  lg: "px-3 py-1.5 text-base"
2313
2314
  };
2314
- Badge = React87__default.forwardRef(
2315
+ Badge = React85__default.forwardRef(
2315
2316
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2316
2317
  const iconSizes3 = {
2317
2318
  sm: "h-icon-default w-icon-default",
@@ -2532,18 +2533,22 @@ var init_SvgBranch = __esm({
2532
2533
  "components/core/atoms/svg/SvgBranch.tsx"() {
2533
2534
  "use client";
2534
2535
  SvgBranch = ({
2535
- x,
2536
- y,
2536
+ x = 5,
2537
+ y = 50,
2537
2538
  variant = "fork",
2538
2539
  branches = 2,
2539
2540
  size = 1,
2540
2541
  color = "var(--color-primary)",
2541
2542
  opacity = 1,
2542
- className
2543
+ className,
2544
+ asRoot = true,
2545
+ width = 100,
2546
+ height = 100
2543
2547
  }) => {
2548
+ let inner;
2544
2549
  if (variant === "diamond") {
2545
2550
  const points = buildDiamondPoints(x, y, size);
2546
- return /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
2551
+ inner = /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
2547
2552
  "polygon",
2548
2553
  {
2549
2554
  points,
@@ -2553,23 +2558,28 @@ var init_SvgBranch = __esm({
2553
2558
  strokeLinejoin: "round"
2554
2559
  }
2555
2560
  ) });
2561
+ } else {
2562
+ const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
2563
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2564
+ paths.map((d, i) => /* @__PURE__ */ jsx(
2565
+ "path",
2566
+ {
2567
+ d,
2568
+ fill: "none",
2569
+ stroke: color,
2570
+ strokeWidth: 2,
2571
+ strokeLinecap: "round"
2572
+ },
2573
+ i
2574
+ )),
2575
+ variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
2576
+ variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
2577
+ ] });
2556
2578
  }
2557
- const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
2558
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2559
- paths.map((d, i) => /* @__PURE__ */ jsx(
2560
- "path",
2561
- {
2562
- d,
2563
- fill: "none",
2564
- stroke: color,
2565
- strokeWidth: 2,
2566
- strokeLinecap: "round"
2567
- },
2568
- i
2569
- )),
2570
- variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
2571
- variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
2572
- ] });
2579
+ if (asRoot) {
2580
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2581
+ }
2582
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
2573
2583
  };
2574
2584
  SvgBranch.displayName = "SvgBranch";
2575
2585
  }
@@ -2579,20 +2589,23 @@ var init_SvgConnection = __esm({
2579
2589
  "components/core/atoms/svg/SvgConnection.tsx"() {
2580
2590
  "use client";
2581
2591
  SvgConnection = ({
2582
- x1,
2583
- y1,
2584
- x2,
2585
- y2,
2592
+ x1 = 10,
2593
+ y1 = 50,
2594
+ x2 = 90,
2595
+ y2 = 50,
2586
2596
  variant = "solid",
2587
2597
  color = "var(--color-primary)",
2588
2598
  strokeWidth = 1.5,
2589
2599
  opacity = 1,
2590
- className
2600
+ className,
2601
+ asRoot = true,
2602
+ width = 100,
2603
+ height = 100
2591
2604
  }) => {
2592
2605
  const dashProps = variant === "solid" ? {} : {
2593
2606
  strokeDasharray: "8 6"
2594
2607
  };
2595
- return /* @__PURE__ */ jsx(
2608
+ const inner = /* @__PURE__ */ jsx(
2596
2609
  "line",
2597
2610
  {
2598
2611
  className: [
@@ -2610,24 +2623,32 @@ var init_SvgConnection = __esm({
2610
2623
  ...dashProps
2611
2624
  }
2612
2625
  );
2626
+ if (asRoot) {
2627
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2628
+ }
2629
+ return inner;
2613
2630
  };
2614
2631
  SvgConnection.displayName = "SvgConnection";
2615
2632
  }
2616
2633
  });
2617
- var flowIdCounter, SvgFlow;
2634
+ var flowIdCounter, DEFAULT_POINTS, SvgFlow;
2618
2635
  var init_SvgFlow = __esm({
2619
2636
  "components/core/atoms/svg/SvgFlow.tsx"() {
2620
2637
  "use client";
2621
2638
  flowIdCounter = 0;
2639
+ DEFAULT_POINTS = [[10, 50], [50, 20], [90, 50]];
2622
2640
  SvgFlow = ({
2623
- points,
2641
+ points = DEFAULT_POINTS,
2624
2642
  color = "var(--color-primary)",
2625
2643
  strokeWidth = 1.5,
2626
2644
  animated = false,
2627
2645
  opacity = 1,
2628
- className
2646
+ className,
2647
+ asRoot = true,
2648
+ width = 100,
2649
+ height = 100
2629
2650
  }) => {
2630
- const markerId = React87__default.useMemo(() => {
2651
+ const markerId = React85__default.useMemo(() => {
2631
2652
  flowIdCounter += 1;
2632
2653
  return `almadar-flow-arrow-${flowIdCounter}`;
2633
2654
  }, []);
@@ -2635,7 +2656,7 @@ var init_SvgFlow = __esm({
2635
2656
  return null;
2636
2657
  }
2637
2658
  const pathData = points.map((pt, i) => `${i === 0 ? "M" : "L"}${pt[0]},${pt[1]}`).join(" ");
2638
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2659
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2639
2660
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
2640
2661
  "marker",
2641
2662
  {
@@ -2664,6 +2685,10 @@ var init_SvgFlow = __esm({
2664
2685
  }
2665
2686
  )
2666
2687
  ] });
2688
+ if (asRoot) {
2689
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2690
+ }
2691
+ return inner;
2667
2692
  };
2668
2693
  SvgFlow.displayName = "SvgFlow";
2669
2694
  }
@@ -2673,8 +2698,8 @@ var init_SvgGrid = __esm({
2673
2698
  "components/core/atoms/svg/SvgGrid.tsx"() {
2674
2699
  "use client";
2675
2700
  SvgGrid = ({
2676
- x,
2677
- y,
2701
+ x = 10,
2702
+ y = 10,
2678
2703
  cols = 4,
2679
2704
  rows: rows2 = 3,
2680
2705
  spacing = 20,
@@ -2682,10 +2707,13 @@ var init_SvgGrid = __esm({
2682
2707
  color = "var(--color-primary)",
2683
2708
  opacity = 1,
2684
2709
  className,
2685
- highlights = []
2710
+ highlights = [],
2711
+ asRoot = true,
2712
+ width = 100,
2713
+ height = 100
2686
2714
  }) => {
2687
2715
  const highlightSet = new Set(highlights);
2688
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
2716
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
2689
2717
  (_, row) => Array.from({ length: cols }).map((_2, col) => {
2690
2718
  const index = row * cols + col;
2691
2719
  const isHighlighted = highlightSet.has(index);
@@ -2704,6 +2732,10 @@ var init_SvgGrid = __esm({
2704
2732
  );
2705
2733
  })
2706
2734
  ) });
2735
+ if (asRoot) {
2736
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2737
+ }
2738
+ return inner;
2707
2739
  };
2708
2740
  SvgGrid.displayName = "SvgGrid";
2709
2741
  }
@@ -2713,15 +2745,18 @@ var init_SvgLobe = __esm({
2713
2745
  "components/core/atoms/svg/SvgLobe.tsx"() {
2714
2746
  "use client";
2715
2747
  SvgLobe = ({
2716
- cx,
2717
- cy,
2748
+ cx = 50,
2749
+ cy = 50,
2718
2750
  rx = 14,
2719
2751
  ry = 20,
2720
2752
  rotation = 0,
2721
2753
  shells = 2,
2722
2754
  color = "var(--color-primary)",
2723
2755
  opacity = 1,
2724
- className
2756
+ className,
2757
+ asRoot = true,
2758
+ width = 100,
2759
+ height = 100
2725
2760
  }) => {
2726
2761
  const clampedShells = Math.max(1, Math.min(3, shells));
2727
2762
  const renderShell = (shellIndex) => {
@@ -2756,7 +2791,7 @@ var init_SvgLobe = __esm({
2756
2791
  )
2757
2792
  ] }, shellIndex);
2758
2793
  };
2759
- return /* @__PURE__ */ jsx(
2794
+ const inner = /* @__PURE__ */ jsx(
2760
2795
  "g",
2761
2796
  {
2762
2797
  className,
@@ -2765,6 +2800,10 @@ var init_SvgLobe = __esm({
2765
2800
  children: Array.from({ length: clampedShells }, (_, i) => renderShell(i))
2766
2801
  }
2767
2802
  );
2803
+ if (asRoot) {
2804
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2805
+ }
2806
+ return inner;
2768
2807
  };
2769
2808
  SvgLobe.displayName = "SvgLobe";
2770
2809
  }
@@ -2793,18 +2832,21 @@ var init_SvgMesh = __esm({
2793
2832
  "components/core/atoms/svg/SvgMesh.tsx"() {
2794
2833
  "use client";
2795
2834
  SvgMesh = ({
2796
- cx,
2797
- cy,
2835
+ cx = 60,
2836
+ cy = 60,
2798
2837
  nodes = 6,
2799
2838
  radius = 50,
2800
2839
  color = "var(--color-primary)",
2801
2840
  connectionDensity = 0.5,
2802
2841
  opacity = 1,
2803
- className
2842
+ className,
2843
+ asRoot = true,
2844
+ width = 120,
2845
+ height = 120
2804
2846
  }) => {
2805
2847
  const positions = getNodePositions(cx, cy, nodes, radius);
2806
2848
  const connections = getConnections(nodes, connectionDensity);
2807
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2849
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2808
2850
  connections.map(([a, b]) => /* @__PURE__ */ jsx(
2809
2851
  "line",
2810
2852
  {
@@ -2829,6 +2871,10 @@ var init_SvgMesh = __esm({
2829
2871
  i
2830
2872
  ))
2831
2873
  ] });
2874
+ if (asRoot) {
2875
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
2876
+ }
2877
+ return inner;
2832
2878
  };
2833
2879
  SvgMesh.displayName = "SvgMesh";
2834
2880
  }
@@ -2970,74 +3016,82 @@ var init_SvgMorph = __esm({
2970
3016
  };
2971
3017
  FlowArrow.displayName = "FlowArrow";
2972
3018
  SvgMorph = ({
2973
- x,
2974
- y,
3019
+ x = 5,
3020
+ y = 10,
2975
3021
  size = 1,
2976
3022
  variant = "generic",
2977
3023
  color = "var(--color-primary)",
2978
3024
  opacity = 1,
2979
- className
3025
+ className,
3026
+ asRoot = true,
3027
+ width = 130,
3028
+ height = 50
2980
3029
  }) => {
2981
3030
  const gap = 40 * size;
2982
3031
  const midY = y + 10 * size;
3032
+ let inner;
2983
3033
  if (variant === "text-to-code") {
2984
3034
  const leftEnd = x + 30 * size;
2985
3035
  const rightStart = leftEnd + gap;
2986
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3036
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2987
3037
  /* @__PURE__ */ jsx(TextLines, { x, y, scale: size, color }),
2988
3038
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
2989
3039
  /* @__PURE__ */ jsx(CodeBrackets, { x: rightStart, y, scale: size, color })
2990
3040
  ] });
2991
- }
2992
- if (variant === "code-to-app") {
3041
+ } else if (variant === "code-to-app") {
2993
3042
  const leftEnd = x + 26 * size;
2994
3043
  const rightStart = leftEnd + gap;
2995
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3044
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
2996
3045
  /* @__PURE__ */ jsx(CodeBrackets, { x, y, scale: size, color }),
2997
3046
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
2998
3047
  /* @__PURE__ */ jsx(AppRect, { x: rightStart, y, scale: size, color })
2999
3048
  ] });
3049
+ } else {
3050
+ const circleR = 10 * size;
3051
+ const circleX = x + circleR;
3052
+ const squareStart = x + circleR * 2 + gap;
3053
+ const squareSize = circleR * 2;
3054
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3055
+ /* @__PURE__ */ jsx(
3056
+ "circle",
3057
+ {
3058
+ cx: circleX,
3059
+ cy: midY,
3060
+ r: circleR,
3061
+ fill: "none",
3062
+ stroke: color,
3063
+ strokeWidth: 2 * size
3064
+ }
3065
+ ),
3066
+ /* @__PURE__ */ jsx(
3067
+ FlowArrow,
3068
+ {
3069
+ x1: circleX + circleR + 2 * size,
3070
+ y: midY,
3071
+ x2: squareStart,
3072
+ scale: size,
3073
+ color
3074
+ }
3075
+ ),
3076
+ /* @__PURE__ */ jsx(
3077
+ "rect",
3078
+ {
3079
+ x: squareStart,
3080
+ y: midY - circleR,
3081
+ width: squareSize,
3082
+ height: squareSize,
3083
+ rx: 3 * size,
3084
+ fill: "none",
3085
+ stroke: color,
3086
+ strokeWidth: 2 * size
3087
+ }
3088
+ )
3089
+ ] });
3000
3090
  }
3001
- const circleR = 10 * size;
3002
- const circleX = x + circleR;
3003
- const squareStart = x + circleR * 2 + gap;
3004
- const squareSize = circleR * 2;
3005
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3006
- /* @__PURE__ */ jsx(
3007
- "circle",
3008
- {
3009
- cx: circleX,
3010
- cy: midY,
3011
- r: circleR,
3012
- fill: "none",
3013
- stroke: color,
3014
- strokeWidth: 2 * size
3015
- }
3016
- ),
3017
- /* @__PURE__ */ jsx(
3018
- FlowArrow,
3019
- {
3020
- x1: circleX + circleR + 2 * size,
3021
- y: midY,
3022
- x2: squareStart,
3023
- scale: size,
3024
- color
3025
- }
3026
- ),
3027
- /* @__PURE__ */ jsx(
3028
- "rect",
3029
- {
3030
- x: squareStart,
3031
- y: midY - circleR,
3032
- width: squareSize,
3033
- height: squareSize,
3034
- rx: 3 * size,
3035
- fill: "none",
3036
- stroke: color,
3037
- strokeWidth: 2 * size
3038
- }
3039
- )
3040
- ] });
3091
+ if (asRoot) {
3092
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3093
+ }
3094
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
3041
3095
  };
3042
3096
  SvgMorph.displayName = "SvgMorph";
3043
3097
  }
@@ -3047,16 +3101,19 @@ var init_SvgNode = __esm({
3047
3101
  "components/core/atoms/svg/SvgNode.tsx"() {
3048
3102
  "use client";
3049
3103
  SvgNode = ({
3050
- x,
3051
- y,
3104
+ x = 50,
3105
+ y = 50,
3052
3106
  r = 6,
3053
3107
  variant = "filled",
3054
3108
  color = "var(--color-primary)",
3055
3109
  opacity = 1,
3056
3110
  className,
3057
- label
3111
+ label,
3112
+ asRoot = true,
3113
+ width = 100,
3114
+ height = 100
3058
3115
  }) => {
3059
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3116
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3060
3117
  variant === "pulse" && /* @__PURE__ */ jsx(
3061
3118
  "circle",
3062
3119
  {
@@ -3094,6 +3151,10 @@ var init_SvgNode = __esm({
3094
3151
  }
3095
3152
  )
3096
3153
  ] });
3154
+ if (asRoot) {
3155
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3156
+ }
3157
+ return inner;
3097
3158
  };
3098
3159
  SvgNode.displayName = "SvgNode";
3099
3160
  }
@@ -3115,16 +3176,19 @@ var init_SvgPulse = __esm({
3115
3176
  }
3116
3177
  `;
3117
3178
  SvgPulse = ({
3118
- cx,
3119
- cy,
3179
+ cx = 70,
3180
+ cy = 70,
3120
3181
  rings = 3,
3121
3182
  maxRadius = 60,
3122
3183
  color = "var(--color-primary)",
3123
3184
  animated = true,
3124
3185
  opacity = 1,
3125
- className
3186
+ className,
3187
+ asRoot = true,
3188
+ width = 140,
3189
+ height = 140
3126
3190
  }) => {
3127
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3191
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3128
3192
  animated && /* @__PURE__ */ jsx("style", { children: PULSE_KEYFRAMES }),
3129
3193
  Array.from({ length: rings }).map((_, i) => {
3130
3194
  const ringRadius = (i + 1) / rings * maxRadius;
@@ -3150,6 +3214,10 @@ var init_SvgPulse = __esm({
3150
3214
  }),
3151
3215
  /* @__PURE__ */ jsx("circle", { cx, cy, r: 3, fill: color })
3152
3216
  ] });
3217
+ if (asRoot) {
3218
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3219
+ }
3220
+ return inner;
3153
3221
  };
3154
3222
  SvgPulse.displayName = "SvgPulse";
3155
3223
  }
@@ -3160,21 +3228,24 @@ var init_SvgRing = __esm({
3160
3228
  "use client";
3161
3229
  ringIdCounter = 0;
3162
3230
  SvgRing = ({
3163
- cx,
3164
- cy,
3231
+ cx = 50,
3232
+ cy = 50,
3165
3233
  r = 40,
3166
3234
  variant = "solid",
3167
3235
  color = "var(--color-primary)",
3168
3236
  strokeWidth = 1.5,
3169
3237
  opacity = 1,
3170
3238
  className,
3171
- label
3239
+ label,
3240
+ asRoot = true,
3241
+ width = 100,
3242
+ height = 100
3172
3243
  }) => {
3173
- const gradientId = React87__default.useMemo(() => {
3244
+ const gradientId = React85__default.useMemo(() => {
3174
3245
  ringIdCounter += 1;
3175
3246
  return `almadar-ring-glow-${ringIdCounter}`;
3176
3247
  }, []);
3177
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3248
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
3178
3249
  variant === "glow" && /* @__PURE__ */ jsxs(Fragment, { children: [
3179
3250
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("radialGradient", { id: gradientId, cx: "50%", cy: "50%", r: "50%", children: [
3180
3251
  /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
@@ -3207,6 +3278,10 @@ var init_SvgRing = __esm({
3207
3278
  }
3208
3279
  )
3209
3280
  ] });
3281
+ if (asRoot) {
3282
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3283
+ }
3284
+ return inner;
3210
3285
  };
3211
3286
  SvgRing.displayName = "SvgRing";
3212
3287
  }
@@ -3218,15 +3293,18 @@ var init_SvgShield = __esm({
3218
3293
  SHIELD_PATH = "M15,2 C15,2 5,5 2,6 C2,6 2,18 5,24 C8,30 15,34 15,34 C15,34 22,30 25,24 C28,18 28,6 28,6 C25,5 15,2 15,2 Z";
3219
3294
  CHECK_PATH = "M10,18 L14,22 L21,13";
3220
3295
  SvgShield = ({
3221
- x,
3222
- y,
3296
+ x = 50,
3297
+ y = 50,
3223
3298
  size = 1,
3224
3299
  variant = "outline",
3225
3300
  color = "var(--color-primary)",
3226
3301
  opacity = 1,
3227
- className
3302
+ className,
3303
+ asRoot = true,
3304
+ width = 100,
3305
+ height = 100
3228
3306
  }) => {
3229
- return /* @__PURE__ */ jsxs(
3307
+ const inner = /* @__PURE__ */ jsxs(
3230
3308
  "g",
3231
3309
  {
3232
3310
  className,
@@ -3257,6 +3335,10 @@ var init_SvgShield = __esm({
3257
3335
  ]
3258
3336
  }
3259
3337
  );
3338
+ if (asRoot) {
3339
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
3340
+ }
3341
+ return inner;
3260
3342
  };
3261
3343
  SvgShield.displayName = "SvgShield";
3262
3344
  }
@@ -3266,20 +3348,23 @@ var init_SvgStack = __esm({
3266
3348
  "components/core/atoms/svg/SvgStack.tsx"() {
3267
3349
  "use client";
3268
3350
  SvgStack = ({
3269
- x,
3270
- y,
3351
+ x = 10,
3352
+ y = 40,
3271
3353
  layers: rawLayers = 3,
3272
3354
  width = 60,
3273
3355
  height = 40,
3274
3356
  color = "var(--color-primary)",
3275
3357
  opacity = 1,
3276
3358
  className,
3277
- labels
3359
+ labels,
3360
+ asRoot = true,
3361
+ svgWidth = 90,
3362
+ svgHeight = 80
3278
3363
  }) => {
3279
3364
  const layers = Math.max(2, Math.min(4, rawLayers));
3280
3365
  const verticalOffset = 8;
3281
3366
  const horizontalOffset = 4;
3282
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
3367
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
3283
3368
  const layerIndex = layers - 1 - i;
3284
3369
  const layerX = x + layerIndex * horizontalOffset;
3285
3370
  const layerY = y - layerIndex * verticalOffset;
@@ -3317,6 +3402,10 @@ var init_SvgStack = __esm({
3317
3402
  )
3318
3403
  ] }, layerIndex);
3319
3404
  }) });
3405
+ if (asRoot) {
3406
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${svgWidth} ${svgHeight}`, width: svgWidth, height: svgHeight, children: inner });
3407
+ }
3408
+ return inner;
3320
3409
  };
3321
3410
  SvgStack.displayName = "SvgStack";
3322
3411
  }
@@ -3332,7 +3421,7 @@ var init_Input = __esm({
3332
3421
  "components/core/atoms/Input.tsx"() {
3333
3422
  init_cn();
3334
3423
  init_Icon();
3335
- Input = React87__default.forwardRef(
3424
+ Input = React85__default.forwardRef(
3336
3425
  ({
3337
3426
  className,
3338
3427
  inputType,
@@ -3453,7 +3542,7 @@ var Label;
3453
3542
  var init_Label = __esm({
3454
3543
  "components/core/atoms/Label.tsx"() {
3455
3544
  init_cn();
3456
- Label = React87__default.forwardRef(
3545
+ Label = React85__default.forwardRef(
3457
3546
  ({ className, required, children, ...props }, ref) => {
3458
3547
  return /* @__PURE__ */ jsxs(
3459
3548
  "label",
@@ -3479,7 +3568,7 @@ var Textarea;
3479
3568
  var init_Textarea = __esm({
3480
3569
  "components/core/atoms/Textarea.tsx"() {
3481
3570
  init_cn();
3482
- Textarea = React87__default.forwardRef(
3571
+ Textarea = React85__default.forwardRef(
3483
3572
  ({ className, error, ...props }, ref) => {
3484
3573
  return /* @__PURE__ */ jsx(
3485
3574
  "textarea",
@@ -3509,7 +3598,7 @@ var init_Select = __esm({
3509
3598
  "components/core/atoms/Select.tsx"() {
3510
3599
  init_cn();
3511
3600
  init_Icon();
3512
- Select = React87__default.forwardRef(
3601
+ Select = React85__default.forwardRef(
3513
3602
  ({ className, options, placeholder, error, ...props }, ref) => {
3514
3603
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3515
3604
  /* @__PURE__ */ jsxs(
@@ -3551,7 +3640,7 @@ var Checkbox;
3551
3640
  var init_Checkbox = __esm({
3552
3641
  "components/core/atoms/Checkbox.tsx"() {
3553
3642
  init_cn();
3554
- Checkbox = React87__default.forwardRef(
3643
+ Checkbox = React85__default.forwardRef(
3555
3644
  ({ className, label, id, ...props }, ref) => {
3556
3645
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3557
3646
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -3642,7 +3731,7 @@ var init_Card = __esm({
3642
3731
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3643
3732
  "tile-image-first": "p-0 overflow-hidden"
3644
3733
  };
3645
- Card = React87__default.forwardRef(
3734
+ Card = React85__default.forwardRef(
3646
3735
  ({
3647
3736
  className,
3648
3737
  variant = "bordered",
@@ -3680,9 +3769,9 @@ var init_Card = __esm({
3680
3769
  }
3681
3770
  );
3682
3771
  Card.displayName = "Card";
3683
- CardHeader = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3772
+ CardHeader = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3684
3773
  CardHeader.displayName = "CardHeader";
3685
- CardTitle = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3774
+ CardTitle = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3686
3775
  "h3",
3687
3776
  {
3688
3777
  ref,
@@ -3695,11 +3784,11 @@ var init_Card = __esm({
3695
3784
  }
3696
3785
  ));
3697
3786
  CardTitle.displayName = "CardTitle";
3698
- CardContent = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3787
+ CardContent = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3699
3788
  CardContent.displayName = "CardContent";
3700
3789
  CardBody = CardContent;
3701
3790
  CardBody.displayName = "CardBody";
3702
- CardFooter = React87__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3791
+ CardFooter = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3703
3792
  "div",
3704
3793
  {
3705
3794
  ref,
@@ -3754,7 +3843,7 @@ var init_FilterPill = __esm({
3754
3843
  md: "w-3.5 h-3.5",
3755
3844
  lg: "w-4 h-4"
3756
3845
  };
3757
- FilterPill = React87__default.forwardRef(
3846
+ FilterPill = React85__default.forwardRef(
3758
3847
  ({
3759
3848
  className,
3760
3849
  variant = "default",
@@ -3831,7 +3920,7 @@ var init_Spinner = __esm({
3831
3920
  md: "h-6 w-6",
3832
3921
  lg: "h-8 w-8"
3833
3922
  };
3834
- Spinner = React87__default.forwardRef(
3923
+ Spinner = React85__default.forwardRef(
3835
3924
  ({ className, size = "md", ...props }, ref) => {
3836
3925
  return /* @__PURE__ */ jsx(
3837
3926
  "div",
@@ -3910,13 +3999,12 @@ var init_Avatar = __esm({
3910
3999
  actionPayload
3911
4000
  }) => {
3912
4001
  const eventBus = useEventBus();
3913
- const [imgFailed, setImgFailed] = React87__default.useState(false);
3914
- React87__default.useEffect(() => {
4002
+ const [imgFailed, setImgFailed] = React85__default.useState(false);
4003
+ React85__default.useEffect(() => {
3915
4004
  setImgFailed(false);
3916
4005
  }, [src]);
3917
4006
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
3918
4007
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
3919
- const hasImage = !!src && !imgFailed;
3920
4008
  const hasIcon = !!IconComponent;
3921
4009
  const hasInitials = !!initials && !(hasIcon && !providedInitials);
3922
4010
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
@@ -3942,15 +4030,13 @@ var init_Avatar = __esm({
3942
4030
  onClick: isClickable ? handleClick : void 0,
3943
4031
  role: isClickable ? "button" : void 0,
3944
4032
  tabIndex: isClickable ? 0 : void 0,
3945
- children: hasImage ? /* @__PURE__ */ jsx(
4033
+ children: src && !imgFailed ? /* @__PURE__ */ jsx(
3946
4034
  "img",
3947
4035
  {
3948
4036
  src,
3949
4037
  alt: alt || "Avatar",
3950
4038
  className: "w-full h-full object-cover",
3951
- onError: () => {
3952
- setImgFailed(true);
3953
- }
4039
+ onError: () => setImgFailed(true)
3954
4040
  }
3955
4041
  ) : hasInitials ? /* @__PURE__ */ jsx(
3956
4042
  "div",
@@ -4131,6 +4217,7 @@ var init_ProgressBar = __esm({
4131
4217
  primary: "bg-primary",
4132
4218
  success: "bg-success",
4133
4219
  warning: "bg-warning",
4220
+ error: "bg-error",
4134
4221
  danger: "bg-error"
4135
4222
  };
4136
4223
  circularSizeClasses = {
@@ -4155,10 +4242,11 @@ var init_ProgressBar = __esm({
4155
4242
  const effectiveColor = color ?? variant;
4156
4243
  const effectiveShowPercentage = showPercentage || showLabel;
4157
4244
  if (progressType === "linear") {
4245
+ const showHeader = label || effectiveShowPercentage;
4158
4246
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
4159
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
4160
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
4161
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-foreground font-medium", children: [
4247
+ showHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
4248
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
4249
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-foreground font-medium", !label && "ml-auto"), children: [
4162
4250
  Math.round(percentage),
4163
4251
  "%"
4164
4252
  ] })
@@ -4243,10 +4331,11 @@ var init_ProgressBar = __esm({
4243
4331
  const stepValue = max / steps;
4244
4332
  const activeSteps = Math.floor(value / stepValue);
4245
4333
  const partialStep = value % stepValue / stepValue;
4334
+ const showStepHeader = label || effectiveShowPercentage;
4246
4335
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
4247
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
4248
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
4249
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4336
+ showStepHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
4337
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
4338
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-muted-foreground", !label && "ml-auto"), children: [
4250
4339
  Math.round(percentage),
4251
4340
  "%"
4252
4341
  ] })
@@ -4296,7 +4385,7 @@ var init_Radio = __esm({
4296
4385
  md: "w-2.5 h-2.5",
4297
4386
  lg: "w-3 h-3"
4298
4387
  };
4299
- Radio = React87__default.forwardRef(
4388
+ Radio = React85__default.forwardRef(
4300
4389
  ({
4301
4390
  label,
4302
4391
  helperText,
@@ -4313,12 +4402,12 @@ var init_Radio = __esm({
4313
4402
  onChange,
4314
4403
  ...props
4315
4404
  }, ref) => {
4316
- const reactId = React87__default.useId();
4405
+ const reactId = React85__default.useId();
4317
4406
  const baseId = id || `radio-${reactId}`;
4318
4407
  const hasError = !!error;
4319
4408
  const eventBus = useEventBus();
4320
- const [selected, setSelected] = React87__default.useState(value);
4321
- React87__default.useEffect(() => {
4409
+ const [selected, setSelected] = React85__default.useState(value);
4410
+ React85__default.useEffect(() => {
4322
4411
  if (value !== void 0) setSelected(value);
4323
4412
  }, [value]);
4324
4413
  const pick = (next, e) => {
@@ -4500,7 +4589,7 @@ var init_Switch = __esm({
4500
4589
  "components/core/atoms/Switch.tsx"() {
4501
4590
  "use client";
4502
4591
  init_cn();
4503
- Switch = React87.forwardRef(
4592
+ Switch = React85.forwardRef(
4504
4593
  ({
4505
4594
  checked,
4506
4595
  defaultChecked = false,
@@ -4511,10 +4600,10 @@ var init_Switch = __esm({
4511
4600
  name,
4512
4601
  className
4513
4602
  }, ref) => {
4514
- const [isChecked, setIsChecked] = React87.useState(
4603
+ const [isChecked, setIsChecked] = React85.useState(
4515
4604
  checked !== void 0 ? checked : defaultChecked
4516
4605
  );
4517
- React87.useEffect(() => {
4606
+ React85.useEffect(() => {
4518
4607
  if (checked !== void 0) {
4519
4608
  setIsChecked(checked);
4520
4609
  }
@@ -4870,7 +4959,7 @@ var Aside;
4870
4959
  var init_Aside = __esm({
4871
4960
  "components/core/atoms/Aside.tsx"() {
4872
4961
  init_cn();
4873
- Aside = React87__default.forwardRef(
4962
+ Aside = React85__default.forwardRef(
4874
4963
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4875
4964
  );
4876
4965
  Aside.displayName = "Aside";
@@ -4948,8 +5037,8 @@ var init_LawReferenceTooltip = __esm({
4948
5037
  className
4949
5038
  }) => {
4950
5039
  const { t } = useTranslate();
4951
- const [isVisible, setIsVisible] = React87__default.useState(false);
4952
- const timeoutRef = React87__default.useRef(null);
5040
+ const [isVisible, setIsVisible] = React85__default.useState(false);
5041
+ const timeoutRef = React85__default.useRef(null);
4953
5042
  const handleMouseEnter = () => {
4954
5043
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4955
5044
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4958,7 +5047,7 @@ var init_LawReferenceTooltip = __esm({
4958
5047
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4959
5048
  setIsVisible(false);
4960
5049
  };
4961
- React87__default.useEffect(() => {
5050
+ React85__default.useEffect(() => {
4962
5051
  return () => {
4963
5052
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4964
5053
  };
@@ -5168,7 +5257,7 @@ var init_StatusDot = __esm({
5168
5257
  md: "w-2.5 h-2.5",
5169
5258
  lg: "w-3 h-3"
5170
5259
  };
5171
- StatusDot = React87__default.forwardRef(
5260
+ StatusDot = React85__default.forwardRef(
5172
5261
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5173
5262
  return /* @__PURE__ */ jsx(
5174
5263
  "span",
@@ -5222,7 +5311,7 @@ var init_TrendIndicator = __esm({
5222
5311
  down: "trending-down",
5223
5312
  flat: "arrow-right"
5224
5313
  };
5225
- TrendIndicator = React87__default.forwardRef(
5314
+ TrendIndicator = React85__default.forwardRef(
5226
5315
  ({
5227
5316
  className,
5228
5317
  value,
@@ -5289,7 +5378,7 @@ var init_RangeSlider = __esm({
5289
5378
  md: "w-4 h-4",
5290
5379
  lg: "w-5 h-5"
5291
5380
  };
5292
- RangeSlider = React87__default.forwardRef(
5381
+ RangeSlider = React85__default.forwardRef(
5293
5382
  ({
5294
5383
  className,
5295
5384
  min = 0,
@@ -5797,7 +5886,7 @@ var init_ContentSection = __esm({
5797
5886
  md: "py-16",
5798
5887
  lg: "py-24"
5799
5888
  };
5800
- ContentSection = React87__default.forwardRef(
5889
+ ContentSection = React85__default.forwardRef(
5801
5890
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5802
5891
  return /* @__PURE__ */ jsx(
5803
5892
  Box,
@@ -6331,7 +6420,7 @@ var init_AnimatedReveal = __esm({
6331
6420
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6332
6421
  "none": {}
6333
6422
  };
6334
- AnimatedReveal = React87__default.forwardRef(
6423
+ AnimatedReveal = React85__default.forwardRef(
6335
6424
  ({
6336
6425
  trigger = "scroll",
6337
6426
  animation = "fade-up",
@@ -6491,7 +6580,7 @@ var init_AnimatedGraphic = __esm({
6491
6580
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6492
6581
  "use client";
6493
6582
  init_cn();
6494
- AnimatedGraphic = React87__default.forwardRef(
6583
+ AnimatedGraphic = React85__default.forwardRef(
6495
6584
  ({
6496
6585
  src,
6497
6586
  svgContent,
@@ -6514,7 +6603,7 @@ var init_AnimatedGraphic = __esm({
6514
6603
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6515
6604
  const resolvedSvg = svgContent ?? fetchedSvg;
6516
6605
  const prevAnimateRef = useRef(animate);
6517
- const setRef = React87__default.useCallback(
6606
+ const setRef = React85__default.useCallback(
6518
6607
  (node) => {
6519
6608
  containerRef.current = node;
6520
6609
  if (typeof ref === "function") ref(node);
@@ -6739,9 +6828,9 @@ function ScoreDisplay({
6739
6828
  ...rest
6740
6829
  }) {
6741
6830
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
6742
- const [displayValue, setDisplayValue] = React87.useState(resolvedValue);
6743
- const [isAnimating, setIsAnimating] = React87.useState(false);
6744
- React87.useEffect(() => {
6831
+ const [displayValue, setDisplayValue] = React85.useState(resolvedValue);
6832
+ const [isAnimating, setIsAnimating] = React85.useState(false);
6833
+ React85.useEffect(() => {
6745
6834
  if (!animated || displayValue === resolvedValue) {
6746
6835
  setDisplayValue(resolvedValue);
6747
6836
  return;
@@ -6811,9 +6900,9 @@ function ControlButton({
6811
6900
  className
6812
6901
  }) {
6813
6902
  const eventBus = useEventBus();
6814
- const [isPressed, setIsPressed] = React87.useState(false);
6903
+ const [isPressed, setIsPressed] = React85.useState(false);
6815
6904
  const actualPressed = pressed ?? isPressed;
6816
- const handlePointerDown = React87.useCallback(
6905
+ const handlePointerDown = React85.useCallback(
6817
6906
  (e) => {
6818
6907
  e.preventDefault();
6819
6908
  if (disabled) return;
@@ -6823,7 +6912,7 @@ function ControlButton({
6823
6912
  },
6824
6913
  [disabled, pressEvent, eventBus, onPress]
6825
6914
  );
6826
- const handlePointerUp = React87.useCallback(
6915
+ const handlePointerUp = React85.useCallback(
6827
6916
  (e) => {
6828
6917
  e.preventDefault();
6829
6918
  if (disabled) return;
@@ -6833,7 +6922,7 @@ function ControlButton({
6833
6922
  },
6834
6923
  [disabled, releaseEvent, eventBus, onRelease]
6835
6924
  );
6836
- const handlePointerLeave = React87.useCallback(
6925
+ const handlePointerLeave = React85.useCallback(
6837
6926
  (e) => {
6838
6927
  if (isPressed) {
6839
6928
  setIsPressed(false);
@@ -7104,7 +7193,7 @@ function ResourceCounter({
7104
7193
  children: [
7105
7194
  icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
7106
7195
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
7107
- /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color), children: [
7196
+ /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color && (color in colorTokenClasses2 ? colorTokenClasses2[color] : color)), children: [
7108
7197
  value,
7109
7198
  max != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
7110
7199
  "/",
@@ -7115,10 +7204,18 @@ function ResourceCounter({
7115
7204
  }
7116
7205
  );
7117
7206
  }
7118
- var sizeMap5;
7207
+ var colorTokenClasses2, sizeMap5;
7119
7208
  var init_ResourceCounter = __esm({
7120
7209
  "components/game/atoms/ResourceCounter.tsx"() {
7121
7210
  init_cn();
7211
+ colorTokenClasses2 = {
7212
+ primary: "text-primary",
7213
+ secondary: "text-secondary",
7214
+ success: "text-success",
7215
+ warning: "text-warning",
7216
+ error: "text-error",
7217
+ muted: "text-muted-foreground"
7218
+ };
7122
7219
  sizeMap5 = {
7123
7220
  sm: { wrapper: "text-xs gap-1 px-1.5 py-0.5", icon: "text-sm" },
7124
7221
  md: { wrapper: "text-sm gap-1.5 px-2 py-1", icon: "text-base" },
@@ -7322,14 +7419,20 @@ function XPBar({
7322
7419
  }) {
7323
7420
  const sizes = sizeMap9[size];
7324
7421
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
7325
- const [fillWidth, setFillWidth] = React87.useState(animated ? 0 : percentage);
7326
- React87.useEffect(() => {
7422
+ const [fillWidth, setFillWidth] = React85.useState(animated ? 0 : percentage);
7423
+ React85.useEffect(() => {
7327
7424
  if (!animated) {
7328
7425
  setFillWidth(percentage);
7329
7426
  return;
7330
7427
  }
7331
- const frame = requestAnimationFrame(() => setFillWidth(percentage));
7332
- return () => cancelAnimationFrame(frame);
7428
+ let frame2;
7429
+ const frame1 = requestAnimationFrame(() => {
7430
+ frame2 = requestAnimationFrame(() => setFillWidth(percentage));
7431
+ });
7432
+ return () => {
7433
+ cancelAnimationFrame(frame1);
7434
+ cancelAnimationFrame(frame2);
7435
+ };
7333
7436
  }, [animated, percentage]);
7334
7437
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
7335
7438
  level != null && /* @__PURE__ */ jsxs(
@@ -7367,7 +7470,7 @@ function XPBar({
7367
7470
  )
7368
7471
  }
7369
7472
  ),
7370
- showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground tabular-nums", sizes.text), children: [
7473
+ showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-foreground/70 tabular-nums", sizes.text), children: [
7371
7474
  current,
7372
7475
  " / ",
7373
7476
  max,
@@ -7485,7 +7588,7 @@ function StatusEffect({
7485
7588
  ),
7486
7589
  title: label,
7487
7590
  children: [
7488
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: icon }),
7591
+ /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }),
7489
7592
  duration !== void 0 && /* @__PURE__ */ jsx(
7490
7593
  "span",
7491
7594
  {
@@ -7516,6 +7619,7 @@ var sizeMap11, variantStyles7;
7516
7619
  var init_StatusEffect = __esm({
7517
7620
  "components/game/atoms/StatusEffect.tsx"() {
7518
7621
  init_cn();
7622
+ init_Icon();
7519
7623
  sizeMap11 = {
7520
7624
  sm: { container: "w-8 h-8", icon: "text-sm", badge: "text-xs -top-1 -right-1 w-4 h-4", timer: "text-[9px]" },
7521
7625
  md: { container: "w-10 h-10", icon: "text-base", badge: "text-xs -top-1 -right-1 w-5 h-5", timer: "text-xs" },
@@ -7749,9 +7853,9 @@ function MiniMap({
7749
7853
  viewportRect,
7750
7854
  className
7751
7855
  }) {
7752
- const canvasRef = React87.useRef(null);
7753
- const frameRef = React87.useRef(0);
7754
- React87.useEffect(() => {
7856
+ const canvasRef = React85.useRef(null);
7857
+ const frameRef = React85.useRef(0);
7858
+ React85.useEffect(() => {
7755
7859
  const canvas = canvasRef.current;
7756
7860
  if (!canvas) return;
7757
7861
  const ctx = canvas.getContext("2d");
@@ -7925,7 +8029,7 @@ var init_ErrorBoundary = __esm({
7925
8029
  }
7926
8030
  );
7927
8031
  };
7928
- ErrorBoundary = class extends React87__default.Component {
8032
+ ErrorBoundary = class extends React85__default.Component {
7929
8033
  constructor(props) {
7930
8034
  super(props);
7931
8035
  __publicField(this, "reset", () => {
@@ -9360,7 +9464,7 @@ var init_Tooltip = __esm({
9360
9464
  setIsVisible(false);
9361
9465
  }, hideDelay);
9362
9466
  };
9363
- useEffect(() => {
9467
+ useLayoutEffect(() => {
9364
9468
  if (isVisible) {
9365
9469
  updatePosition();
9366
9470
  }
@@ -9371,8 +9475,8 @@ var init_Tooltip = __esm({
9371
9475
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
9372
9476
  };
9373
9477
  }, []);
9374
- const triggerElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9375
- const trigger = React87__default.cloneElement(triggerElement, {
9478
+ const triggerElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9479
+ const trigger = React85__default.cloneElement(triggerElement, {
9376
9480
  ref: triggerRef,
9377
9481
  onMouseEnter: handleMouseEnter,
9378
9482
  onMouseLeave: handleMouseLeave,
@@ -9519,8 +9623,8 @@ var init_Popover = __esm({
9519
9623
  onMouseEnter: handleOpen,
9520
9624
  onMouseLeave: handleClose
9521
9625
  };
9522
- const childElement = React87__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9523
- const triggerElement = React87__default.cloneElement(
9626
+ const childElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
9627
+ const triggerElement = React85__default.cloneElement(
9524
9628
  childElement,
9525
9629
  {
9526
9630
  ref: triggerRef,
@@ -9536,7 +9640,10 @@ var init_Popover = __esm({
9536
9640
  "bg-card border-2 border-border shadow-elevation-popover",
9537
9641
  className
9538
9642
  ),
9539
- style: computePopoverStyle(position, triggerRect, popoverWidth),
9643
+ style: {
9644
+ ...computePopoverStyle(position, triggerRect, popoverWidth),
9645
+ ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
9646
+ },
9540
9647
  role: "dialog",
9541
9648
  onMouseEnter: trigger === "hover" ? handleOpen : void 0,
9542
9649
  onMouseLeave: trigger === "hover" ? handleClose : void 0,
@@ -9646,8 +9753,8 @@ var init_Menu = __esm({
9646
9753
  };
9647
9754
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
9648
9755
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
9649
- const triggerChild = React87__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
9650
- const triggerElement = React87__default.cloneElement(
9756
+ const triggerChild = React85__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
9757
+ const triggerElement = React85__default.cloneElement(
9651
9758
  triggerChild,
9652
9759
  {
9653
9760
  ref: triggerRef,
@@ -10054,7 +10161,7 @@ var init_MapView = __esm({
10054
10161
  shadowSize: [41, 41]
10055
10162
  });
10056
10163
  L.Marker.prototype.options.icon = defaultIcon;
10057
- const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback114, useState: useState101 } = React87__default;
10164
+ const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback112, useState: useState99 } = React85__default;
10058
10165
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10059
10166
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10060
10167
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -10099,8 +10206,8 @@ var init_MapView = __esm({
10099
10206
  showAttribution = true
10100
10207
  }) {
10101
10208
  const eventBus = useEventBus2();
10102
- const [clickedPosition, setClickedPosition] = useState101(null);
10103
- const handleMapClick = useCallback114((lat, lng) => {
10209
+ const [clickedPosition, setClickedPosition] = useState99(null);
10210
+ const handleMapClick = useCallback112((lat, lng) => {
10104
10211
  if (showClickedPin) {
10105
10212
  setClickedPosition({ lat, lng });
10106
10213
  }
@@ -10109,7 +10216,7 @@ var init_MapView = __esm({
10109
10216
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
10110
10217
  }
10111
10218
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
10112
- const handleMarkerClick = useCallback114((marker) => {
10219
+ const handleMarkerClick = useCallback112((marker) => {
10113
10220
  onMarkerClick?.(marker);
10114
10221
  if (markerClickEvent) {
10115
10222
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -10118,7 +10225,7 @@ var init_MapView = __esm({
10118
10225
  return /* @__PURE__ */ jsx(
10119
10226
  Box,
10120
10227
  {
10121
- className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
10228
+ className: cn("relative isolate z-0 w-full overflow-hidden rounded-lg", className),
10122
10229
  style: { height },
10123
10230
  "data-testid": "map-view",
10124
10231
  children: /* @__PURE__ */ jsxs(
@@ -10300,7 +10407,7 @@ function InputPattern({
10300
10407
  fieldName
10301
10408
  }) {
10302
10409
  const { emit } = useEventBus();
10303
- const [localValue, setLocalValue] = React87__default.useState(value);
10410
+ const [localValue, setLocalValue] = React85__default.useState(value);
10304
10411
  const handleChange = (e) => {
10305
10412
  setLocalValue(e.target.value);
10306
10413
  if (onChange) {
@@ -10338,7 +10445,7 @@ function TextareaPattern({
10338
10445
  fieldName
10339
10446
  }) {
10340
10447
  const { emit } = useEventBus();
10341
- const [localValue, setLocalValue] = React87__default.useState(value);
10448
+ const [localValue, setLocalValue] = React85__default.useState(value);
10342
10449
  const handleChange = (e) => {
10343
10450
  setLocalValue(e.target.value);
10344
10451
  if (onChange) {
@@ -10370,7 +10477,7 @@ function SelectPattern({
10370
10477
  fieldName
10371
10478
  }) {
10372
10479
  const { emit } = useEventBus();
10373
- const [localValue, setLocalValue] = React87__default.useState(value);
10480
+ const [localValue, setLocalValue] = React85__default.useState(value);
10374
10481
  const handleChange = (e) => {
10375
10482
  setLocalValue(e.target.value);
10376
10483
  if (onChange) {
@@ -10399,7 +10506,7 @@ function CheckboxPattern({
10399
10506
  className
10400
10507
  }) {
10401
10508
  const { emit } = useEventBus();
10402
- const [localChecked, setLocalChecked] = React87__default.useState(checked);
10509
+ const [localChecked, setLocalChecked] = React85__default.useState(checked);
10403
10510
  const handleChange = (e) => {
10404
10511
  setLocalChecked(e.target.checked);
10405
10512
  if (onChange) {
@@ -10631,8 +10738,8 @@ function ActionButtons({
10631
10738
  disabled
10632
10739
  }) {
10633
10740
  const eventBus = useEventBus();
10634
- const [activeButtons, setActiveButtons] = React87.useState(/* @__PURE__ */ new Set());
10635
- const handlePress = React87.useCallback(
10741
+ const [activeButtons, setActiveButtons] = React85.useState(/* @__PURE__ */ new Set());
10742
+ const handlePress = React85.useCallback(
10636
10743
  (id) => {
10637
10744
  setActiveButtons((prev) => new Set(prev).add(id));
10638
10745
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -10640,7 +10747,7 @@ function ActionButtons({
10640
10747
  },
10641
10748
  [actionEvent, eventBus, onAction]
10642
10749
  );
10643
- const handleRelease = React87.useCallback(
10750
+ const handleRelease = React85.useCallback(
10644
10751
  (id) => {
10645
10752
  setActiveButtons((prev) => {
10646
10753
  const next = new Set(prev);
@@ -10930,7 +11037,7 @@ var init_AuthLayout = __esm({
10930
11037
  init_Stack();
10931
11038
  init_Typography();
10932
11039
  AuthLayout = ({
10933
- appName = "{{APP_TITLE}}",
11040
+ appName = "My App",
10934
11041
  logo,
10935
11042
  backgroundImage,
10936
11043
  showBranding = true,
@@ -13621,6 +13728,263 @@ var init_katex_min = __esm({
13621
13728
  "node_modules/katex/dist/katex.min.css"() {
13622
13729
  }
13623
13730
  });
13731
+ var Tabs;
13732
+ var init_Tabs = __esm({
13733
+ "components/core/molecules/Tabs.tsx"() {
13734
+ "use client";
13735
+ init_Icon();
13736
+ init_Badge();
13737
+ init_Typography();
13738
+ init_Box();
13739
+ init_cn();
13740
+ init_useEventBus();
13741
+ Tabs = ({
13742
+ items,
13743
+ tabs,
13744
+ defaultActiveTab,
13745
+ activeTab: controlledActiveTab,
13746
+ onTabChange,
13747
+ tabChangeEvent,
13748
+ variant = "default",
13749
+ orientation = "horizontal",
13750
+ className
13751
+ }) => {
13752
+ const rawItems = items ?? tabs ?? [];
13753
+ const safeItems = rawItems.map(({ id, value, ...rest }) => ({
13754
+ ...rest,
13755
+ id: id || value || ""
13756
+ }));
13757
+ const eventBus = useEventBus();
13758
+ const { t } = useTranslate();
13759
+ const initialActive = safeItems.find((item) => item.active)?.id;
13760
+ const [internalActiveTab, setInternalActiveTab] = useState(
13761
+ defaultActiveTab || initialActive || safeItems[0]?.id || ""
13762
+ );
13763
+ const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
13764
+ const tabRefs = useRef({});
13765
+ const handleTabChange = (tabId, tabEvent) => {
13766
+ if (controlledActiveTab === void 0) {
13767
+ setInternalActiveTab(tabId);
13768
+ }
13769
+ onTabChange?.(tabId);
13770
+ if (tabChangeEvent) {
13771
+ eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
13772
+ }
13773
+ if (tabEvent) {
13774
+ eventBus.emit(`UI:${tabEvent}`, { tabId });
13775
+ }
13776
+ };
13777
+ const handleKeyDown = (e, index) => {
13778
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
13779
+ e.preventDefault();
13780
+ const direction = e.key === "ArrowLeft" ? -1 : 1;
13781
+ const nextIndex = (index + direction + safeItems.length) % safeItems.length;
13782
+ const nextTab = safeItems[nextIndex];
13783
+ if (nextTab && !nextTab.disabled) {
13784
+ handleTabChange(nextTab.id);
13785
+ tabRefs.current[nextTab.id]?.focus();
13786
+ }
13787
+ } else if (e.key === "Home" || e.key === "End") {
13788
+ e.preventDefault();
13789
+ const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
13790
+ const targetTab = safeItems[targetIndex];
13791
+ if (targetTab && !targetTab.disabled) {
13792
+ handleTabChange(targetTab.id);
13793
+ tabRefs.current[targetTab.id]?.focus();
13794
+ }
13795
+ }
13796
+ };
13797
+ const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
13798
+ if (safeItems.length === 0) {
13799
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
13800
+ }
13801
+ const variantClasses2 = {
13802
+ default: [
13803
+ "border-b-[length:var(--border-width)] border-transparent",
13804
+ "hover:border-muted-foreground",
13805
+ "data-[active=true]:border-primary"
13806
+ ].join(" "),
13807
+ pills: [
13808
+ "rounded-sm",
13809
+ "data-[active=true]:bg-primary",
13810
+ "data-[active=true]:text-primary-foreground"
13811
+ ].join(" "),
13812
+ underline: [
13813
+ "border-b-[length:var(--border-width)] border-transparent",
13814
+ "data-[active=true]:border-primary"
13815
+ ].join(" ")
13816
+ };
13817
+ return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
13818
+ /* @__PURE__ */ jsx(
13819
+ Box,
13820
+ {
13821
+ role: "tablist",
13822
+ className: cn(
13823
+ "flex",
13824
+ // Horizontal tab strip becomes a horizontally-scrollable lane
13825
+ // below its container width — phones with many tabs scroll
13826
+ // instead of clipping. `snap-x` snaps to each tab; the
13827
+ // scrollbar is hidden for a cleaner affordance (the swipe
13828
+ // gesture is the discoverability cue).
13829
+ orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
13830
+ variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
13831
+ variant === "underline" && orientation === "vertical" && "border-b-0"
13832
+ ),
13833
+ children: safeItems.map((item, index) => {
13834
+ const isActive = item.id === activeTab;
13835
+ const isDisabled = item.disabled;
13836
+ return /* @__PURE__ */ jsxs(
13837
+ Box,
13838
+ {
13839
+ as: "button",
13840
+ ref: (el) => {
13841
+ tabRefs.current[item.id] = el;
13842
+ },
13843
+ role: "tab",
13844
+ "aria-selected": isActive,
13845
+ "aria-controls": `tabpanel-${item.id}`,
13846
+ "aria-disabled": isDisabled,
13847
+ onClick: () => !isDisabled && handleTabChange(item.id, item.event),
13848
+ onKeyDown: (e) => handleKeyDown(e, index),
13849
+ "data-active": isActive,
13850
+ className: cn(
13851
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
13852
+ orientation === "horizontal" && "snap-start shrink-0",
13853
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
13854
+ isDisabled && "opacity-50 cursor-not-allowed",
13855
+ variantClasses2[variant],
13856
+ isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
13857
+ ),
13858
+ children: [
13859
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
13860
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
13861
+ item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
13862
+ ]
13863
+ },
13864
+ item.id
13865
+ );
13866
+ })
13867
+ }
13868
+ ),
13869
+ activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
13870
+ Box,
13871
+ {
13872
+ role: "tabpanel",
13873
+ id: `tabpanel-${activeTab}`,
13874
+ "aria-labelledby": `tab-${activeTab}`,
13875
+ className: "mt-4",
13876
+ children: activeTabContent
13877
+ }
13878
+ )
13879
+ ] });
13880
+ };
13881
+ Tabs.displayName = "Tabs";
13882
+ }
13883
+ });
13884
+ var ICON_NAME_ALIASES, lookStyles3, EmptyState;
13885
+ var init_EmptyState = __esm({
13886
+ "components/core/molecules/EmptyState.tsx"() {
13887
+ "use client";
13888
+ init_cn();
13889
+ init_atoms2();
13890
+ init_Box();
13891
+ init_Icon();
13892
+ init_Stack();
13893
+ init_Typography();
13894
+ init_useEventBus();
13895
+ ICON_NAME_ALIASES = {
13896
+ check: "check-circle",
13897
+ error: "x-circle",
13898
+ warning: "alert-circle"
13899
+ };
13900
+ lookStyles3 = {
13901
+ "icon-only": "",
13902
+ illustrated: "[&_svg]:w-32 [&_svg]:h-32",
13903
+ "text-only": "[&_svg]:hidden",
13904
+ mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
13905
+ };
13906
+ EmptyState = ({
13907
+ icon,
13908
+ title,
13909
+ message,
13910
+ description,
13911
+ actionLabel,
13912
+ onAction,
13913
+ className,
13914
+ destructive,
13915
+ variant,
13916
+ actionEvent,
13917
+ look = "icon-only"
13918
+ }) => {
13919
+ const eventBus = useEventBus();
13920
+ const { t } = useTranslate();
13921
+ const handleAction = () => {
13922
+ if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
13923
+ onAction?.();
13924
+ };
13925
+ const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
13926
+ const iconComponent = typeof icon === "function" ? icon : void 0;
13927
+ const hasIcon = Boolean(iconName || iconComponent);
13928
+ const isDestructive = destructive || variant === "error";
13929
+ const isSuccess = variant === "success";
13930
+ const displayText = title || message || t("empty.noItems");
13931
+ return /* @__PURE__ */ jsxs(
13932
+ VStack,
13933
+ {
13934
+ align: "center",
13935
+ className: cn(
13936
+ "justify-center py-12 text-center",
13937
+ lookStyles3[look],
13938
+ className
13939
+ ),
13940
+ children: [
13941
+ hasIcon && /* @__PURE__ */ jsx(
13942
+ Box,
13943
+ {
13944
+ className: cn(
13945
+ "mb-4 rounded-full p-3",
13946
+ isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
13947
+ ),
13948
+ children: /* @__PURE__ */ jsx(
13949
+ Icon,
13950
+ {
13951
+ ...iconName ? { name: iconName } : { icon: iconComponent },
13952
+ className: cn(
13953
+ "h-8 w-8",
13954
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
13955
+ )
13956
+ }
13957
+ )
13958
+ }
13959
+ ),
13960
+ /* @__PURE__ */ jsx(
13961
+ Typography,
13962
+ {
13963
+ variant: "h3",
13964
+ className: cn(
13965
+ "text-lg font-medium",
13966
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
13967
+ ),
13968
+ children: displayText
13969
+ }
13970
+ ),
13971
+ description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
13972
+ actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
13973
+ Button,
13974
+ {
13975
+ className: "mt-4",
13976
+ variant: isDestructive ? "danger" : "primary",
13977
+ onClick: handleAction,
13978
+ children: actionLabel
13979
+ }
13980
+ )
13981
+ ]
13982
+ }
13983
+ );
13984
+ };
13985
+ EmptyState.displayName = "EmptyState";
13986
+ }
13987
+ });
13624
13988
  function computeFoldRegions(code) {
13625
13989
  const lines = code.split("\n");
13626
13990
  const regions = [];
@@ -13658,9 +14022,32 @@ function computeFoldRegions(code) {
13658
14022
  function toCodeLanguage(value) {
13659
14023
  return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
13660
14024
  }
13661
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
14025
+ function generateDiff(oldVal, newVal) {
14026
+ const oldLines = oldVal.split("\n");
14027
+ const newLines = newVal.split("\n");
14028
+ const diff = [];
14029
+ const maxLen = Math.max(oldLines.length, newLines.length);
14030
+ for (let i = 0; i < maxLen; i++) {
14031
+ const oldLine = oldLines[i];
14032
+ const newLine = newLines[i];
14033
+ if (oldLine === newLine) {
14034
+ diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
14035
+ } else {
14036
+ if (oldLine !== void 0) diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
14037
+ if (newLine !== void 0) diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
14038
+ }
14039
+ }
14040
+ return diff;
14041
+ }
14042
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
13662
14043
  var init_CodeBlock = __esm({
13663
14044
  "components/core/molecules/markdown/CodeBlock.tsx"() {
14045
+ init_cn();
14046
+ init_atoms2();
14047
+ init_Tabs();
14048
+ init_LoadingState();
14049
+ init_ErrorState();
14050
+ init_EmptyState();
13664
14051
  init_Box();
13665
14052
  init_Button();
13666
14053
  init_Badge();
@@ -13767,9 +14154,14 @@ var init_CodeBlock = __esm({
13767
14154
  "lolo"
13768
14155
  ];
13769
14156
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
14157
+ DIFF_STYLES = {
14158
+ add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
14159
+ remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
14160
+ context: { bg: "", prefix: " ", text: "text-foreground" }
14161
+ };
13770
14162
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
13771
14163
  HIDDEN_LINE_NUMBERS = { display: "none" };
13772
- CodeBlock = React87__default.memo(
14164
+ CodeBlock = React85__default.memo(
13773
14165
  ({
13774
14166
  code: rawCode,
13775
14167
  language = "text",
@@ -13780,7 +14172,20 @@ var init_CodeBlock = __esm({
13780
14172
  className,
13781
14173
  editable = false,
13782
14174
  onChange,
13783
- errorLines
14175
+ errorLines,
14176
+ // viewer props
14177
+ title,
14178
+ mode = "code",
14179
+ diff: propDiff,
14180
+ oldValue,
14181
+ newValue,
14182
+ showLineNumbers = false,
14183
+ wordWrap = false,
14184
+ files,
14185
+ actions,
14186
+ isLoading = false,
14187
+ error,
14188
+ showCopy
13784
14189
  }) => {
13785
14190
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
13786
14191
  const isOrb = language === "orb";
@@ -13792,6 +14197,20 @@ var init_CodeBlock = __esm({
13792
14197
  const codeRef = useRef(null);
13793
14198
  const savedScrollLeftRef = useRef(0);
13794
14199
  const [copied, setCopied] = useState(false);
14200
+ const [wrap, setWrap] = useState(wordWrap);
14201
+ const [activeFileIndex, setActiveFileIndex] = useState(0);
14202
+ const activeFile = files?.[activeFileIndex];
14203
+ const activeCode = activeFile?.code ?? code;
14204
+ const activeLanguage = activeFile?.language ?? language;
14205
+ const diffLines = useMemo(() => {
14206
+ if (propDiff) return propDiff;
14207
+ if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
14208
+ return generateDiff(oldValue, newValue);
14209
+ }
14210
+ return null;
14211
+ }, [propDiff, mode, oldValue, newValue]);
14212
+ const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
14213
+ const effectiveCopy = showCopy ?? showCopyButton;
13795
14214
  const [editableValue, setEditableValue] = useState(code);
13796
14215
  const [editableTextareaKey, setEditableTextareaKey] = useState(0);
13797
14216
  const lastPropCodeRef = useRef(code);
@@ -13962,13 +14381,13 @@ var init_CodeBlock = __esm({
13962
14381
  }, [language, code]);
13963
14382
  const handleCopy = async () => {
13964
14383
  try {
13965
- await navigator.clipboard.writeText(code);
14384
+ await navigator.clipboard.writeText(activeCode);
13966
14385
  setCopied(true);
13967
- eventBus.emit("UI:COPY_CODE", { language, success: true });
14386
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
13968
14387
  setTimeout(() => setCopied(false), 2e3);
13969
14388
  } catch (err) {
13970
14389
  log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13971
- eventBus.emit("UI:COPY_CODE", { language, success: false });
14390
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
13972
14391
  }
13973
14392
  };
13974
14393
  const handleSelectionCopy = useCallback((e) => {
@@ -14021,11 +14440,134 @@ var init_CodeBlock = __esm({
14021
14440
  }
14022
14441
  });
14023
14442
  }
14024
- const full = code.split("\n").slice(a, endLine + 1).join("\n");
14443
+ const full = activeCode.split("\n").slice(a, endLine + 1).join("\n");
14025
14444
  e.clipboardData.setData("text/plain", full);
14026
14445
  e.preventDefault();
14027
14446
  }, [code]);
14028
- const hasHeader = showLanguageBadge || showCopyButton;
14447
+ if (isLoading) {
14448
+ return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
14449
+ }
14450
+ if (error) {
14451
+ return /* @__PURE__ */ jsx(ErrorState, { title: t("display.codeViewerError"), message: error.message, className });
14452
+ }
14453
+ if (isViewerMode && !activeCode && !diffLines) {
14454
+ return /* @__PURE__ */ jsx(EmptyState, { icon: Code, title: t("display.noCode"), description: "No code to display.", className });
14455
+ }
14456
+ if (isViewerMode) {
14457
+ const tabItems = files?.map((file, idx) => ({
14458
+ id: `file-${idx}`,
14459
+ label: file.label,
14460
+ content: null
14461
+ }));
14462
+ const lines = activeCode.split("\n");
14463
+ return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
14464
+ tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
14465
+ Tabs,
14466
+ {
14467
+ tabs: tabItems,
14468
+ activeTab: `file-${activeFileIndex}`,
14469
+ onTabChange: (id) => {
14470
+ const idx = parseInt(id.replace("file-", ""), 10);
14471
+ setActiveFileIndex(idx);
14472
+ }
14473
+ }
14474
+ ) }),
14475
+ /* @__PURE__ */ jsxs(
14476
+ HStack,
14477
+ {
14478
+ gap: "sm",
14479
+ align: "center",
14480
+ justify: "between",
14481
+ className: "px-4 py-2 border-b border-border bg-muted/30",
14482
+ children: [
14483
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
14484
+ /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
14485
+ title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
14486
+ activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
14487
+ ] }),
14488
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
14489
+ /* @__PURE__ */ jsx(
14490
+ Button,
14491
+ {
14492
+ variant: "ghost",
14493
+ size: "sm",
14494
+ icon: WrapText,
14495
+ onClick: () => setWrap(!wrap),
14496
+ className: cn(wrap && "text-primary")
14497
+ }
14498
+ ),
14499
+ effectiveCopy && /* @__PURE__ */ jsx(
14500
+ Button,
14501
+ {
14502
+ variant: "ghost",
14503
+ size: "sm",
14504
+ icon: copied ? Check : Copy,
14505
+ onClick: handleCopy,
14506
+ className: cn(copied && "text-success")
14507
+ }
14508
+ ),
14509
+ actions?.map((action, idx) => /* @__PURE__ */ jsx(
14510
+ Badge,
14511
+ {
14512
+ variant: "default",
14513
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
14514
+ onClick: () => {
14515
+ if (action.event) eventBus.emit(`UI:${action.event}`, {});
14516
+ },
14517
+ children: action.label
14518
+ },
14519
+ idx
14520
+ ))
14521
+ ] })
14522
+ ]
14523
+ }
14524
+ ),
14525
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
14526
+ const style = DIFF_STYLES[line.type];
14527
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
14528
+ showLineNumbers && /* @__PURE__ */ jsx(
14529
+ Typography,
14530
+ {
14531
+ variant: "caption",
14532
+ color: "secondary",
14533
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
14534
+ children: line.lineNumber ?? ""
14535
+ }
14536
+ ),
14537
+ /* @__PURE__ */ jsxs(
14538
+ Typography,
14539
+ {
14540
+ variant: "caption",
14541
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14542
+ children: [
14543
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
14544
+ line.content
14545
+ ]
14546
+ }
14547
+ )
14548
+ ] }, idx);
14549
+ }) }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
14550
+ showLineNumbers && /* @__PURE__ */ jsx(
14551
+ Typography,
14552
+ {
14553
+ variant: "caption",
14554
+ color: "secondary",
14555
+ className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
14556
+ children: idx + 1
14557
+ }
14558
+ ),
14559
+ /* @__PURE__ */ jsx(
14560
+ Typography,
14561
+ {
14562
+ variant: "caption",
14563
+ className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
14564
+ children: line || " "
14565
+ }
14566
+ )
14567
+ ] }, idx)) }) })
14568
+ ] }) });
14569
+ }
14570
+ const hasHeader = showLanguageBadge || effectiveCopy;
14029
14571
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
14030
14572
  hasHeader && /* @__PURE__ */ jsxs(
14031
14573
  HStack,
@@ -14035,7 +14577,7 @@ var init_CodeBlock = __esm({
14035
14577
  className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
14036
14578
  children: [
14037
14579
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
14038
- showCopyButton && /* @__PURE__ */ jsx(
14580
+ effectiveCopy && /* @__PURE__ */ jsx(
14039
14581
  Button,
14040
14582
  {
14041
14583
  variant: "ghost",
@@ -14194,7 +14736,7 @@ var init_CodeBlock = __esm({
14194
14736
  )
14195
14737
  ] });
14196
14738
  },
14197
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
14739
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error
14198
14740
  );
14199
14741
  CodeBlock.displayName = "CodeBlock";
14200
14742
  }
@@ -14206,8 +14748,8 @@ var init_MarkdownContent = __esm({
14206
14748
  init_Box();
14207
14749
  init_CodeBlock();
14208
14750
  init_cn();
14209
- MarkdownContent = React87__default.memo(
14210
- ({ content, direction, className }) => {
14751
+ MarkdownContent = React85__default.memo(
14752
+ ({ content, direction = "ltr", className }) => {
14211
14753
  const { t: _t } = useTranslate();
14212
14754
  const safeContent = typeof content === "string" ? content : String(content ?? "");
14213
14755
  return /* @__PURE__ */ jsx(
@@ -15302,7 +15844,7 @@ var init_StateMachineView = __esm({
15302
15844
  style: { top: title ? 30 : 0 },
15303
15845
  children: [
15304
15846
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
15305
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React87__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15847
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React85__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15306
15848
  StateNode,
15307
15849
  {
15308
15850
  state,
@@ -16451,110 +16993,6 @@ var init_BookTableOfContents = __esm({
16451
16993
  BookTableOfContents.displayName = "BookTableOfContents";
16452
16994
  }
16453
16995
  });
16454
- var ICON_NAME_ALIASES, lookStyles3, EmptyState;
16455
- var init_EmptyState = __esm({
16456
- "components/core/molecules/EmptyState.tsx"() {
16457
- "use client";
16458
- init_cn();
16459
- init_atoms2();
16460
- init_Box();
16461
- init_Icon();
16462
- init_Stack();
16463
- init_Typography();
16464
- init_useEventBus();
16465
- ICON_NAME_ALIASES = {
16466
- check: "check-circle",
16467
- error: "x-circle",
16468
- warning: "alert-circle"
16469
- };
16470
- lookStyles3 = {
16471
- "icon-only": "",
16472
- illustrated: "[&_svg]:w-32 [&_svg]:h-32",
16473
- "text-only": "[&_svg]:hidden",
16474
- mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
16475
- };
16476
- EmptyState = ({
16477
- icon,
16478
- title,
16479
- message,
16480
- description,
16481
- actionLabel,
16482
- onAction,
16483
- className,
16484
- destructive,
16485
- variant,
16486
- actionEvent,
16487
- look = "icon-only"
16488
- }) => {
16489
- const eventBus = useEventBus();
16490
- const { t } = useTranslate();
16491
- const handleAction = () => {
16492
- if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
16493
- onAction?.();
16494
- };
16495
- const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
16496
- const iconComponent = typeof icon === "function" ? icon : void 0;
16497
- const hasIcon = Boolean(iconName || iconComponent);
16498
- const isDestructive = destructive || variant === "error";
16499
- const isSuccess = variant === "success";
16500
- const displayText = title || message || t("empty.noItems");
16501
- return /* @__PURE__ */ jsxs(
16502
- VStack,
16503
- {
16504
- align: "center",
16505
- className: cn(
16506
- "justify-center py-12 text-center",
16507
- lookStyles3[look],
16508
- className
16509
- ),
16510
- children: [
16511
- hasIcon && /* @__PURE__ */ jsx(
16512
- Box,
16513
- {
16514
- className: cn(
16515
- "mb-4 rounded-full p-3",
16516
- isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
16517
- ),
16518
- children: /* @__PURE__ */ jsx(
16519
- Icon,
16520
- {
16521
- ...iconName ? { name: iconName } : { icon: iconComponent },
16522
- className: cn(
16523
- "h-8 w-8",
16524
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
16525
- )
16526
- }
16527
- )
16528
- }
16529
- ),
16530
- /* @__PURE__ */ jsx(
16531
- Typography,
16532
- {
16533
- variant: "h3",
16534
- className: cn(
16535
- "text-lg font-medium",
16536
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
16537
- ),
16538
- children: displayText
16539
- }
16540
- ),
16541
- description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
16542
- actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
16543
- Button,
16544
- {
16545
- className: "mt-4",
16546
- variant: isDestructive ? "danger" : "primary",
16547
- onClick: handleAction,
16548
- children: actionLabel
16549
- }
16550
- )
16551
- ]
16552
- }
16553
- );
16554
- };
16555
- EmptyState.displayName = "EmptyState";
16556
- }
16557
- });
16558
16996
 
16559
16997
  // components/core/organisms/book/types.ts
16560
16998
  function resolveFieldMap(fieldMap) {
@@ -16907,7 +17345,7 @@ var init_Grid = __esm({
16907
17345
  as: Component = "div"
16908
17346
  }) => {
16909
17347
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
16910
- return React87__default.createElement(
17348
+ return React85__default.createElement(
16911
17349
  Component,
16912
17350
  {
16913
17351
  className: cn(
@@ -21350,449 +21788,6 @@ var init_ClassifierBoard = __esm({
21350
21788
  ClassifierBoard.displayName = "ClassifierBoard";
21351
21789
  }
21352
21790
  });
21353
- function CodeView({
21354
- data,
21355
- label,
21356
- defaultExpanded = false,
21357
- className
21358
- }) {
21359
- const { t } = useTranslate();
21360
- const [expanded, setExpanded] = useState(defaultExpanded);
21361
- const jsonString = JSON.stringify(data, null, 2);
21362
- return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
21363
- /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
21364
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
21365
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
21366
- ] }),
21367
- expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
21368
- Typography,
21369
- {
21370
- variant: "caption",
21371
- className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
21372
- children: jsonString
21373
- }
21374
- ) })
21375
- ] });
21376
- }
21377
- var init_CodeView = __esm({
21378
- "components/game/organisms/puzzles/state-architect/CodeView.tsx"() {
21379
- init_atoms2();
21380
- init_cn();
21381
- CodeView.displayName = "CodeView";
21382
- }
21383
- });
21384
- var Tabs;
21385
- var init_Tabs = __esm({
21386
- "components/core/molecules/Tabs.tsx"() {
21387
- "use client";
21388
- init_Icon();
21389
- init_Badge();
21390
- init_Typography();
21391
- init_Box();
21392
- init_cn();
21393
- init_useEventBus();
21394
- Tabs = ({
21395
- items,
21396
- tabs,
21397
- defaultActiveTab,
21398
- activeTab: controlledActiveTab,
21399
- onTabChange,
21400
- tabChangeEvent,
21401
- variant = "default",
21402
- orientation = "horizontal",
21403
- className
21404
- }) => {
21405
- const rawItems = items ?? tabs ?? [];
21406
- const safeItems = rawItems.map(({ id, value, ...rest }) => ({
21407
- ...rest,
21408
- id: id || value || ""
21409
- }));
21410
- const eventBus = useEventBus();
21411
- const { t } = useTranslate();
21412
- const initialActive = safeItems.find((item) => item.active)?.id;
21413
- const [internalActiveTab, setInternalActiveTab] = useState(
21414
- defaultActiveTab || initialActive || safeItems[0]?.id || ""
21415
- );
21416
- const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
21417
- const tabRefs = useRef({});
21418
- const handleTabChange = (tabId, tabEvent) => {
21419
- if (controlledActiveTab === void 0) {
21420
- setInternalActiveTab(tabId);
21421
- }
21422
- onTabChange?.(tabId);
21423
- if (tabChangeEvent) {
21424
- eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
21425
- }
21426
- if (tabEvent) {
21427
- eventBus.emit(`UI:${tabEvent}`, { tabId });
21428
- }
21429
- };
21430
- const handleKeyDown = (e, index) => {
21431
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
21432
- e.preventDefault();
21433
- const direction = e.key === "ArrowLeft" ? -1 : 1;
21434
- const nextIndex = (index + direction + safeItems.length) % safeItems.length;
21435
- const nextTab = safeItems[nextIndex];
21436
- if (nextTab && !nextTab.disabled) {
21437
- handleTabChange(nextTab.id);
21438
- tabRefs.current[nextTab.id]?.focus();
21439
- }
21440
- } else if (e.key === "Home" || e.key === "End") {
21441
- e.preventDefault();
21442
- const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
21443
- const targetTab = safeItems[targetIndex];
21444
- if (targetTab && !targetTab.disabled) {
21445
- handleTabChange(targetTab.id);
21446
- tabRefs.current[targetTab.id]?.focus();
21447
- }
21448
- }
21449
- };
21450
- const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
21451
- if (safeItems.length === 0) {
21452
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
21453
- }
21454
- const variantClasses2 = {
21455
- default: [
21456
- "border-b-[length:var(--border-width)] border-transparent",
21457
- "hover:border-muted-foreground",
21458
- "data-[active=true]:border-primary"
21459
- ].join(" "),
21460
- pills: [
21461
- "rounded-sm",
21462
- "data-[active=true]:bg-primary",
21463
- "data-[active=true]:text-primary-foreground"
21464
- ].join(" "),
21465
- underline: [
21466
- "border-b-[length:var(--border-width)] border-transparent",
21467
- "data-[active=true]:border-primary"
21468
- ].join(" ")
21469
- };
21470
- return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
21471
- /* @__PURE__ */ jsx(
21472
- Box,
21473
- {
21474
- role: "tablist",
21475
- className: cn(
21476
- "flex",
21477
- // Horizontal tab strip becomes a horizontally-scrollable lane
21478
- // below its container width — phones with many tabs scroll
21479
- // instead of clipping. `snap-x` snaps to each tab; the
21480
- // scrollbar is hidden for a cleaner affordance (the swipe
21481
- // gesture is the discoverability cue).
21482
- orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
21483
- variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
21484
- variant === "underline" && orientation === "vertical" && "border-b-0"
21485
- ),
21486
- children: safeItems.map((item, index) => {
21487
- const isActive = item.id === activeTab;
21488
- const isDisabled = item.disabled;
21489
- return /* @__PURE__ */ jsxs(
21490
- Box,
21491
- {
21492
- as: "button",
21493
- ref: (el) => {
21494
- tabRefs.current[item.id] = el;
21495
- },
21496
- role: "tab",
21497
- "aria-selected": isActive,
21498
- "aria-controls": `tabpanel-${item.id}`,
21499
- "aria-disabled": isDisabled,
21500
- onClick: () => !isDisabled && handleTabChange(item.id, item.event),
21501
- onKeyDown: (e) => handleKeyDown(e, index),
21502
- "data-active": isActive,
21503
- className: cn(
21504
- "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
21505
- orientation === "horizontal" && "snap-start shrink-0",
21506
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
21507
- isDisabled && "opacity-50 cursor-not-allowed",
21508
- variantClasses2[variant],
21509
- isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
21510
- ),
21511
- children: [
21512
- item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
21513
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
21514
- item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
21515
- ]
21516
- },
21517
- item.id
21518
- );
21519
- })
21520
- }
21521
- ),
21522
- activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
21523
- Box,
21524
- {
21525
- role: "tabpanel",
21526
- id: `tabpanel-${activeTab}`,
21527
- "aria-labelledby": `tab-${activeTab}`,
21528
- className: "mt-4",
21529
- children: activeTabContent
21530
- }
21531
- )
21532
- ] });
21533
- };
21534
- Tabs.displayName = "Tabs";
21535
- }
21536
- });
21537
- function generateDiff(oldVal, newVal) {
21538
- const oldLines = oldVal.split("\n");
21539
- const newLines = newVal.split("\n");
21540
- const diff = [];
21541
- const maxLen = Math.max(oldLines.length, newLines.length);
21542
- for (let i = 0; i < maxLen; i++) {
21543
- const oldLine = oldLines[i];
21544
- const newLine = newLines[i];
21545
- if (oldLine === newLine) {
21546
- diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
21547
- } else {
21548
- if (oldLine !== void 0) {
21549
- diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
21550
- }
21551
- if (newLine !== void 0) {
21552
- diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
21553
- }
21554
- }
21555
- }
21556
- return diff;
21557
- }
21558
- var DIFF_STYLES, CodeViewer;
21559
- var init_CodeViewer = __esm({
21560
- "components/core/molecules/CodeViewer.tsx"() {
21561
- "use client";
21562
- init_cn();
21563
- init_atoms2();
21564
- init_Stack();
21565
- init_LoadingState();
21566
- init_ErrorState();
21567
- init_EmptyState();
21568
- init_Tabs();
21569
- init_useEventBus();
21570
- DIFF_STYLES = {
21571
- add: {
21572
- bg: "bg-success/10",
21573
- prefix: "+",
21574
- text: "text-success"
21575
- },
21576
- remove: {
21577
- bg: "bg-error/10",
21578
- prefix: "-",
21579
- text: "text-error"
21580
- },
21581
- context: {
21582
- bg: "",
21583
- prefix: " ",
21584
- text: "text-foreground"
21585
- }
21586
- };
21587
- CodeViewer = ({
21588
- title,
21589
- code,
21590
- language,
21591
- diff: propDiff,
21592
- oldValue,
21593
- newValue,
21594
- mode = "code",
21595
- showLineNumbers = true,
21596
- showCopy = true,
21597
- wordWrap = false,
21598
- maxHeight = 500,
21599
- files,
21600
- actions,
21601
- entity,
21602
- isLoading = false,
21603
- error,
21604
- className
21605
- }) => {
21606
- const eventBus = useEventBus();
21607
- const { t } = useTranslate();
21608
- const [copied, setCopied] = useState(false);
21609
- const [wrap, setWrap] = useState(wordWrap);
21610
- const [activeFileIndex, setActiveFileIndex] = useState(0);
21611
- const handleAction = useCallback(
21612
- (action) => {
21613
- if (action.event) {
21614
- eventBus.emit(`UI:${action.event}`, {});
21615
- }
21616
- },
21617
- [eventBus]
21618
- );
21619
- const activeFile = files?.[activeFileIndex];
21620
- const activeCode = activeFile?.code ?? code ?? "";
21621
- const activeLanguage = activeFile?.language ?? language ?? "text";
21622
- const lines = useMemo(() => activeCode.split("\n"), [activeCode]);
21623
- const diffLines = useMemo(() => {
21624
- if (propDiff) return propDiff;
21625
- if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
21626
- return generateDiff(oldValue, newValue);
21627
- }
21628
- return null;
21629
- }, [propDiff, mode, oldValue, newValue]);
21630
- const handleCopy = useCallback(async () => {
21631
- try {
21632
- await navigator.clipboard.writeText(activeCode);
21633
- setCopied(true);
21634
- eventBus.emit("UI:CODE_COPY", { language: activeLanguage });
21635
- setTimeout(() => setCopied(false), 2e3);
21636
- } catch {
21637
- }
21638
- }, [activeCode, eventBus, activeLanguage]);
21639
- const tabItems = files?.map((file, idx) => ({
21640
- id: `file-${idx}`,
21641
- label: file.label,
21642
- content: null
21643
- }));
21644
- if (isLoading) {
21645
- return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
21646
- }
21647
- if (error) {
21648
- return /* @__PURE__ */ jsx(
21649
- ErrorState,
21650
- {
21651
- title: t("display.codeViewerError"),
21652
- message: error.message,
21653
- className
21654
- }
21655
- );
21656
- }
21657
- if (!activeCode && !diffLines) {
21658
- return /* @__PURE__ */ jsx(
21659
- EmptyState,
21660
- {
21661
- icon: Code,
21662
- title: t("display.noCode"),
21663
- description: "No code to display.",
21664
- className
21665
- }
21666
- );
21667
- }
21668
- return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
21669
- tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
21670
- Tabs,
21671
- {
21672
- tabs: tabItems,
21673
- activeTab: `file-${activeFileIndex}`,
21674
- onTabChange: (id) => {
21675
- const idx = parseInt(id.replace("file-", ""), 10);
21676
- setActiveFileIndex(idx);
21677
- }
21678
- }
21679
- ) }),
21680
- /* @__PURE__ */ jsxs(
21681
- HStack,
21682
- {
21683
- gap: "sm",
21684
- align: "center",
21685
- justify: "between",
21686
- className: "px-4 py-2 border-b border-border bg-muted/30",
21687
- children: [
21688
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
21689
- /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
21690
- title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
21691
- activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
21692
- ] }),
21693
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
21694
- /* @__PURE__ */ jsx(
21695
- Button,
21696
- {
21697
- variant: "ghost",
21698
- size: "sm",
21699
- icon: WrapText,
21700
- onClick: () => setWrap(!wrap),
21701
- className: cn(wrap && "text-primary")
21702
- }
21703
- ),
21704
- showCopy && /* @__PURE__ */ jsx(
21705
- Button,
21706
- {
21707
- variant: "ghost",
21708
- size: "sm",
21709
- icon: copied ? Check : Copy,
21710
- onClick: handleCopy,
21711
- className: cn(copied && "text-success")
21712
- }
21713
- ),
21714
- actions?.map((action, idx) => /* @__PURE__ */ jsx(
21715
- Badge,
21716
- {
21717
- variant: "default",
21718
- className: "cursor-pointer hover:opacity-80 transition-opacity",
21719
- onClick: () => handleAction(action),
21720
- children: action.label
21721
- },
21722
- idx
21723
- ))
21724
- ] })
21725
- ]
21726
- }
21727
- ),
21728
- /* @__PURE__ */ jsx(
21729
- Box,
21730
- {
21731
- className: "overflow-auto bg-muted/20",
21732
- style: { maxHeight },
21733
- children: diffLines ? (
21734
- /* Diff mode */
21735
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: diffLines.map((line, idx) => {
21736
- const style = DIFF_STYLES[line.type];
21737
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
21738
- showLineNumbers && /* @__PURE__ */ jsx(
21739
- Typography,
21740
- {
21741
- variant: "caption",
21742
- color: "secondary",
21743
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
21744
- children: line.lineNumber ?? ""
21745
- }
21746
- ),
21747
- /* @__PURE__ */ jsxs(
21748
- Typography,
21749
- {
21750
- variant: "caption",
21751
- className: cn(
21752
- "font-mono flex-1 min-w-0",
21753
- style.text,
21754
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
21755
- ),
21756
- children: [
21757
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
21758
- line.content
21759
- ]
21760
- }
21761
- )
21762
- ] }, idx);
21763
- }) })
21764
- ) : (
21765
- /* Code mode */
21766
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
21767
- showLineNumbers && /* @__PURE__ */ jsx(
21768
- Typography,
21769
- {
21770
- variant: "caption",
21771
- color: "secondary",
21772
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
21773
- children: idx + 1
21774
- }
21775
- ),
21776
- /* @__PURE__ */ jsx(
21777
- Typography,
21778
- {
21779
- variant: "caption",
21780
- className: cn(
21781
- "font-mono flex-1 min-w-0",
21782
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
21783
- ),
21784
- children: line || " "
21785
- }
21786
- )
21787
- ] }, idx)) })
21788
- )
21789
- }
21790
- )
21791
- ] }) });
21792
- };
21793
- CodeViewer.displayName = "CodeViewer";
21794
- }
21795
- });
21796
21791
  function CombatLog({
21797
21792
  events: events2,
21798
21793
  maxVisible = 50,
@@ -22267,7 +22262,7 @@ function CraftingRecipe({
22267
22262
  className
22268
22263
  }) {
22269
22264
  const eventBus = useEventBus();
22270
- const handleCraft = React87.useCallback(() => {
22265
+ const handleCraft = React85.useCallback(() => {
22271
22266
  onCraft?.();
22272
22267
  if (craftEvent) {
22273
22268
  eventBus.emit(craftEvent, { output: output.label });
@@ -22284,7 +22279,7 @@ function CraftingRecipe({
22284
22279
  children: [
22285
22280
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
22286
22281
  const hasSufficient = ingredient.available >= ingredient.required;
22287
- return /* @__PURE__ */ jsxs(React87.Fragment, { children: [
22282
+ return /* @__PURE__ */ jsxs(React85.Fragment, { children: [
22288
22283
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
22289
22284
  ItemSlot,
22290
22285
  {
@@ -22347,8 +22342,8 @@ function DPad({
22347
22342
  }) {
22348
22343
  const eventBus = useEventBus();
22349
22344
  const sizes = sizeMap15[size];
22350
- const [activeDirections, setActiveDirections] = React87.useState(/* @__PURE__ */ new Set());
22351
- const handlePress = React87.useCallback(
22345
+ const [activeDirections, setActiveDirections] = React85.useState(/* @__PURE__ */ new Set());
22346
+ const handlePress = React85.useCallback(
22352
22347
  (direction) => {
22353
22348
  setActiveDirections((prev) => new Set(prev).add(direction));
22354
22349
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -22356,7 +22351,7 @@ function DPad({
22356
22351
  },
22357
22352
  [directionEvent, eventBus, onDirection]
22358
22353
  );
22359
- const handleRelease = React87.useCallback(
22354
+ const handleRelease = React85.useCallback(
22360
22355
  (direction) => {
22361
22356
  setActiveDirections((prev) => {
22362
22357
  const next = new Set(prev);
@@ -23042,14 +23037,14 @@ function useDataDnd(args) {
23042
23037
  const isZone = Boolean(dragGroup || accepts || sortable);
23043
23038
  const enabled = isZone || Boolean(dndRoot);
23044
23039
  const eventBus = useEventBus();
23045
- const parentRoot = React87__default.useContext(RootCtx);
23040
+ const parentRoot = React85__default.useContext(RootCtx);
23046
23041
  const isRoot = enabled && parentRoot === null;
23047
- const zoneId = React87__default.useId();
23042
+ const zoneId = React85__default.useId();
23048
23043
  const ownGroup = dragGroup ?? accepts ?? zoneId;
23049
- const [optimisticOrders, setOptimisticOrders] = React87__default.useState(() => /* @__PURE__ */ new Map());
23050
- const optimisticOrdersRef = React87__default.useRef(optimisticOrders);
23044
+ const [optimisticOrders, setOptimisticOrders] = React85__default.useState(() => /* @__PURE__ */ new Map());
23045
+ const optimisticOrdersRef = React85__default.useRef(optimisticOrders);
23051
23046
  optimisticOrdersRef.current = optimisticOrders;
23052
- const clearOptimisticOrder = React87__default.useCallback((group) => {
23047
+ const clearOptimisticOrder = React85__default.useCallback((group) => {
23053
23048
  setOptimisticOrders((prev) => {
23054
23049
  if (!prev.has(group)) return prev;
23055
23050
  const next = new Map(prev);
@@ -23074,7 +23069,7 @@ function useDataDnd(args) {
23074
23069
  const raw = it[dndItemIdField];
23075
23070
  return String(raw ?? `__idx_${idx}`);
23076
23071
  }).join("|");
23077
- const itemIds = React87__default.useMemo(
23072
+ const itemIds = React85__default.useMemo(
23078
23073
  () => orderedItems.map((it, idx) => {
23079
23074
  const raw = it[dndItemIdField];
23080
23075
  return raw ?? `__idx_${idx}`;
@@ -23082,7 +23077,7 @@ function useDataDnd(args) {
23082
23077
  [itemIdsSignature]
23083
23078
  );
23084
23079
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
23085
- React87__default.useEffect(() => {
23080
+ React85__default.useEffect(() => {
23086
23081
  const root = isRoot ? null : parentRoot;
23087
23082
  if (root) {
23088
23083
  root.clearOptimisticOrder(ownGroup);
@@ -23090,20 +23085,20 @@ function useDataDnd(args) {
23090
23085
  clearOptimisticOrder(ownGroup);
23091
23086
  }
23092
23087
  }, [itemsContentSig, ownGroup]);
23093
- const zonesRef = React87__default.useRef(/* @__PURE__ */ new Map());
23094
- const registerZone = React87__default.useCallback((zoneId2, meta2) => {
23088
+ const zonesRef = React85__default.useRef(/* @__PURE__ */ new Map());
23089
+ const registerZone = React85__default.useCallback((zoneId2, meta2) => {
23095
23090
  zonesRef.current.set(zoneId2, meta2);
23096
23091
  }, []);
23097
- const unregisterZone = React87__default.useCallback((zoneId2) => {
23092
+ const unregisterZone = React85__default.useCallback((zoneId2) => {
23098
23093
  zonesRef.current.delete(zoneId2);
23099
23094
  }, []);
23100
- const [activeDrag, setActiveDrag] = React87__default.useState(null);
23101
- const [overZoneGroup, setOverZoneGroup] = React87__default.useState(null);
23102
- const meta = React87__default.useMemo(
23095
+ const [activeDrag, setActiveDrag] = React85__default.useState(null);
23096
+ const [overZoneGroup, setOverZoneGroup] = React85__default.useState(null);
23097
+ const meta = React85__default.useMemo(
23103
23098
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
23104
23099
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
23105
23100
  );
23106
- React87__default.useEffect(() => {
23101
+ React85__default.useEffect(() => {
23107
23102
  const target = isRoot ? null : parentRoot;
23108
23103
  if (!target) {
23109
23104
  zonesRef.current.set(zoneId, meta);
@@ -23122,7 +23117,7 @@ function useDataDnd(args) {
23122
23117
  }, [parentRoot, isRoot, zoneId, meta]);
23123
23118
  const sensors = useAlmadarDndSensors(true);
23124
23119
  const collisionDetection = almadarDndCollisionDetection;
23125
- const findZoneByItem = React87__default.useCallback(
23120
+ const findZoneByItem = React85__default.useCallback(
23126
23121
  (id) => {
23127
23122
  for (const z of zonesRef.current.values()) {
23128
23123
  if (z.itemIds.includes(id)) return z;
@@ -23131,7 +23126,7 @@ function useDataDnd(args) {
23131
23126
  },
23132
23127
  []
23133
23128
  );
23134
- React87__default.useCallback(
23129
+ React85__default.useCallback(
23135
23130
  (group) => {
23136
23131
  for (const z of zonesRef.current.values()) {
23137
23132
  if (z.group === group) return z;
@@ -23140,7 +23135,7 @@ function useDataDnd(args) {
23140
23135
  },
23141
23136
  []
23142
23137
  );
23143
- const handleDragEnd = React87__default.useCallback(
23138
+ const handleDragEnd = React85__default.useCallback(
23144
23139
  (event) => {
23145
23140
  const { active, over } = event;
23146
23141
  const activeIdStr = String(active.id);
@@ -23231,8 +23226,8 @@ function useDataDnd(args) {
23231
23226
  },
23232
23227
  [eventBus]
23233
23228
  );
23234
- const sortableData = React87__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
23235
- const SortableItem = React87__default.useCallback(
23229
+ const sortableData = React85__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
23230
+ const SortableItem = React85__default.useCallback(
23236
23231
  ({ id, children }) => {
23237
23232
  const {
23238
23233
  attributes,
@@ -23272,7 +23267,7 @@ function useDataDnd(args) {
23272
23267
  id: droppableId,
23273
23268
  data: sortableData
23274
23269
  });
23275
- const ctx = React87__default.useContext(RootCtx);
23270
+ const ctx = React85__default.useContext(RootCtx);
23276
23271
  const activeDrag2 = ctx?.activeDrag ?? null;
23277
23272
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
23278
23273
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -23287,7 +23282,7 @@ function useDataDnd(args) {
23287
23282
  showForeignPlaceholder,
23288
23283
  ctxAvailable: ctx != null
23289
23284
  });
23290
- React87__default.useEffect(() => {
23285
+ React85__default.useEffect(() => {
23291
23286
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
23292
23287
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
23293
23288
  return /* @__PURE__ */ jsx(
@@ -23301,11 +23296,11 @@ function useDataDnd(args) {
23301
23296
  }
23302
23297
  );
23303
23298
  };
23304
- const rootContextValue = React87__default.useMemo(
23299
+ const rootContextValue = React85__default.useMemo(
23305
23300
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
23306
23301
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
23307
23302
  );
23308
- const handleDragStart = React87__default.useCallback((event) => {
23303
+ const handleDragStart = React85__default.useCallback((event) => {
23309
23304
  const sourceZone = findZoneByItem(event.active.id);
23310
23305
  const rect = event.active.rect.current.initial;
23311
23306
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -23324,7 +23319,7 @@ function useDataDnd(args) {
23324
23319
  isRoot
23325
23320
  });
23326
23321
  }, [findZoneByItem, isRoot, zoneId]);
23327
- const handleDragOver = React87__default.useCallback((event) => {
23322
+ const handleDragOver = React85__default.useCallback((event) => {
23328
23323
  const { active, over } = event;
23329
23324
  const overData = over?.data?.current;
23330
23325
  const overGroup = overData?.dndGroup ?? null;
@@ -23394,7 +23389,7 @@ function useDataDnd(args) {
23394
23389
  return next;
23395
23390
  });
23396
23391
  }, []);
23397
- const handleDragCancel = React87__default.useCallback((event) => {
23392
+ const handleDragCancel = React85__default.useCallback((event) => {
23398
23393
  setActiveDrag(null);
23399
23394
  setOverZoneGroup(null);
23400
23395
  dndLog.warn("dragCancel", {
@@ -23402,12 +23397,12 @@ function useDataDnd(args) {
23402
23397
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
23403
23398
  });
23404
23399
  }, []);
23405
- const handleDragEndWithCleanup = React87__default.useCallback((event) => {
23400
+ const handleDragEndWithCleanup = React85__default.useCallback((event) => {
23406
23401
  handleDragEnd(event);
23407
23402
  setActiveDrag(null);
23408
23403
  setOverZoneGroup(null);
23409
23404
  }, [handleDragEnd]);
23410
- const wrapContainer = React87__default.useCallback(
23405
+ const wrapContainer = React85__default.useCallback(
23411
23406
  (children) => {
23412
23407
  if (!enabled) return children;
23413
23408
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -23461,7 +23456,7 @@ var init_useDataDnd = __esm({
23461
23456
  init_useAlmadarDndCollision();
23462
23457
  init_Box();
23463
23458
  dndLog = createLogger("almadar:ui:dnd");
23464
- RootCtx = React87__default.createContext(null);
23459
+ RootCtx = React85__default.createContext(null);
23465
23460
  }
23466
23461
  });
23467
23462
  function fieldLabel2(key) {
@@ -23981,7 +23976,7 @@ function DataList({
23981
23976
  }) {
23982
23977
  const eventBus = useEventBus();
23983
23978
  const { t } = useTranslate();
23984
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize || Infinity);
23979
+ const [visibleCount, setVisibleCount] = React85__default.useState(pageSize || Infinity);
23985
23980
  const fieldDefs = fields ?? columns ?? [];
23986
23981
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
23987
23982
  const dnd = useDataDnd({
@@ -24000,7 +23995,7 @@ function DataList({
24000
23995
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
24001
23996
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
24002
23997
  const hasRenderProp = typeof children === "function";
24003
- React87__default.useEffect(() => {
23998
+ React85__default.useEffect(() => {
24004
23999
  const renderItemTypeOf = typeof schemaRenderItem;
24005
24000
  const childrenTypeOf = typeof children;
24006
24001
  if (data.length > 0 && !hasRenderProp) {
@@ -24105,7 +24100,7 @@ function DataList({
24105
24100
  const items2 = data.map((item) => item);
24106
24101
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
24107
24102
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
24108
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
24103
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
24109
24104
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
24110
24105
  group.items.map((itemData, index) => {
24111
24106
  const id = itemData.id || `${gi}-${index}`;
@@ -24253,7 +24248,7 @@ function DataList({
24253
24248
  className
24254
24249
  ),
24255
24250
  children: [
24256
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
24251
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
24257
24252
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
24258
24253
  group.items.map(
24259
24254
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -25627,7 +25622,7 @@ var init_WizardProgress = __esm({
25627
25622
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
25628
25623
  const isActive = index === currentStep;
25629
25624
  const isCompleted = index < currentStep;
25630
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
25625
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
25631
25626
  /* @__PURE__ */ jsx(
25632
25627
  "button",
25633
25628
  {
@@ -26144,8 +26139,9 @@ var init_FormSectionHeader = __esm({
26144
26139
  Box,
26145
26140
  {
26146
26141
  className: cn(
26147
- "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
26148
- isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
26142
+ "px-5 py-4 bg-muted/60 rounded-lg",
26143
+ "border border-border border-l-4 border-l-primary",
26144
+ isClickable && "cursor-pointer hover:bg-muted transition-colors",
26149
26145
  className
26150
26146
  ),
26151
26147
  onClick: isClickable ? onToggle : void 0,
@@ -26156,7 +26152,7 @@ var init_FormSectionHeader = __esm({
26156
26152
  {
26157
26153
  name: icon,
26158
26154
  size: "md",
26159
- className: "text-primary"
26155
+ className: "text-primary shrink-0"
26160
26156
  }
26161
26157
  ),
26162
26158
  statusIcon && /* @__PURE__ */ jsx(
@@ -26164,12 +26160,15 @@ var init_FormSectionHeader = __esm({
26164
26160
  {
26165
26161
  name: statusIcon,
26166
26162
  size: "md",
26167
- className: hasErrors ? "text-error" : "text-success"
26163
+ className: cn(
26164
+ "shrink-0",
26165
+ hasErrors ? "text-error" : "text-success"
26166
+ )
26168
26167
  }
26169
26168
  ),
26170
26169
  /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
26171
- /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
26172
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
26170
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", className: "text-foreground", children: title }),
26171
+ subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "leading-snug", children: subtitle })
26173
26172
  ] })
26174
26173
  ] }),
26175
26174
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -26178,9 +26177,9 @@ var init_FormSectionHeader = __esm({
26178
26177
  Icon,
26179
26178
  {
26180
26179
  name: "chevron-down",
26181
- size: "md",
26180
+ size: "sm",
26182
26181
  className: cn(
26183
- "text-muted-foreground transition-transform",
26182
+ "text-muted-foreground transition-transform duration-200 shrink-0",
26184
26183
  isCollapsed && "-rotate-90"
26185
26184
  )
26186
26185
  }
@@ -26682,7 +26681,7 @@ function InventoryGrid({
26682
26681
  const eventBus = useEventBus();
26683
26682
  const slotCount = totalSlots ?? items.length;
26684
26683
  const emptySlotCount = Math.max(0, slotCount - items.length);
26685
- const handleSelect = React87.useCallback(
26684
+ const handleSelect = React85.useCallback(
26686
26685
  (id) => {
26687
26686
  onSelect?.(id);
26688
26687
  if (selectEvent) {
@@ -26899,31 +26898,31 @@ function GameCanvas2D({
26899
26898
  assetBaseUrl = "",
26900
26899
  className
26901
26900
  }) {
26902
- const canvasRef = React87.useRef(null);
26903
- const rafRef = React87.useRef(0);
26904
- const frameRef = React87.useRef(0);
26905
- const lastTimeRef = React87.useRef(0);
26906
- const imageCache = React87.useRef(/* @__PURE__ */ new Map());
26901
+ const canvasRef = React85.useRef(null);
26902
+ const rafRef = React85.useRef(0);
26903
+ const frameRef = React85.useRef(0);
26904
+ const lastTimeRef = React85.useRef(0);
26905
+ const imageCache = React85.useRef(/* @__PURE__ */ new Map());
26907
26906
  const emit = useEmitEvent();
26908
- const onDrawRef = React87.useRef(onDraw);
26907
+ const onDrawRef = React85.useRef(onDraw);
26909
26908
  onDrawRef.current = onDraw;
26910
- const onTickRef = React87.useRef(onTick);
26909
+ const onTickRef = React85.useRef(onTick);
26911
26910
  onTickRef.current = onTick;
26912
- const tickEventRef = React87.useRef(tickEvent);
26911
+ const tickEventRef = React85.useRef(tickEvent);
26913
26912
  tickEventRef.current = tickEvent;
26914
- const drawEventRef = React87.useRef(drawEvent);
26913
+ const drawEventRef = React85.useRef(drawEvent);
26915
26914
  drawEventRef.current = drawEvent;
26916
- const emitRef = React87.useRef(emit);
26915
+ const emitRef = React85.useRef(emit);
26917
26916
  emitRef.current = emit;
26918
- const assetBaseUrlRef = React87.useRef(assetBaseUrl);
26917
+ const assetBaseUrlRef = React85.useRef(assetBaseUrl);
26919
26918
  assetBaseUrlRef.current = assetBaseUrl;
26920
- const backgroundImageRef = React87.useRef(backgroundImage);
26919
+ const backgroundImageRef = React85.useRef(backgroundImage);
26921
26920
  backgroundImageRef.current = backgroundImage;
26922
- const widthRef = React87.useRef(width);
26921
+ const widthRef = React85.useRef(width);
26923
26922
  widthRef.current = width;
26924
- const heightRef = React87.useRef(height);
26923
+ const heightRef = React85.useRef(height);
26925
26924
  heightRef.current = height;
26926
- const loadImage = React87.useCallback((url) => {
26925
+ const loadImage = React85.useCallback((url) => {
26927
26926
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
26928
26927
  const cached = imageCache.current.get(fullUrl);
26929
26928
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -26935,7 +26934,7 @@ function GameCanvas2D({
26935
26934
  }
26936
26935
  return null;
26937
26936
  }, []);
26938
- React87.useEffect(() => {
26937
+ React85.useEffect(() => {
26939
26938
  const canvas = canvasRef.current;
26940
26939
  if (!canvas) return;
26941
26940
  const ctx = canvas.getContext("2d");
@@ -27238,7 +27237,7 @@ function TurnPanel({
27238
27237
  className
27239
27238
  }) {
27240
27239
  const eventBus = useEventBus();
27241
- const handleAction = React87.useCallback(
27240
+ const handleAction = React85.useCallback(
27242
27241
  (event) => {
27243
27242
  if (event) {
27244
27243
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -27384,7 +27383,7 @@ function UnitCommandBar({
27384
27383
  className
27385
27384
  }) {
27386
27385
  const eventBus = useEventBus();
27387
- const handleCommand = React87.useCallback(
27386
+ const handleCommand = React85.useCallback(
27388
27387
  (event) => {
27389
27388
  if (event) {
27390
27389
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -27869,7 +27868,7 @@ function GameMenu({
27869
27868
  } catch {
27870
27869
  }
27871
27870
  const eventBus = eventBusProp || eventBusFromHook;
27872
- const handleOptionClick = React87.useCallback(
27871
+ const handleOptionClick = React85.useCallback(
27873
27872
  (option) => {
27874
27873
  if (option.event && eventBus) {
27875
27874
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27983,7 +27982,7 @@ function GameOverScreen({
27983
27982
  } catch {
27984
27983
  }
27985
27984
  const eventBus = eventBusProp || eventBusFromHook;
27986
- const handleActionClick = React87.useCallback(
27985
+ const handleActionClick = React85.useCallback(
27987
27986
  (action) => {
27988
27987
  if (action.event && eventBus) {
27989
27988
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28977,7 +28976,7 @@ var init_StarRating = __esm({
28977
28976
  name: "star",
28978
28977
  className: cn(
28979
28978
  styles.star,
28980
- "text-muted-foreground",
28979
+ "text-foreground/30",
28981
28980
  "transition-colors duration-100"
28982
28981
  ),
28983
28982
  strokeWidth: 1.5
@@ -29460,8 +29459,8 @@ function TableView({
29460
29459
  }) {
29461
29460
  const eventBus = useEventBus();
29462
29461
  const { t } = useTranslate();
29463
- const [visibleCount, setVisibleCount] = React87__default.useState(pageSize > 0 ? pageSize : Infinity);
29464
- const [localSelected, setLocalSelected] = React87__default.useState(/* @__PURE__ */ new Set());
29462
+ const [visibleCount, setVisibleCount] = React85__default.useState(pageSize > 0 ? pageSize : Infinity);
29463
+ const [localSelected, setLocalSelected] = React85__default.useState(/* @__PURE__ */ new Set());
29465
29464
  const colDefs = columns ?? fields ?? [];
29466
29465
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29467
29466
  const dnd = useDataDnd({
@@ -29656,12 +29655,12 @@ function TableView({
29656
29655
  ]
29657
29656
  }
29658
29657
  );
29659
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React87__default.Fragment, { children: rowInner }, id);
29658
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React85__default.Fragment, { children: rowInner }, id);
29660
29659
  };
29661
29660
  const items = data.map((row) => row);
29662
29661
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
29663
29662
  let runningIndex = 0;
29664
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
29663
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
29665
29664
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
29666
29665
  group.items.map((row) => renderRow(row, runningIndex++))
29667
29666
  ] }, gi)) });
@@ -31013,7 +31012,7 @@ var init_StepFlow = __esm({
31013
31012
  className
31014
31013
  }) => {
31015
31014
  if (orientation === "vertical") {
31016
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React87__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
31015
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
31017
31016
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
31018
31017
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
31019
31018
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -31024,7 +31023,7 @@ var init_StepFlow = __esm({
31024
31023
  ] })
31025
31024
  ] }) }, index)) });
31026
31025
  }
31027
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
31026
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
31028
31027
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
31029
31028
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
31030
31029
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31779,11 +31778,19 @@ function LatticeSVG({
31779
31778
  function f2(n) {
31780
31779
  return n.toFixed(2);
31781
31780
  }
31782
- var VARIANT_MAP2, EdgeDecoration;
31781
+ var colorTokenVars, VARIANT_MAP2, EdgeDecoration;
31783
31782
  var init_EdgeDecoration = __esm({
31784
31783
  "components/core/molecules/EdgeDecoration.tsx"() {
31785
31784
  "use client";
31786
31785
  init_cn();
31786
+ colorTokenVars = {
31787
+ primary: "var(--color-primary)",
31788
+ secondary: "var(--color-secondary)",
31789
+ success: "var(--color-success)",
31790
+ warning: "var(--color-warning)",
31791
+ error: "var(--color-error)",
31792
+ muted: "var(--color-muted)"
31793
+ };
31787
31794
  VARIANT_MAP2 = {
31788
31795
  arch: ArchSVG,
31789
31796
  vine: VineSVG,
@@ -31793,13 +31800,14 @@ var init_EdgeDecoration = __esm({
31793
31800
  variant = "arch",
31794
31801
  side = "both",
31795
31802
  opacity = 0.15,
31796
- color = "var(--color-primary)",
31803
+ color = "primary",
31797
31804
  strokeWidth = 0.5,
31798
31805
  width = 15,
31799
31806
  className
31800
31807
  }) => {
31801
31808
  const id = useId();
31802
31809
  const Variant = VARIANT_MAP2[variant];
31810
+ const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
31803
31811
  const sides = side === "both" ? ["left", "right"] : [side];
31804
31812
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
31805
31813
  "svg",
@@ -31822,7 +31830,7 @@ var init_EdgeDecoration = __esm({
31822
31830
  facing: s,
31823
31831
  w: 200,
31824
31832
  h: 600,
31825
- color,
31833
+ color: resolvedColor,
31826
31834
  strokeWidth
31827
31835
  }
31828
31836
  )
@@ -32000,7 +32008,7 @@ var init_LikertScale = __esm({
32000
32008
  md: "text-base",
32001
32009
  lg: "text-lg"
32002
32010
  };
32003
- LikertScale = React87__default.forwardRef(
32011
+ LikertScale = React85__default.forwardRef(
32004
32012
  ({
32005
32013
  question,
32006
32014
  options = DEFAULT_LIKERT_OPTIONS,
@@ -32012,7 +32020,7 @@ var init_LikertScale = __esm({
32012
32020
  variant = "radios",
32013
32021
  className
32014
32022
  }, ref) => {
32015
- const groupId = React87__default.useId();
32023
+ const groupId = React85__default.useId();
32016
32024
  const eventBus = useEventBus();
32017
32025
  const handleSelect = useCallback(
32018
32026
  (next) => {
@@ -33162,7 +33170,6 @@ function BlockRow({
33162
33170
  onUpdate,
33163
33171
  onDelete,
33164
33172
  onDuplicate,
33165
- onInsertAfter,
33166
33173
  onChangeType
33167
33174
  }) {
33168
33175
  const { t } = useTranslate();
@@ -33438,34 +33445,16 @@ function BlockRow({
33438
33445
  "data-block-id": block.id,
33439
33446
  "data-block-type": block.type,
33440
33447
  children: [
33441
- !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
33442
- /* @__PURE__ */ jsx(
33443
- Button,
33444
- {
33445
- type: "button",
33446
- variant: "ghost",
33447
- "aria-label": t("richBlockEditor.insertParagraphBelow"),
33448
- className: cn(
33449
- "inline-flex h-6 w-6 items-center justify-center rounded-sm p-0 gap-0",
33450
- "text-muted-foreground hover:bg-muted hover:text-foreground",
33451
- "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
33452
- "transition-opacity"
33453
- ),
33454
- onClick: () => onInsertAfter("paragraph"),
33455
- children: /* @__PURE__ */ jsx(Icon, { name: "plus", className: "w-3.5 h-3.5" })
33456
- }
33457
- ),
33458
- /* @__PURE__ */ jsx(
33459
- BlockMenu,
33460
- {
33461
- block,
33462
- readOnly,
33463
- onDelete,
33464
- onDuplicate,
33465
- onChangeType
33466
- }
33467
- )
33468
- ] }),
33448
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { className: "flex w-8 shrink-0 items-center pt-1", children: /* @__PURE__ */ jsx(
33449
+ BlockMenu,
33450
+ {
33451
+ block,
33452
+ readOnly,
33453
+ onDelete,
33454
+ onDuplicate,
33455
+ onChangeType
33456
+ }
33457
+ ) }),
33469
33458
  /* @__PURE__ */ jsx(Box, { className: "min-w-0 flex-1", children: renderBody() })
33470
33459
  ]
33471
33460
  }
@@ -33588,12 +33577,6 @@ var init_RichBlockEditor = __esm({
33588
33577
  },
33589
33578
  [blocks, commit]
33590
33579
  );
33591
- const handleInsertAfter = useCallback(
33592
- (id, type) => {
33593
- commit(insertAfter(blocks, id, createBlock(type)));
33594
- },
33595
- [blocks, commit]
33596
- );
33597
33580
  const handleChangeType = useCallback(
33598
33581
  (id, type) => {
33599
33582
  commit(
@@ -33650,7 +33633,6 @@ var init_RichBlockEditor = __esm({
33650
33633
  onUpdate: (updater) => handleUpdate(block.id, updater),
33651
33634
  onDelete: () => handleDelete(block.id),
33652
33635
  onDuplicate: () => handleDuplicate(block.id),
33653
- onInsertAfter: (type) => handleInsertAfter(block.id, type),
33654
33636
  onChangeType: (type) => handleChangeType(block.id, type)
33655
33637
  },
33656
33638
  block.id
@@ -34320,7 +34302,7 @@ var init_DocBreadcrumb = __esm({
34320
34302
  "aria-label": t("aria.breadcrumb"),
34321
34303
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
34322
34304
  const isLast = idx === items.length - 1;
34323
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
34305
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
34324
34306
  idx > 0 && /* @__PURE__ */ jsx(
34325
34307
  Icon,
34326
34308
  {
@@ -34367,108 +34349,6 @@ var init_DocBreadcrumb = __esm({
34367
34349
  DocBreadcrumb.displayName = "DocBreadcrumb";
34368
34350
  }
34369
34351
  });
34370
- function DocCodeBlock({
34371
- code,
34372
- language,
34373
- title,
34374
- showLineNumbers = false,
34375
- className
34376
- }) {
34377
- const [copied, setCopied] = useState(false);
34378
- const handleCopy = useCallback(() => {
34379
- void navigator.clipboard.writeText(code).then(() => {
34380
- setCopied(true);
34381
- setTimeout(() => setCopied(false), 2e3);
34382
- });
34383
- }, [code]);
34384
- const lines = code.split("\n");
34385
- return /* @__PURE__ */ jsxs(
34386
- Box,
34387
- {
34388
- className: cn(
34389
- "rounded-container border border-border overflow-hidden",
34390
- className
34391
- ),
34392
- position: "relative",
34393
- children: [
34394
- title ? /* @__PURE__ */ jsxs(
34395
- HStack,
34396
- {
34397
- align: "center",
34398
- justify: "between",
34399
- className: "bg-muted px-4 py-2 border-b border-border",
34400
- children: [
34401
- /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "sm", children: [
34402
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: title }),
34403
- language ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: language }) : null
34404
- ] }),
34405
- /* @__PURE__ */ jsx(
34406
- Button,
34407
- {
34408
- variant: "ghost",
34409
- size: "sm",
34410
- onClick: handleCopy,
34411
- leftIcon: copied ? "check" : "copy",
34412
- children: copied ? "Copied!" : "Copy"
34413
- }
34414
- )
34415
- ]
34416
- }
34417
- ) : null,
34418
- !title ? /* @__PURE__ */ jsx(Box, { position: "absolute", className: "top-2 right-2 z-10", children: /* @__PURE__ */ jsx(
34419
- Button,
34420
- {
34421
- variant: "ghost",
34422
- size: "sm",
34423
- onClick: handleCopy,
34424
- leftIcon: copied ? "check" : "copy",
34425
- children: copied ? "Copied!" : "Copy"
34426
- }
34427
- ) }) : null,
34428
- /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "bg-foreground overflow-x-auto", children: [
34429
- showLineNumbers ? /* @__PURE__ */ jsx(
34430
- Box,
34431
- {
34432
- className: "py-4 pl-4 pr-3 select-none border-r border-border flex-shrink-0",
34433
- children: lines.map((_, i) => /* @__PURE__ */ jsx(
34434
- Typography,
34435
- {
34436
- variant: "caption",
34437
- color: "muted",
34438
- className: "block font-mono text-right leading-6",
34439
- as: "span",
34440
- children: i + 1
34441
- },
34442
- i
34443
- ))
34444
- }
34445
- ) : null,
34446
- /* @__PURE__ */ jsx(
34447
- Box,
34448
- {
34449
- as: "pre",
34450
- className: cn(
34451
- "p-4 font-mono text-sm text-background leading-6 flex-1 min-w-0",
34452
- !title && "pr-24"
34453
- ),
34454
- children: /* @__PURE__ */ jsx(Box, { as: "code", className: "whitespace-pre", children: code })
34455
- }
34456
- )
34457
- ] })
34458
- ]
34459
- }
34460
- );
34461
- }
34462
- var init_DocCodeBlock = __esm({
34463
- "components/core/molecules/DocCodeBlock.tsx"() {
34464
- "use client";
34465
- init_cn();
34466
- init_Box();
34467
- init_Stack();
34468
- init_Typography();
34469
- init_Button();
34470
- }
34471
- });
34472
34352
  function DocPagination({ prev, next, className }) {
34473
34353
  if (!prev && !next) return null;
34474
34354
  return /* @__PURE__ */ jsxs(
@@ -34905,17 +34785,25 @@ var init_DocTOC = __esm({
34905
34785
  DocTOC.displayName = "DocTOC";
34906
34786
  }
34907
34787
  });
34908
- var GradientDivider;
34788
+ var colorTokenVars2, GradientDivider;
34909
34789
  var init_GradientDivider = __esm({
34910
34790
  "components/core/molecules/GradientDivider.tsx"() {
34911
34791
  "use client";
34912
34792
  init_cn();
34913
34793
  init_Box();
34794
+ colorTokenVars2 = {
34795
+ primary: "var(--color-primary)",
34796
+ secondary: "var(--color-secondary)",
34797
+ success: "var(--color-success)",
34798
+ warning: "var(--color-warning)",
34799
+ error: "var(--color-error)",
34800
+ muted: "var(--color-muted)"
34801
+ };
34914
34802
  GradientDivider = ({
34915
34803
  color,
34916
34804
  className
34917
34805
  }) => {
34918
- const centerColor = color ?? "var(--color-primary)";
34806
+ const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
34919
34807
  return /* @__PURE__ */ jsx(
34920
34808
  Box,
34921
34809
  {
@@ -35284,7 +35172,7 @@ var init_MiniStateMachine = __esm({
35284
35172
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
35285
35173
  const tc = transitionCounts[s.name] ?? 0;
35286
35174
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
35287
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
35175
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
35288
35176
  /* @__PURE__ */ jsx(
35289
35177
  AvlState,
35290
35178
  {
@@ -35488,7 +35376,7 @@ var init_PageHeader = __esm({
35488
35376
  info: "bg-info/10 text-info"
35489
35377
  };
35490
35378
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
35491
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
35379
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
35492
35380
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
35493
35381
  crumb.href ? /* @__PURE__ */ jsx(
35494
35382
  "a",
@@ -36225,7 +36113,7 @@ var init_WizardContainer = __esm({
36225
36113
  const isCompleted = index < currentStep;
36226
36114
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36227
36115
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36228
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
36116
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
36229
36117
  /* @__PURE__ */ jsx(
36230
36118
  Button,
36231
36119
  {
@@ -38510,7 +38398,7 @@ var init_DetailPanel = __esm({
38510
38398
  }
38511
38399
  });
38512
38400
  function extractTitle(children) {
38513
- if (!React87__default.isValidElement(children)) return void 0;
38401
+ if (!React85__default.isValidElement(children)) return void 0;
38514
38402
  const props = children.props;
38515
38403
  if (typeof props.title === "string") {
38516
38404
  return props.title;
@@ -38565,7 +38453,7 @@ function LinearView({
38565
38453
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
38566
38454
  const isDone = i < currentIdx;
38567
38455
  const isCurrent = i === currentIdx;
38568
- return /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
38456
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
38569
38457
  i > 0 && /* @__PURE__ */ jsx(
38570
38458
  Typography,
38571
38459
  {
@@ -39523,12 +39411,12 @@ var init_Form = __esm({
39523
39411
  const isSchemaEntity = isOrbitalEntitySchema(entity);
39524
39412
  const resolvedEntity = isSchemaEntity ? entity : void 0;
39525
39413
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
39526
- const normalizedInitialData = React87__default.useMemo(() => {
39414
+ const normalizedInitialData = React85__default.useMemo(() => {
39527
39415
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
39528
39416
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
39529
39417
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
39530
39418
  }, [entity, initialData]);
39531
- const entityDerivedFields = React87__default.useMemo(() => {
39419
+ const entityDerivedFields = React85__default.useMemo(() => {
39532
39420
  if (fields && fields.length > 0) return void 0;
39533
39421
  if (!resolvedEntity) return void 0;
39534
39422
  return resolvedEntity.fields.map(
@@ -39548,16 +39436,16 @@ var init_Form = __esm({
39548
39436
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
39549
39437
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
39550
39438
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
39551
- const [formData, setFormData] = React87__default.useState(
39439
+ const [formData, setFormData] = React85__default.useState(
39552
39440
  normalizedInitialData
39553
39441
  );
39554
- const [collapsedSections, setCollapsedSections] = React87__default.useState(
39442
+ const [collapsedSections, setCollapsedSections] = React85__default.useState(
39555
39443
  /* @__PURE__ */ new Set()
39556
39444
  );
39557
- const [submitError, setSubmitError] = React87__default.useState(null);
39558
- const formRef = React87__default.useRef(null);
39445
+ const [submitError, setSubmitError] = React85__default.useState(null);
39446
+ const formRef = React85__default.useRef(null);
39559
39447
  const formMode = props.mode;
39560
- const mountedRef = React87__default.useRef(false);
39448
+ const mountedRef = React85__default.useRef(false);
39561
39449
  if (!mountedRef.current) {
39562
39450
  mountedRef.current = true;
39563
39451
  debug("forms", "mount", {
@@ -39570,7 +39458,7 @@ var init_Form = __esm({
39570
39458
  });
39571
39459
  }
39572
39460
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
39573
- const evalContext = React87__default.useMemo(
39461
+ const evalContext = React85__default.useMemo(
39574
39462
  () => ({
39575
39463
  formValues: formData,
39576
39464
  globalVariables: externalContext?.globalVariables ?? {},
@@ -39579,7 +39467,7 @@ var init_Form = __esm({
39579
39467
  }),
39580
39468
  [formData, externalContext]
39581
39469
  );
39582
- React87__default.useEffect(() => {
39470
+ React85__default.useEffect(() => {
39583
39471
  debug("forms", "initialData-sync", {
39584
39472
  mode: formMode,
39585
39473
  normalizedInitialData,
@@ -39590,7 +39478,7 @@ var init_Form = __esm({
39590
39478
  setFormData(normalizedInitialData);
39591
39479
  }
39592
39480
  }, [normalizedInitialData]);
39593
- const processCalculations = React87__default.useCallback(
39481
+ const processCalculations = React85__default.useCallback(
39594
39482
  (changedFieldId, newFormData) => {
39595
39483
  if (!hiddenCalculations.length) return;
39596
39484
  const context = {
@@ -39615,7 +39503,7 @@ var init_Form = __esm({
39615
39503
  },
39616
39504
  [hiddenCalculations, externalContext, eventBus]
39617
39505
  );
39618
- const checkViolations = React87__default.useCallback(
39506
+ const checkViolations = React85__default.useCallback(
39619
39507
  (changedFieldId, newFormData) => {
39620
39508
  if (!violationTriggers.length) return;
39621
39509
  const context = {
@@ -39653,7 +39541,7 @@ var init_Form = __esm({
39653
39541
  processCalculations(name, newFormData);
39654
39542
  checkViolations(name, newFormData);
39655
39543
  };
39656
- const isFieldVisible = React87__default.useCallback(
39544
+ const isFieldVisible = React85__default.useCallback(
39657
39545
  (fieldName) => {
39658
39546
  const condition = conditionalFields[fieldName];
39659
39547
  if (!condition) return true;
@@ -39661,7 +39549,7 @@ var init_Form = __esm({
39661
39549
  },
39662
39550
  [conditionalFields, evalContext]
39663
39551
  );
39664
- const isSectionVisible = React87__default.useCallback(
39552
+ const isSectionVisible = React85__default.useCallback(
39665
39553
  (section) => {
39666
39554
  if (!section.condition) return true;
39667
39555
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -39737,7 +39625,7 @@ var init_Form = __esm({
39737
39625
  eventBus.emit(`UI:${onCancel}`);
39738
39626
  }
39739
39627
  };
39740
- const renderField = React87__default.useCallback(
39628
+ const renderField = React85__default.useCallback(
39741
39629
  (field) => {
39742
39630
  const fieldName = field.name || field.field;
39743
39631
  if (!fieldName) return null;
@@ -39758,7 +39646,7 @@ var init_Form = __esm({
39758
39646
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
39759
39647
  );
39760
39648
  const effectiveFields = entityDerivedFields ?? fields;
39761
- const normalizedFields = React87__default.useMemo(() => {
39649
+ const normalizedFields = React85__default.useMemo(() => {
39762
39650
  if (!effectiveFields || effectiveFields.length === 0) return [];
39763
39651
  return effectiveFields.map((field) => {
39764
39652
  if (typeof field === "string") {
@@ -39781,7 +39669,7 @@ var init_Form = __esm({
39781
39669
  return field;
39782
39670
  });
39783
39671
  }, [effectiveFields, resolvedEntity]);
39784
- const schemaFields = React87__default.useMemo(() => {
39672
+ const schemaFields = React85__default.useMemo(() => {
39785
39673
  if (normalizedFields.length === 0) return null;
39786
39674
  if (isDebugEnabled()) {
39787
39675
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -39791,7 +39679,7 @@ var init_Form = __esm({
39791
39679
  }
39792
39680
  return normalizedFields.map(renderField).filter(Boolean);
39793
39681
  }, [normalizedFields, renderField, entityName, conditionalFields]);
39794
- const sectionElements = React87__default.useMemo(() => {
39682
+ const sectionElements = React85__default.useMemo(() => {
39795
39683
  if (!sections || sections.length === 0) return null;
39796
39684
  return sections.map((section) => {
39797
39685
  if (!isSectionVisible(section)) {
@@ -41066,7 +40954,7 @@ var init_List = __esm({
41066
40954
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
41067
40955
  return [];
41068
40956
  }, [entity]);
41069
- const getItemActions = React87__default.useCallback(
40957
+ const getItemActions = React85__default.useCallback(
41070
40958
  (item) => {
41071
40959
  if (!itemActions) return [];
41072
40960
  if (typeof itemActions === "function") {
@@ -41542,7 +41430,7 @@ var init_MediaGallery = __esm({
41542
41430
  [selectable, selectedItems, selectionEvent, eventBus]
41543
41431
  );
41544
41432
  const entityData = Array.isArray(entity) ? entity : [];
41545
- const items = React87__default.useMemo(() => {
41433
+ const items = React85__default.useMemo(() => {
41546
41434
  if (propItems) return propItems;
41547
41435
  if (entityData.length === 0) return [];
41548
41436
  return entityData.map((record, idx) => ({
@@ -41703,7 +41591,7 @@ var init_MediaGallery = __esm({
41703
41591
  }
41704
41592
  });
41705
41593
  function extractTitle2(children) {
41706
- if (!React87__default.isValidElement(children)) return void 0;
41594
+ if (!React85__default.isValidElement(children)) return void 0;
41707
41595
  const props = children.props;
41708
41596
  if (typeof props.title === "string") {
41709
41597
  return props.title;
@@ -42115,7 +42003,7 @@ var init_debugRegistry = __esm({
42115
42003
  }
42116
42004
  });
42117
42005
  function useDebugData() {
42118
- const [data, setData] = React87.useState(() => ({
42006
+ const [data, setData] = React85.useState(() => ({
42119
42007
  traits: [],
42120
42008
  ticks: [],
42121
42009
  guards: [],
@@ -42129,7 +42017,7 @@ function useDebugData() {
42129
42017
  },
42130
42018
  lastUpdate: Date.now()
42131
42019
  }));
42132
- React87.useEffect(() => {
42020
+ React85.useEffect(() => {
42133
42021
  const updateData = () => {
42134
42022
  setData({
42135
42023
  traits: getAllTraits(),
@@ -42238,12 +42126,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42238
42126
  return positions;
42239
42127
  }
42240
42128
  function WalkMinimap() {
42241
- const [walkStep, setWalkStep] = React87.useState(null);
42242
- const [traits2, setTraits] = React87.useState([]);
42243
- const [coveredEdges, setCoveredEdges] = React87.useState([]);
42244
- const [completedTraits, setCompletedTraits] = React87.useState(/* @__PURE__ */ new Set());
42245
- const prevTraitRef = React87.useRef(null);
42246
- React87.useEffect(() => {
42129
+ const [walkStep, setWalkStep] = React85.useState(null);
42130
+ const [traits2, setTraits] = React85.useState([]);
42131
+ const [coveredEdges, setCoveredEdges] = React85.useState([]);
42132
+ const [completedTraits, setCompletedTraits] = React85.useState(/* @__PURE__ */ new Set());
42133
+ const prevTraitRef = React85.useRef(null);
42134
+ React85.useEffect(() => {
42247
42135
  const interval = setInterval(() => {
42248
42136
  const w = window;
42249
42137
  const step = w.__orbitalWalkStep;
@@ -42679,15 +42567,15 @@ var init_EntitiesTab = __esm({
42679
42567
  });
42680
42568
  function EventFlowTab({ events: events2 }) {
42681
42569
  const { t } = useTranslate();
42682
- const [filter, setFilter] = React87.useState("all");
42683
- const containerRef = React87.useRef(null);
42684
- const [autoScroll, setAutoScroll] = React87.useState(true);
42685
- React87.useEffect(() => {
42570
+ const [filter, setFilter] = React85.useState("all");
42571
+ const containerRef = React85.useRef(null);
42572
+ const [autoScroll, setAutoScroll] = React85.useState(true);
42573
+ React85.useEffect(() => {
42686
42574
  if (autoScroll && containerRef.current) {
42687
42575
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42688
42576
  }
42689
42577
  }, [events2.length, autoScroll]);
42690
- const filteredEvents = React87.useMemo(() => {
42578
+ const filteredEvents = React85.useMemo(() => {
42691
42579
  if (filter === "all") return events2;
42692
42580
  return events2.filter((e) => e.type === filter);
42693
42581
  }, [events2, filter]);
@@ -42803,7 +42691,7 @@ var init_EventFlowTab = __esm({
42803
42691
  });
42804
42692
  function GuardsPanel({ guards }) {
42805
42693
  const { t } = useTranslate();
42806
- const [filter, setFilter] = React87.useState("all");
42694
+ const [filter, setFilter] = React85.useState("all");
42807
42695
  if (guards.length === 0) {
42808
42696
  return /* @__PURE__ */ jsx(
42809
42697
  EmptyState,
@@ -42816,7 +42704,7 @@ function GuardsPanel({ guards }) {
42816
42704
  }
42817
42705
  const passedCount = guards.filter((g) => g.result).length;
42818
42706
  const failedCount = guards.length - passedCount;
42819
- const filteredGuards = React87.useMemo(() => {
42707
+ const filteredGuards = React85.useMemo(() => {
42820
42708
  if (filter === "all") return guards;
42821
42709
  if (filter === "passed") return guards.filter((g) => g.result);
42822
42710
  return guards.filter((g) => !g.result);
@@ -42979,10 +42867,10 @@ function EffectBadge({ effect }) {
42979
42867
  }
42980
42868
  function TransitionTimeline({ transitions }) {
42981
42869
  const { t } = useTranslate();
42982
- const containerRef = React87.useRef(null);
42983
- const [autoScroll, setAutoScroll] = React87.useState(true);
42984
- const [expandedId, setExpandedId] = React87.useState(null);
42985
- React87.useEffect(() => {
42870
+ const containerRef = React85.useRef(null);
42871
+ const [autoScroll, setAutoScroll] = React85.useState(true);
42872
+ const [expandedId, setExpandedId] = React85.useState(null);
42873
+ React85.useEffect(() => {
42986
42874
  if (autoScroll && containerRef.current) {
42987
42875
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42988
42876
  }
@@ -43262,9 +43150,9 @@ function getAllEvents(traits2) {
43262
43150
  function EventDispatcherTab({ traits: traits2, schema }) {
43263
43151
  const eventBus = useEventBus();
43264
43152
  const { t } = useTranslate();
43265
- const [log12, setLog] = React87.useState([]);
43266
- const prevStatesRef = React87.useRef(/* @__PURE__ */ new Map());
43267
- React87.useEffect(() => {
43153
+ const [log12, setLog] = React85.useState([]);
43154
+ const prevStatesRef = React85.useRef(/* @__PURE__ */ new Map());
43155
+ React85.useEffect(() => {
43268
43156
  for (const trait of traits2) {
43269
43157
  const prev = prevStatesRef.current.get(trait.id);
43270
43158
  if (prev && prev !== trait.currentState) {
@@ -43433,10 +43321,10 @@ function VerifyModePanel({
43433
43321
  localCount
43434
43322
  }) {
43435
43323
  const { t } = useTranslate();
43436
- const [expanded, setExpanded] = React87.useState(true);
43437
- const scrollRef = React87.useRef(null);
43438
- const prevCountRef = React87.useRef(0);
43439
- React87.useEffect(() => {
43324
+ const [expanded, setExpanded] = React85.useState(true);
43325
+ const scrollRef = React85.useRef(null);
43326
+ const prevCountRef = React85.useRef(0);
43327
+ React85.useEffect(() => {
43440
43328
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43441
43329
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43442
43330
  }
@@ -43493,10 +43381,10 @@ function RuntimeDebugger({
43493
43381
  schema
43494
43382
  }) {
43495
43383
  const { t } = useTranslate();
43496
- const [isCollapsed, setIsCollapsed] = React87.useState(mode === "verify" ? true : defaultCollapsed);
43497
- const [isVisible, setIsVisible] = React87.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43384
+ const [isCollapsed, setIsCollapsed] = React85.useState(mode === "verify" ? true : defaultCollapsed);
43385
+ const [isVisible, setIsVisible] = React85.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43498
43386
  const debugData = useDebugData();
43499
- React87.useEffect(() => {
43387
+ React85.useEffect(() => {
43500
43388
  if (mode === "inline") return;
43501
43389
  return onDebugToggle((enabled) => {
43502
43390
  setIsVisible(enabled);
@@ -43505,7 +43393,7 @@ function RuntimeDebugger({
43505
43393
  }
43506
43394
  });
43507
43395
  }, [mode]);
43508
- React87.useEffect(() => {
43396
+ React85.useEffect(() => {
43509
43397
  if (mode === "inline") return;
43510
43398
  const handleKeyDown = (e) => {
43511
43399
  if (e.key === "`" && isVisible) {
@@ -43954,7 +43842,7 @@ function SequenceBar({
43954
43842
  onSlotRemove(index);
43955
43843
  }, [onSlotRemove, playing]);
43956
43844
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
43957
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React87__default.Fragment, { children: [
43845
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
43958
43846
  i > 0 && /* @__PURE__ */ jsx(
43959
43847
  Typography,
43960
43848
  {
@@ -44933,7 +44821,7 @@ var init_StatCard = __esm({
44933
44821
  const labelToUse = propLabel ?? propTitle;
44934
44822
  const eventBus = useEventBus();
44935
44823
  const { t } = useTranslate();
44936
- const handleActionClick = React87__default.useCallback(() => {
44824
+ const handleActionClick = React85__default.useCallback(() => {
44937
44825
  if (action?.event) {
44938
44826
  eventBus.emit(`UI:${action.event}`, {});
44939
44827
  }
@@ -44944,7 +44832,7 @@ var init_StatCard = __esm({
44944
44832
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
44945
44833
  const isLoading = externalLoading ?? false;
44946
44834
  const error = externalError;
44947
- const computeMetricValue = React87__default.useCallback(
44835
+ const computeMetricValue = React85__default.useCallback(
44948
44836
  (metric, items) => {
44949
44837
  if (metric.value !== void 0) {
44950
44838
  return metric.value;
@@ -44983,7 +44871,7 @@ var init_StatCard = __esm({
44983
44871
  },
44984
44872
  []
44985
44873
  );
44986
- const schemaStats = React87__default.useMemo(() => {
44874
+ const schemaStats = React85__default.useMemo(() => {
44987
44875
  if (!metrics || metrics.length === 0) return null;
44988
44876
  return metrics.map((metric) => ({
44989
44877
  label: metric.label,
@@ -44991,7 +44879,7 @@ var init_StatCard = __esm({
44991
44879
  format: metric.format
44992
44880
  }));
44993
44881
  }, [metrics, data, computeMetricValue]);
44994
- const calculatedTrend = React87__default.useMemo(() => {
44882
+ const calculatedTrend = React85__default.useMemo(() => {
44995
44883
  if (manualTrend !== void 0) return manualTrend;
44996
44884
  if (previousValue === void 0 || currentValue === void 0)
44997
44885
  return void 0;
@@ -45272,6 +45160,37 @@ var init_VariablePanel = __esm({
45272
45160
  VariablePanel.displayName = "VariablePanel";
45273
45161
  }
45274
45162
  });
45163
+ function StateJsonView({
45164
+ data,
45165
+ label,
45166
+ defaultExpanded = false,
45167
+ className
45168
+ }) {
45169
+ const { t } = useTranslate();
45170
+ const [expanded, setExpanded] = useState(defaultExpanded);
45171
+ const jsonString = JSON.stringify(data, null, 2);
45172
+ return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
45173
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
45174
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
45175
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
45176
+ ] }),
45177
+ expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
45178
+ Typography,
45179
+ {
45180
+ variant: "caption",
45181
+ className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
45182
+ children: jsonString
45183
+ }
45184
+ ) })
45185
+ ] });
45186
+ }
45187
+ var init_StateJsonView = __esm({
45188
+ "components/game/organisms/puzzles/state-architect/StateJsonView.tsx"() {
45189
+ init_atoms2();
45190
+ init_cn();
45191
+ StateJsonView.displayName = "StateJsonView";
45192
+ }
45193
+ });
45275
45194
  function layoutStates(states, width, height) {
45276
45195
  const cx = width / 2;
45277
45196
  const cy = height / 2;
@@ -45563,7 +45482,7 @@ function StateArchitectBoard({
45563
45482
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
45564
45483
  ] }, i))
45565
45484
  ] }),
45566
- resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
45485
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
45567
45486
  ] })
45568
45487
  ] }),
45569
45488
  playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
@@ -45600,7 +45519,7 @@ var init_StateArchitectBoard = __esm({
45600
45519
  init_StateNode();
45601
45520
  init_TransitionArrow();
45602
45521
  init_VariablePanel();
45603
- init_CodeView();
45522
+ init_StateJsonView();
45604
45523
  init_boardEntity();
45605
45524
  ENCOURAGEMENT_KEYS3 = [
45606
45525
  "puzzle.tryAgain1",
@@ -45925,7 +45844,7 @@ var init_Timeline = __esm({
45925
45844
  }) => {
45926
45845
  const { t } = useTranslate();
45927
45846
  const entityData = Array.isArray(entity) ? entity : [];
45928
- const items = React87__default.useMemo(() => {
45847
+ const items = React85__default.useMemo(() => {
45929
45848
  if (propItems) return propItems;
45930
45849
  if (entityData.length === 0) return [];
45931
45850
  return entityData.map((record, idx) => {
@@ -46032,7 +45951,7 @@ var init_Timeline = __esm({
46032
45951
  }
46033
45952
  });
46034
45953
  function extractToastProps(children) {
46035
- if (!React87__default.isValidElement(children)) {
45954
+ if (!React85__default.isValidElement(children)) {
46036
45955
  if (typeof children === "string") {
46037
45956
  return { message: children };
46038
45957
  }
@@ -46070,7 +45989,7 @@ var init_ToastSlot = __esm({
46070
45989
  eventBus.emit("UI:CLOSE");
46071
45990
  };
46072
45991
  if (!isVisible) return null;
46073
- const isCustomContent = React87__default.isValidElement(children) && !message;
45992
+ const isCustomContent = React85__default.isValidElement(children) && !message;
46074
45993
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
46075
45994
  Toast,
46076
45995
  {
@@ -46580,12 +46499,12 @@ var init_WorldMapTemplate = __esm({
46580
46499
  }
46581
46500
  });
46582
46501
  function lazyThree(name, loader) {
46583
- const Lazy = React87__default.lazy(() => loader().then((m) => ({ default: m[name] })));
46502
+ const Lazy = React85__default.lazy(() => loader().then((m) => ({ default: m[name] })));
46584
46503
  function ThreeWrapper(props) {
46585
- return React87__default.createElement(
46586
- React87__default.Suspense,
46504
+ return React85__default.createElement(
46505
+ React85__default.Suspense,
46587
46506
  { fallback: null },
46588
- React87__default.createElement(Lazy, props)
46507
+ React85__default.createElement(Lazy, props)
46589
46508
  );
46590
46509
  }
46591
46510
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -46633,8 +46552,6 @@ var init_component_registry_generated = __esm({
46633
46552
  init_ChoiceButton();
46634
46553
  init_ClassifierBoard();
46635
46554
  init_CodeBlock();
46636
- init_CodeView();
46637
- init_CodeViewer();
46638
46555
  init_CombatLog();
46639
46556
  init_ComboCounter();
46640
46557
  init_CommunityLinks();
@@ -46662,7 +46579,6 @@ var init_component_registry_generated = __esm({
46662
46579
  init_DialogueBox();
46663
46580
  init_DialogueBubble();
46664
46581
  init_DocBreadcrumb();
46665
- init_DocCodeBlock();
46666
46582
  init_DocPagination();
46667
46583
  init_DocSearch();
46668
46584
  init_DocSidebar();
@@ -46800,6 +46716,7 @@ var init_component_registry_generated = __esm({
46800
46716
  init_StatDisplay();
46801
46717
  init_StateArchitectBoard();
46802
46718
  init_StateIndicator();
46719
+ init_StateJsonView();
46803
46720
  init_StateMachineView();
46804
46721
  init_StateNode();
46805
46722
  init_StatsGrid();
@@ -46917,8 +46834,6 @@ var init_component_registry_generated = __esm({
46917
46834
  "ChoiceButton": ChoiceButton,
46918
46835
  "ClassifierBoard": ClassifierBoard,
46919
46836
  "CodeBlock": CodeBlock,
46920
- "CodeView": CodeView,
46921
- "CodeViewer": CodeViewer,
46922
46837
  "CombatLog": CombatLog,
46923
46838
  "ComboCounter": ComboCounter,
46924
46839
  "CommunityLinks": CommunityLinks,
@@ -46950,7 +46865,6 @@ var init_component_registry_generated = __esm({
46950
46865
  "Divider": DividerPattern,
46951
46866
  "DividerPattern": DividerPattern,
46952
46867
  "DocBreadcrumb": DocBreadcrumb,
46953
- "DocCodeBlock": DocCodeBlock,
46954
46868
  "DocPagination": DocPagination,
46955
46869
  "DocSearch": DocSearch,
46956
46870
  "DocSidebar": DocSidebar,
@@ -47117,6 +47031,7 @@ var init_component_registry_generated = __esm({
47117
47031
  "StatDisplay": StatDisplay,
47118
47032
  "StateArchitectBoard": StateArchitectBoard,
47119
47033
  "StateIndicator": StateIndicator,
47034
+ "StateJsonView": StateJsonView,
47120
47035
  "StateMachineView": StateMachineView,
47121
47036
  "StateNode": StateNode2,
47122
47037
  "StatsGrid": StatsGrid,
@@ -47201,7 +47116,7 @@ function SuspenseConfigProvider({
47201
47116
  config,
47202
47117
  children
47203
47118
  }) {
47204
- return React87__default.createElement(
47119
+ return React85__default.createElement(
47205
47120
  SuspenseConfigContext.Provider,
47206
47121
  { value: config },
47207
47122
  children
@@ -47691,7 +47606,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47691
47606
  const key = `${parentId}-${index}-trait:${traitName}`;
47692
47607
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
47693
47608
  }
47694
- return /* @__PURE__ */ jsx(React87__default.Fragment, { children: child }, `${parentId}-${index}`);
47609
+ return /* @__PURE__ */ jsx(React85__default.Fragment, { children: child }, `${parentId}-${index}`);
47695
47610
  }
47696
47611
  if (!child || typeof child !== "object") return null;
47697
47612
  const childId = `${parentId}-${index}`;
@@ -47731,14 +47646,14 @@ function isPatternConfig(value) {
47731
47646
  if (value === null || value === void 0) return false;
47732
47647
  if (typeof value !== "object") return false;
47733
47648
  if (Array.isArray(value)) return false;
47734
- if (React87__default.isValidElement(value)) return false;
47649
+ if (React85__default.isValidElement(value)) return false;
47735
47650
  if (value instanceof Date) return false;
47736
47651
  if (typeof value === "function") return false;
47737
47652
  const record = value;
47738
47653
  return "type" in record && typeof record.type === "string";
47739
47654
  }
47740
47655
  function isPlainConfigObject(value) {
47741
- if (React87__default.isValidElement(value)) return false;
47656
+ if (React85__default.isValidElement(value)) return false;
47742
47657
  if (value instanceof Date) return false;
47743
47658
  const proto = Object.getPrototypeOf(value);
47744
47659
  return proto === Object.prototype || proto === null;