@almadar/ui 5.70.0 → 5.71.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 (55) hide show
  1. package/dist/avl/index.cjs +1953 -1802
  2. package/dist/avl/index.d.cts +93 -56
  3. package/dist/avl/index.js +677 -526
  4. package/dist/components/avl/molecules/AvlEventWireEdge.d.ts +2 -1
  5. package/dist/components/avl/molecules/AvlTransitionEdge.d.ts +2 -1
  6. package/dist/components/avl/molecules/avl-behavior-compose-converter.d.ts +7 -5
  7. package/dist/components/avl/molecules/avl-behavior-compose-types.d.ts +41 -21
  8. package/dist/components/avl/molecules/avl-canvas-types.d.ts +10 -7
  9. package/dist/components/avl/molecules/avl-preview-converter.d.ts +5 -5
  10. package/dist/components/avl/molecules/avl-preview-types.d.ts +15 -4
  11. package/dist/components/avl/organisms/FlowCanvas.d.ts +2 -2
  12. package/dist/components/avl/organisms/avl-schema-parser.d.ts +18 -16
  13. package/dist/components/core/atoms/Button.d.ts +2 -0
  14. package/dist/components/core/atoms/ConditionalWrapper.d.ts +5 -4
  15. package/dist/components/core/molecules/Carousel.d.ts +2 -2
  16. package/dist/components/core/molecules/OrbitalVisualization.d.ts +4 -3
  17. package/dist/components/core/molecules/PageHeader.d.ts +3 -3
  18. package/dist/components/core/molecules/RepeatableFormSection.d.ts +4 -3
  19. package/dist/components/core/molecules/ViolationAlert.d.ts +2 -0
  20. package/dist/components/core/molecules/WizardContainer.d.ts +23 -22
  21. package/dist/components/core/organisms/CardGrid.d.ts +2 -2
  22. package/dist/components/core/organisms/CustomPattern.d.ts +3 -4
  23. package/dist/components/core/organisms/DataTable.d.ts +2 -2
  24. package/dist/components/core/organisms/DetailPanel.d.ts +1 -1
  25. package/dist/components/core/organisms/Form.d.ts +11 -11
  26. package/dist/components/core/organisms/List.d.ts +3 -5
  27. package/dist/components/core/organisms/StatCard.d.ts +2 -2
  28. package/dist/components/core/organisms/book/types.d.ts +1 -1
  29. package/dist/components/core/organisms/debug/RuntimeDebugger.d.ts +2 -1
  30. package/dist/components/core/organisms/debug/tabs/EventDispatcherTab.d.ts +2 -1
  31. package/dist/components/core/organisms/layout/DashboardGrid.d.ts +0 -2
  32. package/dist/components/core/organisms/types.d.ts +3 -2
  33. package/dist/components/game/atoms/ScoreDisplay.d.ts +3 -1
  34. package/dist/components/game/molecules/three/hooks/useSceneGraph.d.ts +2 -1
  35. package/dist/components/game/molecules/three/index.cjs +37 -24
  36. package/dist/components/game/molecules/three/index.js +37 -24
  37. package/dist/components/game/organisms/PinballBoard.d.ts +4 -4
  38. package/dist/components/game/organisms/boardEntity.d.ts +6 -6
  39. package/dist/components/game/organisms/puzzles/debugger/DebuggerBoard.d.ts +16 -2
  40. package/dist/components/game/organisms/puzzles/event-handler/puzzleObject.d.ts +21 -10
  41. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +2 -1
  42. package/dist/components/index.cjs +1690 -1562
  43. package/dist/components/index.js +569 -441
  44. package/dist/docs/index.cjs +107 -104
  45. package/dist/docs/index.d.cts +2 -0
  46. package/dist/docs/index.js +38 -35
  47. package/dist/lib/getNestedValue.d.ts +2 -13
  48. package/dist/marketing/index.cjs +97 -98
  49. package/dist/marketing/index.d.cts +2 -0
  50. package/dist/marketing/index.js +54 -55
  51. package/dist/providers/index.cjs +1663 -1535
  52. package/dist/providers/index.js +554 -426
  53. package/dist/runtime/index.cjs +1721 -1593
  54. package/dist/runtime/index.js +560 -432
  55. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import * as React85 from 'react';
