@almadar/ui 5.16.4 → 5.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/avl/index.cjs +191 -153
  2. package/dist/avl/index.js +191 -153
  3. package/dist/components/atoms/Avatar.d.ts +4 -2
  4. package/dist/components/atoms/ConditionalWrapper.d.ts +2 -2
  5. package/dist/components/atoms/Icon.d.ts +6 -2
  6. package/dist/components/atoms/Input.d.ts +3 -2
  7. package/dist/components/atoms/LawReferenceTooltip.d.ts +2 -2
  8. package/dist/components/atoms/game/MiniMap.d.ts +15 -17
  9. package/dist/components/atoms/index.d.ts +1 -0
  10. package/dist/components/atoms/types.d.ts +40 -0
  11. package/dist/components/index.cjs +191 -153
  12. package/dist/components/index.js +191 -153
  13. package/dist/components/molecules/CTABanner.d.ts +3 -8
  14. package/dist/components/molecules/CalendarGrid.d.ts +2 -2
  15. package/dist/components/molecules/CommunityLinks.d.ts +15 -12
  16. package/dist/components/molecules/DataGrid.d.ts +2 -1
  17. package/dist/components/molecules/DataList.d.ts +12 -11
  18. package/dist/components/molecules/GraphView.d.ts +2 -2
  19. package/dist/components/molecules/HeroSection.d.ts +4 -12
  20. package/dist/components/molecules/MapView.d.ts +2 -2
  21. package/dist/components/molecules/MarketingFooter.d.ts +6 -5
  22. package/dist/components/molecules/Meter.d.ts +2 -1
  23. package/dist/components/molecules/OptionConstraintGroup.d.ts +5 -3
  24. package/dist/components/molecules/PricingCard.d.ts +2 -4
  25. package/dist/components/molecules/QrScanner.d.ts +2 -2
  26. package/dist/components/molecules/RepeatableFormSection.d.ts +2 -2
  27. package/dist/components/molecules/ShowcaseCard.d.ts +2 -4
  28. package/dist/components/molecules/SplitSection.d.ts +2 -4
  29. package/dist/components/molecules/StatDisplay.d.ts +2 -1
  30. package/dist/components/molecules/StatsGrid.d.ts +5 -4
  31. package/dist/components/molecules/TableView.d.ts +2 -1
  32. package/dist/components/molecules/ViolationAlert.d.ts +2 -2
  33. package/dist/components/molecules/game/CraftingRecipe.d.ts +11 -7
  34. package/dist/components/molecules/game/DialogueBox.d.ts +2 -2
  35. package/dist/components/molecules/game/HealthPanel.d.ts +6 -5
  36. package/dist/components/molecules/game/IsometricCanvas.d.ts +9 -13
  37. package/dist/components/organisms/Chart.d.ts +2 -1
  38. package/dist/components/organisms/CodeViewer.d.ts +8 -6
  39. package/dist/components/organisms/ComponentPatterns.d.ts +2 -1
  40. package/dist/components/organisms/ConfirmDialog.d.ts +2 -1
  41. package/dist/components/organisms/CustomPattern.d.ts +2 -1
  42. package/dist/components/organisms/DataTable.d.ts +6 -5
  43. package/dist/components/organisms/DetailPanel.d.ts +5 -4
  44. package/dist/components/organisms/DocumentViewer.d.ts +9 -7
  45. package/dist/components/organisms/DrawerSlot.d.ts +2 -1
  46. package/dist/components/organisms/Form.d.ts +5 -4
  47. package/dist/components/organisms/GraphCanvas.d.ts +2 -1
  48. package/dist/components/organisms/Header.d.ts +17 -14
  49. package/dist/components/organisms/JazariStateMachine.d.ts +2 -1
  50. package/dist/components/organisms/LayoutPatterns.d.ts +4 -3
  51. package/dist/components/organisms/List.d.ts +2 -2
  52. package/dist/components/organisms/Meter.d.ts +2 -1
  53. package/dist/components/organisms/ModalSlot.d.ts +2 -1
  54. package/dist/components/organisms/Navigation.d.ts +2 -1
  55. package/dist/components/organisms/OrbitalVisualization.d.ts +2 -1
  56. package/dist/components/organisms/PageHeader.d.ts +7 -5
  57. package/dist/components/organisms/Section.d.ts +2 -1
  58. package/dist/components/organisms/Sidebar.d.ts +2 -1
  59. package/dist/components/organisms/SignaturePad.d.ts +2 -1
  60. package/dist/components/organisms/Split.d.ts +2 -1
  61. package/dist/components/organisms/StateMachineView.d.ts +8 -4
  62. package/dist/components/organisms/Timeline.d.ts +2 -1
  63. package/dist/components/organisms/ToastSlot.d.ts +2 -1
  64. package/dist/components/organisms/UISlotRenderer.d.ts +4 -3
  65. package/dist/components/organisms/WizardContainer.d.ts +2 -1
  66. package/dist/components/organisms/book/types.d.ts +2 -2
  67. package/dist/components/organisms/game/BattleBoard.d.ts +4 -4
  68. package/dist/components/organisms/game/CanvasEffect.d.ts +2 -1
  69. package/dist/components/organisms/game/CastleBoard.d.ts +6 -5
  70. package/dist/components/organisms/game/GameAudioProvider.d.ts +2 -1
  71. package/dist/components/organisms/game/GameAudioToggle.d.ts +2 -1
  72. package/dist/components/organisms/game/TraitSlot.d.ts +4 -3
  73. package/dist/components/organisms/game/TraitStateViewer.d.ts +6 -5
  74. package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +9 -4
  75. package/dist/components/organisms/game/WorldMapBoard.d.ts +11 -9
  76. package/dist/components/organisms/game/physics-sim/SimulationControls.d.ts +8 -7
  77. package/dist/components/organisms/game/puzzles/builder/BuilderBoard.d.ts +3 -3
  78. package/dist/components/organisms/game/puzzles/classifier/ClassifierBoard.d.ts +3 -3
  79. package/dist/components/organisms/game/puzzles/debugger/DebuggerBoard.d.ts +3 -3
  80. package/dist/components/organisms/game/puzzles/event-handler/EventHandlerBoard.d.ts +7 -4
  81. package/dist/components/organisms/game/puzzles/event-handler/ObjectRulePanel.d.ts +2 -2
  82. package/dist/components/organisms/game/puzzles/event-handler/RuleEditor.d.ts +7 -9
  83. package/dist/components/organisms/game/puzzles/negotiator/NegotiatorBoard.d.ts +3 -3
  84. package/dist/components/organisms/game/puzzles/sequencer/SequencerBoard.d.ts +5 -4
  85. package/dist/components/organisms/game/puzzles/simulator/SimulatorBoard.d.ts +3 -3
  86. package/dist/components/organisms/game/puzzles/state-architect/StateArchitectBoard.d.ts +5 -4
  87. package/dist/components/organisms/game/puzzles/state-architect/StateNode.d.ts +2 -4
  88. package/dist/components/organisms/game/puzzles/state-architect/TransitionArrow.d.ts +3 -8
  89. package/dist/components/organisms/game/types/isometric.d.ts +4 -4
  90. package/dist/components/organisms/index.d.ts +1 -1
  91. package/dist/components/organisms/types.d.ts +3 -1
  92. package/dist/components/templates/DashboardLayout.d.ts +6 -5
  93. package/dist/components/templates/GameTemplate.d.ts +7 -6
  94. package/dist/components/templates/GenericAppTemplate.d.ts +1 -7
  95. package/dist/components/templates/types.d.ts +14 -6
  96. package/dist/docs/index.cjs +60 -22
  97. package/dist/docs/index.d.cts +9 -4
  98. package/dist/docs/index.js +58 -20
  99. package/dist/marketing/index.cjs +61 -23
  100. package/dist/marketing/index.d.cts +54 -55
  101. package/dist/marketing/index.js +58 -20
  102. package/dist/providers/index.cjs +191 -153
  103. package/dist/providers/index.js +191 -153
  104. package/dist/runtime/index.cjs +191 -153
  105. package/dist/runtime/index.js +191 -153
  106. package/package.json +1 -1
