@almadar/ui 2.42.0 → 2.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4086,9 +4086,9 @@ var shapeMap = {
4086
4086
  square: "rounded-md"
4087
4087
  };
4088
4088
  var variantMap = {
4089
- primary: "bg-blue-600 text-white border-blue-400 hover:bg-blue-500",
4090
- secondary: "bg-gray-700 text-white border-gray-500 hover:bg-gray-600",
4091
- ghost: "bg-transparent text-white border-white/30 hover:bg-white/10"
4089
+ primary: "bg-blue-600 text-[var(--color-foreground)] border-blue-400 hover:bg-blue-500",
4090
+ secondary: "bg-[var(--color-surface,#374151)] text-[var(--color-foreground)] border-gray-500 hover:bg-gray-600",
4091
+ ghost: "bg-transparent text-[var(--color-foreground)] border-white/30 hover:bg-white/10"
4092
4092
  };
4093
4093
  function ControlButton({
4094
4094
  label,
@@ -4353,11 +4353,11 @@ function TimerDisplay({
4353
4353
  {
4354
4354
  className: cn(
4355
4355
  "inline-flex items-center justify-center rounded-lg",
4356
- "bg-gray-800/80 border border-gray-600 font-mono font-bold tabular-nums",
4356
+ "bg-[var(--color-card)]/80 border border-gray-600 font-mono font-bold tabular-nums",
4357
4357
  sizeMap4[size],
4358
4358
  running && "border-green-500/50",
4359
4359
  isLow && "text-red-400 border-red-500/50 animate-pulse",
4360
- !isLow && "text-white",
4360
+ !isLow && "text-[var(--color-foreground)]",
4361
4361
  className
4362
4362
  ),
4363
4363
  children: formatTime(seconds, format)
@@ -4385,7 +4385,7 @@ function ResourceCounter({
4385
4385
  {
4386
4386
  className: cn(
4387
4387
  "inline-flex items-center rounded-md",
4388
- "bg-gray-800/80 border border-gray-600 font-medium text-white",
4388
+ "bg-[var(--color-card)]/80 border border-gray-600 font-medium text-[var(--color-foreground)]",
4389
4389
  sizes.wrapper,
4390
4390
  className
4391
4391
  ),
@@ -4444,9 +4444,9 @@ function ItemSlot({
4444
4444
  title: label,
4445
4445
  className: cn(
4446
4446
  "relative flex items-center justify-center rounded-lg border-2",
4447
- "bg-gray-800/80 transition-all duration-150",
4447
+ "bg-[var(--color-card)]/80 transition-all duration-150",
4448
4448
  sizeMap6[size],
4449
- empty ? "border-gray-700 bg-gray-900/50" : rarityBorderMap[rarity],
4449
+ empty ? "border-gray-700 bg-[var(--color-card)]/50" : rarityBorderMap[rarity],
4450
4450
  !empty && rarityGlowMap[rarity],
4451
4451
  selected && "ring-2 ring-white ring-offset-1 ring-offset-gray-900",
4452
4452
  isClickable && !empty && "hover:brightness-125 cursor-pointer",
@@ -4462,7 +4462,7 @@ function ItemSlot({
4462
4462
  className: cn(
4463
4463
  "absolute -bottom-1 -right-1 flex items-center justify-center",
4464
4464
  "min-w-[18px] h-[18px] rounded-full px-1",
4465
- "bg-gray-700 border border-gray-500 text-[10px] font-bold text-white"
4465
+ "bg-[var(--color-surface,#374151)] border border-gray-500 text-[10px] font-bold text-[var(--color-foreground)]"
4466
4466
  ),
4467
4467
  children: quantity
4468
4468
  }
@@ -4491,7 +4491,7 @@ function TurnIndicator({
4491
4491
  {
4492
4492
  className: cn(
4493
4493
  "inline-flex items-center rounded-lg",
4494
- "bg-gray-800/80 border border-gray-600 font-medium text-white",
4494
+ "bg-[var(--color-card)]/80 border border-gray-600 font-medium text-[var(--color-foreground)]",
4495
4495
  sizes.wrapper,
4496
4496
  className
4497
4497
  ),
@@ -4527,7 +4527,7 @@ function getComboIntensity(combo) {
4527
4527
  if (combo >= 10) return "text-red-400 animate-pulse";
4528
4528
  if (combo >= 7) return "text-orange-400";
4529
4529
  if (combo >= 4) return "text-yellow-400";
4530
- return "text-white";
4530
+ return "text-[var(--color-foreground)]";
4531
4531
  }
4532
4532
  function getComboScale(combo) {
4533
4533
  if (combo >= 10) return "scale-110";
@@ -4548,7 +4548,7 @@ function ComboCounter({
4548
4548
  {
4549
4549
  className: cn(
4550
4550
  "inline-flex flex-col items-center justify-center",
4551
- "rounded-xl bg-gray-800/80 border border-gray-600 px-3 py-1.5",
4551
+ "rounded-xl bg-[var(--color-card)]/80 border border-gray-600 px-3 py-1.5",
4552
4552
  "transition-transform duration-200",
4553
4553
  getComboScale(combo),
4554
4554
  className
@@ -4749,7 +4749,7 @@ function StatusEffect({
4749
4749
  "span",
4750
4750
  {
4751
4751
  className: cn(
4752
- "absolute flex items-center justify-center rounded-full bg-white text-black font-bold leading-none",
4752
+ "absolute flex items-center justify-center rounded-full bg-[var(--color-card)] text-[var(--color-foreground)] font-bold leading-none",
4753
4753
  sizes.badge
4754
4754
  ),
4755
4755
  children: stacks
@@ -4828,7 +4828,7 @@ function DialogueBubble({
4828
4828
  ) }),
4829
4829
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 min-w-0", children: [
4830
4830
  speaker && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-bold text-yellow-400", children: speaker }),
4831
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-white leading-relaxed", children: text })
4831
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-[var(--color-foreground)] leading-relaxed", children: text })
4832
4832
  ] })
4833
4833
  ]
4834
4834
  }
@@ -4852,7 +4852,7 @@ function ChoiceButton({
4852
4852
  className: cn(
4853
4853
  "w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
4854
4854
  "flex items-center gap-2",
4855
- selected ? "bg-yellow-500/20 border-yellow-400 text-yellow-300" : "bg-white/5 border-white/10 text-white hover:bg-white/10 hover:border-white/30",
4855
+ selected ? "bg-yellow-500/20 border-yellow-400 text-yellow-300" : "bg-white/5 border-white/10 text-[var(--color-foreground)] hover:bg-white/10 hover:border-white/30",
4856
4856
  disabled && "opacity-40 cursor-not-allowed hover:bg-white/5 hover:border-white/10",
4857
4857
  className
4858
4858
  ),
@@ -4908,7 +4908,7 @@ function ActionButton({
4908
4908
  disabled: isDisabled,
4909
4909
  onClick,
4910
4910
  className: cn(
4911
- "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-white overflow-hidden transition-colors duration-150",
4911
+ "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-[var(--color-foreground)] overflow-hidden transition-colors duration-150",
4912
4912
  sizes.button,
4913
4913
  variantStyles7[variant],
4914
4914
  isDisabled && "opacity-60 cursor-not-allowed",
@@ -5881,27 +5881,27 @@ function useQuerySingleton(query) {
5881
5881
  store2.listeners.delete(listener);
5882
5882
  };
5883
5883
  }, [store2]);
5884
- const notifyListeners = React90.useCallback(() => {
5884
+ const notifyListeners2 = React90.useCallback(() => {
5885
5885
  store2.listeners.forEach((listener) => listener());
5886
5886
  }, [store2]);
5887
5887
  const setSearch = React90.useCallback((value) => {
5888
5888
  store2.search = value;
5889
- notifyListeners();
5890
- }, [store2, notifyListeners]);
5889
+ notifyListeners2();
5890
+ }, [store2, notifyListeners2]);
5891
5891
  const setFilter = React90.useCallback((key, value) => {
5892
5892
  store2.filters = { ...store2.filters, [key]: value };
5893
- notifyListeners();
5894
- }, [store2, notifyListeners]);
5893
+ notifyListeners2();
5894
+ }, [store2, notifyListeners2]);
5895
5895
  const clearFilters = React90.useCallback(() => {
5896
5896
  store2.filters = {};
5897
5897
  store2.search = "";
5898
- notifyListeners();
5899
- }, [store2, notifyListeners]);
5898
+ notifyListeners2();
5899
+ }, [store2, notifyListeners2]);
5900
5900
  const setSort = React90.useCallback((field, direction) => {
5901
5901
  store2.sortField = field;
5902
5902
  store2.sortDirection = direction;
5903
- notifyListeners();
5904
- }, [store2, notifyListeners]);
5903
+ notifyListeners2();
5904
+ }, [store2, notifyListeners2]);
5905
5905
  return {
5906
5906
  search: store2.search,
5907
5907
  setSearch,
@@ -8658,7 +8658,7 @@ var MarkdownContent = React90__namespace.default.memo(
8658
8658
  "th",
8659
8659
  {
8660
8660
  ...props,
8661
- className: "border border-gray-300 dark:border-gray-600 bg-gray-100 dark:bg-gray-800 px-4 py-2 text-left font-semibold",
8661
+ className: "border border-gray-300 dark:border-gray-600 bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
8662
8662
  children
8663
8663
  }
8664
8664
  );
@@ -8739,6 +8739,42 @@ var orbStyleOverrides = {
8739
8739
  "orb-op-async": { color: syntax.ORB_COLORS.dark.async }
8740
8740
  };
8741
8741
  var orbStyle = { ...dark__default.default, ...orbStyleOverrides };
8742
+ function computeFoldRegions(code) {
8743
+ const lines = code.split("\n");
8744
+ const regions = [];
8745
+ const stack = [];
8746
+ for (let i = 0; i < lines.length; i++) {
8747
+ const line = lines[i];
8748
+ let inString = false;
8749
+ for (let j = 0; j < line.length; j++) {
8750
+ const ch = line[j];
8751
+ if (ch === "\\" && inString) {
8752
+ j++;
8753
+ continue;
8754
+ }
8755
+ if (ch === '"') {
8756
+ inString = !inString;
8757
+ continue;
8758
+ }
8759
+ if (inString) continue;
8760
+ if (ch === "{" || ch === "[") {
8761
+ stack.push({ line: i, bracket: ch });
8762
+ } else if (ch === "}" || ch === "]") {
8763
+ const open = stack.pop();
8764
+ if (open && open.line < i) {
8765
+ regions.push({
8766
+ start: open.line,
8767
+ end: i,
8768
+ closeBracket: ch
8769
+ });
8770
+ }
8771
+ }
8772
+ }
8773
+ }
8774
+ return regions.sort((a, b) => a.start - b.start);
8775
+ }
8776
+ var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
8777
+ var HIDDEN_LINE_NUMBERS = { display: "none" };
8742
8778
  var CodeBlock = React90__namespace.default.memo(
8743
8779
  ({
8744
8780
  code: rawCode,
@@ -8746,6 +8782,7 @@ var CodeBlock = React90__namespace.default.memo(
8746
8782
  showCopyButton = true,
8747
8783
  showLanguageBadge = true,
8748
8784
  maxHeight = "60vh",
8785
+ foldable: foldableProp,
8749
8786
  className
8750
8787
  }) => {
8751
8788
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
@@ -8754,8 +8791,114 @@ var CodeBlock = React90__namespace.default.memo(
8754
8791
  const eventBus = useEventBus();
8755
8792
  const { t: _t } = useTranslate();
8756
8793
  const scrollRef = React90.useRef(null);
8794
+ const codeRef = React90.useRef(null);
8757
8795
  const savedScrollLeftRef = React90.useRef(0);
8758
8796
  const [copied, setCopied] = React90.useState(false);
8797
+ const isFoldable = foldableProp ?? (language === "orb" || language === "json");
8798
+ const [collapsed, setCollapsed] = React90.useState(() => /* @__PURE__ */ new Set());
8799
+ const foldRegions = React90.useMemo(
8800
+ () => isFoldable ? computeFoldRegions(code) : [],
8801
+ [code, isFoldable]
8802
+ );
8803
+ const foldStartMap = React90.useMemo(() => {
8804
+ const m = /* @__PURE__ */ new Map();
8805
+ for (const r of foldRegions) m.set(r.start, r);
8806
+ return m;
8807
+ }, [foldRegions]);
8808
+ const hiddenLines = React90.useMemo(() => {
8809
+ const h = /* @__PURE__ */ new Set();
8810
+ for (const r of foldRegions) {
8811
+ if (!collapsed.has(r.start)) continue;
8812
+ for (let i = r.start + 1; i <= r.end; i++) h.add(i);
8813
+ }
8814
+ return h;
8815
+ }, [foldRegions, collapsed]);
8816
+ const collapsedRef = React90.useRef(collapsed);
8817
+ collapsedRef.current = collapsed;
8818
+ const foldStartMapRef = React90.useRef(foldStartMap);
8819
+ foldStartMapRef.current = foldStartMap;
8820
+ const toggleFold = React90.useCallback((lineNum) => {
8821
+ setCollapsed((prev) => {
8822
+ const next = new Set(prev);
8823
+ if (next.has(lineNum)) next.delete(lineNum);
8824
+ else next.add(lineNum);
8825
+ return next;
8826
+ });
8827
+ }, []);
8828
+ const toggleFoldRef = React90.useRef(toggleFold);
8829
+ toggleFoldRef.current = toggleFold;
8830
+ React90.useEffect(() => {
8831
+ setCollapsed(/* @__PURE__ */ new Set());
8832
+ }, [code]);
8833
+ const highlightedElement = React90.useMemo(
8834
+ () => /* @__PURE__ */ jsxRuntime.jsx(
8835
+ SyntaxHighlighter__default.default,
8836
+ {
8837
+ PreTag: "div",
8838
+ language,
8839
+ style: activeStyle,
8840
+ wrapLines: true,
8841
+ showLineNumbers: true,
8842
+ showInlineLineNumbers: false,
8843
+ lineNumberContainerStyle: HIDDEN_LINE_NUMBERS,
8844
+ lineProps: LINE_PROPS_FN,
8845
+ customStyle: {
8846
+ backgroundColor: "transparent",
8847
+ borderRadius: 0,
8848
+ padding: 0,
8849
+ margin: 0,
8850
+ whiteSpace: "pre",
8851
+ minWidth: "100%"
8852
+ },
8853
+ children: code
8854
+ }
8855
+ ),
8856
+ [code, language, activeStyle]
8857
+ );
8858
+ React90.useLayoutEffect(() => {
8859
+ const container = codeRef.current;
8860
+ if (!container) return;
8861
+ container.querySelectorAll(".fold-toggle, .fold-summary").forEach((el) => el.remove());
8862
+ const lineEls = container.querySelectorAll("[data-line]");
8863
+ if (!isFoldable || foldRegions.length === 0) {
8864
+ lineEls.forEach((el) => {
8865
+ el.style.display = "";
8866
+ el.style.position = "";
8867
+ el.style.paddingLeft = "";
8868
+ });
8869
+ return;
8870
+ }
8871
+ lineEls.forEach((el) => {
8872
+ const num = parseInt(el.getAttribute("data-line") ?? "-1", 10);
8873
+ if (hiddenLines.has(num)) {
8874
+ el.style.display = "none";
8875
+ return;
8876
+ }
8877
+ el.style.display = "";
8878
+ el.style.position = "relative";
8879
+ el.style.paddingLeft = "1.2em";
8880
+ const region = foldStartMap.get(num);
8881
+ if (!region) return;
8882
+ const isCollapsed = collapsed.has(num);
8883
+ const toggle = document.createElement("span");
8884
+ toggle.className = "fold-toggle";
8885
+ toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
8886
+ toggle.style.cssText = "position:absolute;left:0;top:0;width:1.2em;text-align:center;cursor:pointer;color:#858585;font-size:10px;user-select:none;line-height:inherit;height:100%";
8887
+ toggle.addEventListener("click", (e) => {
8888
+ e.stopPropagation();
8889
+ toggleFoldRef.current(num);
8890
+ });
8891
+ el.insertBefore(toggle, el.firstChild);
8892
+ if (isCollapsed) {
8893
+ const summary = document.createElement("span");
8894
+ summary.className = "fold-summary";
8895
+ summary.style.cssText = "color:#858585;font-style:italic";
8896
+ const count = region.end - region.start - 1;
8897
+ summary.textContent = ` ... ${count} line${count !== 1 ? "s" : ""} ${region.closeBracket}`;
8898
+ el.appendChild(summary);
8899
+ }
8900
+ });
8901
+ }, [collapsed, hiddenLines, foldStartMap, foldRegions, isFoldable]);
8759
8902
  React90.useLayoutEffect(() => {
8760
8903
  const el = scrollRef.current;
8761
8904
  return () => {
@@ -8786,13 +8929,14 @@ var CodeBlock = React90__namespace.default.memo(
8786
8929
  eventBus.emit("UI:COPY_CODE", { language, success: false });
8787
8930
  }
8788
8931
  };
8932
+ const hasHeader = showLanguageBadge || showCopyButton;
8789
8933
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: `relative group ${className || ""}`, children: [
8790
- (showLanguageBadge || showCopyButton) && /* @__PURE__ */ jsxRuntime.jsxs(
8934
+ hasHeader && /* @__PURE__ */ jsxRuntime.jsxs(
8791
8935
  HStack,
8792
8936
  {
8793
8937
  justify: "between",
8794
8938
  align: "center",
8795
- className: "px-3 py-2 bg-gray-800 rounded-t-lg border-b border-gray-700",
8939
+ className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
8796
8940
  children: [
8797
8941
  showLanguageBadge && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", children: language }),
8798
8942
  showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(
@@ -8822,31 +8966,14 @@ var CodeBlock = React90__namespace.default.memo(
8822
8966
  touchAction: "pan-x pan-y",
8823
8967
  contain: "paint",
8824
8968
  backgroundColor: "#1e1e1e",
8825
- borderRadius: showLanguageBadge || showCopyButton ? "0 0 0.5rem 0.5rem" : "0.5rem",
8826
- padding: "1rem"
8969
+ borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem"
8827
8970
  },
8828
- children: /* @__PURE__ */ jsxRuntime.jsx(
8829
- SyntaxHighlighter__default.default,
8830
- {
8831
- PreTag: "div",
8832
- language,
8833
- style: activeStyle,
8834
- customStyle: {
8835
- backgroundColor: "transparent",
8836
- borderRadius: 0,
8837
- padding: 0,
8838
- margin: 0,
8839
- whiteSpace: "pre",
8840
- minWidth: "100%"
8841
- },
8842
- children: code
8843
- }
8844
- )
8971
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: codeRef, style: { padding: "1rem" }, children: highlightedElement })
8845
8972
  }
8846
8973
  )
8847
8974
  ] });
8848
8975
  },
8849
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight
8976
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable
8850
8977
  );
8851
8978
  CodeBlock.displayName = "CodeBlock";
8852
8979
  var QuizBlock = ({
@@ -10034,7 +10161,7 @@ var sizeMap17 = {
10034
10161
  lg: "text-base px-4 py-2"
10035
10162
  };
10036
10163
  var variantMap2 = {
10037
- default: "bg-gray-800/80 border-gray-700",
10164
+ default: "bg-[var(--color-card)]/80 border-gray-700",
10038
10165
  primary: "bg-blue-900/80 border-blue-700",
10039
10166
  success: "bg-green-900/80 border-green-700",
10040
10167
  warning: "bg-yellow-900/80 border-yellow-700",
@@ -10095,7 +10222,7 @@ function StatBadge({
10095
10222
  animated: true
10096
10223
  }
10097
10224
  ),
10098
- format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-white", children: value })
10225
+ format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-[var(--color-foreground)]", children: value })
10099
10226
  ]
10100
10227
  }
10101
10228
  );
@@ -10438,7 +10565,7 @@ function HealthPanel({
10438
10565
  Box,
10439
10566
  {
10440
10567
  className: cn(
10441
- "rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm",
10568
+ "rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm",
10442
10569
  sizes.padding,
10443
10570
  className
10444
10571
  ),
@@ -10540,7 +10667,7 @@ function ScoreBoard({
10540
10667
  Card,
10541
10668
  {
10542
10669
  className: cn(
10543
- "bg-gray-900/90 border-gray-700 backdrop-blur-sm",
10670
+ "bg-[var(--color-card)]/90 border-gray-700 backdrop-blur-sm",
10544
10671
  className
10545
10672
  ),
10546
10673
  children: /* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "flex items-center gap-3 flex-wrap", children: [
@@ -10639,7 +10766,7 @@ function TurnPanel({
10639
10766
  Box,
10640
10767
  {
10641
10768
  className: cn(
10642
- "flex items-center gap-3 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-3 py-2",
10769
+ "flex items-center gap-3 rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm px-3 py-2",
10643
10770
  className
10644
10771
  ),
10645
10772
  children: [
@@ -10686,7 +10813,7 @@ function EnemyPlate({
10686
10813
  Box,
10687
10814
  {
10688
10815
  className: cn(
10689
- "inline-flex flex-col gap-1 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-3 py-1.5",
10816
+ "inline-flex flex-col gap-1 rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm px-3 py-1.5",
10690
10817
  "min-w-[120px]",
10691
10818
  className
10692
10819
  ),
@@ -10697,7 +10824,7 @@ function EnemyPlate({
10697
10824
  {
10698
10825
  variant: "caption",
10699
10826
  weight: "bold",
10700
- className: "text-white truncate",
10827
+ className: "text-[var(--color-foreground)] truncate",
10701
10828
  children: name
10702
10829
  }
10703
10830
  ),
@@ -10764,7 +10891,7 @@ function UnitCommandBar({
10764
10891
  Box,
10765
10892
  {
10766
10893
  className: cn(
10767
- "flex items-center gap-1.5 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-2 py-1.5",
10894
+ "flex items-center gap-1.5 rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm px-2 py-1.5",
10768
10895
  className
10769
10896
  ),
10770
10897
  children: commands.map((command, i) => /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "flex flex-col items-center gap-0.5", children: [
@@ -10991,7 +11118,7 @@ function DialogueBox({
10991
11118
  tabIndex: 0,
10992
11119
  role: "dialog",
10993
11120
  "aria-label": "Dialogue",
10994
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 my-4 bg-gray-900 bg-opacity-95 border-2 border-gray-600 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
11121
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-4 my-4 bg-[var(--color-card)] bg-opacity-95 border-2 border-gray-600 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
10995
11122
  dialogue.portrait && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 p-4 border-r border-gray-700", children: /* @__PURE__ */ jsxRuntime.jsx(
10996
11123
  "img",
10997
11124
  {
@@ -11003,7 +11130,7 @@ function DialogueBox({
11003
11130
  ) }),
11004
11131
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-4", children: [
11005
11132
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-yellow-400 font-bold mb-2", children: dialogue.speaker }),
11006
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-white text-lg leading-relaxed min-h-[60px]", children: [
11133
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[var(--color-foreground)] text-lg leading-relaxed min-h-[60px]", children: [
11007
11134
  displayedText,
11008
11135
  isTyping && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "animate-pulse", children: "\u258C" })
11009
11136
  ] }),
@@ -11013,8 +11140,8 @@ function DialogueBox({
11013
11140
  type: "button",
11014
11141
  className: cn(
11015
11142
  "block w-full text-left px-4 py-2 rounded transition-colors",
11016
- "hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-yellow-400",
11017
- selectedChoice === index ? "bg-gray-700 text-yellow-400" : "bg-gray-800 text-white"
11143
+ "hover:bg-[var(--color-surface,#374151)] focus:outline-none focus:ring-2 focus:ring-yellow-400",
11144
+ selectedChoice === index ? "bg-[var(--color-surface,#374151)] text-yellow-400" : "bg-[var(--color-card)] text-[var(--color-foreground)]"
11018
11145
  ),
11019
11146
  onClick: (e) => {
11020
11147
  e.stopPropagation();
@@ -11207,7 +11334,7 @@ function InventoryPanel({
11207
11334
  /* @__PURE__ */ jsxRuntime.jsx(
11208
11335
  "div",
11209
11336
  {
11210
- className: "grid gap-1 bg-gray-900 p-2 rounded-lg border border-gray-700",
11337
+ className: "grid gap-1 bg-[var(--color-card)] p-2 rounded-lg border border-gray-700",
11211
11338
  style: {
11212
11339
  gridTemplateColumns: `repeat(${safeColumns}, ${slotSize}px)`,
11213
11340
  gridTemplateRows: `repeat(${rows}, ${slotSize}px)`
@@ -11218,9 +11345,9 @@ function InventoryPanel({
11218
11345
  type: "button",
11219
11346
  className: cn(
11220
11347
  "relative flex items-center justify-center",
11221
- "bg-gray-800 border rounded transition-colors",
11222
- "hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",
11223
- selectedSlot === index ? "border-yellow-400 bg-gray-700" : "border-gray-600"
11348
+ "bg-[var(--color-card)] border rounded transition-colors",
11349
+ "hover:bg-[var(--color-surface,#374151)] focus:outline-none focus:ring-2 focus:ring-blue-500",
11350
+ selectedSlot === index ? "border-yellow-400 bg-[var(--color-surface,#374151)]" : "border-gray-600"
11224
11351
  ),
11225
11352
  style: { width: slotSize, height: slotSize },
11226
11353
  onClick: () => handleSlotClick(index),
@@ -11250,14 +11377,14 @@ function InventoryPanel({
11250
11377
  showTooltips && hoveredItem && /* @__PURE__ */ jsxRuntime.jsxs(
11251
11378
  "div",
11252
11379
  {
11253
- className: "fixed z-50 bg-gray-900 border border-gray-600 rounded-lg p-2 shadow-lg pointer-events-none",
11380
+ className: "fixed z-50 bg-[var(--color-card)] border border-gray-600 rounded-lg p-2 shadow-lg pointer-events-none",
11254
11381
  style: {
11255
11382
  left: tooltipPosition.x,
11256
11383
  top: tooltipPosition.y,
11257
11384
  maxWidth: 200
11258
11385
  },
11259
11386
  children: [
11260
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-white", children: hoveredItem.name || hoveredItem.type }),
11387
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-[var(--color-foreground)]", children: hoveredItem.name || hoveredItem.type }),
11261
11388
  hoveredItem.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-400 mt-1", children: hoveredItem.description }),
11262
11389
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500 mt-1", children: [
11263
11390
  "Quantity: ",
@@ -11269,9 +11396,9 @@ function InventoryPanel({
11269
11396
  ] });
11270
11397
  }
11271
11398
  var variantMap3 = {
11272
- primary: "bg-blue-600 hover:bg-blue-500 text-white border-blue-400 shadow-lg shadow-blue-500/25",
11273
- secondary: "bg-gray-700 hover:bg-gray-600 text-white border-gray-500",
11274
- ghost: "bg-transparent hover:bg-white/10 text-white border-white/20"
11399
+ primary: "bg-[var(--color-primary)] hover:bg-blue-500 text-[var(--color-primary-foreground)] border-blue-400 shadow-lg shadow-blue-500/25",
11400
+ secondary: "bg-[var(--color-surface,#374151)] hover:bg-gray-600 text-[var(--color-foreground)] border-gray-500",
11401
+ ghost: "bg-transparent hover:bg-white/10 text-[var(--color-foreground)] border-white/20"
11275
11402
  };
11276
11403
  function GameMenu({
11277
11404
  title,
@@ -11328,7 +11455,7 @@ function GameMenu({
11328
11455
  /* @__PURE__ */ jsxRuntime.jsx(
11329
11456
  "h1",
11330
11457
  {
11331
- className: "text-5xl md:text-7xl font-bold text-white tracking-tight",
11458
+ className: "text-5xl md:text-7xl font-bold text-[var(--color-foreground)] tracking-tight",
11332
11459
  style: {
11333
11460
  textShadow: "0 4px 12px rgba(0,0,0,0.5)"
11334
11461
  },
@@ -11384,9 +11511,9 @@ var variantColors = {
11384
11511
  }
11385
11512
  };
11386
11513
  var buttonVariants = {
11387
- primary: "bg-blue-600 hover:bg-blue-500 text-white border-blue-400",
11388
- secondary: "bg-gray-700 hover:bg-gray-600 text-white border-gray-500",
11389
- ghost: "bg-transparent hover:bg-white/10 text-white border-white/20"
11514
+ primary: "bg-[var(--color-primary)] hover:bg-blue-500 text-[var(--color-primary-foreground)] border-blue-400",
11515
+ secondary: "bg-[var(--color-surface,#374151)] hover:bg-gray-600 text-[var(--color-foreground)] border-gray-500",
11516
+ ghost: "bg-transparent hover:bg-white/10 text-[var(--color-foreground)] border-white/20"
11390
11517
  };
11391
11518
  function formatTime3(ms) {
11392
11519
  const seconds = Math.floor(ms / 1e3);
@@ -11467,7 +11594,7 @@ function GameOverScreen({
11467
11594
  }
11468
11595
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
11469
11596
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-400 text-sm mb-1", children: stat.label }),
11470
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-white text-2xl font-bold flex items-center justify-center gap-2", children: [
11597
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[var(--color-foreground)] text-2xl font-bold flex items-center justify-center gap-2", children: [
11471
11598
  stat.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: stat.icon }),
11472
11599
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums", children: displayValue })
11473
11600
  ] })
@@ -12661,7 +12788,7 @@ function IsometricCanvas({
12661
12788
  className: cn("relative w-full overflow-hidden rounded-lg", className),
12662
12789
  style: { height: viewportSize.height },
12663
12790
  "data-testid": "game-canvas-empty",
12664
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center justify-center h-full bg-slate-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
12791
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center justify-center h-full bg-[var(--color-card)] rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
12665
12792
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "map", size: "xl" }),
12666
12793
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", className: "text-slate-400", children: t("canvas.emptyMessage") || "No map data loaded" })
12667
12794
  ] }) })
@@ -13737,7 +13864,7 @@ var Lightbox = ({
13737
13864
  className: cn(
13738
13865
  "absolute top-4 right-4 z-10",
13739
13866
  "p-2 rounded-full",
13740
- "text-white bg-black bg-opacity-50",
13867
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
13741
13868
  "hover:bg-opacity-70 transition-opacity",
13742
13869
  "focus:outline-none focus:ring-2 focus:ring-white"
13743
13870
  ),
@@ -13756,7 +13883,7 @@ var Lightbox = ({
13756
13883
  className: cn(
13757
13884
  "absolute left-4 z-10",
13758
13885
  "p-2 rounded-full",
13759
- "text-white bg-black bg-opacity-50",
13886
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
13760
13887
  "hover:bg-opacity-70 transition-opacity",
13761
13888
  "focus:outline-none focus:ring-2 focus:ring-white"
13762
13889
  ),
@@ -13793,7 +13920,7 @@ var Lightbox = ({
13793
13920
  className: cn(
13794
13921
  "absolute right-4 z-10",
13795
13922
  "p-2 rounded-full",
13796
- "text-white bg-black bg-opacity-50",
13923
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
13797
13924
  "hover:bg-opacity-70 transition-opacity",
13798
13925
  "focus:outline-none focus:ring-2 focus:ring-white"
13799
13926
  ),
@@ -13802,12 +13929,12 @@ var Lightbox = ({
13802
13929
  }
13803
13930
  ),
13804
13931
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-4 left-0 right-0 text-center", children: [
13805
- showCounter && safeImages.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-white text-sm mb-1", children: [
13932
+ showCounter && safeImages.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[var(--color-foreground)] text-sm mb-1", children: [
13806
13933
  index + 1,
13807
13934
  " of ",
13808
13935
  safeImages.length
13809
13936
  ] }),
13810
- currentImage?.caption && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-white text-sm opacity-80 px-8", children: currentImage.caption })
13937
+ currentImage?.caption && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[var(--color-foreground)] text-sm opacity-80 px-8", children: currentImage.caption })
13811
13938
  ] })
13812
13939
  ]
13813
13940
  }
@@ -26880,7 +27007,7 @@ function SequencerBoard({
26880
27007
  setPlayState("playing");
26881
27008
  setCurrentStep(0);
26882
27009
  let step = 0;
26883
- const advance2 = () => {
27010
+ const advance = () => {
26884
27011
  step++;
26885
27012
  if (step >= entity.maxSlots) {
26886
27013
  const playerSeq = slots.map((s) => s?.id);
@@ -26911,10 +27038,10 @@ function SequencerBoard({
26911
27038
  }
26912
27039
  } else {
26913
27040
  setCurrentStep(step);
26914
- timerRef.current = setTimeout(advance2, stepDurationMs);
27041
+ timerRef.current = setTimeout(advance, stepDurationMs);
26915
27042
  }
26916
27043
  };
26917
- timerRef.current = setTimeout(advance2, stepDurationMs);
27044
+ timerRef.current = setTimeout(advance, stepDurationMs);
26918
27045
  }, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
26919
27046
  const machine = {
26920
27047
  name: entity.title,
@@ -29026,25 +29153,92 @@ function generateCombatMessage(event) {
29026
29153
  var store = /* @__PURE__ */ new Map();
29027
29154
  var storeListeners = /* @__PURE__ */ new Set();
29028
29155
  var watchCallbacks = /* @__PURE__ */ new Map();
29029
- function advance(entityType, data) {
29030
- const prev = store.get(entityType);
29031
- const oldData = prev?.data ?? [];
29032
- store.set(entityType, { data, version: (prev?.version ?? 0) + 1 });
29156
+ function extractId(record) {
29157
+ const r = record;
29158
+ return String(r.id ?? r._id ?? r.key ?? "");
29159
+ }
29160
+ function materialize(snap) {
29161
+ return snap.ids.map((id) => snap.entities.get(id));
29162
+ }
29163
+ function notifyListeners(entityType, prev) {
29033
29164
  for (const listener of storeListeners) {
29034
29165
  listener();
29035
29166
  }
29036
29167
  const cbs = watchCallbacks.get(entityType);
29037
29168
  if (cbs) {
29169
+ const oldData = prev ? materialize(prev) : [];
29170
+ const cur = store.get(entityType);
29171
+ const newData = cur ? materialize(cur) : [];
29038
29172
  for (const cb of cbs) {
29039
29173
  try {
29040
- cb(oldData, data);
29174
+ cb(oldData, newData);
29041
29175
  } catch {
29042
29176
  }
29043
29177
  }
29044
29178
  }
29045
29179
  }
29180
+ function setAll(entityType, records) {
29181
+ const entities2 = /* @__PURE__ */ new Map();
29182
+ const ids = [];
29183
+ for (const r of records) {
29184
+ const rec = r;
29185
+ const id = extractId(rec);
29186
+ if (id) {
29187
+ entities2.set(id, rec);
29188
+ ids.push(id);
29189
+ }
29190
+ }
29191
+ const prev = store.get(entityType);
29192
+ store.set(entityType, { entities: entities2, ids, version: (prev?.version ?? 0) + 1 });
29193
+ notifyListeners(entityType, prev);
29194
+ }
29195
+ function upsertOne(entityType, record) {
29196
+ const id = extractId(record);
29197
+ if (!id) return;
29198
+ const prev = store.get(entityType);
29199
+ const snapshot = prev ? { entities: new Map(prev.entities), ids: [...prev.ids], version: prev.version } : { entities: /* @__PURE__ */ new Map(), ids: [], version: 0 };
29200
+ snapshot.entities.set(id, record);
29201
+ if (!snapshot.ids.includes(id)) snapshot.ids.push(id);
29202
+ snapshot.version++;
29203
+ store.set(entityType, snapshot);
29204
+ notifyListeners(entityType, prev);
29205
+ }
29206
+ function addOne(entityType, record) {
29207
+ upsertOne(entityType, record);
29208
+ }
29209
+ function updateOne(entityType, id, changes) {
29210
+ const prev = store.get(entityType);
29211
+ if (!prev?.entities.has(id)) return;
29212
+ const snapshot = {
29213
+ entities: new Map(prev.entities),
29214
+ ids: [...prev.ids],
29215
+ version: prev.version
29216
+ };
29217
+ snapshot.entities.set(id, { ...snapshot.entities.get(id), ...changes });
29218
+ snapshot.version++;
29219
+ store.set(entityType, snapshot);
29220
+ notifyListeners(entityType, prev);
29221
+ }
29222
+ function removeOne(entityType, id) {
29223
+ const prev = store.get(entityType);
29224
+ if (!prev) return;
29225
+ const snapshot = {
29226
+ entities: new Map(prev.entities),
29227
+ ids: prev.ids.filter((i) => i !== id),
29228
+ version: prev.version
29229
+ };
29230
+ snapshot.entities.delete(id);
29231
+ snapshot.version++;
29232
+ store.set(entityType, snapshot);
29233
+ notifyListeners(entityType, prev);
29234
+ }
29046
29235
  function getSnapshot2(entityType) {
29047
- return store.get(entityType)?.data ?? [];
29236
+ const snap = store.get(entityType);
29237
+ if (!snap) return [];
29238
+ return materialize(snap);
29239
+ }
29240
+ function getById(entityType, id) {
29241
+ return store.get(entityType)?.entities.get(id) ?? null;
29048
29242
  }
29049
29243
  function getVersion(entityType) {
29050
29244
  return store.get(entityType)?.version ?? 0;
@@ -29068,10 +29262,20 @@ function useEntityRef(entityType) {
29068
29262
  }, [entityType]);
29069
29263
  return React90.useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
29070
29264
  }
29071
- React90.createContext({
29072
- advance,
29073
- getSnapshot: getSnapshot2
29074
- });
29265
+ var contextValue = {
29266
+ setAll,
29267
+ upsertOne,
29268
+ addOne,
29269
+ updateOne,
29270
+ removeOne,
29271
+ getSnapshot: getSnapshot2,
29272
+ getById
29273
+ };
29274
+ React90.createContext(contextValue);
29275
+ var EntitySchemaContext = React90.createContext(null);
29276
+ function useEntitySchemaOptional() {
29277
+ return React90.useContext(EntitySchemaContext);
29278
+ }
29075
29279
  var ClientEffectConfigContext = React90.createContext(null);
29076
29280
  ClientEffectConfigContext.Provider;
29077
29281
 
@@ -29598,11 +29802,11 @@ var AuthLayout = ({
29598
29802
  children: [
29599
29803
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute inset-0 bg-gradient-to-br from-primary-600/90 to-primary-800/90" }),
29600
29804
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "relative z-10", children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Link, { to: "/", className: "flex items-center gap-3", children: [
29601
- logo || /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur", children: /* @__PURE__ */ jsxRuntime.jsx(
29805
+ logo || /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-10 bg-[var(--color-card)]/20 rounded-xl flex items-center justify-center backdrop-blur", children: /* @__PURE__ */ jsxRuntime.jsx(
29602
29806
  Typography,
29603
29807
  {
29604
29808
  variant: "body1",
29605
- className: "text-white font-bold text-lg",
29809
+ className: "text-[var(--color-foreground)] font-bold text-lg",
29606
29810
  children: appName.charAt(0).toUpperCase()
29607
29811
  }
29608
29812
  ) }),
@@ -29610,7 +29814,7 @@ var AuthLayout = ({
29610
29814
  Typography,
29611
29815
  {
29612
29816
  variant: "body1",
29613
- className: "text-2xl font-bold text-white",
29817
+ className: "text-2xl font-bold text-[var(--color-foreground)]",
29614
29818
  children: appName
29615
29819
  }
29616
29820
  )
@@ -29620,7 +29824,7 @@ var AuthLayout = ({
29620
29824
  Typography,
29621
29825
  {
29622
29826
  variant: "h1",
29623
- className: "text-4xl font-bold text-white leading-tight",
29827
+ className: "text-4xl font-bold text-[var(--color-foreground)] leading-tight",
29624
29828
  children: [
29625
29829
  "Welcome to ",
29626
29830
  appName
@@ -29631,27 +29835,27 @@ var AuthLayout = ({
29631
29835
  Typography,
29632
29836
  {
29633
29837
  variant: "body1",
29634
- className: "text-lg text-white/80 max-w-md",
29838
+ className: "text-lg text-[var(--color-foreground)]/80 max-w-md",
29635
29839
  children: "Sign in to access your dashboard and manage your account."
29636
29840
  }
29637
29841
  ),
29638
- /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "mt-12 p-6 bg-white/10 rounded-xl backdrop-blur", children: [
29842
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "mt-12 p-6 bg-[var(--color-card)]/10 rounded-xl backdrop-blur", children: [
29639
29843
  /* @__PURE__ */ jsxRuntime.jsx(
29640
29844
  Typography,
29641
29845
  {
29642
29846
  variant: "body1",
29643
- className: "text-white/90 italic",
29847
+ className: "text-[var(--color-foreground)]/90 italic",
29644
29848
  children: '"This platform has transformed how we work. Highly recommended!"'
29645
29849
  }
29646
29850
  ),
29647
29851
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "mt-4", gap: "sm", align: "center", children: [
29648
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-10 bg-white/20 rounded-full" }),
29852
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-10 bg-[var(--color-card)]/20 rounded-full" }),
29649
29853
  /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", children: [
29650
29854
  /* @__PURE__ */ jsxRuntime.jsx(
29651
29855
  Typography,
29652
29856
  {
29653
29857
  variant: "body1",
29654
- className: "text-white font-medium",
29858
+ className: "text-[var(--color-foreground)] font-medium",
29655
29859
  children: "Jane Doe"
29656
29860
  }
29657
29861
  ),
@@ -29659,7 +29863,7 @@ var AuthLayout = ({
29659
29863
  Typography,
29660
29864
  {
29661
29865
  variant: "body1",
29662
- className: "text-white/60 text-sm",
29866
+ className: "text-[var(--color-foreground)]/60 text-sm",
29663
29867
  children: "CEO, Example Co."
29664
29868
  }
29665
29869
  )
@@ -29667,8 +29871,8 @@ var AuthLayout = ({
29667
29871
  ] })
29668
29872
  ] })
29669
29873
  ] }) }),
29670
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute -bottom-32 -right-32 w-96 h-96 bg-white/5 rounded-full" }),
29671
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute -top-16 -right-16 w-64 h-64 bg-white/5 rounded-full" })
29874
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute -bottom-32 -right-32 w-96 h-96 bg-[var(--color-card)]/5 rounded-full" }),
29875
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute -top-16 -right-16 w-64 h-64 bg-[var(--color-card)]/5 rounded-full" })
29672
29876
  ]
29673
29877
  }
29674
29878
  ),
@@ -29685,7 +29889,7 @@ var AuthLayout = ({
29685
29889
  Typography,
29686
29890
  {
29687
29891
  variant: "body1",
29688
- className: "text-white font-bold text-xl",
29892
+ className: "text-[var(--color-foreground)] font-bold text-xl",
29689
29893
  children: appName.charAt(0).toUpperCase()
29690
29894
  }
29691
29895
  ) }),
@@ -32188,6 +32392,254 @@ function onDebugToggle(listener) {
32188
32392
  listeners5.add(listener);
32189
32393
  return () => listeners5.delete(listener);
32190
32394
  }
32395
+ function layoutGraph(states, transitions, initialState, width, height) {
32396
+ if (states.length === 0) return [];
32397
+ const layers = /* @__PURE__ */ new Map();
32398
+ const queue = [initialState];
32399
+ layers.set(initialState, 0);
32400
+ while (queue.length > 0) {
32401
+ const current = queue.shift();
32402
+ const layer = layers.get(current);
32403
+ for (const tr of transitions) {
32404
+ if (tr.from === current && !layers.has(tr.to)) {
32405
+ layers.set(tr.to, layer + 1);
32406
+ queue.push(tr.to);
32407
+ }
32408
+ }
32409
+ }
32410
+ for (const s of states) {
32411
+ if (!layers.has(s)) layers.set(s, layers.size > 0 ? Math.max(...layers.values()) + 1 : 0);
32412
+ }
32413
+ const layerGroups = /* @__PURE__ */ new Map();
32414
+ for (const [state, layer] of layers) {
32415
+ const group = layerGroups.get(layer) ?? [];
32416
+ group.push(state);
32417
+ layerGroups.set(layer, group);
32418
+ }
32419
+ const maxLayer = Math.max(...layerGroups.keys(), 0);
32420
+ const padX = 24;
32421
+ const padY = 20;
32422
+ const usableW = width - padX * 2;
32423
+ const usableH = height - padY * 2;
32424
+ const positions = [];
32425
+ for (const [layer, group] of layerGroups) {
32426
+ const y = maxLayer === 0 ? usableH / 2 + padY : padY + layer / maxLayer * usableH;
32427
+ for (let i = 0; i < group.length; i++) {
32428
+ const x = group.length === 1 ? width / 2 : padX + i / (group.length - 1) * usableW;
32429
+ positions.push({ x, y, state: group[i] });
32430
+ }
32431
+ }
32432
+ return positions;
32433
+ }
32434
+ function WalkMinimap() {
32435
+ const [walkStep, setWalkStep] = React90__namespace.useState(null);
32436
+ const [traits2, setTraits] = React90__namespace.useState([]);
32437
+ const [coveredEdges, setCoveredEdges] = React90__namespace.useState([]);
32438
+ const [completedTraits, setCompletedTraits] = React90__namespace.useState(/* @__PURE__ */ new Set());
32439
+ const prevTraitRef = React90__namespace.useRef(null);
32440
+ React90__namespace.useEffect(() => {
32441
+ const interval = setInterval(() => {
32442
+ const w = window;
32443
+ const step = w.__orbitalWalkStep;
32444
+ const traitConfigs = w.__orbitalWalkTraits;
32445
+ const edges = w.__orbitalCoveredEdges;
32446
+ if (step) setWalkStep(step);
32447
+ if (traitConfigs) setTraits(traitConfigs);
32448
+ if (edges) setCoveredEdges(edges);
32449
+ if (step && prevTraitRef.current && prevTraitRef.current !== step.traitName) {
32450
+ setCompletedTraits((prev) => new Set(prev).add(prevTraitRef.current));
32451
+ }
32452
+ if (step) prevTraitRef.current = step.traitName;
32453
+ }, 250);
32454
+ return () => clearInterval(interval);
32455
+ }, []);
32456
+ if (!walkStep || traits2.length === 0) return null;
32457
+ const activeTrait = traits2.find((t) => t.name === walkStep.traitName);
32458
+ const engineCount = coveredEdges.filter((e) => e.phase === "engine").length;
32459
+ const domCount = coveredEdges.filter((e) => e.phase === "dom").length;
32460
+ const totalTransitions = traits2.reduce((sum, t) => sum + t.transitions.length, 0);
32461
+ const activeEdgeKeys = new Set(
32462
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).map((e) => `${e.from}+${e.event}->${e.to}`)
32463
+ );
32464
+ const activeEdgePhases = new Map(
32465
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).map((e) => [`${e.from}+${e.event}->${e.to}`, e.phase])
32466
+ );
32467
+ const currentEdgeKey = `${walkStep.from}+${walkStep.event}->${walkStep.to}`;
32468
+ const graphW = 260;
32469
+ const graphH = 120;
32470
+ const nodeR = 10;
32471
+ const positions = activeTrait ? layoutGraph(activeTrait.states, activeTrait.transitions, activeTrait.initialState, graphW, graphH) : [];
32472
+ const posMap = new Map(positions.map((p2) => [p2.state, p2]));
32473
+ const visitedStates = new Set(
32474
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).flatMap((e) => [e.from, e.to])
32475
+ );
32476
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", className: "w-64 flex-shrink-0 border-l border-border bg-[var(--color-card)] overflow-hidden", children: [
32477
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-2 py-1.5 border-b border-border overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "flex-nowrap", children: traits2.map((t) => {
32478
+ const isDone = completedTraits.has(t.name);
32479
+ const isActive = t.name === walkStep.traitName;
32480
+ const variant = isDone ? "success" : isActive ? "info" : "neutral";
32481
+ const shortName = t.name.replace(/^[A-Z][a-z]+/, "");
32482
+ return /* @__PURE__ */ jsxRuntime.jsxs(
32483
+ Badge,
32484
+ {
32485
+ variant,
32486
+ size: "sm",
32487
+ className: `flex-shrink-0 text-[9px] ${isActive ? "ring-1 ring-cyan-400" : ""}`,
32488
+ children: [
32489
+ isDone ? "\u2713" : isActive ? "\u25CF" : "\u25CB",
32490
+ " ",
32491
+ shortName || t.name
32492
+ ]
32493
+ },
32494
+ t.name
32495
+ );
32496
+ }) }) }),
32497
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 flex items-center justify-center px-1 py-1", children: activeTrait && /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: graphW, height: graphH, viewBox: `0 0 ${graphW} ${graphH}`, children: [
32498
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
32499
+ /* @__PURE__ */ jsxRuntime.jsx("marker", { id: "mm-arrow", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#888" }) }),
32500
+ /* @__PURE__ */ jsxRuntime.jsx("marker", { id: "mm-arrow-green", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#22c55e" }) }),
32501
+ /* @__PURE__ */ jsxRuntime.jsx("marker", { id: "mm-arrow-cyan", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#06b6d4" }) }),
32502
+ /* @__PURE__ */ jsxRuntime.jsx("marker", { id: "mm-arrow-yellow", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#eab308" }) })
32503
+ ] }),
32504
+ activeTrait.transitions.map((tr, i) => {
32505
+ const fromPos = posMap.get(tr.from);
32506
+ const toPos = posMap.get(tr.to);
32507
+ if (!fromPos || !toPos) return null;
32508
+ const key = `${tr.from}+${tr.event}->${tr.to}`;
32509
+ const isCurrent = key === currentEdgeKey && !walkStep.isRepositioning;
32510
+ const isCovered = activeEdgeKeys.has(key);
32511
+ const phase = activeEdgePhases.get(key);
32512
+ let stroke = "#555";
32513
+ let markerEnd = "url(#mm-arrow)";
32514
+ let strokeWidth = 1;
32515
+ let opacity = 0.4;
32516
+ if (isCurrent) {
32517
+ stroke = "#eab308";
32518
+ markerEnd = "url(#mm-arrow-yellow)";
32519
+ strokeWidth = 2.5;
32520
+ opacity = 1;
32521
+ } else if (isCovered && phase === "dom") {
32522
+ stroke = "#06b6d4";
32523
+ markerEnd = "url(#mm-arrow-cyan)";
32524
+ strokeWidth = 1.5;
32525
+ opacity = 0.9;
32526
+ } else if (isCovered) {
32527
+ stroke = "#22c55e";
32528
+ markerEnd = "url(#mm-arrow-green)";
32529
+ strokeWidth = 1.5;
32530
+ opacity = 0.9;
32531
+ }
32532
+ if (tr.from === tr.to) {
32533
+ const cx = fromPos.x;
32534
+ const cy = fromPos.y - nodeR - 8;
32535
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
32536
+ /* @__PURE__ */ jsxRuntime.jsx(
32537
+ "path",
32538
+ {
32539
+ d: `M${cx - 5},${fromPos.y - nodeR} C${cx - 18},${cy - 14} ${cx + 18},${cy - 14} ${cx + 5},${fromPos.y - nodeR}`,
32540
+ fill: "none",
32541
+ stroke,
32542
+ strokeWidth,
32543
+ opacity,
32544
+ markerEnd
32545
+ }
32546
+ ),
32547
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: cx, y: cy - 12, textAnchor: "middle", fontSize: "7", fill: stroke, opacity, children: tr.event.length > 10 ? tr.event.slice(0, 8) + ".." : tr.event })
32548
+ ] }, `e-${i}`);
32549
+ }
32550
+ const dx = toPos.x - fromPos.x;
32551
+ const dy = toPos.y - fromPos.y;
32552
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
32553
+ const nx = -dy / len;
32554
+ const ny = dx / len;
32555
+ const hasReverse = activeTrait.transitions.some(
32556
+ (t2) => t2.from === tr.to && t2.to === tr.from
32557
+ );
32558
+ const offset = hasReverse ? 4 : 0;
32559
+ const x1 = fromPos.x + dx / len * nodeR + nx * offset;
32560
+ const y1 = fromPos.y + dy / len * nodeR + ny * offset;
32561
+ const x2 = toPos.x - dx / len * (nodeR + 6) + nx * offset;
32562
+ const y2 = toPos.y - dy / len * (nodeR + 6) + ny * offset;
32563
+ const mx = (x1 + x2) / 2 + nx * 8;
32564
+ const my = (y1 + y2) / 2 + ny * 8;
32565
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
32566
+ /* @__PURE__ */ jsxRuntime.jsx(
32567
+ "line",
32568
+ {
32569
+ x1,
32570
+ y1,
32571
+ x2,
32572
+ y2,
32573
+ stroke,
32574
+ strokeWidth,
32575
+ opacity,
32576
+ markerEnd,
32577
+ children: isCurrent && /* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "opacity", values: "1;0.4;1", dur: "0.8s", repeatCount: "indefinite" })
32578
+ }
32579
+ ),
32580
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: mx, y: my, textAnchor: "middle", fontSize: "7", fill: stroke, opacity: Math.min(opacity + 0.2, 1), children: tr.event.length > 12 ? tr.event.slice(0, 10) + ".." : tr.event })
32581
+ ] }, `e-${i}`);
32582
+ }),
32583
+ positions.map((pos) => {
32584
+ const isCurrentState = pos.state === walkStep.from || pos.state === walkStep.to;
32585
+ const isVisited = visitedStates.has(pos.state);
32586
+ const isInitial = pos.state === activeTrait.initialState;
32587
+ let fill = "#333";
32588
+ let strokeColor = "#555";
32589
+ let sw = 1;
32590
+ if (isCurrentState) {
32591
+ fill = "#1e40af";
32592
+ strokeColor = "#3b82f6";
32593
+ sw = 2;
32594
+ } else if (isVisited) {
32595
+ fill = "#166534";
32596
+ strokeColor = "#22c55e";
32597
+ sw = 1.5;
32598
+ }
32599
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
32600
+ isInitial && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: pos.x, cy: pos.y, r: nodeR + 3, fill: "none", stroke: "#3b82f6", strokeWidth: 1, opacity: 0.4 }),
32601
+ /* @__PURE__ */ jsxRuntime.jsx(
32602
+ "circle",
32603
+ {
32604
+ cx: pos.x,
32605
+ cy: pos.y,
32606
+ r: nodeR,
32607
+ fill,
32608
+ stroke: strokeColor,
32609
+ strokeWidth: sw,
32610
+ children: isCurrentState && /* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "r", values: `${nodeR};${nodeR + 2};${nodeR}`, dur: "1s", repeatCount: "indefinite" })
32611
+ }
32612
+ ),
32613
+ /* @__PURE__ */ jsxRuntime.jsx(
32614
+ "text",
32615
+ {
32616
+ x: pos.x,
32617
+ y: pos.y + nodeR + 10,
32618
+ textAnchor: "middle",
32619
+ fontSize: "8",
32620
+ fill: "#aaa",
32621
+ children: pos.state.length > 10 ? pos.state.slice(0, 8) + ".." : pos.state
32622
+ }
32623
+ )
32624
+ ] }, pos.state);
32625
+ })
32626
+ ] }) }),
32627
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-2 py-1 border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", className: "items-center justify-between", children: [
32628
+ /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "caption", className: "text-[10px] font-mono text-green-500", children: [
32629
+ "Engine: ",
32630
+ engineCount,
32631
+ "/",
32632
+ totalTransitions
32633
+ ] }),
32634
+ domCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "caption", className: "text-[10px] font-mono text-cyan-500", children: [
32635
+ "DOM: ",
32636
+ domCount
32637
+ ] }),
32638
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: walkStep.phase === "engine" ? "info" : "warning", size: "sm", className: "text-[9px]", children: walkStep.phase === "engine" ? "Engine" : "DOM" })
32639
+ ] }) })
32640
+ ] });
32641
+ }
32642
+ WalkMinimap.displayName = "WalkMinimap";
32191
32643
  function TraitsTab({ traits: traits2 }) {
32192
32644
  if (traits2.length === 0) {
32193
32645
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -33011,25 +33463,25 @@ function EventDispatcherTab({ traits: traits2, schema }) {
33011
33463
  EventDispatcherTab.displayName = "EventDispatcherTab";
33012
33464
  function ServerResponseRow({ sr }) {
33013
33465
  const entityEntries = Object.entries(sr.dataEntities);
33014
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-4 pl-2 border-l border-purple-700/50 py-0.5 text-[10px] font-mono", children: [
33466
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-4 pl-2 border-l border-purple-500/30 py-0.5 text-[10px] font-mono", children: [
33015
33467
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
33016
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: sr.success ? "text-green-400" : "text-red-400", children: [
33468
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: sr.success ? "text-green-600 dark:text-green-400" : "text-red-600 dark:text-red-400", children: [
33017
33469
  sr.success ? "\u2713" : "\u2717",
33018
33470
  " server"
33019
33471
  ] }),
33020
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-300", children: sr.orbitalName }),
33021
- sr.clientEffects > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-purple-900/50 text-purple-300", children: [
33472
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-600 dark:text-purple-300", children: sr.orbitalName }),
33473
+ sr.clientEffects > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-purple-500/15 text-purple-600 dark:text-purple-300", children: [
33022
33474
  sr.clientEffects,
33023
33475
  " clientEffect",
33024
33476
  sr.clientEffects !== 1 ? "s" : ""
33025
33477
  ] }),
33026
- sr.emittedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-blue-900/50 text-blue-300", children: [
33478
+ sr.emittedEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-blue-500/15 text-blue-300", children: [
33027
33479
  "emit: ",
33028
33480
  sr.emittedEvents.join(", ")
33029
33481
  ] }),
33030
- sr.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-1 rounded bg-red-900/50 text-red-400 truncate max-w-[300px]", children: sr.error })
33482
+ sr.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-1 rounded bg-red-500/15 text-red-600 dark:text-red-400 truncate max-w-[300px]", children: sr.error })
33031
33483
  ] }),
33032
- entityEntries.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 mt-0.5", children: entityEntries.map(([name, count]) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-gray-800 text-gray-300", children: [
33484
+ entityEntries.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 mt-0.5", children: entityEntries.map(([name, count]) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "px-1 rounded bg-[var(--color-card)] text-foreground", children: [
33033
33485
  name,
33034
33486
  ": ",
33035
33487
  count,
@@ -33042,24 +33494,24 @@ function TransitionRow({ trace }) {
33042
33494
  const isServerEntry = !!trace.serverResponse && trace.traitName.startsWith("server:");
33043
33495
  const hasFailedEffects = trace.effects.some((e) => e.status === "failed");
33044
33496
  if (isServerEntry && trace.serverResponse) {
33045
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-0.5 border-b border-gray-800 last:border-0", children: [
33497
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-0.5 border-b border-border last:border-0", children: [
33046
33498
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 text-xs font-mono", children: [
33047
33499
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-1.5 w-1.5 h-1.5 rounded-full flex-shrink-0 bg-purple-500" }),
33048
33500
  /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "warning", size: "sm", className: "flex-shrink-0", children: trace.event }),
33049
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400 flex-shrink-0", children: "server response" })
33501
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-600 dark:text-purple-400 flex-shrink-0", children: "server response" })
33050
33502
  ] }),