2
- import React85__default, { createContext, useMemo, useContext, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
1
+ import * as React89 from 'react';
2
+ import React89__default, { createContext, useMemo, useContext, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
@@ -445,7 +445,7 @@ var init_Box = __esm({
445
445
  fixed: "fixed",
446
446
  sticky: "sticky"
447
447
  };
448
- Box = React85__default.forwardRef(
448
+ Box = React89__default.forwardRef(
449
449
  ({
450
450
  padding,
451
451
  paddingX,
@@ -510,7 +510,7 @@ var init_Box = __esm({
510
510
  onPointerDown?.(e);
511
511
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
512
512
  const isClickable = action || onClick;
513
- return React85__default.createElement(
513
+ return React89__default.createElement(
514
514
  Component2,
515
515
  {
516
516
  ref,
@@ -606,7 +606,7 @@ function loadLib(key, importer) {
606
606
  return p2;
607
607
  }
608
608
  function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
609
- const Lazy = React85__default.lazy(async () => {
609
+ const Lazy = React89__default.lazy(async () => {
610
610
  const lib = await loadLib(libKey, importer);
611
611
  const Comp = pick(lib);
612
612
  if (!Comp) {
@@ -616,7 +616,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
616
616
  return { default: Comp };
617
617
  });
618
618
  const Wrapped = (props) => /* @__PURE__ */ jsx(
619
- React85__default.Suspense,
619
+ React89__default.Suspense,
620
620
  {
621
621
  fallback: /* @__PURE__ */ jsx(
622
622
  "span",
@@ -1284,9 +1284,10 @@ function resolveIcon(name) {
1284
1284
  function doResolve(name) {
1285
1285
  if (iconAliases[name]) return iconAliases[name];
1286
1286
  const pascalName = kebabToPascal2(name);
1287
- const directLookup = LucideIcons2[pascalName];
1287
+ const lucideMap = LucideIcons2;
1288
+ const directLookup = lucideMap[pascalName];
1288
1289
  if (directLookup && typeof directLookup === "object") return directLookup;
1289
- const asIs = LucideIcons2[name];
1290
+ const asIs = lucideMap[name];
1290
1291
  if (asIs && typeof asIs === "object") return asIs;
1291
1292
  return LucideIcons2.HelpCircle;
1292
1293
  }
@@ -1342,7 +1343,7 @@ var init_Icon = __esm({
1342
1343
  const directIcon = typeof icon === "string" ? void 0 : icon;
1343
1344
  const effectiveName = typeof icon === "string" ? icon : name;
1344
1345
  const family = useIconFamily();
1345
- const RenderedComponent = React85__default.useMemo(() => {
1346
+ const RenderedComponent = React89__default.useMemo(() => {
1346
1347
  if (directIcon) return null;
1347
1348
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1348
1349
  }, [directIcon, effectiveName, family]);
@@ -1392,6 +1393,9 @@ var init_Icon = __esm({
1392
1393
  Icon.displayName = "Icon";
1393
1394
  }
1394
1395
  });
1396
+ function isIconLike(v) {
1397
+ return typeof v.render === "function";
1398
+ }
1395
1399
  function resolveIconProp(value, sizeClass) {
1396
1400
  if (!value) return null;
1397
1401
  if (typeof value === "string") {
@@ -1401,10 +1405,10 @@ function resolveIconProp(value, sizeClass) {
1401
1405
  const IconComp = value;
1402
1406
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1403
1407
  }
1404
- if (React85__default.isValidElement(value)) {
1408
+ if (React89__default.isValidElement(value)) {
1405
1409
  return value;
1406
1410
  }
1407
- if (typeof value === "object" && value !== null && "render" in value) {
1411
+ if (typeof value === "object" && value !== null && isIconLike(value)) {
1408
1412
  const IconComp = value;
1409
1413
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1410
1414
  }
@@ -1477,7 +1481,7 @@ var init_Button = __esm({
1477
1481
  md: "h-icon-default w-icon-default",
1478
1482
  lg: "h-icon-default w-icon-default"
1479
1483
  };
1480
- Button = React85__default.forwardRef(
1484
+ Button = React89__default.forwardRef(
1481
1485
  ({
1482
1486
  className,
1483
1487
  variant = "primary",
@@ -1493,6 +1497,7 @@ var init_Button = __esm({
1493
1497
  label,
1494
1498
  children,
1495
1499
  onClick,
1500
+ "data-testid": dataTestId,
1496
1501
  ...props
1497
1502
  }, ref) => {
1498
1503
  const eventBus = useEventBus();
@@ -1525,7 +1530,7 @@ var init_Button = __esm({
1525
1530
  ),
1526
1531
  onClick: handleClick,
1527
1532
  ...props,
1528
- "data-testid": props["data-testid"] ?? (action ? `action-${action}` : void 0),
1533
+ "data-testid": dataTestId ?? (action ? `action-${action}` : void 0),
1529
1534
  children: [
1530
1535
  isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-icon-default w-icon-default animate-spin" }) : resolvedLeftIcon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: resolvedLeftIcon }),
1531
1536
  children || label,
@@ -1542,7 +1547,7 @@ var Dialog;
1542
1547
  var init_Dialog = __esm({
1543
1548
  "components/core/atoms/Dialog.tsx"() {
1544
1549
  init_cn();
1545
- Dialog = React85__default.forwardRef(
1550
+ Dialog = React89__default.forwardRef(
1546
1551
  ({
1547
1552
  role = "dialog",
1548
1553
  "aria-modal": ariaModal = true,
@@ -1660,9 +1665,8 @@ var init_Typography = __esm({
1660
1665
  }) => {
1661
1666
  const variant = variantProp ?? (level ? `h${level}` : "body1");
1662
1667
  const Component2 = as || defaultElements[variant];
1663
- const Comp = Component2;
1664
- return /* @__PURE__ */ jsx(
1665
- Comp,
1668
+ return React89__default.createElement(
1669
+ Component2,
1666
1670
  {
1667
1671
  id,
1668
1672
  className: cn(
@@ -1675,9 +1679,9 @@ var init_Typography = __esm({
1675
1679
  overflow && overflowStyles2[overflow],
1676
1680
  className
1677
1681
  ),
1678
- style,
1679
- children: children ?? content
1680
- }
1682
+ style
1683
+ },
1684
+ children ?? content
1681
1685
  );
1682
1686
  };
1683
1687
  Typography.displayName = "Typography";
@@ -2156,7 +2160,7 @@ var init_Badge = __esm({
2156
2160
  md: "px-2.5 py-1 text-sm",
2157
2161
  lg: "px-3 py-1.5 text-base"
2158
2162
  };
2159
- Badge = React85__default.forwardRef(
2163
+ Badge = React89__default.forwardRef(
2160
2164
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2161
2165
  const iconSizes3 = {
2162
2166
  sm: "h-icon-default w-icon-default",
@@ -2492,7 +2496,7 @@ var init_SvgFlow = __esm({
2492
2496
  width = 100,
2493
2497
  height = 100
2494
2498
  }) => {
2495
- const markerId = React85__default.useMemo(() => {
2499
+ const markerId = React89__default.useMemo(() => {
2496
2500
  flowIdCounter += 1;
2497
2501
  return `almadar-flow-arrow-${flowIdCounter}`;
2498
2502
  }, []);
@@ -3085,7 +3089,7 @@ var init_SvgRing = __esm({
3085
3089
  width = 100,
3086
3090
  height = 100
3087
3091
  }) => {
3088
- const gradientId = React85__default.useMemo(() => {
3092
+ const gradientId = React89__default.useMemo(() => {
3089
3093
  ringIdCounter += 1;
3090
3094
  return `almadar-ring-glow-${ringIdCounter}`;
3091
3095
  }, []);
@@ -3266,7 +3270,7 @@ var init_Input = __esm({
3266
3270
  init_cn();
3267
3271
  init_Icon();
3268
3272
  init_useEventBus();
3269
- Input = React85__default.forwardRef(
3273
+ Input = React89__default.forwardRef(
3270
3274
  ({
3271
3275
  className,
3272
3276
  inputType,
@@ -3426,7 +3430,7 @@ var Label;
3426
3430
  var init_Label = __esm({
3427
3431
  "components/core/atoms/Label.tsx"() {
3428
3432
  init_cn();
3429
- Label = React85__default.forwardRef(
3433
+ Label = React89__default.forwardRef(
3430
3434
  ({ className, required, children, ...props }, ref) => {
3431
3435
  return /* @__PURE__ */ jsxs(
3432
3436
  "label",
@@ -3453,7 +3457,7 @@ var init_Textarea = __esm({
3453
3457
  "components/core/atoms/Textarea.tsx"() {
3454
3458
  init_cn();
3455
3459
  init_useEventBus();
3456
- Textarea = React85__default.forwardRef(
3460
+ Textarea = React89__default.forwardRef(
3457
3461
  ({ className, error, onChange, ...props }, ref) => {
3458
3462
  const eventBus = useEventBus();
3459
3463
  const handleChange = (e) => {
@@ -3692,7 +3696,7 @@ var init_Select = __esm({
3692
3696
  init_cn();
3693
3697
  init_Icon();
3694
3698
  init_useEventBus();
3695
- Select = React85__default.forwardRef(
3699
+ Select = React89__default.forwardRef(
3696
3700
  (props, _ref) => {
3697
3701
  const { multiple, searchable, clearable } = props;
3698
3702
  if (multiple || searchable || clearable) {
@@ -3709,7 +3713,7 @@ var init_Checkbox = __esm({
3709
3713
  "components/core/atoms/Checkbox.tsx"() {
3710
3714
  init_cn();
3711
3715
  init_useEventBus();
3712
- Checkbox = React85__default.forwardRef(
3716
+ Checkbox = React89__default.forwardRef(
3713
3717
  ({ className, label, id, onChange, ...props }, ref) => {
3714
3718
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3715
3719
  const eventBus = useEventBus();
@@ -3763,7 +3767,7 @@ var init_Spinner = __esm({
3763
3767
  md: "h-6 w-6",
3764
3768
  lg: "h-8 w-8"
3765
3769
  };
3766
- Spinner = React85__default.forwardRef(
3770
+ Spinner = React89__default.forwardRef(
3767
3771
  ({ className, size = "md", overlay, ...props }, ref) => {
3768
3772
  if (overlay) {
3769
3773
  return /* @__PURE__ */ jsx(
@@ -3853,7 +3857,7 @@ var init_Card = __esm({
3853
3857
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3854
3858
  "tile-image-first": "p-0 overflow-hidden"
3855
3859
  };
3856
- Card = React85__default.forwardRef(
3860
+ Card = React89__default.forwardRef(
3857
3861
  ({
3858
3862
  className,
3859
3863
  variant = "bordered",
@@ -3901,9 +3905,9 @@ var init_Card = __esm({
3901
3905
  }
3902
3906
  );
3903
3907
  Card.displayName = "Card";
3904
- CardHeader = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3908
+ CardHeader = React89__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3905
3909
  CardHeader.displayName = "CardHeader";
3906
- CardTitle = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3910
+ CardTitle = React89__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3907
3911
  "h3",
3908
3912
  {
3909
3913
  ref,
@@ -3916,11 +3920,11 @@ var init_Card = __esm({
3916
3920
  }
3917
3921
  ));
3918
3922
  CardTitle.displayName = "CardTitle";
3919
- CardContent = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3923
+ CardContent = React89__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3920
3924
  CardContent.displayName = "CardContent";
3921
3925
  CardBody = CardContent;
3922
3926
  CardBody.displayName = "CardBody";
3923
- CardFooter = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3927
+ CardFooter = React89__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3924
3928
  "div",
3925
3929
  {
3926
3930
  ref,
@@ -3975,7 +3979,7 @@ var init_FilterPill = __esm({
3975
3979
  md: "w-3.5 h-3.5",
3976
3980
  lg: "w-4 h-4"
3977
3981
  };
3978
- FilterPill = React85__default.forwardRef(
3982
+ FilterPill = React89__default.forwardRef(
3979
3983
  ({
3980
3984
  className,
3981
3985
  variant = "default",
@@ -4104,8 +4108,8 @@ var init_Avatar = __esm({
4104
4108
  actionPayload
4105
4109
  }) => {
4106
4110
  const eventBus = useEventBus();
4107
- const [imgFailed, setImgFailed] = React85__default.useState(false);
4108
- React85__default.useEffect(() => {
4111
+ const [imgFailed, setImgFailed] = React89__default.useState(false);
4112
+ React89__default.useEffect(() => {
4109
4113
  setImgFailed(false);
4110
4114
  }, [src]);
4111
4115
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -4218,22 +4222,18 @@ var init_Center = __esm({
4218
4222
  as: Component2 = "div"
4219
4223
  }) => {
4220
4224
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
4221
- const Comp = Component2;
4222
- return /* @__PURE__ */ jsx(
4223
- Comp,
4224
- {
4225
- className: cn(
4226
- inline ? "inline-flex" : "flex",
4227
- horizontal && "justify-center",
4228
- vertical && "items-center",
4229
- fullHeight && "h-full",
4230
- fullWidth && "w-full",
4231
- className
4232
- ),
4233
- style: mergedStyle,
4234
- children
4235
- }
4236
- );
4225
+ return React89__default.createElement(Component2, {
4226
+ className: cn(
4227
+ inline ? "inline-flex" : "flex",
4228
+ horizontal && "justify-center",
4229
+ vertical && "items-center",
4230
+ fullHeight && "h-full",
4231
+ fullWidth && "w-full",
4232
+ className
4233
+ ),
4234
+ style: mergedStyle,
4235
+ children
4236
+ });
4237
4237
  };
4238
4238
  }
4239
4239
  });
@@ -4490,7 +4490,7 @@ var init_Radio = __esm({
4490
4490
  md: "w-2.5 h-2.5",
4491
4491
  lg: "w-3 h-3"
4492
4492
  };
4493
- Radio = React85__default.forwardRef(
4493
+ Radio = React89__default.forwardRef(
4494
4494
  ({
4495
4495
  label,
4496
4496
  helperText,
@@ -4507,12 +4507,12 @@ var init_Radio = __esm({
4507
4507
  onChange,
4508
4508
  ...props
4509
4509
  }, ref) => {
4510
- const reactId = React85__default.useId();
4510
+ const reactId = React89__default.useId();
4511
4511
  const baseId = id || `radio-${reactId}`;
4512
4512
  const hasError = !!error;
4513
4513
  const eventBus = useEventBus();
4514
- const [selected, setSelected] = React85__default.useState(value);
4515
- React85__default.useEffect(() => {
4514
+ const [selected, setSelected] = React89__default.useState(value);
4515
+ React89__default.useEffect(() => {
4516
4516
  if (value !== void 0) setSelected(value);
4517
4517
  }, [value]);
4518
4518
  const pick = (next, e) => {
@@ -4694,7 +4694,7 @@ var init_Switch = __esm({
4694
4694
  "components/core/atoms/Switch.tsx"() {
4695
4695
  "use client";
4696
4696
  init_cn();
4697
- Switch = React85.forwardRef(
4697
+ Switch = React89.forwardRef(
4698
4698
  ({
4699
4699
  checked,
4700
4700
  defaultChecked = false,
@@ -4705,10 +4705,10 @@ var init_Switch = __esm({
4705
4705
  name,
4706
4706
  className
4707
4707
  }, ref) => {
4708
- const [isChecked, setIsChecked] = React85.useState(
4708
+ const [isChecked, setIsChecked] = React89.useState(
4709
4709
  checked !== void 0 ? checked : defaultChecked
4710
4710
  );
4711
- React85.useEffect(() => {
4711
+ React89.useEffect(() => {
4712
4712
  if (checked !== void 0) {
4713
4713
  setIsChecked(checked);
4714
4714
  }
@@ -4867,9 +4867,8 @@ var init_Stack = __esm({
4867
4867
  };
4868
4868
  const isHorizontal = direction === "horizontal";
4869
4869
  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";
4870
- const Comp = Component2;
4871
- return /* @__PURE__ */ jsx(
4872
- Comp,
4870
+ return React89__default.createElement(
4871
+ Component2,
4873
4872
  {
4874
4873
  className: cn(
4875
4874
  "flex",
@@ -4885,9 +4884,9 @@ var init_Stack = __esm({
4885
4884
  onClick: action || onClick ? handleClick : void 0,
4886
4885
  onKeyDown,
4887
4886
  role,
4888
- tabIndex,
4889
- children
4890
- }
4887
+ tabIndex
4888
+ },
4889
+ children
4891
4890
  );
4892
4891
  };
4893
4892
  VStack = (props) => /* @__PURE__ */ jsx(Stack, { direction: "vertical", ...props });
@@ -5068,7 +5067,7 @@ var Aside;
5068
5067
  var init_Aside = __esm({
5069
5068
  "components/core/atoms/Aside.tsx"() {
5070
5069
  init_cn();
5071
- Aside = React85__default.forwardRef(
5070
+ Aside = React89__default.forwardRef(
5072
5071
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
5073
5072
  );
5074
5073
  Aside.displayName = "Aside";
@@ -5147,9 +5146,9 @@ var init_LawReferenceTooltip = __esm({
5147
5146
  className
5148
5147
  }) => {
5149
5148
  const { t } = useTranslate();
5150
- const [isVisible, setIsVisible] = React85__default.useState(false);
5151
- const timeoutRef = React85__default.useRef(null);
5152
- const triggerRef = React85__default.useRef(null);
5149
+ const [isVisible, setIsVisible] = React89__default.useState(false);
5150
+ const timeoutRef = React89__default.useRef(null);
5151
+ const triggerRef = React89__default.useRef(null);
5153
5152
  const handleMouseEnter = () => {
5154
5153
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5155
5154
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -5160,7 +5159,7 @@ var init_LawReferenceTooltip = __esm({
5160
5159
  };
5161
5160
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
5162
5161
  const open = isVisible || revealed;
5163
- React85__default.useEffect(() => {
5162
+ React89__default.useEffect(() => {
5164
5163
  return () => {
5165
5164
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5166
5165
  };
@@ -5372,7 +5371,7 @@ var init_StatusDot = __esm({
5372
5371
  md: "w-2.5 h-2.5",
5373
5372
  lg: "w-3 h-3"
5374
5373
  };
5375
- StatusDot = React85__default.forwardRef(
5374
+ StatusDot = React89__default.forwardRef(
5376
5375
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5377
5376
  return /* @__PURE__ */ jsx(
5378
5377
  "span",
@@ -5426,7 +5425,7 @@ var init_TrendIndicator = __esm({
5426
5425
  down: "trending-down",
5427
5426
  flat: "arrow-right"
5428
5427
  };
5429
- TrendIndicator = React85__default.forwardRef(
5428
+ TrendIndicator = React89__default.forwardRef(
5430
5429
  ({
5431
5430
  className,
5432
5431
  value,
@@ -5493,7 +5492,7 @@ var init_RangeSlider = __esm({
5493
5492
  md: "w-4 h-4",
5494
5493
  lg: "w-5 h-5"
5495
5494
  };
5496
- RangeSlider = React85__default.forwardRef(
5495
+ RangeSlider = React89__default.forwardRef(
5497
5496
  ({
5498
5497
  className,
5499
5498
  min = 0,
@@ -6001,7 +6000,7 @@ var init_ContentSection = __esm({
6001
6000
  md: "py-16",
6002
6001
  lg: "py-24"
6003
6002
  };
6004
- ContentSection = React85__default.forwardRef(
6003
+ ContentSection = React89__default.forwardRef(
6005
6004
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
6006
6005
  return /* @__PURE__ */ jsx(
6007
6006
  Box,
@@ -6535,7 +6534,7 @@ var init_AnimatedReveal = __esm({
6535
6534
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6536
6535
  "none": {}
6537
6536
  };
6538
- AnimatedReveal = React85__default.forwardRef(
6537
+ AnimatedReveal = React89__default.forwardRef(
6539
6538
  ({
6540
6539
  trigger = "scroll",
6541
6540
  animation = "fade-up",
@@ -6695,7 +6694,7 @@ var init_AnimatedGraphic = __esm({
6695
6694
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6696
6695
  "use client";
6697
6696
  init_cn();
6698
- AnimatedGraphic = React85__default.forwardRef(
6697
+ AnimatedGraphic = React89__default.forwardRef(
6699
6698
  ({
6700
6699
  src,
6701
6700
  svgContent,
@@ -6718,7 +6717,7 @@ var init_AnimatedGraphic = __esm({
6718
6717
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6719
6718
  const resolvedSvg = svgContent ?? fetchedSvg;
6720
6719
  const prevAnimateRef = useRef(animate);
6721
- const setRef = React85__default.useCallback(
6720
+ const setRef = React89__default.useCallback(
6722
6721
  (node) => {
6723
6722
  containerRef.current = node;
6724
6723
  if (typeof ref === "function") ref(node);
@@ -6935,18 +6934,18 @@ var init_HealthBar = __esm({
6935
6934
  function ScoreDisplay({
6936
6935
  assetUrl = DEFAULT_ASSET_URL,
6937
6936
  value,
6937
+ score,
6938
6938
  label,
6939
6939
  icon,
6940
6940
  size = "md",
6941
6941
  className,
6942
6942
  animated = true,
6943
- locale = "en-US",
6944
- ...rest
6943
+ locale = "en-US"
6945
6944
  }) {
6946
- const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
6947
- const [displayValue, setDisplayValue] = React85.useState(resolvedValue);
6948
- const [isAnimating, setIsAnimating] = React85.useState(false);
6949
- React85.useEffect(() => {
6945
+ const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof score === "number" && !Number.isNaN(score) ? score : 0;
6946
+ const [displayValue, setDisplayValue] = React89.useState(resolvedValue);
6947
+ const [isAnimating, setIsAnimating] = React89.useState(false);
6948
+ React89.useEffect(() => {
6950
6949
  if (!animated || displayValue === resolvedValue) {
6951
6950
  setDisplayValue(resolvedValue);
6952
6951
  return;
@@ -7029,9 +7028,9 @@ function ControlButton({
7029
7028
  className
7030
7029
  }) {
7031
7030
  const eventBus = useEventBus();
7032
- const [isPressed, setIsPressed] = React85.useState(false);
7031
+ const [isPressed, setIsPressed] = React89.useState(false);
7033
7032
  const actualPressed = pressed ?? isPressed;
7034
- const handlePointerDown = React85.useCallback(
7033
+ const handlePointerDown = React89.useCallback(
7035
7034
  (e) => {
7036
7035
  e.preventDefault();
7037
7036
  if (disabled) return;
@@ -7041,7 +7040,7 @@ function ControlButton({
7041
7040
  },
7042
7041
  [disabled, pressEvent, eventBus, onPress]
7043
7042
  );
7044
- const handlePointerUp = React85.useCallback(
7043
+ const handlePointerUp = React89.useCallback(
7045
7044
  (e) => {
7046
7045
  e.preventDefault();
7047
7046
  if (disabled) return;
@@ -7051,7 +7050,7 @@ function ControlButton({
7051
7050
  },
7052
7051
  [disabled, releaseEvent, eventBus, onRelease]
7053
7052
  );
7054
- const handlePointerLeave = React85.useCallback(
7053
+ const handlePointerLeave = React89.useCallback(
7055
7054
  (e) => {
7056
7055
  if (isPressed) {
7057
7056
  setIsPressed(false);
@@ -7680,8 +7679,8 @@ function XPBar({
7680
7679
  }) {
7681
7680
  const sizes = sizeMap9[size];
7682
7681
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
7683
- const [fillWidth, setFillWidth] = React85.useState(animated ? 0 : percentage);
7684
- React85.useEffect(() => {
7682
+ const [fillWidth, setFillWidth] = React89.useState(animated ? 0 : percentage);
7683
+ React89.useEffect(() => {
7685
7684
  if (!animated) {
7686
7685
  setFillWidth(percentage);
7687
7686
  return;
@@ -8189,9 +8188,9 @@ function MiniMap({
8189
8188
  viewportRect = DEFAULT_VIEWPORT,
8190
8189
  className
8191
8190
  }) {
8192
- const canvasRef = React85.useRef(null);
8193
- const frameRef = React85.useRef(0);
8194
- React85.useEffect(() => {
8191
+ const canvasRef = React89.useRef(null);
8192
+ const frameRef = React89.useRef(0);
8193
+ React89.useEffect(() => {
8195
8194
  const canvas = canvasRef.current;
8196
8195
  if (!canvas) return;
8197
8196
  const ctx = canvas.getContext("2d");
@@ -8380,7 +8379,7 @@ var init_ErrorBoundary = __esm({
8380
8379
  }
8381
8380
  );
8382
8381
  };
8383
- ErrorBoundary = class extends React85__default.Component {
8382
+ ErrorBoundary = class extends React89__default.Component {
8384
8383
  constructor(props) {
8385
8384
  super(props);
8386
8385
  __publicField(this, "reset", () => {
@@ -8691,9 +8690,8 @@ var init_Container = __esm({
8691
8690
  as: Component2 = "div"
8692
8691
  }) => {
8693
8692
  const resolvedSize = maxWidth ?? size ?? "lg";
8694
- const Comp = Component2;
8695
- return /* @__PURE__ */ jsx(
8696
- Comp,
8693
+ return React89__default.createElement(
8694
+ Component2,
8697
8695
  {
8698
8696
  className: cn(
8699
8697
  "w-full",
@@ -8701,9 +8699,9 @@ var init_Container = __esm({
8701
8699
  paddingStyles3[padding],
8702
8700
  center && "mx-auto",
8703
8701
  className
8704
- ),
8705
- children
8706
- }
8702
+ )
8703
+ },
8704
+ children
8707
8705
  );
8708
8706
  };
8709
8707
  Container.displayName = "Container";
@@ -9415,8 +9413,8 @@ function ActionButtons({
9415
9413
  disabled
9416
9414
  }) {
9417
9415
  const eventBus = useEventBus();
9418
- const [activeButtons, setActiveButtons] = React85.useState(/* @__PURE__ */ new Set());
9419
- const handlePress = React85.useCallback(
9416
+ const [activeButtons, setActiveButtons] = React89.useState(/* @__PURE__ */ new Set());
9417
+ const handlePress = React89.useCallback(
9420
9418
  (id) => {
9421
9419
  setActiveButtons((prev) => new Set(prev).add(id));
9422
9420
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9424,7 +9422,7 @@ function ActionButtons({
9424
9422
  },
9425
9423
  [actionEvent, eventBus, onAction]
9426
9424
  );
9427
- const handleRelease = React85.useCallback(
9425
+ const handleRelease = React89.useCallback(
9428
9426
  (id) => {
9429
9427
  setActiveButtons((prev) => {
9430
9428
  const next = new Set(prev);
@@ -11923,9 +11921,37 @@ function BattleBoard({
11923
11921
  className
11924
11922
  }) {
11925
11923
  const board = boardEntity(entity) ?? {};
11926
- const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles : []);
11924
+ function asFieldObj(v) {
11925
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
11926
+ return v;
11927
+ }
11928
+ const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles.flatMap((v) => {
11929
+ const o = asFieldObj(v);
11930
+ if (o === null || typeof o.x !== "number" || typeof o.y !== "number") return [];
11931
+ const tile = { x: o.x, y: o.y };
11932
+ if (typeof o.terrain === "string") tile.terrain = o.terrain;
11933
+ if (typeof o.terrainSprite === "string") tile.terrainSprite = o.terrainSprite;
11934
+ if (typeof o.passable === "boolean") tile.passable = o.passable;
11935
+ if (typeof o.movementCost === "number") tile.movementCost = o.movementCost;
11936
+ if (typeof o.elevation === "number") tile.elevation = o.elevation;
11937
+ if (typeof o.type === "string") tile.type = o.type;
11938
+ if (typeof o.tileType === "string") tile.tileType = o.tileType;
11939
+ if (typeof o.id === "string") tile.id = o.id;
11940
+ if (typeof o.modelUrl === "string") tile.modelUrl = o.modelUrl;
11941
+ return [tile];
11942
+ }) : []);
11927
11943
  const tiles = rawTiles.length === 0 ? DEFAULT_BATTLE_TILES : rawTiles;
11928
- const features = propFeatures ?? (Array.isArray(board.features) ? board.features : []);
11944
+ const features = propFeatures ?? (Array.isArray(board.features) ? board.features.flatMap((v) => {
11945
+ const o = asFieldObj(v);
11946
+ if (o === null || typeof o.type !== "string" || typeof o.x !== "number" || typeof o.y !== "number") return [];
11947
+ const feat = { type: o.type, x: o.x, y: o.y };
11948
+ if (typeof o.id === "string") feat.id = o.id;
11949
+ if (typeof o.sprite === "string") feat.sprite = o.sprite;
11950
+ if (typeof o.color === "string") feat.color = o.color;
11951
+ if (typeof o.elevation === "number") feat.elevation = o.elevation;
11952
+ if (typeof o.assetUrl === "string") feat.assetUrl = o.assetUrl;
11953
+ return [feat];
11954
+ }) : []);
11929
11955
  const boardWidth = num(board.gridWidth ?? board.boardWidth, BATTLE_GRID_W);
11930
11956
  const boardHeight = num(board.gridHeight ?? board.boardHeight, BATTLE_GRID_H);
11931
11957
  const assetManifest = propAssetManifest ?? board.assetManifest;
@@ -12024,7 +12050,12 @@ function BattleBoard({
12024
12050
  return units.filter((u) => unitHealth(u) > 0).map((unit) => {
12025
12051
  const id = str(unit.id);
12026
12052
  const pos = movingPositions.get(id) ?? unitPosition(unit);
12027
- const unitTraits = Array.isArray(unit.traits) ? unit.traits : void 0;
12053
+ const unitTraits = Array.isArray(unit.traits) ? unit.traits.flatMap((v) => {
12054
+ const o = asFieldObj(v);
12055
+ if (o === null || typeof o.name !== "string" || typeof o.currentState !== "string" || !Array.isArray(o.states)) return [];
12056
+ const stateNames = Array.from(o.states).flatMap((s) => typeof s === "string" ? [s] : []);
12057
+ return [{ name: o.name, currentState: o.currentState, states: stateNames, cooldown: typeof o.cooldown === "number" ? o.cooldown : void 0 }];
12058
+ }) : void 0;
12028
12059
  return {
12029
12060
  id,
12030
12061
  position: pos,
@@ -13020,9 +13051,9 @@ async function computeTraitLayout(data) {
13020
13051
  y: n.y ?? 0,
13021
13052
  width: n.width ?? 110,
13022
13053
  height: n.height ?? STATE_H,
13023
- isInitial: stateInfo?.isInitial,
13024
- isTerminal: stateInfo?.isTerminal,
13025
- role: getStateRole(name, stateInfo?.isInitial, stateInfo?.isTerminal, tc, maxTC),
13054
+ isInitial: stateInfo?.isInitial ?? void 0,
13055
+ isTerminal: stateInfo?.isTerminal ?? void 0,
13056
+ role: getStateRole(name, stateInfo?.isInitial ?? void 0, stateInfo?.isTerminal ?? void 0, tc, maxTC),
13026
13057
  transitionCount: tc
13027
13058
  };
13028
13059
  });
@@ -13033,12 +13064,10 @@ async function computeTraitLayout(data) {
13033
13064
  const sections = e.sections ?? [];
13034
13065
  const points = [];
13035
13066
  for (const section of sections) {
13036
- const startPoint = section.startPoint;
13037
- const endPoint = section.endPoint;
13038
13067
  const bendPoints = section.bendPoints ?? [];
13039
- points.push({ x: startPoint.x, y: startPoint.y });
13068
+ points.push({ x: section.startPoint.x, y: section.startPoint.y });
13040
13069
  for (const bp of bendPoints) points.push({ x: bp.x, y: bp.y });
13041
- points.push({ x: endPoint.x, y: endPoint.y });
13070
+ points.push({ x: section.endPoint.x, y: section.endPoint.y });
13042
13071
  }
13043
13072
  const isSelf = t.from === t.to;
13044
13073
  const isBackward = !isSelf && (nodeXMap[t.to] ?? 0) <= (nodeXMap[t.from] ?? 0);
@@ -13636,7 +13665,7 @@ var init_CodeBlock = __esm({
13636
13665
  };
13637
13666
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
13638
13667
  HIDDEN_LINE_NUMBERS = { display: "none" };
13639
- CodeBlock = React85__default.memo(
13668
+ CodeBlock = React89__default.memo(
13640
13669
  ({
13641
13670
  code: rawCode,
13642
13671
  language = "text",
@@ -14223,7 +14252,7 @@ var init_MarkdownContent = __esm({
14223
14252
  init_Box();
14224
14253
  init_CodeBlock();
14225
14254
  init_cn();
14226
- MarkdownContent = React85__default.memo(
14255
+ MarkdownContent = React89__default.memo(
14227
14256
  ({ content, direction = "ltr", className }) => {
14228
14257
  const { t: _t } = useTranslate();
14229
14258
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -15592,7 +15621,7 @@ var init_StateMachineView = __esm({
15592
15621
  style: { top: title ? 30 : 0 },
15593
15622
  children: [
15594
15623
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
15595
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React85__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15624
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React89__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15596
15625
  StateNode,
15597
15626
  {
15598
15627
  state,
@@ -16411,12 +16440,13 @@ var init_ContentRenderer = __esm({
16411
16440
  );
16412
16441
  case "orbital": {
16413
16442
  const parsed = segment.schema;
16443
+ const isFullSchema = (v) => Array.isArray(v.orbitals);
16414
16444
  const inlineTrait = {
16415
16445
  name: "inline",
16416
16446
  scope: "instance",
16417
16447
  stateMachine: parsed
16418
16448
  };
16419
- const schema = Array.isArray(parsed.orbitals) ? parsed : {
16449
+ const schema = isFullSchema(parsed) ? parsed : {
16420
16450
  name: "inline",
16421
16451
  orbitals: [{
16422
16452
  name: "inline",
@@ -17642,8 +17672,21 @@ function BuilderBoard({
17642
17672
  const resolved = boardEntity(entity);
17643
17673
  const [headerError, setHeaderError] = useState(false);
17644
17674
  const [selectedComponent, setSelectedComponent] = useState(null);
17645
- const components = Array.isArray(resolved?.components) ? resolved.components : [];
17646
- const slots = Array.isArray(resolved?.slots) ? resolved.slots : [];
17675
+ const components = rows(resolved?.components).map((r) => ({
17676
+ id: str(r.id),
17677
+ label: str(r.label),
17678
+ description: str(r.description) || void 0,
17679
+ iconEmoji: str(r.iconEmoji) || void 0,
17680
+ iconUrl: str(r.iconUrl) || void 0,
17681
+ category: str(r.category) || void 0
17682
+ }));
17683
+ const slots = rows(resolved?.slots).map((r) => ({
17684
+ id: str(r.id),
17685
+ label: str(r.label) || void 0,
17686
+ description: str(r.description) || void 0,
17687
+ requiredComponentId: str(r.requiredComponentId),
17688
+ placedComponentId: str(r.placedComponentId) || void 0
17689
+ }));
17647
17690
  const placements = {};
17648
17691
  for (const slot of slots) {
17649
17692
  if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
@@ -19547,7 +19590,7 @@ function CardHand({
19547
19590
  className
19548
19591
  }) {
19549
19592
  const eventBus = useEventBus();
19550
- const handleClick = React85.useCallback(
19593
+ const handleClick = React89.useCallback(
19551
19594
  (card) => {
19552
19595
  if (card.disabled) return;
19553
19596
  onCardClick?.(card.id);
@@ -20294,14 +20337,15 @@ var init_CardGrid = __esm({
20294
20337
  bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
20295
20338
  const value = getNestedValue(itemData, field);
20296
20339
  if (value === void 0 || value === null || value === "") return null;
20297
- const boolVal = asBooleanValue(value);
20340
+ const fieldValue = value;
20341
+ const boolVal = asBooleanValue(fieldValue);
20298
20342
  if (boolVal !== null) {
20299
20343
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
20300
20344
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
20301
20345
  boolVal ? /* @__PURE__ */ jsx(Badge, { variant: "success", children: t("common.yes") || "Yes" }) : /* @__PURE__ */ jsx(Badge, { variant: "neutral", children: t("common.no") || "No" })
20302
20346
  ] }, field);
20303
20347
  }
20304
- const displayValue = isDateField(field) ? formatDate(value) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
20348
+ const displayValue = isDateField(field) ? formatDate(fieldValue) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
20305
20349
  if (!displayValue) return null;
20306
20350
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
20307
20351
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
@@ -20686,9 +20730,9 @@ function CastleBoard({
20686
20730
  const eventBus = useEventBus();
20687
20731
  const { t } = useTranslate();
20688
20732
  const resolved = boardEntity(entity);
20689
- const tiles = propTiles ?? (Array.isArray(resolved?.tiles) ? resolved.tiles : []);
20690
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
20691
- const units = propUnits ?? (Array.isArray(resolved?.units) ? resolved.units : []);
20733
+ const tiles = propTiles ?? (resolved?.tiles ?? []);
20734
+ const features = propFeatures ?? (resolved?.features ?? []);
20735
+ const units = propUnits ?? (resolved?.units ?? []);
20692
20736
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
20693
20737
  const backgroundImage = resolved?.backgroundImage;
20694
20738
  const gold = num(resolved?.gold);
@@ -22223,8 +22267,8 @@ function ClassifierBoard({
22223
22267
  const { t } = useTranslate();
22224
22268
  const resolved = boardEntity(entity);
22225
22269
  const [headerError, setHeaderError] = useState(false);
22226
- const items = Array.isArray(resolved?.items) ? resolved.items : [];
22227
- const categories = Array.isArray(resolved?.categories) ? resolved.categories : [];
22270
+ const items = rows(resolved?.items);
22271
+ const categories = rows(resolved?.categories);
22228
22272
  const result = str(resolved?.result);
22229
22273
  const submitted = result === "win";
22230
22274
  const attempts = num(resolved?.attempts);
@@ -23025,7 +23069,7 @@ function CraftingRecipe({
23025
23069
  className
23026
23070
  }) {
23027
23071
  const eventBus = useEventBus();
23028
- const handleCraft = React85.useCallback(() => {
23072
+ const handleCraft = React89.useCallback(() => {
23029
23073
  onCraft?.();
23030
23074
  if (craftEvent) {
23031
23075
  eventBus.emit(craftEvent, { output: output.label });
@@ -23042,7 +23086,7 @@ function CraftingRecipe({
23042
23086
  children: [
23043
23087
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
23044
23088
  const hasSufficient = ingredient.available >= ingredient.required;
23045
- return /* @__PURE__ */ jsxs(React85.Fragment, { children: [
23089
+ return /* @__PURE__ */ jsxs(React89.Fragment, { children: [
23046
23090
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
23047
23091
  ItemSlot,
23048
23092
  {
@@ -23114,8 +23158,8 @@ function DPad({
23114
23158
  }) {
23115
23159
  const eventBus = useEventBus();
23116
23160
  const sizes = sizeMap15[size];
23117
- const [activeDirections, setActiveDirections] = React85.useState(/* @__PURE__ */ new Set());
23118
- const handlePress = React85.useCallback(
23161
+ const [activeDirections, setActiveDirections] = React89.useState(/* @__PURE__ */ new Set());
23162
+ const handlePress = React89.useCallback(
23119
23163
  (direction) => {
23120
23164
  setActiveDirections((prev) => new Set(prev).add(direction));
23121
23165
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -23123,7 +23167,7 @@ function DPad({
23123
23167
  },
23124
23168
  [directionEvent, eventBus, onDirection]
23125
23169
  );
23126
- const handleRelease = React85.useCallback(
23170
+ const handleRelease = React89.useCallback(
23127
23171
  (direction) => {
23128
23172
  setActiveDirections((prev) => {
23129
23173
  const next = new Set(prev);
@@ -24008,8 +24052,8 @@ var init_Menu = __esm({
24008
24052
  "bottom-end": "bottom-start"
24009
24053
  };
24010
24054
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
24011
- const triggerChild = React85__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
24012
- const triggerElement = React85__default.cloneElement(
24055
+ const triggerChild = React89__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
24056
+ const triggerElement = React89__default.cloneElement(
24013
24057
  triggerChild,
24014
24058
  {
24015
24059
  ref: triggerRef,
@@ -24104,14 +24148,14 @@ function useDataDnd(args) {
24104
24148
  const isZone = Boolean(dragGroup || accepts || sortable);
24105
24149
  const enabled = isZone || Boolean(dndRoot);
24106
24150
  const eventBus = useEventBus();
24107
- const parentRoot = React85__default.useContext(RootCtx);
24151
+ const parentRoot = React89__default.useContext(RootCtx);
24108
24152
  const isRoot = enabled && parentRoot === null;
24109
- const zoneId = React85__default.useId();
24153
+ const zoneId = React89__default.useId();
24110
24154
  const ownGroup = dragGroup ?? accepts ?? zoneId;
24111
- const [optimisticOrders, setOptimisticOrders] = React85__default.useState(() => /* @__PURE__ */ new Map());
24112
- const optimisticOrdersRef = React85__default.useRef(optimisticOrders);
24155
+ const [optimisticOrders, setOptimisticOrders] = React89__default.useState(() => /* @__PURE__ */ new Map());
24156
+ const optimisticOrdersRef = React89__default.useRef(optimisticOrders);
24113
24157
  optimisticOrdersRef.current = optimisticOrders;
24114
- const clearOptimisticOrder = React85__default.useCallback((group) => {
24158
+ const clearOptimisticOrder = React89__default.useCallback((group) => {
24115
24159
  setOptimisticOrders((prev) => {
24116
24160
  if (!prev.has(group)) return prev;
24117
24161
  const next = new Map(prev);
@@ -24134,17 +24178,20 @@ function useDataDnd(args) {
24134
24178
  }
24135
24179
  const itemIdsSignature = orderedItems.map((it, idx) => {
24136
24180
  const raw = it[dndItemIdField];
24137
- return String(raw ?? `__idx_${idx}`);
24181
+ return raw != null ? String(raw) : `__idx_${idx}`;
24138
24182
  }).join("|");
24139
- const itemIds = React85__default.useMemo(
24183
+ const itemIds = React89__default.useMemo(
24140
24184
  () => orderedItems.map((it, idx) => {
24141
24185
  const raw = it[dndItemIdField];
24142
- return raw ?? `__idx_${idx}`;
24186
+ return raw != null ? String(raw) : `__idx_${idx}`;
24143
24187
  }),
24144
24188
  [itemIdsSignature]
24145
24189
  );
24146
- const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
24147
- React85__default.useEffect(() => {
24190
+ const itemsContentSig = items.map((it, idx) => {
24191
+ const raw = it[dndItemIdField];
24192
+ return raw != null ? String(raw) : `__${idx}`;
24193
+ }).join("|");
24194
+ React89__default.useEffect(() => {
24148
24195
  const root = isRoot ? null : parentRoot;
24149
24196
  if (root) {
24150
24197
  root.clearOptimisticOrder(ownGroup);
@@ -24152,20 +24199,20 @@ function useDataDnd(args) {
24152
24199
  clearOptimisticOrder(ownGroup);
24153
24200
  }
24154
24201
  }, [itemsContentSig, ownGroup]);
24155
- const zonesRef = React85__default.useRef(/* @__PURE__ */ new Map());
24156
- const registerZone = React85__default.useCallback((zoneId2, meta2) => {
24202
+ const zonesRef = React89__default.useRef(/* @__PURE__ */ new Map());
24203
+ const registerZone = React89__default.useCallback((zoneId2, meta2) => {
24157
24204
  zonesRef.current.set(zoneId2, meta2);
24158
24205
  }, []);
24159
- const unregisterZone = React85__default.useCallback((zoneId2) => {
24206
+ const unregisterZone = React89__default.useCallback((zoneId2) => {
24160
24207
  zonesRef.current.delete(zoneId2);
24161
24208
  }, []);
24162
- const [activeDrag, setActiveDrag] = React85__default.useState(null);
24163
- const [overZoneGroup, setOverZoneGroup] = React85__default.useState(null);
24164
- const meta = React85__default.useMemo(
24209
+ const [activeDrag, setActiveDrag] = React89__default.useState(null);
24210
+ const [overZoneGroup, setOverZoneGroup] = React89__default.useState(null);
24211
+ const meta = React89__default.useMemo(
24165
24212
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
24166
24213
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
24167
24214
  );
24168
- React85__default.useEffect(() => {
24215
+ React89__default.useEffect(() => {
24169
24216
  const target = isRoot ? null : parentRoot;
24170
24217
  if (!target) {
24171
24218
  zonesRef.current.set(zoneId, meta);
@@ -24184,7 +24231,7 @@ function useDataDnd(args) {
24184
24231
  }, [parentRoot, isRoot, zoneId, meta]);
24185
24232
  const sensors = useAlmadarDndSensors(true);
24186
24233
  const collisionDetection = almadarDndCollisionDetection;
24187
- const findZoneByItem = React85__default.useCallback(
24234
+ const findZoneByItem = React89__default.useCallback(
24188
24235
  (id) => {
24189
24236
  for (const z of zonesRef.current.values()) {
24190
24237
  if (z.itemIds.includes(id)) return z;
@@ -24193,7 +24240,7 @@ function useDataDnd(args) {
24193
24240
  },
24194
24241
  []
24195
24242
  );
24196
- React85__default.useCallback(
24243
+ React89__default.useCallback(
24197
24244
  (group) => {
24198
24245
  for (const z of zonesRef.current.values()) {
24199
24246
  if (z.group === group) return z;
@@ -24202,7 +24249,7 @@ function useDataDnd(args) {
24202
24249
  },
24203
24250
  []
24204
24251
  );
24205
- const handleDragEnd = React85__default.useCallback(
24252
+ const handleDragEnd = React89__default.useCallback(
24206
24253
  (event) => {
24207
24254
  const { active, over } = event;
24208
24255
  const activeIdStr = String(active.id);
@@ -24293,8 +24340,8 @@ function useDataDnd(args) {
24293
24340
  },
24294
24341
  [eventBus]
24295
24342
  );
24296
- const sortableData = React85__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
24297
- const SortableItem = React85__default.useCallback(
24343
+ const sortableData = React89__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
24344
+ const SortableItem = React89__default.useCallback(
24298
24345
  ({ id, children }) => {
24299
24346
  const {
24300
24347
  attributes,
@@ -24334,7 +24381,7 @@ function useDataDnd(args) {
24334
24381
  id: droppableId,
24335
24382
  data: sortableData
24336
24383
  });
24337
- const ctx = React85__default.useContext(RootCtx);
24384
+ const ctx = React89__default.useContext(RootCtx);
24338
24385
  const activeDrag2 = ctx?.activeDrag ?? null;
24339
24386
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
24340
24387
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -24349,7 +24396,7 @@ function useDataDnd(args) {
24349
24396
  showForeignPlaceholder,
24350
24397
  ctxAvailable: ctx != null
24351
24398
  });
24352
- React85__default.useEffect(() => {
24399
+ React89__default.useEffect(() => {
24353
24400
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
24354
24401
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
24355
24402
  return /* @__PURE__ */ jsx(
@@ -24363,11 +24410,11 @@ function useDataDnd(args) {
24363
24410
  }
24364
24411
  );
24365
24412
  };
24366
- const rootContextValue = React85__default.useMemo(
24413
+ const rootContextValue = React89__default.useMemo(
24367
24414
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
24368
24415
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
24369
24416
  );
24370
- const handleDragStart = React85__default.useCallback((event) => {
24417
+ const handleDragStart = React89__default.useCallback((event) => {
24371
24418
  const sourceZone = findZoneByItem(event.active.id);
24372
24419
  const rect = event.active.rect.current.initial;
24373
24420
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -24386,7 +24433,7 @@ function useDataDnd(args) {
24386
24433
  isRoot
24387
24434
  });
24388
24435
  }, [findZoneByItem, isRoot, zoneId]);
24389
- const handleDragOver = React85__default.useCallback((event) => {
24436
+ const handleDragOver = React89__default.useCallback((event) => {
24390
24437
  const { active, over } = event;
24391
24438
  const overData = over?.data?.current;
24392
24439
  const overGroup = overData?.dndGroup ?? null;
@@ -24456,7 +24503,7 @@ function useDataDnd(args) {
24456
24503
  return next;
24457
24504
  });
24458
24505
  }, []);
24459
- const handleDragCancel = React85__default.useCallback((event) => {
24506
+ const handleDragCancel = React89__default.useCallback((event) => {
24460
24507
  setActiveDrag(null);
24461
24508
  setOverZoneGroup(null);
24462
24509
  dndLog.warn("dragCancel", {
@@ -24464,12 +24511,12 @@ function useDataDnd(args) {
24464
24511
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
24465
24512
  });
24466
24513
  }, []);
24467
- const handleDragEndWithCleanup = React85__default.useCallback((event) => {
24514
+ const handleDragEndWithCleanup = React89__default.useCallback((event) => {
24468
24515
  handleDragEnd(event);
24469
24516
  setActiveDrag(null);
24470
24517
  setOverZoneGroup(null);
24471
24518
  }, [handleDragEnd]);
24472
- const wrapContainer = React85__default.useCallback(
24519
+ const wrapContainer = React89__default.useCallback(
24473
24520
  (children) => {
24474
24521
  if (!enabled) return children;
24475
24522
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -24523,7 +24570,7 @@ var init_useDataDnd = __esm({
24523
24570
  init_useAlmadarDndCollision();
24524
24571
  init_Box();
24525
24572
  dndLog = createLogger("almadar:ui:dnd");
24526
- RootCtx = React85__default.createContext(null);
24573
+ RootCtx = React89__default.createContext(null);
24527
24574
  }
24528
24575
  });
24529
24576
  function renderIconInput(icon, props) {
@@ -24666,8 +24713,8 @@ function DataGrid({
24666
24713
  const hasRenderProp = typeof children === "function";
24667
24714
  useEffect(() => {
24668
24715
  if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
24669
- const renderItemRaw = schemaRenderItem;
24670
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
24716
+ const schemaArr = Array.isArray(schemaRenderItem) ? schemaRenderItem : null;
24717
+ const isFnLambda = schemaArr !== null && schemaArr.length >= 3 && (schemaArr[0] === "fn" || schemaArr[0] === "lambda");
24671
24718
  dataGridLog.warn("renderItem-unresolved", {
24672
24719
  rowCount: data.length,
24673
24720
  renderItemIsFnLambda: isFnLambda
@@ -25049,7 +25096,7 @@ function DataList({
25049
25096
  }) {
25050
25097
  const eventBus = useEventBus();
25051
25098
  const { t } = useTranslate();
25052
- const [visibleCount, setVisibleCount] = React85__default.useState(pageSize || Infinity);
25099
+ const [visibleCount, setVisibleCount] = React89__default.useState(pageSize || Infinity);
25053
25100
  const fieldDefs = fields ?? columns ?? [];
25054
25101
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
25055
25102
  const dnd = useDataDnd({
@@ -25068,21 +25115,20 @@ function DataList({
25068
25115
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
25069
25116
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
25070
25117
  const hasRenderProp = typeof children === "function";
25071
- React85__default.useEffect(() => {
25118
+ React89__default.useEffect(() => {
25072
25119
  const renderItemTypeOf = typeof schemaRenderItem;
25073
25120
  const childrenTypeOf = typeof children;
25074
25121
  if (data.length > 0 && !hasRenderProp) {
25075
25122
  const firstRow = data[0];
25076
25123
  const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
25077
- const renderItemRaw = schemaRenderItem;
25078
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
25124
+ const isFnLambda = Array.isArray(schemaRenderItem) && schemaRenderItem.length >= 3 && (schemaRenderItem[0] === "fn" || schemaRenderItem[0] === "lambda");
25079
25125
  dataListLog.warn("renderItem-unresolved", {
25080
25126
  rowCount: data.length,
25081
25127
  fieldsCount: fieldDefs.length,
25082
25128
  renderItemTypeOf,
25083
- renderItemIsArray: Array.isArray(renderItemRaw),
25129
+ renderItemIsArray: Array.isArray(schemaRenderItem),
25084
25130
  renderItemIsFnLambda: isFnLambda,
25085
- renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
25131
+ renderItemHead: Array.isArray(schemaRenderItem) ? String(schemaRenderItem[0]) : void 0,
25086
25132
  childrenTypeOf,
25087
25133
  sampleRowKeys: sampleKeys
25088
25134
  });
@@ -25170,10 +25216,10 @@ function DataList({
25170
25216
  const isCompact = variant === "compact";
25171
25217
  const isMessage = variant === "message";
25172
25218
  if (isMessage) {
25173
- const items2 = data.map((item) => item);
25219
+ const items2 = [...data];
25174
25220
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
25175
25221
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
25176
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
25222
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
25177
25223
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
25178
25224
  group.items.map((itemData, index) => {
25179
25225
  const id = itemData.id || `${gi}-${index}`;
@@ -25219,7 +25265,7 @@ function DataList({
25219
25265
  })
25220
25266
  ] }, gi)) });
25221
25267
  }
25222
- const items = data.map((item) => item);
25268
+ const items = [...data];
25223
25269
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
25224
25270
  const idFieldName = dndItemIdField ?? "id";
25225
25271
  const renderItem = (itemData, index, isLast) => {
@@ -25314,7 +25360,7 @@ function DataList({
25314
25360
  className
25315
25361
  ),
25316
25362
  children: [
25317
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
25363
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
25318
25364
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
25319
25365
  group.items.map(
25320
25366
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -26107,23 +26153,19 @@ var init_Flex = __esm({
26107
26153
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
26108
26154
  }
26109
26155
  }
26110
- const Comp = Component2;
26111
- return /* @__PURE__ */ jsx(
26112
- Comp,
26113
- {
26114
- className: cn(
26115
- inline ? "inline-flex" : "flex",
26116
- directionStyles[direction],
26117
- wrapStyles[wrap],
26118
- alignStyles3[align],
26119
- justifyStyles2[justify],
26120
- gapStyles6[gap],
26121
- className
26122
- ),
26123
- style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
26124
- children
26125
- }
26126
- );
26156
+ return React89__default.createElement(Component2, {
26157
+ className: cn(
26158
+ inline ? "inline-flex" : "flex",
26159
+ directionStyles[direction],
26160
+ wrapStyles[wrap],
26161
+ alignStyles3[align],
26162
+ justifyStyles2[justify],
26163
+ gapStyles6[gap],
26164
+ className
26165
+ ),
26166
+ style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
26167
+ children
26168
+ });
26127
26169
  };
26128
26170
  Flex.displayName = "Flex";
26129
26171
  }
@@ -26230,7 +26272,7 @@ var init_Grid = __esm({
26230
26272
  as: Component2 = "div"
26231
26273
  }) => {
26232
26274
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
26233
- return React85__default.createElement(
26275
+ return React89__default.createElement(
26234
26276
  Component2,
26235
26277
  {
26236
26278
  className: cn(
@@ -26426,9 +26468,9 @@ var init_Popover = __esm({
26426
26468
  onMouseLeave: handleClose,
26427
26469
  onPointerDown: tapTriggerProps.onPointerDown
26428
26470
  };
26429
- const childElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
26471
+ const childElement = React89__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
26430
26472
  const childPointerDown = childElement.props.onPointerDown;
26431
- const triggerElement = React85__default.cloneElement(
26473
+ const triggerElement = React89__default.cloneElement(
26432
26474
  childElement,
26433
26475
  {
26434
26476
  ref: triggerRef,
@@ -27030,9 +27072,9 @@ var init_Tooltip = __esm({
27030
27072
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
27031
27073
  };
27032
27074
  }, []);
27033
- const triggerElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
27075
+ const triggerElement = React89__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
27034
27076
  const childPointerDown = triggerElement.props.onPointerDown;
27035
- const trigger = React85__default.cloneElement(triggerElement, {
27077
+ const trigger = React89__default.cloneElement(triggerElement, {
27036
27078
  ref: triggerRef,
27037
27079
  onMouseEnter: handleMouseEnter,
27038
27080
  onMouseLeave: handleMouseLeave,
@@ -27122,7 +27164,7 @@ var init_WizardProgress = __esm({
27122
27164
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
27123
27165
  const isActive = index === currentStep;
27124
27166
  const isCompleted = index < currentStep;
27125
- return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
27167
+ return /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
27126
27168
  /* @__PURE__ */ jsx(
27127
27169
  "button",
27128
27170
  {
@@ -27434,13 +27476,14 @@ var init_ViolationAlert = __esm({
27434
27476
  onNavigateToField,
27435
27477
  compact = false,
27436
27478
  className,
27437
- ...flatProps
27479
+ message
27438
27480
  }) => {
27439
27481
  const { t } = useTranslate();
27482
+ const fallbackMessage = message ?? t("violationAlert.fallbackMessage");
27440
27483
  const resolvedViolation = violation ?? {
27441
27484
  law: "",
27442
27485
  article: "",
27443
- message: flatProps.message ?? t("violationAlert.fallbackMessage"),
27486
+ message: fallbackMessage,
27444
27487
  actionType: "measure"
27445
27488
  };
27446
27489
  const effectiveSeverity = severity ?? (resolvedViolation.actionType === "measure" ? "warning" : "error");
@@ -28185,7 +28228,7 @@ function InventoryGrid({
28185
28228
  const eventBus = useEventBus();
28186
28229
  const slotCount = totalSlots ?? items.length;
28187
28230
  const emptySlotCount = Math.max(0, slotCount - items.length);
28188
- const handleSelect = React85.useCallback(
28231
+ const handleSelect = React89.useCallback(
28189
28232
  (id) => {
28190
28233
  onSelect?.(id);
28191
28234
  if (selectEvent) {
@@ -28420,31 +28463,31 @@ function GameCanvas2D({
28420
28463
  assetBaseUrl,
28421
28464
  className
28422
28465
  }) {
28423
- const canvasRef = React85.useRef(null);
28424
- const rafRef = React85.useRef(0);
28425
- const frameRef = React85.useRef(0);
28426
- const lastTimeRef = React85.useRef(0);
28427
- const imageCache = React85.useRef(/* @__PURE__ */ new Map());
28466
+ const canvasRef = React89.useRef(null);
28467
+ const rafRef = React89.useRef(0);
28468
+ const frameRef = React89.useRef(0);
28469
+ const lastTimeRef = React89.useRef(0);
28470
+ const imageCache = React89.useRef(/* @__PURE__ */ new Map());
28428
28471
  const emit = useEmitEvent();
28429
- const onDrawRef = React85.useRef(onDraw);
28472
+ const onDrawRef = React89.useRef(onDraw);
28430
28473
  onDrawRef.current = onDraw;
28431
- const onTickRef = React85.useRef(onTick);
28474
+ const onTickRef = React89.useRef(onTick);
28432
28475
  onTickRef.current = onTick;
28433
- const tickEventRef = React85.useRef(tickEvent);
28476
+ const tickEventRef = React89.useRef(tickEvent);
28434
28477
  tickEventRef.current = tickEvent;
28435
- const drawEventRef = React85.useRef(drawEvent);
28478
+ const drawEventRef = React89.useRef(drawEvent);
28436
28479
  drawEventRef.current = drawEvent;
28437
- const emitRef = React85.useRef(emit);
28480
+ const emitRef = React89.useRef(emit);
28438
28481
  emitRef.current = emit;
28439
- const assetBaseUrlRef = React85.useRef(assetBaseUrl);
28482
+ const assetBaseUrlRef = React89.useRef(assetBaseUrl);
28440
28483
  assetBaseUrlRef.current = assetBaseUrl;
28441
- const backgroundImageRef = React85.useRef(backgroundImage);
28484
+ const backgroundImageRef = React89.useRef(backgroundImage);
28442
28485
  backgroundImageRef.current = backgroundImage;
28443
- const widthRef = React85.useRef(width);
28486
+ const widthRef = React89.useRef(width);
28444
28487
  widthRef.current = width;
28445
- const heightRef = React85.useRef(height);
28488
+ const heightRef = React89.useRef(height);
28446
28489
  heightRef.current = height;
28447
- const loadImage = React85.useCallback((url) => {
28490
+ const loadImage = React89.useCallback((url) => {
28448
28491
  const base = assetBaseUrlRef.current;
28449
28492
  if (!url.startsWith("http") && !base) return null;
28450
28493
  const fullUrl = url.startsWith("http") ? url : `${base}${url}`;
@@ -28458,7 +28501,7 @@ function GameCanvas2D({
28458
28501
  }
28459
28502
  return null;
28460
28503
  }, []);
28461
- React85.useEffect(() => {
28504
+ React89.useEffect(() => {
28462
28505
  const canvas = canvasRef.current;
28463
28506
  if (!canvas) return;
28464
28507
  const ctx = canvas.getContext("2d");
@@ -28783,7 +28826,7 @@ function TurnPanel({
28783
28826
  className
28784
28827
  }) {
28785
28828
  const eventBus = useEventBus();
28786
- const handleAction = React85.useCallback(
28829
+ const handleAction = React89.useCallback(
28787
28830
  (event) => {
28788
28831
  if (event) {
28789
28832
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -28964,7 +29007,7 @@ function UnitCommandBar({
28964
29007
  className
28965
29008
  }) {
28966
29009
  const eventBus = useEventBus();
28967
- const handleCommand = React85.useCallback(
29010
+ const handleCommand = React89.useCallback(
28968
29011
  (event) => {
28969
29012
  if (event) {
28970
29013
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -29515,7 +29558,7 @@ function GameMenu({
29515
29558
  } catch {
29516
29559
  }
29517
29560
  const eventBus = eventBusProp || eventBusFromHook;
29518
- const handleOptionClick = React85.useCallback(
29561
+ const handleOptionClick = React89.useCallback(
29519
29562
  (option) => {
29520
29563
  if (option.event && eventBus) {
29521
29564
  eventBus.emit(`UI:${option.event}`, { option });
@@ -29634,7 +29677,7 @@ function GameOverScreen({
29634
29677
  } catch {
29635
29678
  }
29636
29679
  const eventBus = eventBusProp || eventBusFromHook;
29637
- const handleActionClick = React85.useCallback(
29680
+ const handleActionClick = React89.useCallback(
29638
29681
  (action) => {
29639
29682
  if (action.event && eventBus) {
29640
29683
  eventBus.emit(`UI:${action.event}`, { action });
@@ -30566,7 +30609,7 @@ var init_MapView = __esm({
30566
30609
  shadowSize: [41, 41]
30567
30610
  });
30568
30611
  L.Marker.prototype.options.icon = defaultIcon;
30569
- const { useEffect: useEffect85, useRef: useRef80, useCallback: useCallback127, useState: useState117 } = React85__default;
30612
+ const { useEffect: useEffect85, useRef: useRef80, useCallback: useCallback127, useState: useState117 } = React89__default;
30570
30613
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
30571
30614
  const { useEventBus: useEventBus4 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
30572
30615
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -31402,6 +31445,15 @@ function renderIconInput3(icon, props) {
31402
31445
  function columnLabel(col) {
31403
31446
  return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
31404
31447
  }
31448
+ function asFieldValue(v) {
31449
+ if (v === void 0 || v === null) return v;
31450
+ const t = typeof v;
31451
+ if (t === "string" || t === "number" || t === "boolean") return v;
31452
+ if (v instanceof Date) return v;
31453
+ if (Array.isArray(v)) return v;
31454
+ if (t === "object") return v;
31455
+ return void 0;
31456
+ }
31405
31457
  function statusVariant4(value) {
31406
31458
  const v = value.toLowerCase();
31407
31459
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online", "ok"].includes(v)) return "success";
@@ -31472,8 +31524,8 @@ function TableView({
31472
31524
  }) {
31473
31525
  const eventBus = useEventBus();
31474
31526
  const { t } = useTranslate();
31475
- const [visibleCount, setVisibleCount] = React85__default.useState(pageSize > 0 ? pageSize : Infinity);
31476
- const [localSelected, setLocalSelected] = React85__default.useState(/* @__PURE__ */ new Set());
31527
+ const [visibleCount, setVisibleCount] = React89__default.useState(pageSize > 0 ? pageSize : Infinity);
31528
+ const [localSelected, setLocalSelected] = React89__default.useState(/* @__PURE__ */ new Set());
31477
31529
  const colDefs = columns ?? fields ?? [];
31478
31530
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
31479
31531
  const dnd = useDataDnd({
@@ -31618,7 +31670,7 @@ function TableView({
31618
31670
  }
31619
31671
  ) }),
31620
31672
  hasRenderProp ? /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
31621
- const raw = getNestedValue(row, col.field ?? col.key);
31673
+ const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
31622
31674
  const cellBase = cn(
31623
31675
  "flex items-center min-w-0",
31624
31676
  alignClass[col.align ?? "left"],
@@ -31668,12 +31720,12 @@ function TableView({
31668
31720
  ]
31669
31721
  }
31670
31722
  );
31671
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React85__default.Fragment, { children: rowInner }, id);
31723
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React89__default.Fragment, { children: rowInner }, id);
31672
31724
  };
31673
- const items = data.map((row) => row);
31725
+ const items = Array.from(data);
31674
31726
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
31675
31727
  let runningIndex = 0;
31676
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
31728
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
31677
31729
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
31678
31730
  group.items.map((row) => renderRow(row, runningIndex++))
31679
31731
  ] }, gi)) });
@@ -33030,7 +33082,7 @@ var init_StepFlow = __esm({
33030
33082
  className
33031
33083
  }) => {
33032
33084
  if (orientation === "vertical") {
33033
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
33085
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React89__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
33034
33086
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
33035
33087
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
33036
33088
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -33041,7 +33093,7 @@ var init_StepFlow = __esm({
33041
33093
  ] })
33042
33094
  ] }) }, index)) });
33043
33095
  }
33044
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
33096
+ 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(React89__default.Fragment, { children: [
33045
33097
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
33046
33098
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
33047
33099
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -34026,7 +34078,7 @@ var init_LikertScale = __esm({
34026
34078
  md: "text-base",
34027
34079
  lg: "text-lg"
34028
34080
  };
34029
- LikertScale = React85__default.forwardRef(
34081
+ LikertScale = React89__default.forwardRef(
34030
34082
  ({
34031
34083
  question,
34032
34084
  options = DEFAULT_LIKERT_OPTIONS,
@@ -34038,7 +34090,7 @@ var init_LikertScale = __esm({
34038
34090
  variant = "radios",
34039
34091
  className
34040
34092
  }, ref) => {
34041
- const groupId = React85__default.useId();
34093
+ const groupId = React89__default.useId();
34042
34094
  const eventBus = useEventBus();
34043
34095
  const handleSelect = useCallback(
34044
34096
  (next) => {
@@ -34933,11 +34985,11 @@ function nextBlockId(prefix = "blk") {
34933
34985
  function normalizeBlocks(raw) {
34934
34986
  if (!Array.isArray(raw) || raw.length === 0) return [createBlock("paragraph")];
34935
34987
  return raw.map((row) => {
34936
- const r = row;
34937
- const rawType = r.type;
34988
+ const entity = row;
34989
+ const rawType = entity.type;
34938
34990
  const type = typeof rawType === "string" && BLOCK_TYPES.has(rawType) ? rawType : "paragraph";
34939
- const id = typeof r.id === "string" && r.id ? r.id : nextBlockId(type);
34940
- return { ...r, id, type };
34991
+ const id = typeof entity.id === "string" && entity.id ? entity.id : nextBlockId(type);
34992
+ return { ...entity, id, type };
34941
34993
  });
34942
34994
  }
34943
34995
  function createBlock(type) {
@@ -36320,7 +36372,7 @@ var init_DocBreadcrumb = __esm({
36320
36372
  "aria-label": t("aria.breadcrumb"),
36321
36373
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
36322
36374
  const isLast = idx === items.length - 1;
36323
- return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
36375
+ return /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
36324
36376
  idx > 0 && /* @__PURE__ */ jsx(
36325
36377
  Icon,
36326
36378
  {
@@ -37188,8 +37240,8 @@ var init_MiniStateMachine = __esm({
37188
37240
  states.map((s, i) => {
37189
37241
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
37190
37242
  const tc = transitionCounts[s.name] ?? 0;
37191
- const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
37192
- return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
37243
+ const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
37244
+ return /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
37193
37245
  /* @__PURE__ */ jsx(
37194
37246
  AvlState,
37195
37247
  {
@@ -37199,8 +37251,8 @@ var init_MiniStateMachine = __esm({
37199
37251
  height: NODE_H,
37200
37252
  name: "",
37201
37253
  role,
37202
- isInitial: s.isInitial,
37203
- isTerminal: s.isTerminal
37254
+ isInitial: s.isInitial ?? void 0,
37255
+ isTerminal: s.isTerminal ?? void 0
37204
37256
  }
37205
37257
  ),
37206
37258
  i < states.length - 1 && /* @__PURE__ */ jsxs("g", { children: [
@@ -37393,7 +37445,7 @@ var init_PageHeader = __esm({
37393
37445
  info: "bg-info/10 text-info"
37394
37446
  };
37395
37447
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37396
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
37448
+ 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(React89__default.Fragment, { children: [
37397
37449
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37398
37450
  crumb.href ? /* @__PURE__ */ jsx(
37399
37451
  "a",
@@ -37751,52 +37803,49 @@ var init_Section = __esm({
37751
37803
  as: Component2 = "section"
37752
37804
  }) => {
37753
37805
  const hasHeader = title || description || action;
37754
- const Comp = Component2;
37755
- return /* @__PURE__ */ jsxs(
37756
- Comp,
37806
+ return React89__default.createElement(
37807
+ Component2,
37757
37808
  {
37758
37809
  className: cn(
37759
37810
  paddingStyles4[padding],
37760
37811
  variantStyles9[variant],
37761
37812
  className
37762
- ),
37763
- children: [
37764
- hasHeader && /* @__PURE__ */ jsxs(
37765
- Box,
37766
- {
37767
- className: cn(
37768
- "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
37769
- divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
37770
- !divider && "mb-4",
37771
- headerClassName
37772
- ),
37773
- children: [
37774
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
37775
- title && /* @__PURE__ */ jsx(
37776
- Typography,
37777
- {
37778
- variant: "h4",
37779
- className: "text-foreground font-semibold",
37780
- children: title
37781
- }
37782
- ),
37783
- description && /* @__PURE__ */ jsx(
37784
- Typography,
37785
- {
37786
- variant: "body",
37787
- color: "muted",
37788
- className: "mt-1",
37789
- children: description
37790
- }
37791
- )
37792
- ] }),
37793
- action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
37794
- ]
37795
- }
37813
+ )
37814
+ },
37815
+ hasHeader && /* @__PURE__ */ jsxs(
37816
+ Box,
37817
+ {
37818
+ className: cn(
37819
+ "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
37820
+ divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
37821
+ !divider && "mb-4",
37822
+ headerClassName
37796
37823
  ),
37797
- /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
37798
- ]
37799
- }
37824
+ children: [
37825
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
37826
+ title && /* @__PURE__ */ jsx(
37827
+ Typography,
37828
+ {
37829
+ variant: "h4",
37830
+ className: "text-foreground font-semibold",
37831
+ children: title
37832
+ }
37833
+ ),
37834
+ description && /* @__PURE__ */ jsx(
37835
+ Typography,
37836
+ {
37837
+ variant: "body",
37838
+ color: "muted",
37839
+ className: "mt-1",
37840
+ children: description
37841
+ }
37842
+ )
37843
+ ] }),
37844
+ action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
37845
+ ]
37846
+ }
37847
+ ),
37848
+ /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
37800
37849
  );
37801
37850
  };
37802
37851
  Section.displayName = "Section";
@@ -38122,7 +38171,7 @@ var init_WizardContainer = __esm({
38122
38171
  const isCompleted = index < currentStep;
38123
38172
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
38124
38173
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
38125
- return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
38174
+ return /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
38126
38175
  /* @__PURE__ */ jsx(
38127
38176
  Button,
38128
38177
  {
@@ -40065,6 +40114,22 @@ var init_DataTable = __esm({
40065
40114
  DataTable.displayName = "DataTable";
40066
40115
  }
40067
40116
  });
40117
+ function toDebuggerLine(v) {
40118
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
40119
+ const id = v["id"];
40120
+ const content = v["content"];
40121
+ const isBug = v["isBug"];
40122
+ if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
40123
+ const isFlagged = v["isFlagged"];
40124
+ const explanation = v["explanation"];
40125
+ return {
40126
+ id,
40127
+ content,
40128
+ isBug,
40129
+ isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
40130
+ explanation: typeof explanation === "string" ? explanation : void 0
40131
+ };
40132
+ }
40068
40133
  function DebuggerBoard({
40069
40134
  entity,
40070
40135
  completeEvent = "PUZZLE_COMPLETE",
@@ -40077,7 +40142,10 @@ function DebuggerBoard({
40077
40142
  const { t } = useTranslate();
40078
40143
  const resolved = boardEntity(entity);
40079
40144
  const [headerError, setHeaderError] = useState(false);
40080
- const lines = Array.isArray(resolved?.lines) ? resolved.lines : [];
40145
+ const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
40146
+ const l = toDebuggerLine(v);
40147
+ return l ? [l] : [];
40148
+ }) : [];
40081
40149
  const result = str(resolved?.result) || "none";
40082
40150
  const attempts = num(resolved?.attempts);
40083
40151
  const submitted = result === "win";
@@ -40682,7 +40750,7 @@ var init_DetailPanel = __esm({
40682
40750
  }
40683
40751
  });
40684
40752
  function extractTitle(children) {
40685
- if (!React85__default.isValidElement(children)) return void 0;
40753
+ if (!React89__default.isValidElement(children)) return void 0;
40686
40754
  const props = children.props;
40687
40755
  if (typeof props.title === "string") {
40688
40756
  return props.title;
@@ -40737,7 +40805,7 @@ function LinearView({
40737
40805
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
40738
40806
  const isDone = i < currentIdx;
40739
40807
  const isCurrent = i === currentIdx;
40740
- return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
40808
+ return /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
40741
40809
  i > 0 && /* @__PURE__ */ jsx(
40742
40810
  Typography,
40743
40811
  {
@@ -41559,12 +41627,12 @@ function evaluateFormExpression(expr, formCtx) {
41559
41627
  return evaluate(expr, ctx);
41560
41628
  }
41561
41629
  function isOrbitalEntitySchema(value) {
41562
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
41630
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
41563
41631
  const fields = value.fields;
41564
41632
  return Array.isArray(fields);
41565
41633
  }
41566
41634
  function isPlainEntityRow(value) {
41567
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
41635
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
41568
41636
  const fields = value.fields;
41569
41637
  return !Array.isArray(fields);
41570
41638
  }
@@ -41723,12 +41791,12 @@ var init_Form = __esm({
41723
41791
  const isSchemaEntity = isOrbitalEntitySchema(entity);
41724
41792
  const resolvedEntity = isSchemaEntity ? entity : void 0;
41725
41793
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
41726
- const normalizedInitialData = React85__default.useMemo(() => {
41794
+ const normalizedInitialData = React89__default.useMemo(() => {
41727
41795
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
41728
41796
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
41729
41797
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
41730
41798
  }, [entity, initialData]);
41731
- const entityDerivedFields = React85__default.useMemo(() => {
41799
+ const entityDerivedFields = React89__default.useMemo(() => {
41732
41800
  if (fields && fields.length > 0) return void 0;
41733
41801
  if (!resolvedEntity) return void 0;
41734
41802
  return resolvedEntity.fields.map(
@@ -41736,6 +41804,7 @@ var init_Form = __esm({
41736
41804
  name: f3.name,
41737
41805
  type: f3.type,
41738
41806
  required: f3.required,
41807
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
41739
41808
  defaultValue: f3.default,
41740
41809
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
41741
41810
  values: "values" in f3 ? f3.values : void 0,
@@ -41748,16 +41817,16 @@ var init_Form = __esm({
41748
41817
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
41749
41818
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
41750
41819
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
41751
- const [formData, setFormData] = React85__default.useState(
41820
+ const [formData, setFormData] = React89__default.useState(
41752
41821
  normalizedInitialData
41753
41822
  );
41754
- const [collapsedSections, setCollapsedSections] = React85__default.useState(
41823
+ const [collapsedSections, setCollapsedSections] = React89__default.useState(
41755
41824
  /* @__PURE__ */ new Set()
41756
41825
  );
41757
- const [submitError, setSubmitError] = React85__default.useState(null);
41758
- const formRef = React85__default.useRef(null);
41826
+ const [submitError, setSubmitError] = React89__default.useState(null);
41827
+ const formRef = React89__default.useRef(null);
41759
41828
  const formMode = props.mode;
41760
- const mountedRef = React85__default.useRef(false);
41829
+ const mountedRef = React89__default.useRef(false);
41761
41830
  if (!mountedRef.current) {
41762
41831
  mountedRef.current = true;
41763
41832
  debug("forms", "mount", {
@@ -41770,7 +41839,7 @@ var init_Form = __esm({
41770
41839
  });
41771
41840
  }
41772
41841
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
41773
- const evalContext = React85__default.useMemo(
41842
+ const evalContext = React89__default.useMemo(
41774
41843
  () => ({
41775
41844
  formValues: formData,
41776
41845
  globalVariables: externalContext?.globalVariables ?? {},
@@ -41779,7 +41848,7 @@ var init_Form = __esm({
41779
41848
  }),
41780
41849
  [formData, externalContext]
41781
41850
  );
41782
- React85__default.useEffect(() => {
41851
+ React89__default.useEffect(() => {
41783
41852
  debug("forms", "initialData-sync", {
41784
41853
  mode: formMode,
41785
41854
  normalizedInitialData,
@@ -41790,7 +41859,7 @@ var init_Form = __esm({
41790
41859
  setFormData(normalizedInitialData);
41791
41860
  }
41792
41861
  }, [normalizedInitialData]);
41793
- const processCalculations = React85__default.useCallback(
41862
+ const processCalculations = React89__default.useCallback(
41794
41863
  (changedFieldId, newFormData) => {
41795
41864
  if (!hiddenCalculations.length) return;
41796
41865
  const context = {
@@ -41815,7 +41884,7 @@ var init_Form = __esm({
41815
41884
  },
41816
41885
  [hiddenCalculations, externalContext, eventBus]
41817
41886
  );
41818
- const checkViolations = React85__default.useCallback(
41887
+ const checkViolations = React89__default.useCallback(
41819
41888
  (changedFieldId, newFormData) => {
41820
41889
  if (!violationTriggers.length) return;
41821
41890
  const context = {
@@ -41853,7 +41922,7 @@ var init_Form = __esm({
41853
41922
  processCalculations(name, newFormData);
41854
41923
  checkViolations(name, newFormData);
41855
41924
  };
41856
- const isFieldVisible = React85__default.useCallback(
41925
+ const isFieldVisible = React89__default.useCallback(
41857
41926
  (fieldName) => {
41858
41927
  const condition = conditionalFields[fieldName];
41859
41928
  if (!condition) return true;
@@ -41861,7 +41930,7 @@ var init_Form = __esm({
41861
41930
  },
41862
41931
  [conditionalFields, evalContext]
41863
41932
  );
41864
- const isSectionVisible = React85__default.useCallback(
41933
+ const isSectionVisible = React89__default.useCallback(
41865
41934
  (section) => {
41866
41935
  if (!section.condition) return true;
41867
41936
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -41937,7 +42006,7 @@ var init_Form = __esm({
41937
42006
  eventBus.emit(`UI:${onCancel}`);
41938
42007
  }
41939
42008
  };
41940
- const renderField = React85__default.useCallback(
42009
+ const renderField = React89__default.useCallback(
41941
42010
  (field) => {
41942
42011
  const fieldName = field.name || field.field;
41943
42012
  if (!fieldName) return null;
@@ -41958,7 +42027,7 @@ var init_Form = __esm({
41958
42027
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
41959
42028
  );
41960
42029
  const effectiveFields = entityDerivedFields ?? fields;
41961
- const normalizedFields = React85__default.useMemo(() => {
42030
+ const normalizedFields = React89__default.useMemo(() => {
41962
42031
  if (!effectiveFields || effectiveFields.length === 0) return [];
41963
42032
  return effectiveFields.map((field) => {
41964
42033
  if (typeof field === "string") {
@@ -41968,6 +42037,7 @@ var init_Form = __esm({
41968
42037
  name: field,
41969
42038
  type: entityField.type,
41970
42039
  required: entityField.required,
42040
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
41971
42041
  defaultValue: entityField.default,
41972
42042
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
41973
42043
  values: "values" in entityField ? entityField.values : void 0,
@@ -41981,7 +42051,7 @@ var init_Form = __esm({
41981
42051
  return field;
41982
42052
  });
41983
42053
  }, [effectiveFields, resolvedEntity]);
41984
- const schemaFields = React85__default.useMemo(() => {
42054
+ const schemaFields = React89__default.useMemo(() => {
41985
42055
  if (normalizedFields.length === 0) return null;
41986
42056
  if (isDebugEnabled()) {
41987
42057
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -41991,7 +42061,7 @@ var init_Form = __esm({
41991
42061
  }
41992
42062
  return normalizedFields.map(renderField).filter(Boolean);
41993
42063
  }, [normalizedFields, renderField, entityName, conditionalFields]);
41994
- const sectionElements = React85__default.useMemo(() => {
42064
+ const sectionElements = React89__default.useMemo(() => {
41995
42065
  if (!sections || sections.length === 0) return null;
41996
42066
  return sections.map((section) => {
41997
42067
  if (!isSectionVisible(section)) {
@@ -44247,6 +44317,14 @@ var init_GameBoard3D = __esm({
44247
44317
  GameBoard3D.displayName = "GameBoard3D";
44248
44318
  }
44249
44319
  });
44320
+ function asDescriptor(v) {
44321
+ if (Array.isArray(v) || React89__default.isValidElement(v)) return null;
44322
+ const o = v;
44323
+ if (typeof o.type !== "string") return null;
44324
+ const props = o.props !== void 0 && typeof o.props === "object" && !Array.isArray(o.props) && o.props !== null ? o.props : void 0;
44325
+ const _id = typeof o._id === "string" ? o._id : void 0;
44326
+ return { type: o.type, props, _id };
44327
+ }
44250
44328
  function getSlotContentRenderer2() {
44251
44329
  if (_scr) return _scr;
44252
44330
  const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
@@ -44255,17 +44333,16 @@ function getSlotContentRenderer2() {
44255
44333
  }
44256
44334
  function resolveDescriptor(value, idPrefix) {
44257
44335
  if (value === null || value === void 0) return value;
44258
- if (React85__default.isValidElement(value)) return value;
44336
+ if (React89__default.isValidElement(value)) return value;
44259
44337
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
44260
44338
  if (Array.isArray(value)) {
44261
- return value.map((item, i) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
44339
+ return value.map((item, i) => /* @__PURE__ */ jsx(React89__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
44262
44340
  }
44263
- if (typeof value === "object") {
44264
- const rec = value;
44265
- if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
44266
- const { type, props: nestedProps, _id, ...flatProps } = rec;
44267
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
44268
- const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
44341
+ if (typeof value === "object" && value !== null) {
44342
+ const desc = asDescriptor(value);
44343
+ if (desc !== null && getComponentForPattern(desc.type) !== null) {
44344
+ const resolvedProps = desc.props ?? {};
44345
+ const content = { id: desc._id ?? idPrefix, pattern: desc.type, props: resolvedProps, priority: 0 };
44269
44346
  const SCR = getSlotContentRenderer2();
44270
44347
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
44271
44348
  }
@@ -44359,16 +44436,19 @@ function getSlotContentRenderer3() {
44359
44436
  }
44360
44437
  function resolveDescriptor2(value, idPrefix) {
44361
44438
  if (value === null || value === void 0) return value;
44362
- if (React85__default.isValidElement(value)) return value;
44439
+ if (React89__default.isValidElement(value)) return value;
44363
44440
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
44364
44441
  if (Array.isArray(value)) {
44365
- return value.map((item, i) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
44442
+ return value.map((item, i) => /* @__PURE__ */ jsx(React89__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
44366
44443
  }
44367
44444
  if (typeof value === "object") {
44368
44445
  const rec = value;
44369
44446
  if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
44370
- const { type, props: nestedProps, _id, ...flatProps } = rec;
44371
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
44447
+ const type = rec.type;
44448
+ const _id = typeof rec._id === "string" ? rec._id : void 0;
44449
+ const nestedProps = rec.props !== void 0 && typeof rec.props === "object" && !Array.isArray(rec.props) && rec.props !== null ? rec.props : void 0;
44450
+ const { type: _t, props: _p, _id: _d, ...flatRest } = rec;
44451
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatRest;
44372
44452
  const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
44373
44453
  const SCR = getSlotContentRenderer3();
44374
44454
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
@@ -45072,7 +45152,7 @@ var init_List = __esm({
45072
45152
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
45073
45153
  return [];
45074
45154
  }, [entity]);
45075
- const getItemActions = React85__default.useCallback(
45155
+ const getItemActions = React89__default.useCallback(
45076
45156
  (item) => {
45077
45157
  if (!itemActions) return [];
45078
45158
  if (typeof itemActions === "function") {
@@ -45129,15 +45209,14 @@ var init_List = __esm({
45129
45209
  };
45130
45210
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
45131
45211
  const firstField = effectiveFieldNames[0];
45132
- const itemRecord = item;
45133
- if (!normalizedItem.title && getNestedValue(itemRecord, firstField)) {
45212
+ if (!normalizedItem.title && getNestedValue(item, firstField)) {
45134
45213
  normalizedItem.title = String(
45135
- getNestedValue(itemRecord, firstField)
45214
+ getNestedValue(item, firstField)
45136
45215
  );
45137
45216
  }
45138
45217
  normalizedItem._fields = effectiveFieldNames.reduce(
45139
45218
  (acc, field) => {
45140
- const value = getNestedValue(itemRecord, field);
45219
+ const value = getNestedValue(item, field);
45141
45220
  if (value !== void 0 && value !== null) {
45142
45221
  acc[field] = value;
45143
45222
  }
@@ -45590,16 +45669,18 @@ var init_MediaGallery = __esm({
45590
45669
  [selectable, selectedItems, selectionEvent, eventBus]
45591
45670
  );
45592
45671
  const entityData = Array.isArray(entity) ? entity : [];
45593
- const items = React85__default.useMemo(() => {
45672
+ const items = React89__default.useMemo(() => {
45594
45673
  if (propItems) return propItems;
45595
45674
  if (entityData.length === 0) return [];
45596
- return entityData.map((record, idx) => ({
45597
- id: String(record.id ?? idx),
45598
- src: String(record.src ?? record.url ?? record.image ?? ""),
45599
- alt: record.alt ? String(record.alt) : void 0,
45600
- thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
45601
- caption: record.caption ? String(record.caption) : record.title ? String(record.title) : void 0
45602
- }));
45675
+ return entityData.map((record, idx) => {
45676
+ return {
45677
+ id: String(record.id ?? idx),
45678
+ src: String(record.src ?? ("url" in record ? record.url : "") ?? ("image" in record ? record.image : "") ?? ""),
45679
+ alt: record.alt ? String(record.alt) : void 0,
45680
+ thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
45681
+ caption: record.caption ? String(record.caption) : "title" in record ? String(record.title) : void 0
45682
+ };
45683
+ });
45603
45684
  }, [propItems, entityData]);
45604
45685
  if (isLoading) {
45605
45686
  return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
@@ -45793,7 +45874,7 @@ var init_MinigolfBoard = __esm({
45793
45874
  }
45794
45875
  });
45795
45876
  function extractTitle2(children) {
45796
- if (!React85__default.isValidElement(children)) return void 0;
45877
+ if (!React89__default.isValidElement(children)) return void 0;
45797
45878
  const props = children.props;
45798
45879
  if (typeof props.title === "string") {
45799
45880
  return props.title;
@@ -45859,8 +45940,16 @@ function NegotiatorBoard({
45859
45940
  const lastPlayerAction = str(resolved?.lastPlayerAction);
45860
45941
  const lastOpponentAction = str(resolved?.lastOpponentAction);
45861
45942
  const lastPayoff = num(resolved?.lastPayoff);
45862
- const actions = Array.isArray(resolved?.actions) ? resolved.actions : [];
45863
- const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix : [];
45943
+ const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
45944
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
45945
+ return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
45946
+ return [];
45947
+ }) : [];
45948
+ const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
45949
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
45950
+ return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
45951
+ return [];
45952
+ }) : [];
45864
45953
  const prevRoundRef = useRef(currentRound);
45865
45954
  useEffect(() => {
45866
45955
  if (currentRound > prevRoundRef.current && lastPlayerAction) {
@@ -46986,7 +47075,7 @@ var init_debugRegistry = __esm({
46986
47075
  }
46987
47076
  });
46988
47077
  function useDebugData() {
46989
- const [data, setData] = React85.useState(() => ({
47078
+ const [data, setData] = React89.useState(() => ({
46990
47079
  traits: [],
46991
47080
  ticks: [],
46992
47081
  guards: [],
@@ -47000,7 +47089,7 @@ function useDebugData() {
47000
47089
  },
47001
47090
  lastUpdate: Date.now()
47002
47091
  }));
47003
- React85.useEffect(() => {
47092
+ React89.useEffect(() => {
47004
47093
  const updateData = () => {
47005
47094
  setData({
47006
47095
  traits: getAllTraits(),
@@ -47109,12 +47198,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
47109
47198
  return positions;
47110
47199
  }
47111
47200
  function WalkMinimap() {
47112
- const [walkStep, setWalkStep] = React85.useState(null);
47113
- const [traits2, setTraits] = React85.useState([]);
47114
- const [coveredEdges, setCoveredEdges] = React85.useState([]);
47115
- const [completedTraits, setCompletedTraits] = React85.useState(/* @__PURE__ */ new Set());
47116
- const prevTraitRef = React85.useRef(null);
47117
- React85.useEffect(() => {
47201
+ const [walkStep, setWalkStep] = React89.useState(null);
47202
+ const [traits2, setTraits] = React89.useState([]);
47203
+ const [coveredEdges, setCoveredEdges] = React89.useState([]);
47204
+ const [completedTraits, setCompletedTraits] = React89.useState(/* @__PURE__ */ new Set());
47205
+ const prevTraitRef = React89.useRef(null);
47206
+ React89.useEffect(() => {
47118
47207
  const interval = setInterval(() => {
47119
47208
  const w = window;
47120
47209
  const step = w.__orbitalWalkStep;
@@ -47550,15 +47639,15 @@ var init_EntitiesTab = __esm({
47550
47639
  });
47551
47640
  function EventFlowTab({ events: events2 }) {
47552
47641
  const { t } = useTranslate();
47553
- const [filter, setFilter] = React85.useState("all");
47554
- const containerRef = React85.useRef(null);
47555
- const [autoScroll, setAutoScroll] = React85.useState(true);
47556
- React85.useEffect(() => {
47642
+ const [filter, setFilter] = React89.useState("all");
47643
+ const containerRef = React89.useRef(null);
47644
+ const [autoScroll, setAutoScroll] = React89.useState(true);
47645
+ React89.useEffect(() => {
47557
47646
  if (autoScroll && containerRef.current) {
47558
47647
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
47559
47648
  }
47560
47649
  }, [events2.length, autoScroll]);
47561
- const filteredEvents = React85.useMemo(() => {
47650
+ const filteredEvents = React89.useMemo(() => {
47562
47651
  if (filter === "all") return events2;
47563
47652
  return events2.filter((e) => e.type === filter);
47564
47653
  }, [events2, filter]);
@@ -47674,7 +47763,7 @@ var init_EventFlowTab = __esm({
47674
47763
  });
47675
47764
  function GuardsPanel({ guards }) {
47676
47765
  const { t } = useTranslate();
47677
- const [filter, setFilter] = React85.useState("all");
47766
+ const [filter, setFilter] = React89.useState("all");
47678
47767
  if (guards.length === 0) {
47679
47768
  return /* @__PURE__ */ jsx(
47680
47769
  EmptyState,
@@ -47687,7 +47776,7 @@ function GuardsPanel({ guards }) {
47687
47776
  }
47688
47777
  const passedCount = guards.filter((g) => g.result).length;
47689
47778
  const failedCount = guards.length - passedCount;
47690
- const filteredGuards = React85.useMemo(() => {
47779
+ const filteredGuards = React89.useMemo(() => {
47691
47780
  if (filter === "all") return guards;
47692
47781
  if (filter === "passed") return guards.filter((g) => g.result);
47693
47782
  return guards.filter((g) => !g.result);
@@ -47850,10 +47939,10 @@ function EffectBadge({ effect }) {
47850
47939
  }
47851
47940
  function TransitionTimeline({ transitions }) {
47852
47941
  const { t } = useTranslate();
47853
- const containerRef = React85.useRef(null);
47854
- const [autoScroll, setAutoScroll] = React85.useState(true);
47855
- const [expandedId, setExpandedId] = React85.useState(null);
47856
- React85.useEffect(() => {
47942
+ const containerRef = React89.useRef(null);
47943
+ const [autoScroll, setAutoScroll] = React89.useState(true);
47944
+ const [expandedId, setExpandedId] = React89.useState(null);
47945
+ React89.useEffect(() => {
47857
47946
  if (autoScroll && containerRef.current) {
47858
47947
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
47859
47948
  }
@@ -48059,18 +48148,18 @@ var init_ServerBridgeTab = __esm({
48059
48148
  });
48060
48149
  function extractPayloadFields(schema, eventName) {
48061
48150
  if (!schema) return [];
48062
- const orbitals = schema.orbitals;
48063
- if (!orbitals) return [];
48064
- for (const orbital of orbitals) {
48065
- const traits2 = orbital.traits ?? [];
48066
- for (const trait of traits2) {
48067
- const sm = trait.stateMachine;
48151
+ for (const orbital of schema.orbitals) {
48152
+ const traitRefs = orbital.traits ?? [];
48153
+ for (const traitRef of traitRefs) {
48154
+ if (!isInlineTrait(traitRef)) continue;
48155
+ const inlineTrait = traitRef;
48156
+ const sm = inlineTrait.stateMachine;
48068
48157
  if (!sm) continue;
48069
48158
  const events2 = sm.events ?? [];
48070
48159
  for (const evt of events2) {
48071
48160
  if (evt.name !== eventName) continue;
48072
- const payload = evt.payload ?? [];
48073
- return payload.map((f3) => ({
48161
+ const payloadFields = evt.payloadSchema ?? [];
48162
+ return payloadFields.map((f3) => ({
48074
48163
  name: f3.name,
48075
48164
  type: f3.type ?? "string"
48076
48165
  }));
@@ -48133,9 +48222,9 @@ function getAllEvents(traits2) {
48133
48222
  function EventDispatcherTab({ traits: traits2, schema }) {
48134
48223
  const eventBus = useEventBus();
48135
48224
  const { t } = useTranslate();
48136
- const [log14, setLog] = React85.useState([]);
48137
- const prevStatesRef = React85.useRef(/* @__PURE__ */ new Map());
48138
- React85.useEffect(() => {
48225
+ const [log14, setLog] = React89.useState([]);
48226
+ const prevStatesRef = React89.useRef(/* @__PURE__ */ new Map());
48227
+ React89.useEffect(() => {
48139
48228
  for (const trait of traits2) {
48140
48229
  const prev = prevStatesRef.current.get(trait.id);
48141
48230
  if (prev && prev !== trait.currentState) {
@@ -48304,10 +48393,10 @@ function VerifyModePanel({
48304
48393
  localCount
48305
48394
  }) {
48306
48395
  const { t } = useTranslate();
48307
- const [expanded, setExpanded] = React85.useState(true);
48308
- const scrollRef = React85.useRef(null);
48309
- const prevCountRef = React85.useRef(0);
48310
- React85.useEffect(() => {
48396
+ const [expanded, setExpanded] = React89.useState(true);
48397
+ const scrollRef = React89.useRef(null);
48398
+ const prevCountRef = React89.useRef(0);
48399
+ React89.useEffect(() => {
48311
48400
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
48312
48401
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
48313
48402
  }
@@ -48364,10 +48453,10 @@ function RuntimeDebugger({
48364
48453
  schema
48365
48454
  }) {
48366
48455
  const { t } = useTranslate();
48367
- const [isCollapsed, setIsCollapsed] = React85.useState(mode === "verify" ? true : defaultCollapsed);
48368
- const [isVisible, setIsVisible] = React85.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
48456
+ const [isCollapsed, setIsCollapsed] = React89.useState(mode === "verify" ? true : defaultCollapsed);
48457
+ const [isVisible, setIsVisible] = React89.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
48369
48458
  const debugData = useDebugData();
48370
- React85.useEffect(() => {
48459
+ React89.useEffect(() => {
48371
48460
  if (mode === "inline") return;
48372
48461
  return onDebugToggle((enabled) => {
48373
48462
  setIsVisible(enabled);
@@ -48376,7 +48465,7 @@ function RuntimeDebugger({
48376
48465
  }
48377
48466
  });
48378
48467
  }, [mode]);
48379
- React85.useEffect(() => {
48468
+ React89.useEffect(() => {
48380
48469
  if (mode === "inline") return;
48381
48470
  const handleKeyDown = (e) => {
48382
48471
  if (e.key === "`" && isVisible) {
@@ -48936,7 +49025,7 @@ function SequenceBar({
48936
49025
  onSlotRemove(index);
48937
49026
  }, [onSlotRemove, playing]);
48938
49027
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
48939
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
49028
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React89__default.Fragment, { children: [
48940
49029
  i > 0 && /* @__PURE__ */ jsx(
48941
49030
  Typography,
48942
49031
  {
@@ -49551,6 +49640,29 @@ var init_SimulationCanvas = __esm({
49551
49640
  SimulationCanvas.displayName = "SimulationCanvas";
49552
49641
  }
49553
49642
  });
49643
+ function readSimulatorParameters(v) {
49644
+ if (!Array.isArray(v)) return [];
49645
+ const result = [];
49646
+ for (const item of v) {
49647
+ if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
49648
+ const param = item;
49649
+ if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
49650
+ result.push({
49651
+ id: str(param.id),
49652
+ label: str(param.label),
49653
+ unit: str(param.unit),
49654
+ min: num(param.min),
49655
+ max: num(param.max),
49656
+ step: num(param.step),
49657
+ initial: num(param.initial),
49658
+ correct: num(param.correct),
49659
+ tolerance: num(param.tolerance)
49660
+ });
49661
+ }
49662
+ }
49663
+ }
49664
+ return result;
49665
+ }
49554
49666
  function SimulatorBoard({
49555
49667
  entity,
49556
49668
  completeEvent = "PUZZLE_COMPLETE",
@@ -49563,7 +49675,7 @@ function SimulatorBoard({
49563
49675
  const { emit } = useEventBus();
49564
49676
  const { t } = useTranslate();
49565
49677
  const resolved = boardEntity(entity);
49566
- const parameters = Array.isArray(resolved?.parameters) ? resolved.parameters : [];
49678
+ const parameters = readSimulatorParameters(resolved?.parameters);
49567
49679
  const [headerError, setHeaderError] = useState(false);
49568
49680
  if (!resolved) return null;
49569
49681
  const paramA = num(resolved.paramA);
@@ -49590,8 +49702,14 @@ function SimulatorBoard({
49590
49702
  const handlePlayAgain = () => {
49591
49703
  if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
49592
49704
  };
49593
- const theme = resolved.theme ?? void 0;
49594
- const themeBackground = theme?.background;
49705
+ const themeBackground = (() => {
49706
+ const t2 = resolved.theme;
49707
+ if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
49708
+ const bg = t2.background;
49709
+ return str(bg);
49710
+ }
49711
+ return "";
49712
+ })();
49595
49713
  const headerImage = str(resolved.headerImage);
49596
49714
  const hint = str(resolved.hint);
49597
49715
  const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
@@ -49996,7 +50114,7 @@ var init_StatCard = __esm({
49996
50114
  const labelToUse = propLabel ?? propTitle;
49997
50115
  const eventBus = useEventBus();
49998
50116
  const { t } = useTranslate();
49999
- const handleActionClick = React85__default.useCallback(() => {
50117
+ const handleActionClick = React89__default.useCallback(() => {
50000
50118
  if (action?.event) {
50001
50119
  eventBus.emit(`UI:${action.event}`, {});
50002
50120
  }
@@ -50007,7 +50125,7 @@ var init_StatCard = __esm({
50007
50125
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
50008
50126
  const isLoading = externalLoading ?? false;
50009
50127
  const error = externalError;
50010
- const computeMetricValue = React85__default.useCallback(
50128
+ const computeMetricValue = React89__default.useCallback(
50011
50129
  (metric, items) => {
50012
50130
  if (metric.value !== void 0) {
50013
50131
  return metric.value;
@@ -50046,7 +50164,7 @@ var init_StatCard = __esm({
50046
50164
  },
50047
50165
  []
50048
50166
  );
50049
- const schemaStats = React85__default.useMemo(() => {
50167
+ const schemaStats = React89__default.useMemo(() => {
50050
50168
  if (!metrics || metrics.length === 0) return null;
50051
50169
  return metrics.map((metric) => ({
50052
50170
  label: metric.label,
@@ -50054,7 +50172,7 @@ var init_StatCard = __esm({
50054
50172
  format: metric.format
50055
50173
  }));
50056
50174
  }, [metrics, data, computeMetricValue]);
50057
- const calculatedTrend = React85__default.useMemo(() => {
50175
+ const calculatedTrend = React89__default.useMemo(() => {
50058
50176
  if (manualTrend !== void 0) return manualTrend;
50059
50177
  if (previousValue === void 0 || currentValue === void 0)
50060
50178
  return void 0;
@@ -50397,8 +50515,25 @@ function StateArchitectBoard({
50397
50515
  const initialState = str(resolved?.initialState);
50398
50516
  const entityName = str(resolved?.entityName);
50399
50517
  const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
50400
- const testCases = Array.isArray(resolved?.testCases) ? resolved.testCases : [];
50401
- const entityTransitions = Array.isArray(resolved?.transitions) ? resolved.transitions : [];
50518
+ const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
50519
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
50520
+ const eventsField = o["events"];
50521
+ return {
50522
+ events: Array.isArray(eventsField) ? eventsField : [],
50523
+ expectedState: str(o["expectedState"]),
50524
+ label: str(o["label"])
50525
+ };
50526
+ });
50527
+ const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
50528
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
50529
+ return {
50530
+ id: str(o["id"]),
50531
+ from: str(o["from"]),
50532
+ to: str(o["to"]),
50533
+ event: str(o["event"]),
50534
+ ...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
50535
+ };
50536
+ });
50402
50537
  const entityVariables = rows(resolved?.variables);
50403
50538
  const transitions = entityTransitions;
50404
50539
  const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
@@ -51243,8 +51378,8 @@ var init_SubagentTracePanel = __esm({
51243
51378
  ] });
51244
51379
  };
51245
51380
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
51246
- const endRef = React85__default.useRef(null);
51247
- React85__default.useEffect(() => {
51381
+ const endRef = React89__default.useRef(null);
51382
+ React89__default.useEffect(() => {
51248
51383
  if (!autoScroll) return;
51249
51384
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
51250
51385
  }, [activities.length, autoScroll]);
@@ -51338,7 +51473,7 @@ var init_SubagentTracePanel = __esm({
51338
51473
  };
51339
51474
  SubagentRichCard = ({ subagent }) => {
51340
51475
  const { t } = useTranslate();
51341
- const activities = React85__default.useMemo(
51476
+ const activities = React89__default.useMemo(
51342
51477
  () => subagentMessagesToActivities(subagent.messages),
51343
51478
  [subagent.messages]
51344
51479
  );
@@ -51415,8 +51550,8 @@ var init_SubagentTracePanel = __esm({
51415
51550
  ] });
51416
51551
  };
51417
51552
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
51418
- const endRef = React85__default.useRef(null);
51419
- React85__default.useEffect(() => {
51553
+ const endRef = React89__default.useRef(null);
51554
+ React89__default.useEffect(() => {
51420
51555
  if (!autoScroll) return;
51421
51556
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
51422
51557
  }, [messages.length, autoScroll]);
@@ -51887,17 +52022,12 @@ var init_Timeline = __esm({
51887
52022
  look = "vertical-spacious"
51888
52023
  }) => {
51889
52024
  const { t } = useTranslate();
51890
- const entityData = Array.isArray(entity) ? entity : [];
51891
- const items = React85__default.useMemo(() => {
52025
+ const entityData = entity ?? [];
52026
+ const items = React89__default.useMemo(() => {
51892
52027
  if (propItems) return propItems;
51893
52028
  if (entityData.length === 0) return [];
51894
52029
  return entityData.map((record, idx) => {
51895
- const resolveField = (f3) => {
51896
- if (typeof f3 === "string") return f3;
51897
- if (f3 && typeof f3 === "object" && "name" in f3) return String(f3.name);
51898
- return "";
51899
- };
51900
- const resolvedFields = fields?.map(resolveField) ?? [];
52030
+ const resolvedFields = fields ?? [];
51901
52031
  const titleField = resolvedFields[0] || "title";
51902
52032
  const descField = resolvedFields[1] || "description";
51903
52033
  const dateField = resolvedFields.find(
@@ -51995,7 +52125,7 @@ var init_Timeline = __esm({
51995
52125
  }
51996
52126
  });
51997
52127
  function extractToastProps(children) {
51998
- if (!React85__default.isValidElement(children)) {
52128
+ if (!React89__default.isValidElement(children)) {
51999
52129
  if (typeof children === "string") {
52000
52130
  return { message: children };
52001
52131
  }
@@ -52033,7 +52163,7 @@ var init_ToastSlot = __esm({
52033
52163
  eventBus.emit("UI:CLOSE");
52034
52164
  };
52035
52165
  if (!isVisible) return null;
52036
- const isCustomContent = React85__default.isValidElement(children) && !message;
52166
+ const isCustomContent = React89__default.isValidElement(children) && !message;
52037
52167
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
52038
52168
  Toast,
52039
52169
  {
@@ -53305,7 +53435,7 @@ function WorldMapBoard({
53305
53435
  const resolved = boardEntity(entity);
53306
53436
  const entityUnits = rows(resolved?.units);
53307
53437
  const entityTiles = rows(resolved?.tiles);
53308
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
53438
+ const features = propFeatures ?? rows(resolved?.features);
53309
53439
  const selectedHeroId = resolved?.selectedHeroId ?? null;
53310
53440
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
53311
53441
  const backgroundImage = resolved?.backgroundImage;
@@ -53438,7 +53568,8 @@ function WorldMapBoard({
53438
53568
  if (heroMoveEvent) {
53439
53569
  eventBus.emit(`UI:${heroMoveEvent}`, { heroId, toX: x, toY: y });
53440
53570
  }
53441
- const feature = tile ? str(tile.feature) : "";
53571
+ const tileWithFeature = tile;
53572
+ const feature = tileWithFeature ? str(tileWithFeature.feature) : "";
53442
53573
  if (feature && feature !== "none") {
53443
53574
  const tileRow = tile;
53444
53575
  onFeatureEnter?.(heroId, tileRow);
@@ -53649,7 +53780,7 @@ var init_WorldMapTemplate = __esm({
53649
53780
  }
53650
53781
  });
53651
53782
  function lazyThree(name, loader) {
53652
- const Lazy = React85__default.lazy(
53783
+ const Lazy = React89__default.lazy(
53653
53784
  () => loader().then((m) => {
53654
53785
  const Resolved = m[name];
53655
53786
  if (!Resolved) {
@@ -53661,13 +53792,13 @@ function lazyThree(name, loader) {
53661
53792
  })
53662
53793
  );
53663
53794
  function ThreeWrapper(props) {
53664
- return React85__default.createElement(
53795
+ return React89__default.createElement(
53665
53796
  ThreeBoundary,
53666
53797
  { name },
53667
- React85__default.createElement(
53668
- React85__default.Suspense,
53798
+ React89__default.createElement(
53799
+ React89__default.Suspense,
53669
53800
  { fallback: null },
53670
- React85__default.createElement(Lazy, props)
53801
+ React89__default.createElement(Lazy, props)
53671
53802
  )
53672
53803
  );
53673
53804
  }
@@ -53990,7 +54121,7 @@ var init_component_registry_generated = __esm({
53990
54121
  init_WorldMapBoard();
53991
54122
  init_WorldMapTemplate();
53992
54123
  init_XPBar();
53993
- ThreeBoundary = class extends React85__default.Component {
54124
+ ThreeBoundary = class extends React89__default.Component {
53994
54125
  constructor() {
53995
54126
  super(...arguments);
53996
54127
  __publicField(this, "state", { failed: false });
@@ -54000,7 +54131,7 @@ var init_component_registry_generated = __esm({
54000
54131
  }
54001
54132
  render() {
54002
54133
  if (this.state.failed) {
54003
- return React85__default.createElement(
54134
+ return React89__default.createElement(
54004
54135
  "div",
54005
54136
  {
54006
54137
  "data-testid": "three-unavailable",
@@ -54366,7 +54497,7 @@ function SuspenseConfigProvider({
54366
54497
  config,
54367
54498
  children
54368
54499
  }) {
54369
- return React85__default.createElement(
54500
+ return React89__default.createElement(
54370
54501
  SuspenseConfigContext.Provider,
54371
54502
  { value: config },
54372
54503
  children
@@ -54382,9 +54513,7 @@ function getComponentForPattern3(patternType) {
54382
54513
  if (!mapping) {
54383
54514
  return null;
54384
54515
  }
54385
- const name = typeof mapping === "string" ? mapping : mapping.component;
54386
- if (!name) return null;
54387
- return COMPONENT_REGISTRY[name] ?? null;
54516
+ return COMPONENT_REGISTRY[mapping] ?? null;
54388
54517
  }
54389
54518
  function enrichFormFields(fields, entityDef) {
54390
54519
  const fieldMap = new Map(entityDef.fields.map((f3) => [f3.name, f3]));
@@ -54396,7 +54525,7 @@ function enrichFormFields(fields, entityDef) {
54396
54525
  name: field,
54397
54526
  label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
54398
54527
  type: entityField.type,
54399
- required: entityField.required
54528
+ required: entityField.required ?? false
54400
54529
  };
54401
54530
  if (entityField.values && entityField.values.length > 0) {
54402
54531
  enriched.values = entityField.values;
@@ -54404,15 +54533,15 @@ function enrichFormFields(fields, entityDef) {
54404
54533
  enriched.values = entityField.enumValues;
54405
54534
  }
54406
54535
  if (entityField.relation) {
54407
- enriched.relation = entityField.relation;
54536
+ enriched.relation = entityField.relation.entity;
54408
54537
  }
54409
54538
  return enriched;
54410
54539
  }
54411
54540
  return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
54412
54541
  }
54413
- if (field && typeof field === "object" && !Array.isArray(field)) {
54542
+ if (field && typeof field === "object" && !Array.isArray(field) && !React89__default.isValidElement(field) && !(field instanceof Date)) {
54414
54543
  const obj = field;
54415
- const fieldName = obj.name ?? obj.field;
54544
+ const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
54416
54545
  if (!fieldName) return field;
54417
54546
  if (obj.type || obj.inputType) return field;
54418
54547
  const entityField = fieldMap.get(fieldName);
@@ -54429,7 +54558,7 @@ function enrichFormFields(fields, entityDef) {
54429
54558
  }
54430
54559
  }
54431
54560
  if (!obj.relation && entityField.relation) {
54432
- enriched.relation = entityField.relation;
54561
+ enriched.relation = entityField.relation.entity;
54433
54562
  }
54434
54563
  return enriched;
54435
54564
  }
@@ -54856,7 +54985,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
54856
54985
  const key = `${parentId}-${index}-trait:${traitName}`;
54857
54986
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
54858
54987
  }
54859
- return /* @__PURE__ */ jsx(React85__default.Fragment, { children: child }, `${parentId}-${index}`);
54988
+ return /* @__PURE__ */ jsx(React89__default.Fragment, { children: child }, `${parentId}-${index}`);
54860
54989
  }
54861
54990
  if (!child || typeof child !== "object") return null;
54862
54991
  const childId = `${parentId}-${index}`;
@@ -54896,14 +55025,14 @@ function isPatternConfig(value) {
54896
55025
  if (value === null || value === void 0) return false;
54897
55026
  if (typeof value !== "object") return false;
54898
55027
  if (Array.isArray(value)) return false;
54899
- if (React85__default.isValidElement(value)) return false;
55028
+ if (React89__default.isValidElement(value)) return false;
54900
55029
  if (value instanceof Date) return false;
54901
55030
  if (typeof value === "function") return false;
54902
55031
  const record = value;
54903
55032
  return "type" in record && typeof record.type === "string" && getComponentForPattern(record.type) !== null;
54904
55033
  }
54905
55034
  function isPlainConfigObject(value) {
54906
- if (React85__default.isValidElement(value)) return false;
55035
+ if (React89__default.isValidElement(value)) return false;
54907
55036
  if (value instanceof Date) return false;
54908
55037
  const proto = Object.getPrototypeOf(value);
54909
55038
  return proto === Object.prototype || proto === null;
@@ -55029,7 +55158,7 @@ function SlotContentRenderer({
55029
55158
  for (const slotKey of CONTENT_NODE_SLOTS) {
55030
55159
  const slotVal = restProps[slotKey];
55031
55160
  if (slotVal === void 0 || slotVal === null) continue;
55032
- if (React85__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
55161
+ if (React89__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
55033
55162
  if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
55034
55163
  nodeSlotOverrides[slotKey] = renderPatternChildren(
55035
55164
  slotVal,
@@ -55074,19 +55203,18 @@ function SlotContentRenderer({
55074
55203
  for (const [k, v] of Object.entries(nodeSlotOverrides)) {
55075
55204
  finalProps[k] = v;
55076
55205
  }
55077
- const resolvedItems = Array.isArray(
55078
- finalProps.entity
55079
- ) ? finalProps.entity : null;
55206
+ const entityVal = finalProps.entity;
55207
+ const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
55080
55208
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
55081
55209
  const sample = resolvedItems[0];
55082
- if (sample && typeof sample === "object") {
55210
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React89__default.isValidElement(sample) && !(sample instanceof Date)) {
55083
55211
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
55084
55212
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
55085
55213
  }
55086
55214
  }
55087
55215
  const isFormPattern = FORM_PATTERNS.has(content.pattern) || content.pattern.includes("form");
55088
- if (isFormPattern && entityDef && Array.isArray(finalProps.fields)) {
55089
- finalProps.fields = enrichFormFields(finalProps.fields, entityDef);
55216
+ if (isFormPattern && entityDef && Array.isArray(finalProps.fields) && finalProps.fields[0] !== "fn") {
55217
+ finalProps.fields = enrichFormFields([...finalProps.fields], entityDef);
55090
55218
  }
55091
55219
  const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
55092
55220
  return /* @__PURE__ */ jsx(
@@ -55367,7 +55495,7 @@ function resolveLambdaBindings(body, params, item, index) {
55367
55495
  if (Array.isArray(body)) {
55368
55496
  return body.map((b) => recur(b));
55369
55497
  }
55370
- if (body !== null && typeof body === "object" && !React85__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
55498
+ if (body !== null && typeof body === "object" && !React89__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
55371
55499
  const out = {};
55372
55500
  for (const [k, v] of Object.entries(body)) {
55373
55501
  out[k] = recur(v);
@@ -55386,7 +55514,7 @@ function getSlotContentRenderer4() {
55386
55514
  function makeLambdaFn(params, lambdaBody, callerKey) {
55387
55515
  return (item, index) => {
55388
55516
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
55389
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React85__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
55517
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React89__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
55390
55518
  return null;
55391
55519
  }
55392
55520
  const record = resolvedBody;
@@ -55405,7 +55533,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
55405
55533
  props: childProps,
55406
55534
  priority: 0
55407
55535
  };
55408
- return React85__default.createElement(SlotContentRenderer2, { content: childContent });
55536
+ return React89__default.createElement(SlotContentRenderer2, { content: childContent });
55409
55537
  };
55410
55538
  }
55411
55539
  function convertNode(node, callerKey) {
@@ -55424,7 +55552,7 @@ function convertNode(node, callerKey) {
55424
55552
  });
55425
55553
  return anyChanged ? mapped : node;
55426
55554
  }
55427
- if (typeof node === "object" && !React85__default.isValidElement(node) && !(node instanceof Date)) {
55555
+ if (typeof node === "object" && !React89__default.isValidElement(node) && !(node instanceof Date)) {
55428
55556
  return convertObjectProps(node);
55429
55557
  }
55430
55558
  return node;
@@ -57250,7 +57378,7 @@ function buildMockData(schema) {
57250
57378
  perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
57251
57379
  return result;
57252
57380
  }
57253
- function isInlineTrait2(traitRef) {
57381
+ function isInlineTrait3(traitRef) {
57254
57382
  return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
57255
57383
  }
57256
57384
  function findDataState(sm, initialStateName) {
@@ -57282,7 +57410,7 @@ function adjustSchemaForMockData(schema, mockData) {
57282
57410
  const updatedOrbitals = schema.orbitals.map((orbital) => {
57283
57411
  const traits2 = orbital.traits ?? [];
57284
57412
  const updatedTraits = traits2.map((traitRef) => {
57285
- if (!isInlineTrait2(traitRef)) return traitRef;
57413
+ if (!isInlineTrait3(traitRef)) return traitRef;
57286
57414
  const updated = rewriteTraitInitialState(traitRef, mockData);
57287
57415
  if (updated !== traitRef) changed = true;
57288
57416
  return updated;