@@ -1486,11 +1486,13 @@ var init_Icon = __esm({
1486
1486
  strokeWidth,
1487
1487
  style
1488
1488
  }) => {
1489
+ const directIcon = typeof icon === "string" ? void 0 : icon;
1490
+ const effectiveName = typeof icon === "string" ? icon : name;
1489
1491
  const family = useIconFamily();
1490
1492
  const RenderedComponent = React86__default.useMemo(() => {
1491
- if (icon) return null;
1492
- return name ? resolveIconForFamily(name, family) : null;
1493
- }, [icon, name, family]);
1493
+ if (directIcon) return null;
1494
+ return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1495
+ }, [directIcon, effectiveName, family]);
1494
1496
  const effectiveStrokeWidth = strokeWidth ?? void 0;
1495
1497
  const inlineStyle = {
1496
1498
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
@@ -1502,8 +1504,8 @@ var init_Icon = __esm({
1502
1504
  color ? color : "text-current",
1503
1505
  className
1504
1506
  );
1505
- if (icon) {
1506
- const Direct = icon;
1507
+ if (directIcon) {
1508
+ const Direct = directIcon;
1507
1509
  return /* @__PURE__ */ jsx(
1508
1510
  Direct,
1509
1511
  {
@@ -3376,7 +3378,7 @@ var init_Input = __esm({
3376
3378
  error,
3377
3379
  leftIcon,
3378
3380
  rightIcon,
3379
- icon: IconComponent,
3381
+ icon: iconProp,
3380
3382
  clearable,
3381
3383
  onClear,
3382
3384
  value,
@@ -3386,6 +3388,7 @@ var init_Input = __esm({
3386
3388
  ...props
3387
3389
  }, ref) => {
3388
3390
  const type = inputType || htmlType || "text";
3391
+ const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
3389
3392
  const resolvedLeftIcon = leftIcon || IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "h-icon-default w-icon-default" });
3390
3393
  const showClearButton = clearable && value && String(value).length > 0;
3391
3394
  const isMultiline = type === "textarea";
@@ -3933,7 +3936,7 @@ var init_Avatar = __esm({
3933
3936
  alt,
3934
3937
  name,
3935
3938
  initials: providedInitials,
3936
- icon: IconComponent,
3939
+ icon: iconProp,
3937
3940
  size = "md",
3938
3941
  status,
3939
3942
  badge,
@@ -3944,6 +3947,7 @@ var init_Avatar = __esm({
3944
3947
  }) => {
3945
3948
  const eventBus = useEventBus();
3946
3949
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
3950
+ const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
3947
3951
  const hasImage = !!src;
3948
3952
  const hasInitials = !!initials;
3949
3953
  const hasIcon = !!IconComponent;
@@ -15158,6 +15162,7 @@ var init_StateMachineView = __esm({
15158
15162
  setTooltip((prev) => ({ ...prev, pinned: false, visible: false }));
15159
15163
  }, []);
15160
15164
  useEventListener("UI:TOOLTIP_CLOSE", handleCloseTooltip);
15165
+ if (!layoutData) return null;
15161
15166
  const { width, height, title, states, labels, entity, outputs, config } = layoutData;
15162
15167
  const bundles = useMemo(() => {
15163
15168
  const bundleMap = {};
@@ -17502,13 +17507,14 @@ function BuilderBoard({
17502
17507
  }) {
17503
17508
  const { emit } = useEventBus();
17504
17509
  const { t } = useTranslate();
17510
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
17505
17511
  const [placements, setPlacements] = useState({});
17506
17512
  const [headerError, setHeaderError] = useState(false);
17507
17513
  const [submitted, setSubmitted] = useState(false);
17508
17514
  const [attempts, setAttempts] = useState(0);
17509
17515
  const [showHint, setShowHint] = useState(false);
17510
- const components = entity?.components ?? [];
17511
- const slots = entity?.slots ?? [];
17516
+ const components = resolved?.components ?? [];
17517
+ const slots = resolved?.slots ?? [];
17512
17518
  const usedComponentIds = new Set(Object.values(placements));
17513
17519
  const availableComponents = components.filter((c) => !usedComponentIds.has(c.id));
17514
17520
  const [selectedComponent, setSelectedComponent] = useState(null);
@@ -17542,7 +17548,7 @@ function BuilderBoard({
17542
17548
  }, [slots, placements, attempts, completeEvent, emit]);
17543
17549
  const handleReset = () => {
17544
17550
  setSubmitted(false);
17545
- if (attempts >= 2 && entity.hint) {
17551
+ if (attempts >= 2 && resolved?.hint) {
17546
17552
  setShowHint(true);
17547
17553
  }
17548
17554
  };
@@ -17554,20 +17560,21 @@ function BuilderBoard({
17554
17560
  setShowHint(false);
17555
17561
  };
17556
17562
  const getComponentById = (id) => components.find((c) => c.id === id);
17563
+ if (!resolved) return null;
17557
17564
  return /* @__PURE__ */ jsx(
17558
17565
  Box,
17559
17566
  {
17560
17567
  className,
17561
17568
  style: {
17562
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
17569
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
17563
17570
  backgroundSize: "cover",
17564
17571
  backgroundPosition: "center"
17565
17572
  },
17566
17573
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
17567
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
17574
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
17568
17575
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
17569
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
17570
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
17576
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
17577
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
17571
17578
  ] }) }),
17572
17579
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
17573
17580
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.components") }),
@@ -17627,9 +17634,9 @@ function BuilderBoard({
17627
17634
  ] }) }),
17628
17635
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
17629
17636
  /* @__PURE__ */ jsx(Icon, { icon: allCorrect ? CheckCircle : XCircle, size: "lg", className: allCorrect ? "text-success" : "text-error" }),
17630
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("builder.success") : entity.failMessage ?? t("builder.incorrect") })
17637
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("builder.success") : resolved.failMessage ?? t("builder.incorrect") })
17631
17638
  ] }) }),
17632
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
17639
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
17633
17640
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
17634
17641
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allPlaced, children: [
17635
17642
  /* @__PURE__ */ jsx(Icon, { icon: Wrench, size: "sm" }),
@@ -20170,11 +20177,12 @@ function CastleBoard({
20170
20177
  className
20171
20178
  }) {
20172
20179
  const eventBus = useEventBus();
20173
- const tiles = entity.tiles;
20174
- const features = entity.features ?? [];
20175
- const units = entity.units ?? [];
20176
- const assetManifest = entity.assetManifest;
20177
- const backgroundImage = entity.backgroundImage;
20180
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
20181
+ const tiles = resolved?.tiles ?? [];
20182
+ const features = resolved?.features ?? [];
20183
+ const units = resolved?.units ?? [];
20184
+ const assetManifest = resolved?.assetManifest;
20185
+ const backgroundImage = resolved?.backgroundImage;
20178
20186
  const [hoveredTile, setHoveredTile] = useState(null);
20179
20187
  const [selectedFeature, setSelectedFeature] = useState(null);
20180
20188
  const hoveredFeature = useMemo(() => {
@@ -21079,13 +21087,14 @@ function ClassifierBoard({
21079
21087
  }) {
21080
21088
  const { emit } = useEventBus();
21081
21089
  const { t } = useTranslate();
21090
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
21082
21091
  const [assignments, setAssignments] = useState({});
21083
21092
  const [headerError, setHeaderError] = useState(false);
21084
21093
  const [submitted, setSubmitted] = useState(false);
21085
21094
  const [attempts, setAttempts] = useState(0);
21086
21095
  const [showHint, setShowHint] = useState(false);
21087
- const items = entity?.items ?? [];
21088
- const categories = entity?.categories ?? [];
21096
+ const items = resolved?.items ?? [];
21097
+ const categories = resolved?.categories ?? [];
21089
21098
  const unassignedItems = items.filter((item) => !assignments[item.id]);
21090
21099
  const allAssigned = Object.keys(assignments).length === items.length;
21091
21100
  const results = submitted ? items.map((item) => ({
@@ -21117,7 +21126,7 @@ function ClassifierBoard({
21117
21126
  }, [items, assignments, attempts, completeEvent, emit]);
21118
21127
  const handleReset = () => {
21119
21128
  setSubmitted(false);
21120
- if (attempts >= 2 && entity.hint) {
21129
+ if (attempts >= 2 && resolved?.hint) {
21121
21130
  setShowHint(true);
21122
21131
  }
21123
21132
  };
@@ -21127,20 +21136,21 @@ function ClassifierBoard({
21127
21136
  setAttempts(0);
21128
21137
  setShowHint(false);
21129
21138
  };
21139
+ if (!resolved) return null;
21130
21140
  return /* @__PURE__ */ jsx(
21131
21141
  Box,
21132
21142
  {
21133
21143
  className,
21134
21144
  style: {
21135
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
21145
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
21136
21146
  backgroundSize: "cover",
21137
21147
  backgroundPosition: "center"
21138
21148
  },
21139
21149
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
21140
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
21150
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
21141
21151
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21142
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
21143
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
21152
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
21153
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
21144
21154
  ] }) }),
21145
21155
  unassignedItems.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
21146
21156
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("classifier.itemsToSort") }),
@@ -21192,10 +21202,10 @@ function ClassifierBoard({
21192
21202
  }) }),
21193
21203
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
21194
21204
  /* @__PURE__ */ jsx(Icon, { icon: allCorrect ? CheckCircle : XCircle, size: "lg", className: allCorrect ? "text-success" : "text-error" }),
21195
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
21196
- !allCorrect && entity.failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: entity.failMessage })
21205
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
21206
+ !allCorrect && resolved.failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: resolved.failMessage })
21197
21207
  ] }) }),
21198
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
21208
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
21199
21209
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
21200
21210
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allAssigned, children: [
21201
21211
  /* @__PURE__ */ jsx(Icon, { icon: Send, size: "sm" }),
@@ -32530,7 +32540,7 @@ var init_OptionConstraintGroup = __esm({
32530
32540
  title,
32531
32541
  description,
32532
32542
  options,
32533
- constraint,
32543
+ constraint = { type: "single" },
32534
32544
  selected = [],
32535
32545
  onChange,
32536
32546
  changeEvent,
@@ -35668,7 +35678,7 @@ function DataTable({
35668
35678
  children: /* @__PURE__ */ jsx(
35669
35679
  EmptyState,
35670
35680
  {
35671
- icon: emptyIcon,
35681
+ icon: typeof emptyIcon === "string" ? resolveIcon(emptyIcon) : emptyIcon,
35672
35682
  title: resolvedEmptyTitle,
35673
35683
  description: resolvedEmptyDescription,
35674
35684
  actionLabel: emptyAction?.label,
@@ -35797,6 +35807,7 @@ var init_DataTable = __esm({
35797
35807
  init_Stack();
35798
35808
  init_Typography();
35799
35809
  init_molecules();
35810
+ init_Icon();
35800
35811
  init_useEventBus();
35801
35812
  init_useTranslate();
35802
35813
  init_types3();
@@ -35817,6 +35828,7 @@ function DebuggerBoard({
35817
35828
  }) {
35818
35829
  const { emit } = useEventBus();
35819
35830
  const { t } = useTranslate();
35831
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
35820
35832
  const [flaggedLines, setFlaggedLines] = useState(/* @__PURE__ */ new Set());
35821
35833
  const [headerError, setHeaderError] = useState(false);
35822
35834
  const [submitted, setSubmitted] = useState(false);
@@ -35834,7 +35846,7 @@ function DebuggerBoard({
35834
35846
  return next;
35835
35847
  });
35836
35848
  };
35837
- const lines = entity?.lines ?? [];
35849
+ const lines = resolved?.lines ?? [];
35838
35850
  const bugLines = lines.filter((l) => l.isBug);
35839
35851
  const correctFlags = lines.filter((l) => l.isBug && flaggedLines.has(l.id));
35840
35852
  const falseFlags = lines.filter((l) => !l.isBug && flaggedLines.has(l.id));
@@ -35849,7 +35861,7 @@ function DebuggerBoard({
35849
35861
  }, [correctFlags.length, bugLines.length, falseFlags.length, attempts, completeEvent, emit]);
35850
35862
  const handleReset = () => {
35851
35863
  setSubmitted(false);
35852
- if (attempts >= 2 && entity.hint) {
35864
+ if (attempts >= 2 && resolved?.hint) {
35853
35865
  setShowHint(true);
35854
35866
  }
35855
35867
  };
@@ -35859,24 +35871,25 @@ function DebuggerBoard({
35859
35871
  setAttempts(0);
35860
35872
  setShowHint(false);
35861
35873
  };
35874
+ if (!resolved) return null;
35862
35875
  return /* @__PURE__ */ jsx(
35863
35876
  Box,
35864
35877
  {
35865
35878
  className,
35866
35879
  style: {
35867
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
35880
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
35868
35881
  backgroundSize: "cover",
35869
35882
  backgroundPosition: "center"
35870
35883
  },
35871
35884
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
35872
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
35885
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
35873
35886
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
35874
35887
  /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
35875
35888
  /* @__PURE__ */ jsx(Icon, { icon: Bug, size: "sm" }),
35876
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title })
35889
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title })
35877
35890
  ] }),
35878
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description }),
35879
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(entity.bugCount) }) })
35891
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description }),
35892
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(resolved.bugCount) }) })
35880
35893
  ] }) }),
35881
35894
  /* @__PURE__ */ jsx(Card, { className: "p-0 overflow-hidden", children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: lines.map((line, i) => {
35882
35895
  const isFlagged = flaggedLines.has(line.id);
@@ -35908,7 +35921,7 @@ function DebuggerBoard({
35908
35921
  );
35909
35922
  }) }) }),
35910
35923
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
35911
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
35924
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
35912
35925
  bugLines.map((line) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "start", children: [
35913
35926
  /* @__PURE__ */ jsx(
35914
35927
  Icon,
@@ -35924,7 +35937,7 @@ function DebuggerBoard({
35924
35937
  ] })
35925
35938
  ] }, line.id))
35926
35939
  ] }) }),
35927
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
35940
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
35928
35941
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
35929
35942
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: flaggedLines.size === 0, children: [
35930
35943
  /* @__PURE__ */ jsx(Icon, { icon: Send, size: "sm" }),
@@ -37056,7 +37069,8 @@ function EventHandlerBoard({
37056
37069
  }) {
37057
37070
  const { emit } = useEventBus();
37058
37071
  const { t } = useTranslate();
37059
- const entityObjects = entity?.objects ?? [];
37072
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
37073
+ const entityObjects = resolved?.objects ?? [];
37060
37074
  const [objects, setObjects] = useState(entityObjects);
37061
37075
  const [selectedObjectId, setSelectedObjectId] = useState(
37062
37076
  entityObjects[0]?.id || null
@@ -37091,7 +37105,7 @@ function EventHandlerBoard({
37091
37105
  allRules.push({ object: obj, rule });
37092
37106
  });
37093
37107
  });
37094
- const triggers = entity.triggerEvents || [];
37108
+ const triggers = resolved?.triggerEvents || [];
37095
37109
  const eventQueue = [...triggers];
37096
37110
  const firedEvents = /* @__PURE__ */ new Set();
37097
37111
  let stepIdx = 0;
@@ -37122,12 +37136,12 @@ function EventHandlerBoard({
37122
37136
  matching.forEach(({ object, rule }) => {
37123
37137
  addLogEntry(object.icon, t("eventHandler.heardEvent", { object: object.name, event: currentEvent, action: rule.thenAction }), "done");
37124
37138
  eventQueue.push(rule.thenAction);
37125
- if (rule.thenAction === entity.goalEvent) {
37139
+ if (rule.thenAction === resolved?.goalEvent) {
37126
37140
  goalReached = true;
37127
37141
  }
37128
37142
  });
37129
37143
  }
37130
- if (currentEvent === entity.goalEvent) {
37144
+ if (currentEvent === resolved?.goalEvent) {
37131
37145
  goalReached = true;
37132
37146
  }
37133
37147
  stepIdx++;
@@ -37137,7 +37151,7 @@ function EventHandlerBoard({
37137
37151
  addLogEntry("\u{1F3AC}", t("eventHandler.simulationStarted", { events: triggers.join(", ") }), "active");
37138
37152
  }
37139
37153
  timerRef.current = setTimeout(processNext, stepDurationMs);
37140
- }, [playState, objects, entity, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
37154
+ }, [playState, objects, resolved, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
37141
37155
  const handleTryAgain = useCallback(() => {
37142
37156
  if (timerRef.current) clearTimeout(timerRef.current);
37143
37157
  setPlayState("editing");
@@ -37145,12 +37159,13 @@ function EventHandlerBoard({
37145
37159
  }, []);
37146
37160
  const handleReset = useCallback(() => {
37147
37161
  if (timerRef.current) clearTimeout(timerRef.current);
37148
- setObjects(entity?.objects ?? []);
37162
+ setObjects(resolved?.objects ?? []);
37149
37163
  setPlayState("editing");
37150
37164
  setEventLog([]);
37151
- setSelectedObjectId((entity?.objects ?? [])[0]?.id || null);
37165
+ setSelectedObjectId((resolved?.objects ?? [])[0]?.id || null);
37152
37166
  setAttempts(0);
37153
- }, [entity?.objects]);
37167
+ }, [resolved?.objects]);
37168
+ if (!resolved) return null;
37154
37169
  const objectViewers = objects.map((obj) => {
37155
37170
  const machine = {
37156
37171
  name: obj.name,
@@ -37164,25 +37179,25 @@ function EventHandlerBoard({
37164
37179
  };
37165
37180
  return { obj, machine };
37166
37181
  });
37167
- const showHint = attempts >= 3 && entity.hint;
37182
+ const showHint = attempts >= 3 && resolved.hint;
37168
37183
  const encourageKey = ENCOURAGEMENT_KEYS[Math.min(attempts - 1, ENCOURAGEMENT_KEYS.length - 1)] ?? ENCOURAGEMENT_KEYS[0];
37169
37184
  return /* @__PURE__ */ jsxs(
37170
37185
  VStack,
37171
37186
  {
37172
37187
  className: cn("p-4 gap-6", className),
37173
37188
  style: {
37174
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
37189
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
37175
37190
  backgroundSize: "cover",
37176
37191
  backgroundPosition: "center"
37177
37192
  },
37178
37193
  children: [
37179
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
37194
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
37180
37195
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
37181
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
37182
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description }),
37196
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
37197
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description }),
37183
37198
  /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-primary/10 border border-primary/30", gap: "xs", children: [
37184
37199
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold", children: t("game.goal") + ":" }),
37185
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: entity.goalCondition })
37200
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: resolved.goalCondition })
37186
37201
  ] })
37187
37202
  ] }),
37188
37203
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
@@ -37213,12 +37228,12 @@ function EventHandlerBoard({
37213
37228
  }
37214
37229
  ),
37215
37230
  eventLog.length > 0 && /* @__PURE__ */ jsx(EventLog, { entries: eventLog }),
37216
- playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: entity.successMessage || t("eventHandler.chainComplete") }) }),
37231
+ playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: resolved.successMessage || t("eventHandler.chainComplete") }) }),
37217
37232
  playState === "fail" && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
37218
37233
  /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(encourageKey) }) }),
37219
37234
  showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
37220
37235
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
37221
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
37236
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
37222
37237
  ] }) })
37223
37238
  ] }),
37224
37239
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
@@ -40339,19 +40354,20 @@ function NegotiatorBoard({
40339
40354
  }) {
40340
40355
  const { emit } = useEventBus();
40341
40356
  const { t } = useTranslate();
40357
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
40342
40358
  const [history, setHistory] = useState([]);
40343
40359
  const [headerError, setHeaderError] = useState(false);
40344
40360
  const [showHint, setShowHint] = useState(false);
40345
40361
  const currentRound = history.length;
40346
- const isComplete = currentRound >= entity.totalRounds;
40362
+ const isComplete = currentRound >= (resolved?.totalRounds ?? 0);
40347
40363
  const playerTotal = history.reduce((s, r) => s + r.playerPayoff, 0);
40348
40364
  const opponentTotal = history.reduce((s, r) => s + r.opponentPayoff, 0);
40349
- const won = isComplete && playerTotal >= entity.targetScore;
40350
- const actions = entity?.actions ?? [];
40351
- const payoffMatrix = entity?.payoffMatrix ?? [];
40365
+ const won = isComplete && playerTotal >= (resolved?.targetScore ?? 0);
40366
+ const actions = resolved?.actions ?? [];
40367
+ const payoffMatrix = resolved?.payoffMatrix ?? [];
40352
40368
  const handleAction = useCallback((actionId) => {
40353
40369
  if (isComplete) return;
40354
- const opponentAction = getOpponentAction(entity.opponentStrategy, actions, history);
40370
+ const opponentAction = getOpponentAction(resolved?.opponentStrategy ?? "random", actions, history);
40355
40371
  const payoff = payoffMatrix.find(
40356
40372
  (p2) => p2.playerAction === actionId && p2.opponentAction === opponentAction
40357
40373
  );
@@ -40364,41 +40380,42 @@ function NegotiatorBoard({
40364
40380
  };
40365
40381
  const newHistory = [...history, result];
40366
40382
  setHistory(newHistory);
40367
- if (newHistory.length >= entity.totalRounds) {
40383
+ if (newHistory.length >= (resolved?.totalRounds ?? 0)) {
40368
40384
  const total = newHistory.reduce((s, r) => s + r.playerPayoff, 0);
40369
- if (total >= entity.targetScore) {
40385
+ if (total >= (resolved?.targetScore ?? 0)) {
40370
40386
  emit(`UI:${completeEvent}`, { success: true, score: total });
40371
40387
  }
40372
- if (newHistory.length >= 3 && entity.hint) {
40388
+ if (newHistory.length >= 3 && resolved?.hint) {
40373
40389
  setShowHint(true);
40374
40390
  }
40375
40391
  }
40376
- }, [isComplete, entity, actions, payoffMatrix, history, currentRound, completeEvent, emit]);
40392
+ }, [isComplete, resolved, actions, payoffMatrix, history, currentRound, completeEvent, emit]);
40377
40393
  const handleReset = () => {
40378
40394
  setHistory([]);
40379
40395
  setShowHint(false);
40380
40396
  };
40381
40397
  const getActionLabel = (id) => actions.find((a) => a.id === id)?.label ?? id;
40398
+ if (!resolved) return null;
40382
40399
  return /* @__PURE__ */ jsx(
40383
40400
  Box,
40384
40401
  {
40385
40402
  className,
40386
40403
  style: {
40387
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
40404
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
40388
40405
  backgroundSize: "cover",
40389
40406
  backgroundPosition: "center"
40390
40407
  },
40391
40408
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
40392
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
40409
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
40393
40410
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
40394
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
40395
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description }),
40411
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
40412
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description }),
40396
40413
  /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
40397
- /* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(entity.totalRounds) }) }),
40414
+ /* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(resolved.totalRounds) }) }),
40398
40415
  /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
40399
40416
  t("negotiator.target"),
40400
40417
  ": ",
40401
- entity.targetScore
40418
+ resolved.targetScore
40402
40419
  ] })
40403
40420
  ] })
40404
40421
  ] }) }),
@@ -40447,16 +40464,16 @@ function NegotiatorBoard({
40447
40464
  ] }) }),
40448
40465
  isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
40449
40466
  /* @__PURE__ */ jsx(Icon, { icon: CheckCircle, size: "lg", className: won ? "text-success" : "text-error" }),
40450
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? entity.successMessage ?? t("negotiator.success") : entity.failMessage ?? t("negotiator.failed") }),
40467
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? resolved.successMessage ?? t("negotiator.success") : resolved.failMessage ?? t("negotiator.failed") }),
40451
40468
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
40452
40469
  t("negotiator.finalScore"),
40453
40470
  ": ",
40454
40471
  playerTotal,
40455
40472
  "/",
40456
- entity.targetScore
40473
+ resolved.targetScore
40457
40474
  ] })
40458
40475
  ] }) }),
40459
- showHint && entity.hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
40476
+ showHint && resolved.hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
40460
40477
  isComplete && !won && /* @__PURE__ */ jsx(HStack, { justify: "center", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleReset, children: t("negotiator.playAgain") }) })
40461
40478
  ] })
40462
40479
  }
@@ -43230,15 +43247,16 @@ function SequencerBoard({
43230
43247
  }) {
43231
43248
  const { emit } = useEventBus();
43232
43249
  const { t } = useTranslate();
43250
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
43233
43251
  const [headerError, setHeaderError] = useState(false);
43234
43252
  const [slots, setSlots] = useState(
43235
- () => Array.from({ length: entity.maxSlots }, () => void 0)
43253
+ () => Array.from({ length: resolved?.maxSlots ?? 0 }, () => void 0)
43236
43254
  );
43237
43255
  const [playState, setPlayState] = useState("idle");
43238
43256
  const [currentStep, setCurrentStep] = useState(-1);
43239
43257
  const [attempts, setAttempts] = useState(0);
43240
43258
  const [slotFeedback, setSlotFeedback] = useState(
43241
- () => Array.from({ length: entity.maxSlots }, () => null)
43259
+ () => Array.from({ length: resolved?.maxSlots ?? 0 }, () => null)
43242
43260
  );
43243
43261
  const timerRef = useRef(null);
43244
43262
  useEffect(() => () => {
@@ -43272,17 +43290,17 @@ function SequencerBoard({
43272
43290
  }, [emit]);
43273
43291
  const handleReset = useCallback(() => {
43274
43292
  if (timerRef.current) clearTimeout(timerRef.current);
43275
- setSlots(Array.from({ length: entity.maxSlots }, () => void 0));
43293
+ setSlots(Array.from({ length: resolved?.maxSlots ?? 0 }, () => void 0));
43276
43294
  setPlayState("idle");
43277
43295
  setCurrentStep(-1);
43278
43296
  setAttempts(0);
43279
- setSlotFeedback(Array.from({ length: entity.maxSlots }, () => null));
43280
- }, [entity.maxSlots]);
43297
+ setSlotFeedback(Array.from({ length: resolved?.maxSlots ?? 0 }, () => null));
43298
+ }, [resolved?.maxSlots]);
43281
43299
  const filledSlots = slots.filter((s) => !!s);
43282
43300
  const canPlay = filledSlots.length > 0 && playState === "idle";
43283
43301
  const handlePlay = useCallback(() => {
43284
43302
  if (!canPlay) return;
43285
- setSlotFeedback(Array.from({ length: entity.maxSlots }, () => null));
43303
+ setSlotFeedback(Array.from({ length: resolved?.maxSlots ?? 0 }, () => null));
43286
43304
  emit("UI:PLAY_SOUND", { key: "confirm" });
43287
43305
  const sequence = slots.map((s) => s?.id || "");
43288
43306
  if (playEvent) {
@@ -43293,10 +43311,10 @@ function SequencerBoard({
43293
43311
  let step = 0;
43294
43312
  const advance = () => {
43295
43313
  step++;
43296
- if (step >= entity.maxSlots) {
43314
+ if (step >= (resolved?.maxSlots ?? 0)) {
43297
43315
  const playerSeq = slots.map((s) => s?.id);
43298
43316
  const playerIds = slots.filter(Boolean).map((s) => s?.id || "");
43299
- const success = entity.solutions.some(
43317
+ const success = (resolved?.solutions ?? []).some(
43300
43318
  (sol) => sol.length === playerIds.length && sol.every((id, i) => id === playerIds[i])
43301
43319
  );
43302
43320
  if (success) {
@@ -43308,7 +43326,7 @@ function SequencerBoard({
43308
43326
  }
43309
43327
  } else {
43310
43328
  setAttempts((prev) => prev + 1);
43311
- const feedback = computeSlotFeedback(playerSeq, entity.solutions);
43329
+ const feedback = computeSlotFeedback(playerSeq, resolved?.solutions ?? []);
43312
43330
  setSlotFeedback(feedback);
43313
43331
  setPlayState("idle");
43314
43332
  setCurrentStep(-1);
@@ -43326,10 +43344,10 @@ function SequencerBoard({
43326
43344
  }
43327
43345
  };
43328
43346
  timerRef.current = setTimeout(advance, stepDurationMs);
43329
- }, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
43347
+ }, [canPlay, slots, resolved?.maxSlots, resolved?.solutions, stepDurationMs, playEvent, completeEvent, emit]);
43330
43348
  const machine = {
43331
- name: entity.title,
43332
- description: entity.description,
43349
+ name: resolved?.title ?? "",
43350
+ description: resolved?.description ?? "",
43333
43351
  states: slots.map((s, i) => stepLabel(s, i)),
43334
43352
  currentState: currentStep >= 0 ? stepLabel(slots[currentStep], currentStep) : "__idle__",
43335
43353
  transitions: slots.slice(0, -1).map((s, i) => ({
@@ -43338,36 +43356,37 @@ function SequencerBoard({
43338
43356
  event: "NEXT"
43339
43357
  }))
43340
43358
  };
43341
- const usedIds = entity.allowDuplicates === false ? slots.filter(Boolean).map((s) => s?.id || "") : [];
43342
- const showHint = attempts >= 3 && !!entity.hint;
43359
+ const usedIds = resolved?.allowDuplicates === false ? slots.filter(Boolean).map((s) => s?.id || "") : [];
43360
+ const showHint = attempts >= 3 && !!resolved?.hint;
43343
43361
  const hasFeedback = slotFeedback.some((f3) => f3 !== null);
43344
43362
  const correctCount = slotFeedback.filter((f3) => f3 === "correct").length;
43345
43363
  const encourageKey = ENCOURAGEMENT_KEYS2[Math.min(attempts - 1, ENCOURAGEMENT_KEYS2.length - 1)] ?? ENCOURAGEMENT_KEYS2[0];
43364
+ if (!resolved) return null;
43346
43365
  return /* @__PURE__ */ jsxs(
43347
43366
  VStack,
43348
43367
  {
43349
43368
  className: cn("p-4 gap-6", className),
43350
43369
  style: {
43351
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
43370
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
43352
43371
  backgroundSize: "cover",
43353
43372
  backgroundPosition: "center"
43354
43373
  },
43355
43374
  children: [
43356
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
43375
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
43357
43376
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
43358
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
43359
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description })
43377
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
43378
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description })
43360
43379
  ] }),
43361
43380
  showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
43362
43381
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
43363
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
43382
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
43364
43383
  ] }) }),
43365
43384
  filledSlots.length > 0 && /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "linear", size: "md" }),
43366
43385
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
43367
43386
  /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
43368
43387
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("sequencer.yourSequence") + ":" }),
43369
43388
  hasFeedback && playState === "idle" && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
43370
- `${correctCount}/${entity.maxSlots} `,
43389
+ `${correctCount}/${resolved.maxSlots} `,
43371
43390
  "\u2705"
43372
43391
  ] })
43373
43392
  ] }),
@@ -43375,7 +43394,7 @@ function SequencerBoard({
43375
43394
  SequenceBar,
43376
43395
  {
43377
43396
  slots,
43378
- maxSlots: entity.maxSlots,
43397
+ maxSlots: resolved.maxSlots,
43379
43398
  onSlotDrop: handleSlotDrop,
43380
43399
  onSlotRemove: handleSlotRemove,
43381
43400
  playing: playState === "playing",
@@ -43389,15 +43408,15 @@ function SequencerBoard({
43389
43408
  playState !== "playing" && /* @__PURE__ */ jsx(
43390
43409
  ActionPalette,
43391
43410
  {
43392
- actions: entity.availableActions,
43411
+ actions: resolved.availableActions,
43393
43412
  usedActionIds: usedIds,
43394
- allowDuplicates: entity.allowDuplicates !== false,
43413
+ allowDuplicates: resolved.allowDuplicates !== false,
43395
43414
  categoryColors,
43396
43415
  label: t("sequencer.dragActions")
43397
43416
  }
43398
43417
  ),
43399
43418
  hasFeedback && playState === "idle" && attempts > 0 && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: t(encourageKey) }) }),
43400
- playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: entity.successMessage || t("sequencer.levelComplete") }) }),
43419
+ playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: resolved.successMessage || t("sequencer.levelComplete") }) }),
43401
43420
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
43402
43421
  /* @__PURE__ */ jsx(
43403
43422
  Button,
@@ -44220,7 +44239,8 @@ function SimulatorBoard({
44220
44239
  }) {
44221
44240
  const { emit } = useEventBus();
44222
44241
  const { t } = useTranslate();
44223
- const parameters = entity?.parameters ?? [];
44242
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
44243
+ const parameters = resolved?.parameters ?? [];
44224
44244
  const [values, setValues] = useState(() => {
44225
44245
  const init = {};
44226
44246
  for (const p2 of parameters) {
@@ -44234,15 +44254,15 @@ function SimulatorBoard({
44234
44254
  const [showHint, setShowHint] = useState(false);
44235
44255
  const computeOutput = useCallback((params) => {
44236
44256
  try {
44237
- const fn = new Function("params", `return (${entity.computeExpression})`);
44257
+ const fn = new Function("params", `return (${resolved?.computeExpression})`);
44238
44258
  return fn(params);
44239
44259
  } catch {
44240
44260
  return 0;
44241
44261
  }
44242
- }, [entity.computeExpression]);
44262
+ }, [resolved?.computeExpression]);
44243
44263
  const output = useMemo(() => computeOutput(values) ?? 0, [computeOutput, values]);
44244
- const targetValue = entity?.targetValue ?? 0;
44245
- const targetTolerance = entity?.targetTolerance ?? 0;
44264
+ const targetValue = resolved?.targetValue ?? 0;
44265
+ const targetTolerance = resolved?.targetTolerance ?? 0;
44246
44266
  const isCorrect = Math.abs(output - targetValue) <= targetTolerance;
44247
44267
  const handleParameterChange = (id, value) => {
44248
44268
  if (submitted) return;
@@ -44257,7 +44277,7 @@ function SimulatorBoard({
44257
44277
  };
44258
44278
  const handleReset = () => {
44259
44279
  setSubmitted(false);
44260
- if (attempts >= 2 && entity.hint) {
44280
+ if (attempts >= 2 && resolved?.hint) {
44261
44281
  setShowHint(true);
44262
44282
  }
44263
44283
  };
@@ -44271,20 +44291,21 @@ function SimulatorBoard({
44271
44291
  setAttempts(0);
44272
44292
  setShowHint(false);
44273
44293
  };
44294
+ if (!resolved) return null;
44274
44295
  return /* @__PURE__ */ jsx(
44275
44296
  Box,
44276
44297
  {
44277
44298
  className,
44278
44299
  style: {
44279
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
44300
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
44280
44301
  backgroundSize: "cover",
44281
44302
  backgroundPosition: "center"
44282
44303
  },
44283
44304
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
44284
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
44305
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
44285
44306
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
44286
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
44287
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
44307
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
44308
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
44288
44309
  ] }) }),
44289
44310
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
44290
44311
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("simulator.parameters") }),
@@ -44325,28 +44346,28 @@ function SimulatorBoard({
44325
44346
  ] }, param.id))
44326
44347
  ] }) }),
