@almadar/ui 5.86.0 → 5.87.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.
Files changed (34) hide show
  1. package/dist/avl/index.cjs +3349 -1250
  2. package/dist/avl/index.js +2399 -300
  3. package/dist/components/game/2d/molecules/index.d.ts +23 -15
  4. package/dist/components/game/2d/organisms/BuilderBoard.d.ts +60 -0
  5. package/dist/components/game/2d/organisms/ClassifierBoard.d.ts +66 -0
  6. package/dist/components/game/2d/organisms/DebuggerBoard.d.ts +61 -0
  7. package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +42 -0
  8. package/dist/components/game/2d/organisms/NegotiatorBoard.d.ts +56 -0
  9. package/dist/components/game/2d/{molecules → organisms}/SequenceBar.d.ts +3 -8
  10. package/dist/components/game/2d/organisms/SequencerBoard.d.ts +69 -0
  11. package/dist/components/game/2d/organisms/SimulatorBoard.d.ts +58 -0
  12. package/dist/components/game/2d/organisms/StateArchitectBoard.d.ts +61 -0
  13. package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
  14. package/dist/components/index.cjs +2972 -1243
  15. package/dist/components/index.js +2004 -283
  16. package/dist/providers/index.cjs +3209 -1110
  17. package/dist/providers/index.js +2368 -269
  18. package/dist/runtime/index.cjs +3205 -1106
  19. package/dist/runtime/index.js +2374 -275
  20. package/package.json +1 -1
  21. /package/dist/components/game/2d/{molecules → organisms}/ActionPalette.d.ts +0 -0
  22. /package/dist/components/game/2d/{molecules → organisms}/ActionTile.d.ts +0 -0
  23. /package/dist/components/game/2d/{molecules → organisms}/EventLog.d.ts +0 -0
  24. /package/dist/components/game/2d/{molecules → organisms}/ObjectRulePanel.d.ts +0 -0
  25. /package/dist/components/game/2d/{molecules → organisms}/RuleEditor.d.ts +0 -0
  26. /package/dist/components/game/2d/{molecules → organisms}/SimulationCanvas.d.ts +0 -0
  27. /package/dist/components/game/2d/{molecules → organisms}/SimulationControls.d.ts +0 -0
  28. /package/dist/components/game/2d/{molecules → organisms}/SimulationGraph.d.ts +0 -0
  29. /package/dist/components/game/2d/{molecules → organisms}/StateJsonView.d.ts +0 -0
  30. /package/dist/components/game/2d/{molecules → organisms}/StateNode.d.ts +0 -0
  31. /package/dist/components/game/2d/{molecules → organisms}/TraitSlot.d.ts +0 -0
  32. /package/dist/components/game/2d/{molecules → organisms}/TraitStateViewer.d.ts +0 -0
  33. /package/dist/components/game/2d/{molecules → organisms}/TransitionArrow.d.ts +0 -0
  34. /package/dist/components/game/2d/{molecules → organisms}/VariablePanel.d.ts +0 -0
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import * as React72 from 'react';
3
- import React72__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, useState, Suspense, lazy, useLayoutEffect, useId, useSyncExternalStore } from 'react';
2
+ import * as React74 from 'react';
3
+ import React74__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, useState, Suspense, lazy, useLayoutEffect, useId, useSyncExternalStore } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, useCurrentPagePath, useEntitySchemaOptional, TraitScopeProvider } from '@almadar/ui/providers';
7
7
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
8
8
  import * as LucideIcons2 from 'lucide-react';
9
- import { X, List, Printer, ChevronRight, ChevronLeft, RotateCcw, Play, Terminal, CheckCircle, XCircle, ChevronDown, Pause, SkipForward, Search, ChevronUp, MoreHorizontal, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, Loader2, Code, FileText, WrapText, Check, Copy, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, GitBranch, Plus, ArrowRight, Trash, ArrowLeft, Menu as Menu$1, AlertTriangle, Trash2, Eraser, ZoomOut, Download, Lightbulb, PauseCircle, Link2, Tag, User, DollarSign } from 'lucide-react';
9
+ import { X, List, Printer, ChevronRight, ChevronLeft, CheckCircle, XCircle, Wrench, RotateCcw, Send, Play, Terminal, ChevronDown, Bug, ArrowRight, Pause, SkipForward, Search, ChevronUp, MoreHorizontal, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, Loader2, Code, FileText, WrapText, Check, Copy, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, GitBranch, Plus, Trash, ArrowLeft, Menu as Menu$1, AlertTriangle, Trash2, Eraser, ZoomOut, Download, Lightbulb, PauseCircle, Link2, Tag, User, DollarSign } from 'lucide-react';
10
10
  import { useTranslate } from '@almadar/ui/hooks';
11
11
  import { useUISlots, useTheme } from '@almadar/ui/context';