33051
33503
  /* @__PURE__ */ jsxRuntime.jsx(ServerResponseRow, { sr: trace.serverResponse })
33052
33504
  ] });
33053
33505
  }
33054
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-0.5 border-b border-gray-800 last:border-0", children: [
33506
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-0.5 border-b border-border last:border-0", children: [
33055
33507
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 text-xs font-mono", children: [
33056
33508
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
33057
33509
  "mt-1.5 w-1.5 h-1.5 rounded-full flex-shrink-0",
33058
33510
  hasFailedEffects ? "bg-red-500" : "bg-green-500"
33059
33511
  ) }),
33060
33512
  /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "info", size: "sm", className: "flex-shrink-0", children: trace.event }),
33061
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-300 flex-shrink-0", children: trace.traitName }),
33062
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-gray-400 flex-shrink-0", children: [
33513
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground flex-shrink-0", children: trace.traitName }),
33514
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-foreground/70 flex-shrink-0", children: [
33063
33515
  trace.from,
33064
33516
  " ",
33065
33517
  "\u2192",
@@ -33069,12 +33521,12 @@ function TransitionRow({ trace }) {
33069
33521
  ] }),
33070
33522
  trace.effects.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 ml-6 mt-0.5", children: trace.effects.map((eff, i) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(
33071
33523
  "px-1 rounded text-[10px]",
33072
- eff.status === "executed" ? "bg-green-900/50 text-green-400" : eff.status === "failed" ? "bg-red-900/50 text-red-400" : "bg-yellow-900/50 text-yellow-400"
33524
+ eff.status === "executed" ? "bg-green-500/15 text-green-600 dark:text-green-400" : eff.status === "failed" ? "bg-red-500/15 text-red-600 dark:text-red-400" : "bg-yellow-500/15 text-yellow-600 dark:text-yellow-400"
33073
33525
  ), children: [
33074
33526
  eff.status === "executed" ? "\u2713" : eff.status === "failed" ? "\u2717" : "-",
33075
33527
  " ",
33076
33528
  eff.type,
33077
- eff.args.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500 ml-0.5", children: JSON.stringify(eff.args).slice(0, 40) })
33529
+ eff.args.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground/50 ml-0.5", children: JSON.stringify(eff.args).slice(0, 40) })
33078
33530
  ] }, i)) }),
33079
33531
  trace.serverResponse && /* @__PURE__ */ jsxRuntime.jsx(ServerResponseRow, { sr: trace.serverResponse })
33080
33532
  ] });
@@ -33089,15 +33541,6 @@ function VerifyModePanel({
33089
33541
  }) {
33090
33542
  const scrollRef = React90__namespace.useRef(null);
33091
33543
  const prevCountRef = React90__namespace.useRef(0);
33092
- const [walkStep, setWalkStep] = React90__namespace.useState(null);
33093
- React90__namespace.useEffect(() => {
33094
- const interval = setInterval(() => {
33095
- const w = window;
33096
- const step = w.__orbitalWalkStep;
33097
- if (step) setWalkStep(step);
33098
- }, 300);
33099
- return () => clearInterval(interval);
33100
- }, []);
33101
33544
  React90__namespace.useEffect(() => {
33102
33545
  if (transitions.length > prevCountRef.current && scrollRef.current) {
33103
33546
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
@@ -33110,49 +33553,28 @@ function VerifyModePanel({
33110
33553
  {
33111
33554
  className: cn(
33112
33555
  "runtime-debugger runtime-debugger--verify",
33113
- "flex flex-col bg-gray-900 text-white border-t-2 border-cyan-500",
33556
+ "flex flex-col bg-[var(--color-card)] text-[var(--color-foreground)] border-t-2 border-cyan-500",
33114
33557
  hudBottom ? "" : "fixed bottom-0 left-0 right-0",
33115
33558
  className
33116
33559
  ),
33117
33560
  "data-testid": "debugger-verify",
33118
33561
  style: { height: "25vh", zIndex: hudBottom ? void 0 : 40 },
33119
33562
  children: [
33120
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-1.5 flex items-center gap-3 text-xs font-mono border-b border-gray-700 flex-shrink-0", children: [
33563
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-1.5 flex items-center gap-3 text-xs font-mono border-b border-border flex-shrink-0", children: [
33121
33564
  /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: failedChecks > 0 ? "danger" : "success", size: "sm", children: failedChecks > 0 ? `${failedChecks} fail` : "OK" }),
33122
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-gray-400", children: [
33565
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-foreground/70", children: [
33123
33566
  localCount,
33124
33567
  " local"
33125
33568
  ] }),
33126
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-purple-400", children: [
33569
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-purple-600 dark:text-purple-400", children: [
33127
33570
  serverCount,
33128
33571
  " server"
33129
33572
  ] }),