44327
44348
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
44328
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: entity.outputLabel }),
44349
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: resolved.outputLabel }),
44329
44350
  /* @__PURE__ */ jsxs(Typography, { variant: "h3", weight: "bold", children: [
44330
44351
  output.toFixed(2),
44331
44352
  " ",
44332
- entity.outputUnit
44353
+ resolved.outputUnit
44333
44354
  ] }),
44334
44355
  submitted && /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
44335
44356
  /* @__PURE__ */ jsx(Icon, { icon: isCorrect ? CheckCircle : XCircle, size: "sm", className: isCorrect ? "text-success" : "text-error" }),
44336
- /* @__PURE__ */ jsx(Typography, { variant: "body", className: isCorrect ? "text-success" : "text-error", children: isCorrect ? entity.successMessage ?? t("simulator.correct") : entity.failMessage ?? t("simulator.incorrect") })
44357
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: isCorrect ? "text-success" : "text-error", children: isCorrect ? resolved.successMessage ?? t("simulator.correct") : resolved.failMessage ?? t("simulator.incorrect") })
44337
44358
  ] }),
44338
44359
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
44339
44360
  t("simulator.target"),
44340
44361
  ": ",
44341
44362
  targetValue,
44342
44363
  " ",
44343
- entity?.outputUnit ?? "",
44364
+ resolved.outputUnit,
44344
44365
  " (\xB1",
44345
44366
  targetTolerance,
44346
44367
  ")"
44347
44368
  ] })
44348
44369
  ] }) }),
44349
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
44370
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
44350
44371
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
44351
44372
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, children: [
44352
44373
  /* @__PURE__ */ jsx(Icon, { icon: Play, size: "sm" }),
@@ -44926,13 +44947,14 @@ function StateArchitectBoard({
44926
44947
  }) {
44927
44948
  const { emit } = useEventBus();
44928
44949
  const { t } = useTranslate();
44929
- const [transitions, setTransitions] = useState(entity.transitions);
44950
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
44951
+ const [transitions, setTransitions] = useState(resolved?.transitions ?? []);
44930
44952
  const [headerError, setHeaderError] = useState(false);
44931
44953
  const [playState, setPlayState] = useState("editing");
44932
- const [currentState, setCurrentState] = useState(entity.initialState);
44954
+ const [currentState, setCurrentState] = useState(resolved?.initialState ?? "");
44933
44955
  const [selectedState, setSelectedState] = useState(null);
44934
44956
  const [testResults, setTestResults] = useState([]);
44935
- const [variables, setVariables] = useState(entity.variables);
44957
+ const [variables, setVariables] = useState(resolved?.variables ?? []);
44936
44958
  const [attempts, setAttempts] = useState(0);
44937
44959
  const timerRef = useRef(null);
44938
44960
  const [addingFrom, setAddingFrom] = useState(null);
@@ -44941,12 +44963,12 @@ function StateArchitectBoard({
44941
44963
  }, []);
44942
44964
  const GRAPH_W = 500;
44943
44965
  const GRAPH_H = 400;
44944
- const positions = useMemo(() => layoutStates(entity.states, GRAPH_W, GRAPH_H), [entity.states]);
44966
+ const positions = useMemo(() => layoutStates(resolved?.states ?? [], GRAPH_W, GRAPH_H), [resolved?.states]);
44945
44967
  const handleStateClick = useCallback((state) => {
44946
44968
  if (playState !== "editing") return;
44947
44969
  if (addingFrom) {
44948
44970
  if (addingFrom !== state) {
44949
- const event = entity.availableEvents[0] || "EVENT";
44971
+ const event = resolved?.availableEvents[0] || "EVENT";
44950
44972
  const newTrans = {
44951
44973
  id: `t-${nextTransId++}`,
44952
44974
  from: addingFrom,
@@ -44959,7 +44981,7 @@ function StateArchitectBoard({
44959
44981
  } else {
44960
44982
  setSelectedState(state);
44961
44983
  }
44962
- }, [playState, addingFrom, entity.availableEvents]);
44984
+ }, [playState, addingFrom, resolved?.availableEvents]);
44963
44985
  const handleStartAddTransition = useCallback(() => {
44964
44986
  if (!selectedState) return;
44965
44987
  setAddingFrom(selectedState);
@@ -44968,9 +44990,9 @@ function StateArchitectBoard({
44968
44990
  setTransitions((prev) => prev.filter((t2) => t2.id !== transId));
44969
44991
  }, []);
44970
44992
  const machine = useMemo(() => ({
44971
- name: entity.entityName,
44972
- description: entity.description,
44973
- states: entity.states,
44993
+ name: resolved?.entityName ?? "",
44994
+ description: resolved?.description ?? "",
44995
+ states: resolved?.states ?? [],
44974
44996
  currentState,
44975
44997
  transitions: transitions.map((t2) => ({
44976
44998
  from: t2.from,
@@ -44978,7 +45000,7 @@ function StateArchitectBoard({
44978
45000
  event: t2.event,
44979
45001
  guardHint: t2.guardHint
44980
45002
  }))
44981
- }), [entity, currentState, transitions]);
45003
+ }), [resolved, currentState, transitions]);
44982
45004
  const handleTest = useCallback(() => {
44983
45005
  if (playState !== "editing") return;
44984
45006
  if (testEvent) emit(`UI:${testEvent}`, {});
@@ -44987,7 +45009,7 @@ function StateArchitectBoard({
44987
45009
  const results = [];
44988
45010
  let testIdx = 0;
44989
45011
  const runNextTest = () => {
44990
- if (testIdx >= entity.testCases.length) {
45012
+ if (testIdx >= (resolved?.testCases.length ?? 0)) {
44991
45013
  const allPassed = results.every((r) => r.passed);
44992
45014
  setPlayState(allPassed ? "success" : "fail");
44993
45015
  setTestResults(results);
@@ -45002,8 +45024,9 @@ function StateArchitectBoard({
45002
45024
  }
45003
45025
  return;
45004
45026
  }
45005
- const testCase = entity.testCases[testIdx];
45006
- let state = entity.initialState;
45027
+ const testCase = resolved?.testCases[testIdx];
45028
+ if (!testCase) return;
45029
+ let state = resolved.initialState;
45007
45030
  for (const event of testCase.events) {
45008
45031
  const trans = transitions.find((t2) => t2.from === state && t2.event === event);
45009
45032
  if (trans) {
@@ -45021,52 +45044,53 @@ function StateArchitectBoard({
45021
45044
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
45022
45045
  };
45023
45046
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
45024
- }, [playState, transitions, entity, stepDurationMs, testEvent, completeEvent, emit]);
45047
+ }, [playState, transitions, resolved, stepDurationMs, testEvent, completeEvent, emit]);
45025
45048
  const handleTryAgain = useCallback(() => {
45026
45049
  if (timerRef.current) clearTimeout(timerRef.current);
45027
45050
  setPlayState("editing");
45028
- setCurrentState(entity.initialState);
45051
+ setCurrentState(resolved?.initialState ?? "");
45029
45052
  setTestResults([]);
45030
- }, [entity.initialState]);
45053
+ }, [resolved?.initialState]);
45031
45054
  const handleReset = useCallback(() => {
45032
45055
  if (timerRef.current) clearTimeout(timerRef.current);
45033
- setTransitions(entity.transitions);
45056
+ setTransitions(resolved?.transitions ?? []);
45034
45057
  setPlayState("editing");
45035
- setCurrentState(entity.initialState);
45058
+ setCurrentState(resolved?.initialState ?? "");
45036
45059
  setTestResults([]);
45037
- setVariables(entity.variables);
45060
+ setVariables(resolved?.variables ?? []);
45038
45061
  setSelectedState(null);
45039
45062
  setAddingFrom(null);
45040
45063
  setAttempts(0);
45041
- }, [entity]);
45064
+ }, [resolved]);
45042
45065
  const codeData = useMemo(() => ({
45043
- name: entity.entityName,
45044
- states: entity.states,
45045
- initialState: entity.initialState,
45066
+ name: resolved?.entityName ?? "",
45067
+ states: resolved?.states ?? [],
45068
+ initialState: resolved?.initialState ?? "",
45046
45069
  transitions: transitions.map((t2) => ({
45047
45070
  from: t2.from,
45048
45071
  to: t2.to,
45049
45072
  event: t2.event,
45050
45073
  ...t2.guardHint ? { guard: t2.guardHint } : {}
45051
45074
  }))
45052
- }), [entity, transitions]);
45075
+ }), [resolved, transitions]);
45076
+ if (!resolved) return null;
45053
45077
  return /* @__PURE__ */ jsxs(
45054
45078
  VStack,
45055
45079
  {
45056
45080
  className: cn("p-4 gap-6", className),
45057
45081
  style: {
45058
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
45082
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
45059
45083
  backgroundSize: "cover",
45060
45084
  backgroundPosition: "center"
45061
45085
  },
45062
45086
  children: [
45063
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
45087
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
45064
45088
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
45065
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
45066
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description }),
45089
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
45090
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description }),
45067
45091
  /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-warning/10 border border-warning/30", gap: "xs", children: [
45068
45092
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-warning font-bold", children: t("game.hint") + ":" }),
45069
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: entity.hint })
45093
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: resolved.hint })
45070
45094
  ] })