12
12
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
@@ -227,7 +227,7 @@ var init_SvgFlow = __esm({
227
227
  width = 100,
228
228
  height = 100
229
229
  }) => {
230
- const markerId = React72__default.useMemo(() => {
230
+ const markerId = React74__default.useMemo(() => {
231
231
  flowIdCounter += 1;
232
232
  return `almadar-flow-arrow-${flowIdCounter}`;
233
233
  }, []);
@@ -820,7 +820,7 @@ var init_SvgRing = __esm({
820
820
  width = 100,
821
821
  height = 100
822
822
  }) => {
823
- const gradientId = React72__default.useMemo(() => {
823
+ const gradientId = React74__default.useMemo(() => {
824
824
  ringIdCounter += 1;
825
825
  return `almadar-ring-glow-${ringIdCounter}`;
826
826
  }, []);
@@ -1232,7 +1232,7 @@ function loadLib(key, importer) {
1232
1232
  return p;
1233
1233
  }
1234
1234
  function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
1235
- const Lazy = React72__default.lazy(async () => {
1235
+ const Lazy = React74__default.lazy(async () => {
1236
1236
  const lib = await loadLib(libKey, importer);
1237
1237
  const Comp = pick(lib);
1238
1238
  if (!Comp) {
@@ -1242,7 +1242,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
1242
1242
  return { default: Comp };
1243
1243
  });
1244
1244
  const Wrapped = (props) => /* @__PURE__ */ jsx(
1245
- React72__default.Suspense,
1245
+ React74__default.Suspense,
1246
1246
  {
1247
1247
  fallback: /* @__PURE__ */ jsx(
1248
1248
  "span",
@@ -1973,7 +1973,7 @@ var init_Icon = __esm({
1973
1973
  const directIcon = typeof icon === "string" ? void 0 : icon;
1974
1974
  const effectiveName = typeof icon === "string" ? icon : name;
1975
1975
  const family = useIconFamily();
1976
- const RenderedComponent = React72__default.useMemo(() => {
1976
+ const RenderedComponent = React74__default.useMemo(() => {
1977
1977
  if (directIcon) return null;
1978
1978
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1979
1979
  }, [directIcon, effectiveName, family]);
@@ -2035,7 +2035,7 @@ function resolveIconProp(value, sizeClass) {
2035
2035
  const IconComp = value;
2036
2036
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
2037
2037
  }
2038
- if (React72__default.isValidElement(value)) {
2038
+ if (React74__default.isValidElement(value)) {
2039
2039
  return value;
2040
2040
  }
2041
2041
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -2111,7 +2111,7 @@ var init_Button = __esm({
2111
2111
  md: "h-icon-default w-icon-default",
2112
2112
  lg: "h-icon-default w-icon-default"
2113
2113
  };
2114
- Button = React72__default.forwardRef(
2114
+ Button = React74__default.forwardRef(
2115
2115
  ({
2116
2116
  className,
2117
2117
  variant = "primary",
@@ -2181,7 +2181,7 @@ var init_Input = __esm({
2181
2181
  init_cn();
2182
2182
  init_Icon();
2183
2183
  init_useEventBus();
2184
- Input = React72__default.forwardRef(
2184
+ Input = React74__default.forwardRef(
2185
2185
  ({
2186
2186
  className,
2187
2187
  inputType,
@@ -2341,7 +2341,7 @@ var Label;
2341
2341
  var init_Label = __esm({
2342
2342
  "components/core/atoms/Label.tsx"() {
2343
2343
  init_cn();
2344
- Label = React72__default.forwardRef(
2344
+ Label = React74__default.forwardRef(
2345
2345
  ({ className, required, children, ...props }, ref) => {
2346
2346
  return /* @__PURE__ */ jsxs(
2347
2347
  "label",
@@ -2368,7 +2368,7 @@ var init_Textarea = __esm({
2368
2368
  "components/core/atoms/Textarea.tsx"() {
2369
2369
  init_cn();
2370
2370
  init_useEventBus();
2371
- Textarea = React72__default.forwardRef(
2371
+ Textarea = React74__default.forwardRef(
2372
2372
  ({ className, error, onChange, ...props }, ref) => {
2373
2373
  const eventBus = useEventBus();
2374
2374
  const handleChange = (e) => {
@@ -2607,7 +2607,7 @@ var init_Select = __esm({
2607
2607
  init_cn();
2608
2608
  init_Icon();
2609
2609
  init_useEventBus();
2610
- Select = React72__default.forwardRef(
2610
+ Select = React74__default.forwardRef(
2611
2611
  (props, _ref) => {
2612
2612
  const { multiple, searchable, clearable } = props;
2613
2613
  if (multiple || searchable || clearable) {
@@ -2624,7 +2624,7 @@ var init_Checkbox = __esm({
2624
2624
  "components/core/atoms/Checkbox.tsx"() {
2625
2625
  init_cn();
2626
2626
  init_useEventBus();
2627
- Checkbox = React72__default.forwardRef(
2627
+ Checkbox = React74__default.forwardRef(
2628
2628
  ({ className, label, id, onChange, ...props }, ref) => {
2629
2629
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2630
2630
  const eventBus = useEventBus();
@@ -2678,7 +2678,7 @@ var init_Spinner = __esm({
2678
2678
  md: "h-6 w-6",
2679
2679
  lg: "h-8 w-8"
2680
2680
  };
2681
- Spinner = React72__default.forwardRef(
2681
+ Spinner = React74__default.forwardRef(
2682
2682
  ({ className, size = "md", overlay, ...props }, ref) => {
2683
2683
  if (overlay) {
2684
2684
  return /* @__PURE__ */ jsx(
@@ -2768,7 +2768,7 @@ var init_Card = __esm({
2768
2768
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
2769
2769
  "tile-image-first": "p-0 overflow-hidden"
2770
2770
  };
2771
- Card = React72__default.forwardRef(
2771
+ Card = React74__default.forwardRef(
2772
2772
  ({
2773
2773
  className,
2774
2774
  variant = "bordered",
@@ -2816,9 +2816,9 @@ var init_Card = __esm({
2816
2816
  }
2817
2817
  );
2818
2818
  Card.displayName = "Card";
2819
- CardHeader = React72__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2819
+ CardHeader = React74__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2820
2820
  CardHeader.displayName = "CardHeader";
2821
- CardTitle = React72__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2821
+ CardTitle = React74__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2822
2822
  "h3",
2823
2823
  {
2824
2824
  ref,
@@ -2831,11 +2831,11 @@ var init_Card = __esm({
2831
2831
  }
2832
2832
  ));
2833
2833
  CardTitle.displayName = "CardTitle";
2834
- CardContent = React72__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2834
+ CardContent = React74__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2835
2835
  CardContent.displayName = "CardContent";
2836
2836
  CardBody = CardContent;
2837
2837
  CardBody.displayName = "CardBody";
2838
- CardFooter = React72__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2838
+ CardFooter = React74__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2839
2839
  "div",
2840
2840
  {
2841
2841
  ref,
@@ -2888,7 +2888,7 @@ var init_Badge = __esm({
2888
2888
  md: "px-2.5 py-1 text-sm",
2889
2889
  lg: "px-3 py-1.5 text-base"
2890
2890
  };
2891
- Badge = React72__default.forwardRef(
2891
+ Badge = React74__default.forwardRef(
2892
2892
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
2893
2893
  const iconSizes3 = {
2894
2894
  sm: "h-icon-default w-icon-default",
@@ -2982,7 +2982,7 @@ var init_FilterPill = __esm({
2982
2982
  md: "w-3.5 h-3.5",
2983
2983
  lg: "w-4 h-4"
2984
2984
  };
2985
- FilterPill = React72__default.forwardRef(
2985
+ FilterPill = React74__default.forwardRef(
2986
2986
  ({
2987
2987
  className,
2988
2988
  variant = "default",
@@ -3111,8 +3111,8 @@ var init_Avatar = __esm({
3111
3111
  actionPayload
3112
3112
  }) => {
3113
3113
  const eventBus = useEventBus();
3114
- const [imgFailed, setImgFailed] = React72__default.useState(false);
3115
- React72__default.useEffect(() => {
3114
+ const [imgFailed, setImgFailed] = React74__default.useState(false);
3115
+ React74__default.useEffect(() => {
3116
3116
  setImgFailed(false);
3117
3117
  }, [src]);
3118
3118
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -3364,7 +3364,7 @@ var init_Box = __esm({
3364
3364
  fixed: "fixed",
3365
3365
  sticky: "sticky"
3366
3366
  };
3367
- Box = React72__default.forwardRef(
3367
+ Box = React74__default.forwardRef(
3368
3368
  ({
3369
3369
  padding,
3370
3370
  paddingX,
@@ -3429,7 +3429,7 @@ var init_Box = __esm({
3429
3429
  onPointerDown?.(e);
3430
3430
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3431
3431
  const isClickable = action || onClick;
3432
- return React72__default.createElement(
3432
+ return React74__default.createElement(
3433
3433
  Component,
3434
3434
  {
3435
3435
  ref,
@@ -3483,7 +3483,7 @@ var init_Center = __esm({
3483
3483
  as: Component = "div"
3484
3484
  }) => {
3485
3485
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
3486
- return React72__default.createElement(Component, {
3486
+ return React74__default.createElement(Component, {
3487
3487
  className: cn(
3488
3488
  inline ? "inline-flex" : "flex",
3489
3489
  horizontal && "justify-center",
@@ -3751,7 +3751,7 @@ var init_Radio = __esm({
3751
3751
  md: "w-2.5 h-2.5",
3752
3752
  lg: "w-3 h-3"
3753
3753
  };
3754
- Radio = React72__default.forwardRef(
3754
+ Radio = React74__default.forwardRef(
3755
3755
  ({
3756
3756
  label,
3757
3757
  helperText,
@@ -3768,12 +3768,12 @@ var init_Radio = __esm({
3768
3768
  onChange,
3769
3769
  ...props
3770
3770
  }, ref) => {
3771
- const reactId = React72__default.useId();
3771
+ const reactId = React74__default.useId();
3772
3772
  const baseId = id || `radio-${reactId}`;
3773
3773
  const hasError = !!error;
3774
3774
  const eventBus = useEventBus();
3775
- const [selected, setSelected] = React72__default.useState(value);
3776
- React72__default.useEffect(() => {
3775
+ const [selected, setSelected] = React74__default.useState(value);
3776
+ React74__default.useEffect(() => {
3777
3777
  if (value !== void 0) setSelected(value);
3778
3778
  }, [value]);
3779
3779
  const pick = (next, e) => {
@@ -3955,7 +3955,7 @@ var init_Switch = __esm({
3955
3955
  "components/core/atoms/Switch.tsx"() {
3956
3956
  "use client";
3957
3957
  init_cn();
3958
- Switch = React72.forwardRef(
3958
+ Switch = React74.forwardRef(
3959
3959
  ({
3960
3960
  checked,
3961
3961
  defaultChecked = false,
@@ -3966,10 +3966,10 @@ var init_Switch = __esm({
3966
3966
  name,
3967
3967
  className
3968
3968
  }, ref) => {
3969
- const [isChecked, setIsChecked] = React72.useState(
3969
+ const [isChecked, setIsChecked] = React74.useState(
3970
3970
  checked !== void 0 ? checked : defaultChecked
3971
3971
  );
3972
- React72.useEffect(() => {
3972
+ React74.useEffect(() => {
3973
3973
  if (checked !== void 0) {
3974
3974
  setIsChecked(checked);
3975
3975
  }
@@ -4132,7 +4132,7 @@ var init_Stack = __esm({
4132
4132
  };
4133
4133
  const isHorizontal = direction === "horizontal";
4134
4134
  const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
4135
- return React72__default.createElement(
4135
+ return React74__default.createElement(
4136
4136
  Component,
4137
4137
  {
4138
4138
  className: cn(
@@ -4328,7 +4328,7 @@ var init_Typography = __esm({
4328
4328
  }) => {
4329
4329
  const variant = variantProp ?? (level ? `h${level}` : "body1");
4330
4330
  const Component = as || defaultElements[variant];
4331
- return React72__default.createElement(
4331
+ return React74__default.createElement(
4332
4332
  Component,
4333
4333
  {
4334
4334
  id,
@@ -4487,7 +4487,7 @@ var Dialog;
4487
4487
  var init_Dialog = __esm({
4488
4488
  "components/core/atoms/Dialog.tsx"() {
4489
4489
  init_cn();
4490
- Dialog = React72__default.forwardRef(
4490
+ Dialog = React74__default.forwardRef(
4491
4491
  ({
4492
4492
  role = "dialog",
4493
4493
  "aria-modal": ariaModal = true,
@@ -4513,7 +4513,7 @@ var Aside;
4513
4513
  var init_Aside = __esm({
4514
4514
  "components/core/atoms/Aside.tsx"() {
4515
4515
  init_cn();
4516
- Aside = React72__default.forwardRef(
4516
+ Aside = React74__default.forwardRef(
4517
4517
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4518
4518
  );
4519
4519
  Aside.displayName = "Aside";
@@ -4592,9 +4592,9 @@ var init_LawReferenceTooltip = __esm({
4592
4592
  className
4593
4593
  }) => {
4594
4594
  const { t } = useTranslate();
4595
- const [isVisible, setIsVisible] = React72__default.useState(false);
4596
- const timeoutRef = React72__default.useRef(null);
4597
- const triggerRef = React72__default.useRef(null);
4595
+ const [isVisible, setIsVisible] = React74__default.useState(false);
4596
+ const timeoutRef = React74__default.useRef(null);
4597
+ const triggerRef = React74__default.useRef(null);
4598
4598
  const handleMouseEnter = () => {
4599
4599
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4600
4600
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4605,7 +4605,7 @@ var init_LawReferenceTooltip = __esm({
4605
4605
  };
4606
4606
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
4607
4607
  const open = isVisible || revealed;
4608
- React72__default.useEffect(() => {
4608
+ React74__default.useEffect(() => {
4609
4609
  return () => {
4610
4610
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4611
4611
  };
@@ -4815,7 +4815,7 @@ var init_StatusDot = __esm({
4815
4815
  md: "w-2.5 h-2.5",
4816
4816
  lg: "w-3 h-3"
4817
4817
  };
4818
- StatusDot = React72__default.forwardRef(
4818
+ StatusDot = React74__default.forwardRef(
4819
4819
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4820
4820
  return /* @__PURE__ */ jsx(
4821
4821
  "span",
@@ -4869,7 +4869,7 @@ var init_TrendIndicator = __esm({
4869
4869
  down: "trending-down",
4870
4870
  flat: "arrow-right"
4871
4871
  };
4872
- TrendIndicator = React72__default.forwardRef(
4872
+ TrendIndicator = React74__default.forwardRef(
4873
4873
  ({
4874
4874
  className,
4875
4875
  value,
@@ -4936,7 +4936,7 @@ var init_RangeSlider = __esm({
4936
4936
  md: "w-4 h-4",
4937
4937
  lg: "w-5 h-5"
4938
4938
  };
4939
- RangeSlider = React72__default.forwardRef(
4939
+ RangeSlider = React74__default.forwardRef(
4940
4940
  ({
4941
4941
  className,
4942
4942
  min = 0,
@@ -5530,7 +5530,7 @@ var init_ContentSection = __esm({
5530
5530
  md: "py-16",
5531
5531
  lg: "py-24"
5532
5532
  };
5533
- ContentSection = React72__default.forwardRef(
5533
+ ContentSection = React74__default.forwardRef(
5534
5534
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5535
5535
  return /* @__PURE__ */ jsx(
5536
5536
  Box,
@@ -6064,7 +6064,7 @@ var init_AnimatedReveal = __esm({
6064
6064
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6065
6065
  "none": {}
6066
6066
  };
6067
- AnimatedReveal = React72__default.forwardRef(
6067
+ AnimatedReveal = React74__default.forwardRef(
6068
6068
  ({
6069
6069
  trigger = "scroll",
6070
6070
  animation = "fade-up",
@@ -6224,7 +6224,7 @@ var init_AnimatedGraphic = __esm({
6224
6224
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6225
6225
  "use client";
6226
6226
  init_cn();
6227
- AnimatedGraphic = React72__default.forwardRef(
6227
+ AnimatedGraphic = React74__default.forwardRef(
6228
6228
  ({
6229
6229
  src,
6230
6230
  svgContent,
@@ -6247,7 +6247,7 @@ var init_AnimatedGraphic = __esm({
6247
6247
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6248
6248
  const resolvedSvg = svgContent ?? fetchedSvg;
6249
6249
  const prevAnimateRef = useRef(animate);
6250
- const setRef = React72__default.useCallback(
6250
+ const setRef = React74__default.useCallback(
6251
6251
  (node) => {
6252
6252
  containerRef.current = node;
6253
6253
  if (typeof ref === "function") ref(node);
@@ -6920,7 +6920,7 @@ var init_ErrorBoundary = __esm({
6920
6920
  }
6921
6921
  );
6922
6922
  };
6923
- ErrorBoundary = class extends React72__default.Component {
6923
+ ErrorBoundary = class extends React74__default.Component {
6924
6924
  constructor(props) {
6925
6925
  super(props);
6926
6926
  __publicField(this, "reset", () => {
@@ -7216,7 +7216,7 @@ var init_Container = __esm({
7216
7216
  as: Component = "div"
7217
7217
  }) => {
7218
7218
  const resolvedSize = maxWidth ?? size ?? "lg";
7219
- return React72__default.createElement(
7219
+ return React74__default.createElement(
7220
7220
  Component,
7221
7221
  {
7222
7222
  className: cn(
@@ -8102,7 +8102,7 @@ function ActionTile({
8102
8102
  }
8103
8103
  var DRAG_MIME, SIZE_CONFIG;
8104
8104
  var init_ActionTile = __esm({
8105
- "components/game/2d/molecules/ActionTile.tsx"() {
8105
+ "components/game/2d/organisms/ActionTile.tsx"() {
8106
8106
  init_atoms();
8107
8107
  init_cn();
8108
8108
  DRAG_MIME = "application/x-almadar-slot-item";
@@ -8139,7 +8139,7 @@ function ActionPalette({
8139
8139
  ] });
8140
8140
  }
8141
8141
  var init_ActionPalette = __esm({
8142
- "components/game/2d/molecules/ActionPalette.tsx"() {
8142
+ "components/game/2d/organisms/ActionPalette.tsx"() {
8143
8143
  init_atoms();
8144
8144
  init_cn();
8145
8145
  init_ActionTile();
@@ -10410,7 +10410,7 @@ var init_CodeBlock = __esm({
10410
10410
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
10411
10411
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
10412
10412
  HIDDEN_LINE_NUMBERS = { display: "none" };
10413
- CodeBlock = React72__default.memo(
10413
+ CodeBlock = React74__default.memo(
10414
10414
  ({
10415
10415
  code: rawCode,
10416
10416
  language = "text",
@@ -10997,7 +10997,7 @@ var init_MarkdownContent = __esm({
10997
10997
  init_Box();
10998
10998
  init_CodeBlock();
10999
10999
  init_cn();
11000
- MarkdownContent = React72__default.memo(
11000
+ MarkdownContent = React74__default.memo(
11001
11001
  ({ content, direction = "ltr", className }) => {
11002
11002
  const { t: _t } = useTranslate();
11003
11003
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -12324,7 +12324,7 @@ var init_StateMachineView = __esm({
12324
12324
  style: { top: title ? 30 : 0 },
12325
12325
  children: [
12326
12326
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
12327
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React72__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12327
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React74__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12328
12328
  StateNode,
12329
12329
  {
12330
12330
  state,
@@ -14363,6 +14363,221 @@ var init_Breadcrumb = __esm({
14363
14363
  Breadcrumb.displayName = "Breadcrumb";
14364
14364
  }
14365
14365
  });
14366
+
14367
+ // components/game/shared/boardEntity.ts
14368
+ function boardEntity(entity) {
14369
+ if (!entity) return void 0;
14370
+ return Array.isArray(entity) ? entity[0] : entity;
14371
+ }
14372
+ function str(v) {
14373
+ return v == null ? "" : String(v);
14374
+ }
14375
+ function num(v, fallback = 0) {
14376
+ const n = Number(v);
14377
+ return Number.isFinite(n) ? n : fallback;
14378
+ }
14379
+ function bool(v) {
14380
+ return Boolean(v);
14381
+ }
14382
+ function rows(v) {
14383
+ return Array.isArray(v) ? v : [];
14384
+ }
14385
+ function vec2(v) {
14386
+ const o = v ?? {};
14387
+ return { x: num(o.x), y: num(o.y) };
14388
+ }
14389
+ function unitPosition(u) {
14390
+ return vec2(u.position);
14391
+ }
14392
+ function unitTeam(u) {
14393
+ return str(u.team);
14394
+ }
14395
+ function unitHealth(u) {
14396
+ return num(u.health);
14397
+ }
14398
+ var init_boardEntity = __esm({
14399
+ "components/game/shared/boardEntity.ts"() {
14400
+ }
14401
+ });
14402
+ function BuilderBoard({
14403
+ entity,
14404
+ completeEvent = "PUZZLE_COMPLETE",
14405
+ placeEvent,
14406
+ checkEvent,
14407
+ playAgainEvent,
14408
+ assetManifest,
14409
+ className
14410
+ }) {
14411
+ const ui = assetManifest?.ui;
14412
+ const { emit } = useEventBus();
14413
+ const { t } = useTranslate();
14414
+ const resolved = boardEntity(entity);
14415
+ const [headerError, setHeaderError] = useState(false);
14416
+ const [selectedComponent, setSelectedComponent] = useState(null);
14417
+ const components = rows(resolved?.components).map((r) => ({
14418
+ id: str(r.id),
14419
+ label: str(r.label),
14420
+ description: str(r.description) || void 0,
14421
+ iconEmoji: str(r.iconEmoji) || void 0,
14422
+ iconUrl: str(r.iconUrl) || void 0,
14423
+ category: str(r.category) || void 0
14424
+ }));
14425
+ const slots = rows(resolved?.slots).map((r) => ({
14426
+ id: str(r.id),
14427
+ label: str(r.label) || void 0,
14428
+ description: str(r.description) || void 0,
14429
+ requiredComponentId: str(r.requiredComponentId),
14430
+ placedComponentId: str(r.placedComponentId) || void 0
14431
+ }));
14432
+ const placements = {};
14433
+ for (const slot of slots) {
14434
+ if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
14435
+ }
14436
+ const attempts = num(resolved?.attempts);
14437
+ const result = str(resolved?.result) || "none";
14438
+ const submitted = result === "win";
14439
+ const usedComponentIds = new Set(Object.values(placements));
14440
+ const availableComponents = components.filter((c) => !usedComponentIds.has(c.id));
14441
+ const allPlaced = slots.length > 0 && slots.every((s) => Boolean(placements[s.id]));
14442
+ const results = submitted ? slots.map((slot) => ({
14443
+ slot,
14444
+ placed: placements[slot.id],
14445
+ correct: placements[slot.id] === slot.requiredComponentId
14446
+ })) : [];
14447
+ const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
14448
+ const handlePlaceComponent = (slotId) => {
14449
+ if (submitted || !selectedComponent) return;
14450
+ if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: selectedComponent });
14451
+ setSelectedComponent(null);
14452
+ };
14453
+ const handleRemoveFromSlot = (slotId) => {
14454
+ if (submitted) return;
14455
+ if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: "" });
14456
+ };
14457
+ const handleSubmit = () => {
14458
+ if (checkEvent) emit(`UI:${checkEvent}`, {});
14459
+ const solved = slots.length > 0 && slots.every((s) => placements[s.id] === s.requiredComponentId);
14460
+ if (solved && completeEvent) {
14461
+ emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
14462
+ }
14463
+ };
14464
+ const handlePlayAgain = () => {
14465
+ setSelectedComponent(null);
14466
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
14467
+ };
14468
+ const getComponentById = (id) => components.find((c) => c.id === id);
14469
+ if (!resolved) return null;
14470
+ const theme = resolved.theme ?? void 0;
14471
+ const themeBackground = theme?.background;
14472
+ const headerImage = str(resolved.headerImage);
14473
+ const hint = str(resolved.hint);
14474
+ return /* @__PURE__ */ jsx(
14475
+ Box,
14476
+ {
14477
+ className,
14478
+ style: {
14479
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
14480
+ backgroundSize: "cover",
14481
+ backgroundPosition: "center"
14482
+ },
14483
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
14484
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
14485
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14486
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
14487
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
14488
+ ] }) }),
14489
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14490
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.components") }),
14491
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "flex-wrap", children: [
14492
+ availableComponents.map((comp) => /* @__PURE__ */ jsxs(
14493
+ Button,
14494
+ {
14495
+ size: "sm",
14496
+ variant: selectedComponent === comp.id ? "primary" : "secondary",
14497
+ onClick: () => setSelectedComponent(selectedComponent === comp.id ? null : comp.id),
14498
+ disabled: submitted,
14499
+ children: [
14500
+ comp.iconUrl ? /* @__PURE__ */ jsx("img", { src: comp.iconUrl, alt: "", className: "w-5 h-5 object-contain inline-block mr-1" }) : comp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
14501
+ comp.iconEmoji,
14502
+ " "
14503
+ ] }) : null,
14504
+ comp.label
14505
+ ]
14506
+ },
14507
+ comp.id
14508
+ )),
14509
+ availableComponents.length === 0 && !submitted && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.allPlaced") })
14510
+ ] })
14511
+ ] }) }),
14512
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14513
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.blueprint") }),
14514
+ /* @__PURE__ */ jsx(VStack, { gap: "sm", children: slots.map((slot) => {
14515
+ const placedComp = placements[slot.id] ? getComponentById(placements[slot.id]) : null;
14516
+ const result2 = results.find((r) => r.slot.id === slot.id);
14517
+ return /* @__PURE__ */ jsxs(
14518
+ HStack,
14519
+ {
14520
+ gap: "sm",
14521
+ align: "center",
14522
+ className: `p-3 border-2 rounded ${result2 ? result2.correct ? "border-success" : "border-error" : selectedComponent ? "border-dashed border-foreground cursor-pointer" : "border-border"}`,
14523
+ onClick: () => handlePlaceComponent(slot.id),
14524
+ children: [
14525
+ /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "flex-1", children: [
14526
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: slot.label }),
14527
+ slot.description && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: slot.description })
14528
+ ] }),
14529
+ placedComp ? /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
14530
+ /* @__PURE__ */ jsxs(Badge, { size: "sm", onClick: () => handleRemoveFromSlot(slot.id), children: [
14531
+ placedComp.iconUrl ? /* @__PURE__ */ jsx("img", { src: placedComp.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block mr-1" }) : placedComp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
14532
+ placedComp.iconEmoji,
14533
+ " "
14534
+ ] }) : null,
14535
+ placedComp.label
14536
+ ] }),
14537
+ result2 && /* @__PURE__ */ jsx(
14538
+ GameIcon,
14539
+ {
14540
+ icon: result2.correct ? CheckCircle : XCircle,
14541
+ assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
14542
+ size: "sm",
14543
+ className: result2.correct ? "text-success" : "text-error"
14544
+ }
14545
+ )
14546
+ ] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.empty") })
14547
+ ]
14548
+ },
14549
+ slot.id
14550
+ );
14551
+ }) })
14552
+ ] }) }),
14553
+ submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
14554
+ /* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: "text-success" }),
14555
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: str(resolved.successMessage) || t("builder.success") })
14556
+ ] }) }),
14557
+ showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
14558
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
14559
+ !submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allPlaced, children: [
14560
+ /* @__PURE__ */ jsx(GameIcon, { icon: Wrench, assetUrl: ui?.["build"], size: "sm" }),
14561
+ t("builder.build")
14562
+ ] }),
14563
+ /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
14564
+ /* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
14565
+ t("builder.reset")
14566
+ ] })
14567
+ ] })
14568
+ ] })
14569
+ }
14570
+ );
14571
+ }
14572
+ var init_BuilderBoard = __esm({
14573
+ "components/game/2d/organisms/BuilderBoard.tsx"() {
14574
+ init_atoms();
14575
+ init_useEventBus();
14576
+ init_boardEntity();
14577
+ init_GameIcon();
14578
+ BuilderBoard.displayName = "BuilderBoard";
14579
+ }
14580
+ });
14366
14581
  function useSwipeGesture(callbacks, options = {}) {
14367
14582
  const { threshold = 50, velocityThreshold = 0.3, preventDefault = false } = options;
14368
14583
  const startX = useRef(0);
@@ -14733,8 +14948,8 @@ function MiniMap({
14733
14948
  tileAssets,
14734
14949
  unitAssets
14735
14950
  }) {
14736
- const canvasRef = React72.useRef(null);
14737
- const imgCacheRef = React72.useRef(/* @__PURE__ */ new Map());
14951
+ const canvasRef = React74.useRef(null);
14952
+ const imgCacheRef = React74.useRef(/* @__PURE__ */ new Map());
14738
14953
  function loadImg(url) {
14739
14954
  const cached = imgCacheRef.current.get(url);
14740
14955
  if (cached) return cached.complete ? cached : null;
@@ -14749,7 +14964,7 @@ function MiniMap({
14749
14964
  imgCacheRef.current.set(url, img);
14750
14965
  return null;
14751
14966
  }
14752
- React72.useEffect(() => {
14967
+ React74.useEffect(() => {
14753
14968
  const canvas = canvasRef.current;
14754
14969
  if (!canvas) return;
14755
14970
  const ctx = canvas.getContext("2d");
@@ -18831,6 +19046,170 @@ var init_ChoiceButton = __esm({
18831
19046
  ChoiceButton.displayName = "ChoiceButton";
18832
19047
  }
18833
19048
  });
19049
+ function ClassifierBoard({
19050
+ entity,
19051
+ completeEvent = "PUZZLE_COMPLETE",
19052
+ assignEvent,
19053
+ checkEvent,
19054
+ playAgainEvent,
19055
+ assetManifest,
19056
+ className
19057
+ }) {
19058
+ const ui = assetManifest?.ui;
19059
+ const { emit } = useEventBus();
19060
+ const { t } = useTranslate();
19061
+ const resolved = boardEntity(entity);
19062
+ const [headerError, setHeaderError] = useState(false);
19063
+ const items = rows(resolved?.items);
19064
+ const categories = rows(resolved?.categories);
19065
+ const result = str(resolved?.result);
19066
+ const submitted = result === "win";
19067
+ const attempts = num(resolved?.attempts);
19068
+ const assignments = items.reduce((acc, item) => {
19069
+ if (item.assignedCategory != null && item.assignedCategory !== "") acc[item.id] = item.assignedCategory;
19070
+ return acc;
19071
+ }, {});
19072
+ const unassignedItems = items.filter((item) => !assignments[item.id]);
19073
+ const allAssigned = items.length > 0 && Object.keys(assignments).length === items.length;
19074
+ const results = submitted ? items.map((item) => ({
19075
+ item,
19076
+ assigned: assignments[item.id],
19077
+ correct: assignments[item.id] === item.correctCategory
19078
+ })) : [];
19079
+ const allCorrect = result === "win";
19080
+ const correctCount = results.filter((r) => r.correct).length;
19081
+ const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
19082
+ const handleAssign = (itemId, categoryId) => {
19083
+ if (submitted) return;
19084
+ if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId });
19085
+ };
19086
+ const handleUnassign = (itemId) => {
19087
+ if (submitted) return;
19088
+ if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId: "" });
19089
+ };
19090
+ const handleSubmit = () => {
19091
+ if (checkEvent) emit(`UI:${checkEvent}`, {});
19092
+ if (allAssigned && items.every((item) => assignments[item.id] === item.correctCategory)) {
19093
+ emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
19094
+ }
19095
+ };
19096
+ const handleFullReset = () => {
19097
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
19098
+ };
19099
+ if (!resolved) return null;
19100
+ const theme = resolved.theme ?? void 0;
19101
+ const themeBackground = theme?.background;
19102
+ const headerImage = str(resolved.headerImage);
19103
+ const hint = str(resolved.hint);
19104
+ const failMessage = str(resolved.failMessage);
19105
+ return /* @__PURE__ */ jsx(
19106
+ Box,
19107
+ {
19108
+ className,
19109
+ style: {
19110
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
19111
+ backgroundSize: "cover",
19112
+ backgroundPosition: "center"
19113
+ },
19114
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
19115
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
19116
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
19117
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
19118
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
19119
+ ] }) }),
19120
+ unassignedItems.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
19121
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("classifier.itemsToSort") }),
19122
+ /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(Badge, { size: "md", className: "cursor-pointer", children: [
19123
+ item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block" }),
19124
+ item.label
19125
+ ] }, item.id)) })
19126
+ ] }) }),
19127
+ /* @__PURE__ */ jsx(VStack, { gap: "md", children: categories.map((cat) => {
19128
+ const catItems = items.filter((item) => assignments[item.id] === cat.id);
19129
+ return /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
19130
+ cat.imageUrl && /* @__PURE__ */ jsx(Box, { className: "w-full h-16 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: cat.imageUrl, alt: "", className: "w-full h-full object-cover" }) }),
19131
+ /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
19132
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: cat.label }),
19133
+ /* @__PURE__ */ jsx(Badge, { size: "sm", children: catItems.length })
19134
+ ] }),
19135
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap min-h-[2rem]", children: catItems.map((item) => {
19136
+ const result2 = results.find((r) => r.item.id === item.id);
19137
+ return /* @__PURE__ */ jsxs(
19138
+ Badge,
19139
+ {
19140
+ size: "sm",
19141
+ className: `cursor-pointer ${result2 ? result2.correct ? "border-success bg-success/10" : "border-error bg-error/10" : ""}`,
19142
+ onClick: () => handleUnassign(item.id),
19143
+ children: [
19144
+ item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-3 h-3 object-contain inline-block" }),
19145
+ item.label,
19146
+ result2 && /* @__PURE__ */ jsx(
19147
+ GameIcon,
19148
+ {
19149
+ icon: result2.correct ? CheckCircle : XCircle,
19150
+ assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
19151
+ size: "sm",
19152
+ className: result2.correct ? "text-success" : "text-error"
19153
+ }
19154
+ )
19155
+ ]
19156
+ },
19157
+ item.id
19158
+ );
19159
+ }) }),
19160
+ !submitted && unassignedItems.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(
19161
+ Button,
19162
+ {
19163
+ size: "sm",
19164
+ variant: "ghost",
19165
+ onClick: () => handleAssign(item.id, cat.id),
19166
+ className: "text-xs opacity-50 hover:opacity-100",
19167
+ children: [
19168
+ "+ ",
19169
+ item.label
19170
+ ]
19171
+ },
19172
+ item.id
19173
+ )) })
19174
+ ] }) }, cat.id);
19175
+ }) }),
19176
+ submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
19177
+ /* @__PURE__ */ jsx(
19178
+ GameIcon,
19179
+ {
19180
+ icon: allCorrect ? CheckCircle : XCircle,
19181
+ assetUrl: allCorrect ? ui?.["correct"] : ui?.["incorrect"],
19182
+ size: "lg",
19183
+ className: allCorrect ? "text-success" : "text-error"
19184
+ }
19185
+ ),
19186
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
19187
+ !allCorrect && failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: failMessage })
19188
+ ] }) }),
19189
+ showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
19190
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
19191
+ !submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allAssigned, children: [
19192
+ /* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
19193
+ t("classifier.check")
19194
+ ] }),
19195
+ /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleFullReset, children: [
19196
+ /* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
19197
+ t("classifier.reset")
19198
+ ] })
19199
+ ] })
19200
+ ] })
19201
+ }
19202
+ );
19203
+ }
19204
+ var init_ClassifierBoard = __esm({
19205
+ "components/game/2d/organisms/ClassifierBoard.tsx"() {
19206
+ init_atoms();
19207
+ init_useEventBus();
19208
+ init_boardEntity();
19209
+ init_GameIcon();
19210
+ ClassifierBoard.displayName = "ClassifierBoard";
19211
+ }
19212
+ });
18834
19213
  var CodeRunnerPanel;
18835
19214
  var init_CodeRunnerPanel = __esm({
18836
19215
  "components/core/organisms/CodeRunnerPanel.tsx"() {
@@ -19264,9 +19643,9 @@ function ControlButton({
19264
19643
  className
19265
19644
  }) {
19266
19645
  const eventBus = useEventBus();
19267
- const [isPressed, setIsPressed] = React72.useState(false);
19646
+ const [isPressed, setIsPressed] = React74.useState(false);
19268
19647
  const actualPressed = pressed ?? isPressed;
19269
- const handlePointerDown = React72.useCallback(
19648
+ const handlePointerDown = React74.useCallback(
19270
19649
  (e) => {
19271
19650
  e.preventDefault();
19272
19651
  if (disabled) return;
@@ -19276,7 +19655,7 @@ function ControlButton({
19276
19655
  },
19277
19656
  [disabled, pressEvent, eventBus, onPress]
19278
19657
  );
19279
- const handlePointerUp = React72.useCallback(
19658
+ const handlePointerUp = React74.useCallback(
19280
19659
  (e) => {
19281
19660
  e.preventDefault();
19282
19661
  if (disabled) return;
@@ -19286,7 +19665,7 @@ function ControlButton({
19286
19665
  },
19287
19666
  [disabled, releaseEvent, eventBus, onRelease]
19288
19667
  );
19289
- const handlePointerLeave = React72.useCallback(
19668
+ const handlePointerLeave = React74.useCallback(
19290
19669
  (e) => {
19291
19670
  if (isPressed) {
19292
19671
  setIsPressed(false);
@@ -19379,8 +19758,8 @@ function ControlGrid({
19379
19758
  className
19380
19759
  }) {
19381
19760
  const eventBus = useEventBus();
19382
- const [active, setActive] = React72.useState(/* @__PURE__ */ new Set());
19383
- const handlePress = React72.useCallback(
19761
+ const [active, setActive] = React74.useState(/* @__PURE__ */ new Set());
19762
+ const handlePress = React74.useCallback(
19384
19763
  (id) => {
19385
19764
  setActive((prev) => new Set(prev).add(id));
19386
19765
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -19394,7 +19773,7 @@ function ControlGrid({
19394
19773
  },
19395
19774
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
19396
19775
  );
19397
- const handleRelease = React72.useCallback(
19776
+ const handleRelease = React74.useCallback(
19398
19777
  (id) => {
19399
19778
  setActive((prev) => {
19400
19779
  const next = new Set(prev);
@@ -20660,8 +21039,8 @@ var init_Menu = __esm({
20660
21039
  "bottom-end": "bottom-start"
20661
21040
  };
20662
21041
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
20663
- const triggerChild = React72__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
20664
- const triggerElement = React72__default.cloneElement(
21042
+ const triggerChild = React74__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
21043
+ const triggerElement = React74__default.cloneElement(
20665
21044
  triggerChild,
20666
21045
  {
20667
21046
  ref: triggerRef,
@@ -20756,14 +21135,14 @@ function useDataDnd(args) {
20756
21135
  const isZone = Boolean(dragGroup || accepts || sortable);
20757
21136
  const enabled = isZone || Boolean(dndRoot);
20758
21137
  const eventBus = useEventBus();
20759
- const parentRoot = React72__default.useContext(RootCtx);
21138
+ const parentRoot = React74__default.useContext(RootCtx);
20760
21139
  const isRoot = enabled && parentRoot === null;
20761
- const zoneId = React72__default.useId();
21140
+ const zoneId = React74__default.useId();
20762
21141
  const ownGroup = dragGroup ?? accepts ?? zoneId;
20763
- const [optimisticOrders, setOptimisticOrders] = React72__default.useState(() => /* @__PURE__ */ new Map());
20764
- const optimisticOrdersRef = React72__default.useRef(optimisticOrders);
21142
+ const [optimisticOrders, setOptimisticOrders] = React74__default.useState(() => /* @__PURE__ */ new Map());
21143
+ const optimisticOrdersRef = React74__default.useRef(optimisticOrders);
20765
21144
  optimisticOrdersRef.current = optimisticOrders;
20766
- const clearOptimisticOrder = React72__default.useCallback((group) => {
21145
+ const clearOptimisticOrder = React74__default.useCallback((group) => {
20767
21146
  setOptimisticOrders((prev) => {
20768
21147
  if (!prev.has(group)) return prev;
20769
21148
  const next = new Map(prev);
@@ -20788,7 +21167,7 @@ function useDataDnd(args) {
20788
21167
  const raw = it[dndItemIdField];
20789
21168
  return raw != null ? String(raw) : `__idx_${idx}`;
20790
21169
  }).join("|");
20791
- const itemIds = React72__default.useMemo(
21170
+ const itemIds = React74__default.useMemo(
20792
21171
  () => orderedItems.map((it, idx) => {
20793
21172
  const raw = it[dndItemIdField];
20794
21173
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -20799,7 +21178,7 @@ function useDataDnd(args) {
20799
21178
  const raw = it[dndItemIdField];
20800
21179
  return raw != null ? String(raw) : `__${idx}`;
20801
21180
  }).join("|");
20802
- React72__default.useEffect(() => {
21181
+ React74__default.useEffect(() => {
20803
21182
  const root = isRoot ? null : parentRoot;
20804
21183
  if (root) {
20805
21184
  root.clearOptimisticOrder(ownGroup);
@@ -20807,20 +21186,20 @@ function useDataDnd(args) {
20807
21186
  clearOptimisticOrder(ownGroup);
20808
21187
  }
20809
21188
  }, [itemsContentSig, ownGroup]);
20810
- const zonesRef = React72__default.useRef(/* @__PURE__ */ new Map());
20811
- const registerZone = React72__default.useCallback((zoneId2, meta2) => {
21189
+ const zonesRef = React74__default.useRef(/* @__PURE__ */ new Map());
21190
+ const registerZone = React74__default.useCallback((zoneId2, meta2) => {
20812
21191
  zonesRef.current.set(zoneId2, meta2);
20813
21192
  }, []);
20814
- const unregisterZone = React72__default.useCallback((zoneId2) => {
21193
+ const unregisterZone = React74__default.useCallback((zoneId2) => {
20815
21194
  zonesRef.current.delete(zoneId2);
20816
21195
  }, []);
20817
- const [activeDrag, setActiveDrag] = React72__default.useState(null);
20818
- const [overZoneGroup, setOverZoneGroup] = React72__default.useState(null);
20819
- const meta = React72__default.useMemo(
21196
+ const [activeDrag, setActiveDrag] = React74__default.useState(null);
21197
+ const [overZoneGroup, setOverZoneGroup] = React74__default.useState(null);
21198
+ const meta = React74__default.useMemo(
20820
21199
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
20821
21200
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
20822
21201
  );
20823
- React72__default.useEffect(() => {
21202
+ React74__default.useEffect(() => {
20824
21203
  const target = isRoot ? null : parentRoot;
20825
21204
  if (!target) {
20826
21205
  zonesRef.current.set(zoneId, meta);
@@ -20839,7 +21218,7 @@ function useDataDnd(args) {
20839
21218
  }, [parentRoot, isRoot, zoneId, meta]);
20840
21219
  const sensors = useAlmadarDndSensors(true);
20841
21220
  const collisionDetection = almadarDndCollisionDetection;
20842
- const findZoneByItem = React72__default.useCallback(
21221
+ const findZoneByItem = React74__default.useCallback(
20843
21222
  (id) => {
20844
21223
  for (const z of zonesRef.current.values()) {
20845
21224
  if (z.itemIds.includes(id)) return z;
@@ -20848,7 +21227,7 @@ function useDataDnd(args) {
20848
21227
  },
20849
21228
  []
20850
21229
  );
20851
- React72__default.useCallback(
21230
+ React74__default.useCallback(
20852
21231
  (group) => {
20853
21232
  for (const z of zonesRef.current.values()) {
20854
21233
  if (z.group === group) return z;
@@ -20857,7 +21236,7 @@ function useDataDnd(args) {
20857
21236
  },
20858
21237
  []
20859
21238
  );
20860
- const handleDragEnd = React72__default.useCallback(
21239
+ const handleDragEnd = React74__default.useCallback(
20861
21240
  (event) => {
20862
21241
  const { active, over } = event;
20863
21242
  const activeIdStr = String(active.id);
@@ -20948,8 +21327,8 @@ function useDataDnd(args) {
20948
21327
  },
20949
21328
  [eventBus]
20950
21329
  );
20951
- const sortableData = React72__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
20952
- const SortableItem = React72__default.useCallback(
21330
+ const sortableData = React74__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
21331
+ const SortableItem = React74__default.useCallback(
20953
21332
  ({ id, children }) => {
20954
21333
  const {
20955
21334
  attributes,
@@ -20989,7 +21368,7 @@ function useDataDnd(args) {
20989
21368
  id: droppableId,
20990
21369
  data: sortableData
20991
21370
  });
20992
- const ctx = React72__default.useContext(RootCtx);
21371
+ const ctx = React74__default.useContext(RootCtx);
20993
21372
  const activeDrag2 = ctx?.activeDrag ?? null;
20994
21373
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
20995
21374
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -21004,7 +21383,7 @@ function useDataDnd(args) {
21004
21383
  showForeignPlaceholder,
21005
21384
  ctxAvailable: ctx != null
21006
21385
  });
21007
- React72__default.useEffect(() => {
21386
+ React74__default.useEffect(() => {
21008
21387
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
21009
21388
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
21010
21389
  return /* @__PURE__ */ jsx(
@@ -21018,11 +21397,11 @@ function useDataDnd(args) {
21018
21397
  }
21019
21398
  );
21020
21399
  };
21021
- const rootContextValue = React72__default.useMemo(
21400
+ const rootContextValue = React74__default.useMemo(
21022
21401
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
21023
21402
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
21024
21403
  );
21025
- const handleDragStart = React72__default.useCallback((event) => {
21404
+ const handleDragStart = React74__default.useCallback((event) => {
21026
21405
  const sourceZone = findZoneByItem(event.active.id);
21027
21406
  const rect = event.active.rect.current.initial;
21028
21407
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -21041,7 +21420,7 @@ function useDataDnd(args) {
21041
21420
  isRoot
21042
21421
  });
21043
21422
  }, [findZoneByItem, isRoot, zoneId]);
21044
- const handleDragOver = React72__default.useCallback((event) => {
21423
+ const handleDragOver = React74__default.useCallback((event) => {
21045
21424
  const { active, over } = event;
21046
21425
  const overData = over?.data?.current;
21047
21426
  const overGroup = overData?.dndGroup ?? null;
@@ -21111,7 +21490,7 @@ function useDataDnd(args) {
21111
21490
  return next;
21112
21491
  });
21113
21492
  }, []);
21114
- const handleDragCancel = React72__default.useCallback((event) => {
21493
+ const handleDragCancel = React74__default.useCallback((event) => {
21115
21494
  setActiveDrag(null);
21116
21495
  setOverZoneGroup(null);
21117
21496
  dndLog.warn("dragCancel", {
@@ -21119,12 +21498,12 @@ function useDataDnd(args) {
21119
21498
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
21120
21499
  });
21121
21500
  }, []);
21122
- const handleDragEndWithCleanup = React72__default.useCallback((event) => {
21501
+ const handleDragEndWithCleanup = React74__default.useCallback((event) => {
21123
21502
  handleDragEnd(event);
21124
21503
  setActiveDrag(null);
21125
21504
  setOverZoneGroup(null);
21126
21505
  }, [handleDragEnd]);
21127
- const wrapContainer = React72__default.useCallback(
21506
+ const wrapContainer = React74__default.useCallback(
21128
21507
  (children) => {
21129
21508
  if (!enabled) return children;
21130
21509
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -21178,7 +21557,7 @@ var init_useDataDnd = __esm({
21178
21557
  init_useAlmadarDndCollision();
21179
21558
  init_Box();
21180
21559
  dndLog = createLogger("almadar:ui:dnd");
21181
- RootCtx = React72__default.createContext(null);
21560
+ RootCtx = React74__default.createContext(null);
21182
21561
  }
21183
21562
  });
21184
21563
  function renderIconInput(icon, props) {
@@ -21704,7 +22083,7 @@ function DataList({
21704
22083
  }) {
21705
22084
  const eventBus = useEventBus();
21706
22085
  const { t } = useTranslate();
21707
- const [visibleCount, setVisibleCount] = React72__default.useState(pageSize || Infinity);
22086
+ const [visibleCount, setVisibleCount] = React74__default.useState(pageSize || Infinity);
21708
22087
  const fieldDefs = fields ?? columns ?? [];
21709
22088
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
21710
22089
  const dnd = useDataDnd({
@@ -21723,7 +22102,7 @@ function DataList({
21723
22102
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
21724
22103
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
21725
22104
  const hasRenderProp = typeof children === "function";
21726
- React72__default.useEffect(() => {
22105
+ React74__default.useEffect(() => {
21727
22106
  const renderItemTypeOf = typeof schemaRenderItem;
21728
22107
  const childrenTypeOf = typeof children;
21729
22108
  if (data.length > 0 && !hasRenderProp) {
@@ -21827,7 +22206,7 @@ function DataList({
21827
22206
  const items2 = [...data];
21828
22207
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
21829
22208
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
21830
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
22209
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
21831
22210
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
21832
22211
  group.items.map((itemData, index) => {
21833
22212
  const id = itemData.id || `${gi}-${index}`;
@@ -21968,7 +22347,7 @@ function DataList({
21968
22347
  className
21969
22348
  ),
21970
22349
  children: [
21971
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
22350
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
21972
22351
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
21973
22352
  group.items.map(
21974
22353
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -22075,8 +22454,8 @@ function ScalarControl({
22075
22454
  }
22076
22455
  const numeric = typeof value === "number";
22077
22456
  const initial = value === null ? "" : String(value);
22078
- const [draft, setDraft] = React72__default.useState(initial);
22079
- React72__default.useEffect(() => setDraft(initial), [initial]);
22457
+ const [draft, setDraft] = React74__default.useState(initial);
22458
+ React74__default.useEffect(() => setDraft(initial), [initial]);
22080
22459
  const commit = () => {
22081
22460
  if (numeric) {
22082
22461
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -22144,8 +22523,8 @@ function Row({
22144
22523
  onRemove,
22145
22524
  readonly
22146
22525
  }) {
22147
- const [keyDraft, setKeyDraft] = React72__default.useState(rowKey);
22148
- React72__default.useEffect(() => setKeyDraft(rowKey), [rowKey]);
22526
+ const [keyDraft, setKeyDraft] = React74__default.useState(rowKey);
22527
+ React74__default.useEffect(() => setKeyDraft(rowKey), [rowKey]);
22149
22528
  const container = isObj(value) || isArr(value);
22150
22529
  return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "group w-max min-w-full", children: [
22151
22530
  /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className: "py-0.5 w-max", children: [
@@ -22188,7 +22567,7 @@ function ContainerNode({
22188
22567
  depth,
22189
22568
  readonly
22190
22569
  }) {
22191
- const [open, setOpen] = React72__default.useState(depth < 2);
22570
+ const [open, setOpen] = React74__default.useState(depth < 2);
22192
22571
  const array = isArr(value);
22193
22572
  const entries = array ? value.map((v, i) => [String(i), v]) : Object.entries(value);
22194
22573
  const setObjValue = (key, next) => {
@@ -22330,7 +22709,7 @@ var init_FormSection = __esm({
22330
22709
  columns = 1,
22331
22710
  className
22332
22711
  }) => {
22333
- const [collapsed, setCollapsed] = React72__default.useState(defaultCollapsed);
22712
+ const [collapsed, setCollapsed] = React74__default.useState(defaultCollapsed);
22334
22713
  const { t } = useTranslate();
22335
22714
  const eventBus = useEventBus();
22336
22715
  const gridClass = {
@@ -22338,7 +22717,7 @@ var init_FormSection = __esm({
22338
22717
  2: "grid-cols-1 md:grid-cols-2",
22339
22718
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
22340
22719
  }[columns];
22341
- React72__default.useCallback(() => {
22720
+ React74__default.useCallback(() => {
22342
22721
  if (collapsible) {
22343
22722
  setCollapsed((prev) => !prev);
22344
22723
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -22746,8 +23125,8 @@ function TextLikeControl({
22746
23125
  onCommit
22747
23126
  }) {
22748
23127
  const initial = value === void 0 || value === null ? "" : String(value);
22749
- const [draft, setDraft] = React72__default.useState(initial);
22750
- React72__default.useEffect(() => setDraft(initial), [initial]);
23128
+ const [draft, setDraft] = React74__default.useState(initial);
23129
+ React74__default.useEffect(() => setDraft(initial), [initial]);
22751
23130
  const commit = () => {
22752
23131
  if (numeric) {
22753
23132
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -22932,14 +23311,14 @@ var init_NodeSlotEditor = __esm({
22932
23311
  isObj2 = (v) => v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
22933
23312
  NodeSlotEditor = ({ value, onChange, className }) => {
22934
23313
  const { type, props, wasArray } = normalize(value);
22935
- const patterns = React72__default.useMemo(() => {
23314
+ const patterns = React74__default.useMemo(() => {
22936
23315
  try {
22937
23316
  return [...getKnownPatterns()].sort();
22938
23317
  } catch {
22939
23318
  return [];
22940
23319
  }
22941
23320
  }, []);
22942
- const options = React72__default.useMemo(
23321
+ const options = React74__default.useMemo(
22943
23322
  () => [{ value: "", label: "\u2014 none \u2014" }, ...patterns.map((p) => ({ value: p, label: p }))],
22944
23323
  [patterns]
22945
23324
  );
@@ -22951,7 +23330,7 @@ var init_NodeSlotEditor = __esm({
22951
23330
  const pattern = { type: nextType, ...nextProps };
22952
23331
  onChange(wasArray || value === void 0 ? [pattern] : pattern);
22953
23332
  };
22954
- const schemaEntries = React72__default.useMemo(() => {
23333
+ const schemaEntries = React74__default.useMemo(() => {
22955
23334
  if (!type) return [];
22956
23335
  const def = getPatternDefinition(type);
22957
23336
  if (!def?.propsSchema) return [];
@@ -23853,7 +24232,7 @@ var init_Flex = __esm({
23853
24232
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
23854
24233
  }
23855
24234
  }
23856
- return React72__default.createElement(Component, {
24235
+ return React74__default.createElement(Component, {
23857
24236
  className: cn(
23858
24237
  inline ? "inline-flex" : "flex",
23859
24238
  directionStyles[direction],
@@ -23972,7 +24351,7 @@ var init_Grid = __esm({
23972
24351
  as: Component = "div"
23973
24352
  }) => {
23974
24353
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
23975
- return React72__default.createElement(
24354
+ return React74__default.createElement(
23976
24355
  Component,
23977
24356
  {
23978
24357
  className: cn(
@@ -24168,9 +24547,9 @@ var init_Popover = __esm({
24168
24547
  onMouseLeave: handleClose,
24169
24548
  onPointerDown: tapTriggerProps.onPointerDown
24170
24549
  };
24171
- const childElement = React72__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
24550
+ const childElement = React74__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
24172
24551
  const childPointerDown = childElement.props.onPointerDown;
24173
- const triggerElement = React72__default.cloneElement(
24552
+ const triggerElement = React74__default.cloneElement(
24174
24553
  childElement,
24175
24554
  {
24176
24555
  ref: triggerRef,
@@ -25022,9 +25401,9 @@ var init_Tooltip = __esm({
25022
25401
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
25023
25402
  };
25024
25403
  }, []);
25025
- const triggerElement = React72__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25404
+ const triggerElement = React74__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25026
25405
  const childPointerDown = triggerElement.props.onPointerDown;
25027
- const trigger = React72__default.cloneElement(triggerElement, {
25406
+ const trigger = React74__default.cloneElement(triggerElement, {
25028
25407
  ref: triggerRef,
25029
25408
  onMouseEnter: handleMouseEnter,
25030
25409
  onMouseLeave: handleMouseLeave,
@@ -25114,7 +25493,7 @@ var init_WizardProgress = __esm({
25114
25493
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
25115
25494
  const isActive = index === currentStep;
25116
25495
  const isCompleted = index < currentStep;
25117
- return /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
25496
+ return /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
25118
25497
  /* @__PURE__ */ jsx(
25119
25498
  "button",
25120
25499
  {
@@ -26162,42 +26541,6 @@ var init_effects = __esm({
26162
26541
  }
26163
26542
  });
26164
26543
 
26165
- // components/game/shared/boardEntity.ts
26166
- function boardEntity(entity) {
26167
- if (!entity) return void 0;
26168
- return Array.isArray(entity) ? entity[0] : entity;
26169
- }
26170
- function str(v) {
26171
- return v == null ? "" : String(v);
26172
- }
26173
- function num(v, fallback = 0) {
26174
- const n = Number(v);
26175
- return Number.isFinite(n) ? n : fallback;
26176
- }
26177
- function bool(v) {
26178
- return Boolean(v);
26179
- }
26180
- function rows(v) {
26181
- return Array.isArray(v) ? v : [];
26182
- }
26183
- function vec2(v) {
26184
- const o = v ?? {};
26185
- return { x: num(o.x), y: num(o.y) };
26186
- }
26187
- function unitPosition(u) {
26188
- return vec2(u.position);
26189
- }
26190
- function unitTeam(u) {
26191
- return str(u.team);
26192
- }
26193
- function unitHealth(u) {
26194
- return num(u.health);
26195
- }
26196
- var init_boardEntity = __esm({
26197
- "components/game/shared/boardEntity.ts"() {
26198
- }
26199
- });
26200
-
26201
26544
  // components/game/shared/makeAsset.ts
26202
26545
  function makeAsset(url, role, overrides = {}) {
26203
26546
  const defaults = ROLE_DEFAULTS[role] ?? { dimension: "2d", animations: ["static"], aspect: "1:1" };
@@ -26263,7 +26606,7 @@ function GameCard({
26263
26606
  className
26264
26607
  }) {
26265
26608
  const eventBus = useEventBus();
26266
- const handleClick = React72.useCallback(() => {
26609
+ const handleClick = React74.useCallback(() => {
26267
26610
  if (disabled) return;
26268
26611
  onClick?.(id);
26269
26612
  if (clickEvent) eventBus.emit(`UI:${clickEvent}`, { cardId: id });
@@ -27155,7 +27498,7 @@ function InventoryGrid({
27155
27498
  const eventBus = useEventBus();
27156
27499
  const slotCount = totalSlots ?? items.length;
27157
27500
  const emptySlotCount = Math.max(0, slotCount - items.length);
27158
- const handleSelect = React72.useCallback(
27501
+ const handleSelect = React74.useCallback(
27159
27502
  (id) => {
27160
27503
  onSelect?.(id);
27161
27504
  if (selectEvent) {
@@ -27372,7 +27715,7 @@ function GameMenu({
27372
27715
  }) {
27373
27716
  const resolvedOptions = options ?? menuItems ?? DEFAULT_MENU_OPTIONS;
27374
27717
  const eventBus = useEventBus();
27375
- const handleOptionClick = React72.useCallback(
27718
+ const handleOptionClick = React74.useCallback(
27376
27719
  (option) => {
27377
27720
  if (option.event) {
27378
27721
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27826,7 +28169,7 @@ function LinearView({
27826
28169
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
27827
28170
  const isDone = i < currentIdx;
27828
28171
  const isCurrent = i === currentIdx;
27829
- return /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
28172
+ return /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
27830
28173
  i > 0 && /* @__PURE__ */ jsx(
27831
28174
  Typography,
27832
28175
  {
@@ -28023,7 +28366,7 @@ function TraitStateViewer({
28023
28366
  }
28024
28367
  var SIZE_CONFIG2;
28025
28368
  var init_TraitStateViewer = __esm({
28026
- "components/game/2d/molecules/TraitStateViewer.tsx"() {
28369
+ "components/game/2d/organisms/TraitStateViewer.tsx"() {
28027
28370
  "use client";
28028
28371
  init_cn();
28029
28372
  init_Box();
@@ -28230,7 +28573,7 @@ function TraitSlot({
28230
28573
  }
28231
28574
  var SIZE_CONFIG3, DRAG_MIME2;
28232
28575
  var init_TraitSlot = __esm({
28233
- "components/game/2d/molecules/TraitSlot.tsx"() {
28576
+ "components/game/2d/organisms/TraitSlot.tsx"() {
28234
28577
  "use client";
28235
28578
  init_cn();
28236
28579
  init_useEventBus();
@@ -28436,8 +28779,6 @@ function SequenceBar({
28436
28779
  maxSlots,
28437
28780
  onSlotDrop,
28438
28781
  onSlotRemove,
28439
- slotDropEvent,
28440
- slotRemoveEvent,
28441
28782
  playing = false,
28442
28783
  currentStep = -1,
28443
28784
  categoryColors,
@@ -28445,19 +28786,16 @@ function SequenceBar({
28445
28786
  size = "lg",
28446
28787
  className
28447
28788
  }) {
28448
- const { emit } = useEventBus();
28449
28789
  const handleDrop = useCallback((index) => (item) => {
28450
28790
  if (playing) return;
28451
- if (slotDropEvent) emit(`UI:${slotDropEvent}`, { slotIndex: index, actionId: item.id });
28452
- onSlotDrop?.(index, item);
28453
- }, [onSlotDrop, slotDropEvent, emit, playing]);
28791
+ onSlotDrop(index, item);
28792
+ }, [onSlotDrop, playing]);
28454
28793
  const handleRemove = useCallback((index) => () => {
28455
28794
  if (playing) return;
28456
- if (slotRemoveEvent) emit(`UI:${slotRemoveEvent}`, { slotIndex: index });
28457
- onSlotRemove?.(index);
28458
- }, [onSlotRemove, slotRemoveEvent, emit, playing]);
28795
+ onSlotRemove(index);
28796
+ }, [onSlotRemove, playing]);
28459
28797
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
28460
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
28798
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
28461
28799
  i > 0 && /* @__PURE__ */ jsx(
28462
28800
  Typography,
28463
28801
  {
@@ -28487,14 +28825,281 @@ function SequenceBar({
28487
28825
  ] }, i)) });
28488
28826
  }
28489
28827
  var init_SequenceBar = __esm({
28490
- "components/game/2d/molecules/SequenceBar.tsx"() {
28828
+ "components/game/2d/organisms/SequenceBar.tsx"() {
28491
28829
  init_atoms();
28492
28830
  init_cn();
28493
- init_useEventBus();
28494
28831
  init_TraitSlot();
28495
28832
  SequenceBar.displayName = "SequenceBar";
28496
28833
  }
28497
28834
  });
28835
+ function computeSlotFeedback(playerSeq, solutions) {
28836
+ let bestSolution = solutions[0];
28837
+ let bestMatches = -1;
28838
+ for (const sol of solutions) {
28839
+ const matches = sol.filter((id, i) => id === playerSeq[i]).length;
28840
+ if (matches > bestMatches) {
28841
+ bestMatches = matches;
28842
+ bestSolution = sol;
28843
+ }
28844
+ }
28845
+ return playerSeq.map(
28846
+ (id, i) => id !== void 0 && id === bestSolution[i] ? "correct" : "wrong"
28847
+ );
28848
+ }
28849
+ function isFieldRecord(v) {
28850
+ return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
28851
+ }
28852
+ function assetFromField(v) {
28853
+ if (!isFieldRecord(v)) return void 0;
28854
+ const url = typeof v.url === "string" ? v.url : void 0;
28855
+ const role = typeof v.role === "string" ? v.role : void 0;
28856
+ const category = typeof v.category === "string" ? v.category : "";
28857
+ if (!url || !role) return void 0;
28858
+ return {
28859
+ url,
28860
+ role,
28861
+ category,
28862
+ name: typeof v.name === "string" ? v.name : void 0,
28863
+ thumbnailUrl: typeof v.thumbnailUrl === "string" ? v.thumbnailUrl : void 0,
28864
+ style: typeof v.style === "string" ? v.style : void 0,
28865
+ variant: typeof v.variant === "string" ? v.variant : void 0,
28866
+ dimension: typeof v.dimension === "string" ? v.dimension : void 0,
28867
+ aspect: typeof v.aspect === "string" ? v.aspect : void 0
28868
+ };
28869
+ }
28870
+ function slotItemFromField(fv) {
28871
+ if (!isFieldRecord(fv)) return void 0;
28872
+ const id = typeof fv.id === "string" ? fv.id : void 0;
28873
+ const name = typeof fv.name === "string" ? fv.name : void 0;
28874
+ const category = typeof fv.category === "string" ? fv.category : void 0;
28875
+ if (!id || !name || !category) return void 0;
28876
+ return {
28877
+ id,
28878
+ name,
28879
+ category,
28880
+ description: typeof fv.description === "string" ? fv.description : void 0,
28881
+ iconEmoji: typeof fv.iconEmoji === "string" ? fv.iconEmoji : void 0,
28882
+ iconUrl: assetFromField(fv.iconUrl)
28883
+ };
28884
+ }
28885
+ function SequencerBoard({
28886
+ entity,
28887
+ categoryColors,
28888
+ stepDurationMs = 1e3,
28889
+ playEvent,
28890
+ completeEvent,
28891
+ placeEvent,
28892
+ removeEvent,
28893
+ checkEvent,
28894
+ playAgainEvent,
28895
+ stepEvent,
28896
+ className
28897
+ }) {
28898
+ const { emit } = useEventBus();
28899
+ const { t } = useTranslate();
28900
+ const resolved = boardEntity(entity);
28901
+ const maxSlots = num(resolved?.maxSlots) || 3;
28902
+ const solutions = Array.isArray(resolved?.solutions) ? resolved.solutions : [];
28903
+ const availableActions = (Array.isArray(resolved?.availableActions) ? resolved.availableActions : []).reduce((acc, fv) => {
28904
+ const item = slotItemFromField(fv);
28905
+ if (item) acc.push(item);
28906
+ return acc;
28907
+ }, []);
28908
+ const allowDuplicates = resolved?.allowDuplicates !== false;
28909
+ const entitySlots = Array.isArray(resolved?.slots) ? resolved.slots : [];
28910
+ const entityResult = str(resolved?.result);
28911
+ const entityAttempts = num(resolved?.attempts);
28912
+ const entityCurrentStep = typeof resolved?.currentStep === "number" ? resolved.currentStep : -1;
28913
+ const slots = Array.from({ length: maxSlots }, (_, i) => {
28914
+ const entitySlot = entitySlots.find((s) => s.index === i);
28915
+ if (!entitySlot?.placedActionId) return void 0;
28916
+ return availableActions.find((a) => a.id === entitySlot.placedActionId);
28917
+ });
28918
+ const isSuccess = entityResult === "win";
28919
+ const attempts = entityAttempts;
28920
+ const isPlayingBack = entityCurrentStep >= 0 && !isSuccess;
28921
+ const currentStep = entityCurrentStep;
28922
+ const [headerError, setHeaderError] = useState(false);
28923
+ const [slotFeedback, setSlotFeedback] = useState(
28924
+ () => Array.from({ length: maxSlots }, () => null)
28925
+ );
28926
+ const timerRef = useRef(null);
28927
+ useEffect(() => () => {
28928
+ if (timerRef.current) clearTimeout(timerRef.current);
28929
+ }, []);
28930
+ const handleSlotDrop = useCallback((index, item) => {
28931
+ setSlotFeedback((prev) => {
28932
+ const next = [...prev];
28933
+ next[index] = null;
28934
+ return next;
28935
+ });
28936
+ emit("UI:PLAY_SOUND", { key: "drop_slot" });
28937
+ if (placeEvent) emit(`UI:${placeEvent}`, { slotIndex: index, actionId: item.id });
28938
+ }, [emit, placeEvent]);
28939
+ const handleSlotRemove = useCallback((index) => {
28940
+ setSlotFeedback((prev) => {
28941
+ const next = [...prev];
28942
+ next[index] = null;
28943
+ return next;
28944
+ });
28945
+ emit("UI:PLAY_SOUND", { key: "back" });
28946
+ if (removeEvent) emit(`UI:${removeEvent}`, { slotIndex: index });
28947
+ }, [emit, removeEvent]);
28948
+ const handleReset = useCallback(() => {
28949
+ if (timerRef.current) clearTimeout(timerRef.current);
28950
+ setSlotFeedback(Array.from({ length: maxSlots }, () => null));
28951
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
28952
+ }, [maxSlots, playAgainEvent, emit]);
28953
+ const filledSlots = slots.filter((s) => !!s);
28954
+ const canPlay = filledSlots.length > 0 && !isPlayingBack && !isSuccess;
28955
+ const handlePlay = useCallback(() => {
28956
+ if (!canPlay) return;
28957
+ setSlotFeedback(Array.from({ length: maxSlots }, () => null));
28958
+ emit("UI:PLAY_SOUND", { key: "confirm" });
28959
+ const sequence = slots.map((s) => s?.id || "");
28960
+ const playerIds = slots.filter(Boolean).map((s) => s?.id || "");
28961
+ if (playEvent) emit(`UI:${playEvent}`, { sequence });
28962
+ let step = 0;
28963
+ const advance = () => {
28964
+ step++;
28965
+ if (stepEvent) emit(`UI:${stepEvent}`, { step });
28966
+ if (step >= maxSlots) {
28967
+ if (checkEvent) emit(`UI:${checkEvent}`, { sequence: playerIds });
28968
+ const playerSeq = slots.map((s) => s?.id);
28969
+ const success = solutions.some(
28970
+ (sol) => sol.length === playerIds.length && sol.every((id, i) => id === playerIds[i])
28971
+ );
28972
+ if (success) {
28973
+ emit("UI:PLAY_SOUND", { key: "levelComplete" });
28974
+ if (completeEvent) emit(`UI:${completeEvent}`, { success: true, sequence: playerIds });
28975
+ } else {
28976
+ const feedback = computeSlotFeedback(playerSeq, solutions);
28977
+ setSlotFeedback(feedback);
28978
+ emit("UI:PLAY_SOUND", { key: "fail" });
28979
+ const correctCount2 = feedback.filter((f3) => f3 === "correct").length;
28980
+ for (let ci = 0; ci < correctCount2; ci++) {
28981
+ setTimeout(() => {
28982
+ emit("UI:PLAY_SOUND", { key: "correctSlot" });
28983
+ }, 300 + ci * 150);
28984
+ }
28985
+ }
28986
+ } else {
28987
+ timerRef.current = setTimeout(advance, stepDurationMs);
28988
+ }
28989
+ };
28990
+ timerRef.current = setTimeout(advance, stepDurationMs);
28991
+ }, [canPlay, slots, maxSlots, solutions, stepDurationMs, playEvent, completeEvent, checkEvent, emit]);
28992
+ const machine = {
28993
+ name: str(resolved?.title),
28994
+ description: str(resolved?.description),
28995
+ states: slots.map((s, i) => stepLabel(s, i)),
28996
+ currentState: currentStep >= 0 ? stepLabel(slots[currentStep], currentStep) : "__idle__",
28997
+ transitions: slots.slice(0, -1).map((s, i) => ({
28998
+ from: stepLabel(s, i),
28999
+ to: stepLabel(slots[i + 1], i + 1),
29000
+ event: "NEXT"
29001
+ }))
29002
+ };
29003
+ const usedIds = !allowDuplicates ? slots.filter(Boolean).map((s) => s?.id || "") : [];
29004
+ const hint = str(resolved?.hint);
29005
+ const showHint = attempts >= 3 && !!hint;
29006
+ const hasFeedback = slotFeedback.some((f3) => f3 !== null);
29007
+ const correctCount = slotFeedback.filter((f3) => f3 === "correct").length;
29008
+ const encourageKey = ENCOURAGEMENT_KEYS[Math.min(attempts - 1, ENCOURAGEMENT_KEYS.length - 1)] ?? ENCOURAGEMENT_KEYS[0];
29009
+ if (!resolved) return null;
29010
+ const theme = resolved.theme ?? void 0;
29011
+ const themeBackground = theme?.background;
29012
+ const headerImage = str(resolved.headerImage);
29013
+ return /* @__PURE__ */ jsxs(
29014
+ VStack,
29015
+ {
29016
+ className: cn("p-4 gap-6", className),
29017
+ style: {
29018
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
29019
+ backgroundSize: "cover",
29020
+ backgroundPosition: "center"
29021
+ },
29022
+ children: [
29023
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
29024
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
29025
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
29026
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) })
29027
+ ] }),
29028
+ 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: [
29029
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
29030
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
29031
+ ] }) }),
29032
+ filledSlots.length > 0 && /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "linear", size: "md" }),
29033
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
29034
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
29035
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("sequencer.yourSequence") + ":" }),
29036
+ hasFeedback && !isPlayingBack && !isSuccess && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
29037
+ `${correctCount}/${maxSlots} `,
29038
+ "\u2705"
29039
+ ] })
29040
+ ] }),
29041
+ /* @__PURE__ */ jsx(
29042
+ SequenceBar,
29043
+ {
29044
+ slots,
29045
+ maxSlots,
29046
+ onSlotDrop: handleSlotDrop,
29047
+ onSlotRemove: handleSlotRemove,
29048
+ playing: isPlayingBack,
29049
+ currentStep,
29050
+ categoryColors,
29051
+ slotFeedback,
29052
+ size: "lg"
29053
+ }
29054
+ )
29055
+ ] }),
29056
+ !isPlayingBack && /* @__PURE__ */ jsx(
29057
+ ActionPalette,
29058
+ {
29059
+ actions: availableActions,
29060
+ usedActionIds: usedIds,
29061
+ allowDuplicates,
29062
+ categoryColors,
29063
+ label: t("sequencer.dragActions")
29064
+ }
29065
+ ),
29066
+ hasFeedback && !isPlayingBack && !isSuccess && 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) }) }),
29067
+ isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("sequencer.levelComplete") }) }),
29068
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
29069
+ /* @__PURE__ */ jsx(
29070
+ Button,
29071
+ {
29072
+ variant: "primary",
29073
+ onClick: handlePlay,
29074
+ disabled: !canPlay,
29075
+ children: "\u25B6 " + t("game.play")
29076
+ }
29077
+ ),
29078
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
29079
+ ] })
29080
+ ]
29081
+ }
29082
+ );
29083
+ }
29084
+ var ENCOURAGEMENT_KEYS, stepLabel;
29085
+ var init_SequencerBoard = __esm({
29086
+ "components/game/2d/organisms/SequencerBoard.tsx"() {
29087
+ init_atoms();
29088
+ init_cn();
29089
+ init_useEventBus();
29090
+ init_TraitStateViewer();
29091
+ init_boardEntity();
29092
+ init_SequenceBar();
29093
+ init_ActionPalette();
29094
+ ENCOURAGEMENT_KEYS = [
29095
+ "puzzle.tryAgain1",
29096
+ "puzzle.tryAgain2",
29097
+ "puzzle.tryAgain3"
29098
+ ];
29099
+ stepLabel = (slot, i) => slot ? `${i + 1}. ${slot.name}` : `Step ${i + 1}`;
29100
+ SequencerBoard.displayName = "SequencerBoard";
29101
+ }
29102
+ });
28498
29103
  function RuleEditor({
28499
29104
  rule,
28500
29105
  availableEvents,
@@ -28538,7 +29143,7 @@ function RuleEditor({
28538
29143
  ] });
28539
29144
  }
28540
29145
  var init_RuleEditor = __esm({
28541
- "components/game/2d/molecules/RuleEditor.tsx"() {
29146
+ "components/game/2d/organisms/RuleEditor.tsx"() {
28542
29147
  init_atoms();
28543
29148
  init_cn();
28544
29149
  RuleEditor.displayName = "RuleEditor";
@@ -28579,7 +29184,7 @@ function EventLog({
28579
29184
  }
28580
29185
  var STATUS_STYLES, STATUS_DOTS;
28581
29186
  var init_EventLog = __esm({
28582
- "components/game/2d/molecules/EventLog.tsx"() {
29187
+ "components/game/2d/organisms/EventLog.tsx"() {
28583
29188
  init_atoms();
28584
29189
  init_cn();
28585
29190
  STATUS_STYLES = {
@@ -28707,7 +29312,7 @@ function ObjectRulePanel({
28707
29312
  }
28708
29313
  var nextRuleId;
28709
29314
  var init_ObjectRulePanel = __esm({
28710
- "components/game/2d/molecules/ObjectRulePanel.tsx"() {
29315
+ "components/game/2d/organisms/ObjectRulePanel.tsx"() {
28711
29316
  init_atoms();
28712
29317
  init_cn();
28713
29318
  init_TraitStateViewer();
@@ -28717,6 +29322,220 @@ var init_ObjectRulePanel = __esm({
28717
29322
  ObjectRulePanel.displayName = "ObjectRulePanel";
28718
29323
  }
28719
29324
  });
29325
+ function EventHandlerBoard({
29326
+ entity,
29327
+ stepDurationMs = 800,
29328
+ playEvent,
29329
+ completeEvent,
29330
+ editRuleEvent,
29331
+ playAgainEvent,
29332
+ className
29333
+ }) {
29334
+ const { emit } = useEventBus();
29335
+ const { t } = useTranslate();
29336
+ const resolved = boardEntity(entity);
29337
+ const objects = rows(resolved?.objects);
29338
+ const entityResult = str(resolved?.result) || "none";
29339
+ const isSuccess = entityResult === "win";
29340
+ const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
29341
+ const [selectedObjectId, setSelectedObjectId] = useState(
29342
+ objects[0] ? objId(objects[0]) : null
29343
+ );
29344
+ const [headerError, setHeaderError] = useState(false);
29345
+ const [isPlaying, setIsPlaying] = useState(false);
29346
+ const [eventLog, setEventLog] = useState([]);
29347
+ const timerRef = useRef(null);
29348
+ const logIdCounter = useRef(0);
29349
+ useEffect(() => () => {
29350
+ if (timerRef.current) clearTimeout(timerRef.current);
29351
+ }, []);
29352
+ const selectedObject = objects.find((o) => objId(o) === selectedObjectId) ?? null;
29353
+ const handleRulesChange = useCallback((objectId, rules) => {
29354
+ if (editRuleEvent) emit(`UI:${editRuleEvent}`, { objectId, rules });
29355
+ }, [editRuleEvent, emit]);
29356
+ const addLogEntry = useCallback((icon, message, status = "done") => {
29357
+ const id = `log-${logIdCounter.current++}`;
29358
+ setEventLog((prev) => [...prev, { id, timestamp: Date.now(), icon, message, status }]);
29359
+ }, []);
29360
+ const handlePlay = useCallback(() => {
29361
+ if (isPlaying || isSuccess) return;
29362
+ if (playEvent) emit(`UI:${playEvent}`, {});
29363
+ setIsPlaying(true);
29364
+ setEventLog([]);
29365
+ const allRules = [];
29366
+ objects.forEach((obj) => {
29367
+ objRules(obj).forEach((rule) => {
29368
+ allRules.push({ object: obj, rule });
29369
+ });
29370
+ });
29371
+ const triggers = Array.isArray(resolved?.triggerEvents) ? resolved.triggerEvents : [];
29372
+ const goalEvent = str(resolved?.goalEvent);
29373
+ const eventQueue = [...triggers];
29374
+ const firedEvents = /* @__PURE__ */ new Set();
29375
+ let stepIdx = 0;
29376
+ let goalReached = false;
29377
+ const processNext = () => {
29378
+ if (eventQueue.length === 0 || stepIdx > 20) {
29379
+ setIsPlaying(false);
29380
+ if (goalReached && completeEvent) emit(`UI:${completeEvent}`, { success: true });
29381
+ return;
29382
+ }
29383
+ const currentEvent = eventQueue.shift();
29384
+ if (firedEvents.has(currentEvent)) {
29385
+ timerRef.current = setTimeout(processNext, 100);
29386
+ return;
29387
+ }
29388
+ firedEvents.add(currentEvent);
29389
+ const matching = allRules.filter((r) => r.rule.whenEvent === currentEvent);
29390
+ if (matching.length === 0) {
29391
+ addLogEntry("\u26A1", t("eventHandler.noListeners", { event: currentEvent }), "done");
29392
+ } else {
29393
+ matching.forEach(({ object, rule }) => {
29394
+ addLogEntry(objIcon(object), t("eventHandler.heardEvent", { object: objName(object), event: currentEvent, action: rule.thenAction }), "done");
29395
+ eventQueue.push(rule.thenAction);
29396
+ if (rule.thenAction === goalEvent) {
29397
+ goalReached = true;
29398
+ }
29399
+ });
29400
+ }
29401
+ if (currentEvent === goalEvent) {
29402
+ goalReached = true;
29403
+ }
29404
+ stepIdx++;
29405
+ timerRef.current = setTimeout(processNext, stepDurationMs);
29406
+ };
29407
+ if (triggers.length > 0) {
29408
+ addLogEntry("\u{1F3AC}", t("eventHandler.simulationStarted", { events: triggers.join(", ") }), "active");
29409
+ }
29410
+ timerRef.current = setTimeout(processNext, stepDurationMs);
29411
+ }, [isPlaying, isSuccess, objects, resolved, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
29412
+ const handleTryAgain = useCallback(() => {
29413
+ if (timerRef.current) clearTimeout(timerRef.current);
29414
+ setIsPlaying(false);
29415
+ setEventLog([]);
29416
+ }, []);
29417
+ const handleReset = useCallback(() => {
29418
+ if (timerRef.current) clearTimeout(timerRef.current);
29419
+ setIsPlaying(false);
29420
+ setEventLog([]);
29421
+ setSelectedObjectId(objects[0] ? objId(objects[0]) : null);
29422
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
29423
+ }, [objects, playAgainEvent, emit]);
29424
+ if (!resolved) return null;
29425
+ const objectViewers = objects.map((obj) => {
29426
+ const states = objStates(obj);
29427
+ const currentState = objCurrentState(obj);
29428
+ const machine = {
29429
+ name: objName(obj),
29430
+ states,
29431
+ currentState,
29432
+ transitions: objRules(obj).map((r) => ({
29433
+ from: currentState,
29434
+ to: states.find((s) => s !== currentState) || currentState,
29435
+ event: r.whenEvent
29436
+ }))
29437
+ };
29438
+ return { obj, machine };
29439
+ });
29440
+ const hint = str(resolved.hint);
29441
+ const showHint = attempts >= 3 && hint;
29442
+ const theme = resolved.theme ?? void 0;
29443
+ const themeBackground = theme?.background;
29444
+ const headerImage = str(resolved.headerImage);
29445
+ const encourageKey = ENCOURAGEMENT_KEYS2[Math.min(attempts - 1, ENCOURAGEMENT_KEYS2.length - 1)] ?? ENCOURAGEMENT_KEYS2[0];
29446
+ return /* @__PURE__ */ jsxs(
29447
+ VStack,
29448
+ {
29449
+ className: cn("p-4 gap-6", className),
29450
+ style: {
29451
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
29452
+ backgroundSize: "cover",
29453
+ backgroundPosition: "center"
29454
+ },
29455
+ children: [
29456
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
29457
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
29458
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
29459
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
29460
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-primary/10 border border-primary/30", gap: "xs", children: [
29461
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold", children: t("game.goal") + ":" }),
29462
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: str(resolved.goalCondition) })
29463
+ ] })
29464
+ ] }),
29465
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
29466
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("eventHandler.clickObject") + ":" }),
29467
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap", gap: "sm", children: objectViewers.map(({ obj, machine }) => {
29468
+ const oid = objId(obj);
29469
+ return /* @__PURE__ */ jsx(
29470
+ Box,
29471
+ {
29472
+ className: cn(
29473
+ "p-3 rounded-container border-2 cursor-pointer transition-all hover:scale-105",
29474
+ selectedObjectId === oid ? "border-primary bg-primary/10" : "border-border bg-card hover:border-muted-foreground"
29475
+ ),
29476
+ onClick: () => setSelectedObjectId(oid),
29477
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "items-center min-w-[120px]", children: [
29478
+ /* @__PURE__ */ jsx(Typography, { variant: "h5", children: objIcon(obj) }),
29479
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground font-medium", children: objName(obj) }),
29480
+ /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "compact", size: "sm" })
29481
+ ] })
29482
+ },
29483
+ oid
29484
+ );
29485
+ }) })
29486
+ ] }),
29487
+ selectedObject && /* @__PURE__ */ jsx(
29488
+ ObjectRulePanel,
29489
+ {
29490
+ object: selectedObject,
29491
+ onRulesChange: handleRulesChange,
29492
+ disabled: isPlaying
29493
+ }
29494
+ ),
29495
+ eventLog.length > 0 && /* @__PURE__ */ jsx(EventLog, { entries: eventLog }),
29496
+ isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("eventHandler.chainComplete") }) }),
29497
+ !isPlaying && !isSuccess && attempts > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
29498
+ /* @__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) }) }),
29499
+ 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: [
29500
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
29501
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
29502
+ ] }) })
29503
+ ] }),
29504
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
29505
+ !isPlaying && !isSuccess && attempts > 0 ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
29506
+ Button,
29507
+ {
29508
+ variant: "primary",
29509
+ onClick: handlePlay,
29510
+ disabled: isPlaying || isSuccess,
29511
+ children: "\u25B6 " + t("game.play")
29512
+ }
29513
+ ),
29514
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
29515
+ ] })
29516
+ ]
29517
+ }
29518
+ );
29519
+ }
29520
+ var ENCOURAGEMENT_KEYS2;
29521
+ var init_EventHandlerBoard = __esm({
29522
+ "components/game/2d/organisms/EventHandlerBoard.tsx"() {
29523
+ init_atoms();
29524
+ init_cn();
29525
+ init_useEventBus();
29526
+ init_TraitStateViewer();
29527
+ init_ObjectRulePanel();
29528
+ init_EventLog();
29529
+ init_puzzleObject();
29530
+ init_boardEntity();
29531
+ ENCOURAGEMENT_KEYS2 = [
29532
+ "puzzle.tryAgain1",
29533
+ "puzzle.tryAgain2",
29534
+ "puzzle.tryAgain3"
29535
+ ];
29536
+ EventHandlerBoard.displayName = "EventHandlerBoard";
29537
+ }
29538
+ });
28720
29539
  function StateNode2({
28721
29540
  name,
28722
29541
  isCurrent = false,
@@ -28763,7 +29582,7 @@ function StateNode2({
28763
29582
  );
28764
29583
  }
28765
29584
  var init_StateNode = __esm({
28766
- "components/game/2d/molecules/StateNode.tsx"() {
29585
+ "components/game/2d/organisms/StateNode.tsx"() {
28767
29586
  init_atoms();
28768
29587
  init_cn();
28769
29588
  StateNode2.displayName = "StateNode";
@@ -28835,7 +29654,7 @@ function TransitionArrow({
28835
29654
  }
28836
29655
  var NODE_RADIUS;
28837
29656
  var init_TransitionArrow = __esm({
28838
- "components/game/2d/molecules/TransitionArrow.tsx"() {
29657
+ "components/game/2d/organisms/TransitionArrow.tsx"() {
28839
29658
  init_cn();
28840
29659
  NODE_RADIUS = 40;
28841
29660
  TransitionArrow.displayName = "TransitionArrow";
@@ -28885,7 +29704,7 @@ function VariablePanel({
28885
29704
  }
28886
29705
  var numField;
28887
29706
  var init_VariablePanel = __esm({
28888
- "components/game/2d/molecules/VariablePanel.tsx"() {
29707
+ "components/game/2d/organisms/VariablePanel.tsx"() {
28889
29708
  init_atoms();
28890
29709
  init_cn();
28891
29710
  numField = (v, fallback = 0) => {
@@ -28920,12 +29739,890 @@ function StateJsonView({
28920
29739
  ] });
28921
29740
  }
28922
29741
  var init_StateJsonView = __esm({
28923
- "components/game/2d/molecules/StateJsonView.tsx"() {
29742
+ "components/game/2d/organisms/StateJsonView.tsx"() {
28924
29743
  init_atoms();
28925
29744
  init_cn();
28926
29745
  StateJsonView.displayName = "StateJsonView";
28927
29746
  }
28928
29747
  });
29748
+ function layoutStates(states, width, height) {
29749
+ const cx = width / 2;
29750
+ const cy = height / 2;
29751
+ const radius = Math.min(cx, cy) - 60;
29752
+ const positions = {};
29753
+ states.forEach((state, i) => {
29754
+ const angle = 2 * Math.PI * i / states.length - Math.PI / 2;
29755
+ positions[state] = {
29756
+ x: cx + radius * Math.cos(angle),
29757
+ y: cy + radius * Math.sin(angle)
29758
+ };
29759
+ });
29760
+ return positions;
29761
+ }
29762
+ function StateArchitectBoard({
29763
+ entity,
29764
+ stepDurationMs = 600,
29765
+ testEvent,
29766
+ completeEvent,
29767
+ addTransitionEvent,
29768
+ removeTransitionEvent,
29769
+ playAgainEvent,
29770
+ className
29771
+ }) {
29772
+ const { emit } = useEventBus();
29773
+ const { t } = useTranslate();
29774
+ const resolved = boardEntity(entity);
29775
+ const entityStates = Array.isArray(resolved?.states) ? resolved.states : [];
29776
+ const initialState = str(resolved?.initialState);
29777
+ const entityName = str(resolved?.entityName);
29778
+ const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
29779
+ const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
29780
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
29781
+ const eventsField = o["events"];
29782
+ return {
29783
+ events: Array.isArray(eventsField) ? eventsField : [],
29784
+ expectedState: str(o["expectedState"]),
29785
+ label: str(o["label"])
29786
+ };
29787
+ });
29788
+ const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
29789
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
29790
+ return {
29791
+ id: str(o["id"]),
29792
+ from: str(o["from"]),
29793
+ to: str(o["to"]),
29794
+ event: str(o["event"]),
29795
+ ...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
29796
+ };
29797
+ });
29798
+ const entityVariables = rows(resolved?.variables);
29799
+ const transitions = entityTransitions;
29800
+ const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
29801
+ const entityResult = str(resolved?.result) || "none";
29802
+ const isSuccess = entityResult === "win";
29803
+ const [isTesting, setIsTesting] = useState(false);
29804
+ const [headerError, setHeaderError] = useState(false);
29805
+ const [currentState, setCurrentState] = useState(initialState);
29806
+ const [selectedState, setSelectedState] = useState(null);
29807
+ const [testResults, setTestResults] = useState([]);
29808
+ const [variables, setVariables] = useState(() => [...entityVariables]);
29809
+ const timerRef = useRef(null);
29810
+ const [addingFrom, setAddingFrom] = useState(null);
29811
+ useEffect(() => () => {
29812
+ if (timerRef.current) clearTimeout(timerRef.current);
29813
+ }, []);
29814
+ const GRAPH_W = 500;
29815
+ const GRAPH_H = 400;
29816
+ const positions = useMemo(() => layoutStates(entityStates, GRAPH_W, GRAPH_H), [entityStates]);
29817
+ const handleStateClick = useCallback((state) => {
29818
+ if (isTesting) return;
29819
+ if (addingFrom) {
29820
+ if (addingFrom !== state) {
29821
+ const event = availableEvents[0] || "EVENT";
29822
+ const newTrans = {
29823
+ id: `t-${nextTransId++}`,
29824
+ from: addingFrom,
29825
+ to: state,
29826
+ event
29827
+ };
29828
+ if (addTransitionEvent) emit(`UI:${addTransitionEvent}`, { id: newTrans.id, from: newTrans.from, to: newTrans.to, event: newTrans.event });
29829
+ }
29830
+ setAddingFrom(null);
29831
+ } else {
29832
+ setSelectedState(state);
29833
+ }
29834
+ }, [isTesting, addingFrom, availableEvents, addTransitionEvent, emit]);
29835
+ const handleStartAddTransition = useCallback(() => {
29836
+ if (!selectedState) return;
29837
+ setAddingFrom(selectedState);
29838
+ }, [selectedState]);
29839
+ const handleRemoveTransition = useCallback((transId) => {
29840
+ if (removeTransitionEvent) emit(`UI:${removeTransitionEvent}`, { id: transId });
29841
+ }, [removeTransitionEvent, emit]);
29842
+ const machine = useMemo(() => ({
29843
+ name: entityName,
29844
+ description: str(resolved?.description),
29845
+ states: entityStates,
29846
+ currentState,
29847
+ transitions: transitions.map((t2) => ({
29848
+ from: t2.from,
29849
+ to: t2.to,
29850
+ event: t2.event,
29851
+ guardHint: t2.guardHint
29852
+ }))
29853
+ }), [entityName, resolved, entityStates, currentState, transitions]);
29854
+ const handleTest = useCallback(() => {
29855
+ if (isTesting) return;
29856
+ if (testEvent) emit(`UI:${testEvent}`, {});
29857
+ setIsTesting(true);
29858
+ setTestResults([]);
29859
+ const results = [];
29860
+ let testIdx = 0;
29861
+ const runNextTest = () => {
29862
+ if (testIdx >= testCases.length) {
29863
+ const allPassed = results.every((r) => r.passed);
29864
+ setIsTesting(false);
29865
+ setTestResults(results);
29866
+ if (allPassed && completeEvent) {
29867
+ emit(`UI:${completeEvent}`, {
29868
+ success: true,
29869
+ passedTests: results.filter((r) => r.passed).length
29870
+ });
29871
+ }
29872
+ return;
29873
+ }
29874
+ const testCase = testCases[testIdx];
29875
+ if (!testCase) return;
29876
+ let state = initialState;
29877
+ for (const event of testCase.events) {
29878
+ const trans = transitions.find((t2) => t2.from === state && t2.event === event);
29879
+ if (trans) {
29880
+ state = trans.to;
29881
+ }
29882
+ }
29883
+ setCurrentState(state);
29884
+ results.push({
29885
+ label: testCase.label,
29886
+ passed: state === testCase.expectedState,
29887
+ actualState: state,
29888
+ expectedState: testCase.expectedState
29889
+ });
29890
+ testIdx++;
29891
+ timerRef.current = setTimeout(runNextTest, stepDurationMs);
29892
+ };
29893
+ timerRef.current = setTimeout(runNextTest, stepDurationMs);
29894
+ }, [isTesting, transitions, testCases, initialState, stepDurationMs, testEvent, completeEvent, emit]);
29895
+ const handleTryAgain = useCallback(() => {
29896
+ if (timerRef.current) clearTimeout(timerRef.current);
29897
+ setIsTesting(false);
29898
+ setCurrentState(initialState);
29899
+ setTestResults([]);
29900
+ }, [initialState]);
29901
+ const handleReset = useCallback(() => {
29902
+ if (timerRef.current) clearTimeout(timerRef.current);
29903
+ setIsTesting(false);
29904
+ setCurrentState(initialState);
29905
+ setTestResults([]);
29906
+ setVariables([...entityVariables]);
29907
+ setSelectedState(null);
29908
+ setAddingFrom(null);
29909
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
29910
+ }, [initialState, entityVariables, playAgainEvent, emit]);
29911
+ const codeData = useMemo(() => ({
29912
+ name: entityName,
29913
+ states: entityStates,
29914
+ initialState,
29915
+ transitions: transitions.map((t2) => ({
29916
+ from: t2.from,
29917
+ to: t2.to,
29918
+ event: t2.event,
29919
+ ...t2.guardHint ? { guard: t2.guardHint } : {}
29920
+ }))
29921
+ }), [entityName, entityStates, initialState, transitions]);
29922
+ if (!resolved) return null;
29923
+ const theme = resolved.theme ?? void 0;
29924
+ const themeBackground = theme?.background;
29925
+ const headerImage = str(resolved.headerImage);
29926
+ const hint = str(resolved.hint);
29927
+ return /* @__PURE__ */ jsxs(
29928
+ VStack,
29929
+ {
29930
+ className: cn("p-4 gap-6", className),
29931
+ style: {
29932
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
29933
+ backgroundSize: "cover",
29934
+ backgroundPosition: "center"
29935
+ },
29936
+ children: [
29937
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
29938
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
29939
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
29940
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
29941
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-warning/10 border border-warning/30", gap: "xs", children: [
29942
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-warning font-bold", children: t("game.hint") + ":" }),
29943
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: hint })
29944
+ ] })
29945
+ ] }),
29946
+ /* @__PURE__ */ jsxs(HStack, { className: "flex-wrap items-start", gap: "lg", children: [
29947
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "flex-1 min-w-[300px]", children: [
29948
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
29949
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.graph") }),
29950
+ addingFrom && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent animate-pulse", children: t("stateArchitect.clickTarget", { state: addingFrom || "" }) })
29951
+ ] }),
29952
+ /* @__PURE__ */ jsxs(
29953
+ Box,
29954
+ {
29955
+ position: "relative",
29956
+ className: "rounded-container border border-border bg-background overflow-hidden",
29957
+ style: { width: GRAPH_W, height: GRAPH_H },
29958
+ children: [
29959
+ /* @__PURE__ */ jsxs(
29960
+ "svg",
29961
+ {
29962
+ width: GRAPH_W,
29963
+ height: GRAPH_H,
29964
+ className: "absolute inset-0",
29965
+ style: { pointerEvents: "none" },
29966
+ children: [
29967
+ /* @__PURE__ */ jsxs("defs", { children: [
29968
+ /* @__PURE__ */ jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-border)" }) }),
29969
+ /* @__PURE__ */ jsx("marker", { id: "arrowhead-active", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-primary)" }) })
29970
+ ] }),
29971
+ transitions.map((t2) => {
29972
+ const fromPos = positions[t2.from];
29973
+ const toPos = positions[t2.to];
29974
+ if (!fromPos || !toPos) return null;
29975
+ const isActive = t2.from === currentState;
29976
+ return /* @__PURE__ */ jsx(
29977
+ TransitionArrow,
29978
+ {
29979
+ from: fromPos,
29980
+ to: toPos,
29981
+ eventLabel: t2.event,
29982
+ guardHint: t2.guardHint,
29983
+ isActive
29984
+ },
29985
+ t2.id
29986
+ );
29987
+ })
29988
+ ]
29989
+ }
29990
+ ),
29991
+ entityStates.map((state) => /* @__PURE__ */ jsx(
29992
+ StateNode2,
29993
+ {
29994
+ name: state,
29995
+ position: positions[state],
29996
+ isCurrent: state === currentState,
29997
+ isSelected: state === selectedState,
29998
+ isInitial: state === initialState,
29999
+ onClick: () => handleStateClick(state)
30000
+ },
30001
+ state
30002
+ ))
30003
+ ]
30004
+ }
30005
+ ),
30006
+ !isTesting && /* @__PURE__ */ jsx(HStack, { gap: "sm", children: /* @__PURE__ */ jsx(
30007
+ Button,
30008
+ {
30009
+ variant: "ghost",
30010
+ onClick: handleStartAddTransition,
30011
+ disabled: !selectedState,
30012
+ children: selectedState ? t("stateArchitect.addTransition", { state: selectedState }) : t("stateArchitect.addTransitionPrompt")
30013
+ }
30014
+ ) }),
30015
+ transitions.length > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "p-3 rounded-container bg-muted/50 border border-border", children: [
30016
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: t("stateArchitect.transitions", { count: transitions.length }) + ":" }),
30017
+ transitions.map((t2) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
30018
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: t2.from }),
30019
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "\u2014[" }),
30020
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-medium", children: t2.event }),
30021
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "]\u2192" }),
30022
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-success", children: t2.to }),
30023
+ t2.guardHint && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-warning", children: [
30024
+ "(",
30025
+ t2.guardHint,
30026
+ ")"
30027
+ ] }),
30028
+ !isTesting && /* @__PURE__ */ jsx(
30029
+ Button,
30030
+ {
30031
+ variant: "ghost",
30032
+ onClick: () => handleRemoveTransition(t2.id),
30033
+ className: "text-xs ml-auto",
30034
+ children: "\xD7"
30035
+ }
30036
+ )
30037
+ ] }, t2.id))
30038
+ ] })
30039
+ ] }),
30040
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "w-[280px] shrink-0", children: [
30041
+ /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "full", size: "sm" }),
30042
+ /* @__PURE__ */ jsx(
30043
+ VariablePanel,
30044
+ {
30045
+ entityName,
30046
+ variables
30047
+ }
30048
+ ),
30049
+ testResults.length > 0 && /* @__PURE__ */ jsxs(VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
30050
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.testResults") + ":" }),
30051
+ testResults.map((r, i) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
30052
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: r.passed ? "text-success" : "text-error", children: r.passed ? "\u2714" : "\u2717" }),
30053
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground flex-1", children: r.label }),
30054
+ !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
30055
+ ] }, i))
30056
+ ] }),
30057
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
30058
+ ] })
30059
+ ] }),
30060
+ isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
30061
+ !isTesting && !isSuccess && testResults.some((r) => !r.passed) && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30062
+ /* @__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]) }) }),
30063
+ !isSuccess && attempts >= 2 && Boolean(str(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: [
30064
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
30065
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
30066
+ ] }) })
30067
+ ] }),
30068
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
30069
+ !isTesting && !isSuccess && testResults.some((r) => !r.passed) ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
30070
+ Button,
30071
+ {
30072
+ variant: "primary",
30073
+ onClick: handleTest,
30074
+ disabled: isTesting,
30075
+ children: "\u25B6 " + t("game.runTests")
30076
+ }
30077
+ ),
30078
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
30079
+ ] })
30080
+ ]
30081
+ }
30082
+ );
30083
+ }
30084
+ var ENCOURAGEMENT_KEYS3, nextTransId;
30085
+ var init_StateArchitectBoard = __esm({
30086
+ "components/game/2d/organisms/StateArchitectBoard.tsx"() {
30087
+ init_atoms();
30088
+ init_cn();
30089
+ init_useEventBus();
30090
+ init_TraitStateViewer();
30091
+ init_StateNode();
30092
+ init_TransitionArrow();
30093
+ init_VariablePanel();
30094
+ init_StateJsonView();
30095
+ init_boardEntity();
30096
+ ENCOURAGEMENT_KEYS3 = [
30097
+ "puzzle.tryAgain1",
30098
+ "puzzle.tryAgain2",
30099
+ "puzzle.tryAgain3"
30100
+ ];
30101
+ nextTransId = 100;
30102
+ StateArchitectBoard.displayName = "StateArchitectBoard";
30103
+ }
30104
+ });
30105
+ function readSimulatorParameters(v) {
30106
+ if (!Array.isArray(v)) return [];
30107
+ const result = [];
30108
+ for (const item of v) {
30109
+ if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
30110
+ const param = item;
30111
+ if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
30112
+ result.push({
30113
+ id: str(param.id),
30114
+ label: str(param.label),
30115
+ unit: str(param.unit),
30116
+ min: num(param.min),
30117
+ max: num(param.max),
30118
+ step: num(param.step),
30119
+ initial: num(param.initial),
30120
+ correct: num(param.correct),
30121
+ tolerance: num(param.tolerance)
30122
+ });
30123
+ }
30124
+ }
30125
+ }
30126
+ return result;
30127
+ }
30128
+ function SimulatorBoard({
30129
+ entity,
30130
+ completeEvent = "PUZZLE_COMPLETE",
30131
+ setAEvent,
30132
+ setBEvent,
30133
+ checkEvent,
30134
+ playAgainEvent,
30135
+ assetManifest,
30136
+ className
30137
+ }) {
30138
+ const ui = assetManifest?.ui;
30139
+ const { emit } = useEventBus();
30140
+ const { t } = useTranslate();
30141
+ const resolved = boardEntity(entity);
30142
+ const parameters = readSimulatorParameters(resolved?.parameters);
30143
+ const [headerError, setHeaderError] = useState(false);
30144
+ if (!resolved) return null;
30145
+ const paramA = num(resolved.paramA);
30146
+ const paramB = num(resolved.paramB);
30147
+ const output = num(resolved.output);
30148
+ const targetValue = num(resolved.target);
30149
+ const targetTolerance = num(resolved.tolerance);
30150
+ const attempts = num(resolved.attempts);
30151
+ const result = str(resolved.result);
30152
+ const isWin = result === "win";
30153
+ const isComplete = result !== "none" && result !== "";
30154
+ const paramAValue = parameters[0];
30155
+ const paramBValue = parameters[1];
30156
+ const sliderValues = [paramA, paramB];
30157
+ const sliderEvents = [setAEvent, setBEvent];
30158
+ const handleParameterChange = (index, value) => {
30159
+ if (isComplete) return;
30160
+ const ev = sliderEvents[index];
30161
+ if (ev) emit(`UI:${ev}`, { value });
30162
+ };
30163
+ const handleCheck = () => {
30164
+ if (checkEvent) emit(`UI:${checkEvent}`, {});
30165
+ };
30166
+ const handlePlayAgain = () => {
30167
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
30168
+ };
30169
+ const themeBackground = (() => {
30170
+ const t2 = resolved.theme;
30171
+ if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
30172
+ const bg = t2.background;
30173
+ return str(bg);
30174
+ }
30175
+ return "";
30176
+ })();
30177
+ const headerImage = str(resolved.headerImage);
30178
+ const hint = str(resolved.hint);
30179
+ const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
30180
+ const outputLabel = str(resolved.outputLabel);
30181
+ const outputUnit = str(resolved.outputUnit);
30182
+ return /* @__PURE__ */ jsx(
30183
+ Box,
30184
+ {
30185
+ className,
30186
+ style: {
30187
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
30188
+ backgroundSize: "cover",
30189
+ backgroundPosition: "center"
30190
+ },
30191
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
30192
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
30193
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30194
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
30195
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
30196
+ ] }) }),
30197
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
30198
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("simulator.parameters") }),
30199
+ [paramAValue, paramBValue].map(
30200
+ (param, index) => param ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
30201
+ /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
30202
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: param.label }),
30203
+ /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
30204
+ sliderValues[index],
30205
+ " ",
30206
+ param.unit
30207
+ ] })
30208
+ ] }),
30209
+ /* @__PURE__ */ jsx(
30210
+ "input",
30211
+ {
30212
+ type: "range",
30213
+ min: param.min,
30214
+ max: param.max,
30215
+ step: param.step,
30216
+ value: sliderValues[index],
30217
+ onChange: (e) => handleParameterChange(index, Number(e.target.value)),
30218
+ disabled: isComplete,
30219
+ className: "w-full accent-foreground"
30220
+ }
30221
+ ),
30222
+ /* @__PURE__ */ jsxs(HStack, { justify: "between", children: [
30223
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
30224
+ param.min,
30225
+ " ",
30226
+ param.unit
30227
+ ] }),
30228
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
30229
+ param.max,
30230
+ " ",
30231
+ param.unit
30232
+ ] })
30233
+ ] })
30234
+ ] }, param.id ?? index) : null
30235
+ )
30236
+ ] }) }),
30237
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
30238
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: outputLabel }),
30239
+ /* @__PURE__ */ jsxs(Typography, { variant: "h3", weight: "bold", children: [
30240
+ output.toFixed(2),
30241
+ " ",
30242
+ outputUnit
30243
+ ] }),
30244
+ isComplete && /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
30245
+ /* @__PURE__ */ jsx(
30246
+ GameIcon,
30247
+ {
30248
+ icon: isWin ? CheckCircle : XCircle,
30249
+ assetUrl: isWin ? ui?.["correct"] : ui?.["incorrect"],
30250
+ size: "sm",
30251
+ className: isWin ? "text-success" : "text-error"
30252
+ }
30253
+ ),
30254
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: isWin ? "text-success" : "text-error", children: isWin ? str(resolved.successMessage) || t("simulator.correct") : str(resolved.failMessage) || t("simulator.incorrect") })
30255
+ ] }),
30256
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
30257
+ t("simulator.target"),
30258
+ ": ",
30259
+ targetValue,
30260
+ " ",
30261
+ outputUnit,
30262
+ " (\xB1",
30263
+ targetTolerance,
30264
+ ")"
30265
+ ] })
30266
+ ] }) }),
30267
+ showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
30268
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
30269
+ !isComplete ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleCheck, children: [
30270
+ /* @__PURE__ */ jsx(GameIcon, { icon: Play, assetUrl: ui?.["play"], size: "sm" }),
30271
+ t("simulator.simulate")
30272
+ ] }) : null,
30273
+ /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
30274
+ /* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
30275
+ t("simulator.reset")
30276
+ ] })
30277
+ ] })
30278
+ ] })
30279
+ }
30280
+ );
30281
+ }
30282
+ var init_SimulatorBoard = __esm({
30283
+ "components/game/2d/organisms/SimulatorBoard.tsx"() {
30284
+ init_atoms();
30285
+ init_useEventBus();
30286
+ init_boardEntity();
30287
+ init_GameIcon();
30288
+ SimulatorBoard.displayName = "SimulatorBoard";
30289
+ }
30290
+ });
30291
+ function toDebuggerLine(v) {
30292
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
30293
+ const id = v["id"];
30294
+ const content = v["content"];
30295
+ const isBug = v["isBug"];
30296
+ if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
30297
+ const isFlagged = v["isFlagged"];
30298
+ const explanation = v["explanation"];
30299
+ return {
30300
+ id,
30301
+ content,
30302
+ isBug,
30303
+ isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
30304
+ explanation: typeof explanation === "string" ? explanation : void 0
30305
+ };
30306
+ }
30307
+ function DebuggerBoard({
30308
+ entity,
30309
+ completeEvent = "PUZZLE_COMPLETE",
30310
+ toggleFlagEvent,
30311
+ checkEvent,
30312
+ playAgainEvent,
30313
+ assetManifest,
30314
+ className
30315
+ }) {
30316
+ const ui = assetManifest?.ui;
30317
+ const { emit } = useEventBus();
30318
+ const { t } = useTranslate();
30319
+ const resolved = boardEntity(entity);
30320
+ const [headerError, setHeaderError] = useState(false);
30321
+ const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
30322
+ const l = toDebuggerLine(v);
30323
+ return l ? [l] : [];
30324
+ }) : [];
30325
+ const result = str(resolved?.result) || "none";
30326
+ const attempts = num(resolved?.attempts);
30327
+ const submitted = result === "win";
30328
+ const showHint = !submitted && attempts >= 2 && Boolean(str(resolved?.hint));
30329
+ const bugLines = lines.filter((l) => l.isBug);
30330
+ const flaggedLines = lines.filter((l) => l.isFlagged);
30331
+ const correctFlags = lines.filter((l) => l.isBug && l.isFlagged);
30332
+ const falseFlags = lines.filter((l) => !l.isBug && l.isFlagged);
30333
+ const allCorrect = submitted;
30334
+ const toggleLine = (lineId) => {
30335
+ if (submitted) return;
30336
+ if (toggleFlagEvent) emit(`UI:${toggleFlagEvent}`, { lineId });
30337
+ };
30338
+ const handleSubmit = useCallback(() => {
30339
+ if (checkEvent) emit(`UI:${checkEvent}`, {});
30340
+ const correct = correctFlags.length === bugLines.length && falseFlags.length === 0;
30341
+ if (correct) emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
30342
+ }, [checkEvent, correctFlags.length, bugLines.length, falseFlags.length, attempts, completeEvent, emit]);
30343
+ const handleReset = () => {
30344
+ if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
30345
+ };
30346
+ if (!resolved) return null;
30347
+ const theme = resolved.theme ?? void 0;
30348
+ const themeBackground = theme?.background;
30349
+ const headerImage = str(resolved.headerImage);
30350
+ const hint = str(resolved.hint);
30351
+ return /* @__PURE__ */ jsx(
30352
+ Box,
30353
+ {
30354
+ className,
30355
+ style: {
30356
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
30357
+ backgroundSize: "cover",
30358
+ backgroundPosition: "center"
30359
+ },
30360
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
30361
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
30362
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30363
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
30364
+ /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm" }),
30365
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) })
30366
+ ] }),
30367
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
30368
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(lines.filter((l) => l.isBug).length) }) })
30369
+ ] }) }),
30370
+ /* @__PURE__ */ jsx(Card, { className: "p-0 overflow-hidden", children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: lines.map((line, i) => {
30371
+ const isFlagged = !!line.isFlagged;
30372
+ let lineStyle = "";
30373
+ if (submitted) {
30374
+ if (line.isBug && isFlagged) lineStyle = "bg-success/10";
30375
+ else if (line.isBug && !isFlagged) lineStyle = "bg-warning/10";
30376
+ else if (!line.isBug && isFlagged) lineStyle = "bg-error/10";
30377
+ } else if (isFlagged) {
30378
+ lineStyle = "bg-error/10";
30379
+ }
30380
+ return /* @__PURE__ */ jsxs(
30381
+ HStack,
30382
+ {
30383
+ gap: "none",
30384
+ align: "stretch",
30385
+ className: `border-b border-border cursor-pointer hover:bg-muted ${lineStyle}`,
30386
+ onClick: () => toggleLine(line.id),
30387
+ children: [
30388
+ /* @__PURE__ */ jsx(Box, { className: "w-10 flex-shrink-0 flex items-center justify-center border-r border-border text-muted-foreground", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: i + 1 }) }),
30389
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 px-3 py-1.5 font-mono text-sm whitespace-pre", children: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "font-mono text-sm", children: line.content }) }),
30390
+ /* @__PURE__ */ jsxs(Box, { className: "w-8 flex-shrink-0 flex items-center justify-center", children: [
30391
+ isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-error" }),
30392
+ submitted && line.isBug && !isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-warning" })
30393
+ ] })
30394
+ ]
30395
+ },
30396
+ line.id
30397
+ );
30398
+ }) }) }),
30399
+ submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30400
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
30401
+ bugLines.map((line) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "start", children: [
30402
+ /* @__PURE__ */ jsx(
30403
+ GameIcon,
30404
+ {
30405
+ icon: line.isFlagged ? CheckCircle : XCircle,
30406
+ assetUrl: line.isFlagged ? ui?.["correct"] : ui?.["incorrect"],
30407
+ size: "sm",
30408
+ className: line.isFlagged ? "text-success mt-0.5" : "text-warning mt-0.5"
30409
+ }
30410
+ ),
30411
+ /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
30412
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", weight: "bold", className: "font-mono", children: line.content.trim() }),
30413
+ line.explanation && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: line.explanation })
30414
+ ] })
30415
+ ] }, line.id))
30416
+ ] }) }),
30417
+ showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
30418
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
30419
+ !submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: flaggedLines.length === 0, children: [
30420
+ /* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
30421
+ t("debugger.submit")
30422
+ ] }),
30423
+ /* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleReset, children: [
30424
+ /* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
30425
+ t("debugger.reset")
30426
+ ] })
30427
+ ] })
30428
+ ] })
30429
+ }
30430
+ );
30431
+ }
30432
+ var init_DebuggerBoard = __esm({
30433
+ "components/game/2d/organisms/DebuggerBoard.tsx"() {
30434
+ init_atoms();
30435
+ init_useEventBus();
30436
+ init_boardEntity();
30437
+ init_GameIcon();
30438
+ DebuggerBoard.displayName = "DebuggerBoard";
30439
+ }
30440
+ });
30441
+ function NegotiatorBoard({
30442
+ entity,
30443
+ completeEvent = "PUZZLE_COMPLETE",
30444
+ playRoundEvent,
30445
+ finishEvent,
30446
+ playAgainEvent,
30447
+ assetManifest,
30448
+ className
30449
+ }) {
30450
+ const ui = assetManifest?.ui;
30451
+ const { emit } = useEventBus();
30452
+ const { t } = useTranslate();
30453
+ const resolved = boardEntity(entity);
30454
+ const [history, setHistory] = useState([]);
30455
+ const [headerError, setHeaderError] = useState(false);
30456
+ const [showHint, setShowHint] = useState(false);
30457
+ const totalRounds = num(resolved?.maxRounds);
30458
+ const targetScore = num(resolved?.targetScore);
30459
+ const currentRound = num(resolved?.round);
30460
+ const result = str(resolved?.result) || "none";
30461
+ const playerTotal = num(resolved?.score);
30462
+ const isComplete = result !== "none" || totalRounds > 0 && currentRound >= totalRounds;
30463
+ const won = result === "win";
30464
+ const lastPlayerAction = str(resolved?.lastPlayerAction);
30465
+ const lastOpponentAction = str(resolved?.lastOpponentAction);
30466
+ const lastPayoff = num(resolved?.lastPayoff);
30467
+ const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
30468
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
30469
+ return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
30470
+ return [];
30471
+ }) : [];
30472
+ const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
30473
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
30474
+ return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
30475
+ return [];
30476
+ }) : [];
30477
+ const prevRoundRef = useRef(currentRound);
30478
+ useEffect(() => {
30479
+ if (currentRound > prevRoundRef.current && lastPlayerAction) {
30480
+ const opponentPayoffEntry = payoffMatrix.find(
30481
+ (p) => p.playerAction === lastPlayerAction && p.opponentAction === lastOpponentAction
30482
+ );
30483
+ setHistory((prev) => [
30484
+ ...prev,
30485
+ {
30486
+ round: currentRound,
30487
+ playerAction: lastPlayerAction,
30488
+ opponentAction: lastOpponentAction,
30489
+ playerPayoff: lastPayoff,
30490
+ opponentPayoff: opponentPayoffEntry?.opponentPayoff ?? 0
30491
+ }
30492
+ ]);
30493
+ }
30494
+ prevRoundRef.current = currentRound;
30495
+ }, [currentRound, lastPlayerAction, lastOpponentAction, lastPayoff, payoffMatrix]);
30496
+ const opponentTotal = useMemo(() => history.reduce((s, r) => s + r.opponentPayoff, 0), [history]);
30497
+ const handleAction = useCallback((actionId) => {
30498
+ if (isComplete) return;
30499
+ if (playRoundEvent) {
30500
+ emit(`UI:${playRoundEvent}`, { playerAction: actionId, payoff: 0 });
30501
+ }
30502
+ if (totalRounds > 0 && currentRound + 1 >= totalRounds) {
30503
+ if (finishEvent) {
30504
+ emit(`UI:${finishEvent}`, {});
30505
+ }
30506
+ if (str(resolved?.hint)) {
30507
+ setShowHint(true);
30508
+ }
30509
+ }
30510
+ }, [isComplete, resolved, totalRounds, currentRound, playRoundEvent, finishEvent, emit]);
30511
+ const handleReset = useCallback(() => {
30512
+ setHistory([]);
30513
+ setShowHint(false);
30514
+ prevRoundRef.current = 0;
30515
+ if (playAgainEvent) {
30516
+ emit(`UI:${playAgainEvent}`, {});
30517
+ }
30518
+ }, [playAgainEvent, emit]);
30519
+ const completedRef = useRef(false);
30520
+ useEffect(() => {
30521
+ if (result === "win" && !completedRef.current) {
30522
+ completedRef.current = true;
30523
+ emit(`UI:${completeEvent}`, { success: true, score: playerTotal });
30524
+ } else if (result === "none") {
30525
+ completedRef.current = false;
30526
+ }
30527
+ }, [result, playerTotal, completeEvent, emit]);
30528
+ const getActionLabel = (id) => actions.find((a) => a.id === id)?.label ?? id;
30529
+ if (!resolved) return null;
30530
+ const theme = resolved.theme ?? void 0;
30531
+ const themeBackground = theme?.background;
30532
+ const headerImage = str(resolved.headerImage);
30533
+ const hint = str(resolved.hint);
30534
+ return /* @__PURE__ */ jsx(
30535
+ Box,
30536
+ {
30537
+ className,
30538
+ style: {
30539
+ backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
30540
+ backgroundSize: "cover",
30541
+ backgroundPosition: "center"
30542
+ },
30543
+ children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
30544
+ headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
30545
+ /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30546
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
30547
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
30548
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
30549
+ /* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(totalRounds) }) }),
30550
+ /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
30551
+ t("negotiator.target"),
30552
+ ": ",
30553
+ targetScore
30554
+ ] })
30555
+ ] })
30556
+ ] }) }),
30557
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", justify: "center", children: [
30558
+ /* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
30559
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.you") }),
30560
+ /* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: playerTotal })
30561
+ ] }) }),
30562
+ /* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
30563
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.opponent") }),
30564
+ /* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: opponentTotal })
30565
+ ] }) })
30566
+ ] }),
30567
+ !isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30568
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.chooseAction") }),
30569
+ /* @__PURE__ */ jsx(HStack, { gap: "sm", justify: "center", className: "flex-wrap", children: actions.map((action) => /* @__PURE__ */ jsx(
30570
+ Button,
30571
+ {
30572
+ variant: "primary",
30573
+ onClick: () => handleAction(action.id),
30574
+ children: action.label
30575
+ },
30576
+ action.id
30577
+ )) })
30578
+ ] }) }),
30579
+ history.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
30580
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.history") }),
30581
+ history.map((round) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", className: "text-sm", children: [
30582
+ /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
30583
+ "R",
30584
+ round.round
30585
+ ] }),
30586
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.playerAction) }),
30587
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "vs" }),
30588
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.opponentAction) }),
30589
+ /* @__PURE__ */ jsx(GameIcon, { icon: ArrowRight, assetUrl: ui?.["arrow"], size: "sm" }),
30590
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", weight: "bold", className: "text-success", children: [
30591
+ "+",
30592
+ round.playerPayoff
30593
+ ] }),
30594
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
30595
+ "/ +",
30596
+ round.opponentPayoff
30597
+ ] })
30598
+ ] }, round.round))
30599
+ ] }) }),
30600
+ isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
30601
+ /* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: won ? "text-success" : "text-error" }),
30602
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? str(resolved.successMessage) || t("negotiator.success") : str(resolved.failMessage) || t("negotiator.failed") }),
30603
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
30604
+ t("negotiator.finalScore"),
30605
+ ": ",
30606
+ playerTotal,
30607
+ "/",
30608
+ targetScore
30609
+ ] })
30610
+ ] }) }),
30611
+ showHint && hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
30612
+ isComplete && !won && /* @__PURE__ */ jsx(HStack, { justify: "center", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleReset, children: t("negotiator.playAgain") }) })
30613
+ ] })
30614
+ }
30615
+ );
30616
+ }
30617
+ var init_NegotiatorBoard = __esm({
30618
+ "components/game/2d/organisms/NegotiatorBoard.tsx"() {
30619
+ init_atoms();
30620
+ init_useEventBus();
30621
+ init_boardEntity();
30622
+ init_GameIcon();
30623
+ NegotiatorBoard.displayName = "NegotiatorBoard";
30624
+ }
30625
+ });
28929
30626
 
28930
30627
  // components/game/shared/lib/mechanics.ts
28931
30628
  var projectileMotion, pendulum, springOscillator;
@@ -29140,7 +30837,7 @@ function SimulationCanvas({
29140
30837
  }
29141
30838
  var PRESET_BY_ID;
29142
30839
  var init_SimulationCanvas = __esm({
29143
- "components/game/2d/molecules/SimulationCanvas.tsx"() {
30840
+ "components/game/2d/organisms/SimulationCanvas.tsx"() {
29144
30841
  init_cn();
29145
30842
  init_atoms();
29146
30843
  init_verificationRegistry();
@@ -29258,7 +30955,7 @@ function SimulationControls({
29258
30955
  ] });
29259
30956
  }
29260
30957
  var init_SimulationControls = __esm({
29261
- "components/game/2d/molecules/SimulationControls.tsx"() {
30958
+ "components/game/2d/organisms/SimulationControls.tsx"() {
29262
30959
  init_useEventBus();
29263
30960
  init_atoms();
29264
30961
  init_GameIcon();
@@ -29323,7 +31020,7 @@ function SimulationGraph({
29323
31020
  ] }) });
29324
31021
  }
29325
31022
  var init_SimulationGraph = __esm({
29326
- "components/game/2d/molecules/SimulationGraph.tsx"() {
31023
+ "components/game/2d/organisms/SimulationGraph.tsx"() {
29327
31024
  init_atoms();
29328
31025
  SimulationGraph.displayName = "SimulationGraph";
29329
31026
  }
@@ -29574,14 +31271,22 @@ var init_molecules = __esm({
29574
31271
  init_ActionTile();
29575
31272
  init_ActionPalette();
29576
31273
  init_SequenceBar();
31274
+ init_SequencerBoard();
29577
31275
  init_RuleEditor();
29578
31276
  init_EventLog();
29579
31277
  init_ObjectRulePanel();
31278
+ init_EventHandlerBoard();
29580
31279
  init_puzzleObject();
29581
31280
  init_StateNode();
29582
31281
  init_TransitionArrow();
29583
31282
  init_VariablePanel();
29584
31283
  init_StateJsonView();
31284
+ init_StateArchitectBoard();
31285
+ init_SimulatorBoard();
31286
+ init_ClassifierBoard();
31287
+ init_BuilderBoard();
31288
+ init_DebuggerBoard();
31289
+ init_NegotiatorBoard();
29585
31290
  init_SimulationCanvas();
29586
31291
  init_SimulationControls();
29587
31292
  init_SimulationGraph();
@@ -30189,13 +31894,13 @@ var init_MapView = __esm({
30189
31894
  shadowSize: [41, 41]
30190
31895
  });
30191
31896
  L.Marker.prototype.options.icon = defaultIcon;
30192
- const { useEffect: useEffect67, useRef: useRef62, useCallback: useCallback109, useState: useState100 } = React72__default;
31897
+ const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback114, useState: useState108 } = React74__default;
30193
31898
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
30194
31899
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
30195
31900
  function MapUpdater({ centerLat, centerLng, zoom }) {
30196
31901
  const map = useMap();
30197
- const prevRef = useRef62({ centerLat, centerLng, zoom });
30198
- useEffect67(() => {
31902
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
31903
+ useEffect71(() => {
30199
31904
  const prev = prevRef.current;
30200
31905
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
30201
31906
  map.setView([centerLat, centerLng], zoom);
@@ -30206,7 +31911,7 @@ var init_MapView = __esm({
30206
31911
  }
30207
31912
  function MapClickHandler({ onMapClick }) {
30208
31913
  const map = useMap();
30209
- useEffect67(() => {
31914
+ useEffect71(() => {
30210
31915
  if (!onMapClick) return;
30211
31916
  const handler = (e) => {
30212
31917
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -30234,8 +31939,8 @@ var init_MapView = __esm({
30234
31939
  showAttribution = true
30235
31940
  }) {
30236
31941
  const eventBus = useEventBus2();
30237
- const [clickedPosition, setClickedPosition] = useState100(null);
30238
- const handleMapClick = useCallback109((lat, lng) => {
31942
+ const [clickedPosition, setClickedPosition] = useState108(null);
31943
+ const handleMapClick = useCallback114((lat, lng) => {
30239
31944
  if (showClickedPin) {
30240
31945
  setClickedPosition({ lat, lng });
30241
31946
  }
@@ -30244,7 +31949,7 @@ var init_MapView = __esm({
30244
31949
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
30245
31950
  }
30246
31951
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
30247
- const handleMarkerClick = useCallback109((marker) => {
31952
+ const handleMarkerClick = useCallback114((marker) => {
30248
31953
  onMarkerClick?.(marker);
30249
31954
  if (markerClickEvent) {
30250
31955
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -31104,8 +32809,8 @@ function TableView({
31104
32809
  }) {
31105
32810
  const eventBus = useEventBus();
31106
32811
  const { t } = useTranslate();
31107
- const [visibleCount, setVisibleCount] = React72__default.useState(pageSize > 0 ? pageSize : Infinity);
31108
- const [localSelected, setLocalSelected] = React72__default.useState(/* @__PURE__ */ new Set());
32812
+ const [visibleCount, setVisibleCount] = React74__default.useState(pageSize > 0 ? pageSize : Infinity);
32813
+ const [localSelected, setLocalSelected] = React74__default.useState(/* @__PURE__ */ new Set());
31109
32814
  const colDefs = columns ?? fields ?? [];
31110
32815
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
31111
32816
  const dnd = useDataDnd({
@@ -31300,12 +33005,12 @@ function TableView({
31300
33005
  ]
31301
33006
  }
31302
33007
  );
31303
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React72__default.Fragment, { children: rowInner }, id);
33008
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React74__default.Fragment, { children: rowInner }, id);
31304
33009
  };
31305
33010
  const items = Array.from(data);
31306
33011
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
31307
33012
  let runningIndex = 0;
31308
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
33013
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
31309
33014
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
31310
33015
  group.items.map((row) => renderRow(row, runningIndex++))
31311
33016
  ] }, gi)) });
@@ -32662,7 +34367,7 @@ var init_StepFlow = __esm({
32662
34367
  className
32663
34368
  }) => {
32664
34369
  if (orientation === "vertical") {
32665
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React72__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
34370
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React74__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
32666
34371
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
32667
34372
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
32668
34373
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -32673,7 +34378,7 @@ var init_StepFlow = __esm({
32673
34378
  ] })
32674
34379
  ] }) }, index)) });
32675
34380
  }
32676
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
34381
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
32677
34382
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
32678
34383
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
32679
34384
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -33658,7 +35363,7 @@ var init_LikertScale = __esm({
33658
35363
  md: "text-base",
33659
35364
  lg: "text-lg"
33660
35365
  };
33661
- LikertScale = React72__default.forwardRef(
35366
+ LikertScale = React74__default.forwardRef(
33662
35367
  ({
33663
35368
  question,
33664
35369
  options = DEFAULT_LIKERT_OPTIONS,
@@ -33670,7 +35375,7 @@ var init_LikertScale = __esm({
33670
35375
  variant = "radios",
33671
35376
  className
33672
35377
  }, ref) => {
33673
- const groupId = React72__default.useId();
35378
+ const groupId = React74__default.useId();
33674
35379
  const eventBus = useEventBus();
33675
35380
  const handleSelect = useCallback(
33676
35381
  (next) => {
@@ -35952,7 +37657,7 @@ var init_DocBreadcrumb = __esm({
35952
37657
  "aria-label": t("aria.breadcrumb"),
35953
37658
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
35954
37659
  const isLast = idx === items.length - 1;
35955
- return /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
37660
+ return /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
35956
37661
  idx > 0 && /* @__PURE__ */ jsx(
35957
37662
  Icon,
35958
37663
  {
@@ -36821,7 +38526,7 @@ var init_MiniStateMachine = __esm({
36821
38526
  const x = 2 + i * (NODE_W + GAP2 + ARROW_W + GAP2);
36822
38527
  const tc = transitionCounts[s.name] ?? 0;
36823
38528
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
36824
- return /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
38529
+ return /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
36825
38530
  /* @__PURE__ */ jsx(
36826
38531
  AvlState,
36827
38532
  {
@@ -37025,7 +38730,7 @@ var init_PageHeader = __esm({
37025
38730
  info: "bg-info/10 text-info"
37026
38731
  };
37027
38732
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37028
- 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(React72__default.Fragment, { children: [
38733
+ 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(React74__default.Fragment, { children: [
37029
38734
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37030
38735
  crumb.href ? /* @__PURE__ */ jsx(
37031
38736
  "a",
@@ -37383,7 +39088,7 @@ var init_Section = __esm({
37383
39088
  as: Component = "section"
37384
39089
  }) => {
37385
39090
  const hasHeader = title || description || action;
37386
- return React72__default.createElement(
39091
+ return React74__default.createElement(
37387
39092
  Component,
37388
39093
  {
37389
39094
  className: cn(
@@ -37757,7 +39462,7 @@ var init_WizardContainer = __esm({
37757
39462
  const isCompleted = index < currentStep;
37758
39463
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
37759
39464
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
37760
- return /* @__PURE__ */ jsxs(React72__default.Fragment, { children: [
39465
+ return /* @__PURE__ */ jsxs(React74__default.Fragment, { children: [
37761
39466
  /* @__PURE__ */ jsx(
37762
39467
  Button,
37763
39468
  {
@@ -40406,7 +42111,7 @@ var init_DetailPanel = __esm({
40406
42111
  }
40407
42112
  });
40408
42113
  function extractTitle(children) {
40409
- if (!React72__default.isValidElement(children)) return void 0;
42114
+ if (!React74__default.isValidElement(children)) return void 0;
40410
42115
  const props = children.props;
40411
42116
  if (typeof props.title === "string") {
40412
42117
  return props.title;
@@ -40756,12 +42461,12 @@ var init_Form = __esm({
40756
42461
  const isSchemaEntity = isOrbitalEntitySchema(entity);
40757
42462
  const resolvedEntity = isSchemaEntity ? entity : void 0;
40758
42463
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
40759
- const normalizedInitialData = React72__default.useMemo(() => {
42464
+ const normalizedInitialData = React74__default.useMemo(() => {
40760
42465
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
40761
42466
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
40762
42467
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
40763
42468
  }, [entity, initialData]);
40764
- const entityDerivedFields = React72__default.useMemo(() => {
42469
+ const entityDerivedFields = React74__default.useMemo(() => {
40765
42470
  if (fields && fields.length > 0) return void 0;
40766
42471
  if (!resolvedEntity) return void 0;
40767
42472
  return resolvedEntity.fields.map(
@@ -40782,16 +42487,16 @@ var init_Form = __esm({
40782
42487
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
40783
42488
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
40784
42489
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
40785
- const [formData, setFormData] = React72__default.useState(
42490
+ const [formData, setFormData] = React74__default.useState(
40786
42491
  normalizedInitialData
40787
42492
  );
40788
- const [collapsedSections, setCollapsedSections] = React72__default.useState(
42493
+ const [collapsedSections, setCollapsedSections] = React74__default.useState(
40789
42494
  /* @__PURE__ */ new Set()
40790
42495
  );
40791
- const [submitError, setSubmitError] = React72__default.useState(null);
40792
- const formRef = React72__default.useRef(null);
42496
+ const [submitError, setSubmitError] = React74__default.useState(null);
42497
+ const formRef = React74__default.useRef(null);
40793
42498
  const formMode = props.mode;
40794
- const mountedRef = React72__default.useRef(false);
42499
+ const mountedRef = React74__default.useRef(false);
40795
42500
  if (!mountedRef.current) {
40796
42501
  mountedRef.current = true;
40797
42502
  debug("forms", "mount", {
@@ -40804,7 +42509,7 @@ var init_Form = __esm({
40804
42509
  });
40805
42510
  }
40806
42511
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
40807
- const evalContext = React72__default.useMemo(
42512
+ const evalContext = React74__default.useMemo(
40808
42513
  () => ({
40809
42514
  formValues: formData,
40810
42515
  globalVariables: externalContext?.globalVariables ?? {},
@@ -40813,7 +42518,7 @@ var init_Form = __esm({
40813
42518
  }),
40814
42519
  [formData, externalContext]
40815
42520
  );
40816
- React72__default.useEffect(() => {
42521
+ React74__default.useEffect(() => {
40817
42522
  debug("forms", "initialData-sync", {
40818
42523
  mode: formMode,
40819
42524
  normalizedInitialData,
@@ -40824,7 +42529,7 @@ var init_Form = __esm({
40824
42529
  setFormData(normalizedInitialData);
40825
42530
  }
40826
42531
  }, [normalizedInitialData]);
40827
- const processCalculations = React72__default.useCallback(
42532
+ const processCalculations = React74__default.useCallback(
40828
42533
  (changedFieldId, newFormData) => {
40829
42534
  if (!hiddenCalculations.length) return;
40830
42535
  const context = {
@@ -40849,7 +42554,7 @@ var init_Form = __esm({
40849
42554
  },
40850
42555
  [hiddenCalculations, externalContext, eventBus]
40851
42556
  );
40852
- const checkViolations = React72__default.useCallback(
42557
+ const checkViolations = React74__default.useCallback(
40853
42558
  (changedFieldId, newFormData) => {
40854
42559
  if (!violationTriggers.length) return;
40855
42560
  const context = {
@@ -40887,7 +42592,7 @@ var init_Form = __esm({
40887
42592
  processCalculations(name, newFormData);
40888
42593
  checkViolations(name, newFormData);
40889
42594
  };
40890
- const isFieldVisible = React72__default.useCallback(
42595
+ const isFieldVisible = React74__default.useCallback(
40891
42596
  (fieldName) => {
40892
42597
  const condition = conditionalFields[fieldName];
40893
42598
  if (!condition) return true;
@@ -40895,7 +42600,7 @@ var init_Form = __esm({
40895
42600
  },
40896
42601
  [conditionalFields, evalContext]
40897
42602
  );
40898
- const isSectionVisible = React72__default.useCallback(
42603
+ const isSectionVisible = React74__default.useCallback(
40899
42604
  (section) => {
40900
42605
  if (!section.condition) return true;
40901
42606
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -40971,7 +42676,7 @@ var init_Form = __esm({
40971
42676
  eventBus.emit(`UI:${onCancel}`);
40972
42677
  }
40973
42678
  };
40974
- const renderField = React72__default.useCallback(
42679
+ const renderField = React74__default.useCallback(
40975
42680
  (field) => {
40976
42681
  const fieldName = field.name || field.field;
40977
42682
  if (!fieldName) return null;
@@ -40992,7 +42697,7 @@ var init_Form = __esm({
40992
42697
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
40993
42698
  );
40994
42699
  const effectiveFields = entityDerivedFields ?? fields;
40995
- const normalizedFields = React72__default.useMemo(() => {
42700
+ const normalizedFields = React74__default.useMemo(() => {
40996
42701
  if (!effectiveFields || effectiveFields.length === 0) return [];
40997
42702
  return effectiveFields.map((field) => {
40998
42703
  if (typeof field === "string") {
@@ -41016,7 +42721,7 @@ var init_Form = __esm({
41016
42721
  return field;
41017
42722
  });
41018
42723
  }, [effectiveFields, resolvedEntity]);
41019
- const schemaFields = React72__default.useMemo(() => {
42724
+ const schemaFields = React74__default.useMemo(() => {
41020
42725
  if (normalizedFields.length === 0) return null;
41021
42726
  if (isDebugEnabled()) {
41022
42727
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -41026,7 +42731,7 @@ var init_Form = __esm({
41026
42731
  }
41027
42732
  return normalizedFields.map(renderField).filter(Boolean);
41028
42733
  }, [normalizedFields, renderField, entityName, conditionalFields]);
41029
- const sectionElements = React72__default.useMemo(() => {
42734
+ const sectionElements = React74__default.useMemo(() => {
41030
42735
  if (!sections || sections.length === 0) return null;
41031
42736
  return sections.map((section) => {
41032
42737
  if (!isSectionVisible(section)) {
@@ -41751,7 +43456,7 @@ var init_List = __esm({
41751
43456
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
41752
43457
  return [];
41753
43458
  }, [entity]);
41754
- const getItemActions = React72__default.useCallback(
43459
+ const getItemActions = React74__default.useCallback(
41755
43460
  (item) => {
41756
43461
  if (!itemActions) return [];
41757
43462
  if (typeof itemActions === "function") {
@@ -42226,7 +43931,7 @@ var init_MediaGallery = __esm({
42226
43931
  [selectable, selectedItems, selectionEvent, eventBus]
42227
43932
  );
42228
43933
  const entityData = Array.isArray(entity) ? entity : [];
42229
- const items = React72__default.useMemo(() => {
43934
+ const items = React74__default.useMemo(() => {
42230
43935
  if (propItems) return propItems;
42231
43936
  if (entityData.length === 0) return [];
42232
43937
  return entityData.map((record, idx) => {
@@ -42389,7 +44094,7 @@ var init_MediaGallery = __esm({
42389
44094
  }
42390
44095
  });
42391
44096
  function extractTitle2(children) {
42392
- if (!React72__default.isValidElement(children)) return void 0;
44097
+ if (!React74__default.isValidElement(children)) return void 0;
42393
44098
  const props = children.props;
42394
44099
  if (typeof props.title === "string") {
42395
44100
  return props.title;
@@ -42644,7 +44349,7 @@ var init_debugRegistry = __esm({
42644
44349
  }
42645
44350
  });
42646
44351
  function useDebugData() {
42647
- const [data, setData] = React72.useState(() => ({
44352
+ const [data, setData] = React74.useState(() => ({
42648
44353
  traits: [],
42649
44354
  ticks: [],
42650
44355
  guards: [],
@@ -42658,7 +44363,7 @@ function useDebugData() {
42658
44363
  },
42659
44364
  lastUpdate: Date.now()
42660
44365
  }));
42661
- React72.useEffect(() => {
44366
+ React74.useEffect(() => {
42662
44367
  const updateData = () => {
42663
44368
  setData({
42664
44369
  traits: getAllTraits(),
@@ -42767,12 +44472,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42767
44472
  return positions;
42768
44473
  }
42769
44474
  function WalkMinimap() {
42770
- const [walkStep, setWalkStep] = React72.useState(null);
42771
- const [traits2, setTraits] = React72.useState([]);
42772
- const [coveredEdges, setCoveredEdges] = React72.useState([]);
42773
- const [completedTraits, setCompletedTraits] = React72.useState(/* @__PURE__ */ new Set());
42774
- const prevTraitRef = React72.useRef(null);
42775
- React72.useEffect(() => {
44475
+ const [walkStep, setWalkStep] = React74.useState(null);
44476
+ const [traits2, setTraits] = React74.useState([]);
44477
+ const [coveredEdges, setCoveredEdges] = React74.useState([]);
44478
+ const [completedTraits, setCompletedTraits] = React74.useState(/* @__PURE__ */ new Set());
44479
+ const prevTraitRef = React74.useRef(null);
44480
+ React74.useEffect(() => {
42776
44481
  const interval = setInterval(() => {
42777
44482
  const w = window;
42778
44483
  const step = w.__orbitalWalkStep;
@@ -43208,15 +44913,15 @@ var init_EntitiesTab = __esm({
43208
44913
  });
43209
44914
  function EventFlowTab({ events: events2 }) {
43210
44915
  const { t } = useTranslate();
43211
- const [filter, setFilter] = React72.useState("all");
43212
- const containerRef = React72.useRef(null);
43213
- const [autoScroll, setAutoScroll] = React72.useState(true);
43214
- React72.useEffect(() => {
44916
+ const [filter, setFilter] = React74.useState("all");
44917
+ const containerRef = React74.useRef(null);
44918
+ const [autoScroll, setAutoScroll] = React74.useState(true);
44919
+ React74.useEffect(() => {
43215
44920
  if (autoScroll && containerRef.current) {
43216
44921
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
43217
44922
  }
43218
44923
  }, [events2.length, autoScroll]);
43219
- const filteredEvents = React72.useMemo(() => {
44924
+ const filteredEvents = React74.useMemo(() => {
43220
44925
  if (filter === "all") return events2;
43221
44926
  return events2.filter((e) => e.type === filter);
43222
44927
  }, [events2, filter]);
@@ -43332,7 +45037,7 @@ var init_EventFlowTab = __esm({
43332
45037
  });
43333
45038
  function GuardsPanel({ guards }) {
43334
45039
  const { t } = useTranslate();
43335
- const [filter, setFilter] = React72.useState("all");
45040
+ const [filter, setFilter] = React74.useState("all");
43336
45041
  if (guards.length === 0) {
43337
45042
  return /* @__PURE__ */ jsx(
43338
45043
  EmptyState,
@@ -43345,7 +45050,7 @@ function GuardsPanel({ guards }) {
43345
45050
  }
43346
45051
  const passedCount = guards.filter((g) => g.result).length;
43347
45052
  const failedCount = guards.length - passedCount;
43348
- const filteredGuards = React72.useMemo(() => {
45053
+ const filteredGuards = React74.useMemo(() => {
43349
45054
  if (filter === "all") return guards;
43350
45055
  if (filter === "passed") return guards.filter((g) => g.result);
43351
45056
  return guards.filter((g) => !g.result);
@@ -43508,10 +45213,10 @@ function EffectBadge({ effect }) {
43508
45213
  }
43509
45214
  function TransitionTimeline({ transitions }) {
43510
45215
  const { t } = useTranslate();
43511
- const containerRef = React72.useRef(null);
43512
- const [autoScroll, setAutoScroll] = React72.useState(true);
43513
- const [expandedId, setExpandedId] = React72.useState(null);
43514
- React72.useEffect(() => {
45216
+ const containerRef = React74.useRef(null);
45217
+ const [autoScroll, setAutoScroll] = React74.useState(true);
45218
+ const [expandedId, setExpandedId] = React74.useState(null);
45219
+ React74.useEffect(() => {
43515
45220
  if (autoScroll && containerRef.current) {
43516
45221
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
43517
45222
  }
@@ -43791,9 +45496,9 @@ function getAllEvents(traits2) {
43791
45496
  function EventDispatcherTab({ traits: traits2, schema }) {
43792
45497
  const eventBus = useEventBus();
43793
45498
  const { t } = useTranslate();
43794
- const [log18, setLog] = React72.useState([]);
43795
- const prevStatesRef = React72.useRef(/* @__PURE__ */ new Map());
43796
- React72.useEffect(() => {
45499
+ const [log18, setLog] = React74.useState([]);
45500
+ const prevStatesRef = React74.useRef(/* @__PURE__ */ new Map());
45501
+ React74.useEffect(() => {
43797
45502
  for (const trait of traits2) {
43798
45503
  const prev = prevStatesRef.current.get(trait.id);
43799
45504
  if (prev && prev !== trait.currentState) {
@@ -43962,10 +45667,10 @@ function VerifyModePanel({
43962
45667
  localCount
43963
45668
  }) {
43964
45669
  const { t } = useTranslate();
43965
- const [expanded, setExpanded] = React72.useState(true);
43966
- const scrollRef = React72.useRef(null);
43967
- const prevCountRef = React72.useRef(0);
43968
- React72.useEffect(() => {
45670
+ const [expanded, setExpanded] = React74.useState(true);
45671
+ const scrollRef = React74.useRef(null);
45672
+ const prevCountRef = React74.useRef(0);
45673
+ React74.useEffect(() => {
43969
45674
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43970
45675
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43971
45676
  }
@@ -44022,10 +45727,10 @@ function RuntimeDebugger({
44022
45727
  schema
44023
45728
  }) {
44024
45729
  const { t } = useTranslate();
44025
- const [isCollapsed, setIsCollapsed] = React72.useState(mode === "verify" ? true : defaultCollapsed);
44026
- const [isVisible, setIsVisible] = React72.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
45730
+ const [isCollapsed, setIsCollapsed] = React74.useState(mode === "verify" ? true : defaultCollapsed);
45731
+ const [isVisible, setIsVisible] = React74.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
44027
45732
  const debugData = useDebugData();
44028
- React72.useEffect(() => {
45733
+ React74.useEffect(() => {
44029
45734
  if (mode === "inline") return;
44030
45735
  return onDebugToggle((enabled) => {
44031
45736
  setIsVisible(enabled);
@@ -44034,7 +45739,7 @@ function RuntimeDebugger({
44034
45739
  }
44035
45740
  });
44036
45741
  }, [mode]);
44037
- React72.useEffect(() => {
45742
+ React74.useEffect(() => {
44038
45743
  if (mode === "inline") return;
44039
45744
  const handleKeyDown = (e) => {
44040
45745
  if (e.key === "`" && isVisible) {
@@ -44554,7 +46259,7 @@ var init_StatCard = __esm({
44554
46259
  const labelToUse = propLabel ?? propTitle;
44555
46260
  const eventBus = useEventBus();
44556
46261
  const { t } = useTranslate();
44557
- const handleActionClick = React72__default.useCallback(() => {
46262
+ const handleActionClick = React74__default.useCallback(() => {
44558
46263
  if (action?.event) {
44559
46264
  eventBus.emit(`UI:${action.event}`, {});
44560
46265
  }
@@ -44565,7 +46270,7 @@ var init_StatCard = __esm({
44565
46270
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
44566
46271
  const isLoading = externalLoading ?? false;
44567
46272
  const error = externalError;
44568
- const computeMetricValue = React72__default.useCallback(
46273
+ const computeMetricValue = React74__default.useCallback(
44569
46274
  (metric, items) => {
44570
46275
  if (metric.value !== void 0) {
44571
46276
  return metric.value;
@@ -44604,7 +46309,7 @@ var init_StatCard = __esm({
44604
46309
  },
44605
46310
  []
44606
46311
  );
44607
- const schemaStats = React72__default.useMemo(() => {
46312
+ const schemaStats = React74__default.useMemo(() => {
44608
46313
  if (!metrics || metrics.length === 0) return null;
44609
46314
  return metrics.map((metric) => ({
44610
46315
  label: metric.label,
@@ -44612,7 +46317,7 @@ var init_StatCard = __esm({
44612
46317
  format: metric.format
44613
46318
  }));
44614
46319
  }, [metrics, data, computeMetricValue]);
44615
- const calculatedTrend = React72__default.useMemo(() => {
46320
+ const calculatedTrend = React74__default.useMemo(() => {
44616
46321
  if (manualTrend !== void 0) return manualTrend;
44617
46322
  if (previousValue === void 0 || currentValue2 === void 0)
44618
46323
  return void 0;
@@ -45252,8 +46957,8 @@ var init_SubagentTracePanel = __esm({
45252
46957
  ] });
45253
46958
  };
45254
46959
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
45255
- const endRef = React72__default.useRef(null);
45256
- React72__default.useEffect(() => {
46960
+ const endRef = React74__default.useRef(null);
46961
+ React74__default.useEffect(() => {
45257
46962
  if (!autoScroll) return;
45258
46963
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
45259
46964
  }, [activities.length, autoScroll]);
@@ -45347,7 +47052,7 @@ var init_SubagentTracePanel = __esm({
45347
47052
  };
45348
47053
  SubagentRichCard = ({ subagent }) => {
45349
47054
  const { t } = useTranslate();
45350
- const activities = React72__default.useMemo(
47055
+ const activities = React74__default.useMemo(
45351
47056
  () => subagentMessagesToActivities(subagent.messages),
45352
47057
  [subagent.messages]
45353
47058
  );
@@ -45424,8 +47129,8 @@ var init_SubagentTracePanel = __esm({
45424
47129
  ] });
45425
47130
  };
45426
47131
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
45427
- const endRef = React72__default.useRef(null);
45428
- React72__default.useEffect(() => {
47132
+ const endRef = React74__default.useRef(null);
47133
+ React74__default.useEffect(() => {
45429
47134
  if (!autoScroll) return;
45430
47135
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
45431
47136
  }, [messages.length, autoScroll]);
@@ -45855,7 +47560,7 @@ var init_Timeline = __esm({
45855
47560
  }) => {
45856
47561
  const { t } = useTranslate();
45857
47562
  const entityData = entity ?? [];
45858
- const items = React72__default.useMemo(() => {
47563
+ const items = React74__default.useMemo(() => {
45859
47564
  if (propItems) return propItems;
45860
47565
  if (entityData.length === 0) return [];
45861
47566
  return entityData.map((record, idx) => {
@@ -45957,7 +47662,7 @@ var init_Timeline = __esm({
45957
47662
  }
45958
47663
  });
45959
47664
  function extractToastProps(children) {
45960
- if (!React72__default.isValidElement(children)) {
47665
+ if (!React74__default.isValidElement(children)) {
45961
47666
  if (typeof children === "string") {
45962
47667
  return { message: children };
45963
47668
  }
@@ -45999,7 +47704,7 @@ var init_ToastSlot = __esm({
45999
47704
  eventBus.emit(`${prefix}CLOSE`);
46000
47705
  };
46001
47706
  if (!isVisible) return null;
46002
- const isCustomContent = React72__default.isValidElement(children) && !message;
47707
+ const isCustomContent = React74__default.isValidElement(children) && !message;
46003
47708
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
46004
47709
  Toast,
46005
47710
  {
@@ -46016,7 +47721,7 @@ var init_ToastSlot = __esm({
46016
47721
  }
46017
47722
  });
46018
47723
  function lazyThree(name, loader) {
46019
- const Lazy = React72__default.lazy(
47724
+ const Lazy = React74__default.lazy(
46020
47725
  () => loader().then((m) => {
46021
47726
  const Resolved = m[name];
46022
47727
  if (!Resolved) {
@@ -46028,13 +47733,13 @@ function lazyThree(name, loader) {
46028
47733
  })
46029
47734
  );
46030
47735
  function ThreeWrapper(props) {
46031
- return React72__default.createElement(
47736
+ return React74__default.createElement(
46032
47737
  ThreeBoundary,
46033
47738
  { name },
46034
- React72__default.createElement(
46035
- React72__default.Suspense,
47739
+ React74__default.createElement(
47740
+ React74__default.Suspense,
46036
47741
  { fallback: null },
46037
- React72__default.createElement(Lazy, props)
47742
+ React74__default.createElement(Lazy, props)
46038
47743
  )
46039
47744
  );
46040
47745
  }
@@ -46070,6 +47775,7 @@ var init_component_registry_generated = __esm({
46070
47775
  init_LayoutPatterns();
46071
47776
  init_BranchingLogicBuilder();
46072
47777
  init_Breadcrumb();
47778
+ init_BuilderBoard();
46073
47779
  init_CTABanner();
46074
47780
  init_CalendarGrid();
46075
47781
  init_Canvas2D();
@@ -46085,6 +47791,7 @@ var init_component_registry_generated = __esm({
46085
47791
  init_Checkbox();
46086
47792
  init_ChemistryCanvas();
46087
47793
  init_ChoiceButton();
47794
+ init_ClassifierBoard();
46088
47795
  init_CodeBlock();
46089
47796
  init_CodeRunnerPanel();
46090
47797
  init_ComboCounter();
@@ -46108,6 +47815,7 @@ var init_component_registry_generated = __esm({
46108
47815
  init_DateRangePicker();
46109
47816
  init_DateRangeSelector();
46110
47817
  init_DayCell();
47818
+ init_DebuggerBoard();
46111
47819
  init_DetailPanel();
46112
47820
  init_Dialog();
46113
47821
  init_DialogueBubble();
@@ -46123,6 +47831,7 @@ var init_component_registry_generated = __esm({
46123
47831
  init_EmptyState();
46124
47832
  init_ErrorBoundary();
46125
47833
  init_ErrorState();
47834
+ init_EventHandlerBoard();
46126
47835
  init_EventLog();
46127
47836
  init_FeatureCard();
46128
47837
  init_FeatureDetailPageTemplate();
@@ -46189,6 +47898,7 @@ var init_component_registry_generated = __esm({
46189
47898
  init_ModalSlot();
46190
47899
  init_ModuleCard();
46191
47900
  init_Navigation();
47901
+ init_NegotiatorBoard();
46192
47902
  init_NumberStepper();
46193
47903
  init_OptionConstraintGroup();
46194
47904
  init_OrbitalVisualization();
@@ -46227,6 +47937,7 @@ var init_component_registry_generated = __esm({
46227
47937
  init_SegmentRenderer();
46228
47938
  init_Select();
46229
47939
  init_SequenceBar();
47940
+ init_SequencerBoard();
46230
47941
  init_ServiceCatalog();
46231
47942
  init_ShowcaseCard();
46232
47943
  init_ShowcaseOrganism();
@@ -46235,6 +47946,7 @@ var init_component_registry_generated = __esm({
46235
47946
  init_SignaturePad();
46236
47947
  init_SimpleGrid();
46237
47948
  init_SimulationCanvas();
47949
+ init_SimulatorBoard();
46238
47950
  init_Skeleton();
46239
47951
  init_SocialProof();
46240
47952
  init_SortableList();
@@ -46248,6 +47960,7 @@ var init_component_registry_generated = __esm({
46248
47960
  init_StatBadge();
46249
47961
  init_StatCard();
46250
47962
  init_StatDisplay();
47963
+ init_StateArchitectBoard();
46251
47964
  init_StateIndicator();
46252
47965
  init_StateMachineView();
46253
47966
  init_StatsGrid();
@@ -46302,7 +48015,7 @@ var init_component_registry_generated = __esm({
46302
48015
  init_WizardContainer();
46303
48016
  init_WizardNavigation();
46304
48017
  init_WizardProgress();
46305
- ThreeBoundary = class extends React72__default.Component {
48018
+ ThreeBoundary = class extends React74__default.Component {
46306
48019
  constructor() {
46307
48020
  super(...arguments);
46308
48021
  __publicField(this, "state", { failed: false });
@@ -46312,7 +48025,7 @@ var init_component_registry_generated = __esm({
46312
48025
  }
46313
48026
  render() {
46314
48027
  if (this.state.failed) {
46315
- return React72__default.createElement(
48028
+ return React74__default.createElement(
46316
48029
  "div",
46317
48030
  {
46318
48031
  "data-testid": "three-unavailable",
@@ -46358,6 +48071,7 @@ var init_component_registry_generated = __esm({
46358
48071
  "BoxPattern": BoxPattern,
46359
48072
  "BranchingLogicBuilder": BranchingLogicBuilder,
46360
48073
  "Breadcrumb": Breadcrumb,
48074
+ "BuilderBoard": BuilderBoard,
46361
48075
  "Button": ButtonPattern,
46362
48076
  "ButtonPattern": ButtonPattern,
46363
48077
  "CTABanner": CTABanner,
@@ -46375,6 +48089,7 @@ var init_component_registry_generated = __esm({
46375
48089
  "Checkbox": Checkbox,
46376
48090
  "ChemistryCanvas": ChemistryCanvas,
46377
48091
  "ChoiceButton": ChoiceButton,
48092
+ "ClassifierBoard": ClassifierBoard,
46378
48093
  "CodeBlock": CodeBlock,
46379
48094
  "CodeRunnerPanel": CodeRunnerPanel,
46380
48095
  "ComboCounter": ComboCounter,
@@ -46398,6 +48113,7 @@ var init_component_registry_generated = __esm({
46398
48113
  "DateRangePicker": DateRangePicker,
46399
48114
  "DateRangeSelector": DateRangeSelector,
46400
48115
  "DayCell": DayCell,
48116
+ "DebuggerBoard": DebuggerBoard,
46401
48117
  "DetailPanel": DetailPanel,
46402
48118
  "Dialog": Dialog,
46403
48119
  "DialogueBubble": DialogueBubble,
@@ -46415,6 +48131,7 @@ var init_component_registry_generated = __esm({
46415
48131
  "EmptyState": EmptyState,
46416
48132
  "ErrorBoundary": ErrorBoundary,
46417
48133
  "ErrorState": ErrorState,
48134
+ "EventHandlerBoard": EventHandlerBoard,
46418
48135
  "EventLog": EventLog,
46419
48136
  "FeatureCard": FeatureCard,
46420
48137
  "FeatureDetailPageTemplate": FeatureDetailPageTemplate,
@@ -46489,6 +48206,7 @@ var init_component_registry_generated = __esm({
46489
48206
  "ModalSlot": ModalSlot,
46490
48207
  "ModuleCard": ModuleCard,
46491
48208
  "Navigation": Navigation,
48209
+ "NegotiatorBoard": NegotiatorBoard,
46492
48210
  "NumberStepper": NumberStepper,
46493
48211
  "OptionConstraintGroup": OptionConstraintGroup,
46494
48212
  "OrbitalVisualization": OrbitalVisualization,
@@ -46527,6 +48245,7 @@ var init_component_registry_generated = __esm({
46527
48245
  "SegmentRenderer": SegmentRenderer,
46528
48246
  "Select": Select,
46529
48247
  "SequenceBar": SequenceBar,
48248
+ "SequencerBoard": SequencerBoard,
46530
48249
  "ServiceCatalog": ServiceCatalog,
46531
48250
  "ShowcaseCard": ShowcaseCard,
46532
48251
  "ShowcaseOrganism": ShowcaseOrganism,
@@ -46535,6 +48254,7 @@ var init_component_registry_generated = __esm({
46535
48254
  "SignaturePad": SignaturePad,
46536
48255
  "SimpleGrid": SimpleGrid,
46537
48256
  "SimulationCanvas": SimulationCanvas,
48257
+ "SimulatorBoard": SimulatorBoard,
46538
48258
  "Skeleton": Skeleton,
46539
48259
  "SocialProof": SocialProof,
46540
48260
  "SortableList": SortableList,
@@ -46551,6 +48271,7 @@ var init_component_registry_generated = __esm({
46551
48271
  "StatBadge": StatBadge,
46552
48272
  "StatCard": StatCard,
46553
48273
  "StatDisplay": StatDisplay,
48274
+ "StateArchitectBoard": StateArchitectBoard,
46554
48275
  "StateIndicator": StateIndicator,
46555
48276
  "StateMachineView": StateMachineView,
46556
48277
  "StatsGrid": StatsGrid,
@@ -46624,7 +48345,7 @@ function SuspenseConfigProvider({
46624
48345
  config,
46625
48346
  children
46626
48347
  }) {
46627
- return React72__default.createElement(
48348
+ return React74__default.createElement(
46628
48349
  SuspenseConfigContext.Provider,
46629
48350
  { value: config },
46630
48351
  children
@@ -46666,7 +48387,7 @@ function enrichFormFields(fields, entityDef) {
46666
48387
  }
46667
48388
  return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
46668
48389
  }
46669
- if (field && typeof field === "object" && !Array.isArray(field) && !React72__default.isValidElement(field) && !(field instanceof Date)) {
48390
+ if (field && typeof field === "object" && !Array.isArray(field) && !React74__default.isValidElement(field) && !(field instanceof Date)) {
46670
48391
  const obj = field;
46671
48392
  const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
46672
48393
  if (!fieldName) return field;
@@ -47119,7 +48840,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47119
48840
  const key = `${parentId}-${index}-trait:${traitName}`;
47120
48841
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
47121
48842
  }
47122
- return /* @__PURE__ */ jsx(React72__default.Fragment, { children: child }, `${parentId}-${index}`);
48843
+ return /* @__PURE__ */ jsx(React74__default.Fragment, { children: child }, `${parentId}-${index}`);
47123
48844
  }
47124
48845
  if (!child || typeof child !== "object") return null;
47125
48846
  const childId = `${parentId}-${index}`;
@@ -47159,14 +48880,14 @@ function isPatternConfig(value) {
47159
48880
  if (value === null || value === void 0) return false;
47160
48881
  if (typeof value !== "object") return false;
47161
48882
  if (Array.isArray(value)) return false;
47162
- if (React72__default.isValidElement(value)) return false;
48883
+ if (React74__default.isValidElement(value)) return false;
47163
48884
  if (value instanceof Date) return false;
47164
48885
  if (typeof value === "function") return false;
47165
48886
  const record = value;
47166
48887
  return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
47167
48888
  }
47168
48889
  function isPlainConfigObject(value) {
47169
- if (React72__default.isValidElement(value)) return false;
48890
+ if (React74__default.isValidElement(value)) return false;
47170
48891
  if (value instanceof Date) return false;
47171
48892
  const proto = Object.getPrototypeOf(value);
47172
48893
  return proto === Object.prototype || proto === null;
@@ -47292,7 +49013,7 @@ function SlotContentRenderer({
47292
49013
  for (const slotKey of CONTENT_NODE_SLOTS) {
47293
49014
  const slotVal = restProps[slotKey];
47294
49015
  if (slotVal === void 0 || slotVal === null) continue;
47295
- if (React72__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
49016
+ if (React74__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
47296
49017
  if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
47297
49018
  nodeSlotOverrides[slotKey] = renderPatternChildren(
47298
49019
  slotVal,
@@ -47341,7 +49062,7 @@ function SlotContentRenderer({
47341
49062
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
47342
49063
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
47343
49064
  const sample = resolvedItems[0];
47344
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React72__default.isValidElement(sample) && !(sample instanceof Date)) {
49065
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React74__default.isValidElement(sample) && !(sample instanceof Date)) {
47345
49066
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
47346
49067
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
47347
49068
  }
@@ -49641,7 +51362,7 @@ var I18nContext = createContext({
49641
51362
  });
49642
51363
  I18nContext.displayName = "I18nContext";
49643
51364
  var I18nProvider = I18nContext.Provider;
49644
- function useTranslate119() {
51365
+ function useTranslate127() {
49645
51366
  return useContext(I18nContext);
49646
51367
  }
49647
51368
  function createTranslate(messages) {
@@ -49842,4 +51563,4 @@ function useGitHubBranches(owner, repo, enabled = true) {
49842
51563
  });
49843
51564
  }
49844
51565
 
49845
- export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EMPTY_EFFECT_STATE, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCard, GameHud, GameIcon, GameMenu, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, ItemSlot, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateIndicator, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createTranslate, createUnitAnimationState, drawSprite, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGameAudioContext, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useLongPress, useOrbitalHistory, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSwipeGesture, useTapReveal, useTraitListens, useTranslate119 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };
51566
+ export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EMPTY_EFFECT_STATE, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCard, GameHud, GameIcon, GameMenu, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, ItemSlot, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NodeSlotEditor, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createTranslate, createUnitAnimationState, drawSprite, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGameAudioContext, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useLongPress, useOrbitalHistory, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSwipeGesture, useTapReveal, useTraitListens, useTranslate127 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };