@almadar/ui 2.43.0 → 2.46.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.
package/dist/avl/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { OrbitControls, Grid as Grid$1, Stars, Sparkles, Html, RoundedBox } from '@react-three/drei';
3
- import * as React124 from 'react';
4
- import React124__default, { createContext, useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect, lazy, useContext, Suspense, useSyncExternalStore, useId, forwardRef, useImperativeHandle, useReducer, Component } from 'react';
3
+ import * as React125 from 'react';
4
+ import React125__default, { createContext, useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect, lazy, useContext, Suspense, useSyncExternalStore, useId, forwardRef, useImperativeHandle, useReducer, Component } from 'react';
5
5
  import { useThree, useFrame, Canvas } from '@react-three/fiber';
6
6
  import * as THREE6 from 'three';
7
7
  import { MathUtils, Vector3, Quaternion, QuadraticBezierCurve3 } from 'three';
@@ -3155,7 +3155,7 @@ var init_Box = __esm({
3155
3155
  fixed: "fixed",
3156
3156
  sticky: "sticky"
3157
3157
  };
3158
- Box = React124__default.forwardRef(
3158
+ Box = React125__default.forwardRef(
3159
3159
  ({
3160
3160
  padding,
3161
3161
  paddingX,
@@ -5495,7 +5495,7 @@ function UnitRenderer({
5495
5495
  onAnimationStateChange,
5496
5496
  animationSpeed = 1
5497
5497
  }) {
5498
- const handleUnitClick = React124__default.useCallback(
5498
+ const handleUnitClick = React125__default.useCallback(
5499
5499
  (unit) => {
5500
5500
  onUnitClick?.(unit);
5501
5501
  },
@@ -8689,7 +8689,7 @@ var init_Avl3DViewer = __esm({
8689
8689
  const handleTraitClick = useCallback((name) => {
8690
8690
  dispatch({ type: "ZOOM_INTO_TRAIT", trait: name, targetPosition: { x: 0, y: 0 } });
8691
8691
  }, []);
8692
- const [highlightedTrait, setHighlightedTrait] = React124__default.useState(null);
8692
+ const [highlightedTrait, setHighlightedTrait] = React125__default.useState(null);
8693
8693
  const handleTransitionClick = useCallback((index) => {
8694
8694
  dispatch({ type: "ZOOM_INTO_TRANSITION", transitionIndex: index, targetPosition: { x: 0, y: 0 } });
8695
8695
  }, []);
@@ -8776,7 +8776,7 @@ var init_Avl3DViewer = __esm({
8776
8776
  gap: "xs",
8777
8777
  align: "center",
8778
8778
  className: "absolute top-2 left-2 z-10 bg-surface/80 backdrop-blur rounded-md px-3 py-1.5",
8779
- children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
8779
+ children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
8780
8780
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "mx-1", children: "/" }),
8781
8781
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
8782
8782
  Box,
@@ -9527,7 +9527,7 @@ var AvlTransition = ({
9527
9527
  opacity = 1,
9528
9528
  className
9529
9529
  }) => {
9530
- const ids = React124__default.useMemo(() => {
9530
+ const ids = React125__default.useMemo(() => {
9531
9531
  avlTransitionId += 1;
9532
9532
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
9533
9533
  }, []);
@@ -10292,7 +10292,7 @@ var AvlStateMachine = ({
10292
10292
  color = "var(--color-primary)",
10293
10293
  animated = false
10294
10294
  }) => {
10295
- const ids = React124__default.useMemo(() => {
10295
+ const ids = React125__default.useMemo(() => {
10296
10296
  avlSmId += 1;
10297
10297
  const base = `avl-sm-${avlSmId}`;
10298
10298
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -10487,7 +10487,7 @@ var AvlOrbitalUnit = ({
10487
10487
  color = "var(--color-primary)",
10488
10488
  animated = false
10489
10489
  }) => {
10490
- const ids = React124__default.useMemo(() => {
10490
+ const ids = React125__default.useMemo(() => {
10491
10491
  avlOuId += 1;
10492
10492
  const base = `avl-ou-${avlOuId}`;
10493
10493
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -10579,7 +10579,7 @@ var AvlClosedCircuit = ({
10579
10579
  color = "var(--color-primary)",
10580
10580
  animated = false
10581
10581
  }) => {
10582
- const ids = React124__default.useMemo(() => {
10582
+ const ids = React125__default.useMemo(() => {
10583
10583
  avlCcId += 1;
10584
10584
  const base = `avl-cc-${avlCcId}`;
10585
10585
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -10732,7 +10732,7 @@ var AvlEmitListen = ({
10732
10732
  color = "var(--color-primary)",
10733
10733
  animated = false
10734
10734
  }) => {
10735
- const ids = React124__default.useMemo(() => {
10735
+ const ids = React125__default.useMemo(() => {
10736
10736
  avlElId += 1;
10737
10737
  const base = `avl-el-${avlElId}`;
10738
10738
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -11005,7 +11005,7 @@ function renderNode(node, color, glowId) {
11005
11005
  const baseR = node.type === "operator" ? 20 : 16;
11006
11006
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
11007
11007
  const nc = nodeColor(node.type, color);
11008
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
11008
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
11009
11009
  node.children.map((child, i) => {
11010
11010
  const childR = Math.max(
11011
11011
  child.type === "operator" ? 20 : 16,
@@ -11062,7 +11062,7 @@ var AvlExprTree = ({
11062
11062
  className,
11063
11063
  color = "var(--color-primary)"
11064
11064
  }) => {
11065
- const ids = React124__default.useMemo(() => {
11065
+ const ids = React125__default.useMemo(() => {
11066
11066
  avlEtId += 1;
11067
11067
  return { glow: `avl-et-${avlEtId}-glow` };
11068
11068
  }, []);
@@ -12036,7 +12036,7 @@ var SystemNode = ({ data }) => {
12036
12036
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
12037
12037
  const tc = transitionCounts[s.name] ?? 0;
12038
12038
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
12039
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
12039
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
12040
12040
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
12041
12041
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
12042
12042
  ] }, s.name);
@@ -12076,7 +12076,7 @@ var MiniStateMachine = ({ data, className }) => {
12076
12076
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
12077
12077
  const tc = transitionCounts[s.name] ?? 0;
12078
12078
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
12079
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
12079
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
12080
12080
  /* @__PURE__ */ jsx(
12081
12081
  AvlState,
12082
12082
  {
@@ -12830,12 +12830,12 @@ function findCrossLinks(orbitals) {
12830
12830
  }
12831
12831
  return links;
12832
12832
  }
12833
- function schemaToOverviewGraph(schema, mockData) {
12833
+ function schemaToOverviewGraph(schema, mockData, behaviorMeta, layoutHint) {
12834
12834
  const orbitals = getOrbitals(schema);
12835
12835
  const nodes = [];
12836
12836
  const edges = [];
12837
12837
  const count = orbitals.length;
12838
- const cols = Math.ceil(Math.sqrt(count));
12838
+ const cols = layoutHint === "pipeline" ? count : Math.ceil(Math.sqrt(count));
12839
12839
  for (let i = 0; i < orbitals.length; i++) {
12840
12840
  const orb = orbitals[i];
12841
12841
  const entityInfo = getEntityInfo(orb);
@@ -12874,6 +12874,22 @@ function schemaToOverviewGraph(schema, mockData) {
12874
12874
  }
12875
12875
  }
12876
12876
  const eventSources = collectEventSources(initPatterns);
12877
+ for (const source of eventSources) {
12878
+ for (const trait of traits2) {
12879
+ const sm = getStateMachine2(trait);
12880
+ if (!sm) continue;
12881
+ const smEvents = trait.stateMachine?.events ?? [];
12882
+ const matchingEvent = smEvents.find((ev) => ev.key === source.event);
12883
+ if (matchingEvent?.payload && Array.isArray(matchingEvent.payload)) {
12884
+ source.payloadFields = matchingEvent.payload.map((p2) => ({
12885
+ name: String(p2.name ?? ""),
12886
+ type: String(p2.type ?? "string"),
12887
+ ...p2.required ? { required: true } : {}
12888
+ }));
12889
+ break;
12890
+ }
12891
+ }
12892
+ }
12877
12893
  const col = i % cols;
12878
12894
  const row = Math.floor(i / cols);
12879
12895
  nodes.push({
@@ -12885,6 +12901,7 @@ function schemaToOverviewGraph(schema, mockData) {
12885
12901
  patterns: initPatterns,
12886
12902
  eventSources,
12887
12903
  effectTypes: initEffectTypes,
12904
+ layer: behaviorMeta?.[orb.name]?.layer,
12888
12905
  stateRole: "initial",
12889
12906
  entityName: entityInfo.name,
12890
12907
  persistence: entityInfo.persistence,
@@ -13374,7 +13391,7 @@ function subscribeToStore(listener) {
13374
13391
  function useEntityRef(entityType) {
13375
13392
  const versionRef = useRef(0);
13376
13393
  const dataRef = useRef([]);
13377
- const getSnapshotStable = React124__default.useCallback(() => {
13394
+ const getSnapshotStable = React125__default.useCallback(() => {
13378
13395
  const currentVersion = getVersion(entityType);
13379
13396
  if (currentVersion !== versionRef.current) {
13380
13397
  versionRef.current = currentVersion;
@@ -13482,6 +13499,36 @@ function SelectionProvider({
13482
13499
  };
13483
13500
  return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue2, children });
13484
13501
  }
13502
+ var EntitySchemaContext = createContext(null);
13503
+ function EntitySchemaProvider({
13504
+ entities,
13505
+ children
13506
+ }) {
13507
+ const entitiesMap = useMemo(() => {
13508
+ const map = /* @__PURE__ */ new Map();
13509
+ for (const entity of entities) {
13510
+ map.set(entity.name, entity);
13511
+ }
13512
+ return map;
13513
+ }, [entities]);
13514
+ const contextValue2 = useMemo(
13515
+ () => ({
13516
+ entities: entitiesMap
13517
+ }),
13518
+ [entitiesMap]
13519
+ );
13520
+ return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue2, children });
13521
+ }
13522
+ function useEntitySchema() {
13523
+ const context = useContext(EntitySchemaContext);
13524
+ if (!context) {
13525
+ throw new Error("useEntitySchema must be used within an EntitySchemaProvider");
13526
+ }
13527
+ return context;
13528
+ }
13529
+ function useEntitySchemaOptional() {
13530
+ return useContext(EntitySchemaContext);
13531
+ }
13485
13532
  var DEFAULT_SLOTS = {
13486
13533
  main: null,
13487
13534
  sidebar: null,
@@ -14211,7 +14258,7 @@ function resolveIconProp(value, sizeClass) {
14211
14258
  const IconComp = value;
14212
14259
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
14213
14260
  }
14214
- if (React124__default.isValidElement(value)) {
14261
+ if (React125__default.isValidElement(value)) {
14215
14262
  return value;
14216
14263
  }
14217
14264
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -14220,7 +14267,7 @@ function resolveIconProp(value, sizeClass) {
14220
14267
  }
14221
14268
  return value;
14222
14269
  }
14223
- var Button = React124__default.forwardRef(
14270
+ var Button = React125__default.forwardRef(
14224
14271
  ({
14225
14272
  className,
14226
14273
  variant = "primary",
@@ -14319,7 +14366,7 @@ var sizeStyles3 = {
14319
14366
  md: "px-2.5 py-1 text-sm",
14320
14367
  lg: "px-3 py-1.5 text-base"
14321
14368
  };
14322
- var Badge = React124__default.forwardRef(
14369
+ var Badge = React125__default.forwardRef(
14323
14370
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
14324
14371
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
14325
14372
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -14460,7 +14507,7 @@ init_cn();
14460
14507
 
14461
14508
  // components/atoms/Input.tsx
14462
14509
  init_cn();
14463
- var Input = React124__default.forwardRef(
14510
+ var Input = React125__default.forwardRef(
14464
14511
  ({
14465
14512
  className,
14466
14513
  inputType,
@@ -14575,7 +14622,7 @@ Input.displayName = "Input";
14575
14622
 
14576
14623
  // components/atoms/Label.tsx
14577
14624
  init_cn();
14578
- var Label = React124__default.forwardRef(
14625
+ var Label = React125__default.forwardRef(
14579
14626
  ({ className, required, children, ...props }, ref) => {
14580
14627
  return /* @__PURE__ */ jsxs(
14581
14628
  "label",
@@ -14598,7 +14645,7 @@ Label.displayName = "Label";
14598
14645
 
14599
14646
  // components/atoms/Textarea.tsx
14600
14647
  init_cn();
14601
- var Textarea = React124__default.forwardRef(
14648
+ var Textarea = React125__default.forwardRef(
14602
14649
  ({ className, error, ...props }, ref) => {
14603
14650
  return /* @__PURE__ */ jsx(
14604
14651
  "textarea",
@@ -14624,7 +14671,7 @@ Textarea.displayName = "Textarea";
14624
14671
 
14625
14672
  // components/atoms/Select.tsx
14626
14673
  init_cn();
14627
- var Select = React124__default.forwardRef(
14674
+ var Select = React125__default.forwardRef(
14628
14675
  ({ className, options, placeholder, error, ...props }, ref) => {
14629
14676
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
14630
14677
  /* @__PURE__ */ jsxs(
@@ -14663,7 +14710,7 @@ Select.displayName = "Select";
14663
14710
 
14664
14711
  // components/atoms/Checkbox.tsx
14665
14712
  init_cn();
14666
- var Checkbox = React124__default.forwardRef(
14713
+ var Checkbox = React125__default.forwardRef(
14667
14714
  ({ className, label, id, ...props }, ref) => {
14668
14715
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
14669
14716
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -14742,7 +14789,7 @@ var shadowStyles2 = {
14742
14789
  md: "shadow",
14743
14790
  lg: "shadow-lg"
14744
14791
  };
14745
- var Card = React124__default.forwardRef(
14792
+ var Card = React125__default.forwardRef(
14746
14793
  ({
14747
14794
  className,
14748
14795
  variant = "bordered",
@@ -14778,9 +14825,9 @@ var Card = React124__default.forwardRef(
14778
14825
  }
14779
14826
  );
14780
14827
  Card.displayName = "Card";
14781
- var CardHeader = React124__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
14828
+ var CardHeader = React125__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
14782
14829
  CardHeader.displayName = "CardHeader";
14783
- var CardTitle = React124__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
14830
+ var CardTitle = React125__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
14784
14831
  "h3",
14785
14832
  {
14786
14833
  ref,
@@ -14793,11 +14840,11 @@ var CardTitle = React124__default.forwardRef(({ className, ...props }, ref) => /
14793
14840
  }
14794
14841
  ));
14795
14842
  CardTitle.displayName = "CardTitle";
14796
- var CardContent = React124__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
14843
+ var CardContent = React125__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
14797
14844
  CardContent.displayName = "CardContent";
14798
14845
  var CardBody = CardContent;
14799
14846
  CardBody.displayName = "CardBody";
14800
- var CardFooter = React124__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
14847
+ var CardFooter = React125__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
14801
14848
  "div",
14802
14849
  {
14803
14850
  ref,
@@ -14815,7 +14862,7 @@ var sizeStyles4 = {
14815
14862
  md: "h-6 w-6",
14816
14863
  lg: "h-8 w-8"
14817
14864
  };
14818
- var Spinner = React124__default.forwardRef(
14865
+ var Spinner = React125__default.forwardRef(
14819
14866
  ({ className, size = "md", ...props }, ref) => {
14820
14867
  return /* @__PURE__ */ jsx(
14821
14868
  "div",
@@ -15250,7 +15297,7 @@ ProgressBar.displayName = "ProgressBar";
15250
15297
 
15251
15298
  // components/atoms/Radio.tsx
15252
15299
  init_cn();
15253
- var Radio = React124__default.forwardRef(
15300
+ var Radio = React125__default.forwardRef(
15254
15301
  ({
15255
15302
  label,
15256
15303
  helperText,
@@ -15357,7 +15404,7 @@ Radio.displayName = "Radio";
15357
15404
 
15358
15405
  // components/atoms/Switch.tsx
15359
15406
  init_cn();
15360
- var Switch = React124.forwardRef(
15407
+ var Switch = React125.forwardRef(
15361
15408
  ({
15362
15409
  checked,
15363
15410
  defaultChecked = false,
@@ -15368,10 +15415,10 @@ var Switch = React124.forwardRef(
15368
15415
  name,
15369
15416
  className
15370
15417
  }, ref) => {
15371
- const [isChecked, setIsChecked] = React124.useState(
15418
+ const [isChecked, setIsChecked] = React125.useState(
15372
15419
  checked !== void 0 ? checked : defaultChecked
15373
15420
  );
15374
- React124.useEffect(() => {
15421
+ React125.useEffect(() => {
15375
15422
  if (checked !== void 0) {
15376
15423
  setIsChecked(checked);
15377
15424
  }
@@ -15687,8 +15734,8 @@ var LawReferenceTooltip = ({
15687
15734
  position = "top",
15688
15735
  className
15689
15736
  }) => {
15690
- const [isVisible, setIsVisible] = React124__default.useState(false);
15691
- const timeoutRef = React124__default.useRef(null);
15737
+ const [isVisible, setIsVisible] = React125__default.useState(false);
15738
+ const timeoutRef = React125__default.useRef(null);
15692
15739
  const handleMouseEnter = () => {
15693
15740
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
15694
15741
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -15697,7 +15744,7 @@ var LawReferenceTooltip = ({
15697
15744
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
15698
15745
  setIsVisible(false);
15699
15746
  };
15700
- React124__default.useEffect(() => {
15747
+ React125__default.useEffect(() => {
15701
15748
  return () => {
15702
15749
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
15703
15750
  };
@@ -15897,7 +15944,7 @@ var sizeStyles5 = {
15897
15944
  md: "w-2.5 h-2.5",
15898
15945
  lg: "w-3 h-3"
15899
15946
  };
15900
- var StatusDot = React124__default.forwardRef(
15947
+ var StatusDot = React125__default.forwardRef(
15901
15948
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
15902
15949
  return /* @__PURE__ */ jsx(
15903
15950
  "span",
@@ -15947,7 +15994,7 @@ var iconMap2 = {
15947
15994
  down: TrendingDown,
15948
15995
  flat: ArrowRight
15949
15996
  };
15950
- var TrendIndicator = React124__default.forwardRef(
15997
+ var TrendIndicator = React125__default.forwardRef(
15951
15998
  ({
15952
15999
  className,
15953
16000
  value,
@@ -16010,7 +16057,7 @@ var thumbSizes = {
16010
16057
  md: "w-4 h-4",
16011
16058
  lg: "w-5 h-5"
16012
16059
  };
16013
- var RangeSlider = React124__default.forwardRef(
16060
+ var RangeSlider = React125__default.forwardRef(
16014
16061
  ({
16015
16062
  className,
16016
16063
  min = 0,
@@ -16524,7 +16571,7 @@ var paddingClasses = {
16524
16571
  md: "py-16",
16525
16572
  lg: "py-24"
16526
16573
  };
16527
- var ContentSection = React124__default.forwardRef(
16574
+ var ContentSection = React125__default.forwardRef(
16528
16575
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
16529
16576
  return /* @__PURE__ */ jsx(
16530
16577
  Box,
@@ -16566,7 +16613,7 @@ var animatedStyles = {
16566
16613
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
16567
16614
  "none": {}
16568
16615
  };
16569
- var AnimatedReveal = React124__default.forwardRef(
16616
+ var AnimatedReveal = React125__default.forwardRef(
16570
16617
  ({
16571
16618
  trigger = "scroll",
16572
16619
  animation = "fade-up",
@@ -16722,7 +16769,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
16722
16769
  el.style.opacity = animate ? "1" : "0";
16723
16770
  });
16724
16771
  }
16725
- var AnimatedGraphic = React124__default.forwardRef(
16772
+ var AnimatedGraphic = React125__default.forwardRef(
16726
16773
  ({
16727
16774
  src,
16728
16775
  svgContent,
@@ -16745,7 +16792,7 @@ var AnimatedGraphic = React124__default.forwardRef(
16745
16792
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
16746
16793
  const resolvedSvg = svgContent ?? fetchedSvg;
16747
16794
  const prevAnimateRef = useRef(animate);
16748
- const setRef = React124__default.useCallback(
16795
+ const setRef = React125__default.useCallback(
16749
16796
  (node) => {
16750
16797
  containerRef.current = node;
16751
16798
  if (typeof ref === "function") ref(node);
@@ -16922,9 +16969,9 @@ function ScoreDisplay({
16922
16969
  ...rest
16923
16970
  }) {
16924
16971
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
16925
- const [displayValue, setDisplayValue] = React124.useState(resolvedValue);
16926
- const [isAnimating, setIsAnimating] = React124.useState(false);
16927
- React124.useEffect(() => {
16972
+ const [displayValue, setDisplayValue] = React125.useState(resolvedValue);
16973
+ const [isAnimating, setIsAnimating] = React125.useState(false);
16974
+ React125.useEffect(() => {
16928
16975
  if (!animated || displayValue === resolvedValue) {
16929
16976
  setDisplayValue(resolvedValue);
16930
16977
  return;
@@ -16982,9 +17029,9 @@ var shapeMap = {
16982
17029
  square: "rounded-md"
16983
17030
  };
16984
17031
  var variantMap = {
16985
- primary: "bg-blue-600 text-white border-blue-400 hover:bg-blue-500",
16986
- secondary: "bg-gray-700 text-white border-gray-500 hover:bg-gray-600",
16987
- ghost: "bg-transparent text-white border-white/30 hover:bg-white/10"
17032
+ primary: "bg-blue-600 text-[var(--color-foreground)] border-blue-400 hover:bg-blue-500",
17033
+ secondary: "bg-[var(--color-surface,#374151)] text-[var(--color-foreground)] border-gray-500 hover:bg-gray-600",
17034
+ ghost: "bg-transparent text-[var(--color-foreground)] border-white/30 hover:bg-white/10"
16988
17035
  };
16989
17036
  function ControlButton({
16990
17037
  label,
@@ -17001,9 +17048,9 @@ function ControlButton({
17001
17048
  className
17002
17049
  }) {
17003
17050
  const eventBus = useEventBus();
17004
- const [isPressed, setIsPressed] = React124.useState(false);
17051
+ const [isPressed, setIsPressed] = React125.useState(false);
17005
17052
  const actualPressed = pressed ?? isPressed;
17006
- const handlePointerDown = React124.useCallback(
17053
+ const handlePointerDown = React125.useCallback(
17007
17054
  (e) => {
17008
17055
  e.preventDefault();
17009
17056
  if (disabled) return;
@@ -17013,7 +17060,7 @@ function ControlButton({
17013
17060
  },
17014
17061
  [disabled, pressEvent, eventBus, onPress]
17015
17062
  );
17016
- const handlePointerUp = React124.useCallback(
17063
+ const handlePointerUp = React125.useCallback(
17017
17064
  (e) => {
17018
17065
  e.preventDefault();
17019
17066
  if (disabled) return;
@@ -17023,7 +17070,7 @@ function ControlButton({
17023
17070
  },
17024
17071
  [disabled, releaseEvent, eventBus, onRelease]
17025
17072
  );
17026
- const handlePointerLeave = React124.useCallback(
17073
+ const handlePointerLeave = React125.useCallback(
17027
17074
  (e) => {
17028
17075
  if (isPressed) {
17029
17076
  setIsPressed(false);
@@ -17223,11 +17270,11 @@ function TimerDisplay({
17223
17270
  {
17224
17271
  className: cn(
17225
17272
  "inline-flex items-center justify-center rounded-lg",
17226
- "bg-gray-800/80 border border-gray-600 font-mono font-bold tabular-nums",
17273
+ "bg-[var(--color-card)]/80 border border-gray-600 font-mono font-bold tabular-nums",
17227
17274
  sizeMap4[size],
17228
17275
  running && "border-green-500/50",
17229
17276
  isLow && "text-red-400 border-red-500/50 animate-pulse",
17230
- !isLow && "text-white",
17277
+ !isLow && "text-[var(--color-foreground)]",
17231
17278
  className
17232
17279
  ),
17233
17280
  children: formatTime(seconds, format)
@@ -17258,7 +17305,7 @@ function ResourceCounter({
17258
17305
  {
17259
17306
  className: cn(
17260
17307
  "inline-flex items-center rounded-md",
17261
- "bg-gray-800/80 border border-gray-600 font-medium text-white",
17308
+ "bg-[var(--color-card)]/80 border border-gray-600 font-medium text-[var(--color-foreground)]",
17262
17309
  sizes.wrapper,
17263
17310
  className
17264
17311
  ),
@@ -17320,9 +17367,9 @@ function ItemSlot({
17320
17367
  title: label,
17321
17368
  className: cn(
17322
17369
  "relative flex items-center justify-center rounded-lg border-2",
17323
- "bg-gray-800/80 transition-all duration-150",
17370
+ "bg-[var(--color-card)]/80 transition-all duration-150",
17324
17371
  sizeMap6[size],
17325
- empty ? "border-gray-700 bg-gray-900/50" : rarityBorderMap[rarity],
17372
+ empty ? "border-gray-700 bg-[var(--color-card)]/50" : rarityBorderMap[rarity],
17326
17373
  !empty && rarityGlowMap[rarity],
17327
17374
  selected && "ring-2 ring-white ring-offset-1 ring-offset-gray-900",
17328
17375
  isClickable && !empty && "hover:brightness-125 cursor-pointer",
@@ -17338,7 +17385,7 @@ function ItemSlot({
17338
17385
  className: cn(
17339
17386
  "absolute -bottom-1 -right-1 flex items-center justify-center",
17340
17387
  "min-w-[18px] h-[18px] rounded-full px-1",
17341
- "bg-gray-700 border border-gray-500 text-[10px] font-bold text-white"
17388
+ "bg-[var(--color-surface,#374151)] border border-gray-500 text-[10px] font-bold text-[var(--color-foreground)]"
17342
17389
  ),
17343
17390
  children: quantity
17344
17391
  }
@@ -17370,7 +17417,7 @@ function TurnIndicator({
17370
17417
  {
17371
17418
  className: cn(
17372
17419
  "inline-flex items-center rounded-lg",
17373
- "bg-gray-800/80 border border-gray-600 font-medium text-white",
17420
+ "bg-[var(--color-card)]/80 border border-gray-600 font-medium text-[var(--color-foreground)]",
17374
17421
  sizes.wrapper,
17375
17422
  className
17376
17423
  ),
@@ -17409,7 +17456,7 @@ function getComboIntensity(combo) {
17409
17456
  if (combo >= 10) return "text-red-400 animate-pulse";
17410
17457
  if (combo >= 7) return "text-orange-400";
17411
17458
  if (combo >= 4) return "text-yellow-400";
17412
- return "text-white";
17459
+ return "text-[var(--color-foreground)]";
17413
17460
  }
17414
17461
  function getComboScale(combo) {
17415
17462
  if (combo >= 10) return "scale-110";
@@ -17430,7 +17477,7 @@ function ComboCounter({
17430
17477
  {
17431
17478
  className: cn(
17432
17479
  "inline-flex flex-col items-center justify-center",
17433
- "rounded-xl bg-gray-800/80 border border-gray-600 px-3 py-1.5",
17480
+ "rounded-xl bg-[var(--color-card)]/80 border border-gray-600 px-3 py-1.5",
17434
17481
  "transition-transform duration-200",
17435
17482
  getComboScale(combo),
17436
17483
  className
@@ -17640,7 +17687,7 @@ function StatusEffect({
17640
17687
  "span",
17641
17688
  {
17642
17689
  className: cn(
17643
- "absolute flex items-center justify-center rounded-full bg-white text-black font-bold leading-none",
17690
+ "absolute flex items-center justify-center rounded-full bg-[var(--color-card)] text-[var(--color-foreground)] font-bold leading-none",
17644
17691
  sizes.badge
17645
17692
  ),
17646
17693
  children: stacks
@@ -17725,7 +17772,7 @@ function DialogueBubble({
17725
17772
  ) }),
17726
17773
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 min-w-0", children: [
17727
17774
  speaker && /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-yellow-400", children: speaker }),
17728
- /* @__PURE__ */ jsx("span", { className: "text-sm text-white leading-relaxed", children: text })
17775
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-[var(--color-foreground)] leading-relaxed", children: text })
17729
17776
  ] })
17730
17777
  ]
17731
17778
  }
@@ -17752,7 +17799,7 @@ function ChoiceButton({
17752
17799
  className: cn(
17753
17800
  "w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
17754
17801
  "flex items-center gap-2",
17755
- 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",
17802
+ 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",
17756
17803
  disabled && "opacity-40 cursor-not-allowed hover:bg-white/5 hover:border-white/10",
17757
17804
  className
17758
17805
  ),
@@ -17811,7 +17858,7 @@ function ActionButton({
17811
17858
  disabled: isDisabled,
17812
17859
  onClick,
17813
17860
  className: cn(
17814
- "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-white overflow-hidden transition-colors duration-150",
17861
+ "relative inline-flex items-center gap-1.5 rounded-md border font-medium text-[var(--color-foreground)] overflow-hidden transition-colors duration-150",
17815
17862
  sizes.button,
17816
17863
  variantStyles7[variant],
17817
17864
  isDisabled && "opacity-60 cursor-not-allowed",
@@ -17859,9 +17906,9 @@ function MiniMap({
17859
17906
  viewportRect,
17860
17907
  className
17861
17908
  }) {
17862
- const canvasRef = React124.useRef(null);
17863
- const frameRef = React124.useRef(0);
17864
- React124.useEffect(() => {
17909
+ const canvasRef = React125.useRef(null);
17910
+ const frameRef = React125.useRef(0);
17911
+ React125.useEffect(() => {
17865
17912
  const canvas = canvasRef.current;
17866
17913
  if (!canvas) return;
17867
17914
  const ctx = canvas.getContext("2d");
@@ -18097,7 +18144,7 @@ var ErrorState = ({
18097
18144
  );
18098
18145
  };
18099
18146
  ErrorState.displayName = "ErrorState";
18100
- var ErrorBoundary = class extends React124__default.Component {
18147
+ var ErrorBoundary = class extends React125__default.Component {
18101
18148
  constructor(props) {
18102
18149
  super(props);
18103
18150
  __publicField(this, "reset", () => {
@@ -18500,8 +18547,8 @@ var Tooltip = ({
18500
18547
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
18501
18548
  };
18502
18549
  }, []);
18503
- const triggerElement = React124__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
18504
- const trigger = React124__default.cloneElement(triggerElement, {
18550
+ const triggerElement = React125__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
18551
+ const trigger = React125__default.cloneElement(triggerElement, {
18505
18552
  ref: triggerRef,
18506
18553
  onMouseEnter: handleMouseEnter,
18507
18554
  onMouseLeave: handleMouseLeave,
@@ -18618,8 +18665,8 @@ var Popover = ({
18618
18665
  onMouseEnter: handleOpen,
18619
18666
  onMouseLeave: handleClose
18620
18667
  };
18621
- const childElement = React124__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
18622
- const triggerElement = React124__default.cloneElement(
18668
+ const childElement = React125__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
18669
+ const triggerElement = React125__default.cloneElement(
18623
18670
  childElement,
18624
18671
  {
18625
18672
  ref: triggerRef,
@@ -18726,8 +18773,8 @@ var Menu = ({
18726
18773
  "bottom-start": "top-full left-0 mt-2",
18727
18774
  "bottom-end": "top-full right-0 mt-2"
18728
18775
  };
18729
- const triggerChild = React124__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
18730
- const triggerElement = React124__default.cloneElement(
18776
+ const triggerChild = React125__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
18777
+ const triggerElement = React125__default.cloneElement(
18731
18778
  triggerChild,
18732
18779
  {
18733
18780
  ref: triggerRef,
@@ -19447,7 +19494,7 @@ function InputPattern({
19447
19494
  className
19448
19495
  }) {
19449
19496
  const { emit } = useEventBus();
19450
- const [localValue, setLocalValue] = React124__default.useState(value);
19497
+ const [localValue, setLocalValue] = React125__default.useState(value);
19451
19498
  const handleChange = (e) => {
19452
19499
  setLocalValue(e.target.value);
19453
19500
  if (onChange) {
@@ -19484,7 +19531,7 @@ function TextareaPattern({
19484
19531
  className
19485
19532
  }) {
19486
19533
  const { emit } = useEventBus();
19487
- const [localValue, setLocalValue] = React124__default.useState(value);
19534
+ const [localValue, setLocalValue] = React125__default.useState(value);
19488
19535
  const handleChange = (e) => {
19489
19536
  setLocalValue(e.target.value);
19490
19537
  if (onChange) {
@@ -19515,7 +19562,7 @@ function SelectPattern({
19515
19562
  className
19516
19563
  }) {
19517
19564
  const { emit } = useEventBus();
19518
- const [localValue, setLocalValue] = React124__default.useState(value);
19565
+ const [localValue, setLocalValue] = React125__default.useState(value);
19519
19566
  const handleChange = (e) => {
19520
19567
  setLocalValue(e.target.value);
19521
19568
  if (onChange) {
@@ -19544,7 +19591,7 @@ function CheckboxPattern({
19544
19591
  className
19545
19592
  }) {
19546
19593
  const { emit } = useEventBus();
19547
- const [localChecked, setLocalChecked] = React124__default.useState(checked);
19594
+ const [localChecked, setLocalChecked] = React125__default.useState(checked);
19548
19595
  const handleChange = (e) => {
19549
19596
  setLocalChecked(e.target.checked);
19550
19597
  if (onChange) {
@@ -19749,8 +19796,8 @@ function ActionButtons({
19749
19796
  disabled
19750
19797
  }) {
19751
19798
  const eventBus = useEventBus();
19752
- const [activeButtons, setActiveButtons] = React124.useState(/* @__PURE__ */ new Set());
19753
- const handlePress = React124.useCallback(
19799
+ const [activeButtons, setActiveButtons] = React125.useState(/* @__PURE__ */ new Set());
19800
+ const handlePress = React125.useCallback(
19754
19801
  (id) => {
19755
19802
  setActiveButtons((prev) => new Set(prev).add(id));
19756
19803
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -19758,7 +19805,7 @@ function ActionButtons({
19758
19805
  },
19759
19806
  [actionEvent, eventBus, onAction]
19760
19807
  );
19761
- const handleRelease = React124.useCallback(
19808
+ const handleRelease = React125.useCallback(
19762
19809
  (id) => {
19763
19810
  setActiveButtons((prev) => {
19764
19811
  const next = new Set(prev);
@@ -19955,11 +20002,11 @@ var AuthLayout = ({
19955
20002
  children: [
19956
20003
  /* @__PURE__ */ jsx(Box, { className: "absolute inset-0 bg-gradient-to-br from-primary-600/90 to-primary-800/90" }),
19957
20004
  /* @__PURE__ */ jsx(Box, { className: "relative z-10", children: /* @__PURE__ */ jsxs(Link, { to: "/", className: "flex items-center gap-3", children: [
19958
- logo || /* @__PURE__ */ jsx(Box, { className: "w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur", children: /* @__PURE__ */ jsx(
20005
+ logo || /* @__PURE__ */ jsx(Box, { className: "w-10 h-10 bg-[var(--color-card)]/20 rounded-xl flex items-center justify-center backdrop-blur", children: /* @__PURE__ */ jsx(
19959
20006
  Typography,
19960
20007
  {
19961
20008
  variant: "body1",
19962
- className: "text-white font-bold text-lg",
20009
+ className: "text-[var(--color-foreground)] font-bold text-lg",
19963
20010
  children: appName.charAt(0).toUpperCase()
19964
20011
  }
19965
20012
  ) }),
@@ -19967,7 +20014,7 @@ var AuthLayout = ({
19967
20014
  Typography,
19968
20015
  {
19969
20016
  variant: "body1",
19970
- className: "text-2xl font-bold text-white",
20017
+ className: "text-2xl font-bold text-[var(--color-foreground)]",
19971
20018
  children: appName
19972
20019
  }
19973
20020
  )
@@ -19977,7 +20024,7 @@ var AuthLayout = ({
19977
20024
  Typography,
19978
20025
  {
19979
20026
  variant: "h1",
19980
- className: "text-4xl font-bold text-white leading-tight",
20027
+ className: "text-4xl font-bold text-[var(--color-foreground)] leading-tight",
19981
20028
  children: [
19982
20029
  "Welcome to ",
19983
20030
  appName
@@ -19988,27 +20035,27 @@ var AuthLayout = ({
19988
20035
  Typography,
19989
20036
  {
19990
20037
  variant: "body1",
19991
- className: "text-lg text-white/80 max-w-md",
20038
+ className: "text-lg text-[var(--color-foreground)]/80 max-w-md",
19992
20039
  children: "Sign in to access your dashboard and manage your account."
19993
20040
  }
19994
20041
  ),
19995
- /* @__PURE__ */ jsxs(Box, { className: "mt-12 p-6 bg-white/10 rounded-xl backdrop-blur", children: [
20042
+ /* @__PURE__ */ jsxs(Box, { className: "mt-12 p-6 bg-[var(--color-card)]/10 rounded-xl backdrop-blur", children: [
19996
20043
  /* @__PURE__ */ jsx(
19997
20044
  Typography,
19998
20045
  {
19999
20046
  variant: "body1",
20000
- className: "text-white/90 italic",
20047
+ className: "text-[var(--color-foreground)]/90 italic",
20001
20048
  children: '"This platform has transformed how we work. Highly recommended!"'
20002
20049
  }
20003
20050
  ),
20004
20051
  /* @__PURE__ */ jsxs(HStack, { className: "mt-4", gap: "sm", align: "center", children: [
20005
- /* @__PURE__ */ jsx(Box, { className: "w-10 h-10 bg-white/20 rounded-full" }),
20052
+ /* @__PURE__ */ jsx(Box, { className: "w-10 h-10 bg-[var(--color-card)]/20 rounded-full" }),
20006
20053
  /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
20007
20054
  /* @__PURE__ */ jsx(
20008
20055
  Typography,
20009
20056
  {
20010
20057
  variant: "body1",
20011
- className: "text-white font-medium",
20058
+ className: "text-[var(--color-foreground)] font-medium",
20012
20059
  children: "Jane Doe"
20013
20060
  }
20014
20061
  ),
@@ -20016,7 +20063,7 @@ var AuthLayout = ({
20016
20063
  Typography,
20017
20064
  {
20018
20065
  variant: "body1",
20019
- className: "text-white/60 text-sm",
20066
+ className: "text-[var(--color-foreground)]/60 text-sm",
20020
20067
  children: "CEO, Example Co."
20021
20068
  }
20022
20069
  )
@@ -20024,8 +20071,8 @@ var AuthLayout = ({
20024
20071
  ] })
20025
20072
  ] })
20026
20073
  ] }) }),
20027
- /* @__PURE__ */ jsx(Box, { className: "absolute -bottom-32 -right-32 w-96 h-96 bg-white/5 rounded-full" }),
20028
- /* @__PURE__ */ jsx(Box, { className: "absolute -top-16 -right-16 w-64 h-64 bg-white/5 rounded-full" })
20074
+ /* @__PURE__ */ jsx(Box, { className: "absolute -bottom-32 -right-32 w-96 h-96 bg-[var(--color-card)]/5 rounded-full" }),
20075
+ /* @__PURE__ */ jsx(Box, { className: "absolute -top-16 -right-16 w-64 h-64 bg-[var(--color-card)]/5 rounded-full" })
20029
20076
  ]
20030
20077
  }
20031
20078
  ),
@@ -20042,7 +20089,7 @@ var AuthLayout = ({
20042
20089
  Typography,
20043
20090
  {
20044
20091
  variant: "body1",
20045
- className: "text-white font-bold text-xl",
20092
+ className: "text-[var(--color-foreground)] font-bold text-xl",
20046
20093
  children: appName.charAt(0).toUpperCase()
20047
20094
  }
20048
20095
  ) }),
@@ -21148,7 +21195,7 @@ function IsometricCanvas({
21148
21195
  className: cn("relative w-full overflow-hidden rounded-lg", className),
21149
21196
  style: { height: viewportSize.height },
21150
21197
  "data-testid": "game-canvas-empty",
21151
- children: /* @__PURE__ */ jsx(Box, { className: "flex items-center justify-center h-full bg-slate-800 rounded-lg", children: /* @__PURE__ */ jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
21198
+ children: /* @__PURE__ */ jsx(Box, { className: "flex items-center justify-center h-full bg-[var(--color-card)] rounded-lg", children: /* @__PURE__ */ jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
21152
21199
  /* @__PURE__ */ jsx(Icon, { name: "map", size: "xl" }),
21153
21200
  /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-slate-400", children: t("canvas.emptyMessage") || "No map data loaded" })
21154
21201
  ] }) })
@@ -21680,7 +21727,7 @@ ScaledDiagram.displayName = "ScaledDiagram";
21680
21727
  init_Stack();
21681
21728
  init_Box();
21682
21729
  init_cn();
21683
- var MarkdownContent = React124__default.memo(
21730
+ var MarkdownContent = React125__default.memo(
21684
21731
  ({ content, direction, className }) => {
21685
21732
  const { t: _t } = useTranslate();
21686
21733
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -21746,7 +21793,7 @@ var MarkdownContent = React124__default.memo(
21746
21793
  "th",
21747
21794
  {
21748
21795
  ...props,
21749
- className: "border border-gray-300 dark:border-gray-600 bg-gray-100 dark:bg-gray-800 px-4 py-2 text-left font-semibold",
21796
+ className: "border border-gray-300 dark:border-gray-600 bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
21750
21797
  children
21751
21798
  }
21752
21799
  );
@@ -21868,7 +21915,7 @@ function computeFoldRegions(code) {
21868
21915
  }
21869
21916
  var LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
21870
21917
  var HIDDEN_LINE_NUMBERS = { display: "none" };
21871
- var CodeBlock = React124__default.memo(
21918
+ var CodeBlock = React125__default.memo(
21872
21919
  ({
21873
21920
  code: rawCode,
21874
21921
  language = "text",
@@ -22029,7 +22076,7 @@ var CodeBlock = React124__default.memo(
22029
22076
  {
22030
22077
  justify: "between",
22031
22078
  align: "center",
22032
- className: "px-3 py-2 bg-gray-800 rounded-t-lg border-b border-gray-700",
22079
+ className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
22033
22080
  children: [
22034
22081
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
22035
22082
  showCopyButton && /* @__PURE__ */ jsx(
@@ -22987,7 +23034,7 @@ var StateMachineView = ({
22987
23034
  style: { top: title ? 30 : 0 },
22988
23035
  children: [
22989
23036
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
22990
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React124__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
23037
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React125__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
22991
23038
  StateNode,
22992
23039
  {
22993
23040
  state,
@@ -28513,7 +28560,7 @@ function CraftingRecipe({
28513
28560
  className
28514
28561
  }) {
28515
28562
  const eventBus = useEventBus();
28516
- const handleCraft = React124.useCallback(() => {
28563
+ const handleCraft = React125.useCallback(() => {
28517
28564
  onCraft?.();
28518
28565
  if (craftEvent) {
28519
28566
  eventBus.emit(craftEvent, { output: output.label });
@@ -28530,7 +28577,7 @@ function CraftingRecipe({
28530
28577
  children: [
28531
28578
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
28532
28579
  const hasSufficient = ingredient.available >= ingredient.required;
28533
- return /* @__PURE__ */ jsxs(React124.Fragment, { children: [
28580
+ return /* @__PURE__ */ jsxs(React125.Fragment, { children: [
28534
28581
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
28535
28582
  ItemSlot,
28536
28583
  {
@@ -28819,8 +28866,8 @@ function DPad({
28819
28866
  }) {
28820
28867
  const eventBus = useEventBus();
28821
28868
  const sizes = sizeMap15[size];
28822
- const [activeDirections, setActiveDirections] = React124.useState(/* @__PURE__ */ new Set());
28823
- const handlePress = React124.useCallback(
28869
+ const [activeDirections, setActiveDirections] = React125.useState(/* @__PURE__ */ new Set());
28870
+ const handlePress = React125.useCallback(
28824
28871
  (direction) => {
28825
28872
  setActiveDirections((prev) => new Set(prev).add(direction));
28826
28873
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -28828,7 +28875,7 @@ function DPad({
28828
28875
  },
28829
28876
  [directionEvent, eventBus, onDirection]
28830
28877
  );
28831
- const handleRelease = React124.useCallback(
28878
+ const handleRelease = React125.useCallback(
28832
28879
  (direction) => {
28833
28880
  setActiveDirections((prev) => {
28834
28881
  const next = new Set(prev);
@@ -29639,7 +29686,7 @@ var DataList = ({
29639
29686
  }) => {
29640
29687
  const eventBus = useEventBus();
29641
29688
  const { t } = useTranslate();
29642
- const [visibleCount, setVisibleCount] = React124__default.useState(pageSize || Infinity);
29689
+ const [visibleCount, setVisibleCount] = React125__default.useState(pageSize || Infinity);
29643
29690
  const fields = fieldsProp ?? columnsProp ?? [];
29644
29691
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
29645
29692
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -29676,7 +29723,7 @@ var DataList = ({
29676
29723
  const items2 = data.map((item) => item);
29677
29724
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
29678
29725
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
29679
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
29726
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
29680
29727
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
29681
29728
  group.items.map((itemData, index) => {
29682
29729
  const id = itemData.id || `${gi}-${index}`;
@@ -29879,7 +29926,7 @@ var DataList = ({
29879
29926
  className
29880
29927
  ),
29881
29928
  children: [
29882
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
29929
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
29883
29930
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
29884
29931
  group.items.map(
29885
29932
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -30946,7 +30993,7 @@ var WizardProgress = ({
30946
30993
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
30947
30994
  const isActive = index === currentStep;
30948
30995
  const isCompleted = index < currentStep;
30949
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
30996
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
30950
30997
  /* @__PURE__ */ jsx(
30951
30998
  "button",
30952
30999
  {
@@ -31722,7 +31769,7 @@ var sizeMap17 = {
31722
31769
  lg: "text-base px-4 py-2"
31723
31770
  };
31724
31771
  var variantMap2 = {
31725
- default: "bg-gray-800/80 border-gray-700",
31772
+ default: "bg-[var(--color-card)]/80 border-gray-700",
31726
31773
  primary: "bg-blue-900/80 border-blue-700",
31727
31774
  success: "bg-green-900/80 border-green-700",
31728
31775
  warning: "bg-yellow-900/80 border-yellow-700",
@@ -31783,7 +31830,7 @@ function StatBadge({
31783
31830
  animated: true
31784
31831
  }
31785
31832
  ),
31786
- format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: value })
31833
+ format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-[var(--color-foreground)]", children: value })
31787
31834
  ]
31788
31835
  }
31789
31836
  );
@@ -31816,7 +31863,7 @@ function InventoryGrid({
31816
31863
  const eventBus = useEventBus();
31817
31864
  const slotCount = totalSlots ?? items.length;
31818
31865
  const emptySlotCount = Math.max(0, slotCount - items.length);
31819
- const handleSelect = React124.useCallback(
31866
+ const handleSelect = React125.useCallback(
31820
31867
  (id) => {
31821
31868
  onSelect?.(id);
31822
31869
  if (selectEvent) {
@@ -32005,15 +32052,15 @@ function GameCanvas2D({
32005
32052
  fps = 60,
32006
32053
  className
32007
32054
  }) {
32008
- const canvasRef = React124.useRef(null);
32009
- const rafRef = React124.useRef(0);
32010
- const frameRef = React124.useRef(0);
32011
- const lastTimeRef = React124.useRef(0);
32012
- const onDrawRef = React124.useRef(onDraw);
32055
+ const canvasRef = React125.useRef(null);
32056
+ const rafRef = React125.useRef(0);
32057
+ const frameRef = React125.useRef(0);
32058
+ const lastTimeRef = React125.useRef(0);
32059
+ const onDrawRef = React125.useRef(onDraw);
32013
32060
  onDrawRef.current = onDraw;
32014
- const onTickRef = React124.useRef(onTick);
32061
+ const onTickRef = React125.useRef(onTick);
32015
32062
  onTickRef.current = onTick;
32016
- React124.useEffect(() => {
32063
+ React125.useEffect(() => {
32017
32064
  const canvas = canvasRef.current;
32018
32065
  if (!canvas) return;
32019
32066
  const ctx = canvas.getContext("2d");
@@ -32082,7 +32129,7 @@ function HealthPanel({
32082
32129
  Box,
32083
32130
  {
32084
32131
  className: cn(
32085
- "rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm",
32132
+ "rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm",
32086
32133
  sizes.padding,
32087
32134
  className
32088
32135
  ),
@@ -32188,7 +32235,7 @@ function ScoreBoard({
32188
32235
  Card,
32189
32236
  {
32190
32237
  className: cn(
32191
- "bg-gray-900/90 border-gray-700 backdrop-blur-sm",
32238
+ "bg-[var(--color-card)]/90 border-gray-700 backdrop-blur-sm",
32192
32239
  className
32193
32240
  ),
32194
32241
  children: /* @__PURE__ */ jsx(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-3 flex-wrap", children: [
@@ -32284,7 +32331,7 @@ function TurnPanel({
32284
32331
  className
32285
32332
  }) {
32286
32333
  const eventBus = useEventBus();
32287
- const handleAction = React124.useCallback(
32334
+ const handleAction = React125.useCallback(
32288
32335
  (event) => {
32289
32336
  if (event) {
32290
32337
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -32296,7 +32343,7 @@ function TurnPanel({
32296
32343
  Box,
32297
32344
  {
32298
32345
  className: cn(
32299
- "flex items-center gap-3 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-3 py-2",
32346
+ "flex items-center gap-3 rounded-lg bg-[var(--color-card)]/90 border border-gray-700 backdrop-blur-sm px-3 py-2",
32300
32347
  className
32301
32348
  ),
32302
32349
  children: [
@@ -32348,7 +32395,7 @@ function EnemyPlate({
32348
32395
  Box,
32349
32396
  {
32350
32397
  className: cn(
32351
- "inline-flex flex-col gap-1 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-3 py-1.5",
32398
+ "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",
32352
32399
  "min-w-[120px]",
32353
32400
  className
32354
32401
  ),
@@ -32359,7 +32406,7 @@ function EnemyPlate({
32359
32406
  {
32360
32407
  variant: "caption",
32361
32408
  weight: "bold",
32362
- className: "text-white truncate",
32409
+ className: "text-[var(--color-foreground)] truncate",
32363
32410
  children: name
32364
32411
  }
32365
32412
  ),
@@ -32420,7 +32467,7 @@ function UnitCommandBar({
32420
32467
  className
32421
32468
  }) {
32422
32469
  const eventBus = useEventBus();
32423
- const handleCommand = React124.useCallback(
32470
+ const handleCommand = React125.useCallback(
32424
32471
  (event) => {
32425
32472
  if (event) {
32426
32473
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -32432,7 +32479,7 @@ function UnitCommandBar({
32432
32479
  Box,
32433
32480
  {
32434
32481
  className: cn(
32435
- "flex items-center gap-1.5 rounded-lg bg-gray-900/90 border border-gray-700 backdrop-blur-sm px-2 py-1.5",
32482
+ "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",
32436
32483
  className
32437
32484
  ),
32438
32485
  children: commands.map((command, i) => /* @__PURE__ */ jsxs(Box, { className: "flex flex-col items-center gap-0.5", children: [
@@ -32666,7 +32713,7 @@ function DialogueBox({
32666
32713
  tabIndex: 0,
32667
32714
  role: "dialog",
32668
32715
  "aria-label": "Dialogue",
32669
- children: /* @__PURE__ */ jsx("div", { className: "mx-4 my-4 bg-gray-900 bg-opacity-95 border-2 border-gray-600 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
32716
+ children: /* @__PURE__ */ 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__ */ jsxs("div", { className: "flex", children: [
32670
32717
  dialogue.portrait && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 p-4 border-r border-gray-700", children: /* @__PURE__ */ jsx(
32671
32718
  "img",
32672
32719
  {
@@ -32678,7 +32725,7 @@ function DialogueBox({
32678
32725
  ) }),
32679
32726
  /* @__PURE__ */ jsxs("div", { className: "flex-1 p-4", children: [
32680
32727
  /* @__PURE__ */ jsx("div", { className: "text-yellow-400 font-bold mb-2", children: dialogue.speaker }),
32681
- /* @__PURE__ */ jsxs("div", { className: "text-white text-lg leading-relaxed min-h-[60px]", children: [
32728
+ /* @__PURE__ */ jsxs("div", { className: "text-[var(--color-foreground)] text-lg leading-relaxed min-h-[60px]", children: [
32682
32729
  displayedText,
32683
32730
  isTyping && /* @__PURE__ */ jsx("span", { className: "animate-pulse", children: "\u258C" })
32684
32731
  ] }),
@@ -32688,8 +32735,8 @@ function DialogueBox({
32688
32735
  type: "button",
32689
32736
  className: cn(
32690
32737
  "block w-full text-left px-4 py-2 rounded transition-colors",
32691
- "hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-yellow-400",
32692
- selectedChoice === index ? "bg-gray-700 text-yellow-400" : "bg-gray-800 text-white"
32738
+ "hover:bg-[var(--color-surface,#374151)] focus:outline-none focus:ring-2 focus:ring-yellow-400",
32739
+ selectedChoice === index ? "bg-[var(--color-surface,#374151)] text-yellow-400" : "bg-[var(--color-card)] text-[var(--color-foreground)]"
32693
32740
  ),
32694
32741
  onClick: (e) => {
32695
32742
  e.stopPropagation();
@@ -32806,7 +32853,7 @@ function InventoryPanel({
32806
32853
  /* @__PURE__ */ jsx(
32807
32854
  "div",
32808
32855
  {
32809
- className: "grid gap-1 bg-gray-900 p-2 rounded-lg border border-gray-700",
32856
+ className: "grid gap-1 bg-[var(--color-card)] p-2 rounded-lg border border-gray-700",
32810
32857
  style: {
32811
32858
  gridTemplateColumns: `repeat(${safeColumns}, ${slotSize}px)`,
32812
32859
  gridTemplateRows: `repeat(${rows}, ${slotSize}px)`
@@ -32817,9 +32864,9 @@ function InventoryPanel({
32817
32864
  type: "button",
32818
32865
  className: cn(
32819
32866
  "relative flex items-center justify-center",
32820
- "bg-gray-800 border rounded transition-colors",
32821
- "hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",
32822
- selectedSlot === index ? "border-yellow-400 bg-gray-700" : "border-gray-600"
32867
+ "bg-[var(--color-card)] border rounded transition-colors",
32868
+ "hover:bg-[var(--color-surface,#374151)] focus:outline-none focus:ring-2 focus:ring-blue-500",
32869
+ selectedSlot === index ? "border-yellow-400 bg-[var(--color-surface,#374151)]" : "border-gray-600"
32823
32870
  ),
32824
32871
  style: { width: slotSize, height: slotSize },
32825
32872
  onClick: () => handleSlotClick(index),
@@ -32849,14 +32896,14 @@ function InventoryPanel({
32849
32896
  showTooltips && hoveredItem && /* @__PURE__ */ jsxs(
32850
32897
  "div",
32851
32898
  {
32852
- className: "fixed z-50 bg-gray-900 border border-gray-600 rounded-lg p-2 shadow-lg pointer-events-none",
32899
+ className: "fixed z-50 bg-[var(--color-card)] border border-gray-600 rounded-lg p-2 shadow-lg pointer-events-none",
32853
32900
  style: {
32854
32901
  left: tooltipPosition.x,
32855
32902
  top: tooltipPosition.y,
32856
32903
  maxWidth: 200
32857
32904
  },
32858
32905
  children: [
32859
- /* @__PURE__ */ jsx("div", { className: "font-semibold text-white", children: hoveredItem.name || hoveredItem.type }),
32906
+ /* @__PURE__ */ jsx("div", { className: "font-semibold text-[var(--color-foreground)]", children: hoveredItem.name || hoveredItem.type }),
32860
32907
  hoveredItem.description && /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-400 mt-1", children: hoveredItem.description }),
32861
32908
  /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-1", children: [
32862
32909
  "Quantity: ",
@@ -32872,9 +32919,9 @@ function InventoryPanel({
32872
32919
  init_cn();
32873
32920
  init_useEventBus();
32874
32921
  var variantMap3 = {
32875
- primary: "bg-blue-600 hover:bg-blue-500 text-white border-blue-400 shadow-lg shadow-blue-500/25",
32876
- secondary: "bg-gray-700 hover:bg-gray-600 text-white border-gray-500",
32877
- ghost: "bg-transparent hover:bg-white/10 text-white border-white/20"
32922
+ primary: "bg-[var(--color-primary)] hover:bg-blue-500 text-[var(--color-primary-foreground)] border-blue-400 shadow-lg shadow-blue-500/25",
32923
+ secondary: "bg-[var(--color-surface,#374151)] hover:bg-gray-600 text-[var(--color-foreground)] border-gray-500",
32924
+ ghost: "bg-transparent hover:bg-white/10 text-[var(--color-foreground)] border-white/20"
32878
32925
  };
32879
32926
  function GameMenu({
32880
32927
  title,
@@ -32894,7 +32941,7 @@ function GameMenu({
32894
32941
  } catch {
32895
32942
  }
32896
32943
  const eventBus = eventBusProp || eventBusFromHook;
32897
- const handleOptionClick = React124.useCallback(
32944
+ const handleOptionClick = React125.useCallback(
32898
32945
  (option) => {
32899
32946
  if (option.event && eventBus) {
32900
32947
  eventBus.emit(`UI:${option.event}`, { option });
@@ -32931,7 +32978,7 @@ function GameMenu({
32931
32978
  /* @__PURE__ */ jsx(
32932
32979
  "h1",
32933
32980
  {
32934
- className: "text-5xl md:text-7xl font-bold text-white tracking-tight",
32981
+ className: "text-5xl md:text-7xl font-bold text-[var(--color-foreground)] tracking-tight",
32935
32982
  style: {
32936
32983
  textShadow: "0 4px 12px rgba(0,0,0,0.5)"
32937
32984
  },
@@ -32991,9 +33038,9 @@ var variantColors = {
32991
33038
  }
32992
33039
  };
32993
33040
  var buttonVariants = {
32994
- primary: "bg-blue-600 hover:bg-blue-500 text-white border-blue-400",
32995
- secondary: "bg-gray-700 hover:bg-gray-600 text-white border-gray-500",
32996
- ghost: "bg-transparent hover:bg-white/10 text-white border-white/20"
33041
+ primary: "bg-[var(--color-primary)] hover:bg-blue-500 text-[var(--color-primary-foreground)] border-blue-400",
33042
+ secondary: "bg-[var(--color-surface,#374151)] hover:bg-gray-600 text-[var(--color-foreground)] border-gray-500",
33043
+ ghost: "bg-transparent hover:bg-white/10 text-[var(--color-foreground)] border-white/20"
32997
33044
  };
32998
33045
  function formatTime3(ms) {
32999
33046
  const seconds = Math.floor(ms / 1e3);
@@ -33021,7 +33068,7 @@ function GameOverScreen({
33021
33068
  } catch {
33022
33069
  }
33023
33070
  const eventBus = eventBusProp || eventBusFromHook;
33024
- const handleActionClick = React124.useCallback(
33071
+ const handleActionClick = React125.useCallback(
33025
33072
  (action) => {
33026
33073
  if (action.event && eventBus) {
33027
33074
  eventBus.emit(`UI:${action.event}`, { action });
@@ -33074,7 +33121,7 @@ function GameOverScreen({
33074
33121
  }
33075
33122
  return /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
33076
33123
  /* @__PURE__ */ jsx("div", { className: "text-gray-400 text-sm mb-1", children: stat.label }),
33077
- /* @__PURE__ */ jsxs("div", { className: "text-white text-2xl font-bold flex items-center justify-center gap-2", children: [
33124
+ /* @__PURE__ */ jsxs("div", { className: "text-[var(--color-foreground)] text-2xl font-bold flex items-center justify-center gap-2", children: [
33078
33125
  stat.icon && /* @__PURE__ */ jsx("span", { children: stat.icon }),
33079
33126
  /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: displayValue })
33080
33127
  ] })
@@ -34269,7 +34316,7 @@ var Lightbox = ({
34269
34316
  className: cn(
34270
34317
  "absolute top-4 right-4 z-10",
34271
34318
  "p-2 rounded-full",
34272
- "text-white bg-black bg-opacity-50",
34319
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
34273
34320
  "hover:bg-opacity-70 transition-opacity",
34274
34321
  "focus:outline-none focus:ring-2 focus:ring-white"
34275
34322
  ),
@@ -34288,7 +34335,7 @@ var Lightbox = ({
34288
34335
  className: cn(
34289
34336
  "absolute left-4 z-10",
34290
34337
  "p-2 rounded-full",
34291
- "text-white bg-black bg-opacity-50",
34338
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
34292
34339
  "hover:bg-opacity-70 transition-opacity",
34293
34340
  "focus:outline-none focus:ring-2 focus:ring-white"
34294
34341
  ),
@@ -34325,7 +34372,7 @@ var Lightbox = ({
34325
34372
  className: cn(
34326
34373
  "absolute right-4 z-10",
34327
34374
  "p-2 rounded-full",
34328
- "text-white bg-black bg-opacity-50",
34375
+ "text-[var(--color-foreground)] bg-[var(--color-card)]",
34329
34376
  "hover:bg-opacity-70 transition-opacity",
34330
34377
  "focus:outline-none focus:ring-2 focus:ring-white"
34331
34378
  ),
@@ -34334,12 +34381,12 @@ var Lightbox = ({
34334
34381
  }
34335
34382
  ),
34336
34383
  /* @__PURE__ */ jsxs("div", { className: "absolute bottom-4 left-0 right-0 text-center", children: [
34337
- showCounter && safeImages.length > 1 && /* @__PURE__ */ jsxs("div", { className: "text-white text-sm mb-1", children: [
34384
+ showCounter && safeImages.length > 1 && /* @__PURE__ */ jsxs("div", { className: "text-[var(--color-foreground)] text-sm mb-1", children: [
34338
34385
  index + 1,
34339
34386
  " of ",
34340
34387
  safeImages.length
34341
34388
  ] }),
34342
- currentImage?.caption && /* @__PURE__ */ jsx("div", { className: "text-white text-sm opacity-80 px-8", children: currentImage.caption })
34389
+ currentImage?.caption && /* @__PURE__ */ jsx("div", { className: "text-[var(--color-foreground)] text-sm opacity-80 px-8", children: currentImage.caption })
34343
34390
  ] })
34344
34391
  ]
34345
34392
  }
@@ -36426,7 +36473,7 @@ var DocumentViewer = ({
36426
36473
  DocumentViewer.displayName = "DocumentViewer";
36427
36474
  init_useEventBus();
36428
36475
  function extractTitle(children) {
36429
- if (!React124__default.isValidElement(children)) return void 0;
36476
+ if (!React125__default.isValidElement(children)) return void 0;
36430
36477
  const props = children.props;
36431
36478
  if (typeof props.title === "string") {
36432
36479
  return props.title;
@@ -36486,7 +36533,7 @@ function LinearView({
36486
36533
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
36487
36534
  const isDone = i < currentIdx;
36488
36535
  const isCurrent = i === currentIdx;
36489
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
36536
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
36490
36537
  i > 0 && /* @__PURE__ */ jsx(
36491
36538
  Typography,
36492
36539
  {
@@ -37162,7 +37209,7 @@ var Form = ({
37162
37209
  const normalizedInitialData = initialData ?? {};
37163
37210
  const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
37164
37211
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
37165
- const entityDerivedFields = React124__default.useMemo(() => {
37212
+ const entityDerivedFields = React125__default.useMemo(() => {
37166
37213
  if (fields && fields.length > 0) return void 0;
37167
37214
  if (!resolvedEntity) return void 0;
37168
37215
  return resolvedEntity.fields.map(
@@ -37181,14 +37228,14 @@ var Form = ({
37181
37228
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
37182
37229
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
37183
37230
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
37184
- const [formData, setFormData] = React124__default.useState(
37231
+ const [formData, setFormData] = React125__default.useState(
37185
37232
  normalizedInitialData
37186
37233
  );
37187
- const [collapsedSections, setCollapsedSections] = React124__default.useState(
37234
+ const [collapsedSections, setCollapsedSections] = React125__default.useState(
37188
37235
  /* @__PURE__ */ new Set()
37189
37236
  );
37190
37237
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
37191
- const evalContext = React124__default.useMemo(
37238
+ const evalContext = React125__default.useMemo(
37192
37239
  () => ({
37193
37240
  formValues: formData,
37194
37241
  globalVariables: externalContext?.globalVariables ?? {},
@@ -37197,13 +37244,13 @@ var Form = ({
37197
37244
  }),
37198
37245
  [formData, externalContext]
37199
37246
  );
37200
- React124__default.useEffect(() => {
37247
+ React125__default.useEffect(() => {
37201
37248
  const data = initialData;
37202
37249
  if (data && Object.keys(data).length > 0) {
37203
37250
  setFormData(data);
37204
37251
  }
37205
37252
  }, [initialData]);
37206
- const processCalculations = React124__default.useCallback(
37253
+ const processCalculations = React125__default.useCallback(
37207
37254
  (changedFieldId, newFormData) => {
37208
37255
  if (!hiddenCalculations.length) return;
37209
37256
  const context = {
@@ -37228,7 +37275,7 @@ var Form = ({
37228
37275
  },
37229
37276
  [hiddenCalculations, externalContext, eventBus]
37230
37277
  );
37231
- const checkViolations = React124__default.useCallback(
37278
+ const checkViolations = React125__default.useCallback(
37232
37279
  (changedFieldId, newFormData) => {
37233
37280
  if (!violationTriggers.length) return;
37234
37281
  const context = {
@@ -37265,7 +37312,7 @@ var Form = ({
37265
37312
  processCalculations(name, newFormData);
37266
37313
  checkViolations(name, newFormData);
37267
37314
  };
37268
- const isFieldVisible = React124__default.useCallback(
37315
+ const isFieldVisible = React125__default.useCallback(
37269
37316
  (fieldName) => {
37270
37317
  const condition = conditionalFields[fieldName];
37271
37318
  if (!condition) return true;
@@ -37273,7 +37320,7 @@ var Form = ({
37273
37320
  },
37274
37321
  [conditionalFields, evalContext]
37275
37322
  );
37276
- const isSectionVisible = React124__default.useCallback(
37323
+ const isSectionVisible = React125__default.useCallback(
37277
37324
  (section) => {
37278
37325
  if (!section.condition) return true;
37279
37326
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -37305,7 +37352,7 @@ var Form = ({
37305
37352
  eventBus.emit(`UI:${onCancel}`);
37306
37353
  }
37307
37354
  };
37308
- const renderField = React124__default.useCallback(
37355
+ const renderField = React125__default.useCallback(
37309
37356
  (field) => {
37310
37357
  const fieldName = field.name || field.field;
37311
37358
  if (!fieldName) return null;
@@ -37326,7 +37373,7 @@ var Form = ({
37326
37373
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
37327
37374
  );
37328
37375
  const effectiveFields = entityDerivedFields ?? fields;
37329
- const normalizedFields = React124__default.useMemo(() => {
37376
+ const normalizedFields = React125__default.useMemo(() => {
37330
37377
  if (!effectiveFields || effectiveFields.length === 0) return [];
37331
37378
  return effectiveFields.map((field) => {
37332
37379
  if (typeof field === "string") {
@@ -37348,7 +37395,7 @@ var Form = ({
37348
37395
  return field;
37349
37396
  });
37350
37397
  }, [effectiveFields, resolvedEntity]);
37351
- const schemaFields = React124__default.useMemo(() => {
37398
+ const schemaFields = React125__default.useMemo(() => {
37352
37399
  if (normalizedFields.length === 0) return null;
37353
37400
  if (isDebugEnabled()) {
37354
37401
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -37358,7 +37405,7 @@ var Form = ({
37358
37405
  }
37359
37406
  return normalizedFields.map(renderField).filter(Boolean);
37360
37407
  }, [normalizedFields, renderField, entityName, conditionalFields]);
37361
- const sectionElements = React124__default.useMemo(() => {
37408
+ const sectionElements = React125__default.useMemo(() => {
37362
37409
  if (!sections || sections.length === 0) return null;
37363
37410
  return sections.map((section) => {
37364
37411
  if (!isSectionVisible(section)) {
@@ -38796,7 +38843,7 @@ var List2 = ({
38796
38843
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
38797
38844
  return [];
38798
38845
  }, [entity]);
38799
- const getItemActions = React124__default.useCallback(
38846
+ const getItemActions = React125__default.useCallback(
38800
38847
  (item) => {
38801
38848
  if (!itemActions) return [];
38802
38849
  if (typeof itemActions === "function") {
@@ -39231,7 +39278,7 @@ var MediaGallery = ({
39231
39278
  [selectable, selectedItems, selectionEvent, eventBus]
39232
39279
  );
39233
39280
  const entityData = Array.isArray(entity) ? entity : [];
39234
- const items = React124__default.useMemo(() => {
39281
+ const items = React125__default.useMemo(() => {
39235
39282
  if (propItems) return propItems;
39236
39283
  if (entityData.length === 0) return [];
39237
39284
  return entityData.map((record, idx) => ({
@@ -39394,7 +39441,7 @@ var MediaGallery = ({
39394
39441
  MediaGallery.displayName = "MediaGallery";
39395
39442
  init_useEventBus();
39396
39443
  function extractTitle2(children) {
39397
- if (!React124__default.isValidElement(children)) return void 0;
39444
+ if (!React125__default.isValidElement(children)) return void 0;
39398
39445
  const props = children.props;
39399
39446
  if (typeof props.title === "string") {
39400
39447
  return props.title;
@@ -40080,7 +40127,7 @@ var PageHeader = ({
40080
40127
  info: "bg-info/10 text-info"
40081
40128
  };
40082
40129
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
40083
- 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(React124__default.Fragment, { children: [
40130
+ 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(React125__default.Fragment, { children: [
40084
40131
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
40085
40132
  crumb.href ? /* @__PURE__ */ jsx(
40086
40133
  "a",
@@ -40239,7 +40286,7 @@ function subscribeToDebugEvents(listener) {
40239
40286
 
40240
40287
  // components/organisms/debug/hooks/useDebugData.ts
40241
40288
  function useDebugData() {
40242
- const [data, setData] = React124.useState(() => ({
40289
+ const [data, setData] = React125.useState(() => ({
40243
40290
  traits: [],
40244
40291
  ticks: [],
40245
40292
  guards: [],
@@ -40253,7 +40300,7 @@ function useDebugData() {
40253
40300
  },
40254
40301
  lastUpdate: Date.now()
40255
40302
  }));
40256
- React124.useEffect(() => {
40303
+ React125.useEffect(() => {
40257
40304
  const updateData = () => {
40258
40305
  setData({
40259
40306
  traits: getAllTraits(),
@@ -40310,6 +40357,259 @@ function onDebugToggle(listener) {
40310
40357
  // components/organisms/debug/RuntimeDebugger.tsx
40311
40358
  init_Typography();
40312
40359
 
40360
+ // components/organisms/debug/WalkMinimap.tsx
40361
+ init_Box();
40362
+ init_Stack();
40363
+ init_Typography();
40364
+ function layoutGraph(states, transitions, initialState, width, height) {
40365
+ if (states.length === 0) return [];
40366
+ const layers = /* @__PURE__ */ new Map();
40367
+ const queue = [initialState];
40368
+ layers.set(initialState, 0);
40369
+ while (queue.length > 0) {
40370
+ const current = queue.shift();
40371
+ const layer = layers.get(current);
40372
+ for (const tr of transitions) {
40373
+ if (tr.from === current && !layers.has(tr.to)) {
40374
+ layers.set(tr.to, layer + 1);
40375
+ queue.push(tr.to);
40376
+ }
40377
+ }
40378
+ }
40379
+ for (const s of states) {
40380
+ if (!layers.has(s)) layers.set(s, layers.size > 0 ? Math.max(...layers.values()) + 1 : 0);
40381
+ }
40382
+ const layerGroups = /* @__PURE__ */ new Map();
40383
+ for (const [state, layer] of layers) {
40384
+ const group = layerGroups.get(layer) ?? [];
40385
+ group.push(state);
40386
+ layerGroups.set(layer, group);
40387
+ }
40388
+ const maxLayer = Math.max(...layerGroups.keys(), 0);
40389
+ const padX = 24;
40390
+ const padY = 20;
40391
+ const usableW = width - padX * 2;
40392
+ const usableH = height - padY * 2;
40393
+ const positions = [];
40394
+ for (const [layer, group] of layerGroups) {
40395
+ const y = maxLayer === 0 ? usableH / 2 + padY : padY + layer / maxLayer * usableH;
40396
+ for (let i = 0; i < group.length; i++) {
40397
+ const x = group.length === 1 ? width / 2 : padX + i / (group.length - 1) * usableW;
40398
+ positions.push({ x, y, state: group[i] });
40399
+ }
40400
+ }
40401
+ return positions;
40402
+ }
40403
+ function WalkMinimap() {
40404
+ const [walkStep, setWalkStep] = React125.useState(null);
40405
+ const [traits2, setTraits] = React125.useState([]);
40406
+ const [coveredEdges, setCoveredEdges] = React125.useState([]);
40407
+ const [completedTraits, setCompletedTraits] = React125.useState(/* @__PURE__ */ new Set());
40408
+ const prevTraitRef = React125.useRef(null);
40409
+ React125.useEffect(() => {
40410
+ const interval = setInterval(() => {
40411
+ const w = window;
40412
+ const step = w.__orbitalWalkStep;
40413
+ const traitConfigs = w.__orbitalWalkTraits;
40414
+ const edges = w.__orbitalCoveredEdges;
40415
+ if (step) setWalkStep(step);
40416
+ if (traitConfigs) setTraits(traitConfigs);
40417
+ if (edges) setCoveredEdges(edges);
40418
+ if (step && prevTraitRef.current && prevTraitRef.current !== step.traitName) {
40419
+ setCompletedTraits((prev) => new Set(prev).add(prevTraitRef.current));
40420
+ }
40421
+ if (step) prevTraitRef.current = step.traitName;
40422
+ }, 250);
40423
+ return () => clearInterval(interval);
40424
+ }, []);
40425
+ if (!walkStep || traits2.length === 0) return null;
40426
+ const activeTrait = traits2.find((t) => t.name === walkStep.traitName);
40427
+ const engineCount = coveredEdges.filter((e) => e.phase === "engine").length;
40428
+ const domCount = coveredEdges.filter((e) => e.phase === "dom").length;
40429
+ const totalTransitions = traits2.reduce((sum, t) => sum + t.transitions.length, 0);
40430
+ const activeEdgeKeys = new Set(
40431
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).map((e) => `${e.from}+${e.event}->${e.to}`)
40432
+ );
40433
+ const activeEdgePhases = new Map(
40434
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).map((e) => [`${e.from}+${e.event}->${e.to}`, e.phase])
40435
+ );
40436
+ const currentEdgeKey = `${walkStep.from}+${walkStep.event}->${walkStep.to}`;
40437
+ const graphW = 260;
40438
+ const graphH = 120;
40439
+ const nodeR = 10;
40440
+ const positions = activeTrait ? layoutGraph(activeTrait.states, activeTrait.transitions, activeTrait.initialState, graphW, graphH) : [];
40441
+ const posMap = new Map(positions.map((p2) => [p2.state, p2]));
40442
+ const visitedStates = new Set(
40443
+ coveredEdges.filter((e) => e.trait === walkStep.traitName).flatMap((e) => [e.from, e.to])
40444
+ );
40445
+ return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "w-64 flex-shrink-0 border-l border-border bg-[var(--color-card)] overflow-hidden", children: [
40446
+ /* @__PURE__ */ jsx(Box, { className: "px-2 py-1.5 border-b border-border overflow-x-auto", children: /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-nowrap", children: traits2.map((t) => {
40447
+ const isDone = completedTraits.has(t.name);
40448
+ const isActive = t.name === walkStep.traitName;
40449
+ const variant = isDone ? "success" : isActive ? "info" : "neutral";
40450
+ const shortName = t.name.replace(/^[A-Z][a-z]+/, "");
40451
+ return /* @__PURE__ */ jsxs(
40452
+ Badge,
40453
+ {
40454
+ variant,
40455
+ size: "sm",
40456
+ className: `flex-shrink-0 text-[9px] ${isActive ? "ring-1 ring-cyan-400" : ""}`,
40457
+ children: [
40458
+ isDone ? "\u2713" : isActive ? "\u25CF" : "\u25CB",
40459
+ " ",
40460
+ shortName || t.name
40461
+ ]
40462
+ },
40463
+ t.name
40464
+ );
40465
+ }) }) }),
40466
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 flex items-center justify-center px-1 py-1", children: activeTrait && /* @__PURE__ */ jsxs("svg", { width: graphW, height: graphH, viewBox: `0 0 ${graphW} ${graphH}`, children: [
40467
+ /* @__PURE__ */ jsxs("defs", { children: [
40468
+ /* @__PURE__ */ jsx("marker", { id: "mm-arrow", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#888" }) }),
40469
+ /* @__PURE__ */ jsx("marker", { id: "mm-arrow-green", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#22c55e" }) }),
40470
+ /* @__PURE__ */ jsx("marker", { id: "mm-arrow-cyan", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#06b6d4" }) }),
40471
+ /* @__PURE__ */ jsx("marker", { id: "mm-arrow-yellow", markerWidth: "6", markerHeight: "4", refX: "6", refY: "2", orient: "auto", children: /* @__PURE__ */ jsx("path", { d: "M0,0 L6,2 L0,4", fill: "#eab308" }) })
40472
+ ] }),
40473
+ activeTrait.transitions.map((tr, i) => {
40474
+ const fromPos = posMap.get(tr.from);
40475
+ const toPos = posMap.get(tr.to);
40476
+ if (!fromPos || !toPos) return null;
40477
+ const key = `${tr.from}+${tr.event}->${tr.to}`;
40478
+ const isCurrent = key === currentEdgeKey && !walkStep.isRepositioning;
40479
+ const isCovered = activeEdgeKeys.has(key);
40480
+ const phase = activeEdgePhases.get(key);
40481
+ let stroke = "#555";
40482
+ let markerEnd = "url(#mm-arrow)";
40483
+ let strokeWidth = 1;
40484
+ let opacity = 0.4;
40485
+ if (isCurrent) {
40486
+ stroke = "#eab308";
40487
+ markerEnd = "url(#mm-arrow-yellow)";
40488
+ strokeWidth = 2.5;
40489
+ opacity = 1;
40490
+ } else if (isCovered && phase === "dom") {
40491
+ stroke = "#06b6d4";
40492
+ markerEnd = "url(#mm-arrow-cyan)";
40493
+ strokeWidth = 1.5;
40494
+ opacity = 0.9;
40495
+ } else if (isCovered) {
40496
+ stroke = "#22c55e";
40497
+ markerEnd = "url(#mm-arrow-green)";
40498
+ strokeWidth = 1.5;
40499
+ opacity = 0.9;
40500
+ }
40501
+ if (tr.from === tr.to) {
40502
+ const cx = fromPos.x;
40503
+ const cy = fromPos.y - nodeR - 8;
40504
+ return /* @__PURE__ */ jsxs("g", { children: [
40505
+ /* @__PURE__ */ jsx(
40506
+ "path",
40507
+ {
40508
+ d: `M${cx - 5},${fromPos.y - nodeR} C${cx - 18},${cy - 14} ${cx + 18},${cy - 14} ${cx + 5},${fromPos.y - nodeR}`,
40509
+ fill: "none",
40510
+ stroke,
40511
+ strokeWidth,
40512
+ opacity,
40513
+ markerEnd
40514
+ }
40515
+ ),
40516
+ /* @__PURE__ */ 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 })
40517
+ ] }, `e-${i}`);
40518
+ }
40519
+ const dx = toPos.x - fromPos.x;
40520
+ const dy = toPos.y - fromPos.y;
40521
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
40522
+ const nx = -dy / len;
40523
+ const ny = dx / len;
40524
+ const hasReverse = activeTrait.transitions.some(
40525
+ (t2) => t2.from === tr.to && t2.to === tr.from
40526
+ );
40527
+ const offset = hasReverse ? 4 : 0;
40528
+ const x1 = fromPos.x + dx / len * nodeR + nx * offset;
40529
+ const y1 = fromPos.y + dy / len * nodeR + ny * offset;
40530
+ const x2 = toPos.x - dx / len * (nodeR + 6) + nx * offset;
40531
+ const y2 = toPos.y - dy / len * (nodeR + 6) + ny * offset;
40532
+ const mx = (x1 + x2) / 2 + nx * 8;
40533
+ const my = (y1 + y2) / 2 + ny * 8;
40534
+ return /* @__PURE__ */ jsxs("g", { children: [
40535
+ /* @__PURE__ */ jsx(
40536
+ "line",
40537
+ {
40538
+ x1,
40539
+ y1,
40540
+ x2,
40541
+ y2,
40542
+ stroke,
40543
+ strokeWidth,
40544
+ opacity,
40545
+ markerEnd,
40546
+ children: isCurrent && /* @__PURE__ */ jsx("animate", { attributeName: "opacity", values: "1;0.4;1", dur: "0.8s", repeatCount: "indefinite" })
40547
+ }
40548
+ ),
40549
+ /* @__PURE__ */ 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 })
40550
+ ] }, `e-${i}`);
40551
+ }),
40552
+ positions.map((pos) => {
40553
+ const isCurrentState = pos.state === walkStep.from || pos.state === walkStep.to;
40554
+ const isVisited = visitedStates.has(pos.state);
40555
+ const isInitial = pos.state === activeTrait.initialState;
40556
+ let fill = "#333";
40557
+ let strokeColor = "#555";
40558
+ let sw = 1;
40559
+ if (isCurrentState) {
40560
+ fill = "#1e40af";
40561
+ strokeColor = "#3b82f6";
40562
+ sw = 2;
40563
+ } else if (isVisited) {
40564
+ fill = "#166534";
40565
+ strokeColor = "#22c55e";
40566
+ sw = 1.5;
40567
+ }
40568
+ return /* @__PURE__ */ jsxs("g", { children: [
40569
+ isInitial && /* @__PURE__ */ jsx("circle", { cx: pos.x, cy: pos.y, r: nodeR + 3, fill: "none", stroke: "#3b82f6", strokeWidth: 1, opacity: 0.4 }),
40570
+ /* @__PURE__ */ jsx(
40571
+ "circle",
40572
+ {
40573
+ cx: pos.x,
40574
+ cy: pos.y,
40575
+ r: nodeR,
40576
+ fill,
40577
+ stroke: strokeColor,
40578
+ strokeWidth: sw,
40579
+ children: isCurrentState && /* @__PURE__ */ jsx("animate", { attributeName: "r", values: `${nodeR};${nodeR + 2};${nodeR}`, dur: "1s", repeatCount: "indefinite" })
40580
+ }
40581
+ ),
40582
+ /* @__PURE__ */ jsx(
40583
+ "text",
40584
+ {
40585
+ x: pos.x,
40586
+ y: pos.y + nodeR + 10,
40587
+ textAnchor: "middle",
40588
+ fontSize: "8",
40589
+ fill: "#aaa",
40590
+ children: pos.state.length > 10 ? pos.state.slice(0, 8) + ".." : pos.state
40591
+ }
40592
+ )
40593
+ ] }, pos.state);
40594
+ })
40595
+ ] }) }),
40596
+ /* @__PURE__ */ jsx(Box, { className: "px-2 py-1 border-t border-border", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center justify-between", children: [
40597
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-[10px] font-mono text-green-500", children: [
40598
+ "Engine: ",
40599
+ engineCount,
40600
+ "/",
40601
+ totalTransitions
40602
+ ] }),
40603
+ domCount > 0 && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-[10px] font-mono text-cyan-500", children: [
40604
+ "DOM: ",
40605
+ domCount
40606
+ ] }),
40607
+ /* @__PURE__ */ jsx(Badge, { variant: walkStep.phase === "engine" ? "info" : "warning", size: "sm", className: "text-[9px]", children: walkStep.phase === "engine" ? "Engine" : "DOM" })
40608
+ ] }) })
40609
+ ] });
40610
+ }
40611
+ WalkMinimap.displayName = "WalkMinimap";
40612
+
40313
40613
  // components/organisms/debug/tabs/TraitsTab.tsx
40314
40614
  init_Typography();
40315
40615
  init_Stack();
@@ -40538,15 +40838,15 @@ var TYPE_BADGES = {
40538
40838
  state: { variant: "danger", icon: "\u{1F4CA}" }
40539
40839
  };
40540
40840
  function EventFlowTab({ events: events2 }) {
40541
- const [filter, setFilter] = React124.useState("all");
40542
- const containerRef = React124.useRef(null);
40543
- const [autoScroll, setAutoScroll] = React124.useState(true);
40544
- React124.useEffect(() => {
40841
+ const [filter, setFilter] = React125.useState("all");
40842
+ const containerRef = React125.useRef(null);
40843
+ const [autoScroll, setAutoScroll] = React125.useState(true);
40844
+ React125.useEffect(() => {
40545
40845
  if (autoScroll && containerRef.current) {
40546
40846
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
40547
40847
  }
40548
40848
  }, [events2.length, autoScroll]);
40549
- const filteredEvents = React124.useMemo(() => {
40849
+ const filteredEvents = React125.useMemo(() => {
40550
40850
  if (filter === "all") return events2;
40551
40851
  return events2.filter((e) => e.type === filter);
40552
40852
  }, [events2, filter]);
@@ -40647,7 +40947,7 @@ EventFlowTab.displayName = "EventFlowTab";
40647
40947
  init_Typography();
40648
40948
  init_Stack();
40649
40949
  function GuardsPanel({ guards }) {
40650
- const [filter, setFilter] = React124.useState("all");
40950
+ const [filter, setFilter] = React125.useState("all");
40651
40951
  if (guards.length === 0) {
40652
40952
  return /* @__PURE__ */ jsx(
40653
40953
  EmptyState,
@@ -40660,7 +40960,7 @@ function GuardsPanel({ guards }) {
40660
40960
  }
40661
40961
  const passedCount = guards.filter((g) => g.result).length;
40662
40962
  const failedCount = guards.length - passedCount;
40663
- const filteredGuards = React124.useMemo(() => {
40963
+ const filteredGuards = React125.useMemo(() => {
40664
40964
  if (filter === "all") return guards;
40665
40965
  if (filter === "passed") return guards.filter((g) => g.result);
40666
40966
  return guards.filter((g) => !g.result);
@@ -40809,10 +41109,10 @@ function EffectBadge({ effect }) {
40809
41109
  ] });
40810
41110
  }
40811
41111
  function TransitionTimeline({ transitions }) {
40812
- const containerRef = React124.useRef(null);
40813
- const [autoScroll, setAutoScroll] = React124.useState(true);
40814
- const [expandedId, setExpandedId] = React124.useState(null);
40815
- React124.useEffect(() => {
41112
+ const containerRef = React125.useRef(null);
41113
+ const [autoScroll, setAutoScroll] = React125.useState(true);
41114
+ const [expandedId, setExpandedId] = React125.useState(null);
41115
+ React125.useEffect(() => {
40816
41116
  if (autoScroll && containerRef.current) {
40817
41117
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
40818
41118
  }
@@ -41080,9 +41380,9 @@ function getAllEvents(traits2) {
41080
41380
  }
41081
41381
  function EventDispatcherTab({ traits: traits2, schema }) {
41082
41382
  const eventBus = useEventBus();
41083
- const [log, setLog] = React124.useState([]);
41084
- const prevStatesRef = React124.useRef(/* @__PURE__ */ new Map());
41085
- React124.useEffect(() => {
41383
+ const [log, setLog] = React125.useState([]);
41384
+ const prevStatesRef = React125.useRef(/* @__PURE__ */ new Map());
41385
+ React125.useEffect(() => {
41086
41386
  for (const trait of traits2) {
41087
41387
  const prev = prevStatesRef.current.get(trait.id);
41088
41388
  if (prev && prev !== trait.currentState) {
@@ -41159,25 +41459,25 @@ function EventDispatcherTab({ traits: traits2, schema }) {
41159
41459
  EventDispatcherTab.displayName = "EventDispatcherTab";
41160
41460
  function ServerResponseRow({ sr }) {
41161
41461
  const entityEntries = Object.entries(sr.dataEntities);
41162
- return /* @__PURE__ */ jsxs("div", { className: "ml-4 pl-2 border-l border-purple-700/50 py-0.5 text-[10px] font-mono", children: [
41462
+ return /* @__PURE__ */ jsxs("div", { className: "ml-4 pl-2 border-l border-purple-500/30 py-0.5 text-[10px] font-mono", children: [
41163
41463
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
41164
- /* @__PURE__ */ jsxs("span", { className: sr.success ? "text-green-400" : "text-red-400", children: [
41464
+ /* @__PURE__ */ jsxs("span", { className: sr.success ? "text-green-600 dark:text-green-400" : "text-red-600 dark:text-red-400", children: [
41165
41465
  sr.success ? "\u2713" : "\u2717",
41166
41466
  " server"
41167
41467
  ] }),
41168
- /* @__PURE__ */ jsx("span", { className: "text-purple-300", children: sr.orbitalName }),
41169
- sr.clientEffects > 0 && /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-purple-900/50 text-purple-300", children: [
41468
+ /* @__PURE__ */ jsx("span", { className: "text-purple-600 dark:text-purple-300", children: sr.orbitalName }),
41469
+ sr.clientEffects > 0 && /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-purple-500/15 text-purple-600 dark:text-purple-300", children: [
41170
41470
  sr.clientEffects,
41171
41471
  " clientEffect",
41172
41472
  sr.clientEffects !== 1 ? "s" : ""
41173
41473
  ] }),
41174
- sr.emittedEvents.length > 0 && /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-blue-900/50 text-blue-300", children: [
41474
+ sr.emittedEvents.length > 0 && /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-blue-500/15 text-blue-300", children: [
41175
41475
  "emit: ",
41176
41476
  sr.emittedEvents.join(", ")
41177
41477
  ] }),
41178
- sr.error && /* @__PURE__ */ jsx("span", { className: "px-1 rounded bg-red-900/50 text-red-400 truncate max-w-[300px]", children: sr.error })
41478
+ sr.error && /* @__PURE__ */ jsx("span", { className: "px-1 rounded bg-red-500/15 text-red-600 dark:text-red-400 truncate max-w-[300px]", children: sr.error })
41179
41479
  ] }),
41180
- entityEntries.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-0.5", children: entityEntries.map(([name, count]) => /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-gray-800 text-gray-300", children: [
41480
+ entityEntries.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-0.5", children: entityEntries.map(([name, count]) => /* @__PURE__ */ jsxs("span", { className: "px-1 rounded bg-[var(--color-card)] text-foreground", children: [
41181
41481
  name,
41182
41482
  ": ",
41183
41483
  count,
@@ -41190,24 +41490,24 @@ function TransitionRow({ trace }) {
41190
41490
  const isServerEntry = !!trace.serverResponse && trace.traitName.startsWith("server:");
41191
41491
  const hasFailedEffects = trace.effects.some((e) => e.status === "failed");
41192
41492
  if (isServerEntry && trace.serverResponse) {
41193
- return /* @__PURE__ */ jsxs("div", { className: "py-0.5 border-b border-gray-800 last:border-0", children: [
41493
+ return /* @__PURE__ */ jsxs("div", { className: "py-0.5 border-b border-border last:border-0", children: [
41194
41494
  /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs font-mono", children: [
41195
41495
  /* @__PURE__ */ jsx("span", { className: "mt-1.5 w-1.5 h-1.5 rounded-full flex-shrink-0 bg-purple-500" }),
41196
41496
  /* @__PURE__ */ jsx(Badge, { variant: "warning", size: "sm", className: "flex-shrink-0", children: trace.event }),
41197
- /* @__PURE__ */ jsx("span", { className: "text-purple-400 flex-shrink-0", children: "server response" })
41497
+ /* @__PURE__ */ jsx("span", { className: "text-purple-600 dark:text-purple-400 flex-shrink-0", children: "server response" })
41198
41498
  ] }),
41199
41499
  /* @__PURE__ */ jsx(ServerResponseRow, { sr: trace.serverResponse })
41200
41500
  ] });
41201
41501
  }
41202
- return /* @__PURE__ */ jsxs("div", { className: "py-0.5 border-b border-gray-800 last:border-0", children: [
41502
+ return /* @__PURE__ */ jsxs("div", { className: "py-0.5 border-b border-border last:border-0", children: [
41203
41503
  /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs font-mono", children: [
41204
41504
  /* @__PURE__ */ jsx("span", { className: cn(
41205
41505
  "mt-1.5 w-1.5 h-1.5 rounded-full flex-shrink-0",
41206
41506
  hasFailedEffects ? "bg-red-500" : "bg-green-500"
41207
41507
  ) }),
41208
41508
  /* @__PURE__ */ jsx(Badge, { variant: "info", size: "sm", className: "flex-shrink-0", children: trace.event }),
41209
- /* @__PURE__ */ jsx("span", { className: "text-gray-300 flex-shrink-0", children: trace.traitName }),
41210
- /* @__PURE__ */ jsxs("span", { className: "text-gray-400 flex-shrink-0", children: [
41509
+ /* @__PURE__ */ jsx("span", { className: "text-foreground flex-shrink-0", children: trace.traitName }),
41510
+ /* @__PURE__ */ jsxs("span", { className: "text-foreground/70 flex-shrink-0", children: [
41211
41511
  trace.from,
41212
41512
  " ",
41213
41513
  "\u2192",
@@ -41217,12 +41517,12 @@ function TransitionRow({ trace }) {
41217
41517
  ] }),
41218
41518
  trace.effects.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 ml-6 mt-0.5", children: trace.effects.map((eff, i) => /* @__PURE__ */ jsxs("span", { className: cn(
41219
41519
  "px-1 rounded text-[10px]",
41220
- 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"
41520
+ 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"
41221
41521
  ), children: [
41222
41522
  eff.status === "executed" ? "\u2713" : eff.status === "failed" ? "\u2717" : "-",
41223
41523
  " ",
41224
41524
  eff.type,
41225
- eff.args.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-gray-500 ml-0.5", children: JSON.stringify(eff.args).slice(0, 40) })
41525
+ eff.args.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-foreground/50 ml-0.5", children: JSON.stringify(eff.args).slice(0, 40) })
41226
41526
  ] }, i)) }),
41227
41527
  trace.serverResponse && /* @__PURE__ */ jsx(ServerResponseRow, { sr: trace.serverResponse })
41228
41528
  ] });
@@ -41235,18 +41535,9 @@ function VerifyModePanel({
41235
41535
  serverCount,
41236
41536
  localCount
41237
41537
  }) {
41238
- const scrollRef = React124.useRef(null);
41239
- const prevCountRef = React124.useRef(0);
41240
- const [walkStep, setWalkStep] = React124.useState(null);
41241
- React124.useEffect(() => {
41242
- const interval = setInterval(() => {
41243
- const w = window;
41244
- const step = w.__orbitalWalkStep;
41245
- if (step) setWalkStep(step);
41246
- }, 300);
41247
- return () => clearInterval(interval);
41248
- }, []);
41249
- React124.useEffect(() => {
41538
+ const scrollRef = React125.useRef(null);
41539
+ const prevCountRef = React125.useRef(0);
41540
+ React125.useEffect(() => {
41250
41541
  if (transitions.length > prevCountRef.current && scrollRef.current) {
41251
41542
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
41252
41543
  }
@@ -41258,49 +41549,28 @@ function VerifyModePanel({
41258
41549
  {
41259
41550
  className: cn(
41260
41551
  "runtime-debugger runtime-debugger--verify",
41261
- "flex flex-col bg-gray-900 text-white border-t-2 border-cyan-500",
41552
+ "flex flex-col bg-[var(--color-card)] text-[var(--color-foreground)] border-t-2 border-cyan-500",
41262
41553
  hudBottom ? "" : "fixed bottom-0 left-0 right-0",
41263
41554
  className
41264
41555
  ),
41265
41556
  "data-testid": "debugger-verify",
41266
41557
  style: { height: "25vh", zIndex: hudBottom ? void 0 : 40 },
41267
41558
  children: [
41268
- /* @__PURE__ */ 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: [
41559
+ /* @__PURE__ */ 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: [
41269
41560
  /* @__PURE__ */ jsx(Badge, { variant: failedChecks > 0 ? "danger" : "success", size: "sm", children: failedChecks > 0 ? `${failedChecks} fail` : "OK" }),
41270
- /* @__PURE__ */ jsxs("span", { className: "text-gray-400", children: [
41561
+ /* @__PURE__ */ jsxs("span", { className: "text-foreground/70", children: [
41271
41562
  localCount,
41272
41563
  " local"
41273
41564
  ] }),
41274
- /* @__PURE__ */ jsxs("span", { className: "text-purple-400", children: [
41565
+ /* @__PURE__ */ jsxs("span", { className: "text-purple-600 dark:text-purple-400", children: [
41275
41566
  serverCount,
41276
41567
  " server"
41277
41568
  ] }),
41278
- traitStates && /* @__PURE__ */ jsx("span", { className: "text-cyan-400 truncate max-w-[400px]", children: traitStates })
41569
+ traitStates && /* @__PURE__ */ jsx("span", { className: "text-cyan-600 dark:text-cyan-400 truncate max-w-[400px]", children: traitStates })
41279
41570
  ] }),
41280
41571
  /* @__PURE__ */ jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
41281
- /* @__PURE__ */ jsx("div", { ref: scrollRef, className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "px-2 py-1", children: transitions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-500 text-xs font-mono py-2 text-center", children: "Waiting for transitions..." }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: transitions.map((trace) => /* @__PURE__ */ jsx(TransitionRow, { trace }, trace.id)) }) }) }),
41282
- walkStep && /* @__PURE__ */ 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: [
41283
- /* @__PURE__ */ jsxs("div", { className: "text-cyan-400 font-bold mb-1", children: [
41284
- "Walk Step ",
41285
- walkStep.stepIndex,
41286
- "/",
41287
- walkStep.stepTotal
41288
- ] }),
41289
- /* @__PURE__ */ jsx("div", { className: "text-gray-300 mb-1", children: walkStep.traitName }),
41290
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mb-1", children: [
41291
- /* @__PURE__ */ jsx("span", { className: "text-yellow-300", children: walkStep.from }),
41292
- /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: "--" }),
41293
- /* @__PURE__ */ jsx("span", { className: "text-green-300", children: walkStep.event }),
41294
- /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: "-->" }),
41295
- /* @__PURE__ */ jsx("span", { className: "text-yellow-300", children: walkStep.to })
41296
- ] }),
41297
- walkStep.guardCase && /* @__PURE__ */ jsxs("div", { className: walkStep.guardCase === "pass" ? "text-green-400" : "text-red-400", children: [
41298
- "guard: ",
41299
- walkStep.guardCase
41300
- ] }),
41301
- walkStep.isRepositioning && /* @__PURE__ */ jsx("div", { className: "text-gray-500 italic", children: "repositioning" }),
41302
- /* @__PURE__ */ jsx("div", { className: walkStep.accepted ? "text-green-400 mt-1" : "text-red-400 mt-1", children: walkStep.accepted ? "\u2713 accepted" : "\u2717 rejected" })
41303
- ] })
41572
+ /* @__PURE__ */ jsx("div", { ref: scrollRef, className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "px-2 py-1", children: transitions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-foreground/50 text-xs font-mono py-2 text-center", children: "Waiting for transitions..." }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: transitions.map((trace) => /* @__PURE__ */ jsx(TransitionRow, { trace }, trace.id)) }) }) }),
41573
+ /* @__PURE__ */ jsx(WalkMinimap, {})
41304
41574
  ] })
41305
41575
  ]
41306
41576
  }
@@ -41315,10 +41585,10 @@ function RuntimeDebugger({
41315
41585
  defaultTab,
41316
41586
  schema
41317
41587
  }) {
41318
- const [isCollapsed, setIsCollapsed] = React124.useState(mode === "verify" ? true : defaultCollapsed);
41319
- const [isVisible, setIsVisible] = React124.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
41588
+ const [isCollapsed, setIsCollapsed] = React125.useState(mode === "verify" ? true : defaultCollapsed);
41589
+ const [isVisible, setIsVisible] = React125.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
41320
41590
  const debugData = useDebugData();
41321
- React124.useEffect(() => {
41591
+ React125.useEffect(() => {
41322
41592
  if (mode === "inline") return;
41323
41593
  return onDebugToggle((enabled) => {
41324
41594
  setIsVisible(enabled);
@@ -41327,7 +41597,7 @@ function RuntimeDebugger({
41327
41597
  }
41328
41598
  });
41329
41599
  }, [mode]);
41330
- React124.useEffect(() => {
41600
+ React125.useEffect(() => {
41331
41601
  if (mode === "inline") return;
41332
41602
  const handleKeyDown = (e) => {
41333
41603
  if (e.key === "`" && isVisible) {
@@ -41525,7 +41795,7 @@ function RuntimeDebugger({
41525
41795
  className: "runtime-debugger__tabs"
41526
41796
  }
41527
41797
  ) }),
41528
- /* @__PURE__ */ jsx("div", { className: "runtime-debugger__footer", children: /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-gray-500", children: "Press ` to toggle | window.__orbitalVerification for automation" }) })
41798
+ /* @__PURE__ */ jsx("div", { className: "runtime-debugger__footer", children: /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-foreground/50", children: "Press ` to toggle | window.__orbitalVerification for automation" }) })
41529
41799
  ] })
41530
41800
  }
41531
41801
  );
@@ -41845,7 +42115,7 @@ function SequenceBar({
41845
42115
  onSlotRemove(index);
41846
42116
  }, [onSlotRemove, playing]);
41847
42117
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
41848
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
42118
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
41849
42119
  i > 0 && /* @__PURE__ */ jsx(
41850
42120
  Typography,
41851
42121
  {
@@ -43114,7 +43384,7 @@ var StatCard = ({
43114
43384
  const labelToUse = propLabel ?? propTitle;
43115
43385
  const eventBus = useEventBus();
43116
43386
  const { t } = useTranslate();
43117
- const handleActionClick = React124__default.useCallback(() => {
43387
+ const handleActionClick = React125__default.useCallback(() => {
43118
43388
  if (action?.event) {
43119
43389
  eventBus.emit(`UI:${action.event}`, {});
43120
43390
  }
@@ -43125,7 +43395,7 @@ var StatCard = ({
43125
43395
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
43126
43396
  const isLoading = externalLoading ?? false;
43127
43397
  const error = externalError;
43128
- const computeMetricValue = React124__default.useCallback(
43398
+ const computeMetricValue = React125__default.useCallback(
43129
43399
  (metric, items) => {
43130
43400
  if (metric.value !== void 0) {
43131
43401
  return metric.value;
@@ -43164,7 +43434,7 @@ var StatCard = ({
43164
43434
  },
43165
43435
  []
43166
43436
  );
43167
- const schemaStats = React124__default.useMemo(() => {
43437
+ const schemaStats = React125__default.useMemo(() => {
43168
43438
  if (!metrics || metrics.length === 0) return null;
43169
43439
  return metrics.map((metric) => ({
43170
43440
  label: metric.label,
@@ -43172,7 +43442,7 @@ var StatCard = ({
43172
43442
  format: metric.format
43173
43443
  }));
43174
43444
  }, [metrics, data, computeMetricValue]);
43175
- const calculatedTrend = React124__default.useMemo(() => {
43445
+ const calculatedTrend = React125__default.useMemo(() => {
43176
43446
  if (manualTrend !== void 0) return manualTrend;
43177
43447
  if (previousValue === void 0 || currentValue === void 0)
43178
43448
  return void 0;
@@ -44107,7 +44377,7 @@ var Timeline = ({
44107
44377
  }) => {
44108
44378
  const { t } = useTranslate();
44109
44379
  const entityData = Array.isArray(entity) ? entity : [];
44110
- const items = React124__default.useMemo(() => {
44380
+ const items = React125__default.useMemo(() => {
44111
44381
  if (propItems) return propItems;
44112
44382
  if (entityData.length === 0) return [];
44113
44383
  return entityData.map((record, idx) => {
@@ -44211,7 +44481,7 @@ Timeline.displayName = "Timeline";
44211
44481
  init_Box();
44212
44482
  init_useEventBus();
44213
44483
  function extractToastProps(children) {
44214
- if (!React124__default.isValidElement(children)) {
44484
+ if (!React125__default.isValidElement(children)) {
44215
44485
  if (typeof children === "string") {
44216
44486
  return { message: children };
44217
44487
  }
@@ -44242,7 +44512,7 @@ var ToastSlot = ({
44242
44512
  eventBus.emit("UI:CLOSE");
44243
44513
  };
44244
44514
  if (!isVisible) return null;
44245
- const isCustomContent = React124__default.isValidElement(children) && !message;
44515
+ const isCustomContent = React125__default.isValidElement(children) && !message;
44246
44516
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
44247
44517
  Toast,
44248
44518
  {
@@ -44496,7 +44766,7 @@ var WizardContainer = ({
44496
44766
  const isCompleted = index < currentStep;
44497
44767
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
44498
44768
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
44499
- return /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
44769
+ return /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
44500
44770
  /* @__PURE__ */ jsx(
44501
44771
  Button,
44502
44772
  {
@@ -44867,12 +45137,12 @@ WorldMapTemplate.displayName = "WorldMapTemplate";
44867
45137
 
44868
45138
  // components/organisms/component-registry.generated.ts
44869
45139
  function lazyThree(name, loader) {
44870
- const Lazy = React124__default.lazy(() => loader().then((m) => ({ default: m[name] })));
45140
+ const Lazy = React125__default.lazy(() => loader().then((m) => ({ default: m[name] })));
44871
45141
  function ThreeWrapper(props) {
44872
- return React124__default.createElement(
44873
- React124__default.Suspense,
45142
+ return React125__default.createElement(
45143
+ React125__default.Suspense,
44874
45144
  { fallback: null },
44875
- React124__default.createElement(Lazy, props)
45145
+ React125__default.createElement(Lazy, props)
44876
45146
  );
44877
45147
  }
44878
45148
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -45160,7 +45430,7 @@ function SuspenseConfigProvider({
45160
45430
  config,
45161
45431
  children
45162
45432
  }) {
45163
- return React124__default.createElement(
45433
+ return React125__default.createElement(
45164
45434
  SuspenseConfigContext.Provider,
45165
45435
  { value: config },
45166
45436
  children
@@ -45187,6 +45457,62 @@ function getComponentForPattern(patternType) {
45187
45457
  if (!name) return null;
45188
45458
  return COMPONENT_REGISTRY[name] ?? null;
45189
45459
  }
45460
+ var FORM_PATTERNS = /* @__PURE__ */ new Set([
45461
+ "form",
45462
+ "form-section",
45463
+ "inline-edit-form",
45464
+ "wizard-step"
45465
+ ]);
45466
+ function enrichFormFields(fields, entityDef) {
45467
+ const fieldMap = new Map(entityDef.fields.map((f3) => [f3.name, f3]));
45468
+ return fields.map((field) => {
45469
+ if (typeof field === "string") {
45470
+ const entityField = fieldMap.get(field);
45471
+ if (entityField) {
45472
+ const enriched = {
45473
+ name: field,
45474
+ label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
45475
+ type: entityField.type,
45476
+ required: entityField.required
45477
+ };
45478
+ if (entityField.values && entityField.values.length > 0) {
45479
+ enriched.values = entityField.values;
45480
+ } else if (entityField.enumValues && entityField.enumValues.length > 0) {
45481
+ enriched.values = entityField.enumValues;
45482
+ }
45483
+ if (entityField.relation) {
45484
+ enriched.relation = entityField.relation;
45485
+ }
45486
+ return enriched;
45487
+ }
45488
+ return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
45489
+ }
45490
+ if (field && typeof field === "object" && !Array.isArray(field)) {
45491
+ const obj = field;
45492
+ const fieldName = obj.name ?? obj.field;
45493
+ if (!fieldName) return field;
45494
+ if (obj.type || obj.inputType) return field;
45495
+ const entityField = fieldMap.get(fieldName);
45496
+ if (!entityField) return field;
45497
+ const enriched = { ...obj, type: entityField.type };
45498
+ if (entityField.required && !("required" in obj)) {
45499
+ enriched.required = true;
45500
+ }
45501
+ if (!obj.values && !obj.options) {
45502
+ if (entityField.values && entityField.values.length > 0) {
45503
+ enriched.values = entityField.values;
45504
+ } else if (entityField.enumValues && entityField.enumValues.length > 0) {
45505
+ enriched.values = entityField.enumValues;
45506
+ }
45507
+ }
45508
+ if (!obj.relation && entityField.relation) {
45509
+ enriched.relation = entityField.relation;
45510
+ }
45511
+ return enriched;
45512
+ }
45513
+ return field;
45514
+ });
45515
+ }
45190
45516
  var PATTERNS_WITH_CHILDREN = /* @__PURE__ */ new Set([
45191
45517
  "stack",
45192
45518
  "vstack",
@@ -45620,6 +45946,8 @@ function SlotContentRenderer({
45620
45946
  const entityProp = content.props.entity;
45621
45947
  const entityType = typeof entityProp === "string" ? entityProp : "";
45622
45948
  const storeData = useEntityRef(entityType);
45949
+ const schemaCtx = useEntitySchemaOptional();
45950
+ const entityDef = entityType && schemaCtx ? schemaCtx.entities.get(entityType) : void 0;
45623
45951
  const PatternComponent = getComponentForPattern(content.pattern);
45624
45952
  if (PatternComponent) {
45625
45953
  const childrenConfig = content.props.children;
@@ -45641,6 +45969,13 @@ function SlotContentRenderer({
45641
45969
  } else {
45642
45970
  finalProps = renderedProps;
45643
45971
  }
45972
+ const isFormPattern = FORM_PATTERNS.has(content.pattern) || content.pattern.includes("form");
45973
+ if (isFormPattern && entityDef && Array.isArray(finalProps.fields)) {
45974
+ finalProps.fields = enrichFormFields(finalProps.fields, entityDef);
45975
+ if (finalProps.mode === "edit" && !finalProps.initialData && storeData.length > 0) {
45976
+ finalProps.initialData = storeData[0];
45977
+ }
45978
+ }
45644
45979
  const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
45645
45980
  return /* @__PURE__ */ jsx(
45646
45981
  Box,
@@ -46047,33 +46382,6 @@ function createClientEffectHandlers(options) {
46047
46382
  })
46048
46383
  };
46049
46384
  }
46050
- var EntitySchemaContext = createContext(null);
46051
- function EntitySchemaProvider({
46052
- entities,
46053
- children
46054
- }) {
46055
- const entitiesMap = useMemo(() => {
46056
- const map = /* @__PURE__ */ new Map();
46057
- for (const entity of entities) {
46058
- map.set(entity.name, entity);
46059
- }
46060
- return map;
46061
- }, [entities]);
46062
- const contextValue2 = useMemo(
46063
- () => ({
46064
- entities: entitiesMap
46065
- }),
46066
- [entitiesMap]
46067
- );
46068
- return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue2, children });
46069
- }
46070
- function useEntitySchema() {
46071
- const context = useContext(EntitySchemaContext);
46072
- if (!context) {
46073
- throw new Error("useEntitySchema must be used within an EntitySchemaProvider");
46074
- }
46075
- return context;
46076
- }
46077
46385
 
46078
46386
  // runtime/useTraitStateMachine.ts
46079
46387
  function toTraitDefinition(binding) {
@@ -46856,6 +47164,43 @@ OrbPreview.displayName = "OrbPreview";
46856
47164
 
46857
47165
  // components/molecules/avl/OrbPreviewNode.tsx
46858
47166
  init_useEventBus();
47167
+
47168
+ // components/molecules/avl/wire-validation.ts
47169
+ function validateWire(sourcePayload, targetPayload) {
47170
+ const warnings = [];
47171
+ if (!sourcePayload?.length && !targetPayload?.length) {
47172
+ return { valid: true, warnings };
47173
+ }
47174
+ if (sourcePayload?.length && !targetPayload?.length) {
47175
+ return { valid: true, warnings };
47176
+ }
47177
+ if (!sourcePayload?.length && targetPayload?.length) {
47178
+ const requiredFields = targetPayload.filter((f3) => f3.required);
47179
+ if (requiredFields.length > 0) {
47180
+ warnings.push(`Missing required fields: ${requiredFields.map((f3) => f3.name).join(", ")}`);
47181
+ }
47182
+ return { valid: warnings.length === 0, warnings };
47183
+ }
47184
+ const sourceFields = new Map(sourcePayload.map((f3) => [f3.name, f3]));
47185
+ for (const targetField of targetPayload) {
47186
+ const sourceField = sourceFields.get(targetField.name);
47187
+ if (!sourceField) {
47188
+ if (targetField.required) {
47189
+ warnings.push(`Missing required field: ${targetField.name} (${targetField.type})`);
47190
+ }
47191
+ } else if (sourceField.type !== targetField.type) {
47192
+ warnings.push(`Type mismatch: ${targetField.name} (source: ${sourceField.type}, target: ${targetField.type})`);
47193
+ }
47194
+ }
47195
+ return { valid: warnings.length === 0, warnings };
47196
+ }
47197
+ function formatPayloadTooltip(fields) {
47198
+ if (fields.length === 0) return "";
47199
+ const parts = fields.map(
47200
+ (f3) => `${f3.name}: ${f3.type}${f3.required ? " (req)" : ""}`
47201
+ );
47202
+ return `{ ${parts.join(", ")} }`;
47203
+ }
46859
47204
  var ScreenSizeContext = createContext("tablet");
46860
47205
  var PatternSelectionContext = createContext({ selected: null, select: () => {
46861
47206
  } });
@@ -46866,6 +47211,15 @@ var ROLE_COLORS = {
46866
47211
  error: { border: "#D97706", dot: "#F59E0B" },
46867
47212
  default: { border: "var(--color-border)", dot: "#6B7280" }
46868
47213
  };
47214
+ var LAYER_COLORS = {
47215
+ Infrastructure: "#3B82F6",
47216
+ Services: "#F59E0B",
47217
+ "UI Patterns": "#8B5CF6",
47218
+ Game: "#22C55E",
47219
+ ML: "#EC4899",
47220
+ Domain: "#6366F1",
47221
+ Community: "#6B7280"
47222
+ };
46869
47223
  var TARGET_HANDLE_STYLE = {
46870
47224
  background: "var(--color-primary)",
46871
47225
  width: 8,
@@ -46968,6 +47322,7 @@ var OrbPreviewNodeInner = (props) => {
46968
47322
  const role = data.stateRole ?? "default";
46969
47323
  const colors = ROLE_COLORS[role] ?? ROLE_COLORS.default;
46970
47324
  const eventSources = data.eventSources ?? [];
47325
+ const layerColor = data.layer ? LAYER_COLORS[data.layer] : void 0;
46971
47326
  const isExpanded = Boolean(data.traitName);
46972
47327
  const label = isExpanded ? `${data.transitionEvent ?? ""}` : data.orbitalName;
46973
47328
  const sublabel = isExpanded ? `${data.fromState ?? ""} \u2192 ${data.toState ?? ""}` : data.entityName ?? "";
@@ -47078,10 +47433,11 @@ var OrbPreviewNodeInner = (props) => {
47078
47433
  });
47079
47434
  }, [eventBus]);
47080
47435
  const handlePreviewDragOver = useCallback((e) => {
47081
- if (!dragActive) return;
47436
+ if (!e.dataTransfer.types.includes(ALMADAR_DND_MIME)) return;
47082
47437
  e.preventDefault();
47083
47438
  e.stopPropagation();
47084
47439
  e.dataTransfer.dropEffect = "copy";
47440
+ if (!dragActive) setDragActive(true);
47085
47441
  let el = e.target;
47086
47442
  while (el && el.dataset.acceptsChildren !== "true") {
47087
47443
  el = el.parentElement;
@@ -47108,6 +47464,13 @@ var OrbPreviewNodeInner = (props) => {
47108
47464
  onMouseLeave: handleMouseLeave,
47109
47465
  children: [
47110
47466
  /* @__PURE__ */ jsx("style", { children: SELECTION_STYLES }),
47467
+ layerColor && /* @__PURE__ */ jsx(
47468
+ Box,
47469
+ {
47470
+ style: { height: 3, backgroundColor: layerColor },
47471
+ title: data.layer
47472
+ }
47473
+ ),
47111
47474
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 px-3 py-1.5 border-b border-border/40 drag-handle cursor-grab", children: [
47112
47475
  /* @__PURE__ */ jsx(
47113
47476
  Box,
@@ -47129,7 +47492,7 @@ var OrbPreviewNodeInner = (props) => {
47129
47492
  color: "#F97316",
47130
47493
  border: "1px solid #F9731630"
47131
47494
  },
47132
- title: `${src.label ?? src.patternType} \u2192 ${src.event}`,
47495
+ title: `${src.label ?? src.patternType} \u2192 ${src.event}${src.payloadFields?.length ? ` ${formatPayloadTooltip(src.payloadFields)}` : ""}`,
47133
47496
  children: src.label ?? src.event
47134
47497
  },
47135
47498
  src.event
@@ -47163,7 +47526,7 @@ var OrbPreviewNodeInner = (props) => {
47163
47526
  type: "source",
47164
47527
  position: Position.Right,
47165
47528
  style: eventHandleStyle(src),
47166
- title: `${src.label ?? src.patternType}: ${src.event}`
47529
+ title: `${src.label ?? src.patternType}: ${src.event}${src.payloadFields?.length ? ` ${formatPayloadTooltip(src.payloadFields)}` : ""}`
47167
47530
  },
47168
47531
  `event-${src.event}`
47169
47532
  ))
@@ -47171,7 +47534,7 @@ var OrbPreviewNodeInner = (props) => {
47171
47534
  }
47172
47535
  );
47173
47536
  };
47174
- var OrbPreviewNode = React124__default.memo(OrbPreviewNodeInner);
47537
+ var OrbPreviewNode = React125__default.memo(OrbPreviewNodeInner);
47175
47538
  OrbPreviewNode.displayName = "OrbPreviewNode";
47176
47539
  var EventFlowEdgeInner = (props) => {
47177
47540
  const {
@@ -47248,9 +47611,214 @@ var EventFlowEdgeInner = (props) => {
47248
47611
  ) })
47249
47612
  ] });
47250
47613
  };
47251
- var EventFlowEdge = React124__default.memo(EventFlowEdgeInner);
47614
+ var EventFlowEdge = React125__default.memo(EventFlowEdgeInner);
47252
47615
  EventFlowEdge.displayName = "EventFlowEdge";
47253
47616
 
47617
+ // components/molecules/avl/BehaviorComposeNode.tsx
47618
+ init_Box();
47619
+ init_Typography();
47620
+ var LAYER_COLORS2 = {
47621
+ Infrastructure: "#3B82F6",
47622
+ Services: "#F59E0B",
47623
+ "UI Patterns": "#8B5CF6",
47624
+ Game: "#22C55E",
47625
+ ML: "#EC4899",
47626
+ Domain: "#6366F1",
47627
+ Community: "#6B7280"
47628
+ };
47629
+ var NODE_WIDTH = 220;
47630
+ var TARGET_HANDLE_STYLE2 = {
47631
+ background: "var(--color-primary)",
47632
+ width: 8,
47633
+ height: 8,
47634
+ border: "2px solid var(--color-card)"
47635
+ };
47636
+ function eventHandleStyle2(source) {
47637
+ return {
47638
+ background: "#F97316",
47639
+ width: 10,
47640
+ height: 10,
47641
+ border: "2px solid var(--color-card)",
47642
+ top: `${source.positionHint * 100}%`,
47643
+ right: -5
47644
+ };
47645
+ }
47646
+ var BehaviorComposeNodeInner = (props) => {
47647
+ const data = props.data;
47648
+ const [hovered, setHovered] = useState(false);
47649
+ const handleMouseEnter = useCallback(() => setHovered(true), []);
47650
+ const handleMouseLeave = useCallback(() => setHovered(false), []);
47651
+ const layerColor = data.layer ? LAYER_COLORS2[data.layer] : void 0;
47652
+ const connectableEvents = data.connectableEvents ?? [];
47653
+ return /* @__PURE__ */ jsxs(
47654
+ Box,
47655
+ {
47656
+ className: "rounded-lg border shadow-sm bg-card transition-all duration-200 overflow-hidden",
47657
+ style: {
47658
+ borderColor: hovered ? "var(--color-primary)" : "var(--color-border)",
47659
+ borderWidth: "1.5px",
47660
+ width: NODE_WIDTH
47661
+ },
47662
+ onMouseEnter: handleMouseEnter,
47663
+ onMouseLeave: handleMouseLeave,
47664
+ children: [
47665
+ layerColor && /* @__PURE__ */ jsx(
47666
+ Box,
47667
+ {
47668
+ style: { height: 3, backgroundColor: layerColor },
47669
+ title: data.layer
47670
+ }
47671
+ ),
47672
+ /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 px-3 py-1.5 border-b border-border/40 drag-handle cursor-grab", children: [
47673
+ /* @__PURE__ */ jsxs(Box, { className: "flex flex-col min-w-0 flex-1", children: [
47674
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "font-semibold truncate leading-tight text-[12px]", children: data.behaviorName }),
47675
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground truncate text-[10px] leading-tight", children: data.entityName })
47676
+ ] }),
47677
+ /* @__PURE__ */ jsx(Badge, { variant: "neutral", className: "shrink-0", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-[9px] text-inherit", children: data.level }) })
47678
+ ] }),
47679
+ /* @__PURE__ */ jsx(Box, { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsx(
47680
+ AvlBehaviorGlyph,
47681
+ {
47682
+ name: data.behaviorName,
47683
+ level: data.level,
47684
+ domain: data.domain,
47685
+ stateCount: data.stateCount,
47686
+ fieldCount: data.fieldCount,
47687
+ persistence: data.persistence,
47688
+ effectTypes: data.effectTypes,
47689
+ children: data.children,
47690
+ connections: data.connections,
47691
+ size: "sm",
47692
+ showLabels: false
47693
+ }
47694
+ ) }),
47695
+ connectableEvents.length > 0 && /* @__PURE__ */ jsxs(Box, { className: "flex flex-wrap gap-0.5 px-2 pb-2", children: [
47696
+ connectableEvents.slice(0, 4).map((ev) => /* @__PURE__ */ jsx(
47697
+ Box,
47698
+ {
47699
+ className: "rounded-full px-1.5 py-0 text-[8px] font-medium leading-tight",
47700
+ style: {
47701
+ backgroundColor: "#F9731615",
47702
+ color: "#F97316",
47703
+ border: "1px solid #F9731630"
47704
+ },
47705
+ title: `${ev.event}${ev.payloadFields?.length ? ` ${formatPayloadTooltip(ev.payloadFields)}` : ""}`,
47706
+ children: ev.event
47707
+ },
47708
+ ev.event
47709
+ )),
47710
+ connectableEvents.length > 4 && /* @__PURE__ */ jsxs(
47711
+ Box,
47712
+ {
47713
+ className: "rounded-full px-1.5 py-0 text-[8px] font-medium leading-tight",
47714
+ style: { color: "var(--color-muted-foreground)" },
47715
+ children: [
47716
+ "+",
47717
+ connectableEvents.length - 4
47718
+ ]
47719
+ }
47720
+ )
47721
+ ] }),
47722
+ /* @__PURE__ */ jsxs(Box, { className: "flex items-center justify-between px-2 pb-1.5", children: [
47723
+ /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "text-muted-foreground text-[9px]", children: [
47724
+ data.stateCount,
47725
+ " states"
47726
+ ] }),
47727
+ data.layer && /* @__PURE__ */ jsx(Badge, { variant: "neutral", className: "text-[8px]", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-[8px] text-inherit", children: data.layer }) })
47728
+ ] }),
47729
+ /* @__PURE__ */ jsx(
47730
+ Handle,
47731
+ {
47732
+ type: "target",
47733
+ position: Position.Left,
47734
+ style: TARGET_HANDLE_STYLE2
47735
+ }
47736
+ ),
47737
+ connectableEvents.map((ev) => /* @__PURE__ */ jsx(
47738
+ Handle,
47739
+ {
47740
+ id: `event-${ev.event}`,
47741
+ type: "source",
47742
+ position: Position.Right,
47743
+ style: eventHandleStyle2(ev),
47744
+ title: `${ev.event}${ev.payloadFields?.length ? ` ${formatPayloadTooltip(ev.payloadFields)}` : ""}`
47745
+ },
47746
+ `event-${ev.event}`
47747
+ ))
47748
+ ]
47749
+ }
47750
+ );
47751
+ };
47752
+ var BehaviorComposeNode = React125__default.memo(BehaviorComposeNodeInner);
47753
+ BehaviorComposeNode.displayName = "BehaviorComposeNode";
47754
+
47755
+ // components/molecules/avl/avl-behavior-compose-converter.ts
47756
+ var COMPOSE_SPACING = 320;
47757
+ function behaviorsToComposeGraph(entries, wires, layoutHint) {
47758
+ const nodes = [];
47759
+ const edges = [];
47760
+ const count = entries.length;
47761
+ const cols = layoutHint === "pipeline" ? count : Math.ceil(Math.sqrt(count));
47762
+ for (let i = 0; i < entries.length; i++) {
47763
+ const entry = entries[i];
47764
+ const col = i % cols;
47765
+ const row = Math.floor(i / cols);
47766
+ nodes.push({
47767
+ id: entry.behaviorName,
47768
+ type: "behaviorCompose",
47769
+ position: { x: col * COMPOSE_SPACING, y: row * COMPOSE_SPACING },
47770
+ data: {
47771
+ behaviorName: entry.behaviorName,
47772
+ level: entry.level,
47773
+ domain: entry.domain,
47774
+ layer: entry.layer,
47775
+ entityName: entry.entityName,
47776
+ stateCount: entry.stateCount,
47777
+ fieldCount: entry.fieldCount,
47778
+ persistence: entry.persistence,
47779
+ effectTypes: entry.effectTypes,
47780
+ children: entry.children,
47781
+ connections: entry.connections,
47782
+ connectableEvents: entry.connectableEvents,
47783
+ composableWith: entry.composableWith,
47784
+ orbitalNames: entry.orbitalNames
47785
+ }
47786
+ });
47787
+ }
47788
+ for (const wire of wires) {
47789
+ edges.push({
47790
+ id: `bw-${wire.sourceBehavior}-${wire.targetBehavior}-${wire.event}`,
47791
+ source: wire.sourceBehavior,
47792
+ target: wire.targetBehavior,
47793
+ sourceHandle: `event-${wire.event}`,
47794
+ type: "eventFlow",
47795
+ data: wire
47796
+ });
47797
+ }
47798
+ return { nodes, edges };
47799
+ }
47800
+ function registryEntryToCanvasEntry(entry, orbitalNames) {
47801
+ const events2 = entry.connectableEvents;
47802
+ const connectableEvents = events2.map((eventName, i) => ({
47803
+ event: eventName,
47804
+ payloadFields: entry.eventPayloads[eventName],
47805
+ positionHint: events2.length > 1 ? 0.1 + i * 0.8 / (events2.length - 1) : 0.5
47806
+ }));
47807
+ return {
47808
+ behaviorName: entry.name,
47809
+ level: entry.level,
47810
+ domain: entry.family,
47811
+ layer: entry.layer,
47812
+ entityName: entry.defaultEntity.name,
47813
+ stateCount: entry.complexity.states,
47814
+ fieldCount: entry.defaultEntity.fields.length,
47815
+ persistence: entry.defaultEntity.persistence,
47816
+ connectableEvents,
47817
+ composableWith: entry.composableWith,
47818
+ orbitalNames
47819
+ };
47820
+ }
47821
+
47254
47822
  // components/molecules/avl/index.ts
47255
47823
  init_Avl3DOrbitalNode();
47256
47824
  init_Avl3DCrossWire();
@@ -47363,6 +47931,7 @@ function OrbInspector({ node, schema, editable = false, onSchemaChange, onClose
47363
47931
  const effectTypes = node.effectTypes ?? [];
47364
47932
  const guard = node.guard;
47365
47933
  const isExpanded = Boolean(traitName);
47934
+ const hasRenderUi = effectTypes.includes("render-ui");
47366
47935
  const patternType = selectedPattern?.patternType;
47367
47936
  const patternDef = useMemo(() => patternType ? getPatternDefinition(patternType) : null, [patternType]);
47368
47937
  const isEntityPattern = patternType ? isEntityAwarePattern(patternType) : false;
@@ -47562,6 +48131,42 @@ function OrbInspector({ node, schema, editable = false, onSchemaChange, onClose
47562
48131
  }
47563
48132
  )
47564
48133
  ] }),
48134
+ editable && !selectedPattern && !isExpanded && node.layer === "Services" && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
48135
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-[10px] uppercase tracking-wider mb-2", children: t("Service Mode") }),
48136
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
48137
+ /* @__PURE__ */ jsxs(
48138
+ Button,
48139
+ {
48140
+ variant: hasRenderUi ? "primary" : "ghost",
48141
+ size: "sm",
48142
+ className: "flex-1 text-[11px]",
48143
+ onClick: () => {
48144
+ if (!hasRenderUi) eventBus.emit("UI:SERVICE_MODE_TOGGLE", { orbitalName: node.orbitalName, standalone: true });
48145
+ },
48146
+ children: [
48147
+ /* @__PURE__ */ jsx(Icon, { name: "monitor", size: "xs", className: "mr-1" }),
48148
+ t("Standalone")
48149
+ ]
48150
+ }
48151
+ ),
48152
+ /* @__PURE__ */ jsxs(
48153
+ Button,
48154
+ {
48155
+ variant: hasRenderUi ? "ghost" : "primary",
48156
+ size: "sm",
48157
+ className: "flex-1 text-[11px]",
48158
+ onClick: () => {
48159
+ if (hasRenderUi) eventBus.emit("UI:SERVICE_MODE_TOGGLE", { orbitalName: node.orbitalName, standalone: false });
48160
+ },
48161
+ children: [
48162
+ /* @__PURE__ */ jsx(Icon, { name: "cpu", size: "xs", className: "mr-1" }),
48163
+ t("Embedded")
48164
+ ]
48165
+ }
48166
+ )
48167
+ ] }),
48168
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-[10px] mt-1", children: hasRenderUi ? t("Renders its own UI") : t("Headless, wired to other behaviors") })
48169
+ ] }),
47565
48170
  !selectedPattern && !isExpanded && traits2.length > 0 && /* @__PURE__ */ jsxs(Box, { className: "px-4 py-3 border-b border-border/40", children: [
47566
48171
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-[10px] uppercase tracking-wider mb-2", children: "Traits" }),
47567
48172
  /* @__PURE__ */ jsx(Box, { className: "flex flex-col gap-1", children: traits2.map((t2) => /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
@@ -47710,8 +48315,10 @@ OrbInspector.displayName = "OrbInspector";
47710
48315
  // components/organisms/avl/FlowCanvas.tsx
47711
48316
  init_Box();
47712
48317
  init_Typography();
48318
+ init_useEventBus();
47713
48319
  var NODE_TYPES = {
47714
- preview: OrbPreviewNode
48320
+ preview: OrbPreviewNode,
48321
+ behaviorCompose: BehaviorComposeNode
47715
48322
  };
47716
48323
  var EDGE_TYPES = {
47717
48324
  eventFlow: EventFlowEdge
@@ -47728,21 +48335,31 @@ function FlowCanvasInner({
47728
48335
  onNodeClick,
47729
48336
  onLevelChange,
47730
48337
  initialOrbital,
48338
+ initialLevel,
48339
+ initialSelectedNode,
47731
48340
  editable,
47732
48341
  onSchemaChange,
47733
48342
  onPatternDelete,
47734
- onEventWire
48343
+ onEventWire,
48344
+ behaviorMeta,
48345
+ layoutHint,
48346
+ onNodeSelect,
48347
+ composeLevel,
48348
+ behaviorEntries,
48349
+ behaviorWires
47735
48350
  }) {
47736
48351
  const parsedSchema = useMemo(() => {
47737
48352
  if (typeof schemaProp === "string") return JSON.parse(schemaProp);
47738
48353
  return schemaProp;
47739
48354
  }, [schemaProp]);
47740
- const [level, setLevel] = useState("overview");
48355
+ const [level, setLevel] = useState(
48356
+ initialLevel ?? (initialOrbital ? "expanded" : "overview")
48357
+ );
47741
48358
  const [expandedOrbital, setExpandedOrbital] = useState(
47742
48359
  initialOrbital
47743
48360
  );
47744
48361
  const [screenSize, setScreenSize] = useState("tablet");
47745
- const [selectedNode, setSelectedNode] = useState(null);
48362
+ const [selectedNode, setSelectedNode] = useState(initialSelectedNode ?? null);
47746
48363
  const [selectedPattern, setSelectedPattern] = useState(null);
47747
48364
  const patternSelectionValue = useMemo(() => ({
47748
48365
  selected: selectedPattern,
@@ -47751,18 +48368,22 @@ function FlowCanvasInner({
47751
48368
  if (p2) setSelectedNode(p2.nodeData);
47752
48369
  }
47753
48370
  }), [selectedPattern]);
47754
- const { overviewNodes, overviewEdges, expandedNodes, expandedEdges } = useMemo(() => {
47755
- const overview = schemaToOverviewGraph(parsedSchema, mockData);
48371
+ const [atBehaviorLevel, setAtBehaviorLevel] = useState(composeLevel === "behavior");
48372
+ const { composeNodes, composeEdges, overviewNodes, overviewEdges, expandedNodes, expandedEdges } = useMemo(() => {
48373
+ const compose = composeLevel === "behavior" && behaviorEntries?.length ? behaviorsToComposeGraph(behaviorEntries, behaviorWires ?? [], layoutHint) : { nodes: [], edges: [] };
48374
+ const overview = schemaToOverviewGraph(parsedSchema, mockData, behaviorMeta, layoutHint);
47756
48375
  const expanded = expandedOrbital ? orbitalToExpandedGraph(parsedSchema, expandedOrbital, mockData) : { nodes: [], edges: [] };
47757
48376
  return {
48377
+ composeNodes: compose.nodes,
48378
+ composeEdges: compose.edges,
47758
48379
  overviewNodes: overview.nodes,
47759
48380
  overviewEdges: overview.edges,
47760
48381
  expandedNodes: expanded.nodes,
47761
48382
  expandedEdges: expanded.edges
47762
48383
  };
47763
- }, [parsedSchema, expandedOrbital]);
47764
- const activeNodes = level === "overview" ? overviewNodes : expandedNodes;
47765
- const activeEdges = level === "overview" ? overviewEdges : expandedEdges;
48384
+ }, [parsedSchema, expandedOrbital, behaviorMeta, layoutHint, composeLevel, behaviorEntries, behaviorWires]);
48385
+ const activeNodes = atBehaviorLevel && composeNodes.length > 0 ? composeNodes : level === "overview" ? overviewNodes : expandedNodes;
48386
+ const activeEdges = atBehaviorLevel && composeEdges.length > 0 ? composeEdges : level === "overview" ? overviewEdges : expandedEdges;
47766
48387
  const [nodes, setNodes, onNodesChange] = useNodesState(activeNodes);
47767
48388
  const [edges, setEdges, onEdgesChange] = useEdgesState(activeEdges);
47768
48389
  const reactFlow = useReactFlow();
@@ -47774,13 +48395,23 @@ function FlowCanvasInner({
47774
48395
  });
47775
48396
  }, [activeNodes, activeEdges, setNodes, setEdges, reactFlow]);
47776
48397
  const handleNodeDoubleClick = useCallback((_, node) => {
48398
+ if (atBehaviorLevel && composeLevel === "behavior") {
48399
+ const d = node.data;
48400
+ if (d.orbitalNames?.length) {
48401
+ setExpandedOrbital(d.orbitalNames[0]);
48402
+ }
48403
+ setAtBehaviorLevel(false);
48404
+ setLevel("overview");
48405
+ onLevelChange?.("overview", d.behaviorName);
48406
+ return;
48407
+ }
47777
48408
  if (level === "overview") {
47778
48409
  const d = node.data;
47779
48410
  setExpandedOrbital(d.orbitalName ?? node.id);
47780
48411
  setLevel("expanded");
47781
48412
  onLevelChange?.("expanded", d.orbitalName ?? node.id);
47782
48413
  }
47783
- }, [level, onLevelChange]);
48414
+ }, [level, onLevelChange, atBehaviorLevel, composeLevel]);
47784
48415
  const handleNodeClick = useCallback((_, node) => {
47785
48416
  const nodeData = node.data;
47786
48417
  if (level === "expanded") {
@@ -47796,6 +48427,7 @@ function FlowCanvasInner({
47796
48427
  level: "overview",
47797
48428
  orbital: nodeData.orbitalName ?? node.id
47798
48429
  });
48430
+ onNodeSelect?.(nodeData.orbitalName ?? node.id);
47799
48431
  }
47800
48432
  }, [level, expandedOrbital, onNodeClick]);
47801
48433
  const handleClosePanel = useCallback(() => {
@@ -47809,6 +48441,9 @@ function FlowCanvasInner({
47809
48441
  setLevel("overview");
47810
48442
  setExpandedOrbital(void 0);
47811
48443
  onLevelChange?.("overview");
48444
+ } else if (level === "overview" && composeLevel === "behavior" && !atBehaviorLevel) {
48445
+ setAtBehaviorLevel(true);
48446
+ setExpandedOrbital(void 0);
47812
48447
  }
47813
48448
  } else if (e.key === "Delete" || e.key === "Backspace") {
47814
48449
  const target = e.target;
@@ -47831,8 +48466,13 @@ function FlowCanvasInner({
47831
48466
  setExpandedOrbital(void 0);
47832
48467
  setSelectedNode(null);
47833
48468
  onLevelChange?.("overview");
48469
+ } else if (level === "overview" && composeLevel === "behavior" && !atBehaviorLevel) {
48470
+ setAtBehaviorLevel(true);
48471
+ setExpandedOrbital(void 0);
48472
+ setSelectedNode(null);
47834
48473
  }
47835
- }, [level, onLevelChange, selectedNode]);
48474
+ }, [level, onLevelChange, selectedNode, composeLevel, atBehaviorLevel]);
48475
+ const eventBus = useEventBus();
47836
48476
  const handleConnect = useCallback((connection) => {
47837
48477
  if (!connection.sourceHandle?.startsWith("event-") || !onEventWire) return;
47838
48478
  const eventName = connection.sourceHandle.replace("event-", "");
@@ -47841,6 +48481,19 @@ function FlowCanvasInner({
47841
48481
  if (!sourceNode || !targetNode) return;
47842
48482
  const srcData = sourceNode.data;
47843
48483
  const tgtData = targetNode.data;
48484
+ const sourceEventSource = srcData.eventSources?.find((es) => es.event === eventName);
48485
+ const sourcePayload = sourceEventSource?.payloadFields;
48486
+ const targetEventSource = tgtData.eventSources?.find((es) => es.event === eventName);
48487
+ const targetPayload = targetEventSource?.payloadFields;
48488
+ const validation = validateWire(sourcePayload, targetPayload);
48489
+ if (validation.warnings.length > 0) {
48490
+ eventBus.emit("UI:WIRE_VALIDATION_WARNING", {
48491
+ eventName,
48492
+ sourceOrbital: srcData.orbitalName,
48493
+ targetOrbital: tgtData.orbitalName,
48494
+ warnings: validation.warnings
48495
+ });
48496
+ }
47844
48497
  onEventWire({
47845
48498
  eventName,
47846
48499
  sourceOrbital: srcData.orbitalName ?? "",
@@ -47848,7 +48501,7 @@ function FlowCanvasInner({
47848
48501
  sourceTraitName: srcData.traitName,
47849
48502
  targetTraitName: tgtData.traitName
47850
48503
  });
47851
- }, [nodes, onEventWire]);
48504
+ }, [nodes, onEventWire, eventBus]);
47852
48505
  const screenSizeKeys = ["mobile", "tablet", "desktop"];
47853
48506
  return /* @__PURE__ */ jsx(ScreenSizeContext.Provider, { value: screenSize, children: /* @__PURE__ */ jsx(PatternSelectionContext.Provider, { value: patternSelectionValue, children: /* @__PURE__ */ jsxs(
47854
48507
  Box,
@@ -48007,7 +48660,7 @@ var ZoomBreadcrumb = ({
48007
48660
  if (eventName && band === "detail") {
48008
48661
  segments.push({ icon: "\u26A1", label: eventName });
48009
48662
  }
48010
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-[var(--color-card)]/90 border border-[var(--color-border)] text-[11px] text-[var(--color-muted-foreground)] backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React124__default.Fragment, { children: [
48663
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-[11px] text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React125__default.Fragment, { children: [
48011
48664
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
48012
48665
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
48013
48666
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -48059,11 +48712,11 @@ var ZoomLegend = ({ band }) => {
48059
48712
  "button",
48060
48713
  {
48061
48714
  onClick: () => setCollapsed(!collapsed),
48062
- className: "px-2 py-1 text-[10px] rounded-md bg-[var(--color-card)]/90 border border-[var(--color-border)] text-[var(--color-muted-foreground)] backdrop-blur-sm cursor-pointer hover:bg-[var(--color-card)]",
48715
+ className: "px-2 py-1 text-[10px] rounded-md bg-card/90 border border-border text-muted-foreground backdrop-blur-sm cursor-pointer hover:bg-card",
48063
48716
  children: collapsed ? "Legend" : "Hide"
48064
48717
  }
48065
48718
  ),
48066
- !collapsed && /* @__PURE__ */ jsx("div", { className: "mt-1 px-2 py-1.5 rounded-md bg-[var(--color-card)]/95 border border-[var(--color-border)] backdrop-blur-sm space-y-0.5", children: items.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-[var(--color-muted-foreground)]", children: [
48719
+ !collapsed && /* @__PURE__ */ jsx("div", { className: "mt-1 px-2 py-1.5 rounded-md bg-card/95 border border-border backdrop-blur-sm space-y-0.5", children: items.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [
48067
48720
  /* @__PURE__ */ jsx("span", { className: "opacity-70 w-6 text-center", children: item.icon }),
48068
48721
  /* @__PURE__ */ jsx("span", { children: item.label })
48069
48722
  ] }, i)) })
@@ -48498,4 +49151,4 @@ AvlClickTarget.displayName = "AvlClickTarget";
48498
49151
  init_avl_schema_parser();
48499
49152
  init_avl_zoom_state();
48500
49153
 
48501
- export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, AvlBackwardEdge, AvlBehaviorGlyph, AvlBinding, AvlBindingEdge, AvlBindingRef, AvlClickTarget, AvlClosedCircuit, AvlCosmicZoom, AvlEffect, AvlEmitListen, AvlEntity, AvlEvent, AvlEventWireEdge, AvlExprTree, AvlField, AvlFieldType, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlOrbitalNode, AvlOrbitalUnit, AvlPage, AvlPageEdge, AvlPersistence, AvlSExpr, AvlSlotMap, AvlState, AvlStateMachine, AvlSwimLane, AvlTrait, AvlTraitScene, AvlTransition, AvlTransitionEdge, AvlTransitionLane, AvlTransitionScene, BehaviorView, CONNECTION_COLORS, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, EventFlowEdge, FlowCanvas, MiniStateMachine, ModuleCard, OrbInspector, OrbPreviewNode, STATE_COLORS, SystemNode, ZOOM_BAND_THRESHOLDS, ZoomBandContext, ZoomBreadcrumb, ZoomLegend, arcPath, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useZoomBand, zoomProgress };
49154
+ export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, AvlBackwardEdge, AvlBehaviorGlyph, AvlBinding, AvlBindingEdge, AvlBindingRef, AvlClickTarget, AvlClosedCircuit, AvlCosmicZoom, AvlEffect, AvlEmitListen, AvlEntity, AvlEvent, AvlEventWireEdge, AvlExprTree, AvlField, AvlFieldType, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlOrbitalNode, AvlOrbitalUnit, AvlPage, AvlPageEdge, AvlPersistence, AvlSExpr, AvlSlotMap, AvlState, AvlStateMachine, AvlSwimLane, AvlTrait, AvlTraitScene, AvlTransition, AvlTransitionEdge, AvlTransitionLane, AvlTransitionScene, BehaviorComposeNode, BehaviorView, CONNECTION_COLORS, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, EventFlowEdge, FlowCanvas, MiniStateMachine, ModuleCard, OrbInspector, OrbPreviewNode, STATE_COLORS, SystemNode, ZOOM_BAND_THRESHOLDS, ZoomBandContext, ZoomBreadcrumb, ZoomLegend, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useZoomBand, zoomProgress };