45071
45095
  ] }),
45072
45096
  /* @__PURE__ */ jsxs(HStack, { className: "flex-wrap items-start", gap: "lg", children: [
@@ -45114,14 +45138,14 @@ function StateArchitectBoard({
45114
45138
  ]
45115
45139
  }
45116
45140
  ),
45117
- entity.states.map((state) => /* @__PURE__ */ jsx(
45141
+ resolved.states.map((state) => /* @__PURE__ */ jsx(
45118
45142
  StateNode2,
45119
45143
  {
45120
45144
  name: state,
45121
45145
  position: positions[state],
45122
45146
  isCurrent: state === currentState,
45123
45147
  isSelected: state === selectedState,
45124
- isInitial: state === entity.initialState,
45148
+ isInitial: state === resolved.initialState,
45125
45149
  onClick: () => handleStateClick(state)
45126
45150
  },
45127
45151
  state
@@ -45168,7 +45192,7 @@ function StateArchitectBoard({
45168
45192
  /* @__PURE__ */ jsx(
45169
45193
  VariablePanel,
45170
45194
  {
45171
- entityName: entity.entityName,
45195
+ entityName: resolved.entityName,
45172
45196
  variables
45173
45197
  }
45174
45198
  ),
@@ -45180,15 +45204,15 @@ function StateArchitectBoard({
45180
45204
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
45181
45205
  ] }, i))
45182
45206
  ] }),
45183
- entity.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
45207
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
45184
45208
  ] })
45185
45209
  ] }),
45186
- playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: entity.successMessage || t("stateArchitect.allPassed") }) }),
45210
+ playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: resolved.successMessage || t("stateArchitect.allPassed") }) }),
45187
45211
  playState === "fail" && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
45188
45212
  /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(ENCOURAGEMENT_KEYS3[Math.min(attempts - 1, ENCOURAGEMENT_KEYS3.length - 1)] ?? ENCOURAGEMENT_KEYS3[0]) }) }),
45189
- attempts >= 3 && entity.hint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
45213
+ attempts >= 3 && resolved.hint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
45190
45214
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
45191
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
45215
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
45192
45216
  ] }) })
45193
45217
  ] }),
45194
45218
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
@@ -46044,8 +46068,9 @@ var init_useBattleState = __esm({
46044
46068
  }
46045
46069
  });
46046
46070
  function UncontrolledBattleBoard({ entity, ...rest }) {
46071
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
46047
46072
  const battleState = useBattleState(
46048
- entity.initialUnits,
46073
+ resolved?.initialUnits ?? [],
46049
46074
  {
46050
46075
  tileClickEvent: rest.tileClickEvent,
46051
46076
  unitClickEvent: rest.unitClickEvent,
@@ -46062,12 +46087,13 @@ function UncontrolledBattleBoard({ entity, ...rest }) {
46062
46087
  calculateDamage: rest.calculateDamage
46063
46088
  }
46064
46089
  );
46090
+ if (!resolved) return null;
46065
46091
  return /* @__PURE__ */ jsx(
46066
46092
  BattleBoard,
46067
46093
  {
46068
46094
  ...rest,
46069
46095
  entity: {
46070
- ...entity,
46096
+ ...resolved,
46071
46097
  units: battleState.units,
46072
46098
  phase: battleState.phase,
46073
46099
  turn: battleState.turn,
@@ -46770,6 +46796,7 @@ var init_component_registry_generated = __esm({
46770
46796
  init_StatsOrganism();
46771
46797
  init_StatusDot();
46772
46798
  init_StatusEffect();
46799
+ init_StepFlow();
46773
46800
  init_StepFlowOrganism();
46774
46801
  init_SvgBranch();
46775
46802
  init_SvgConnection();
@@ -47088,6 +47115,7 @@ var init_component_registry_generated = __esm({
47088
47115
  "StatsOrganism": StatsOrganism,
47089
47116
  "StatusDot": StatusDot,
47090
47117
  "StatusEffect": StatusEffect,
47118
+ "StepFlow": StepFlow,
47091
47119
  "StepFlowOrganism": StepFlowOrganism,
47092
47120
  "SvgBranch": SvgBranch,
47093
47121
  "SvgConnection": SvgConnection,
@@ -47813,6 +47841,16 @@ function SlotContentRenderer({
47813
47841
  );
47814
47842
  }
47815
47843
  }
47844
+ if (propsSchema) {
47845
+ for (const [propKey, propDef] of Object.entries(propsSchema)) {
47846
+ const v = renderedProps[propKey];
47847
+ if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
47848
+ (t) => t === "date" || t === "datetime" || t === "timestamp"
47849
+ )) {
47850
+ renderedProps[propKey] = new Date(v);
47851
+ }
47852
+ }
47853
+ }
47816
47854
  const finalProps = renderedProps;
47817
47855
  const resolvedItems = Array.isArray(
47818
47856
  finalProps.entity