@almadar/ui 5.70.0 → 5.72.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 (63) hide show
  1. package/dist/avl/index.cjs +2198 -2218
  2. package/dist/avl/index.d.cts +93 -56
  3. package/dist/avl/index.js +931 -951
  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 -3
  34. package/dist/components/game/atoms/Sprite.d.ts +6 -1
  35. package/dist/components/game/atoms/XPBar.d.ts +1 -1
  36. package/dist/components/game/molecules/GameCanvas3D.d.ts +0 -2
  37. package/dist/components/game/molecules/IsometricCanvas.d.ts +4 -2
  38. package/dist/components/game/molecules/PlatformerCanvas.d.ts +4 -1
  39. package/dist/components/game/molecules/StatBadge.d.ts +3 -1
  40. package/dist/components/game/molecules/three/hooks/useSceneGraph.d.ts +2 -1
  41. package/dist/components/game/molecules/three/index.cjs +41 -105
  42. package/dist/components/game/molecules/three/index.js +41 -105
  43. package/dist/components/game/molecules/useUnitSpriteAtlas.d.ts +3 -2
  44. package/dist/components/game/organisms/PinballBoard.d.ts +4 -4
  45. package/dist/components/game/organisms/boardEntity.d.ts +6 -6
  46. package/dist/components/game/organisms/puzzles/debugger/DebuggerBoard.d.ts +16 -2
  47. package/dist/components/game/organisms/puzzles/event-handler/puzzleObject.d.ts +21 -10
  48. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +2 -1
  49. package/dist/components/game/organisms/types/isometric.d.ts +16 -0
  50. package/dist/components/index.cjs +2228 -2251
  51. package/dist/components/index.js +1116 -1139
  52. package/dist/docs/index.cjs +107 -104
  53. package/dist/docs/index.d.cts +2 -0
  54. package/dist/docs/index.js +38 -35
  55. package/dist/lib/getNestedValue.d.ts +2 -13
  56. package/dist/marketing/index.cjs +97 -98
  57. package/dist/marketing/index.d.cts +2 -0
  58. package/dist/marketing/index.js +54 -55
  59. package/dist/providers/index.cjs +1908 -1951
  60. package/dist/providers/index.js +808 -851
  61. package/dist/runtime/index.cjs +1966 -2009
  62. package/dist/runtime/index.js +814 -857
  63. package/package.json +1 -1
package/dist/avl/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React94 from 'react';
3
- import React94__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
2
+ import * as React96 from 'react';
3
+ import React96__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
4
4
  import { OrbitalProvider, EventBusContext, useTraitScope, VerificationProvider, TraitScopeProvider } from '@almadar/ui/providers';