33130
- traitStates && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-cyan-400 truncate max-w-[400px]", children: traitStates })
33573
+ traitStates && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-cyan-600 dark:text-cyan-400 truncate max-w-[400px]", children: traitStates })
33131
33574
  ] }),
33132
33575
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
33133
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1", children: transitions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-500 text-xs font-mono py-2 text-center", children: "Waiting for transitions..." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: transitions.map((trace) => /* @__PURE__ */ jsxRuntime.jsx(TransitionRow, { trace }, trace.id)) }) }) }),
33134
- walkStep && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-56 flex-shrink-0 border-l border-gray-700 px-2 py-1 text-xs font-mono overflow-y-auto", children: [
33135
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-cyan-400 font-bold mb-1", children: [
33136
- "Walk Step ",
33137
- walkStep.stepIndex,
33138
- "/",
33139
- walkStep.stepTotal
33140
- ] }),
33141
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-300 mb-1", children: walkStep.traitName }),
33142
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 mb-1", children: [
33143
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-yellow-300", children: walkStep.from }),
33144
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "--" }),
33145
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-green-300", children: walkStep.event }),
33146
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: "-->" }),
33147
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-yellow-300", children: walkStep.to })
33148
- ] }),
33149
- walkStep.guardCase && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: walkStep.guardCase === "pass" ? "text-green-400" : "text-red-400", children: [
33150
- "guard: ",
33151
- walkStep.guardCase
33152
- ] }),
33153
- walkStep.isRepositioning && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-500 italic", children: "repositioning" }),
33154
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: walkStep.accepted ? "text-green-400 mt-1" : "text-red-400 mt-1", children: walkStep.accepted ? "\u2713 accepted" : "\u2717 rejected" })
33155
- ] })
33576
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1", children: transitions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-foreground/50 text-xs font-mono py-2 text-center", children: "Waiting for transitions..." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: transitions.map((trace) => /* @__PURE__ */ jsxRuntime.jsx(TransitionRow, { trace }, trace.id)) }) }) }),
33577
+ /* @__PURE__ */ jsxRuntime.jsx(WalkMinimap, {})
33156
33578
  ] })
33157
33579
  ]
33158
33580
  }
@@ -33377,7 +33799,7 @@ function RuntimeDebugger({
33377
33799
  className: "runtime-debugger__tabs"
33378
33800
  }
33379
33801
  ) }),
33380
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "runtime-debugger__footer", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", className: "text-gray-500", children: "Press ` to toggle | window.__orbitalVerification for automation" }) })
33802
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "runtime-debugger__footer", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", className: "text-foreground/50", children: "Press ` to toggle | window.__orbitalVerification for automation" }) })
33381
33803
  ] })
33382
33804
  }
33383
33805
  );
@@ -34088,6 +34510,62 @@ function getComponentForPattern(patternType) {
34088
34510
  if (!name) return null;
34089
34511
  return COMPONENT_REGISTRY[name] ?? null;
34090
34512
  }
34513
+ var FORM_PATTERNS = /* @__PURE__ */ new Set([
34514
+ "form",
34515
+ "form-section",
34516
+ "inline-edit-form",
34517
+ "wizard-step"
34518
+ ]);
34519
+ function enrichFormFields(fields, entityDef) {
34520
+ const fieldMap = new Map(entityDef.fields.map((f3) => [f3.name, f3]));
34521
+ return fields.map((field) => {
34522
+ if (typeof field === "string") {
34523
+ const entityField = fieldMap.get(field);
34524
+ if (entityField) {
34525
+ const enriched = {
34526
+ name: field,
34527
+ label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
34528
+ type: entityField.type,
34529
+ required: entityField.required
34530
+ };
34531
+ if (entityField.values && entityField.values.length > 0) {
34532
+ enriched.values = entityField.values;
34533
+ } else if (entityField.enumValues && entityField.enumValues.length > 0) {
34534
+ enriched.values = entityField.enumValues;
34535
+ }
34536
+ if (entityField.relation) {
34537
+ enriched.relation = entityField.relation;
34538
+ }
34539
+ return enriched;
34540
+ }
34541
+ return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
34542
+ }
34543
+ if (field && typeof field === "object" && !Array.isArray(field)) {
34544
+ const obj = field;
34545
+ const fieldName = obj.name ?? obj.field;
34546
+ if (!fieldName) return field;
34547
+ if (obj.type || obj.inputType) return field;
34548
+ const entityField = fieldMap.get(fieldName);
34549
+ if (!entityField) return field;
34550
+ const enriched = { ...obj, type: entityField.type };
34551
+ if (entityField.required && !("required" in obj)) {
34552
+ enriched.required = true;
34553
+ }
34554
+ if (!obj.values && !obj.options) {
34555
+ if (entityField.values && entityField.values.length > 0) {
34556
+ enriched.values = entityField.values;
34557
+ } else if (entityField.enumValues && entityField.enumValues.length > 0) {
34558
+ enriched.values = entityField.enumValues;
34559
+ }
34560
+ }
34561
+ if (!obj.relation && entityField.relation) {
34562
+ enriched.relation = entityField.relation;
34563
+ }
34564
+ return enriched;
34565
+ }
34566
+ return field;
34567
+ });
34568
+ }
34091
34569
  var PATTERNS_WITH_CHILDREN = /* @__PURE__ */ new Set([
34092
34570
  "stack",
34093
34571
  "vstack",
@@ -34463,13 +34941,14 @@ function getToastPosition(position) {
34463
34941
  return "top-4 right-4";
34464
34942
  }
34465
34943
  }
34466
- function renderPatternChildren(children, onDismiss, parentId = "root") {
34944
+ function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root") {
34467
34945
  if (!children || !Array.isArray(children) || children.length === 0) {
34468
34946
  return null;
34469
34947
  }
34470
34948
  return children.map((child, index) => {
34471
34949
  if (!child || typeof child !== "object") return null;
34472
34950
  const childId = `${parentId}-${index}`;
34951
+ const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
34473
34952
  const childContent = {
34474
34953
  id: childId,
34475
34954
  pattern: child.type,
@@ -34481,7 +34960,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root") {
34481
34960
  SlotContentRenderer,
34482
34961
  {
34483
34962
  content: childContent,
34484
- onDismiss
34963
+ onDismiss,
34964
+ patternPath: childPath
34485
34965
  },
34486
34966
  childId
34487
34967
  );
@@ -34513,16 +34993,20 @@ function renderPatternProps(props, onDismiss) {
34513
34993
  }
34514
34994
  function SlotContentRenderer({
34515
34995
  content,
34516
- onDismiss
34996
+ onDismiss,
34997
+ patternPath
34517
34998
  }) {
34518
34999
  const entityProp = content.props.entity;
34519
35000
  const entityType = typeof entityProp === "string" ? entityProp : "";
34520
35001
  const storeData = useEntityRef(entityType);
35002
+ const schemaCtx = useEntitySchemaOptional();
35003
+ const entityDef = entityType && schemaCtx ? schemaCtx.entities.get(entityType) : void 0;
34521
35004
  const PatternComponent = getComponentForPattern(content.pattern);
34522
35005
  if (PatternComponent) {
34523
35006
  const childrenConfig = content.props.children;
34524
35007
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0;
34525
- const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id) : void 0;
35008
+ const myPath = patternPath ?? "root";
35009
+ const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath) : void 0;
34526
35010
  const { children: _childrenConfig, ...restProps } = content.props;
34527
35011
  const renderedProps = renderPatternProps(restProps, onDismiss);
34528
35012
  let finalProps;
@@ -34538,6 +35022,14 @@ function SlotContentRenderer({
34538
35022
  } else {
34539
35023
  finalProps = renderedProps;
34540
35024
  }
35025
+ const isFormPattern = FORM_PATTERNS.has(content.pattern) || content.pattern.includes("form");
35026
+ if (isFormPattern && entityDef && Array.isArray(finalProps.fields)) {
35027
+ finalProps.fields = enrichFormFields(finalProps.fields, entityDef);
35028
+ if (finalProps.mode === "edit" && !finalProps.initialData && storeData.length > 0) {
35029
+ finalProps.initialData = storeData[0];
35030
+ }
35031
+ }
35032
+ const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
34541
35033
  return /* @__PURE__ */ jsxRuntime.jsx(
34542
35034
  Box,
34543
35035
  {
@@ -34546,6 +35038,9 @@ function SlotContentRenderer({
34546
35038
  "data-id": content.id,
34547
35039
  "data-node-id": content.nodeId,
34548
35040
  "data-source-trait": content.sourceTrait,
35041
+ "data-pattern-path": myPath,
35042
+ "data-pattern-type": content.pattern,
35043
+ "data-accepts-children": acceptsChildren ? "true" : void 0,
34549
35044
  children: /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren })
34550
35045
  }
34551
35046
  );
@@ -37220,6 +37715,98 @@ function usePinchZoom(options = {}) {
37220
37715
  resetZoom
37221
37716
  };
37222
37717
  }
37718
+ var ALMADAR_DND_MIME = "application/x-almadar-dnd";
37719
+ function useDraggable({ payload, disabled = false }) {
37720
+ const [isDragging, setIsDragging] = React90.useState(false);
37721
+ const eventBus = useEventBus();
37722
+ const handleDragStart = React90.useCallback(
37723
+ (e) => {
37724
+ if (disabled) {
37725
+ e.preventDefault();
37726
+ return;
37727
+ }
37728
+ e.dataTransfer.setData(ALMADAR_DND_MIME, JSON.stringify(payload));
37729
+ e.dataTransfer.effectAllowed = "copy";
37730
+ setIsDragging(true);
37731
+ eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
37732
+ },
37733
+ [disabled, payload, eventBus]
37734
+ );
37735
+ const handleDragEnd = React90.useCallback(
37736
+ (e) => {
37737
+ setIsDragging(false);
37738
+ eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
37739
+ },
37740
+ [payload, eventBus]
37741
+ );
37742
+ const dragProps = React90.useMemo(
37743
+ () => ({
37744
+ draggable: !disabled,
37745
+ onDragStart: handleDragStart,
37746
+ onDragEnd: handleDragEnd,
37747
+ "aria-grabbed": isDragging
37748
+ }),
37749
+ [disabled, handleDragStart, handleDragEnd, isDragging]
37750
+ );
37751
+ return { dragProps, isDragging };
37752
+ }
37753
+ function parsePayload(e) {
37754
+ try {
37755
+ const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
37756
+ if (!raw) return null;
37757
+ const parsed = JSON.parse(raw);
37758
+ if (typeof parsed.kind !== "string" || !parsed.data) return null;
37759
+ return parsed;
37760
+ } catch {
37761
+ return null;
37762
+ }
37763
+ }
37764
+ function hasAlmadarPayload(e) {
37765
+ return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
37766
+ }
37767
+ function useDropZone({ accepts, onDrop, disabled = false }) {
37768
+ const [isOver, setIsOver] = React90.useState(false);
37769
+ const eventBus = useEventBus();
37770
+ const handleDragOver = React90.useCallback(
37771
+ (e) => {
37772
+ if (disabled) return;
37773
+ if (!hasAlmadarPayload(e)) return;
37774
+ e.preventDefault();
37775
+ e.dataTransfer.dropEffect = "copy";
37776
+ setIsOver(true);
37777
+ },
37778
+ [disabled]
37779
+ );
37780
+ const handleDragLeave = React90.useCallback(
37781
+ (e) => {
37782
+ setIsOver(false);
37783
+ },
37784
+ []
37785
+ );
37786
+ const handleDrop = React90.useCallback(
37787
+ (e) => {
37788
+ e.preventDefault();
37789
+ setIsOver(false);
37790
+ if (disabled) return;
37791
+ const payload = parsePayload(e);
37792
+ if (!payload) return;
37793
+ if (!accepts.includes(payload.kind)) return;
37794
+ const position = { x: e.clientX, y: e.clientY };
37795
+ onDrop(payload, position);
37796
+ eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
37797
+ },
37798
+ [disabled, accepts, onDrop, eventBus]
37799
+ );
37800
+ const dropProps = React90.useMemo(
37801
+ () => ({
37802
+ onDragOver: handleDragOver,
37803
+ onDragLeave: handleDragLeave,
37804
+ onDrop: handleDrop
37805
+ }),
37806
+ [handleDragOver, handleDragLeave, handleDrop]
37807
+ );
37808
+ return { dropProps, isOver };
37809
+ }
37223
37810
  var API_BASE = typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_API_URL : "http://localhost:3000";
37224
37811
  function getUserId() {
37225
37812
  return localStorage.getItem("userId") || "anonymous";
@@ -37297,6 +37884,7 @@ function useGitHubBranches(owner, repo, enabled = true) {
37297
37884
  }
37298
37885
 
37299
37886
  exports.ALL_PRESETS = ALL_PRESETS;
37887
+ exports.ALMADAR_DND_MIME = ALMADAR_DND_MIME;
37300
37888
  exports.AR_BOOK_FIELDS = AR_BOOK_FIELDS;
37301
37889
  exports.AboutPageTemplate = AboutPageTemplate;
37302
37890
  exports.Accordion = Accordion;
@@ -37641,6 +38229,8 @@ exports.useDeepAgentGeneration = useDeepAgentGeneration;
37641
38229
  exports.useDeleteEntity = useDeleteEntity;
37642
38230
  exports.useDisconnectGitHub = useDisconnectGitHub;
37643
38231
  exports.useDragReorder = useDragReorder;
38232
+ exports.useDraggable = useDraggable;
38233
+ exports.useDropZone = useDropZone;
37644
38234
  exports.useEmitEvent = useEmitEvent;
37645
38235
  exports.useEntities = useEntities;
37646
38236
  exports.useEntitiesByType = useEntitiesByType;