5
5
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
@@ -3181,9 +3181,8 @@ var init_Typography = __esm({
3181
3181
  }) => {
3182
3182
  const variant = variantProp ?? (level ? `h${level}` : "body1");
3183
3183
  const Component2 = as || defaultElements[variant];
3184
- const Comp = Component2;
3185
- return /* @__PURE__ */ jsx(
3186
- Comp,
3184
+ return React96__default.createElement(
3185
+ Component2,
3187
3186
  {
3188
3187
  id,
3189
3188
  className: cn(
@@ -3196,9 +3195,9 @@ var init_Typography = __esm({
3196
3195
  overflow && overflowStyles[overflow],
3197
3196
  className
3198
3197
  ),
3199
- style,
3200
- children: children ?? content
3201
- }
3198
+ style
3199
+ },
3200
+ children ?? content
3202
3201
  );
3203
3202
  };
3204
3203
  Typography.displayName = "Typography";
@@ -3519,7 +3518,7 @@ var init_Box = __esm({
3519
3518
  fixed: "fixed",
3520
3519
  sticky: "sticky"
3521
3520
  };
3522
- Box = React94__default.forwardRef(
3521
+ Box = React96__default.forwardRef(
3523
3522
  ({
3524
3523
  padding,
3525
3524
  paddingX,
@@ -3584,7 +3583,7 @@ var init_Box = __esm({
3584
3583
  onPointerDown?.(e);
3585
3584
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3586
3585
  const isClickable = action || onClick;
3587
- return React94__default.createElement(
3586
+ return React96__default.createElement(
3588
3587
  Component2,
3589
3588
  {
3590
3589
  ref,
@@ -3680,9 +3679,8 @@ var init_Stack = __esm({
3680
3679
  };
3681
3680
  const isHorizontal = direction === "horizontal";
3682
3681
  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";
3683
- const Comp = Component2;
3684
- return /* @__PURE__ */ jsx(
3685
- Comp,
3682
+ return React96__default.createElement(
3683
+ Component2,
3686
3684
  {
3687
3685
  className: cn(
3688
3686
  "flex",
@@ -3698,9 +3696,9 @@ var init_Stack = __esm({
3698
3696
  onClick: action || onClick ? handleClick : void 0,
3699
3697
  onKeyDown,
3700
3698
  role,
3701
- tabIndex,
3702
- children
3703
- }
3699
+ tabIndex
3700
+ },
3701
+ children
3704
3702
  );
3705
3703
  };
3706
3704
  VStack = (props) => /* @__PURE__ */ jsx(Stack, { direction: "vertical", ...props });
@@ -4078,9 +4076,9 @@ async function computeTraitLayout(data) {
4078
4076
  y: n.y ?? 0,
4079
4077
  width: n.width ?? 110,
4080
4078
  height: n.height ?? STATE_H,
4081
- isInitial: stateInfo?.isInitial,
4082
- isTerminal: stateInfo?.isTerminal,
4083
- role: getStateRole(name, stateInfo?.isInitial, stateInfo?.isTerminal, tc, maxTC),
4079
+ isInitial: stateInfo?.isInitial ?? void 0,
4080
+ isTerminal: stateInfo?.isTerminal ?? void 0,
4081
+ role: getStateRole(name, stateInfo?.isInitial ?? void 0, stateInfo?.isTerminal ?? void 0, tc, maxTC),
4084
4082
  transitionCount: tc
4085
4083
  };
4086
4084
  });
@@ -4091,12 +4089,10 @@ async function computeTraitLayout(data) {
4091
4089
  const sections = e.sections ?? [];
4092
4090
  const points = [];
4093
4091
  for (const section of sections) {
4094
- const startPoint = section.startPoint;
4095
- const endPoint = section.endPoint;
4096
4092
  const bendPoints = section.bendPoints ?? [];
4097
- points.push({ x: startPoint.x, y: startPoint.y });
4093
+ points.push({ x: section.startPoint.x, y: section.startPoint.y });
4098
4094
  for (const bp of bendPoints) points.push({ x: bp.x, y: bp.y });
4099
- points.push({ x: endPoint.x, y: endPoint.y });
4095
+ points.push({ x: section.endPoint.x, y: section.endPoint.y });
4100
4096
  }
4101
4097
  const isSelf = t.from === t.to;
4102
4098
  const isBackward = !isSelf && (nodeXMap[t.to] ?? 0) <= (nodeXMap[t.from] ?? 0);
@@ -4174,8 +4170,8 @@ var init_MiniStateMachine = __esm({
4174
4170
  states.map((s, i) => {
4175
4171
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4176
4172
  const tc = transitionCounts[s.name] ?? 0;
4177
- const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
4178
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
4173
+ const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
4174
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
4179
4175
  /* @__PURE__ */ jsx(
4180
4176
  AvlState,
4181
4177
  {
@@ -4185,8 +4181,8 @@ var init_MiniStateMachine = __esm({
4185
4181
  height: NODE_H,
4186
4182
  name: "",
4187
4183
  role,
4188
- isInitial: s.isInitial,
4189
- isTerminal: s.isTerminal
4184
+ isInitial: s.isInitial ?? void 0,
4185
+ isTerminal: s.isTerminal ?? void 0
4190
4186
  }
4191
4187
  ),
4192
4188
  i < states.length - 1 && /* @__PURE__ */ jsxs("g", { children: [
@@ -4550,7 +4546,7 @@ function loadLib(key, importer) {
4550
4546
  return p2;
4551
4547
  }
4552
4548
  function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4553
- const Lazy = React94__default.lazy(async () => {
4549
+ const Lazy = React96__default.lazy(async () => {
4554
4550
  const lib = await loadLib(libKey, importer);
4555
4551
  const Comp = pick(lib);
4556
4552
  if (!Comp) {
@@ -4560,7 +4556,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4560
4556
  return { default: Comp };
4561
4557
  });
4562
4558
  const Wrapped = (props) => /* @__PURE__ */ jsx(
4563
- React94__default.Suspense,
4559
+ React96__default.Suspense,
4564
4560
  {
4565
4561
  fallback: /* @__PURE__ */ jsx(
4566
4562
  "span",
@@ -5228,9 +5224,10 @@ function resolveIcon(name) {
5228
5224
  function doResolve(name) {
5229
5225
  if (iconAliases[name]) return iconAliases[name];
5230
5226
  const pascalName = kebabToPascal2(name);
5231
- const directLookup = LucideIcons2[pascalName];
5227
+ const lucideMap = LucideIcons2;
5228
+ const directLookup = lucideMap[pascalName];
5232
5229
  if (directLookup && typeof directLookup === "object") return directLookup;
5233
- const asIs = LucideIcons2[name];
5230
+ const asIs = lucideMap[name];
5234
5231
  if (asIs && typeof asIs === "object") return asIs;
5235
5232
  return LucideIcons2.HelpCircle;
5236
5233
  }
@@ -5286,7 +5283,7 @@ var init_Icon = __esm({
5286
5283
  const directIcon = typeof icon === "string" ? void 0 : icon;
5287
5284
  const effectiveName = typeof icon === "string" ? icon : name;
5288
5285
  const family = useIconFamily();
5289
- const RenderedComponent = React94__default.useMemo(() => {
5286
+ const RenderedComponent = React96__default.useMemo(() => {
5290
5287
  if (directIcon) return null;
5291
5288
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
5292
5289
  }, [directIcon, effectiveName, family]);
@@ -5336,6 +5333,9 @@ var init_Icon = __esm({
5336
5333
  Icon.displayName = "Icon";
5337
5334
  }
5338
5335
  });
5336
+ function isIconLike(v) {
5337
+ return typeof v.render === "function";
5338
+ }
5339
5339
  function resolveIconProp(value, sizeClass) {
5340
5340
  if (!value) return null;
5341
5341
  if (typeof value === "string") {
@@ -5345,10 +5345,10 @@ function resolveIconProp(value, sizeClass) {
5345
5345
  const IconComp = value;
5346
5346
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5347
5347
  }
5348
- if (React94__default.isValidElement(value)) {
5348
+ if (React96__default.isValidElement(value)) {
5349
5349
  return value;
5350
5350
  }
5351
- if (typeof value === "object" && value !== null && "render" in value) {
5351
+ if (typeof value === "object" && value !== null && isIconLike(value)) {
5352
5352
  const IconComp = value;
5353
5353
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5354
5354
  }
@@ -5421,7 +5421,7 @@ var init_Button = __esm({
5421
5421
  md: "h-icon-default w-icon-default",
5422
5422
  lg: "h-icon-default w-icon-default"
5423
5423
  };
5424
- Button = React94__default.forwardRef(
5424
+ Button = React96__default.forwardRef(
5425
5425
  ({
5426
5426
  className,
5427
5427
  variant = "primary",
@@ -5437,6 +5437,7 @@ var init_Button = __esm({
5437
5437
  label,
5438
5438
  children,
5439
5439
  onClick,
5440
+ "data-testid": dataTestId,
5440
5441
  ...props
5441
5442
  }, ref) => {
5442
5443
  const eventBus = useEventBus();
@@ -5469,7 +5470,7 @@ var init_Button = __esm({
5469
5470
  ),
5470
5471
  onClick: handleClick,
5471
5472
  ...props,
5472
- "data-testid": props["data-testid"] ?? (action ? `action-${action}` : void 0),
5473
+ "data-testid": dataTestId ?? (action ? `action-${action}` : void 0),
5473
5474
  children: [
5474
5475
  isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-icon-default w-icon-default animate-spin" }) : resolvedLeftIcon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: resolvedLeftIcon }),
5475
5476
  children || label,
@@ -5486,7 +5487,7 @@ var Dialog;
5486
5487
  var init_Dialog = __esm({
5487
5488
  "components/core/atoms/Dialog.tsx"() {
5488
5489
  init_cn();
5489
- Dialog = React94__default.forwardRef(
5490
+ Dialog = React96__default.forwardRef(
5490
5491
  ({
5491
5492
  role = "dialog",
5492
5493
  "aria-modal": ariaModal = true,
@@ -5981,7 +5982,7 @@ var init_Badge = __esm({
5981
5982
  md: "px-2.5 py-1 text-sm",
5982
5983
  lg: "px-3 py-1.5 text-base"
5983
5984
  };
5984
- Badge = React94__default.forwardRef(
5985
+ Badge = React96__default.forwardRef(
5985
5986
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
5986
5987
  const iconSizes3 = {
5987
5988
  sm: "h-icon-default w-icon-default",
@@ -6317,7 +6318,7 @@ var init_SvgFlow = __esm({
6317
6318
  width = 100,
6318
6319
  height = 100
6319
6320
  }) => {
6320
- const markerId = React94__default.useMemo(() => {
6321
+ const markerId = React96__default.useMemo(() => {
6321
6322
  flowIdCounter += 1;
6322
6323
  return `almadar-flow-arrow-${flowIdCounter}`;
6323
6324
  }, []);
@@ -6910,7 +6911,7 @@ var init_SvgRing = __esm({
6910
6911
  width = 100,
6911
6912
  height = 100
6912
6913
  }) => {
6913
- const gradientId = React94__default.useMemo(() => {
6914
+ const gradientId = React96__default.useMemo(() => {
6914
6915
  ringIdCounter += 1;
6915
6916
  return `almadar-ring-glow-${ringIdCounter}`;
6916
6917
  }, []);
@@ -7091,7 +7092,7 @@ var init_Input = __esm({
7091
7092
  init_cn();
7092
7093
  init_Icon();
7093
7094
  init_useEventBus();
7094
- Input = React94__default.forwardRef(
7095
+ Input = React96__default.forwardRef(
7095
7096
  ({
7096
7097
  className,
7097
7098
  inputType,
@@ -7251,7 +7252,7 @@ var Label;
7251
7252
  var init_Label = __esm({
7252
7253
  "components/core/atoms/Label.tsx"() {
7253
7254
  init_cn();
7254
- Label = React94__default.forwardRef(
7255
+ Label = React96__default.forwardRef(
7255
7256
  ({ className, required, children, ...props }, ref) => {
7256
7257
  return /* @__PURE__ */ jsxs(
7257
7258
  "label",
@@ -7278,7 +7279,7 @@ var init_Textarea = __esm({
7278
7279
  "components/core/atoms/Textarea.tsx"() {
7279
7280
  init_cn();
7280
7281
  init_useEventBus();
7281
- Textarea = React94__default.forwardRef(
7282
+ Textarea = React96__default.forwardRef(
7282
7283
  ({ className, error, onChange, ...props }, ref) => {
7283
7284
  const eventBus = useEventBus();
7284
7285
  const handleChange = (e) => {
@@ -7517,7 +7518,7 @@ var init_Select = __esm({
7517
7518
  init_cn();
7518
7519
  init_Icon();
7519
7520
  init_useEventBus();
7520
- Select = React94__default.forwardRef(
7521
+ Select = React96__default.forwardRef(
7521
7522
  (props, _ref) => {
7522
7523
  const { multiple, searchable, clearable } = props;
7523
7524
  if (multiple || searchable || clearable) {
@@ -7534,7 +7535,7 @@ var init_Checkbox = __esm({
7534
7535
  "components/core/atoms/Checkbox.tsx"() {
7535
7536
  init_cn();
7536
7537
  init_useEventBus();
7537
- Checkbox = React94__default.forwardRef(
7538
+ Checkbox = React96__default.forwardRef(
7538
7539
  ({ className, label, id, onChange, ...props }, ref) => {
7539
7540
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7540
7541
  const eventBus = useEventBus();
@@ -7588,7 +7589,7 @@ var init_Spinner = __esm({
7588
7589
  md: "h-6 w-6",
7589
7590
  lg: "h-8 w-8"
7590
7591
  };
7591
- Spinner = React94__default.forwardRef(
7592
+ Spinner = React96__default.forwardRef(
7592
7593
  ({ className, size = "md", overlay, ...props }, ref) => {
7593
7594
  if (overlay) {
7594
7595
  return /* @__PURE__ */ jsx(
@@ -7678,7 +7679,7 @@ var init_Card = __esm({
7678
7679
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7679
7680
  "tile-image-first": "p-0 overflow-hidden"
7680
7681
  };
7681
- Card = React94__default.forwardRef(
7682
+ Card = React96__default.forwardRef(
7682
7683
  ({
7683
7684
  className,
7684
7685
  variant = "bordered",
@@ -7726,9 +7727,9 @@ var init_Card = __esm({
7726
7727
  }
7727
7728
  );
7728
7729
  Card.displayName = "Card";
7729
- CardHeader = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7730
+ CardHeader = React96__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7730
7731
  CardHeader.displayName = "CardHeader";
7731
- CardTitle = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7732
+ CardTitle = React96__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7732
7733
  "h3",
7733
7734
  {
7734
7735
  ref,
@@ -7741,11 +7742,11 @@ var init_Card = __esm({
7741
7742
  }
7742
7743
  ));
7743
7744
  CardTitle.displayName = "CardTitle";
7744
- CardContent = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7745
+ CardContent = React96__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7745
7746
  CardContent.displayName = "CardContent";
7746
7747
  CardBody = CardContent;
7747
7748
  CardBody.displayName = "CardBody";
7748
- CardFooter = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7749
+ CardFooter = React96__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7749
7750
  "div",
7750
7751
  {
7751
7752
  ref,
@@ -7800,7 +7801,7 @@ var init_FilterPill = __esm({
7800
7801
  md: "w-3.5 h-3.5",
7801
7802
  lg: "w-4 h-4"
7802
7803
  };
7803
- FilterPill = React94__default.forwardRef(
7804
+ FilterPill = React96__default.forwardRef(
7804
7805
  ({
7805
7806
  className,
7806
7807
  variant = "default",
@@ -7929,8 +7930,8 @@ var init_Avatar = __esm({
7929
7930
  actionPayload
7930
7931
  }) => {
7931
7932
  const eventBus = useEventBus();
7932
- const [imgFailed, setImgFailed] = React94__default.useState(false);
7933
- React94__default.useEffect(() => {
7933
+ const [imgFailed, setImgFailed] = React96__default.useState(false);
7934
+ React96__default.useEffect(() => {
7934
7935
  setImgFailed(false);
7935
7936
  }, [src]);
7936
7937
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -8043,22 +8044,18 @@ var init_Center = __esm({
8043
8044
  as: Component2 = "div"
8044
8045
  }) => {
8045
8046
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
8046
- const Comp = Component2;
8047
- return /* @__PURE__ */ jsx(
8048
- Comp,
8049
- {
8050
- className: cn(
8051
- inline ? "inline-flex" : "flex",
8052
- horizontal && "justify-center",
8053
- vertical && "items-center",
8054
- fullHeight && "h-full",
8055
- fullWidth && "w-full",
8056
- className
8057
- ),
8058
- style: mergedStyle,
8059
- children
8060
- }
8061
- );
8047
+ return React96__default.createElement(Component2, {
8048
+ className: cn(
8049
+ inline ? "inline-flex" : "flex",
8050
+ horizontal && "justify-center",
8051
+ vertical && "items-center",
8052
+ fullHeight && "h-full",
8053
+ fullWidth && "w-full",
8054
+ className
8055
+ ),
8056
+ style: mergedStyle,
8057
+ children
8058
+ });
8062
8059
  };
8063
8060
  }
8064
8061
  });
@@ -8315,7 +8312,7 @@ var init_Radio = __esm({
8315
8312
  md: "w-2.5 h-2.5",
8316
8313
  lg: "w-3 h-3"
8317
8314
  };
8318
- Radio = React94__default.forwardRef(
8315
+ Radio = React96__default.forwardRef(
8319
8316
  ({
8320
8317
  label,
8321
8318
  helperText,
@@ -8332,12 +8329,12 @@ var init_Radio = __esm({
8332
8329
  onChange,
8333
8330
  ...props
8334
8331
  }, ref) => {
8335
- const reactId = React94__default.useId();
8332
+ const reactId = React96__default.useId();
8336
8333
  const baseId = id || `radio-${reactId}`;
8337
8334
  const hasError = !!error;
8338
8335
  const eventBus = useEventBus();
8339
- const [selected, setSelected] = React94__default.useState(value);
8340
- React94__default.useEffect(() => {
8336
+ const [selected, setSelected] = React96__default.useState(value);
8337
+ React96__default.useEffect(() => {
8341
8338
  if (value !== void 0) setSelected(value);
8342
8339
  }, [value]);
8343
8340
  const pick = (next, e) => {
@@ -8519,7 +8516,7 @@ var init_Switch = __esm({
8519
8516
  "components/core/atoms/Switch.tsx"() {
8520
8517
  "use client";
8521
8518
  init_cn();
8522
- Switch = React94.forwardRef(
8519
+ Switch = React96.forwardRef(
8523
8520
  ({
8524
8521
  checked,
8525
8522
  defaultChecked = false,
@@ -8530,10 +8527,10 @@ var init_Switch = __esm({
8530
8527
  name,
8531
8528
  className
8532
8529
  }, ref) => {
8533
- const [isChecked, setIsChecked] = React94.useState(
8530
+ const [isChecked, setIsChecked] = React96.useState(
8534
8531
  checked !== void 0 ? checked : defaultChecked
8535
8532
  );
8536
- React94.useEffect(() => {
8533
+ React96.useEffect(() => {
8537
8534
  if (checked !== void 0) {
8538
8535
  setIsChecked(checked);
8539
8536
  }
@@ -8807,7 +8804,7 @@ var Aside;
8807
8804
  var init_Aside = __esm({
8808
8805
  "components/core/atoms/Aside.tsx"() {
8809
8806
  init_cn();
8810
- Aside = React94__default.forwardRef(
8807
+ Aside = React96__default.forwardRef(
8811
8808
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8812
8809
  );
8813
8810
  Aside.displayName = "Aside";
@@ -8886,9 +8883,9 @@ var init_LawReferenceTooltip = __esm({
8886
8883
  className
8887
8884
  }) => {
8888
8885
  const { t } = useTranslate();
8889
- const [isVisible, setIsVisible] = React94__default.useState(false);
8890
- const timeoutRef = React94__default.useRef(null);
8891
- const triggerRef = React94__default.useRef(null);
8886
+ const [isVisible, setIsVisible] = React96__default.useState(false);
8887
+ const timeoutRef = React96__default.useRef(null);
8888
+ const triggerRef = React96__default.useRef(null);
8892
8889
  const handleMouseEnter = () => {
8893
8890
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8894
8891
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8899,7 +8896,7 @@ var init_LawReferenceTooltip = __esm({
8899
8896
  };
8900
8897
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
8901
8898
  const open = isVisible || revealed;
8902
- React94__default.useEffect(() => {
8899
+ React96__default.useEffect(() => {
8903
8900
  return () => {
8904
8901
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8905
8902
  };
@@ -9111,7 +9108,7 @@ var init_StatusDot = __esm({
9111
9108
  md: "w-2.5 h-2.5",
9112
9109
  lg: "w-3 h-3"
9113
9110
  };
9114
- StatusDot = React94__default.forwardRef(
9111
+ StatusDot = React96__default.forwardRef(
9115
9112
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
9116
9113
  return /* @__PURE__ */ jsx(
9117
9114
  "span",
@@ -9165,7 +9162,7 @@ var init_TrendIndicator = __esm({
9165
9162
  down: "trending-down",
9166
9163
  flat: "arrow-right"
9167
9164
  };
9168
- TrendIndicator = React94__default.forwardRef(
9165
+ TrendIndicator = React96__default.forwardRef(
9169
9166
  ({
9170
9167
  className,
9171
9168
  value,
@@ -9232,7 +9229,7 @@ var init_RangeSlider = __esm({
9232
9229
  md: "w-4 h-4",
9233
9230
  lg: "w-5 h-5"
9234
9231
  };
9235
- RangeSlider = React94__default.forwardRef(
9232
+ RangeSlider = React96__default.forwardRef(
9236
9233
  ({
9237
9234
  className,
9238
9235
  min = 0,
@@ -9740,7 +9737,7 @@ var init_ContentSection = __esm({
9740
9737
  md: "py-16",
9741
9738
  lg: "py-24"
9742
9739
  };
9743
- ContentSection = React94__default.forwardRef(
9740
+ ContentSection = React96__default.forwardRef(
9744
9741
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9745
9742
  return /* @__PURE__ */ jsx(
9746
9743
  Box,
@@ -10274,7 +10271,7 @@ var init_AnimatedReveal = __esm({
10274
10271
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10275
10272
  "none": {}
10276
10273
  };
10277
- AnimatedReveal = React94__default.forwardRef(
10274
+ AnimatedReveal = React96__default.forwardRef(
10278
10275
  ({
10279
10276
  trigger = "scroll",
10280
10277
  animation = "fade-up",
@@ -10434,7 +10431,7 @@ var init_AnimatedGraphic = __esm({
10434
10431
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10435
10432
  "use client";
10436
10433
  init_cn();
10437
- AnimatedGraphic = React94__default.forwardRef(
10434
+ AnimatedGraphic = React96__default.forwardRef(
10438
10435
  ({
10439
10436
  src,
10440
10437
  svgContent,
@@ -10457,7 +10454,7 @@ var init_AnimatedGraphic = __esm({
10457
10454
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10458
10455
  const resolvedSvg = svgContent ?? fetchedSvg;
10459
10456
  const prevAnimateRef = useRef(animate);
10460
- const setRef = React94__default.useCallback(
10457
+ const setRef = React96__default.useCallback(
10461
10458
  (node) => {
10462
10459
  containerRef.current = node;
10463
10460
  if (typeof ref === "function") ref(node);
@@ -10674,48 +10671,21 @@ var init_HealthBar = __esm({
10674
10671
  function ScoreDisplay({
10675
10672
  assetUrl = DEFAULT_ASSET_URL,
10676
10673
  value,
10674
+ score,
10677
10675
  label,
10678
10676
  icon,
10679
10677
  size = "md",
10680
10678
  className,
10681
- animated = true,
10682
- locale = "en-US",
10683
- ...rest
10679
+ locale = "en-US"
10684
10680
  }) {
10685
- const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
10686
- const [displayValue, setDisplayValue] = React94.useState(resolvedValue);
10687
- const [isAnimating, setIsAnimating] = React94.useState(false);
10688
- React94.useEffect(() => {
10689
- if (!animated || displayValue === resolvedValue) {
10690
- setDisplayValue(resolvedValue);
10691
- return;
10692
- }
10693
- setIsAnimating(true);
10694
- const diff = resolvedValue - displayValue;
10695
- const steps = Math.min(Math.abs(diff), 20);
10696
- const increment = diff / steps;
10697
- let current = displayValue;
10698
- let step = 0;
10699
- const timer = setInterval(() => {
10700
- step++;
10701
- current += increment;
10702
- setDisplayValue(Math.round(current));
10703
- if (step >= steps) {
10704
- clearInterval(timer);
10705
- setDisplayValue(resolvedValue);
10706
- setIsAnimating(false);
10707
- }
10708
- }, 50);
10709
- return () => clearInterval(timer);
10710
- }, [resolvedValue, animated]);
10711
- const formattedValue = new Intl.NumberFormat(locale).format(displayValue);
10681
+ const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof score === "number" && !Number.isNaN(score) ? score : 0;
10682
+ const formattedValue = new Intl.NumberFormat(locale).format(resolvedValue);
10712
10683
  return /* @__PURE__ */ jsxs(
10713
10684
  "div",
10714
10685
  {
10715
10686
  className: cn(
10716
10687
  "flex items-center gap-2 font-bold",
10717
10688
  sizeMap2[size],
10718
- isAnimating && "animate-pulse",
10719
10689
  className
10720
10690
  ),
10721
10691
  children: [
@@ -10739,7 +10709,6 @@ function ScoreDisplay({
10739
10709
  var sizeMap2, DEFAULT_ASSET_URL;
10740
10710
  var init_ScoreDisplay = __esm({
10741
10711
  "components/game/atoms/ScoreDisplay.tsx"() {
10742
- "use client";
10743
10712
  init_cn();
10744
10713
  init_Icon();
10745
10714
  sizeMap2 = {
@@ -10768,9 +10737,9 @@ function ControlButton({
10768
10737
  className
10769
10738
  }) {
10770
10739
  const eventBus = useEventBus();
10771
- const [isPressed, setIsPressed] = React94.useState(false);
10740
+ const [isPressed, setIsPressed] = React96.useState(false);
10772
10741
  const actualPressed = pressed ?? isPressed;
10773
- const handlePointerDown = React94.useCallback(
10742
+ const handlePointerDown = React96.useCallback(
10774
10743
  (e) => {
10775
10744
  e.preventDefault();
10776
10745
  if (disabled) return;
@@ -10780,7 +10749,7 @@ function ControlButton({
10780
10749
  },
10781
10750
  [disabled, pressEvent, eventBus, onPress]
10782
10751
  );
10783
- const handlePointerUp = React94.useCallback(
10752
+ const handlePointerUp = React96.useCallback(
10784
10753
  (e) => {
10785
10754
  e.preventDefault();
10786
10755
  if (disabled) return;
@@ -10790,7 +10759,7 @@ function ControlButton({
10790
10759
  },
10791
10760
  [disabled, releaseEvent, eventBus, onRelease]
10792
10761
  );
10793
- const handlePointerLeave = React94.useCallback(
10762
+ const handlePointerLeave = React96.useCallback(
10794
10763
  (e) => {
10795
10764
  if (isPressed) {
10796
10765
  setIsPressed(false);
@@ -10878,13 +10847,6 @@ var init_spriteSheetConstants = __esm({
10878
10847
  });
10879
10848
 
10880
10849
  // components/game/organisms/utils/spriteAnimation.ts
10881
- function inferDirection(dx, dy) {
10882
- if (dx === 0 && dy === 0) return "se";
10883
- if (dx >= 0 && dy >= 0) return "se";
10884
- if (dx <= 0 && dy >= 0) return "sw";
10885
- if (dx >= 0 && dy <= 0) return "ne";
10886
- return "nw";
10887
- }
10888
10850
  function resolveSheetDirection(facing) {
10889
10851
  switch (facing) {
10890
10852
  case "se":
@@ -10905,19 +10867,6 @@ function frameRect(frame, row, columns, frameWidth, frameHeight) {
10905
10867
  sh: frameHeight
10906
10868
  };
10907
10869
  }
10908
- function getCurrentFrameFromDef(def, elapsed) {
10909
- const frameDuration = 1e3 / def.frameRate;
10910
- const totalDuration = def.frames * frameDuration;
10911
- if (def.loop) {
10912
- const frame2 = Math.floor(elapsed % totalDuration / frameDuration);
10913
- return { frame: frame2, finished: false };
10914
- }
10915
- if (elapsed >= totalDuration) {
10916
- return { frame: def.frames - 1, finished: true };
10917
- }
10918
- const frame = Math.floor(elapsed / frameDuration);
10919
- return { frame, finished: false };
10920
- }
10921
10870
  var init_spriteAnimation = __esm({
10922
10871
  "components/game/organisms/utils/spriteAnimation.ts"() {
10923
10872
  }
@@ -10936,6 +10885,8 @@ function Sprite({
10936
10885
  opacity = 1,
10937
10886
  zIndex = 0,
10938
10887
  columns = 16,
10888
+ animState: _animState,
10889
+ frameRate: _frameRate,
10939
10890
  className,
10940
10891
  onClick,
10941
10892
  action
@@ -11419,21 +11370,6 @@ function XPBar({
11419
11370
  }) {
11420
11371
  const sizes = sizeMap9[size];
11421
11372
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
11422
- const [fillWidth, setFillWidth] = React94.useState(animated ? 0 : percentage);
11423
- React94.useEffect(() => {
11424
- if (!animated) {
11425
- setFillWidth(percentage);
11426
- return;
11427
- }
11428
- let frame2;
11429
- const frame1 = requestAnimationFrame(() => {
11430
- frame2 = requestAnimationFrame(() => setFillWidth(percentage));
11431
- });
11432
- return () => {
11433
- cancelAnimationFrame(frame1);
11434
- cancelAnimationFrame(frame2);
11435
- };
11436
- }, [animated, percentage]);
11437
11373
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
11438
11374
  level != null && /* @__PURE__ */ jsxs(
11439
11375
  "span",
@@ -11465,7 +11401,7 @@ function XPBar({
11465
11401
  "bg-gradient-to-r from-accent to-info",
11466
11402
  animated && "transition-all duration-500 ease-out"
11467
11403
  ),
11468
- style: { width: `${fillWidth}%` }
11404
+ style: { width: `${percentage}%` }
11469
11405
  }
11470
11406
  )
11471
11407
  }
@@ -11482,7 +11418,6 @@ function XPBar({
11482
11418
  var sizeMap9;
11483
11419
  var init_XPBar = __esm({
11484
11420
  "components/game/atoms/XPBar.tsx"() {
11485
- "use client";
11486
11421
  init_cn();
11487
11422
  sizeMap9 = {
11488
11423
  sm: { bar: "h-2", text: "text-xs", badge: "text-xs px-1.5 py-0.5" },
@@ -11928,9 +11863,9 @@ function MiniMap({
11928
11863
  viewportRect = DEFAULT_VIEWPORT,
11929
11864
  className
11930
11865
  }) {
11931
- const canvasRef = React94.useRef(null);
11932
- const frameRef = React94.useRef(0);
11933
- React94.useEffect(() => {
11866
+ const canvasRef = React96.useRef(null);
11867
+ const frameRef = React96.useRef(0);
11868
+ React96.useEffect(() => {
11934
11869
  const canvas = canvasRef.current;
11935
11870
  if (!canvas) return;
11936
11871
  const ctx = canvas.getContext("2d");
@@ -12119,7 +12054,7 @@ var init_ErrorBoundary = __esm({
12119
12054
  }
12120
12055
  );
12121
12056
  };
12122
- ErrorBoundary = class extends React94__default.Component {
12057
+ ErrorBoundary = class extends React96__default.Component {
12123
12058
  constructor(props) {
12124
12059
  super(props);
12125
12060
  __publicField(this, "reset", () => {
@@ -12430,9 +12365,8 @@ var init_Container = __esm({
12430
12365
  as: Component2 = "div"
12431
12366
  }) => {
12432
12367
  const resolvedSize = maxWidth ?? size ?? "lg";
12433
- const Comp = Component2;
12434
- return /* @__PURE__ */ jsx(
12435
- Comp,
12368
+ return React96__default.createElement(
12369
+ Component2,
12436
12370
  {
12437
12371
  className: cn(
12438
12372
  "w-full",
@@ -12440,9 +12374,9 @@ var init_Container = __esm({
12440
12374
  paddingStyles3[padding],
12441
12375
  center && "mx-auto",
12442
12376
  className
12443
- ),
12444
- children
12445
- }
12377
+ )
12378
+ },
12379
+ children
12446
12380
  );
12447
12381
  };
12448
12382
  Container.displayName = "Container";
@@ -13154,8 +13088,8 @@ function ActionButtons({
13154
13088
  disabled
13155
13089
  }) {
13156
13090
  const eventBus = useEventBus();
13157
- const [activeButtons, setActiveButtons] = React94.useState(/* @__PURE__ */ new Set());
13158
- const handlePress = React94.useCallback(
13091
+ const [activeButtons, setActiveButtons] = React96.useState(/* @__PURE__ */ new Set());
13092
+ const handlePress = React96.useCallback(
13159
13093
  (id) => {
13160
13094
  setActiveButtons((prev) => new Set(prev).add(id));
13161
13095
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -13163,7 +13097,7 @@ function ActionButtons({
13163
13097
  },
13164
13098
  [actionEvent, eventBus, onAction]
13165
13099
  );
13166
- const handleRelease = React94.useCallback(
13100
+ const handleRelease = React96.useCallback(
13167
13101
  (id) => {
13168
13102
  setActiveButtons((prev) => {
13169
13103
  const next = new Set(prev);
@@ -13993,50 +13927,6 @@ var init_AuthLayout = __esm({
13993
13927
  AuthLayout.displayName = "AuthLayout";
13994
13928
  }
13995
13929
  });
13996
- var LoadingState;
13997
- var init_LoadingState = __esm({
13998
- "components/core/molecules/LoadingState.tsx"() {
13999
- "use client";
14000
- init_cn();
14001
- init_atoms2();
14002
- init_Stack();
14003
- init_Typography();
14004
- LoadingState = ({
14005
- title,
14006
- message,
14007
- className
14008
- }) => {
14009
- const { t } = useTranslate();
14010
- const displayMessage = message ?? t("common.loading");
14011
- return /* @__PURE__ */ jsxs(
14012
- VStack,
14013
- {
14014
- align: "center",
14015
- className: cn(
14016
- "justify-center py-12",
14017
- className
14018
- ),
14019
- children: [
14020
- /* @__PURE__ */ jsx(Spinner, { size: "lg" }),
14021
- title && /* @__PURE__ */ jsx(Typography, { variant: "h3", className: "mt-4 text-lg font-semibold text-foreground", children: title }),
14022
- /* @__PURE__ */ jsx(
14023
- Typography,
14024
- {
14025
- variant: "small",
14026
- className: cn(
14027
- "text-muted-foreground",
14028
- title ? "mt-2" : "mt-4"
14029
- ),
14030
- children: displayMessage
14031
- }
14032
- )
14033
- ]
14034
- }
14035
- );
14036
- };
14037
- LoadingState.displayName = "LoadingState";
14038
- }
14039
- });
14040
13930
  function getState() {
14041
13931
  if (typeof window !== "undefined") {
14042
13932
  const w = window;
@@ -14566,9 +14456,6 @@ function useUnitSpriteAtlas(units) {
14566
14456
  const loadingRef = useRef(/* @__PURE__ */ new Set());
14567
14457
  const [pendingCount, setPendingCount] = useState(0);
14568
14458
  const [, forceTick] = useState(0);
14569
- const animStatesRef = useRef(/* @__PURE__ */ new Map());
14570
- const lastTickRef = useRef(0);
14571
- const rafRef = useRef(0);
14572
14459
  const atlasUrls = useMemo(() => {
14573
14460
  const set = /* @__PURE__ */ new Set();
14574
14461
  for (const unit of units) {
@@ -14614,54 +14501,6 @@ function useUnitSpriteAtlas(units) {
14614
14501
  }
14615
14502
  return [...urls];
14616
14503
  }, [units, pendingCount]);
14617
- useEffect(() => {
14618
- const hasAtlasUnits = units.some((u) => unitAtlasUrl(u) !== null);
14619
- if (!hasAtlasUnits) return;
14620
- let running = true;
14621
- const tick = (ts) => {
14622
- if (!running) return;
14623
- const last = lastTickRef.current || ts;
14624
- const delta = ts - last;
14625
- lastTickRef.current = ts;
14626
- const states = animStatesRef.current;
14627
- const currentIds = /* @__PURE__ */ new Set();
14628
- for (const unit of units) {
14629
- if (unitAtlasUrl(unit) === null) continue;
14630
- currentIds.add(unit.id);
14631
- let state = states.get(unit.id);
14632
- if (!state) {
14633
- state = { animation: "idle", direction: "se", elapsed: 0, walkHold: 0, prev: null };
14634
- states.set(unit.id, state);
14635
- }
14636
- const posX = unit.position?.x ?? unit.x ?? 0;
14637
- const posY = unit.position?.y ?? unit.y ?? 0;
14638
- if (state.prev) {
14639
- const dx = posX - state.prev.x;
14640
- const dy = posY - state.prev.y;
14641
- if (dx !== 0 || dy !== 0) {
14642
- state.animation = "walk";
14643
- state.direction = inferDirection(dx, dy);
14644
- state.walkHold = WALK_HOLD_MS;
14645
- } else if (state.animation === "walk") {
14646
- state.walkHold -= delta;
14647
- if (state.walkHold <= 0) state.animation = "idle";
14648
- }
14649
- }
14650
- state.prev = { x: posX, y: posY };
14651
- state.elapsed += delta;
14652
- }
14653
- for (const id of states.keys()) {
14654
- if (!currentIds.has(id)) states.delete(id);
14655
- }
14656
- rafRef.current = requestAnimationFrame(tick);
14657
- };
14658
- rafRef.current = requestAnimationFrame(tick);
14659
- return () => {
14660
- running = false;
14661
- cancelAnimationFrame(rafRef.current);
14662
- lastTickRef.current = 0;
14663
- };
14664
- }, [units]);
14665
14504
  const resolveUnitFrame = useCallback((unitId) => {
14666
14505
  const unit = units.find((u) => u.id === unitId);
14667
14506
  if (!unit) return null;
@@ -14669,18 +14508,14 @@ function useUnitSpriteAtlas(units) {
14669
14508
  if (!atlasUrl) return null;
14670
14509
  const atlas = atlasCacheRef.current.get(atlasUrl);
14671
14510
  if (!atlas) return null;
14672
- const state = animStatesRef.current.get(unitId);
14673
- const animation = state?.animation ?? "idle";
14674
- const direction = state?.direction ?? "se";
14675
- const elapsed = state?.elapsed ?? 0;
14511
+ const animation = unit.animation ?? "idle";
14512
+ const frame = unit.frame ?? 0;
14676
14513
  const def = atlas.animations[animation] ?? atlas.animations.idle;
14677
14514
  if (!def) return null;
14678
- const { sheetDir, flipX } = resolveSheetDirection(direction);
14515
+ const { sheetDir, flipX } = resolveSheetDirection("se");
14679
14516
  const rel = atlas.sheets[sheetDir] ?? atlas.sheets.se ?? atlas.sheets.sw;
14680
14517
  if (!rel) return null;
14681
14518
  const sheetUrl = resolveSheetUrl(atlasUrl, rel);
14682
- const isIdle = animation === "idle";
14683
- const frame = isIdle ? 0 : getCurrentFrameFromDef(def, elapsed).frame;
14684
14519
  const rect = frameRect(frame, def.row, atlas.columns, atlas.frameWidth, atlas.frameHeight);
14685
14520
  return {
14686
14521
  sheetUrl,
@@ -14689,17 +14524,15 @@ function useUnitSpriteAtlas(units) {
14689
14524
  sw: rect.sw,
14690
14525
  sh: rect.sh,
14691
14526
  flipX,
14692
- applyBreathing: isIdle
14527
+ applyBreathing: animation === "idle"
14693
14528
  };
14694
14529
  }, [units]);
14695
14530
  return { sheetUrls, resolveUnitFrame, pendingCount };
14696
14531
  }
14697
- var WALK_HOLD_MS;
14698
14532
  var init_useUnitSpriteAtlas = __esm({
14699
14533
  "components/game/molecules/useUnitSpriteAtlas.ts"() {
14700
14534
  "use client";
14701
14535
  init_spriteAnimation();
14702
- WALK_HOLD_MS = 600;
14703
14536
  }
14704
14537
  });
14705
14538
 
@@ -14767,6 +14600,7 @@ function IsometricCanvas({
14767
14600
  tiles: _tilesPropRaw = [],
14768
14601
  units: _unitsPropRaw = [],
14769
14602
  features: _featuresPropRaw = [],
14603
+ effects: _effectsPropRaw = [],
14770
14604
  // Interaction state
14771
14605
  selectedUnitId = null,
14772
14606
  validMoves = [],
@@ -14799,7 +14633,7 @@ function IsometricCanvas({
14799
14633
  resolveUnitFrame,
14800
14634
  effectSpriteUrls = [],
14801
14635
  onDrawEffects,
14802
- hasActiveEffects: hasActiveEffects2 = false,
14636
+ hasActiveEffects: _hasActiveEffects = false,
14803
14637
  // Tuning
14804
14638
  diamondTopY: diamondTopYProp,
14805
14639
  // Remote asset loading
@@ -14809,13 +14643,12 @@ function IsometricCanvas({
14809
14643
  const tilesProp = Array.isArray(_tilesPropRaw) ? _tilesPropRaw : [];
14810
14644
  const unitsProp = Array.isArray(_unitsPropRaw) ? _unitsPropRaw : [];
14811
14645
  const featuresProp = Array.isArray(_featuresPropRaw) ? _featuresPropRaw : [];
14646
+ const effects = Array.isArray(_effectsPropRaw) ? _effectsPropRaw : [];
14812
14647
  const eventBus = useEventBus();
14813
14648
  const { t } = useTranslate();
14814
14649
  const canvasRef = useRef(null);
14815
14650
  const containerRef = useRef(null);
14816
- const minimapRef = useRef(null);
14817
- const animTimeRef = useRef(0);
14818
- const rafIdRef = useRef(0);
14651
+ const lerpRafRef = useRef(0);
14819
14652
  const [viewportSize, setViewportSize] = useState({ width: 800, height: 600 });
14820
14653
  useEffect(() => {
14821
14654
  const el = containerRef.current;
@@ -14839,7 +14672,7 @@ function IsometricCanvas({
14839
14672
  () => unitsProp.map((u) => u.position ? u : { ...u, position: { x: u.x ?? 0, y: u.y ?? 0 } }),
14840
14673
  [unitsProp]
14841
14674
  );
14842
- const { sheetUrls: atlasSheetUrls, resolveUnitFrame: resolveUnitFrameInternal, pendingCount: atlasPending } = useUnitSpriteAtlas(units);
14675
+ const { sheetUrls: atlasSheetUrls, resolveUnitFrame: resolveUnitFrameInternal } = useUnitSpriteAtlas(units);
14843
14676
  const resolveFrameForUnit = useCallback((unitId) => {
14844
14677
  return resolveUnitFrame?.(unitId) ?? resolveUnitFrameInternal(unitId);
14845
14678
  }, [resolveUnitFrame, resolveUnitFrameInternal]);
@@ -14934,7 +14767,7 @@ function IsometricCanvas({
14934
14767
  if (backgroundImage) urls.push(backgroundImage);
14935
14768
  return [...new Set(urls.filter(Boolean))];
14936
14769
  }, [sortedTiles, features, units, getTerrainSprite, getFeatureSprite, getUnitSprite, effectSpriteUrls, atlasSheetUrls, backgroundImage, assetManifest, resolveManifestUrl7]);
14937
- const { getImage, pendingCount } = useImageCache(spriteUrls);
14770
+ const { getImage, pendingCount: _imagePendingCount } = useImageCache(spriteUrls);
14938
14771
  useEffect(() => {
14939
14772
  if (typeof window === "undefined") return;
14940
14773
  const canvas = canvasRef.current;
@@ -14966,63 +14799,26 @@ function IsometricCanvas({
14966
14799
  const resolveUnitSpriteUrl = useCallback((unit) => {
14967
14800
  return unit.sprite || getUnitSprite?.(unit) || (unit.unitType ? resolveManifestUrl7(assetManifest?.units?.[unit.unitType]) : void 0);
14968
14801
  }, [getUnitSprite, assetManifest, resolveManifestUrl7]);
14969
- const drawMinimap = useCallback(() => {
14970
- if (!showMinimap) return;
14971
- const miniCanvas = minimapRef.current;
14972
- if (!miniCanvas || sortedTiles.length === 0) return;
14973
- const mCtx = miniCanvas.getContext("2d");
14974
- if (!mCtx) return;
14975
- const mW = 150;
14976
- const mH = 100;
14977
- miniCanvas.width = mW;
14978
- miniCanvas.height = mH;
14979
- mCtx.clearRect(0, 0, mW, mH);
14980
- const allScreenPos = sortedTiles.map((t2) => isoToScreen(t2.x, t2.y, scale, baseOffsetX, tileLayout));
14981
- const minX = Math.min(...allScreenPos.map((p2) => p2.x));
14982
- const maxX = Math.max(...allScreenPos.map((p2) => p2.x + scaledTileWidth));
14983
- const minY = Math.min(...allScreenPos.map((p2) => p2.y));
14984
- const tileBottomExtent = tileLayout === "hex" || tileLayout === "flat" ? scaledTileWidth : scaledTileHeight;
14985
- const maxY = Math.max(...allScreenPos.map((p2) => p2.y + tileBottomExtent));
14986
- const worldW = maxX - minX;
14987
- const worldH = maxY - minY;
14988
- const scaleM = Math.min(mW / worldW, mH / worldH) * 0.9;
14989
- const offsetMx = (mW - worldW * scaleM) / 2;
14990
- const offsetMy = (mH - worldH * scaleM) / 2;
14991
- for (const tile of sortedTiles) {
14992
- const pos = isoToScreen(tile.x, tile.y, scale, baseOffsetX, tileLayout);
14993
- const mx = (pos.x - minX) * scaleM + offsetMx;
14994
- const my = (pos.y - minY) * scaleM + offsetMy;
14995
- const mTileW = scaledTileWidth * scaleM;
14996
- const mFloorH = scaledFloorHeight * scaleM;
14997
- mCtx.fillStyle = tile.terrain === "water" ? "#3b82f6" : tile.terrain === "mountain" ? "#78716c" : "#4ade80";
14998
- mCtx.beginPath();
14999
- mCtx.moveTo(mx + mTileW / 2, my);
15000
- mCtx.lineTo(mx + mTileW, my + mFloorH / 2);
15001
- mCtx.lineTo(mx + mTileW / 2, my + mFloorH);
15002
- mCtx.lineTo(mx, my + mFloorH / 2);
15003
- mCtx.closePath();
15004
- mCtx.fill();
15005
- }
15006
- for (const unit of units) {
15007
- if (!unit.position) continue;
15008
- const pos = isoToScreen(unit.position.x, unit.position.y, scale, baseOffsetX, tileLayout);
15009
- const mx = (pos.x + scaledTileWidth / 2 - minX) * scaleM + offsetMx;
15010
- const my = (pos.y + scaledTileHeight / 2 - minY) * scaleM + offsetMy;
15011
- mCtx.fillStyle = unit.team === "player" ? "#60a5fa" : unit.team === "enemy" ? "#f87171" : "#9ca3af";
15012
- mCtx.beginPath();
15013
- mCtx.arc(mx, my, 3, 0, Math.PI * 2);
15014
- mCtx.fill();
15015
- }
15016
- const cam = cameraRef.current;
15017
- const vLeft = (cam.x - minX) * scaleM + offsetMx;
15018
- const vTop = (cam.y - minY) * scaleM + offsetMy;
15019
- const vW = viewportSize.width / cam.zoom * scaleM;
15020
- const vH = viewportSize.height / cam.zoom * scaleM;
15021
- mCtx.strokeStyle = "rgba(255, 255, 255, 0.8)";
15022
- mCtx.lineWidth = 1;
15023
- mCtx.strokeRect(vLeft, vTop, vW, vH);
15024
- }, [showMinimap, sortedTiles, units, tileLayout, scale, baseOffsetX, scaledTileWidth, scaledTileHeight, scaledFloorHeight, viewportSize, cameraRef]);
15025
- const draw = useCallback((animTime) => {
14802
+ const miniMapTiles = useMemo(() => {
14803
+ if (!showMinimap) return [];
14804
+ return sortedTiles.map((t2) => ({
14805
+ x: t2.x,
14806
+ y: t2.y,
14807
+ color: t2.terrain === "water" ? "#3b82f6" : t2.terrain === "mountain" ? "#78716c" : "#4ade80"
14808
+ }));
14809
+ }, [showMinimap, sortedTiles]);
14810
+ const miniMapUnits = useMemo(() => {
14811
+ if (!showMinimap) return [];
14812
+ return units.filter((u) => u.position).map((u) => ({
14813
+ x: u.position.x,
14814
+ y: u.position.y,
14815
+ color: u.team === "player" ? "#60a5fa" : u.team === "enemy" ? "#f87171" : "#9ca3af",
14816
+ isPlayer: u.team === "player"
14817
+ }));
14818
+ }, [showMinimap, units]);
14819
+ const miniMapWidth = gridWidth || 10;
14820
+ const miniMapHeight = gridHeight || 10;
14821
+ const draw = useCallback(() => {
15026
14822
  const canvas = canvasRef.current;
15027
14823
  if (!canvas) return;
15028
14824
  const ctx = canvas.getContext("2d");
@@ -15108,8 +14904,7 @@ function IsometricCanvas({
15108
14904
  if (validMoveSet.has(tileKey)) {
15109
14905
  const centerX = pos.x + scaledTileWidth / 2;
15110
14906
  const topY = pos.y + scaledDiamondTopY;
15111
- const pulse = 0.15 + 0.1 * Math.sin(animTime * 4e-3);
15112
- ctx.fillStyle = `rgba(74, 222, 128, ${pulse})`;
14907
+ ctx.fillStyle = "rgba(74, 222, 128, 0.25)";
15113
14908
  ctx.beginPath();
15114
14909
  ctx.moveTo(centerX, topY);
15115
14910
  ctx.lineTo(pos.x + scaledTileWidth, topY + scaledFloorHeight / 2);
@@ -15121,8 +14916,7 @@ function IsometricCanvas({
15121
14916
  if (attackTargetSet.has(tileKey)) {
15122
14917
  const centerX = pos.x + scaledTileWidth / 2;
15123
14918
  const topY = pos.y + scaledDiamondTopY;
15124
- const pulse = 0.2 + 0.15 * Math.sin(animTime * 5e-3);
15125
- ctx.fillStyle = `rgba(239, 68, 68, ${pulse})`;
14919
+ ctx.fillStyle = "rgba(239, 68, 68, 0.35)";
15126
14920
  ctx.beginPath();
15127
14921
  ctx.moveTo(centerX, topY);
15128
14922
  ctx.lineTo(pos.x + scaledTileWidth, topY + scaledFloorHeight / 2);
@@ -15195,7 +14989,7 @@ function IsometricCanvas({
15195
14989
  const isSelected = unit.id === selectedUnitId;
15196
14990
  const centerX = pos.x + scaledTileWidth / 2;
15197
14991
  const groundY = pos.y + scaledDiamondTopY + scaledFloorHeight * 0.5;
15198
- const breatheOffset = 0.8 * scale * (1 + Math.sin(animTime * 2e-3 + (unit.position.x * 3.7 + unit.position.y * 5.3)));
14992
+ const breatheOffset = 0;
15199
14993
  const unitSpriteUrl = resolveUnitSpriteUrl(unit);
15200
14994
  const img = unitSpriteUrl ? getImage(unitSpriteUrl) : null;
15201
14995
  const unitDrawH = scaledFloorHeight * spriteHeightRatio * unitScale;
@@ -15235,10 +15029,9 @@ function IsometricCanvas({
15235
15029
  ctx.restore();
15236
15030
  }
15237
15031
  if (isSelected) {
15238
- const ringAlpha = 0.6 + 0.3 * Math.sin(animTime * 4e-3);
15239
15032
  ctx.beginPath();
15240
15033
  ctx.ellipse(centerX, groundY, drawW / 2 + 4 * scale, 12 * scale, 0, 0, Math.PI * 2);
15241
- ctx.strokeStyle = `rgba(0, 200, 255, ${ringAlpha})`;
15034
+ ctx.strokeStyle = "rgba(0, 200, 255, 0.8)";
15242
15035
  ctx.lineWidth = 3;
15243
15036
  ctx.stroke();
15244
15037
  }
@@ -15294,66 +15087,29 @@ function IsometricCanvas({
15294
15087
  ctx.lineWidth = 2;
15295
15088
  ctx.stroke();
15296
15089
  }
15297
- if (unit.name) {
15298
- const labelBg = unit.team === "player" ? "rgba(59, 130, 246, 0.9)" : unit.team === "enemy" ? "rgba(239, 68, 68, 0.9)" : "rgba(107, 114, 128, 0.9)";
15299
- ctx.font = `bold ${10 * scale * 2.5}px system-ui`;
15300
- ctx.textAlign = "center";
15301
- const textWidth = ctx.measureText(unit.name).width;
15302
- const labelY = groundY + 14 * scale - breatheOffset;
15303
- ctx.fillStyle = labelBg;
15304
- ctx.beginPath();
15305
- ctx.roundRect(centerX - textWidth / 2 - 6 * scale, labelY - 8 * scale, textWidth + 12 * scale, 16 * scale, 4 * scale);
15306
- ctx.fill();
15307
- ctx.fillStyle = "white";
15308
- ctx.fillText(unit.name, centerX, labelY + 4 * scale);
15309
- }
15310
- if (unit.health !== void 0 && unit.maxHealth !== void 0) {
15311
- const barWidth = 40 * scale;
15312
- const barHeight = 6 * scale;
15313
- const barX = centerX - barWidth / 2;
15314
- const barY = groundY - drawH - 2 * scale - breatheOffset;
15315
- const healthRatio = unit.health / unit.maxHealth;
15316
- const barRadius = barHeight / 2;
15317
- ctx.fillStyle = "rgba(0, 0, 0, 0.7)";
15318
- ctx.beginPath();
15319
- ctx.roundRect(barX, barY, barWidth, barHeight, barRadius);
15320
- ctx.fill();
15321
- if (healthRatio > 0) {
15322
- const fillWidth = barWidth * healthRatio;
15323
- const gradient = ctx.createLinearGradient(barX, barY, barX, barY + barHeight);
15324
- if (healthRatio > 0.6) {
15325
- gradient.addColorStop(0, "#4ade80");
15326
- gradient.addColorStop(1, "#22c55e");
15327
- } else if (healthRatio > 0.3) {
15328
- gradient.addColorStop(0, "#fde047");
15329
- gradient.addColorStop(1, "#eab308");
15330
- } else {
15331
- gradient.addColorStop(0, "#f87171");
15332
- gradient.addColorStop(1, "#ef4444");
15333
- }
15334
- ctx.fillStyle = gradient;
15335
- ctx.save();
15336
- ctx.beginPath();
15337
- ctx.roundRect(barX, barY, fillWidth, barHeight, barRadius);
15338
- ctx.clip();
15339
- ctx.fillRect(barX, barY, fillWidth, barHeight);
15340
- ctx.restore();
15341
- }
15342
- ctx.strokeStyle = "rgba(255, 255, 255, 0.3)";
15343
- ctx.lineWidth = 1;
15344
- ctx.beginPath();
15345
- ctx.roundRect(barX, barY, barWidth, barHeight, barRadius);
15346
- ctx.stroke();
15347
- }
15348
15090
  }
15349
- onDrawEffects?.(ctx, animTime, getImage);
15091
+ for (const fx of effects) {
15092
+ const spriteUrl = resolveManifestUrl7(assetManifest?.effects?.[fx.key]);
15093
+ if (!spriteUrl) continue;
15094
+ const img = getImage(spriteUrl);
15095
+ if (!img) continue;
15096
+ const pos = isoToScreen(fx.x, fx.y, scale, baseOffsetX, tileLayout);
15097
+ const cx = pos.x + scaledTileWidth / 2;
15098
+ const cy = pos.y + scaledDiamondTopY + scaledFloorHeight * 0.5;
15099
+ const alpha = Math.min(1, fx.ttl / 4);
15100
+ const prev = ctx.globalAlpha;
15101
+ ctx.globalAlpha = alpha;
15102
+ ctx.drawImage(img, cx - img.naturalWidth / 2, cy - img.naturalHeight / 2);
15103
+ ctx.globalAlpha = prev;
15104
+ }
15105
+ onDrawEffects?.(ctx, 0, getImage);
15350
15106
  ctx.restore();
15351
- drawMinimap();
15352
15107
  }, [
15353
15108
  sortedTiles,
15354
15109
  units,
15355
15110
  features,
15356
15111
  selectedUnitId,
15112
+ effects,
15357
15113
  tileLayout,
15358
15114
  scale,
15359
15115
  debug2,
@@ -15373,11 +15129,12 @@ function IsometricCanvas({
15373
15129
  attackTargetSet,
15374
15130
  hoveredTile,
15375
15131
  viewportSize,
15376
- drawMinimap,
15377
15132
  onDrawEffects,
15378
15133
  backgroundImage,
15379
15134
  cameraRef,
15380
- unitScale
15135
+ unitScale,
15136
+ resolveManifestUrl7,
15137
+ assetManifest
15381
15138
  ]);
15382
15139
  useEffect(() => {
15383
15140
  if (!selectedUnitId) return;
@@ -15392,30 +15149,33 @@ function IsometricCanvas({
15392
15149
  };
15393
15150
  }, [selectedUnitId, units, tileLayout, scale, baseOffsetX, scaledTileWidth, scaledDiamondTopY, scaledFloorHeight, viewportSize, targetCameraRef]);
15394
15151
  useEffect(() => {
15395
- const hasAnimations = units.length > 0 || validMoves.length > 0 || attackTargets.length > 0 || selectedUnitId != null || targetCameraRef.current != null || hasActiveEffects2 || pendingCount > 0 || atlasPending > 0;
15396
- draw(animTimeRef.current);
15397
- if (!hasAnimations) return;
15152
+ draw();
15153
+ }, [draw]);
15154
+ useEffect(() => {
15155
+ draw();
15156
+ }, [_imagePendingCount]);
15157
+ useEffect(() => {
15158
+ if (selectedUnitId == null) return;
15398
15159
  let running = true;
15399
- const animate = (timestamp) => {
15160
+ const tick = () => {
15400
15161
  if (!running) return;
15401
- animTimeRef.current = timestamp;
15402
- lerpToTarget();
15403
- draw(timestamp);
15404
- rafIdRef.current = requestAnimationFrame(animate);
15162
+ const stillLerping = lerpToTarget();
15163
+ draw();
15164
+ if (stillLerping) lerpRafRef.current = requestAnimationFrame(tick);
15405
15165
  };
15406
- rafIdRef.current = requestAnimationFrame(animate);
15166
+ lerpRafRef.current = requestAnimationFrame(tick);
15407
15167
  return () => {
15408
15168
  running = false;
15409
- cancelAnimationFrame(rafIdRef.current);
15169
+ cancelAnimationFrame(lerpRafRef.current);
15410
15170
  };
15411
- }, [draw, units.length, validMoves.length, attackTargets.length, selectedUnitId, hasActiveEffects2, pendingCount, atlasPending, lerpToTarget, targetCameraRef]);
15171
+ }, [selectedUnitId, lerpToTarget, draw]);
15412
15172
  const singlePointerActiveRef = useRef(false);
15413
15173
  const handleCanvasPointerDown = useCallback((e) => {
15414
15174
  singlePointerActiveRef.current = true;
15415
15175
  if (enableCamera) handlePointerDown(e);
15416
15176
  }, [enableCamera, handlePointerDown]);
15417
15177
  const handleCanvasPointerMove = useCallback((e) => {
15418
- if (enableCamera) handlePointerMove(e, () => draw(animTimeRef.current));
15178
+ if (enableCamera) handlePointerMove(e, () => draw());
15419
15179
  }, [enableCamera, handlePointerMove, draw]);
15420
15180
  const handleCanvasHover = useCallback((e) => {
15421
15181
  if (singlePointerActiveRef.current) return;
@@ -15457,10 +15217,10 @@ function IsometricCanvas({
15457
15217
  onTileLeave?.();
15458
15218
  }, [handleMouseLeave, onTileLeave, tileLeaveEvent, eventBus]);
15459
15219
  const applyZoom = useCallback((factor, centerX, centerY) => {
15460
- if (enableCamera) zoomAtPoint(factor, centerX, centerY, viewportSize, () => draw(animTimeRef.current));
15220
+ if (enableCamera) zoomAtPoint(factor, centerX, centerY, viewportSize, () => draw());
15461
15221
  }, [enableCamera, zoomAtPoint, viewportSize, draw]);
15462
15222
  const applyPanDelta = useCallback((dx, dy) => {
15463
- if (enableCamera) panBy(dx, dy, () => draw(animTimeRef.current));
15223
+ if (enableCamera) panBy(dx, dy, () => draw());
15464
15224
  }, [enableCamera, panBy, draw]);
15465
15225
  const cancelSinglePointer = useCallback(() => {
15466
15226
  singlePointerActiveRef.current = false;
@@ -15476,11 +15236,27 @@ function IsometricCanvas({
15476
15236
  onPanDelta: applyPanDelta,
15477
15237
  onMultiTouchStart: cancelSinglePointer
15478
15238
  });
15239
+ const unitOverlays = useMemo(() => {
15240
+ if (sortedTiles.length === 0) return [];
15241
+ return units.filter((u) => !!u.position).map((u) => {
15242
+ const pos = isoToScreen(u.position.x, u.position.y, scale, baseOffsetX, tileLayout);
15243
+ const cam = cameraRef.current;
15244
+ const screenX = (pos.x + scaledTileWidth / 2 - (cam.x + viewportSize.width / 2)) * cam.zoom + viewportSize.width / 2;
15245
+ const screenY = (pos.y + scaledDiamondTopY + scaledFloorHeight * 0.5 - (cam.y + viewportSize.height / 2)) * cam.zoom + viewportSize.height / 2;
15246
+ return { unit: u, screenX, screenY };
15247
+ });
15248
+ }, [units, sortedTiles.length, scale, baseOffsetX, tileLayout, scaledTileWidth, scaledDiamondTopY, scaledFloorHeight, viewportSize, cameraRef]);
15479
15249
  if (error) {
15480
- return /* @__PURE__ */ jsx(ErrorState, { title: t("canvas.errorTitle"), message: error.message, className });
15250
+ return /* @__PURE__ */ jsx(Box, { className: cn("flex items-center justify-center w-full h-full bg-[var(--color-card)] rounded-container", className), children: /* @__PURE__ */ jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
15251
+ /* @__PURE__ */ jsx(Icon, { name: "alert-circle", size: "xl" }),
15252
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-error", children: error.message })
15253
+ ] }) });
15481
15254
  }
15482
15255
  if (isLoading) {
15483
- return /* @__PURE__ */ jsx(LoadingState, { className });
15256
+ return /* @__PURE__ */ jsx(Box, { className: cn("flex items-center justify-center w-full h-full bg-[var(--color-card)] rounded-container", className), children: /* @__PURE__ */ jsxs(Stack, { direction: "vertical", gap: "md", align: "center", children: [
15257
+ /* @__PURE__ */ jsx(Icon, { name: "loader", size: "xl", className: "animate-spin" }),
15258
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: t("canvas.loadingMessage") || "Loading\u2026" })
15259
+ ] }) });
15484
15260
  }
15485
15261
  if (sortedTiles.length === 0) {
15486
15262
  return /* @__PURE__ */ jsx(
@@ -15545,14 +15321,36 @@ function IsometricCanvas({
15545
15321
  }
15546
15322
  )
15547
15323
  ] }),
15548
- showMinimap && /* @__PURE__ */ jsx(
15549
- "canvas",
15324
+ unitOverlays.map(({ unit, screenX, screenY }) => /* @__PURE__ */ jsxs(
15325
+ "div",
15550
15326
  {
15551
- ref: minimapRef,
15552
- className: "absolute bottom-2 right-2 border border-border rounded bg-background/80 pointer-events-none",
15553
- style: { width: 150, height: 100, zIndex: 10 }
15327
+ className: "absolute pointer-events-none",
15328
+ style: { left: Math.round(screenX), top: Math.round(screenY), transform: "translate(-50%, 0)", zIndex: 5 },
15329
+ children: [
15330
+ unit.name && /* @__PURE__ */ jsx(
15331
+ "div",
15332
+ {
15333
+ className: "text-white text-xs font-bold px-1.5 py-0.5 rounded mb-0.5 whitespace-nowrap",
15334
+ style: { background: unit.team === "player" ? "rgba(59,130,246,0.9)" : unit.team === "enemy" ? "rgba(239,68,68,0.9)" : "rgba(107,114,128,0.9)" },
15335
+ children: unit.name
15336
+ }
15337
+ ),
15338
+ unit.health !== void 0 && unit.maxHealth !== void 0 && unit.maxHealth > 0 && /* @__PURE__ */ jsx(HealthBar, { current: unit.health, max: unit.maxHealth, format: "bar", size: "sm" })
15339
+ ]
15340
+ },
15341
+ unit.id
15342
+ )),
15343
+ showMinimap && /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 pointer-events-none", style: { zIndex: 10 }, children: /* @__PURE__ */ jsx(
15344
+ MiniMap,
15345
+ {
15346
+ tiles: miniMapTiles,
15347
+ units: miniMapUnits,
15348
+ width: 150,
15349
+ height: 100,
15350
+ mapWidth: miniMapWidth,
15351
+ mapHeight: miniMapHeight
15554
15352
  }
15555
- )
15353
+ ) })
15556
15354
  ]
15557
15355
  }
15558
15356
  );
@@ -15567,8 +15365,8 @@ var init_IsometricCanvas = __esm({
15567
15365
  init_Stack();
15568
15366
  init_Icon();
15569
15367
  init_Typography();
15570
- init_LoadingState();
15571
- init_ErrorState();
15368
+ init_MiniMap();
15369
+ init_HealthBar();
15572
15370
  init_useImageCache();
15573
15371
  init_useCamera();
15574
15372
  init_useCanvasGestures();
@@ -15662,9 +15460,37 @@ function BattleBoard({
15662
15460
  className
15663
15461
  }) {
15664
15462
  const board = boardEntity(entity) ?? {};
15665
- const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles : []);
15463
+ function asFieldObj(v) {
15464
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
15465
+ return v;
15466
+ }
15467
+ const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles.flatMap((v) => {
15468
+ const o = asFieldObj(v);
15469
+ if (o === null || typeof o.x !== "number" || typeof o.y !== "number") return [];
15470
+ const tile = { x: o.x, y: o.y };
15471
+ if (typeof o.terrain === "string") tile.terrain = o.terrain;
15472
+ if (typeof o.terrainSprite === "string") tile.terrainSprite = o.terrainSprite;
15473
+ if (typeof o.passable === "boolean") tile.passable = o.passable;
15474
+ if (typeof o.movementCost === "number") tile.movementCost = o.movementCost;
15475
+ if (typeof o.elevation === "number") tile.elevation = o.elevation;
15476
+ if (typeof o.type === "string") tile.type = o.type;
15477
+ if (typeof o.tileType === "string") tile.tileType = o.tileType;
15478
+ if (typeof o.id === "string") tile.id = o.id;
15479
+ if (typeof o.modelUrl === "string") tile.modelUrl = o.modelUrl;
15480
+ return [tile];
15481
+ }) : []);
15666
15482
  const tiles = rawTiles.length === 0 ? DEFAULT_BATTLE_TILES : rawTiles;
15667
- const features = propFeatures ?? (Array.isArray(board.features) ? board.features : []);
15483
+ const features = propFeatures ?? (Array.isArray(board.features) ? board.features.flatMap((v) => {
15484
+ const o = asFieldObj(v);
15485
+ if (o === null || typeof o.type !== "string" || typeof o.x !== "number" || typeof o.y !== "number") return [];
15486
+ const feat = { type: o.type, x: o.x, y: o.y };
15487
+ if (typeof o.id === "string") feat.id = o.id;
15488
+ if (typeof o.sprite === "string") feat.sprite = o.sprite;
15489
+ if (typeof o.color === "string") feat.color = o.color;
15490
+ if (typeof o.elevation === "number") feat.elevation = o.elevation;
15491
+ if (typeof o.assetUrl === "string") feat.assetUrl = o.assetUrl;
15492
+ return [feat];
15493
+ }) : []);
15668
15494
  const boardWidth = num(board.gridWidth ?? board.boardWidth, BATTLE_GRID_W);
15669
15495
  const boardHeight = num(board.gridHeight ?? board.boardHeight, BATTLE_GRID_H);
15670
15496
  const assetManifest = propAssetManifest ?? board.assetManifest;
@@ -15763,7 +15589,12 @@ function BattleBoard({
15763
15589
  return units.filter((u) => unitHealth(u) > 0).map((unit) => {
15764
15590
  const id = str(unit.id);
15765
15591
  const pos = movingPositions.get(id) ?? unitPosition(unit);
15766
- const unitTraits = Array.isArray(unit.traits) ? unit.traits : void 0;
15592
+ const unitTraits = Array.isArray(unit.traits) ? unit.traits.flatMap((v) => {
15593
+ const o = asFieldObj(v);
15594
+ if (o === null || typeof o.name !== "string" || typeof o.currentState !== "string" || !Array.isArray(o.states)) return [];
15595
+ const stateNames = Array.from(o.states).flatMap((s) => typeof s === "string" ? [s] : []);
15596
+ return [{ name: o.name, currentState: o.currentState, states: stateNames, cooldown: typeof o.cooldown === "number" ? o.cooldown : void 0 }];
15597
+ }) : void 0;
15767
15598
  return {
15768
15599
  id,
15769
15600
  position: pos,
@@ -16266,6 +16097,50 @@ var init_Tabs = __esm({
16266
16097
  Tabs.displayName = "Tabs";
16267
16098
  }
16268
16099
  });
16100
+ var LoadingState;
16101
+ var init_LoadingState = __esm({
16102
+ "components/core/molecules/LoadingState.tsx"() {
16103
+ "use client";
16104
+ init_cn();
16105
+ init_atoms2();
16106
+ init_Stack();
16107
+ init_Typography();
16108
+ LoadingState = ({
16109
+ title,
16110
+ message,
16111
+ className
16112
+ }) => {
16113
+ const { t } = useTranslate();
16114
+ const displayMessage = message ?? t("common.loading");
16115
+ return /* @__PURE__ */ jsxs(
16116
+ VStack,
16117
+ {
16118
+ align: "center",
16119
+ className: cn(
16120
+ "justify-center py-12",
16121
+ className
16122
+ ),
16123
+ children: [
16124
+ /* @__PURE__ */ jsx(Spinner, { size: "lg" }),
16125
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h3", className: "mt-4 text-lg font-semibold text-foreground", children: title }),
16126
+ /* @__PURE__ */ jsx(
16127
+ Typography,
16128
+ {
16129
+ variant: "small",
16130
+ className: cn(
16131
+ "text-muted-foreground",
16132
+ title ? "mt-2" : "mt-4"
16133
+ ),
16134
+ children: displayMessage
16135
+ }
16136
+ )
16137
+ ]
16138
+ }
16139
+ );
16140
+ };
16141
+ LoadingState.displayName = "LoadingState";
16142
+ }
16143
+ });
16269
16144
  var ICON_NAME_ALIASES, lookStyles3, EmptyState;
16270
16145
  var init_EmptyState = __esm({
16271
16146
  "components/core/molecules/EmptyState.tsx"() {
@@ -16546,7 +16421,7 @@ var init_CodeBlock = __esm({
16546
16421
  };
16547
16422
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16548
16423
  HIDDEN_LINE_NUMBERS = { display: "none" };
16549
- CodeBlock = React94__default.memo(
16424
+ CodeBlock = React96__default.memo(
16550
16425
  ({
16551
16426
  code: rawCode,
16552
16427
  language = "text",
@@ -17133,7 +17008,7 @@ var init_MarkdownContent = __esm({
17133
17008
  init_Box();
17134
17009
  init_CodeBlock();
17135
17010
  init_cn();
17136
- MarkdownContent = React94__default.memo(
17011
+ MarkdownContent = React96__default.memo(
17137
17012
  ({ content, direction = "ltr", className }) => {
17138
17013
  const { t: _t } = useTranslate();
17139
17014
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18502,7 +18377,7 @@ var init_StateMachineView = __esm({
18502
18377
  style: { top: title ? 30 : 0 },
18503
18378
  children: [
18504
18379
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
18505
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React94__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18380
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React96__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18506
18381
  StateNode,
18507
18382
  {
18508
18383
  state,
@@ -19321,12 +19196,13 @@ var init_ContentRenderer = __esm({
19321
19196
  );
19322
19197
  case "orbital": {
19323
19198
  const parsed = segment.schema;
19199
+ const isFullSchema = (v) => Array.isArray(v.orbitals);
19324
19200
  const inlineTrait = {
19325
19201
  name: "inline",
19326
19202
  scope: "instance",
19327
19203
  stateMachine: parsed
19328
19204
  };
19329
- const schema = Array.isArray(parsed.orbitals) ? parsed : {
19205
+ const schema = isFullSchema(parsed) ? parsed : {
19330
19206
  name: "inline",
19331
19207
  orbitals: [{
19332
19208
  name: "inline",
@@ -20552,8 +20428,21 @@ function BuilderBoard({
20552
20428
  const resolved = boardEntity(entity);
20553
20429
  const [headerError, setHeaderError] = useState(false);
20554
20430
  const [selectedComponent, setSelectedComponent] = useState(null);
20555
- const components = Array.isArray(resolved?.components) ? resolved.components : [];
20556
- const slots = Array.isArray(resolved?.slots) ? resolved.slots : [];
20431
+ const components = rows(resolved?.components).map((r2) => ({
20432
+ id: str(r2.id),
20433
+ label: str(r2.label),
20434
+ description: str(r2.description) || void 0,
20435
+ iconEmoji: str(r2.iconEmoji) || void 0,
20436
+ iconUrl: str(r2.iconUrl) || void 0,
20437
+ category: str(r2.category) || void 0
20438
+ }));
20439
+ const slots = rows(resolved?.slots).map((r2) => ({
20440
+ id: str(r2.id),
20441
+ label: str(r2.label) || void 0,
20442
+ description: str(r2.description) || void 0,
20443
+ requiredComponentId: str(r2.requiredComponentId),
20444
+ placedComponentId: str(r2.placedComponentId) || void 0
20445
+ }));
20557
20446
  const placements = {};
20558
20447
  for (const slot of slots) {
20559
20448
  if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
@@ -22457,7 +22346,7 @@ function CardHand({
22457
22346
  className
22458
22347
  }) {
22459
22348
  const eventBus = useEventBus();
22460
- const handleClick = React94.useCallback(
22349
+ const handleClick = React96.useCallback(
22461
22350
  (card) => {
22462
22351
  if (card.disabled) return;
22463
22352
  onCardClick?.(card.id);
@@ -23204,14 +23093,15 @@ var init_CardGrid = __esm({
23204
23093
  bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
23205
23094
  const value = getNestedValue(itemData, field);
23206
23095
  if (value === void 0 || value === null || value === "") return null;
23207
- const boolVal = asBooleanValue(value);
23096
+ const fieldValue = value;
23097
+ const boolVal = asBooleanValue(fieldValue);
23208
23098
  if (boolVal !== null) {
23209
23099
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
23210
23100
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
23211
23101
  boolVal ? /* @__PURE__ */ jsx(Badge, { variant: "success", children: t("common.yes") || "Yes" }) : /* @__PURE__ */ jsx(Badge, { variant: "neutral", children: t("common.no") || "No" })
23212
23102
  ] }, field);
23213
23103
  }
23214
- const displayValue = isDateField(field) ? formatDate(value) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
23104
+ const displayValue = isDateField(field) ? formatDate(fieldValue) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
23215
23105
  if (!displayValue) return null;
23216
23106
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
23217
23107
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
@@ -23596,9 +23486,9 @@ function CastleBoard({
23596
23486
  const eventBus = useEventBus();
23597
23487
  const { t } = useTranslate();
23598
23488
  const resolved = boardEntity(entity);
23599
- const tiles = propTiles ?? (Array.isArray(resolved?.tiles) ? resolved.tiles : []);
23600
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
23601
- const units = propUnits ?? (Array.isArray(resolved?.units) ? resolved.units : []);
23489
+ const tiles = propTiles ?? (resolved?.tiles ?? []);
23490
+ const features = propFeatures ?? (resolved?.features ?? []);
23491
+ const units = propUnits ?? (resolved?.units ?? []);
23602
23492
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
23603
23493
  const backgroundImage = resolved?.backgroundImage;
23604
23494
  const gold = num(resolved?.gold);
@@ -25133,8 +25023,8 @@ function ClassifierBoard({
25133
25023
  const { t } = useTranslate();
25134
25024
  const resolved = boardEntity(entity);
25135
25025
  const [headerError, setHeaderError] = useState(false);
25136
- const items = Array.isArray(resolved?.items) ? resolved.items : [];
25137
- const categories = Array.isArray(resolved?.categories) ? resolved.categories : [];
25026
+ const items = rows(resolved?.items);
25027
+ const categories = rows(resolved?.categories);
25138
25028
  const result = str(resolved?.result);
25139
25029
  const submitted = result === "win";
25140
25030
  const attempts = num(resolved?.attempts);
@@ -25445,10 +25335,10 @@ function CombatLog({
25445
25335
  }, [events2, autoScroll]);
25446
25336
  const safeEvents = events2 ?? [];
25447
25337
  const visibleEvents = safeEvents.slice(-maxVisible);
25448
- return /* @__PURE__ */ jsxs(Card, { variant: "default", className: cn("flex flex-col", className), children: [
25338
+ return /* @__PURE__ */ jsxs(Box, { className: cn("flex flex-col rounded-container border border-border bg-card shadow-elevation-card", className), children: [
25449
25339
  /* @__PURE__ */ jsx(Box, { padding: "sm", border: true, className: "border-b-2 border-x-0 border-t-0 border-border", children: /* @__PURE__ */ jsxs(Box, { display: "flex", className: "items-center justify-between", children: [
25450
25340
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-bold", children: title }),
25451
- /* @__PURE__ */ jsxs(Badge, { variant: "neutral", size: "sm", children: [
25341
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5 border border-border/50 font-mono", children: [
25452
25342
  safeEvents.length,
25453
25343
  " events"
25454
25344
  ] })
@@ -25468,7 +25358,7 @@ function CombatLog({
25468
25358
  /* @__PURE__ */ jsx(Box, { className: cn("flex-shrink-0 mt-0.5", colorClass), children: /* @__PURE__ */ jsx(EventIcon, { className: "h-4 w-4" }) }),
25469
25359
  /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
25470
25360
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "block", children: event.message }),
25471
- event.value !== void 0 && /* @__PURE__ */ jsxs(Badge, { variant: eventBadgeVariants[eventType], size: "sm", className: "mt-1", children: [
25361
+ event.value !== void 0 && /* @__PURE__ */ jsxs("span", { className: cn("inline-block mt-1 text-xs font-bold rounded px-1.5 py-0.5 border", eventValueColors[eventType]), children: [
25472
25362
  eventType === "heal" ? "+" : eventType === "attack" ? "-" : "",
25473
25363
  event.value
25474
25364
  ] })
@@ -25481,7 +25371,7 @@ function CombatLog({
25481
25371
  }) }) })
25482
25372
  ] });
25483
25373
  }
25484
- var eventIcons, eventColors, eventBadgeVariants, DEFAULT_COMBAT_EVENTS;
25374
+ var eventIcons, eventColors, eventValueColors, DEFAULT_COMBAT_EVENTS;
25485
25375
  var init_CombatLog = __esm({
25486
25376
  "components/game/molecules/CombatLog.tsx"() {
25487
25377
  init_atoms2();
@@ -25504,14 +25394,14 @@ var init_CombatLog = __esm({
25504
25394
  death: "text-muted-foreground",
25505
25395
  spawn: "text-accent"
25506
25396
  };
25507
- eventBadgeVariants = {
25508
- attack: "danger",
25509
- defend: "primary",
25510
- heal: "success",
25511
- move: "warning",
25512
- special: "secondary",
25513
- death: "secondary",
25514
- spawn: "secondary"
25397
+ eventValueColors = {
25398
+ attack: "text-error bg-error/10 border-error/30",
25399
+ defend: "text-info bg-info/10 border-info/30",
25400
+ heal: "text-success bg-success/10 border-success/30",
25401
+ move: "text-warning bg-warning/10 border-warning/30",
25402
+ special: "text-accent bg-accent/10 border-accent/30",
25403
+ death: "text-muted-foreground bg-muted/30 border-border",
25404
+ spawn: "text-accent bg-accent/10 border-accent/30"
25515
25405
  };
25516
25406
  DEFAULT_COMBAT_EVENTS = [
25517
25407
  { id: "e1", type: "spawn", message: "Shadow Guard entered the field.", timestamp: 0, turn: 1 },
@@ -25935,7 +25825,7 @@ function CraftingRecipe({
25935
25825
  className
25936
25826
  }) {
25937
25827
  const eventBus = useEventBus();
25938
- const handleCraft = React94.useCallback(() => {
25828
+ const handleCraft = React96.useCallback(() => {
25939
25829
  onCraft?.();
25940
25830
  if (craftEvent) {
25941
25831
  eventBus.emit(craftEvent, { output: output.label });
@@ -25952,7 +25842,7 @@ function CraftingRecipe({
25952
25842
  children: [
25953
25843
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
25954
25844
  const hasSufficient = ingredient.available >= ingredient.required;
25955
- return /* @__PURE__ */ jsxs(React94.Fragment, { children: [
25845
+ return /* @__PURE__ */ jsxs(React96.Fragment, { children: [
25956
25846
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
25957
25847
  ItemSlot,
25958
25848
  {
@@ -25977,13 +25867,13 @@ function CraftingRecipe({
25977
25867
  }
25978
25868
  ),
25979
25869
  /* @__PURE__ */ jsx(
25980
- Button,
25870
+ ActionButton,
25981
25871
  {
25872
+ label: "Craft",
25982
25873
  onClick: handleCraft,
25983
25874
  disabled: !canCraft,
25984
25875
  variant: canCraft ? "primary" : "secondary",
25985
- size: "sm",
25986
- children: "Craft"
25876
+ size: "sm"
25987
25877
  }
25988
25878
  )
25989
25879
  ]
@@ -25997,7 +25887,7 @@ var init_CraftingRecipe = __esm({
25997
25887
  init_cn();
25998
25888
  init_useEventBus();
25999
25889
  init_ItemSlot();
26000
- init_Button();
25890
+ init_ActionButton();
26001
25891
  init_Box();
26002
25892
  init_Stack();
26003
25893
  init_Icon();
@@ -26024,8 +25914,8 @@ function DPad({
26024
25914
  }) {
26025
25915
  const eventBus = useEventBus();
26026
25916
  const sizes = sizeMap15[size];
26027
- const [activeDirections, setActiveDirections] = React94.useState(/* @__PURE__ */ new Set());
26028
- const handlePress = React94.useCallback(
25917
+ const [activeDirections, setActiveDirections] = React96.useState(/* @__PURE__ */ new Set());
25918
+ const handlePress = React96.useCallback(
26029
25919
  (direction) => {
26030
25920
  setActiveDirections((prev) => new Set(prev).add(direction));
26031
25921
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -26033,7 +25923,7 @@ function DPad({
26033
25923
  },
26034
25924
  [directionEvent, eventBus, onDirection]
26035
25925
  );
26036
- const handleRelease = React94.useCallback(
25926
+ const handleRelease = React96.useCallback(
26037
25927
  (direction) => {
26038
25928
  setActiveDirections((prev) => {
26039
25929
  const next = new Set(prev);
@@ -26918,8 +26808,8 @@ var init_Menu = __esm({
26918
26808
  "bottom-end": "bottom-start"
26919
26809
  };
26920
26810
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
26921
- const triggerChild = React94__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
26922
- const triggerElement = React94__default.cloneElement(
26811
+ const triggerChild = React96__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
26812
+ const triggerElement = React96__default.cloneElement(
26923
26813
  triggerChild,
26924
26814
  {
26925
26815
  ref: triggerRef,
@@ -27014,14 +26904,14 @@ function useDataDnd(args) {
27014
26904
  const isZone = Boolean(dragGroup || accepts || sortable);
27015
26905
  const enabled = isZone || Boolean(dndRoot);
27016
26906
  const eventBus = useEventBus();
27017
- const parentRoot = React94__default.useContext(RootCtx);
26907
+ const parentRoot = React96__default.useContext(RootCtx);
27018
26908
  const isRoot = enabled && parentRoot === null;
27019
- const zoneId = React94__default.useId();
26909
+ const zoneId = React96__default.useId();
27020
26910
  const ownGroup = dragGroup ?? accepts ?? zoneId;
27021
- const [optimisticOrders, setOptimisticOrders] = React94__default.useState(() => /* @__PURE__ */ new Map());
27022
- const optimisticOrdersRef = React94__default.useRef(optimisticOrders);
26911
+ const [optimisticOrders, setOptimisticOrders] = React96__default.useState(() => /* @__PURE__ */ new Map());
26912
+ const optimisticOrdersRef = React96__default.useRef(optimisticOrders);
27023
26913
  optimisticOrdersRef.current = optimisticOrders;
27024
- const clearOptimisticOrder = React94__default.useCallback((group) => {
26914
+ const clearOptimisticOrder = React96__default.useCallback((group) => {
27025
26915
  setOptimisticOrders((prev) => {
27026
26916
  if (!prev.has(group)) return prev;
27027
26917
  const next = new Map(prev);
@@ -27044,17 +26934,20 @@ function useDataDnd(args) {
27044
26934
  }
27045
26935
  const itemIdsSignature = orderedItems.map((it, idx) => {
27046
26936
  const raw = it[dndItemIdField];
27047
- return String(raw ?? `__idx_${idx}`);
26937
+ return raw != null ? String(raw) : `__idx_${idx}`;
27048
26938
  }).join("|");
27049
- const itemIds = React94__default.useMemo(
26939
+ const itemIds = React96__default.useMemo(
27050
26940
  () => orderedItems.map((it, idx) => {
27051
26941
  const raw = it[dndItemIdField];
27052
- return raw ?? `__idx_${idx}`;
26942
+ return raw != null ? String(raw) : `__idx_${idx}`;
27053
26943
  }),
27054
26944
  [itemIdsSignature]
27055
26945
  );
27056
- const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
27057
- React94__default.useEffect(() => {
26946
+ const itemsContentSig = items.map((it, idx) => {
26947
+ const raw = it[dndItemIdField];
26948
+ return raw != null ? String(raw) : `__${idx}`;
26949
+ }).join("|");
26950
+ React96__default.useEffect(() => {
27058
26951
  const root = isRoot ? null : parentRoot;
27059
26952
  if (root) {
27060
26953
  root.clearOptimisticOrder(ownGroup);
@@ -27062,20 +26955,20 @@ function useDataDnd(args) {
27062
26955
  clearOptimisticOrder(ownGroup);
27063
26956
  }
27064
26957
  }, [itemsContentSig, ownGroup]);
27065
- const zonesRef = React94__default.useRef(/* @__PURE__ */ new Map());
27066
- const registerZone = React94__default.useCallback((zoneId2, meta2) => {
26958
+ const zonesRef = React96__default.useRef(/* @__PURE__ */ new Map());
26959
+ const registerZone = React96__default.useCallback((zoneId2, meta2) => {
27067
26960
  zonesRef.current.set(zoneId2, meta2);
27068
26961
  }, []);
27069
- const unregisterZone = React94__default.useCallback((zoneId2) => {
26962
+ const unregisterZone = React96__default.useCallback((zoneId2) => {
27070
26963
  zonesRef.current.delete(zoneId2);
27071
26964
  }, []);
27072
- const [activeDrag, setActiveDrag] = React94__default.useState(null);
27073
- const [overZoneGroup, setOverZoneGroup] = React94__default.useState(null);
27074
- const meta = React94__default.useMemo(
26965
+ const [activeDrag, setActiveDrag] = React96__default.useState(null);
26966
+ const [overZoneGroup, setOverZoneGroup] = React96__default.useState(null);
26967
+ const meta = React96__default.useMemo(
27075
26968
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
27076
26969
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
27077
26970
  );
27078
- React94__default.useEffect(() => {
26971
+ React96__default.useEffect(() => {
27079
26972
  const target = isRoot ? null : parentRoot;
27080
26973
  if (!target) {
27081
26974
  zonesRef.current.set(zoneId, meta);
@@ -27094,7 +26987,7 @@ function useDataDnd(args) {
27094
26987
  }, [parentRoot, isRoot, zoneId, meta]);
27095
26988
  const sensors = useAlmadarDndSensors(true);
27096
26989
  const collisionDetection = almadarDndCollisionDetection;
27097
- const findZoneByItem = React94__default.useCallback(
26990
+ const findZoneByItem = React96__default.useCallback(
27098
26991
  (id) => {
27099
26992
  for (const z of zonesRef.current.values()) {
27100
26993
  if (z.itemIds.includes(id)) return z;
@@ -27103,7 +26996,7 @@ function useDataDnd(args) {
27103
26996
  },
27104
26997
  []
27105
26998
  );
27106
- React94__default.useCallback(
26999
+ React96__default.useCallback(
27107
27000
  (group) => {
27108
27001
  for (const z of zonesRef.current.values()) {
27109
27002
  if (z.group === group) return z;
@@ -27112,7 +27005,7 @@ function useDataDnd(args) {
27112
27005
  },
27113
27006
  []
27114
27007
  );
27115
- const handleDragEnd = React94__default.useCallback(
27008
+ const handleDragEnd = React96__default.useCallback(
27116
27009
  (event) => {
27117
27010
  const { active, over } = event;
27118
27011
  const activeIdStr = String(active.id);
@@ -27203,8 +27096,8 @@ function useDataDnd(args) {
27203
27096
  },
27204
27097
  [eventBus]
27205
27098
  );
27206
- const sortableData = React94__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
27207
- const SortableItem = React94__default.useCallback(
27099
+ const sortableData = React96__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
27100
+ const SortableItem = React96__default.useCallback(
27208
27101
  ({ id, children }) => {
27209
27102
  const {
27210
27103
  attributes,
@@ -27244,7 +27137,7 @@ function useDataDnd(args) {
27244
27137
  id: droppableId,
27245
27138
  data: sortableData
27246
27139
  });
27247
- const ctx = React94__default.useContext(RootCtx);
27140
+ const ctx = React96__default.useContext(RootCtx);
27248
27141
  const activeDrag2 = ctx?.activeDrag ?? null;
27249
27142
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
27250
27143
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -27259,7 +27152,7 @@ function useDataDnd(args) {
27259
27152
  showForeignPlaceholder,
27260
27153
  ctxAvailable: ctx != null
27261
27154
  });
27262
- React94__default.useEffect(() => {
27155
+ React96__default.useEffect(() => {
27263
27156
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
27264
27157
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
27265
27158
  return /* @__PURE__ */ jsx(
@@ -27273,11 +27166,11 @@ function useDataDnd(args) {
27273
27166
  }
27274
27167
  );
27275
27168
  };
27276
- const rootContextValue = React94__default.useMemo(
27169
+ const rootContextValue = React96__default.useMemo(
27277
27170
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
27278
27171
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
27279
27172
  );
27280
- const handleDragStart = React94__default.useCallback((event) => {
27173
+ const handleDragStart = React96__default.useCallback((event) => {
27281
27174
  const sourceZone = findZoneByItem(event.active.id);
27282
27175
  const rect = event.active.rect.current.initial;
27283
27176
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -27296,7 +27189,7 @@ function useDataDnd(args) {
27296
27189
  isRoot
27297
27190
  });
27298
27191
  }, [findZoneByItem, isRoot, zoneId]);
27299
- const handleDragOver = React94__default.useCallback((event) => {
27192
+ const handleDragOver = React96__default.useCallback((event) => {
27300
27193
  const { active, over } = event;
27301
27194
  const overData = over?.data?.current;
27302
27195
  const overGroup = overData?.dndGroup ?? null;
@@ -27366,7 +27259,7 @@ function useDataDnd(args) {
27366
27259
  return next;
27367
27260
  });
27368
27261
  }, []);
27369
- const handleDragCancel = React94__default.useCallback((event) => {
27262
+ const handleDragCancel = React96__default.useCallback((event) => {
27370
27263
  setActiveDrag(null);
27371
27264
  setOverZoneGroup(null);
27372
27265
  dndLog.warn("dragCancel", {
@@ -27374,12 +27267,12 @@ function useDataDnd(args) {
27374
27267
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
27375
27268
  });
27376
27269
  }, []);
27377
- const handleDragEndWithCleanup = React94__default.useCallback((event) => {
27270
+ const handleDragEndWithCleanup = React96__default.useCallback((event) => {
27378
27271
  handleDragEnd(event);
27379
27272
  setActiveDrag(null);
27380
27273
  setOverZoneGroup(null);
27381
27274
  }, [handleDragEnd]);
27382
- const wrapContainer = React94__default.useCallback(
27275
+ const wrapContainer = React96__default.useCallback(
27383
27276
  (children) => {
27384
27277
  if (!enabled) return children;
27385
27278
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -27433,7 +27326,7 @@ var init_useDataDnd = __esm({
27433
27326
  init_useAlmadarDndCollision();
27434
27327
  init_Box();
27435
27328
  dndLog = createLogger("almadar:ui:dnd");
27436
- RootCtx = React94__default.createContext(null);
27329
+ RootCtx = React96__default.createContext(null);
27437
27330
  }
27438
27331
  });
27439
27332
  function renderIconInput(icon, props) {
@@ -27576,8 +27469,8 @@ function DataGrid({
27576
27469
  const hasRenderProp = typeof children === "function";
27577
27470
  useEffect(() => {
27578
27471
  if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
27579
- const renderItemRaw = schemaRenderItem;
27580
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
27472
+ const schemaArr = Array.isArray(schemaRenderItem) ? schemaRenderItem : null;
27473
+ const isFnLambda = schemaArr !== null && schemaArr.length >= 3 && (schemaArr[0] === "fn" || schemaArr[0] === "lambda");
27581
27474
  dataGridLog.warn("renderItem-unresolved", {
27582
27475
  rowCount: data.length,
27583
27476
  renderItemIsFnLambda: isFnLambda
@@ -27959,7 +27852,7 @@ function DataList({
27959
27852
  }) {
27960
27853
  const eventBus = useEventBus();
27961
27854
  const { t } = useTranslate();
27962
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize || Infinity);
27855
+ const [visibleCount, setVisibleCount] = React96__default.useState(pageSize || Infinity);
27963
27856
  const fieldDefs = fields ?? columns ?? [];
27964
27857
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
27965
27858
  const dnd = useDataDnd({
@@ -27978,21 +27871,20 @@ function DataList({
27978
27871
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
27979
27872
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
27980
27873
  const hasRenderProp = typeof children === "function";
27981
- React94__default.useEffect(() => {
27874
+ React96__default.useEffect(() => {
27982
27875
  const renderItemTypeOf = typeof schemaRenderItem;
27983
27876
  const childrenTypeOf = typeof children;
27984
27877
  if (data.length > 0 && !hasRenderProp) {
27985
27878
  const firstRow = data[0];
27986
27879
  const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
27987
- const renderItemRaw = schemaRenderItem;
27988
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
27880
+ const isFnLambda = Array.isArray(schemaRenderItem) && schemaRenderItem.length >= 3 && (schemaRenderItem[0] === "fn" || schemaRenderItem[0] === "lambda");
27989
27881
  dataListLog.warn("renderItem-unresolved", {
27990
27882
  rowCount: data.length,
27991
27883
  fieldsCount: fieldDefs.length,
27992
27884
  renderItemTypeOf,
27993
- renderItemIsArray: Array.isArray(renderItemRaw),
27885
+ renderItemIsArray: Array.isArray(schemaRenderItem),
27994
27886
  renderItemIsFnLambda: isFnLambda,
27995
- renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
27887
+ renderItemHead: Array.isArray(schemaRenderItem) ? String(schemaRenderItem[0]) : void 0,
27996
27888
  childrenTypeOf,
27997
27889
  sampleRowKeys: sampleKeys
27998
27890
  });
@@ -28080,10 +27972,10 @@ function DataList({
28080
27972
  const isCompact = variant === "compact";
28081
27973
  const isMessage = variant === "message";
28082
27974
  if (isMessage) {
28083
- const items2 = data.map((item) => item);
27975
+ const items2 = [...data];
28084
27976
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
28085
27977
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
28086
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
27978
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
28087
27979
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
28088
27980
  group.items.map((itemData, index) => {
28089
27981
  const id = itemData.id || `${gi}-${index}`;
@@ -28129,7 +28021,7 @@ function DataList({
28129
28021
  })
28130
28022
  ] }, gi)) });
28131
28023
  }
28132
- const items = data.map((item) => item);
28024
+ const items = [...data];
28133
28025
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
28134
28026
  const idFieldName = dndItemIdField ?? "id";
28135
28027
  const renderItem = (itemData, index, isLast) => {
@@ -28224,7 +28116,7 @@ function DataList({
28224
28116
  className
28225
28117
  ),
28226
28118
  children: [
28227
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
28119
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
28228
28120
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
28229
28121
  group.items.map(
28230
28122
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -29017,23 +28909,19 @@ var init_Flex = __esm({
29017
28909
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
29018
28910
  }
29019
28911
  }
29020
- const Comp = Component2;
29021
- return /* @__PURE__ */ jsx(
29022
- Comp,
29023
- {
29024
- className: cn(
29025
- inline ? "inline-flex" : "flex",
29026
- directionStyles[direction],
29027
- wrapStyles[wrap],
29028
- alignStyles3[align],
29029
- justifyStyles2[justify],
29030
- gapStyles6[gap],
29031
- className
29032
- ),
29033
- style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
29034
- children
29035
- }
29036
- );
28912
+ return React96__default.createElement(Component2, {
28913
+ className: cn(
28914
+ inline ? "inline-flex" : "flex",
28915
+ directionStyles[direction],
28916
+ wrapStyles[wrap],
28917
+ alignStyles3[align],
28918
+ justifyStyles2[justify],
28919
+ gapStyles6[gap],
28920
+ className
28921
+ ),
28922
+ style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
28923
+ children
28924
+ });
29037
28925
  };
29038
28926
  Flex.displayName = "Flex";
29039
28927
  }
@@ -29140,7 +29028,7 @@ var init_Grid = __esm({
29140
29028
  as: Component2 = "div"
29141
29029
  }) => {
29142
29030
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
29143
- return React94__default.createElement(
29031
+ return React96__default.createElement(
29144
29032
  Component2,
29145
29033
  {
29146
29034
  className: cn(
@@ -29336,9 +29224,9 @@ var init_Popover = __esm({
29336
29224
  onMouseLeave: handleClose,
29337
29225
  onPointerDown: tapTriggerProps.onPointerDown
29338
29226
  };
29339
- const childElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29227
+ const childElement = React96__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29340
29228
  const childPointerDown = childElement.props.onPointerDown;
29341
- const triggerElement = React94__default.cloneElement(
29229
+ const triggerElement = React96__default.cloneElement(
29342
29230
  childElement,
29343
29231
  {
29344
29232
  ref: triggerRef,
@@ -29940,9 +29828,9 @@ var init_Tooltip = __esm({
29940
29828
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
29941
29829
  };
29942
29830
  }, []);
29943
- const triggerElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29831
+ const triggerElement = React96__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29944
29832
  const childPointerDown = triggerElement.props.onPointerDown;
29945
- const trigger = React94__default.cloneElement(triggerElement, {
29833
+ const trigger = React96__default.cloneElement(triggerElement, {
29946
29834
  ref: triggerRef,
29947
29835
  onMouseEnter: handleMouseEnter,
29948
29836
  onMouseLeave: handleMouseLeave,
@@ -30032,7 +29920,7 @@ var init_WizardProgress = __esm({
30032
29920
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
30033
29921
  const isActive = index === currentStep;
30034
29922
  const isCompleted = index < currentStep;
30035
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
29923
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
30036
29924
  /* @__PURE__ */ jsx(
30037
29925
  "button",
30038
29926
  {
@@ -30344,13 +30232,14 @@ var init_ViolationAlert = __esm({
30344
30232
  onNavigateToField,
30345
30233
  compact = false,
30346
30234
  className,
30347
- ...flatProps
30235
+ message
30348
30236
  }) => {
30349
30237
  const { t } = useTranslate();
30238
+ const fallbackMessage = message ?? t("violationAlert.fallbackMessage");
30350
30239
  const resolvedViolation = violation ?? {
30351
30240
  law: "",
30352
30241
  article: "",
30353
- message: flatProps.message ?? t("violationAlert.fallbackMessage"),
30242
+ message: fallbackMessage,
30354
30243
  actionType: "measure"
30355
30244
  };
30356
30245
  const effectiveSeverity = severity ?? (resolvedViolation.actionType === "measure" ? "warning" : "error");
@@ -30994,6 +30883,7 @@ var init_ProgressDots = __esm({
30994
30883
  });
30995
30884
  function StatBadge({
30996
30885
  assetUrl,
30886
+ iconUrl,
30997
30887
  label,
30998
30888
  value = 0,
30999
30889
  max,
@@ -31007,6 +30897,7 @@ function StatBadge({
31007
30897
  field: _field
31008
30898
  }) {
31009
30899
  const numValue = typeof value === "number" ? value : parseInt(String(value), 10) || 0;
30900
+ const resolvedAsset = iconUrl ?? assetUrl;
31010
30901
  return /* @__PURE__ */ jsxs(
31011
30902
  "div",
31012
30903
  {
@@ -31017,10 +30908,10 @@ function StatBadge({
31017
30908
  className
31018
30909
  ),
31019
30910
  children: [
31020
- assetUrl ? /* @__PURE__ */ jsx(
30911
+ resolvedAsset ? /* @__PURE__ */ jsx(
31021
30912
  "img",
31022
30913
  {
31023
- src: assetUrl,
30914
+ src: resolvedAsset,
31024
30915
  alt: "",
31025
30916
  width: 16,
31026
30917
  height: 16,
@@ -31051,8 +30942,7 @@ function StatBadge({
31051
30942
  ScoreDisplay,
31052
30943
  {
31053
30944
  value: numValue,
31054
- size: size === "lg" ? "md" : "sm",
31055
- animated: true
30945
+ size: size === "lg" ? "md" : "sm"
31056
30946
  }
31057
30947
  ),
31058
30948
  format === "text" && /* @__PURE__ */ jsx("span", { className: "font-bold text-foreground", children: value })
@@ -31095,7 +30985,7 @@ function InventoryGrid({
31095
30985
  const eventBus = useEventBus();
31096
30986
  const slotCount = totalSlots ?? items.length;
31097
30987
  const emptySlotCount = Math.max(0, slotCount - items.length);
31098
- const handleSelect = React94.useCallback(
30988
+ const handleSelect = React96.useCallback(
31099
30989
  (id) => {
31100
30990
  onSelect?.(id);
31101
30991
  if (selectEvent) {
@@ -31202,12 +31092,14 @@ function QuestTracker({
31202
31092
  }
31203
31093
  ),
31204
31094
  /* @__PURE__ */ jsx(Box, { className: "mt-1.5", children: /* @__PURE__ */ jsx(
31205
- ProgressBar,
31095
+ HealthBar,
31206
31096
  {
31207
- value: quest.progress,
31097
+ current: quest.progress,
31208
31098
  max: quest.maxProgress,
31209
- variant: isCompleted ? "success" : isActive ? "primary" : "default",
31210
- size: "sm"
31099
+ format: "bar",
31100
+ size: "sm",
31101
+ animated: true,
31102
+ className: isCompleted ? "[--health-color:var(--color-success)]" : isActive ? "" : "opacity-60"
31211
31103
  }
31212
31104
  ) }),
31213
31105
  /* @__PURE__ */ jsxs(
@@ -31235,7 +31127,7 @@ var init_QuestTracker = __esm({
31235
31127
  "use client";
31236
31128
  init_cn();
31237
31129
  init_WaypointMarker();
31238
- init_ProgressBar();
31130
+ init_HealthBar();
31239
31131
  init_Typography();
31240
31132
  init_Box();
31241
31133
  init_Stack();
@@ -31330,31 +31222,31 @@ function GameCanvas2D({
31330
31222
  assetBaseUrl,
31331
31223
  className
31332
31224
  }) {
31333
- const canvasRef = React94.useRef(null);
31334
- const rafRef = React94.useRef(0);
31335
- const frameRef = React94.useRef(0);
31336
- const lastTimeRef = React94.useRef(0);
31337
- const imageCache = React94.useRef(/* @__PURE__ */ new Map());
31225
+ const canvasRef = React96.useRef(null);
31226
+ const rafRef = React96.useRef(0);
31227
+ const frameRef = React96.useRef(0);
31228
+ const lastTimeRef = React96.useRef(0);
31229
+ const imageCache = React96.useRef(/* @__PURE__ */ new Map());
31338
31230
  const emit = useEmitEvent();
31339
- const onDrawRef = React94.useRef(onDraw);
31231
+ const onDrawRef = React96.useRef(onDraw);
31340
31232
  onDrawRef.current = onDraw;
31341
- const onTickRef = React94.useRef(onTick);
31233
+ const onTickRef = React96.useRef(onTick);
31342
31234
  onTickRef.current = onTick;
31343
- const tickEventRef = React94.useRef(tickEvent);
31235
+ const tickEventRef = React96.useRef(tickEvent);
31344
31236
  tickEventRef.current = tickEvent;
31345
- const drawEventRef = React94.useRef(drawEvent);
31237
+ const drawEventRef = React96.useRef(drawEvent);
31346
31238
  drawEventRef.current = drawEvent;
31347
- const emitRef = React94.useRef(emit);
31239
+ const emitRef = React96.useRef(emit);
31348
31240
  emitRef.current = emit;
31349
- const assetBaseUrlRef = React94.useRef(assetBaseUrl);
31241
+ const assetBaseUrlRef = React96.useRef(assetBaseUrl);
31350
31242
  assetBaseUrlRef.current = assetBaseUrl;
31351
- const backgroundImageRef = React94.useRef(backgroundImage);
31243
+ const backgroundImageRef = React96.useRef(backgroundImage);
31352
31244
  backgroundImageRef.current = backgroundImage;
31353
- const widthRef = React94.useRef(width);
31245
+ const widthRef = React96.useRef(width);
31354
31246
  widthRef.current = width;
31355
- const heightRef = React94.useRef(height);
31247
+ const heightRef = React96.useRef(height);
31356
31248
  heightRef.current = height;
31357
- const loadImage = React94.useCallback((url) => {
31249
+ const loadImage = React96.useCallback((url) => {
31358
31250
  const base = assetBaseUrlRef.current;
31359
31251
  if (!url.startsWith("http") && !base) return null;
31360
31252
  const fullUrl = url.startsWith("http") ? url : `${base}${url}`;
@@ -31368,7 +31260,7 @@ function GameCanvas2D({
31368
31260
  }
31369
31261
  return null;
31370
31262
  }, []);
31371
- React94.useEffect(() => {
31263
+ React96.useEffect(() => {
31372
31264
  const canvas = canvasRef.current;
31373
31265
  if (!canvas) return;
31374
31266
  const ctx = canvas.getContext("2d");
@@ -31516,26 +31408,14 @@ function HealthPanel({
31516
31408
  )
31517
31409
  }
31518
31410
  ),
31519
- effects && effects.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsxs(
31520
- Badge,
31411
+ effects && effects.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsx(
31412
+ StatusEffect,
31521
31413
  {
31414
+ assetUrl: effect.assetUrl,
31415
+ icon: effect.icon,
31416
+ label: effect.label,
31522
31417
  variant: effectVariantMap[effect.variant ?? "neutral"],
31523
- size: "sm",
31524
- icon: effect.assetUrl ? void 0 : effect.icon,
31525
- children: [
31526
- effect.assetUrl && /* @__PURE__ */ jsx(
31527
- "img",
31528
- {
31529
- src: effect.assetUrl,
31530
- alt: "",
31531
- width: 12,
31532
- height: 12,
31533
- style: { imageRendering: "pixelated", objectFit: "contain" },
31534
- className: "flex-shrink-0 inline-block"
31535
- }
31536
- ),
31537
- effect.label
31538
- ]
31418
+ size: "sm"
31539
31419
  },
31540
31420
  i
31541
31421
  )) })
@@ -31549,17 +31429,17 @@ var init_HealthPanel = __esm({
31549
31429
  "use client";
31550
31430
  init_cn();
31551
31431
  init_HealthBar();
31432
+ init_StatusEffect();
31552
31433
  init_Box();
31553
31434
  init_Typography();
31554
- init_Badge();
31555
31435
  sizeMap18 = {
31556
31436
  sm: { gap: "gap-1", padding: "px-2 py-1.5", text: "text-xs", barSize: "sm" },
31557
31437
  md: { gap: "gap-1.5", padding: "px-3 py-2", text: "text-sm", barSize: "md" },
31558
31438
  lg: { gap: "gap-2", padding: "px-4 py-3", text: "text-base", barSize: "lg" }
31559
31439
  };
31560
31440
  effectVariantMap = {
31561
- buff: "success",
31562
- debuff: "danger",
31441
+ buff: "buff",
31442
+ debuff: "debuff",
31563
31443
  neutral: "neutral"
31564
31444
  };
31565
31445
  HealthPanel.displayName = "HealthPanel";
@@ -31579,13 +31459,13 @@ function ScoreBoard({
31579
31459
  const multiplier = rawMultiplier ?? 1;
31580
31460
  const level = rawLevel ?? 1;
31581
31461
  return /* @__PURE__ */ jsx(
31582
- Card,
31462
+ Box,
31583
31463
  {
31584
31464
  className: cn(
31585
- "bg-[var(--color-card)]/90 border-border backdrop-blur-sm",
31465
+ "rounded-container border border-border bg-[var(--color-card)]/90 backdrop-blur-sm p-3",
31586
31466
  className
31587
31467
  ),
31588
- children: /* @__PURE__ */ jsx(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-3 flex-wrap", children: [
31468
+ children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-3 flex-wrap", children: [
31589
31469
  /* @__PURE__ */ jsx(
31590
31470
  StatBadge,
31591
31471
  {
@@ -31627,7 +31507,7 @@ function ScoreBoard({
31627
31507
  }
31628
31508
  ),
31629
31509
  combo != null && combo > 0 && /* @__PURE__ */ jsx(ComboCounter, { combo, multiplier, size: "sm" })
31630
- ] }) })
31510
+ ] })
31631
31511
  }
31632
31512
  );
31633
31513
  }
@@ -31637,7 +31517,6 @@ var init_ScoreBoard = __esm({
31637
31517
  init_cn();
31638
31518
  init_ComboCounter();
31639
31519
  init_StatBadge();
31640
- init_Card();
31641
31520
  init_Box();
31642
31521
  ScoreBoard.displayName = "ScoreBoard";
31643
31522
  }
@@ -31693,7 +31572,7 @@ function TurnPanel({
31693
31572
  className
31694
31573
  }) {
31695
31574
  const eventBus = useEventBus();
31696
- const handleAction = React94.useCallback(
31575
+ const handleAction = React96.useCallback(
31697
31576
  (event) => {
31698
31577
  if (event) {
31699
31578
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -31718,28 +31597,16 @@ function TurnPanel({
31718
31597
  activeTeam
31719
31598
  }
31720
31599
  ),
31721
- actions && actions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsxs(
31722
- Button,
31600
+ actions && actions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsx(
31601
+ ActionButton,
31723
31602
  {
31724
- variant: "ghost",
31725
- size: "sm",
31603
+ label: action.label,
31604
+ icon: action.assetUrl ? void 0 : action.icon,
31605
+ assetUrl: action.assetUrl,
31726
31606
  disabled: action.disabled,
31727
- leftIcon: action.assetUrl ? void 0 : action.icon,
31728
- onClick: () => handleAction(action.event),
31729
- children: [
31730
- action.assetUrl && /* @__PURE__ */ jsx(
31731
- "img",
31732
- {
31733
- src: action.assetUrl,
31734
- alt: "",
31735
- width: 14,
31736
- height: 14,
31737
- style: { imageRendering: "pixelated", objectFit: "contain" },
31738
- className: "flex-shrink-0"
31739
- }
31740
- ),
31741
- action.label
31742
- ]
31607
+ variant: "secondary",
31608
+ size: "sm",
31609
+ onClick: () => handleAction(action.event)
31743
31610
  },
31744
31611
  i
31745
31612
  )) })
@@ -31753,7 +31620,7 @@ var init_TurnPanel = __esm({
31753
31620
  "use client";
31754
31621
  init_cn();
31755
31622
  init_TurnIndicator();
31756
- init_Button();
31623
+ init_ActionButton();
31757
31624
  init_Box();
31758
31625
  init_useEventBus();
31759
31626
  DEFAULT_TURN_ACTIONS = [
@@ -31804,7 +31671,7 @@ function EnemyPlate({
31804
31671
  }
31805
31672
  )
31806
31673
  ] }),
31807
- level != null && /* @__PURE__ */ jsxs(Badge, { variant: "neutral", size: "sm", children: [
31674
+ level != null && /* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5 border border-border/50 shrink-0", children: [
31808
31675
  "Lv.",
31809
31676
  level
31810
31677
  ] })
@@ -31835,12 +31702,12 @@ function EnemyPlate({
31835
31702
  )
31836
31703
  ] }),
31837
31704
  effects && effects.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsx(
31838
- Badge,
31705
+ StatusEffect,
31839
31706
  {
31840
- variant: effectVariantMap2[effect.variant ?? "neutral"],
31841
- size: "sm",
31842
31707
  icon: effect.icon,
31843
- children: effect.label
31708
+ label: effect.label,
31709
+ variant: effectVariantMap2[effect.variant ?? "neutral"],
31710
+ size: "sm"
31844
31711
  },
31845
31712
  i
31846
31713
  )) })
@@ -31854,12 +31721,12 @@ var init_EnemyPlate = __esm({
31854
31721
  "use client";
31855
31722
  init_cn();
31856
31723
  init_HealthBar();
31724
+ init_StatusEffect();
31857
31725
  init_Box();
31858
31726
  init_Typography();
31859
- init_Badge();
31860
31727
  effectVariantMap2 = {
31861
- buff: "success",
31862
- debuff: "danger",
31728
+ buff: "buff",
31729
+ debuff: "debuff",
31863
31730
  neutral: "neutral"
31864
31731
  };
31865
31732
  DEFAULT_ENEMY_EFFECTS = [
@@ -31874,7 +31741,7 @@ function UnitCommandBar({
31874
31741
  className
31875
31742
  }) {
31876
31743
  const eventBus = useEventBus();
31877
- const handleCommand = React94.useCallback(
31744
+ const handleCommand = React96.useCallback(
31878
31745
  (event) => {
31879
31746
  if (event) {
31880
31747
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -31889,27 +31756,18 @@ function UnitCommandBar({
31889
31756
  "flex items-center gap-1.5 rounded-container bg-[var(--color-card)]/90 border border-border backdrop-blur-sm px-2 py-1.5",
31890
31757
  className
31891
31758
  ),
31892
- children: commands.map((command, i) => /* @__PURE__ */ jsxs(Box, { className: "flex flex-col items-center gap-0.5", children: [
31893
- /* @__PURE__ */ jsx(
31894
- Button,
31895
- {
31896
- variant: "ghost",
31897
- size: "sm",
31898
- disabled: command.disabled,
31899
- leftIcon: command.icon,
31900
- onClick: () => handleCommand(command.event),
31901
- children: command.label
31902
- }
31903
- ),
31904
- command.hotkey && /* @__PURE__ */ jsx(
31905
- Typography,
31906
- {
31907
- variant: "caption",
31908
- className: "text-muted-foreground text-xs font-mono",
31909
- children: command.hotkey
31910
- }
31911
- )
31912
- ] }, i))
31759
+ children: commands.map((command, i) => /* @__PURE__ */ jsx(Box, { className: "flex flex-col items-center gap-0.5", children: /* @__PURE__ */ jsx(
31760
+ ActionButton,
31761
+ {
31762
+ label: command.label,
31763
+ icon: command.icon,
31764
+ disabled: command.disabled,
31765
+ hotkey: command.hotkey,
31766
+ variant: "secondary",
31767
+ size: "sm",
31768
+ onClick: () => handleCommand(command.event)
31769
+ }
31770
+ ) }, i))
31913
31771
  }
31914
31772
  );
31915
31773
  }
@@ -31918,9 +31776,8 @@ var init_UnitCommandBar = __esm({
31918
31776
  "components/game/molecules/UnitCommandBar.tsx"() {
31919
31777
  "use client";
31920
31778
  init_cn();
31921
- init_Button();
31779
+ init_ActionButton();
31922
31780
  init_Box();
31923
- init_Typography();
31924
31781
  init_useEventBus();
31925
31782
  DEFAULT_COMMANDS = [
31926
31783
  { label: "Move", icon: "move", event: "MOVE", hotkey: "M" },
@@ -32425,7 +32282,7 @@ function GameMenu({
32425
32282
  } catch {
32426
32283
  }
32427
32284
  const eventBus = eventBusProp || eventBusFromHook;
32428
- const handleOptionClick = React94.useCallback(
32285
+ const handleOptionClick = React96.useCallback(
32429
32286
  (option) => {
32430
32287
  if (option.event && eventBus) {
32431
32288
  eventBus.emit(`UI:${option.event}`, { option });
@@ -32544,7 +32401,7 @@ function GameOverScreen({
32544
32401
  } catch {
32545
32402
  }
32546
32403
  const eventBus = eventBusProp || eventBusFromHook;
32547
- const handleActionClick = React94.useCallback(
32404
+ const handleActionClick = React96.useCallback(
32548
32405
  (action) => {
32549
32406
  if (action.event && eventBus) {
32550
32407
  eventBus.emit(`UI:${action.event}`, { action });
@@ -32759,6 +32616,7 @@ function PlatformerCanvas({
32759
32616
  rightEvent = "MOVE_RIGHT",
32760
32617
  jumpEvent = "JUMP",
32761
32618
  stopEvent = "STOP",
32619
+ effects = [],
32762
32620
  className
32763
32621
  }) {
32764
32622
  const canvasRef = useRef(null);
@@ -32829,7 +32687,8 @@ function PlatformerCanvas({
32829
32687
  playerSprite,
32830
32688
  tileSprites,
32831
32689
  backgroundImage,
32832
- assetBaseUrl
32690
+ assetBaseUrl,
32691
+ effects
32833
32692
  });
32834
32693
  propsRef.current = {
32835
32694
  platforms,
@@ -32842,7 +32701,8 @@ function PlatformerCanvas({
32842
32701
  playerSprite,
32843
32702
  tileSprites,
32844
32703
  backgroundImage,
32845
- assetBaseUrl
32704
+ assetBaseUrl,
32705
+ effects
32846
32706
  };
32847
32707
  const handleKeyDown = useCallback((e) => {
32848
32708
  if (keysRef.current.has(e.code)) return;
@@ -32909,7 +32769,8 @@ function PlatformerCanvas({
32909
32769
  bgColor: bg,
32910
32770
  playerSprite: pSprite,
32911
32771
  tileSprites: tSprites,
32912
- backgroundImage: bgImg
32772
+ backgroundImage: bgImg,
32773
+ effects: fxList
32913
32774
  } = propsRef.current;
32914
32775
  const auth = playerRef.current;
32915
32776
  const interped = positions.get("player");
@@ -33063,6 +32924,18 @@ function PlatformerCanvas({
33063
32924
  ctx.arc(ppx + eyeOffsetX + 7, eyeY, eyeSize, 0, Math.PI * 2);
33064
32925
  ctx.fill();
33065
32926
  }
32927
+ for (const fx of fxList) {
32928
+ const fxScreenX = fx.x - camX;
32929
+ const fxScreenY = fx.y - camY;
32930
+ const alpha = Math.min(1, fx.ttl / 4);
32931
+ const prev = ctx.globalAlpha;
32932
+ ctx.globalAlpha = alpha;
32933
+ ctx.fillStyle = "#ffe066";
32934
+ ctx.beginPath();
32935
+ ctx.arc(fxScreenX, fxScreenY, 12, 0, Math.PI * 2);
32936
+ ctx.fill();
32937
+ ctx.globalAlpha = prev;
32938
+ }
33066
32939
  };
33067
32940
  return interp.startLoop(drawFrame);
33068
32941
  }, [interp.startLoop, loadImage]);
@@ -33476,13 +33349,13 @@ var init_MapView = __esm({
33476
33349
  shadowSize: [41, 41]
33477
33350
  });
33478
33351
  L.Marker.prototype.options.icon = defaultIcon;
33479
- const { useEffect: useEffect89, useRef: useRef82, useCallback: useCallback133, useState: useState125 } = React94__default;
33352
+ const { useEffect: useEffect87, useRef: useRef82, useCallback: useCallback133, useState: useState123 } = React96__default;
33480
33353
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
33481
33354
  const { useEventBus: useEventBus4 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
33482
33355
  function MapUpdater({ centerLat, centerLng, zoom }) {
33483
33356
  const map = useMap();
33484
33357
  const prevRef = useRef82({ centerLat, centerLng, zoom });
33485
- useEffect89(() => {
33358
+ useEffect87(() => {
33486
33359
  const prev = prevRef.current;
33487
33360
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
33488
33361
  map.setView([centerLat, centerLng], zoom);
@@ -33493,7 +33366,7 @@ var init_MapView = __esm({
33493
33366
  }
33494
33367
  function MapClickHandler({ onMapClick }) {
33495
33368
  const map = useMap();
33496
- useEffect89(() => {
33369
+ useEffect87(() => {
33497
33370
  if (!onMapClick) return;
33498
33371
  const handler = (e) => {
33499
33372
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -33521,7 +33394,7 @@ var init_MapView = __esm({
33521
33394
  showAttribution = true
33522
33395
  }) {
33523
33396
  const eventBus = useEventBus4();
33524
- const [clickedPosition, setClickedPosition] = useState125(null);
33397
+ const [clickedPosition, setClickedPosition] = useState123(null);
33525
33398
  const handleMapClick = useCallback133((lat, lng) => {
33526
33399
  if (showClickedPin) {
33527
33400
  setClickedPosition({ lat, lng });
@@ -34312,6 +34185,15 @@ function renderIconInput3(icon, props) {
34312
34185
  function columnLabel(col) {
34313
34186
  return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
34314
34187
  }
34188
+ function asFieldValue(v) {
34189
+ if (v === void 0 || v === null) return v;
34190
+ const t = typeof v;
34191
+ if (t === "string" || t === "number" || t === "boolean") return v;
34192
+ if (v instanceof Date) return v;
34193
+ if (Array.isArray(v)) return v;
34194
+ if (t === "object") return v;
34195
+ return void 0;
34196
+ }
34315
34197
  function statusVariant4(value) {
34316
34198
  const v = value.toLowerCase();
34317
34199
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online", "ok"].includes(v)) return "success";
@@ -34382,8 +34264,8 @@ function TableView({
34382
34264
  }) {
34383
34265
  const eventBus = useEventBus();
34384
34266
  const { t } = useTranslate();
34385
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize > 0 ? pageSize : Infinity);
34386
- const [localSelected, setLocalSelected] = React94__default.useState(/* @__PURE__ */ new Set());
34267
+ const [visibleCount, setVisibleCount] = React96__default.useState(pageSize > 0 ? pageSize : Infinity);
34268
+ const [localSelected, setLocalSelected] = React96__default.useState(/* @__PURE__ */ new Set());
34387
34269
  const colDefs = columns ?? fields ?? [];
34388
34270
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
34389
34271
  const dnd = useDataDnd({
@@ -34528,7 +34410,7 @@ function TableView({
34528
34410
  }
34529
34411
  ) }),
34530
34412
  hasRenderProp ? /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
34531
- const raw = getNestedValue(row, col.field ?? col.key);
34413
+ const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
34532
34414
  const cellBase = cn(
34533
34415
  "flex items-center min-w-0",
34534
34416
  alignClass[col.align ?? "left"],
@@ -34578,12 +34460,12 @@ function TableView({
34578
34460
  ]
34579
34461
  }
34580
34462
  );
34581
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React94__default.Fragment, { children: rowInner }, id);
34463
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React96__default.Fragment, { children: rowInner }, id);
34582
34464
  };
34583
- const items = data.map((row) => row);
34465
+ const items = Array.from(data);
34584
34466
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
34585
34467
  let runningIndex = 0;
34586
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
34468
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
34587
34469
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
34588
34470
  group.items.map((row) => renderRow(row, runningIndex++))
34589
34471
  ] }, gi)) });
@@ -35940,7 +35822,7 @@ var init_StepFlow = __esm({
35940
35822
  className
35941
35823
  }) => {
35942
35824
  if (orientation === "vertical") {
35943
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
35825
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React96__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
35944
35826
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
35945
35827
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
35946
35828
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -35951,7 +35833,7 @@ var init_StepFlow = __esm({
35951
35833
  ] })
35952
35834
  ] }) }, index)) });
35953
35835
  }
35954
- 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(React94__default.Fragment, { children: [
35836
+ 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(React96__default.Fragment, { children: [
35955
35837
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
35956
35838
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
35957
35839
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -36936,7 +36818,7 @@ var init_LikertScale = __esm({
36936
36818
  md: "text-base",
36937
36819
  lg: "text-lg"
36938
36820
  };
36939
- LikertScale = React94__default.forwardRef(
36821
+ LikertScale = React96__default.forwardRef(
36940
36822
  ({
36941
36823
  question,
36942
36824
  options = DEFAULT_LIKERT_OPTIONS,
@@ -36948,7 +36830,7 @@ var init_LikertScale = __esm({
36948
36830
  variant = "radios",
36949
36831
  className
36950
36832
  }, ref) => {
36951
- const groupId = React94__default.useId();
36833
+ const groupId = React96__default.useId();
36952
36834
  const eventBus = useEventBus();
36953
36835
  const handleSelect = useCallback(
36954
36836
  (next) => {
@@ -37843,11 +37725,11 @@ function nextBlockId(prefix = "blk") {
37843
37725
  function normalizeBlocks(raw) {
37844
37726
  if (!Array.isArray(raw) || raw.length === 0) return [createBlock("paragraph")];
37845
37727
  return raw.map((row) => {
37846
- const r2 = row;
37847
- const rawType = r2.type;
37728
+ const entity = row;
37729
+ const rawType = entity.type;
37848
37730
  const type = typeof rawType === "string" && BLOCK_TYPES.has(rawType) ? rawType : "paragraph";
37849
- const id = typeof r2.id === "string" && r2.id ? r2.id : nextBlockId(type);
37850
- return { ...r2, id, type };
37731
+ const id = typeof entity.id === "string" && entity.id ? entity.id : nextBlockId(type);
37732
+ return { ...entity, id, type };
37851
37733
  });
37852
37734
  }
37853
37735
  function createBlock(type) {
@@ -39230,7 +39112,7 @@ var init_DocBreadcrumb = __esm({
39230
39112
  "aria-label": t("aria.breadcrumb"),
39231
39113
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
39232
39114
  const isLast = idx === items.length - 1;
39233
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
39115
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
39234
39116
  idx > 0 && /* @__PURE__ */ jsx(
39235
39117
  Icon,
39236
39118
  {
@@ -39894,7 +39776,7 @@ var init_PageHeader = __esm({
39894
39776
  info: "bg-info/10 text-info"
39895
39777
  };
39896
39778
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
39897
- 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(React94__default.Fragment, { children: [
39779
+ 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(React96__default.Fragment, { children: [
39898
39780
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
39899
39781
  crumb.href ? /* @__PURE__ */ jsx(
39900
39782
  "a",
@@ -40252,52 +40134,49 @@ var init_Section = __esm({
40252
40134
  as: Component2 = "section"
40253
40135
  }) => {
40254
40136
  const hasHeader = title || description || action;
40255
- const Comp = Component2;
40256
- return /* @__PURE__ */ jsxs(
40257
- Comp,
40137
+ return React96__default.createElement(
40138
+ Component2,
40258
40139
  {
40259
40140
  className: cn(
40260
40141
  paddingStyles4[padding],
40261
40142
  variantStyles9[variant],
40262
40143
  className
40263
- ),
40264
- children: [
40265
- hasHeader && /* @__PURE__ */ jsxs(
40266
- Box,
40267
- {
40268
- className: cn(
40269
- "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
40270
- divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
40271
- !divider && "mb-4",
40272
- headerClassName
40273
- ),
40274
- children: [
40275
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
40276
- title && /* @__PURE__ */ jsx(
40277
- Typography,
40278
- {
40279
- variant: "h4",
40280
- className: "text-foreground font-semibold",
40281
- children: title
40282
- }
40283
- ),
40284
- description && /* @__PURE__ */ jsx(
40285
- Typography,
40286
- {
40287
- variant: "body",
40288
- color: "muted",
40289
- className: "mt-1",
40290
- children: description
40291
- }
40292
- )
40293
- ] }),
40294
- action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
40295
- ]
40296
- }
40144
+ )
40145
+ },
40146
+ hasHeader && /* @__PURE__ */ jsxs(
40147
+ Box,
40148
+ {
40149
+ className: cn(
40150
+ "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
40151
+ divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
40152
+ !divider && "mb-4",
40153
+ headerClassName
40297
40154
  ),
40298
- /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
40299
- ]
40300
- }
40155
+ children: [
40156
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
40157
+ title && /* @__PURE__ */ jsx(
40158
+ Typography,
40159
+ {
40160
+ variant: "h4",
40161
+ className: "text-foreground font-semibold",
40162
+ children: title
40163
+ }
40164
+ ),
40165
+ description && /* @__PURE__ */ jsx(
40166
+ Typography,
40167
+ {
40168
+ variant: "body",
40169
+ color: "muted",
40170
+ className: "mt-1",
40171
+ children: description
40172
+ }
40173
+ )
40174
+ ] }),
40175
+ action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
40176
+ ]
40177
+ }
40178
+ ),
40179
+ /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
40301
40180
  );
40302
40181
  };
40303
40182
  Section.displayName = "Section";
@@ -40623,7 +40502,7 @@ var init_WizardContainer = __esm({
40623
40502
  const isCompleted = index < currentStep;
40624
40503
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
40625
40504
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
40626
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
40505
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
40627
40506
  /* @__PURE__ */ jsx(
40628
40507
  Button,
40629
40508
  {
@@ -42566,6 +42445,22 @@ var init_DataTable = __esm({
42566
42445
  DataTable.displayName = "DataTable";
42567
42446
  }
42568
42447
  });
42448
+ function toDebuggerLine(v) {
42449
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
42450
+ const id = v["id"];
42451
+ const content = v["content"];
42452
+ const isBug = v["isBug"];
42453
+ if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
42454
+ const isFlagged = v["isFlagged"];
42455
+ const explanation = v["explanation"];
42456
+ return {
42457
+ id,
42458
+ content,
42459
+ isBug,
42460
+ isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
42461
+ explanation: typeof explanation === "string" ? explanation : void 0
42462
+ };
42463
+ }
42569
42464
  function DebuggerBoard({
42570
42465
  entity,
42571
42466
  completeEvent = "PUZZLE_COMPLETE",
@@ -42578,7 +42473,10 @@ function DebuggerBoard({
42578
42473
  const { t } = useTranslate();
42579
42474
  const resolved = boardEntity(entity);
42580
42475
  const [headerError, setHeaderError] = useState(false);
42581
- const lines = Array.isArray(resolved?.lines) ? resolved.lines : [];
42476
+ const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
42477
+ const l = toDebuggerLine(v);
42478
+ return l ? [l] : [];
42479
+ }) : [];
42582
42480
  const result = str(resolved?.result) || "none";
42583
42481
  const attempts = num(resolved?.attempts);
42584
42482
  const submitted = result === "win";
@@ -43183,7 +43081,7 @@ var init_DetailPanel = __esm({
43183
43081
  }
43184
43082
  });
43185
43083
  function extractTitle(children) {
43186
- if (!React94__default.isValidElement(children)) return void 0;
43084
+ if (!React96__default.isValidElement(children)) return void 0;
43187
43085
  const props = children.props;
43188
43086
  if (typeof props.title === "string") {
43189
43087
  return props.title;
@@ -43238,7 +43136,7 @@ function LinearView({
43238
43136
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
43239
43137
  const isDone = i < currentIdx;
43240
43138
  const isCurrent = i === currentIdx;
43241
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
43139
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
43242
43140
  i > 0 && /* @__PURE__ */ jsx(
43243
43141
  Typography,
43244
43142
  {
@@ -44060,12 +43958,12 @@ function evaluateFormExpression(expr, formCtx) {
44060
43958
  return evaluate(expr, ctx);
44061
43959
  }
44062
43960
  function isOrbitalEntitySchema(value) {
44063
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
43961
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
44064
43962
  const fields = value.fields;
44065
43963
  return Array.isArray(fields);
44066
43964
  }
44067
43965
  function isPlainEntityRow(value) {
44068
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
43966
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
44069
43967
  const fields = value.fields;
44070
43968
  return !Array.isArray(fields);
44071
43969
  }
@@ -44224,12 +44122,12 @@ var init_Form = __esm({
44224
44122
  const isSchemaEntity = isOrbitalEntitySchema(entity);
44225
44123
  const resolvedEntity = isSchemaEntity ? entity : void 0;
44226
44124
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
44227
- const normalizedInitialData = React94__default.useMemo(() => {
44125
+ const normalizedInitialData = React96__default.useMemo(() => {
44228
44126
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
44229
44127
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
44230
44128
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
44231
44129
  }, [entity, initialData]);
44232
- const entityDerivedFields = React94__default.useMemo(() => {
44130
+ const entityDerivedFields = React96__default.useMemo(() => {
44233
44131
  if (fields && fields.length > 0) return void 0;
44234
44132
  if (!resolvedEntity) return void 0;
44235
44133
  return resolvedEntity.fields.map(
@@ -44237,6 +44135,7 @@ var init_Form = __esm({
44237
44135
  name: f3.name,
44238
44136
  type: f3.type,
44239
44137
  required: f3.required,
44138
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
44240
44139
  defaultValue: f3.default,
44241
44140
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
44242
44141
  values: "values" in f3 ? f3.values : void 0,
@@ -44249,16 +44148,16 @@ var init_Form = __esm({
44249
44148
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
44250
44149
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
44251
44150
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
44252
- const [formData, setFormData] = React94__default.useState(
44151
+ const [formData, setFormData] = React96__default.useState(
44253
44152
  normalizedInitialData
44254
44153
  );
44255
- const [collapsedSections, setCollapsedSections] = React94__default.useState(
44154
+ const [collapsedSections, setCollapsedSections] = React96__default.useState(
44256
44155
  /* @__PURE__ */ new Set()
44257
44156
  );
44258
- const [submitError, setSubmitError] = React94__default.useState(null);
44259
- const formRef = React94__default.useRef(null);
44157
+ const [submitError, setSubmitError] = React96__default.useState(null);
44158
+ const formRef = React96__default.useRef(null);
44260
44159
  const formMode = props.mode;
44261
- const mountedRef = React94__default.useRef(false);
44160
+ const mountedRef = React96__default.useRef(false);
44262
44161
  if (!mountedRef.current) {
44263
44162
  mountedRef.current = true;
44264
44163
  debug("forms", "mount", {
@@ -44271,7 +44170,7 @@ var init_Form = __esm({
44271
44170
  });
44272
44171
  }
44273
44172
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
44274
- const evalContext = React94__default.useMemo(
44173
+ const evalContext = React96__default.useMemo(
44275
44174
  () => ({
44276
44175
  formValues: formData,
44277
44176
  globalVariables: externalContext?.globalVariables ?? {},
@@ -44280,7 +44179,7 @@ var init_Form = __esm({
44280
44179
  }),
44281
44180
  [formData, externalContext]
44282
44181
  );
44283
- React94__default.useEffect(() => {
44182
+ React96__default.useEffect(() => {
44284
44183
  debug("forms", "initialData-sync", {
44285
44184
  mode: formMode,
44286
44185
  normalizedInitialData,
@@ -44291,7 +44190,7 @@ var init_Form = __esm({
44291
44190
  setFormData(normalizedInitialData);
44292
44191
  }
44293
44192
  }, [normalizedInitialData]);
44294
- const processCalculations = React94__default.useCallback(
44193
+ const processCalculations = React96__default.useCallback(
44295
44194
  (changedFieldId, newFormData) => {
44296
44195
  if (!hiddenCalculations.length) return;
44297
44196
  const context = {
@@ -44316,7 +44215,7 @@ var init_Form = __esm({
44316
44215
  },
44317
44216
  [hiddenCalculations, externalContext, eventBus]
44318
44217
  );
44319
- const checkViolations = React94__default.useCallback(
44218
+ const checkViolations = React96__default.useCallback(
44320
44219
  (changedFieldId, newFormData) => {
44321
44220
  if (!violationTriggers.length) return;
44322
44221
  const context = {
@@ -44354,7 +44253,7 @@ var init_Form = __esm({
44354
44253
  processCalculations(name, newFormData);
44355
44254
  checkViolations(name, newFormData);
44356
44255
  };
44357
- const isFieldVisible = React94__default.useCallback(
44256
+ const isFieldVisible = React96__default.useCallback(
44358
44257
  (fieldName) => {
44359
44258
  const condition = conditionalFields[fieldName];
44360
44259
  if (!condition) return true;
@@ -44362,7 +44261,7 @@ var init_Form = __esm({
44362
44261
  },
44363
44262
  [conditionalFields, evalContext]
44364
44263
  );
44365
- const isSectionVisible = React94__default.useCallback(
44264
+ const isSectionVisible = React96__default.useCallback(
44366
44265
  (section) => {
44367
44266
  if (!section.condition) return true;
44368
44267
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -44438,7 +44337,7 @@ var init_Form = __esm({
44438
44337
  eventBus.emit(`UI:${onCancel}`);
44439
44338
  }
44440
44339
  };
44441
- const renderField = React94__default.useCallback(
44340
+ const renderField = React96__default.useCallback(
44442
44341
  (field) => {
44443
44342
  const fieldName = field.name || field.field;
44444
44343
  if (!fieldName) return null;
@@ -44459,7 +44358,7 @@ var init_Form = __esm({
44459
44358
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
44460
44359
  );
44461
44360
  const effectiveFields = entityDerivedFields ?? fields;
44462
- const normalizedFields = React94__default.useMemo(() => {
44361
+ const normalizedFields = React96__default.useMemo(() => {
44463
44362
  if (!effectiveFields || effectiveFields.length === 0) return [];
44464
44363
  return effectiveFields.map((field) => {
44465
44364
  if (typeof field === "string") {
@@ -44469,6 +44368,7 @@ var init_Form = __esm({
44469
44368
  name: field,
44470
44369
  type: entityField.type,
44471
44370
  required: entityField.required,
44371
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
44472
44372
  defaultValue: entityField.default,
44473
44373
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
44474
44374
  values: "values" in entityField ? entityField.values : void 0,
@@ -44482,7 +44382,7 @@ var init_Form = __esm({
44482
44382
  return field;
44483
44383
  });
44484
44384
  }, [effectiveFields, resolvedEntity]);
44485
- const schemaFields = React94__default.useMemo(() => {
44385
+ const schemaFields = React96__default.useMemo(() => {
44486
44386
  if (normalizedFields.length === 0) return null;
44487
44387
  if (isDebugEnabled()) {
44488
44388
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -44492,7 +44392,7 @@ var init_Form = __esm({
44492
44392
  }
44493
44393
  return normalizedFields.map(renderField).filter(Boolean);
44494
44394
  }, [normalizedFields, renderField, entityName, conditionalFields]);
44495
- const sectionElements = React94__default.useMemo(() => {
44395
+ const sectionElements = React96__default.useMemo(() => {
44496
44396
  if (!sections || sections.length === 0) return null;
44497
44397
  return sections.map((section) => {
44498
44398
  if (!isSectionVisible(section)) {
@@ -46013,7 +45913,6 @@ var init_GameCanvas3D2 = __esm({
46013
45913
  className,
46014
45914
  isLoading: externalLoading,
46015
45915
  error: externalError,
46016
- entity,
46017
45916
  preloadAssets = [],
46018
45917
  tileClickEvent,
46019
45918
  unitClickEvent,
@@ -46748,6 +46647,14 @@ var init_GameBoard3D = __esm({
46748
46647
  GameBoard3D.displayName = "GameBoard3D";
46749
46648
  }
46750
46649
  });
46650
+ function asDescriptor(v) {
46651
+ if (Array.isArray(v) || React96__default.isValidElement(v)) return null;
46652
+ const o = v;
46653
+ if (typeof o.type !== "string") return null;
46654
+ const props = o.props !== void 0 && typeof o.props === "object" && !Array.isArray(o.props) && o.props !== null ? o.props : void 0;
46655
+ const _id = typeof o._id === "string" ? o._id : void 0;
46656
+ return { type: o.type, props, _id };
46657
+ }
46751
46658
  function getSlotContentRenderer2() {
46752
46659
  if (_scr) return _scr;
46753
46660
  const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
@@ -46756,17 +46663,16 @@ function getSlotContentRenderer2() {
46756
46663
  }
46757
46664
  function resolveDescriptor(value, idPrefix) {
46758
46665
  if (value === null || value === void 0) return value;
46759
- if (React94__default.isValidElement(value)) return value;
46666
+ if (React96__default.isValidElement(value)) return value;
46760
46667
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
46761
46668
  if (Array.isArray(value)) {
46762
- return value.map((item, i) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
46669
+ return value.map((item, i) => /* @__PURE__ */ jsx(React96__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
46763
46670
  }
46764
- if (typeof value === "object") {
46765
- const rec = value;
46766
- if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
46767
- const { type, props: nestedProps, _id, ...flatProps } = rec;
46768
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46769
- const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
46671
+ if (typeof value === "object" && value !== null) {
46672
+ const desc = asDescriptor(value);
46673
+ if (desc !== null && getComponentForPattern(desc.type) !== null) {
46674
+ const resolvedProps = desc.props ?? {};
46675
+ const content = { id: desc._id ?? idPrefix, pattern: desc.type, props: resolvedProps, priority: 0 };
46770
46676
  const SCR = getSlotContentRenderer2();
46771
46677
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
46772
46678
  }
@@ -46860,16 +46766,19 @@ function getSlotContentRenderer3() {
46860
46766
  }
46861
46767
  function resolveDescriptor2(value, idPrefix) {
46862
46768
  if (value === null || value === void 0) return value;
46863
- if (React94__default.isValidElement(value)) return value;
46769
+ if (React96__default.isValidElement(value)) return value;
46864
46770
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
46865
46771
  if (Array.isArray(value)) {
46866
- return value.map((item, i) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
46772
+ return value.map((item, i) => /* @__PURE__ */ jsx(React96__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
46867
46773
  }
46868
46774
  if (typeof value === "object") {
46869
46775
  const rec = value;
46870
46776
  if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
46871
- const { type, props: nestedProps, _id, ...flatProps } = rec;
46872
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46777
+ const type = rec.type;
46778
+ const _id = typeof rec._id === "string" ? rec._id : void 0;
46779
+ const nestedProps = rec.props !== void 0 && typeof rec.props === "object" && !Array.isArray(rec.props) && rec.props !== null ? rec.props : void 0;
46780
+ const { type: _t, props: _p, _id: _d, ...flatRest } = rec;
46781
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatRest;
46873
46782
  const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
46874
46783
  const SCR = getSlotContentRenderer3();
46875
46784
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
@@ -47573,7 +47482,7 @@ var init_List = __esm({
47573
47482
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
47574
47483
  return [];
47575
47484
  }, [entity]);
47576
- const getItemActions = React94__default.useCallback(
47485
+ const getItemActions = React96__default.useCallback(
47577
47486
  (item) => {
47578
47487
  if (!itemActions) return [];
47579
47488
  if (typeof itemActions === "function") {
@@ -47630,15 +47539,14 @@ var init_List = __esm({
47630
47539
  };
47631
47540
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
47632
47541
  const firstField = effectiveFieldNames[0];
47633
- const itemRecord = item;
47634
- if (!normalizedItem.title && getNestedValue(itemRecord, firstField)) {
47542
+ if (!normalizedItem.title && getNestedValue(item, firstField)) {
47635
47543
  normalizedItem.title = String(
47636
- getNestedValue(itemRecord, firstField)
47544
+ getNestedValue(item, firstField)
47637
47545
  );
47638
47546
  }
47639
47547
  normalizedItem._fields = effectiveFieldNames.reduce(
47640
47548
  (acc, field) => {
47641
- const value = getNestedValue(itemRecord, field);
47549
+ const value = getNestedValue(item, field);
47642
47550
  if (value !== void 0 && value !== null) {
47643
47551
  acc[field] = value;
47644
47552
  }
@@ -48091,16 +47999,18 @@ var init_MediaGallery = __esm({
48091
47999
  [selectable, selectedItems, selectionEvent, eventBus]
48092
48000
  );
48093
48001
  const entityData = Array.isArray(entity) ? entity : [];
48094
- const items = React94__default.useMemo(() => {
48002
+ const items = React96__default.useMemo(() => {
48095
48003
  if (propItems) return propItems;
48096
48004
  if (entityData.length === 0) return [];
48097
- return entityData.map((record, idx) => ({
48098
- id: String(record.id ?? idx),
48099
- src: String(record.src ?? record.url ?? record.image ?? ""),
48100
- alt: record.alt ? String(record.alt) : void 0,
48101
- thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
48102
- caption: record.caption ? String(record.caption) : record.title ? String(record.title) : void 0
48103
- }));
48005
+ return entityData.map((record, idx) => {
48006
+ return {
48007
+ id: String(record.id ?? idx),
48008
+ src: String(record.src ?? ("url" in record ? record.url : "") ?? ("image" in record ? record.image : "") ?? ""),
48009
+ alt: record.alt ? String(record.alt) : void 0,
48010
+ thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
48011
+ caption: record.caption ? String(record.caption) : "title" in record ? String(record.title) : void 0
48012
+ };
48013
+ });
48104
48014
  }, [propItems, entityData]);
48105
48015
  if (isLoading) {
48106
48016
  return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
@@ -48294,7 +48204,7 @@ var init_MinigolfBoard = __esm({
48294
48204
  }
48295
48205
  });
48296
48206
  function extractTitle2(children) {
48297
- if (!React94__default.isValidElement(children)) return void 0;
48207
+ if (!React96__default.isValidElement(children)) return void 0;
48298
48208
  const props = children.props;
48299
48209
  if (typeof props.title === "string") {
48300
48210
  return props.title;
@@ -48360,8 +48270,16 @@ function NegotiatorBoard({
48360
48270
  const lastPlayerAction = str(resolved?.lastPlayerAction);
48361
48271
  const lastOpponentAction = str(resolved?.lastOpponentAction);
48362
48272
  const lastPayoff = num(resolved?.lastPayoff);
48363
- const actions = Array.isArray(resolved?.actions) ? resolved.actions : [];
48364
- const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix : [];
48273
+ const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
48274
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
48275
+ return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
48276
+ return [];
48277
+ }) : [];
48278
+ const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
48279
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
48280
+ return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
48281
+ return [];
48282
+ }) : [];
48365
48283
  const prevRoundRef = useRef(currentRound);
48366
48284
  useEffect(() => {
48367
48285
  if (currentRound > prevRoundRef.current && lastPlayerAction) {
@@ -49487,7 +49405,7 @@ var init_debugRegistry = __esm({
49487
49405
  }
49488
49406
  });
49489
49407
  function useDebugData() {
49490
- const [data, setData] = React94.useState(() => ({
49408
+ const [data, setData] = React96.useState(() => ({
49491
49409
  traits: [],
49492
49410
  ticks: [],
49493
49411
  guards: [],
@@ -49501,7 +49419,7 @@ function useDebugData() {
49501
49419
  },
49502
49420
  lastUpdate: Date.now()
49503
49421
  }));
49504
- React94.useEffect(() => {
49422
+ React96.useEffect(() => {
49505
49423
  const updateData = () => {
49506
49424
  setData({
49507
49425
  traits: getAllTraits(),
@@ -49610,12 +49528,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
49610
49528
  return positions;
49611
49529
  }
49612
49530
  function WalkMinimap() {
49613
- const [walkStep, setWalkStep] = React94.useState(null);
49614
- const [traits2, setTraits] = React94.useState([]);
49615
- const [coveredEdges, setCoveredEdges] = React94.useState([]);
49616
- const [completedTraits, setCompletedTraits] = React94.useState(/* @__PURE__ */ new Set());
49617
- const prevTraitRef = React94.useRef(null);
49618
- React94.useEffect(() => {
49531
+ const [walkStep, setWalkStep] = React96.useState(null);
49532
+ const [traits2, setTraits] = React96.useState([]);
49533
+ const [coveredEdges, setCoveredEdges] = React96.useState([]);
49534
+ const [completedTraits, setCompletedTraits] = React96.useState(/* @__PURE__ */ new Set());
49535
+ const prevTraitRef = React96.useRef(null);
49536
+ React96.useEffect(() => {
49619
49537
  const interval = setInterval(() => {
49620
49538
  const w = window;
49621
49539
  const step = w.__orbitalWalkStep;
@@ -50051,15 +49969,15 @@ var init_EntitiesTab = __esm({
50051
49969
  });
50052
49970
  function EventFlowTab({ events: events2 }) {
50053
49971
  const { t } = useTranslate();
50054
- const [filter, setFilter] = React94.useState("all");
50055
- const containerRef = React94.useRef(null);
50056
- const [autoScroll, setAutoScroll] = React94.useState(true);
50057
- React94.useEffect(() => {
49972
+ const [filter, setFilter] = React96.useState("all");
49973
+ const containerRef = React96.useRef(null);
49974
+ const [autoScroll, setAutoScroll] = React96.useState(true);
49975
+ React96.useEffect(() => {
50058
49976
  if (autoScroll && containerRef.current) {
50059
49977
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
50060
49978
  }
50061
49979
  }, [events2.length, autoScroll]);
50062
- const filteredEvents = React94.useMemo(() => {
49980
+ const filteredEvents = React96.useMemo(() => {
50063
49981
  if (filter === "all") return events2;
50064
49982
  return events2.filter((e) => e.type === filter);
50065
49983
  }, [events2, filter]);
@@ -50175,7 +50093,7 @@ var init_EventFlowTab = __esm({
50175
50093
  });
50176
50094
  function GuardsPanel({ guards }) {
50177
50095
  const { t } = useTranslate();
50178
- const [filter, setFilter] = React94.useState("all");
50096
+ const [filter, setFilter] = React96.useState("all");
50179
50097
  if (guards.length === 0) {
50180
50098
  return /* @__PURE__ */ jsx(
50181
50099
  EmptyState,
@@ -50188,7 +50106,7 @@ function GuardsPanel({ guards }) {
50188
50106
  }
50189
50107
  const passedCount = guards.filter((g) => g.result).length;
50190
50108
  const failedCount = guards.length - passedCount;
50191
- const filteredGuards = React94.useMemo(() => {
50109
+ const filteredGuards = React96.useMemo(() => {
50192
50110
  if (filter === "all") return guards;
50193
50111
  if (filter === "passed") return guards.filter((g) => g.result);
50194
50112
  return guards.filter((g) => !g.result);
@@ -50351,10 +50269,10 @@ function EffectBadge({ effect }) {
50351
50269
  }
50352
50270
  function TransitionTimeline({ transitions }) {
50353
50271
  const { t } = useTranslate();
50354
- const containerRef = React94.useRef(null);
50355
- const [autoScroll, setAutoScroll] = React94.useState(true);
50356
- const [expandedId, setExpandedId] = React94.useState(null);
50357
- React94.useEffect(() => {
50272
+ const containerRef = React96.useRef(null);
50273
+ const [autoScroll, setAutoScroll] = React96.useState(true);
50274
+ const [expandedId, setExpandedId] = React96.useState(null);
50275
+ React96.useEffect(() => {
50358
50276
  if (autoScroll && containerRef.current) {
50359
50277
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
50360
50278
  }
@@ -50560,18 +50478,18 @@ var init_ServerBridgeTab = __esm({
50560
50478
  });
50561
50479
  function extractPayloadFields(schema, eventName) {
50562
50480
  if (!schema) return [];
50563
- const orbitals = schema.orbitals;
50564
- if (!orbitals) return [];
50565
- for (const orbital of orbitals) {
50566
- const traits2 = orbital.traits ?? [];
50567
- for (const trait of traits2) {
50568
- const sm = trait.stateMachine;
50481
+ for (const orbital of schema.orbitals) {
50482
+ const traitRefs = orbital.traits ?? [];
50483
+ for (const traitRef of traitRefs) {
50484
+ if (!isInlineTrait(traitRef)) continue;
50485
+ const inlineTrait = traitRef;
50486
+ const sm = inlineTrait.stateMachine;
50569
50487
  if (!sm) continue;
50570
50488
  const events2 = sm.events ?? [];
50571
50489
  for (const evt of events2) {
50572
50490
  if (evt.name !== eventName) continue;
50573
- const payload = evt.payload ?? [];
50574
- return payload.map((f3) => ({
50491
+ const payloadFields = evt.payloadSchema ?? [];
50492
+ return payloadFields.map((f3) => ({
50575
50493
  name: f3.name,
50576
50494
  type: f3.type ?? "string"
50577
50495
  }));
@@ -50634,9 +50552,9 @@ function getAllEvents(traits2) {
50634
50552
  function EventDispatcherTab({ traits: traits2, schema }) {
50635
50553
  const eventBus = useEventBus();
50636
50554
  const { t } = useTranslate();
50637
- const [log15, setLog] = React94.useState([]);
50638
- const prevStatesRef = React94.useRef(/* @__PURE__ */ new Map());
50639
- React94.useEffect(() => {
50555
+ const [log15, setLog] = React96.useState([]);
50556
+ const prevStatesRef = React96.useRef(/* @__PURE__ */ new Map());
50557
+ React96.useEffect(() => {
50640
50558
  for (const trait of traits2) {
50641
50559
  const prev = prevStatesRef.current.get(trait.id);
50642
50560
  if (prev && prev !== trait.currentState) {
@@ -50805,10 +50723,10 @@ function VerifyModePanel({
50805
50723
  localCount
50806
50724
  }) {
50807
50725
  const { t } = useTranslate();
50808
- const [expanded, setExpanded] = React94.useState(true);
50809
- const scrollRef = React94.useRef(null);
50810
- const prevCountRef = React94.useRef(0);
50811
- React94.useEffect(() => {
50726
+ const [expanded, setExpanded] = React96.useState(true);
50727
+ const scrollRef = React96.useRef(null);
50728
+ const prevCountRef = React96.useRef(0);
50729
+ React96.useEffect(() => {
50812
50730
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
50813
50731
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
50814
50732
  }
@@ -50865,10 +50783,10 @@ function RuntimeDebugger({
50865
50783
  schema
50866
50784
  }) {
50867
50785
  const { t } = useTranslate();
50868
- const [isCollapsed, setIsCollapsed] = React94.useState(mode === "verify" ? true : defaultCollapsed);
50869
- const [isVisible, setIsVisible] = React94.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
50786
+ const [isCollapsed, setIsCollapsed] = React96.useState(mode === "verify" ? true : defaultCollapsed);
50787
+ const [isVisible, setIsVisible] = React96.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
50870
50788
  const debugData = useDebugData();
50871
- React94.useEffect(() => {
50789
+ React96.useEffect(() => {
50872
50790
  if (mode === "inline") return;
50873
50791
  return onDebugToggle((enabled) => {
50874
50792
  setIsVisible(enabled);
@@ -50877,7 +50795,7 @@ function RuntimeDebugger({
50877
50795
  }
50878
50796
  });
50879
50797
  }, [mode]);
50880
- React94.useEffect(() => {
50798
+ React96.useEffect(() => {
50881
50799
  if (mode === "inline") return;
50882
50800
  const handleKeyDown = (e) => {
50883
50801
  if (e.key === "`" && isVisible) {
@@ -51437,7 +51355,7 @@ function SequenceBar({
51437
51355
  onSlotRemove(index);
51438
51356
  }, [onSlotRemove, playing]);
51439
51357
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
51440
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
51358
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
51441
51359
  i > 0 && /* @__PURE__ */ jsx(
51442
51360
  Typography,
51443
51361
  {
@@ -52052,6 +51970,29 @@ var init_SimulationCanvas = __esm({
52052
51970
  SimulationCanvas.displayName = "SimulationCanvas";
52053
51971
  }
52054
51972
  });
51973
+ function readSimulatorParameters(v) {
51974
+ if (!Array.isArray(v)) return [];
51975
+ const result = [];
51976
+ for (const item of v) {
51977
+ if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
51978
+ const param = item;
51979
+ if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
51980
+ result.push({
51981
+ id: str(param.id),
51982
+ label: str(param.label),
51983
+ unit: str(param.unit),
51984
+ min: num(param.min),
51985
+ max: num(param.max),
51986
+ step: num(param.step),
51987
+ initial: num(param.initial),
51988
+ correct: num(param.correct),
51989
+ tolerance: num(param.tolerance)
51990
+ });
51991
+ }
51992
+ }
51993
+ }
51994
+ return result;
51995
+ }
52055
51996
  function SimulatorBoard({
52056
51997
  entity,
52057
51998
  completeEvent = "PUZZLE_COMPLETE",
@@ -52064,7 +52005,7 @@ function SimulatorBoard({
52064
52005
  const { emit } = useEventBus();
52065
52006
  const { t } = useTranslate();
52066
52007
  const resolved = boardEntity(entity);
52067
- const parameters = Array.isArray(resolved?.parameters) ? resolved.parameters : [];
52008
+ const parameters = readSimulatorParameters(resolved?.parameters);
52068
52009
  const [headerError, setHeaderError] = useState(false);
52069
52010
  if (!resolved) return null;
52070
52011
  const paramA = num(resolved.paramA);
@@ -52091,8 +52032,14 @@ function SimulatorBoard({
52091
52032
  const handlePlayAgain = () => {
52092
52033
  if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
52093
52034
  };
52094
- const theme = resolved.theme ?? void 0;
52095
- const themeBackground = theme?.background;
52035
+ const themeBackground = (() => {
52036
+ const t2 = resolved.theme;
52037
+ if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
52038
+ const bg = t2.background;
52039
+ return str(bg);
52040
+ }
52041
+ return "";
52042
+ })();
52096
52043
  const headerImage = str(resolved.headerImage);
52097
52044
  const hint = str(resolved.hint);
52098
52045
  const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
@@ -52497,7 +52444,7 @@ var init_StatCard = __esm({
52497
52444
  const labelToUse = propLabel ?? propTitle;
52498
52445
  const eventBus = useEventBus();
52499
52446
  const { t } = useTranslate();
52500
- const handleActionClick = React94__default.useCallback(() => {
52447
+ const handleActionClick = React96__default.useCallback(() => {
52501
52448
  if (action?.event) {
52502
52449
  eventBus.emit(`UI:${action.event}`, {});
52503
52450
  }
@@ -52508,7 +52455,7 @@ var init_StatCard = __esm({
52508
52455
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
52509
52456
  const isLoading = externalLoading ?? false;
52510
52457
  const error = externalError;
52511
- const computeMetricValue = React94__default.useCallback(
52458
+ const computeMetricValue = React96__default.useCallback(
52512
52459
  (metric, items) => {
52513
52460
  if (metric.value !== void 0) {
52514
52461
  return metric.value;
@@ -52547,7 +52494,7 @@ var init_StatCard = __esm({
52547
52494
  },
52548
52495
  []
52549
52496
  );
52550
- const schemaStats = React94__default.useMemo(() => {
52497
+ const schemaStats = React96__default.useMemo(() => {
52551
52498
  if (!metrics || metrics.length === 0) return null;
52552
52499
  return metrics.map((metric) => ({
52553
52500
  label: metric.label,
@@ -52555,7 +52502,7 @@ var init_StatCard = __esm({
52555
52502
  format: metric.format
52556
52503
  }));
52557
52504
  }, [metrics, data, computeMetricValue]);
52558
- const calculatedTrend = React94__default.useMemo(() => {
52505
+ const calculatedTrend = React96__default.useMemo(() => {
52559
52506
  if (manualTrend !== void 0) return manualTrend;
52560
52507
  if (previousValue === void 0 || currentValue === void 0)
52561
52508
  return void 0;
@@ -52898,8 +52845,25 @@ function StateArchitectBoard({
52898
52845
  const initialState = str(resolved?.initialState);
52899
52846
  const entityName = str(resolved?.entityName);
52900
52847
  const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
52901
- const testCases = Array.isArray(resolved?.testCases) ? resolved.testCases : [];
52902
- const entityTransitions = Array.isArray(resolved?.transitions) ? resolved.transitions : [];
52848
+ const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
52849
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
52850
+ const eventsField = o["events"];
52851
+ return {
52852
+ events: Array.isArray(eventsField) ? eventsField : [],
52853
+ expectedState: str(o["expectedState"]),
52854
+ label: str(o["label"])
52855
+ };
52856
+ });
52857
+ const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
52858
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
52859
+ return {
52860
+ id: str(o["id"]),
52861
+ from: str(o["from"]),
52862
+ to: str(o["to"]),
52863
+ event: str(o["event"]),
52864
+ ...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
52865
+ };
52866
+ });
52903
52867
  const entityVariables = rows(resolved?.variables);
52904
52868
  const transitions = entityTransitions;
52905
52869
  const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
@@ -53744,8 +53708,8 @@ var init_SubagentTracePanel = __esm({
53744
53708
  ] });
53745
53709
  };
53746
53710
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
53747
- const endRef = React94__default.useRef(null);
53748
- React94__default.useEffect(() => {
53711
+ const endRef = React96__default.useRef(null);
53712
+ React96__default.useEffect(() => {
53749
53713
  if (!autoScroll) return;
53750
53714
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
53751
53715
  }, [activities.length, autoScroll]);
@@ -53839,7 +53803,7 @@ var init_SubagentTracePanel = __esm({
53839
53803
  };
53840
53804
  SubagentRichCard = ({ subagent }) => {
53841
53805
  const { t } = useTranslate();
53842
- const activities = React94__default.useMemo(
53806
+ const activities = React96__default.useMemo(
53843
53807
  () => subagentMessagesToActivities(subagent.messages),
53844
53808
  [subagent.messages]
53845
53809
  );
@@ -53916,8 +53880,8 @@ var init_SubagentTracePanel = __esm({
53916
53880
  ] });
53917
53881
  };
53918
53882
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
53919
- const endRef = React94__default.useRef(null);
53920
- React94__default.useEffect(() => {
53883
+ const endRef = React96__default.useRef(null);
53884
+ React96__default.useEffect(() => {
53921
53885
  if (!autoScroll) return;
53922
53886
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
53923
53887
  }, [messages.length, autoScroll]);
@@ -54388,17 +54352,12 @@ var init_Timeline = __esm({
54388
54352
  look = "vertical-spacious"
54389
54353
  }) => {
54390
54354
  const { t } = useTranslate();
54391
- const entityData = Array.isArray(entity) ? entity : [];
54392
- const items = React94__default.useMemo(() => {
54355
+ const entityData = entity ?? [];
54356
+ const items = React96__default.useMemo(() => {
54393
54357
  if (propItems) return propItems;
54394
54358
  if (entityData.length === 0) return [];
54395
54359
  return entityData.map((record, idx) => {
54396
- const resolveField = (f3) => {
54397
- if (typeof f3 === "string") return f3;
54398
- if (f3 && typeof f3 === "object" && "name" in f3) return String(f3.name);
54399
- return "";
54400
- };
54401
- const resolvedFields = fields?.map(resolveField) ?? [];
54360
+ const resolvedFields = fields ?? [];
54402
54361
  const titleField = resolvedFields[0] || "title";
54403
54362
  const descField = resolvedFields[1] || "description";
54404
54363
  const dateField = resolvedFields.find(
@@ -54496,7 +54455,7 @@ var init_Timeline = __esm({
54496
54455
  }
54497
54456
  });
54498
54457
  function extractToastProps(children) {
54499
- if (!React94__default.isValidElement(children)) {
54458
+ if (!React96__default.isValidElement(children)) {
54500
54459
  if (typeof children === "string") {
54501
54460
  return { message: children };
54502
54461
  }
@@ -54534,7 +54493,7 @@ var init_ToastSlot = __esm({
54534
54493
  eventBus.emit("UI:CLOSE");
54535
54494
  };
54536
54495
  if (!isVisible) return null;
54537
- const isCustomContent = React94__default.isValidElement(children) && !message;
54496
+ const isCustomContent = React96__default.isValidElement(children) && !message;
54538
54497
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
54539
54498
  Toast,
54540
54499
  {
@@ -55806,7 +55765,7 @@ function WorldMapBoard({
55806
55765
  const resolved = boardEntity(entity);
55807
55766
  const entityUnits = rows(resolved?.units);
55808
55767
  const entityTiles = rows(resolved?.tiles);
55809
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
55768
+ const features = propFeatures ?? rows(resolved?.features);
55810
55769
  const selectedHeroId = resolved?.selectedHeroId ?? null;
55811
55770
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
55812
55771
  const backgroundImage = resolved?.backgroundImage;
@@ -55939,7 +55898,8 @@ function WorldMapBoard({
55939
55898
  if (heroMoveEvent) {
55940
55899
  eventBus.emit(`UI:${heroMoveEvent}`, { heroId, toX: x, toY: y });
55941
55900
  }
55942
- const feature = tile ? str(tile.feature) : "";
55901
+ const tileWithFeature = tile;
55902
+ const feature = tileWithFeature ? str(tileWithFeature.feature) : "";
55943
55903
  if (feature && feature !== "none") {
55944
55904
  const tileRow = tile;
55945
55905
  onFeatureEnter?.(heroId, tileRow);
@@ -56150,7 +56110,7 @@ var init_WorldMapTemplate = __esm({
56150
56110
  }
56151
56111
  });
56152
56112
  function lazyThree(name, loader) {
56153
- const Lazy = React94__default.lazy(
56113
+ const Lazy = React96__default.lazy(
56154
56114
  () => loader().then((m) => {
56155
56115
  const Resolved = m[name];
56156
56116
  if (!Resolved) {
@@ -56162,13 +56122,13 @@ function lazyThree(name, loader) {
56162
56122
  })
56163
56123
  );
56164
56124
  function ThreeWrapper(props) {
56165
- return React94__default.createElement(
56125
+ return React96__default.createElement(
56166
56126
  ThreeBoundary,
56167
56127
  { name },
56168
- React94__default.createElement(
56169
- React94__default.Suspense,
56128
+ React96__default.createElement(
56129
+ React96__default.Suspense,
56170
56130
  { fallback: null },
56171
- React94__default.createElement(Lazy, props)
56131
+ React96__default.createElement(Lazy, props)
56172
56132
  )
56173
56133
  );
56174
56134
  }
@@ -56491,7 +56451,7 @@ var init_component_registry_generated = __esm({
56491
56451
  init_WorldMapBoard();
56492
56452
  init_WorldMapTemplate();
56493
56453
  init_XPBar();
56494
- ThreeBoundary = class extends React94__default.Component {
56454
+ ThreeBoundary = class extends React96__default.Component {
56495
56455
  constructor() {
56496
56456
  super(...arguments);
56497
56457
  __publicField(this, "state", { failed: false });
@@ -56501,7 +56461,7 @@ var init_component_registry_generated = __esm({
56501
56461
  }
56502
56462
  render() {
56503
56463
  if (this.state.failed) {
56504
- return React94__default.createElement(
56464
+ return React96__default.createElement(
56505
56465
  "div",
56506
56466
  {
56507
56467
  "data-testid": "three-unavailable",
@@ -56867,7 +56827,7 @@ function SuspenseConfigProvider({
56867
56827
  config,
56868
56828
  children
56869
56829
  }) {
56870
- return React94__default.createElement(
56830
+ return React96__default.createElement(
56871
56831
  SuspenseConfigContext.Provider,
56872
56832
  { value: config },
56873
56833
  children
@@ -56883,9 +56843,7 @@ function getComponentForPattern3(patternType) {
56883
56843
  if (!mapping) {
56884
56844
  return null;
56885
56845
  }
56886
- const name = typeof mapping === "string" ? mapping : mapping.component;
56887
- if (!name) return null;
56888
- return COMPONENT_REGISTRY[name] ?? null;
56846
+ return COMPONENT_REGISTRY[mapping] ?? null;
56889
56847
  }
56890
56848
  function enrichFormFields(fields, entityDef) {
56891
56849
  const fieldMap = new Map(entityDef.fields.map((f3) => [f3.name, f3]));
@@ -56897,7 +56855,7 @@ function enrichFormFields(fields, entityDef) {
56897
56855
  name: field,
56898
56856
  label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
56899
56857
  type: entityField.type,
56900
- required: entityField.required
56858
+ required: entityField.required ?? false
56901
56859
  };
56902
56860
  if (entityField.values && entityField.values.length > 0) {
56903
56861
  enriched.values = entityField.values;
@@ -56905,15 +56863,15 @@ function enrichFormFields(fields, entityDef) {
56905
56863
  enriched.values = entityField.enumValues;
56906
56864
  }
56907
56865
  if (entityField.relation) {
56908
- enriched.relation = entityField.relation;
56866
+ enriched.relation = entityField.relation.entity;
56909
56867
  }
56910
56868
  return enriched;
56911
56869
  }
56912
56870
  return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
56913
56871
  }
56914
- if (field && typeof field === "object" && !Array.isArray(field)) {
56872
+ if (field && typeof field === "object" && !Array.isArray(field) && !React96__default.isValidElement(field) && !(field instanceof Date)) {
56915
56873
  const obj = field;
56916
- const fieldName = obj.name ?? obj.field;
56874
+ const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
56917
56875
  if (!fieldName) return field;
56918
56876
  if (obj.type || obj.inputType) return field;
56919
56877
  const entityField = fieldMap.get(fieldName);
@@ -56930,7 +56888,7 @@ function enrichFormFields(fields, entityDef) {
56930
56888
  }
56931
56889
  }
56932
56890
  if (!obj.relation && entityField.relation) {
56933
- enriched.relation = entityField.relation;
56891
+ enriched.relation = entityField.relation.entity;
56934
56892
  }
56935
56893
  return enriched;
56936
56894
  }
@@ -57357,7 +57315,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
57357
57315
  const key = `${parentId}-${index}-trait:${traitName}`;
57358
57316
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
57359
57317
  }
57360
- return /* @__PURE__ */ jsx(React94__default.Fragment, { children: child }, `${parentId}-${index}`);
57318
+ return /* @__PURE__ */ jsx(React96__default.Fragment, { children: child }, `${parentId}-${index}`);
57361
57319
  }
57362
57320
  if (!child || typeof child !== "object") return null;
57363
57321
  const childId = `${parentId}-${index}`;
@@ -57397,14 +57355,14 @@ function isPatternConfig(value) {
57397
57355
  if (value === null || value === void 0) return false;
57398
57356
  if (typeof value !== "object") return false;
57399
57357
  if (Array.isArray(value)) return false;
57400
- if (React94__default.isValidElement(value)) return false;
57358
+ if (React96__default.isValidElement(value)) return false;
57401
57359
  if (value instanceof Date) return false;
57402
57360
  if (typeof value === "function") return false;
57403
57361
  const record = value;
57404
57362
  return "type" in record && typeof record.type === "string" && getComponentForPattern(record.type) !== null;
57405
57363
  }
57406
57364
  function isPlainConfigObject(value) {
57407
- if (React94__default.isValidElement(value)) return false;
57365
+ if (React96__default.isValidElement(value)) return false;
57408
57366
  if (value instanceof Date) return false;
57409
57367
  const proto = Object.getPrototypeOf(value);
57410
57368
  return proto === Object.prototype || proto === null;
@@ -57530,7 +57488,7 @@ function SlotContentRenderer({
57530
57488
  for (const slotKey of CONTENT_NODE_SLOTS) {
57531
57489
  const slotVal = restProps[slotKey];
57532
57490
  if (slotVal === void 0 || slotVal === null) continue;
57533
- if (React94__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
57491
+ if (React96__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
57534
57492
  if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
57535
57493
  nodeSlotOverrides[slotKey] = renderPatternChildren(
57536
57494
  slotVal,
@@ -57575,19 +57533,18 @@ function SlotContentRenderer({
57575
57533
  for (const [k, v] of Object.entries(nodeSlotOverrides)) {
57576
57534
  finalProps[k] = v;
57577
57535
  }
57578
- const resolvedItems = Array.isArray(
57579
- finalProps.entity
57580
- ) ? finalProps.entity : null;
57536
+ const entityVal = finalProps.entity;
57537
+ const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
57581
57538
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
57582
57539
  const sample = resolvedItems[0];
57583
- if (sample && typeof sample === "object") {
57540
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React96__default.isValidElement(sample) && !(sample instanceof Date)) {
57584
57541
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
57585
57542
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
57586
57543
  }
57587
57544
  }
57588
57545
  const isFormPattern = FORM_PATTERNS.has(content.pattern) || content.pattern.includes("form");
57589
- if (isFormPattern && entityDef && Array.isArray(finalProps.fields)) {
57590
- finalProps.fields = enrichFormFields(finalProps.fields, entityDef);
57546
+ if (isFormPattern && entityDef && Array.isArray(finalProps.fields) && finalProps.fields[0] !== "fn") {
57547
+ finalProps.fields = enrichFormFields([...finalProps.fields], entityDef);
57591
57548
  }
57592
57549
  const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
57593
57550
  return /* @__PURE__ */ jsx(
@@ -57943,7 +57900,7 @@ var AvlTransition = ({
57943
57900
  opacity = 1,
57944
57901
  className
57945
57902
  }) => {
57946
- const ids = React94__default.useMemo(() => {
57903
+ const ids = React96__default.useMemo(() => {
57947
57904
  avlTransitionId += 1;
57948
57905
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
57949
57906
  }, []);
@@ -58504,7 +58461,7 @@ var AvlStateMachine = ({
58504
58461
  color = "var(--color-primary)",
58505
58462
  animated = false
58506
58463
  }) => {
58507
- const ids = React94__default.useMemo(() => {
58464
+ const ids = React96__default.useMemo(() => {
58508
58465
  avlSmId += 1;
58509
58466
  const base = `avl-sm-${avlSmId}`;
58510
58467
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -58703,7 +58660,7 @@ var AvlOrbitalUnit = ({
58703
58660
  color = "var(--color-primary)",
58704
58661
  animated = false
58705
58662
  }) => {
58706
- const ids = React94__default.useMemo(() => {
58663
+ const ids = React96__default.useMemo(() => {
58707
58664
  avlOuId += 1;
58708
58665
  const base = `avl-ou-${avlOuId}`;
58709
58666
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -58799,7 +58756,7 @@ var AvlClosedCircuit = ({
58799
58756
  color = "var(--color-primary)",
58800
58757
  animated = false
58801
58758
  }) => {
58802
- const ids = React94__default.useMemo(() => {
58759
+ const ids = React96__default.useMemo(() => {
58803
58760
  avlCcId += 1;
58804
58761
  const base = `avl-cc-${avlCcId}`;
58805
58762
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -58954,7 +58911,7 @@ var AvlEmitListen = ({
58954
58911
  color = "var(--color-primary)",
58955
58912
  animated = false
58956
58913
  }) => {
58957
- const ids = React94__default.useMemo(() => {
58914
+ const ids = React96__default.useMemo(() => {
58958
58915
  avlElId += 1;
58959
58916
  const base = `avl-el-${avlElId}`;
58960
58917
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -59228,7 +59185,7 @@ function renderNode(node, color, glowId) {
59228
59185
  const baseR = node.type === "operator" ? 20 : 16;
59229
59186
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
59230
59187
  const nc = nodeColor(node.type, color);
59231
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
59188
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
59232
59189
  node.children.map((child, i) => {
59233
59190
  const childR = Math.max(
59234
59191
  child.type === "operator" ? 20 : 16,
@@ -59285,7 +59242,7 @@ var AvlExprTree = ({
59285
59242
  className,
59286
59243
  color = "var(--color-primary)"
59287
59244
  }) => {
59288
- const ids = React94__default.useMemo(() => {
59245
+ const ids = React96__default.useMemo(() => {
59289
59246
  avlEtId += 1;
59290
59247
  return { glow: `avl-et-${avlEtId}-glow` };
59291
59248
  }, []);
@@ -59750,9 +59707,17 @@ function getEntity(orbital) {
59750
59707
  if (typeof entity === "string") {
59751
59708
  return { name: entity, fields: [], persistence: "runtime" };
59752
59709
  }
59710
+ if ("extends" in entity) {
59711
+ const ec = entity;
59712
+ return {
59713
+ name: ec.name ?? orbital.name,
59714
+ fields: ec.fields ?? [],
59715
+ persistence: ec.persistence ?? "runtime"
59716
+ };
59717
+ }
59753
59718
  const e = entity;
59754
59719
  return {
59755
- name: e.name ?? orbital.name,
59720
+ name: e.name,
59756
59721
  fields: e.fields ?? [],
59757
59722
  persistence: e.persistence ?? "runtime"
59758
59723
  };
@@ -59761,6 +59726,7 @@ function getTraits(orbital) {
59761
59726
  if (!orbital.traits) return [];
59762
59727
  return orbital.traits.map((t) => {
59763
59728
  if (typeof t === "string") return { name: t };
59729
+ if ("ref" in t && !("stateMachine" in t)) return { name: t.name ?? t.ref };
59764
59730
  return t;
59765
59731
  });
59766
59732
  }
@@ -59768,6 +59734,7 @@ function getPages(orbital) {
59768
59734
  if (!orbital.pages) return [];
59769
59735
  return orbital.pages.map((p2) => {
59770
59736
  if (typeof p2 === "string") return { name: p2, path: `/${p2.toLowerCase()}` };
59737
+ if ("ref" in p2 && !("path" in p2)) return { name: p2.ref, path: `/${p2.ref.toLowerCase()}` };
59771
59738
  return p2;
59772
59739
  });
59773
59740
  }
@@ -59786,12 +59753,12 @@ function getEvents(sm) {
59786
59753
  function getEmits(trait) {
59787
59754
  const emits = trait.emits;
59788
59755
  if (!emits) return [];
59789
- return emits.map((e) => typeof e === "string" ? e : e.event ?? e.name ?? "");
59756
+ return emits.map((e) => e.event ?? "");
59790
59757
  }
59791
59758
  function getListens(trait) {
59792
59759
  const listens = trait.listens;
59793
59760
  if (!listens) return [];
59794
- return listens.map((l) => typeof l === "string" ? l : l.event ?? "");
59761
+ return listens.map((l) => l.event ?? "");
59795
59762
  }
59796
59763
  function parseEffectType(effect) {
59797
59764
  if (Array.isArray(effect)) {
@@ -59962,14 +59929,14 @@ function parseTraitLevel(schema, orbitalName, traitName) {
59962
59929
  if (!sm) return null;
59963
59930
  const states = getStates(sm).map((s) => ({
59964
59931
  name: s.name ?? "",
59965
- isInitial: s.isInitial ?? false,
59966
- isTerminal: s.isTerminal ?? false
59932
+ isInitial: s.isInitial ?? null,
59933
+ isTerminal: s.isTerminal ?? null
59967
59934
  }));
59968
59935
  const transitions = getTransitions(sm).map((t, i) => ({
59969
59936
  from: t.from ?? "",
59970
59937
  to: t.to ?? "",
59971
59938
  event: t.event ?? "",
59972
- guard: t.guard,
59939
+ guard: t.guard ?? null,
59973
59940
  effects: (t.effects ?? []).map(parseEffectType),
59974
59941
  index: i
59975
59942
  }));
@@ -59988,13 +59955,14 @@ function parseTransitionLevel(schema, orbitalName, traitName, transitionIndex) {
59988
59955
  if (!traitData) return null;
59989
59956
  const transition = traitData.transitions[transitionIndex];
59990
59957
  if (!transition) return null;
59991
- const guard = transition.guard ? exprToTree(transition.guard) : null;
59958
+ const guardVal = transition.guard;
59959
+ const guard = guardVal != null ? exprToTree(guardVal) : null;
59992
59960
  const effects = transition.effects.map(
59993
59961
  (e) => exprToTree([e.type, ...e.args])
59994
59962
  );
59995
59963
  const slotTargets = transition.effects.filter((e) => e.type === "render-ui").map((e) => ({
59996
59964
  name: String(e.args[0] ?? "main"),
59997
- pattern: typeof e.args[1] === "object" && e.args[1] !== null ? e.args[1].type ?? "unknown" : String(e.args[1] ?? "unknown")
59965
+ pattern: typeof e.args[1] === "object" && e.args[1] !== null && !Array.isArray(e.args[1]) ? e.args[1].type ?? "unknown" : String(e.args[1] ?? "unknown")
59998
59966
  }));
59999
59967
  return {
60000
59968
  from: transition.from,
@@ -60050,8 +60018,8 @@ function schemaToFlowGraph(schema) {
60050
60018
  data: {
60051
60019
  edgeKind: "eventWire",
60052
60020
  event: link.eventName,
60053
- fromTrait: link.emitterTrait,
60054
- toTrait: link.listenerTrait
60021
+ fromTrait: link.emitterTrait ?? null,
60022
+ toTrait: link.listenerTrait ?? null
60055
60023
  }
60056
60024
  });
60057
60025
  }
@@ -60108,9 +60076,9 @@ var SystemNode = ({ data }) => {
60108
60076
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
60109
60077
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
60110
60078
  const tc = transitionCounts[s.name] ?? 0;
60111
- const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
60112
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
60113
- /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
60079
+ const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
60080
+ return /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
60081
+ /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
60114
60082
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
60115
60083
  ] }, s.name);
60116
60084
  }) }),
@@ -60143,17 +60111,17 @@ var DetailView = ({ data }) => {
60143
60111
  transitionCounts[t2.to] = (transitionCounts[t2.to] ?? 0) + 1;
60144
60112
  }
60145
60113
  const maxTC = Math.max(...Object.values(transitionCounts), 0);
60146
- const fromRole = getStateRole(transition.from, fromState?.isInitial, fromState?.isTerminal, transitionCounts[transition.from] ?? 0, maxTC);
60147
- const toRole = getStateRole(transition.to, toState?.isInitial, toState?.isTerminal, transitionCounts[transition.to] ?? 0, maxTC);
60114
+ const fromRole = getStateRole(transition.from, fromState?.isInitial ?? void 0, fromState?.isTerminal ?? void 0, transitionCounts[transition.from] ?? 0, maxTC);
60115
+ const toRole = getStateRole(transition.to, toState?.isInitial ?? void 0, toState?.isTerminal ?? void 0, transitionCounts[transition.to] ?? 0, maxTC);
60148
60116
  const hasGuard = transition.guard != null;
60149
60117
  return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-2 border-[var(--color-border)] bg-[var(--color-card)] overflow-hidden", style: { minWidth: 380, maxWidth: 500 }, children: [
60150
60118
  /* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
60151
- /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.from, role: fromRole, isInitial: fromState?.isInitial, isTerminal: fromState?.isTerminal }) }),
60119
+ /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.from, role: fromRole, isInitial: fromState?.isInitial ?? void 0, isTerminal: fromState?.isTerminal ?? void 0 }) }),
60152
60120
  /* @__PURE__ */ jsxs("svg", { width: 24, height: 16, viewBox: "0 0 24 16", children: [
60153
60121
  /* @__PURE__ */ jsx("line", { x1: 0, y1: 8, x2: 18, y2: 8, stroke: "var(--color-muted-foreground)", strokeWidth: 2 }),
60154
60122
  /* @__PURE__ */ jsx("polygon", { points: "18,4 24,8 18,12", fill: "var(--color-muted-foreground)" })
60155
60123
  ] }),
60156
- /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.to, role: toRole, isInitial: toState?.isInitial, isTerminal: toState?.isTerminal }) })
60124
+ /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.to, role: toRole, isInitial: toState?.isInitial ?? void 0, isTerminal: toState?.isTerminal ?? void 0 }) })
60157
60125
  ] }) }),
60158
60126
  /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 space-y-3", children: [
60159
60127
  /* @__PURE__ */ jsxs("div", { children: [
@@ -60490,7 +60458,7 @@ function getTraits2(orbital) {
60490
60458
  if (!orbital.traits) return [];
60491
60459
  return orbital.traits.map((t) => {
60492
60460
  if (typeof t === "string") return { name: t };
60493
- if ("ref" in t) return { name: t.ref };
60461
+ if (typeof t === "object" && t !== null && "ref" in t) return { name: t.ref };
60494
60462
  return t;
60495
60463
  });
60496
60464
  }
@@ -60519,8 +60487,8 @@ function getPages2(orbital) {
60519
60487
  if (!orbital.pages) return [];
60520
60488
  return orbital.pages.map((p2) => {
60521
60489
  if (typeof p2 === "string") return `/${p2.toLowerCase()}`;
60522
- const po = p2;
60523
- return po.path ?? `/${po.name ?? ""}`.toLowerCase();
60490
+ if ("ref" in p2) return p2.path ?? `/${p2.ref}`.toLowerCase();
60491
+ return p2.path ?? `/${p2.name}`.toLowerCase();
60524
60492
  });
60525
60493
  }
60526
60494
  function getEmits2(trait) {
@@ -60537,13 +60505,11 @@ function extractRenderUI(effects) {
60537
60505
  const patterns = [];
60538
60506
  for (const eff of effects) {
60539
60507
  if (!Array.isArray(eff)) continue;
60540
- const [type, ...args] = eff;
60541
- if (type === "render-ui" && args.length >= 2) {
60542
- const slot = args[0];
60543
- const pattern = args[1];
60544
- if (pattern !== null && pattern !== void 0 && typeof pattern === "object") {
60545
- patterns.push({ slot, pattern });
60546
- }
60508
+ if (eff[0] !== "render-ui" || eff.length < 3) continue;
60509
+ const slot = eff[1];
60510
+ const pattern = eff[2];
60511
+ if (pattern !== null && pattern !== void 0 && typeof pattern === "object" && !Array.isArray(pattern)) {
60512
+ patterns.push({ slot, pattern });
60547
60513
  }
60548
60514
  }
60549
60515
  return patterns;
@@ -60560,14 +60526,14 @@ function extractEffectTypes(effects) {
60560
60526
  function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, siblingIndex = 0) {
60561
60527
  const sources = [];
60562
60528
  if (depth > 10) return sources;
60563
- const patternType = config.type;
60564
- const event = config.event;
60565
- if (patternType && event && typeof event === "string") {
60529
+ const patternType = typeof config.type === "string" ? config.type : void 0;
60530
+ const event = typeof config.event === "string" ? config.event : void 0;
60531
+ if (patternType && event) {
60566
60532
  const positionHint = totalSiblings > 1 ? (siblingIndex + 0.5) / totalSiblings : 0.5 + depth * 0.1;
60567
60533
  sources.push({
60568
60534
  event,
60569
60535
  patternType,
60570
- label: config.label ?? config.content ?? config.text,
60536
+ label: typeof config.label === "string" ? config.label : typeof config.content === "string" ? config.content : typeof config.text === "string" ? config.text : void 0,
60571
60537
  path,
60572
60538
  positionHint: Math.min(Math.max(positionHint, 0.1), 0.9)
60573
60539
  });
@@ -60576,7 +60542,7 @@ function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, s
60576
60542
  if (Array.isArray(children)) {
60577
60543
  for (let i = 0; i < children.length; i++) {
60578
60544
  const child = children[i];
60579
- if (child && typeof child === "object") {
60545
+ if (child !== null && typeof child === "object" && !Array.isArray(child)) {
60580
60546
  sources.push(
60581
60547
  ...findEventSources(child, `${path}.children.${i}`, depth + 1, children.length, i)
60582
60548
  );
@@ -60585,7 +60551,7 @@ function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, s
60585
60551
  }
60586
60552
  for (const [key, value] of Object.entries(config)) {
60587
60553
  if (key === "children" || key === "type" || key === "event") continue;
60588
- if (value && typeof value === "object" && !Array.isArray(value) && "type" in value) {
60554
+ if (value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value) {
60589
60555
  sources.push(
60590
60556
  ...findEventSources(value, `${path}.${key}`, depth + 1, totalSiblings, siblingIndex)
60591
60557
  );
@@ -60722,10 +60688,10 @@ function schemaToOverviewGraph(schema, mockData, behaviorMeta, layoutHint, orbit
60722
60688
  if (!sm) continue;
60723
60689
  const smEvents = trait.stateMachine?.events ?? [];
60724
60690
  const matchingEvent = smEvents.find((ev) => ev.key === source.event);
60725
- if (matchingEvent?.payload && Array.isArray(matchingEvent.payload)) {
60726
- source.payloadFields = matchingEvent.payload.map((p2) => ({
60727
- name: String(p2.name ?? ""),
60728
- type: String(p2.type ?? "string"),
60691
+ if (matchingEvent?.payloadSchema && Array.isArray(matchingEvent.payloadSchema)) {
60692
+ source.payloadFields = matchingEvent.payloadSchema.map((p2) => ({
60693
+ name: p2.name ?? "",
60694
+ type: p2.type ?? "string",
60729
60695
  ...p2.required ? { required: true } : {}
60730
60696
  }));
60731
60697
  break;
@@ -61261,7 +61227,7 @@ function resolveLambdaBindings(body, params, item, index) {
61261
61227
  if (Array.isArray(body)) {
61262
61228
  return body.map((b) => recur(b));
61263
61229
  }
61264
- if (body !== null && typeof body === "object" && !React94__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
61230
+ if (body !== null && typeof body === "object" && !React96__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
61265
61231
  const out = {};
61266
61232
  for (const [k, v] of Object.entries(body)) {
61267
61233
  out[k] = recur(v);
@@ -61280,7 +61246,7 @@ function getSlotContentRenderer4() {
61280
61246
  function makeLambdaFn(params, lambdaBody, callerKey) {
61281
61247
  return (item, index) => {
61282
61248
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
61283
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React94__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
61249
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React96__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
61284
61250
  return null;
61285
61251
  }
61286
61252
  const record = resolvedBody;
@@ -61299,7 +61265,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
61299
61265
  props: childProps,
61300
61266
  priority: 0
61301
61267
  };
61302
- return React94__default.createElement(SlotContentRenderer2, { content: childContent });
61268
+ return React96__default.createElement(SlotContentRenderer2, { content: childContent });
61303
61269
  };
61304
61270
  }
61305
61271
  function convertNode(node, callerKey) {
@@ -61318,7 +61284,7 @@ function convertNode(node, callerKey) {
61318
61284
  });
61319
61285
  return anyChanged ? mapped : node;
61320
61286
  }
61321
- if (typeof node === "object" && !React94__default.isValidElement(node) && !(node instanceof Date)) {
61287
+ if (typeof node === "object" && !React96__default.isValidElement(node) && !(node instanceof Date)) {
61322
61288
  return convertObjectProps(node);
61323
61289
  }
61324
61290
  return node;
@@ -62912,7 +62878,7 @@ function buildMockData(schema) {
62912
62878
  perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
62913
62879
  return result;
62914
62880
  }
62915
- function isInlineTrait2(traitRef) {
62881
+ function isInlineTrait3(traitRef) {
62916
62882
  return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
62917
62883
  }
62918
62884
  function findDataState(sm, initialStateName) {
@@ -62944,7 +62910,7 @@ function adjustSchemaForMockData(schema, mockData) {
62944
62910
  const updatedOrbitals = schema.orbitals.map((orbital) => {
62945
62911
  const traits2 = orbital.traits ?? [];
62946
62912
  const updatedTraits = traits2.map((traitRef) => {
62947
- if (!isInlineTrait2(traitRef)) return traitRef;
62913
+ if (!isInlineTrait3(traitRef)) return traitRef;
62948
62914
  const updated = rewriteTraitInitialState(traitRef, mockData);
62949
62915
  if (updated !== traitRef) changed = true;
62950
62916
  return updated;
@@ -63514,7 +63480,7 @@ function useCanvasDroppable({
63514
63480
  function defaultEmit(eventBus, drop) {
63515
63481
  const { payload, target, resolved } = drop;
63516
63482
  if (payload.kind === "pattern") {
63517
- const patternType = payload.data.type;
63483
+ const patternType = payload.data["type"];
63518
63484
  if (typeof patternType !== "string") {
63519
63485
  log13.warn("default-emit:pattern:missing-type");
63520
63486
  return;
@@ -63529,7 +63495,7 @@ function defaultEmit(eventBus, drop) {
63529
63495
  return;
63530
63496
  }
63531
63497
  if (payload.kind === "behavior") {
63532
- const behaviorName = payload.data.name;
63498
+ const behaviorName = payload.data["name"];
63533
63499
  if (typeof behaviorName !== "string") {
63534
63500
  log13.warn("default-emit:behavior:missing-name");
63535
63501
  return;
@@ -63550,8 +63516,8 @@ function CanvasDndProvider({
63550
63516
  }) {
63551
63517
  const eventBus = useEventBus();
63552
63518
  const sensors = useAlmadarDndSensors(false);
63553
- const [activePayload, setActivePayload] = React94__default.useState(null);
63554
- const handleDragStart = React94__default.useCallback((e) => {
63519
+ const [activePayload, setActivePayload] = React96__default.useState(null);
63520
+ const handleDragStart = React96__default.useCallback((e) => {
63555
63521
  const data = e.active.data.current;
63556
63522
  const payload = data?.payload;
63557
63523
  if (payload) {
@@ -63562,7 +63528,7 @@ function CanvasDndProvider({
63562
63528
  log13.warn("dragStart:missing-payload", { id: e.active.id });
63563
63529
  }
63564
63530
  }, [eventBus]);
63565
- const handleDragEnd = React94__default.useCallback((e) => {
63531
+ const handleDragEnd = React96__default.useCallback((e) => {
63566
63532
  setActivePayload(null);
63567
63533
  const activeData = e.active.data.current;
63568
63534
  const payload = activeData?.payload;
@@ -63591,7 +63557,7 @@ function CanvasDndProvider({
63591
63557
  const suppressed = onDrop ? onDrop(drop) === true : false;
63592
63558
  if (!suppressed) defaultEmit(eventBus, drop);
63593
63559
  }, [eventBus, onDrop]);
63594
- const handleDragCancel = React94__default.useCallback(() => {
63560
+ const handleDragCancel = React96__default.useCallback(() => {
63595
63561
  setActivePayload(null);
63596
63562
  log13.info("dragCancel");
63597
63563
  }, []);
@@ -64349,7 +64315,7 @@ var OrbPreviewNodeInner = (props) => {
64349
64315
  }
64350
64316
  );
64351
64317
  };
64352
- var OrbPreviewNode = React94__default.memo(OrbPreviewNodeInner);
64318
+ var OrbPreviewNode = React96__default.memo(OrbPreviewNodeInner);
64353
64319
  OrbPreviewNode.displayName = "OrbPreviewNode";
64354
64320
  orbPreviewLog.debug("export-resolved", () => ({
64355
64321
  type: typeof OrbPreviewNode,
@@ -64454,7 +64420,7 @@ var EventFlowEdgeInner = (props) => {
64454
64420
  ) })
64455
64421
  ] });
64456
64422
  };
64457
- var EventFlowEdge = React94__default.memo(EventFlowEdgeInner);
64423
+ var EventFlowEdge = React96__default.memo(EventFlowEdgeInner);
64458
64424
  EventFlowEdge.displayName = "EventFlowEdge";
64459
64425
 
64460
64426
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -64518,7 +64484,7 @@ var BehaviorComposeNodeInner = (props) => {
64518
64484
  Box,
64519
64485
  {
64520
64486
  style: { height: 3, backgroundColor: layerColor },
64521
- title: data.layer
64487
+ title: data.layer ?? void 0
64522
64488
  }
64523
64489
  ),
64524
64490
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 px-3 py-1.5 border-b border-border/40 drag-handle cursor-grab", children: [
@@ -64533,9 +64499,9 @@ var BehaviorComposeNodeInner = (props) => {
64533
64499
  {
64534
64500
  name: data.behaviorName,
64535
64501
  level: data.level,
64536
- domain: data.domain,
64502
+ domain: data.domain ?? void 0,
64537
64503
  stateCount: data.stateCount,
64538
- fieldCount: data.fieldCount,
64504
+ fieldCount: data.fieldCount ?? void 0,
64539
64505
  persistence: data.persistence,
64540
64506
  effectTypes: data.effectTypes,
64541
64507
  children: data.children,
@@ -64601,7 +64567,7 @@ var BehaviorComposeNodeInner = (props) => {
64601
64567
  }
64602
64568
  );
64603
64569
  };
64604
- var BehaviorComposeNode = React94__default.memo(BehaviorComposeNodeInner);
64570
+ var BehaviorComposeNode = React96__default.memo(BehaviorComposeNodeInner);
64605
64571
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
64606
64572
 
64607
64573
  // components/avl/molecules/avl-behavior-compose-converter.ts
@@ -64622,17 +64588,17 @@ function behaviorsToComposeGraph(entries, wires, layoutHint) {
64622
64588
  data: {
64623
64589
  behaviorName: entry.behaviorName,
64624
64590
  level: entry.level,
64625
- domain: entry.domain,
64626
- layer: entry.layer,
64591
+ domain: entry.domain ?? null,
64592
+ layer: entry.layer ?? null,
64627
64593
  entityName: entry.entityName,
64628
64594
  stateCount: entry.stateCount,
64629
- fieldCount: entry.fieldCount,
64630
- persistence: entry.persistence,
64631
- effectTypes: entry.effectTypes,
64632
- children: entry.children,
64633
- connections: entry.connections,
64595
+ fieldCount: entry.fieldCount ?? null,
64596
+ persistence: entry.persistence ?? null,
64597
+ effectTypes: entry.effectTypes ?? null,
64598
+ children: entry.children ?? null,
64599
+ connections: entry.connections ?? null,
64634
64600
  connectableEvents: entry.connectableEvents,
64635
- composableWith: entry.composableWith,
64601
+ composableWith: entry.composableWith ?? null,
64636
64602
  orbitalNames: entry.orbitalNames
64637
64603
  }
64638
64604
  });
@@ -64651,11 +64617,20 @@ function behaviorsToComposeGraph(entries, wires, layoutHint) {
64651
64617
  }
64652
64618
  function registryEntryToCanvasEntry(entry, orbitalNames) {
64653
64619
  const events2 = entry.connectableEvents;
64654
- const connectableEvents = events2.map((eventName, i) => ({
64655
- event: eventName,
64656
- payloadFields: entry.eventPayloads[eventName],
64657
- positionHint: events2.length > 1 ? 0.1 + i * 0.8 / (events2.length - 1) : 0.5
64658
- }));
64620
+ const connectableEvents = events2.map((eventName, i) => {
64621
+ const rawFields = entry.eventPayloads[eventName];
64622
+ const payloadFields = rawFields ? rawFields.map((f3) => ({
64623
+ name: f3.name,
64624
+ type: f3.type,
64625
+ required: f3.required ?? null,
64626
+ description: null
64627
+ })) : null;
64628
+ return {
64629
+ event: eventName,
64630
+ payloadFields,
64631
+ positionHint: events2.length > 1 ? 0.1 + i * 0.8 / (events2.length - 1) : 0.5
64632
+ };
64633
+ });
64659
64634
  return {
64660
64635
  behaviorName: entry.name,
64661
64636
  level: entry.level,
@@ -64760,28 +64735,31 @@ function findPatternInTree(root, path) {
64760
64735
  const parts = cleanPath.split(".");
64761
64736
  let current = root;
64762
64737
  for (const part of parts) {
64763
- if (current === null || current === void 0 || typeof current !== "object") return null;
64764
- const record = current;
64765
- if (part === "children") {
64766
- if (Array.isArray(record.children)) {
64767
- current = record.children;
64768
- } else {
64769
- const nestedProps = record.props;
64770
- if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
64771
- current = nestedProps.children;
64772
- } else {
64773
- return null;
64774
- }
64775
- }
64776
- } else if (Array.isArray(current)) {
64738
+ if (current === null) return null;
64739
+ if (Array.isArray(current)) {
64777
64740
  const idx = parseInt(part, 10);
64778
64741
  if (isNaN(idx) || idx < 0 || idx >= current.length) return null;
64779
- current = current[idx];
64742
+ const item = current[idx];
64743
+ current = item && typeof item === "object" && !Array.isArray(item) ? item : null;
64780
64744
  } else {
64781
- current = record[part];
64745
+ if (part === "children") {
64746
+ if (Array.isArray(current.children)) {
64747
+ current = current.children;
64748
+ } else {
64749
+ const nestedProps = current.props;
64750
+ if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
64751
+ current = nestedProps.children;
64752
+ } else {
64753
+ return null;
64754
+ }
64755
+ }
64756
+ } else {
64757
+ const rawVal = current[part];
64758
+ current = rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) ? rawVal : null;
64759
+ }
64782
64760
  }
64783
64761
  }
64784
- return typeof current === "object" && current !== null ? current : null;
64762
+ return Array.isArray(current) ? null : current;
64785
64763
  }
64786
64764
  var FIELD_TYPE_OPTIONS = FieldTypeSchema.options.map((v) => ({ value: v, label: v }));
64787
64765
  var EFFECT_TYPE_OPTIONS = Object.keys(EFFECT_TYPE_TO_CATEGORY).map((v) => ({ value: v, label: v }));
@@ -64816,7 +64794,9 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
64816
64794
  const tryEffects = (effects) => {
64817
64795
  for (const eff of effects) {
64818
64796
  if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
64819
- const found = findPatternInTree(eff[2], patternId);
64797
+ const root = eff[2];
64798
+ if (typeof root !== "object" || root === null || Array.isArray(root)) continue;
64799
+ const found = findPatternInTree(root, patternId);
64820
64800
  if (!found) continue;
64821
64801
  if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
64822
64802
  continue;
@@ -65245,9 +65225,9 @@ function OrbPatternTree({ config, depth }) {
65245
65225
  return /* @__PURE__ */ jsxs(Box, { style: { paddingLeft: depth * 12 }, children: [
65246
65226
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-primary font-semibold text-xs", children: type }),
65247
65227
  propEntries.slice(0, 5).map(([key, val]) => {
65248
- const display = typeof val === "string" ? val.startsWith("@") ? /* @__PURE__ */ jsx("span", { className: "text-purple-500", children: val }) : `"${val}"` : Array.isArray(val) && typeof val[0] === "string" && val[0].includes("/") ? /* @__PURE__ */ jsxs("span", { className: "text-amber-600", children: [
65228
+ const display = typeof val === "string" ? val.startsWith("@") ? /* @__PURE__ */ jsx("span", { className: "text-purple-500", children: val }) : `"${val}"` : Array.isArray(val) && val.length > 0 && typeof val[0] === "string" && val[0].includes("/") ? /* @__PURE__ */ jsxs("span", { className: "text-amber-600", children: [
65249
65229
  "(",
65250
- val.join(" "),
65230
+ val.map(String).join(" "),
65251
65231
  ")"
65252
65232
  ] }) : String(val);
65253
65233
  return /* @__PURE__ */ jsxs(Box, { className: "flex gap-1 text-xs", children: [
@@ -65613,7 +65593,7 @@ var TraitCardNodeInner = (props) => {
65613
65593
  }
65614
65594
  );
65615
65595
  };
65616
- var TraitCardNode = React94__default.memo(TraitCardNodeInner);
65596
+ var TraitCardNode = React96__default.memo(TraitCardNodeInner);
65617
65597
  TraitCardNode.displayName = "TraitCardNode";
65618
65598
 
65619
65599
  // components/avl/organisms/FlowCanvas.tsx
@@ -65686,7 +65666,7 @@ function FlowCanvasInner({
65686
65666
  initialOrbital
65687
65667
  );
65688
65668
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
65689
- const screenSizeUserOverrideRef = React94__default.useRef(false);
65669
+ const screenSizeUserOverrideRef = React96__default.useRef(false);
65690
65670
  const [screenSize, setScreenSize] = useState(
65691
65671
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
65692
65672
  );
@@ -66070,7 +66050,7 @@ var ZoomBreadcrumb = ({
66070
66050
  if (eventName && band === "detail") {
66071
66051
  segments.push({ icon: "\u26A1", label: eventName });
66072
66052
  }
66073
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
66053
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
66074
66054
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
66075
66055
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
66076
66056
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -66411,7 +66391,7 @@ var EventWireOverlay = ({
66411
66391
  containerW,
66412
66392
  containerH
66413
66393
  }) => {
66414
- const ids = React94__default.useMemo(() => {
66394
+ const ids = React96__default.useMemo(() => {
66415
66395
  avlOczWireId += 1;
66416
66396
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
66417
66397
  }, []);
@@ -66778,7 +66758,7 @@ var AvlOrbitalsCosmicZoom = ({
66778
66758
  borderRadius: 6,
66779
66759
  border: `1px solid ${color}`
66780
66760
  },
66781
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
66761
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React96__default.Fragment, { children: [
66782
66762
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
66783
66763
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
66784
66764
  Box,