@almadar/ui 4.6.5 → 4.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/avl/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { Html, RoundedBox, OrbitControls as OrbitControls$1, Grid as Grid$1, Stars, Sparkles } from '@react-three/drei';
3
- import * as React126 from 'react';
4
- import React126__default, { createContext, useContext, useRef, useState, useCallback, useMemo, useEffect, Suspense, useLayoutEffect, useReducer, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
3
+ import * as React127 from 'react';
4
+ import React127__default, { createContext, useContext, useRef, useState, useCallback, useMemo, useEffect, Suspense, useLayoutEffect, useReducer, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
5
5
  import * as LucideIcons from 'lucide-react';
6
6
  import { Loader2, ChevronDown, X, Check, Copy, AlertTriangle, Info, AlertCircle, CheckCircle, List, Printer, ChevronRight, ChevronLeft, Code, FileText, WrapText, Trash2, Settings, Menu as Menu$1, Search, Bell, LogOut, ZoomOut, ZoomIn, Download, FileQuestion, Inbox, XCircle, Filter, Plus, Pause, Play, RotateCcw, Package, Calendar, Pencil, Eye, MoreHorizontal, Image as Image$1, Upload, Minus, ArrowLeft, HelpCircle, ChevronUp, Eraser, Star, TrendingUp, TrendingDown, ArrowUp, ArrowDown, MoreVertical, Sun, Moon, Circle, Clock, CheckCircle2, ArrowRight, FileWarning, SkipForward, Bug, Send, Wrench, User, Tag, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
7
7
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
@@ -2886,6 +2886,24 @@ var init_logger = __esm({
2886
2886
  DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2887
2887
  }
2888
2888
  });
2889
+ function captureSubscriberTag(listener) {
2890
+ const fnName = listener.name;
2891
+ if (typeof fnName === "string" && fnName.length > 0 && fnName !== "listener") {
2892
+ return fnName;
2893
+ }
2894
+ const stack = new Error().stack ?? "";
2895
+ const lines = stack.split("\n");
2896
+ for (const raw of lines.slice(2)) {
2897
+ const line = raw.trim();
2898
+ if (!line) continue;
2899
+ if (line.includes("EventBusProvider") || line.includes("useEventBus")) continue;
2900
+ if (line.includes("captureSubscriberTag")) continue;
2901
+ const match = line.match(/([^/\\)]+\.(?:tsx?|jsx?))(?::(\d+))?/);
2902
+ if (match) return match[2] ? `${match[1]}:${match[2]}` : match[1];
2903
+ return line.slice(0, 120);
2904
+ }
2905
+ return "unknown";
2906
+ }
2889
2907
  function EventBusProvider({ children, debug: debug2 = false }) {
2890
2908
  const listenersRef = useRef(/* @__PURE__ */ new Map());
2891
2909
  const anyListenersRef = useRef(/* @__PURE__ */ new Set());
@@ -2926,7 +2944,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2926
2944
  }
2927
2945
  if (listeners6) {
2928
2946
  const listenersCopy = Array.from(listeners6);
2929
- for (const listener of listenersCopy) {
2947
+ for (let i = 0; i < listenersCopy.length; i++) {
2948
+ const listener = listenersCopy[i];
2949
+ busLog.debug("emit:listener", {
2950
+ type,
2951
+ kind: "specific",
2952
+ index: i,
2953
+ tag: listenerTags.get(listener) ?? "untagged"
2954
+ });
2930
2955
  try {
2931
2956
  listener(event);
2932
2957
  } catch (error) {
@@ -2935,7 +2960,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2935
2960
  }
2936
2961
  }
2937
2962
  const anyListeners = Array.from(anyListenersRef.current);
2938
- for (const listener of anyListeners) {
2963
+ for (let i = 0; i < anyListeners.length; i++) {
2964
+ const listener = anyListeners[i];
2965
+ busLog.debug("emit:listener", {
2966
+ type,
2967
+ kind: "onAny",
2968
+ index: i,
2969
+ tag: listenerTags.get(listener) ?? "untagged"
2970
+ });
2939
2971
  try {
2940
2972
  listener(event);
2941
2973
  } catch (error) {
@@ -2949,7 +2981,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2949
2981
  }
2950
2982
  const listeners6 = listenersRef.current.get(type);
2951
2983
  listeners6.add(listener);
2952
- subLog.debug("subscribe", { type, totalListeners: listeners6.size });
2984
+ if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
2985
+ subLog.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
2953
2986
  if (debug2) {
2954
2987
  console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
2955
2988
  }
@@ -2976,7 +3009,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
2976
3009
  }, []);
2977
3010
  const onAny = useCallback((listener) => {
2978
3011
  anyListenersRef.current.add(listener);
2979
- subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size });
3012
+ if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3013
+ subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
2980
3014
  if (debug2) {
2981
3015
  console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
2982
3016
  }
@@ -3007,7 +3041,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3007
3041
  }, [contextValue]);
3008
3042
  return /* @__PURE__ */ jsx(EventBusContext.Provider, { value: contextValue, children });
3009
3043
  }
3010
- var busLog, subLog, EventBusContext;
3044
+ var busLog, subLog, EventBusContext, listenerTags;
3011
3045
  var init_EventBusProvider = __esm({
3012
3046
  "providers/EventBusProvider.tsx"() {
3013
3047
  "use client";
@@ -3016,6 +3050,7 @@ var init_EventBusProvider = __esm({
3016
3050
  busLog = createLogger("almadar:eventbus");
3017
3051
  subLog = createLogger("almadar:eventbus:subscribe");
3018
3052
  EventBusContext = createContext(null);
3053
+ listenerTags = /* @__PURE__ */ new WeakMap();
3019
3054
  }
3020
3055
  });
3021
3056
 
@@ -3252,7 +3287,7 @@ var init_Box = __esm({
3252
3287
  fixed: "fixed",
3253
3288
  sticky: "sticky"
3254
3289
  };
3255
- Box = React126__default.forwardRef(
3290
+ Box = React127__default.forwardRef(
3256
3291
  ({
3257
3292
  padding,
3258
3293
  paddingX,
@@ -4954,7 +4989,7 @@ function resolveIconProp(value, sizeClass) {
4954
4989
  const IconComp = value;
4955
4990
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
4956
4991
  }
4957
- if (React126__default.isValidElement(value)) {
4992
+ if (React127__default.isValidElement(value)) {
4958
4993
  return value;
4959
4994
  }
4960
4995
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -5030,7 +5065,7 @@ var init_Button = __esm({
5030
5065
  md: "h-4 w-4",
5031
5066
  lg: "h-5 w-5"
5032
5067
  };
5033
- Button = React126__default.forwardRef(
5068
+ Button = React127__default.forwardRef(
5034
5069
  ({
5035
5070
  className,
5036
5071
  variant = "primary",
@@ -5133,7 +5168,7 @@ var init_Badge = __esm({
5133
5168
  md: "px-2.5 py-1 text-sm",
5134
5169
  lg: "px-3 py-1.5 text-base"
5135
5170
  };
5136
- Badge = React126__default.forwardRef(
5171
+ Badge = React127__default.forwardRef(
5137
5172
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
5138
5173
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
5139
5174
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -5270,11 +5305,110 @@ var init_Toast = __esm({
5270
5305
  Toast.displayName = "Toast";
5271
5306
  }
5272
5307
  });
5308
+ function refId(obj) {
5309
+ if (obj === null || obj === void 0 || typeof obj !== "object") return null;
5310
+ const existing = refIds.get(obj);
5311
+ if (existing !== void 0) return existing;
5312
+ const id = nextRefId++;
5313
+ refIds.set(obj, id);
5314
+ return id;
5315
+ }
5316
+ function slotEntriesInOrder(slot) {
5317
+ if (!slot) return [];
5318
+ const out = [];
5319
+ for (const [sourceKey, entry] of Object.entries(slot)) {
5320
+ if (entry.patterns.length > 0) {
5321
+ out.push({ sourceKey, entry });
5322
+ }
5323
+ }
5324
+ return out;
5325
+ }
5326
+ function SlotsProvider({ children }) {
5327
+ const [slots, setSlots] = useState({});
5328
+ const setSlotPatterns = useCallback((slot, patterns, source) => {
5329
+ const sourceKey = source?.trait ?? DEFAULT_SOURCE_KEY2;
5330
+ const entityProp = patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.entity : void 0;
5331
+ slotLog.debug("setSlotPatterns", {
5332
+ slot,
5333
+ sourceKey,
5334
+ patternCount: patterns.length,
5335
+ firstPatternType: patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.type : void 0,
5336
+ entityRefId: refId(entityProp)
5337
+ });
5338
+ setSlots((prev) => {
5339
+ const prevSlot = prev[slot] ?? {};
5340
+ return {
5341
+ ...prev,
5342
+ [slot]: {
5343
+ ...prevSlot,
5344
+ [sourceKey]: { patterns, source }
5345
+ }
5346
+ };
5347
+ });
5348
+ }, []);
5349
+ const clearSlot = useCallback((slot) => {
5350
+ setSlots((prev) => {
5351
+ const existing = prev[slot];
5352
+ if (existing && Object.keys(existing).length === 0) {
5353
+ return prev;
5354
+ }
5355
+ return { ...prev, [slot]: {} };
5356
+ });
5357
+ }, []);
5358
+ const clearSlotForSource = useCallback((slot, sourceTrait) => {
5359
+ setSlots((prev) => {
5360
+ const existing = prev[slot];
5361
+ if (!existing || !(sourceTrait in existing)) return prev;
5362
+ const next = { ...existing };
5363
+ delete next[sourceTrait];
5364
+ return { ...prev, [slot]: next };
5365
+ });
5366
+ }, []);
5367
+ const clearAllSlots = useCallback(() => {
5368
+ setSlots({});
5369
+ }, []);
5370
+ const actionsRef = useRef({
5371
+ setSlotPatterns,
5372
+ clearSlot,
5373
+ clearSlotForSource,
5374
+ clearAllSlots
5375
+ });
5376
+ actionsRef.current = { setSlotPatterns, clearSlot, clearSlotForSource, clearAllSlots };
5377
+ const [stableActions] = useState(() => ({
5378
+ setSlotPatterns: (...args) => actionsRef.current.setSlotPatterns(...args),
5379
+ clearSlot: (...args) => actionsRef.current.clearSlot(...args),
5380
+ clearSlotForSource: (...args) => actionsRef.current.clearSlotForSource(...args),
5381
+ clearAllSlots: () => actionsRef.current.clearAllSlots()
5382
+ }));
5383
+ return /* @__PURE__ */ jsx(SlotsActionsContext.Provider, { value: stableActions, children: /* @__PURE__ */ jsx(SlotsStateContext.Provider, { value: slots, children }) });
5384
+ }
5385
+ function useSlots() {
5386
+ return useContext(SlotsStateContext);
5387
+ }
5388
+ function useSlotsActions() {
5389
+ const actions = useContext(SlotsActionsContext);
5390
+ if (!actions) {
5391
+ throw new Error("useSlotsActions must be used within a SlotsProvider");
5392
+ }
5393
+ return actions;
5394
+ }
5395
+ var slotLog, refIds, nextRefId, DEFAULT_SOURCE_KEY2, SlotsStateContext, SlotsActionsContext;
5396
+ var init_SlotsContext = __esm({
5397
+ "runtime/ui/SlotsContext.tsx"() {
5398
+ init_logger();
5399
+ slotLog = createLogger("almadar:ui:slot-render");
5400
+ refIds = /* @__PURE__ */ new WeakMap();
5401
+ nextRefId = 1;
5402
+ DEFAULT_SOURCE_KEY2 = "__default__";
5403
+ SlotsStateContext = createContext({});
5404
+ SlotsActionsContext = createContext(null);
5405
+ }
5406
+ });
5273
5407
  var Input;
5274
5408
  var init_Input = __esm({
5275
5409
  "components/atoms/Input.tsx"() {
5276
5410
  init_cn();
5277
- Input = React126__default.forwardRef(
5411
+ Input = React127__default.forwardRef(
5278
5412
  ({
5279
5413
  className,
5280
5414
  inputType,
@@ -5392,7 +5526,7 @@ var Label;
5392
5526
  var init_Label = __esm({
5393
5527
  "components/atoms/Label.tsx"() {
5394
5528
  init_cn();
5395
- Label = React126__default.forwardRef(
5529
+ Label = React127__default.forwardRef(
5396
5530
  ({ className, required, children, ...props }, ref) => {
5397
5531
  return /* @__PURE__ */ jsxs(
5398
5532
  "label",
@@ -5418,7 +5552,7 @@ var Textarea;
5418
5552
  var init_Textarea = __esm({
5419
5553
  "components/atoms/Textarea.tsx"() {
5420
5554
  init_cn();
5421
- Textarea = React126__default.forwardRef(
5555
+ Textarea = React127__default.forwardRef(
5422
5556
  ({ className, error, ...props }, ref) => {
5423
5557
  return /* @__PURE__ */ jsx(
5424
5558
  "textarea",
@@ -5447,7 +5581,7 @@ var Select;
5447
5581
  var init_Select = __esm({
5448
5582
  "components/atoms/Select.tsx"() {
5449
5583
  init_cn();
5450
- Select = React126__default.forwardRef(
5584
+ Select = React127__default.forwardRef(
5451
5585
  ({ className, options, placeholder, error, ...props }, ref) => {
5452
5586
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
5453
5587
  /* @__PURE__ */ jsxs(
@@ -5489,7 +5623,7 @@ var Checkbox;
5489
5623
  var init_Checkbox = __esm({
5490
5624
  "components/atoms/Checkbox.tsx"() {
5491
5625
  init_cn();
5492
- Checkbox = React126__default.forwardRef(
5626
+ Checkbox = React127__default.forwardRef(
5493
5627
  ({ className, label, id, ...props }, ref) => {
5494
5628
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
5495
5629
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -5571,7 +5705,7 @@ var init_Card = __esm({
5571
5705
  md: "shadow",
5572
5706
  lg: "shadow-lg"
5573
5707
  };
5574
- Card = React126__default.forwardRef(
5708
+ Card = React127__default.forwardRef(
5575
5709
  ({
5576
5710
  className,
5577
5711
  variant = "bordered",
@@ -5607,9 +5741,9 @@ var init_Card = __esm({
5607
5741
  }
5608
5742
  );
5609
5743
  Card.displayName = "Card";
5610
- CardHeader = React126__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
5744
+ CardHeader = React127__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
5611
5745
  CardHeader.displayName = "CardHeader";
5612
- CardTitle = React126__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5746
+ CardTitle = React127__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5613
5747
  "h3",
5614
5748
  {
5615
5749
  ref,
@@ -5622,11 +5756,11 @@ var init_Card = __esm({
5622
5756
  }
5623
5757
  ));
5624
5758
  CardTitle.displayName = "CardTitle";
5625
- CardContent = React126__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
5759
+ CardContent = React127__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
5626
5760
  CardContent.displayName = "CardContent";
5627
5761
  CardBody = CardContent;
5628
5762
  CardBody.displayName = "CardBody";
5629
- CardFooter = React126__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5763
+ CardFooter = React127__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5630
5764
  "div",
5631
5765
  {
5632
5766
  ref,
@@ -5647,7 +5781,7 @@ var init_Spinner = __esm({
5647
5781
  md: "h-6 w-6",
5648
5782
  lg: "h-8 w-8"
5649
5783
  };
5650
- Spinner = React126__default.forwardRef(
5784
+ Spinner = React127__default.forwardRef(
5651
5785
  ({ className, size = "md", ...props }, ref) => {
5652
5786
  return /* @__PURE__ */ jsx(
5653
5787
  "div",
@@ -6095,7 +6229,7 @@ var Radio;
6095
6229
  var init_Radio = __esm({
6096
6230
  "components/atoms/Radio.tsx"() {
6097
6231
  init_cn();
6098
- Radio = React126__default.forwardRef(
6232
+ Radio = React127__default.forwardRef(
6099
6233
  ({
6100
6234
  label,
6101
6235
  helperText,
@@ -6206,7 +6340,7 @@ var init_Switch = __esm({
6206
6340
  "components/atoms/Switch.tsx"() {
6207
6341
  "use client";
6208
6342
  init_cn();
6209
- Switch = React126.forwardRef(
6343
+ Switch = React127.forwardRef(
6210
6344
  ({
6211
6345
  checked,
6212
6346
  defaultChecked = false,
@@ -6217,10 +6351,10 @@ var init_Switch = __esm({
6217
6351
  name,
6218
6352
  className
6219
6353
  }, ref) => {
6220
- const [isChecked, setIsChecked] = React126.useState(
6354
+ const [isChecked, setIsChecked] = React127.useState(
6221
6355
  checked !== void 0 ? checked : defaultChecked
6222
6356
  );
6223
- React126.useEffect(() => {
6357
+ React127.useEffect(() => {
6224
6358
  if (checked !== void 0) {
6225
6359
  setIsChecked(checked);
6226
6360
  }
@@ -6560,8 +6694,8 @@ var init_LawReferenceTooltip = __esm({
6560
6694
  position = "top",
6561
6695
  className
6562
6696
  }) => {
6563
- const [isVisible, setIsVisible] = React126__default.useState(false);
6564
- const timeoutRef = React126__default.useRef(null);
6697
+ const [isVisible, setIsVisible] = React127__default.useState(false);
6698
+ const timeoutRef = React127__default.useRef(null);
6565
6699
  const handleMouseEnter = () => {
6566
6700
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
6567
6701
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -6570,7 +6704,7 @@ var init_LawReferenceTooltip = __esm({
6570
6704
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
6571
6705
  setIsVisible(false);
6572
6706
  };
6573
- React126__default.useEffect(() => {
6707
+ React127__default.useEffect(() => {
6574
6708
  return () => {
6575
6709
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
6576
6710
  };
@@ -6780,7 +6914,7 @@ var init_StatusDot = __esm({
6780
6914
  md: "w-2.5 h-2.5",
6781
6915
  lg: "w-3 h-3"
6782
6916
  };
6783
- StatusDot = React126__default.forwardRef(
6917
+ StatusDot = React127__default.forwardRef(
6784
6918
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
6785
6919
  return /* @__PURE__ */ jsx(
6786
6920
  "span",
@@ -6833,7 +6967,7 @@ var init_TrendIndicator = __esm({
6833
6967
  down: TrendingDown,
6834
6968
  flat: ArrowRight
6835
6969
  };
6836
- TrendIndicator = React126__default.forwardRef(
6970
+ TrendIndicator = React127__default.forwardRef(
6837
6971
  ({
6838
6972
  className,
6839
6973
  value,
@@ -6900,7 +7034,7 @@ var init_RangeSlider = __esm({
6900
7034
  md: "w-4 h-4",
6901
7035
  lg: "w-5 h-5"
6902
7036
  };
6903
- RangeSlider = React126__default.forwardRef(
7037
+ RangeSlider = React127__default.forwardRef(
6904
7038
  ({
6905
7039
  className,
6906
7040
  min = 0,
@@ -7496,7 +7630,7 @@ var init_ContentSection = __esm({
7496
7630
  md: "py-16",
7497
7631
  lg: "py-24"
7498
7632
  };
7499
- ContentSection = React126__default.forwardRef(
7633
+ ContentSection = React127__default.forwardRef(
7500
7634
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
7501
7635
  return /* @__PURE__ */ jsx(
7502
7636
  Box,
@@ -8030,7 +8164,7 @@ var init_AnimatedReveal = __esm({
8030
8164
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
8031
8165
  "none": {}
8032
8166
  };
8033
- AnimatedReveal = React126__default.forwardRef(
8167
+ AnimatedReveal = React127__default.forwardRef(
8034
8168
  ({
8035
8169
  trigger = "scroll",
8036
8170
  animation = "fade-up",
@@ -8190,7 +8324,7 @@ var init_AnimatedGraphic = __esm({
8190
8324
  "components/atoms/AnimatedGraphic.tsx"() {
8191
8325
  "use client";
8192
8326
  init_cn();
8193
- AnimatedGraphic = React126__default.forwardRef(
8327
+ AnimatedGraphic = React127__default.forwardRef(
8194
8328
  ({
8195
8329
  src,
8196
8330
  svgContent,
@@ -8213,7 +8347,7 @@ var init_AnimatedGraphic = __esm({
8213
8347
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
8214
8348
  const resolvedSvg = svgContent ?? fetchedSvg;
8215
8349
  const prevAnimateRef = useRef(animate);
8216
- const setRef = React126__default.useCallback(
8350
+ const setRef = React127__default.useCallback(
8217
8351
  (node) => {
8218
8352
  containerRef.current = node;
8219
8353
  if (typeof ref === "function") ref(node);
@@ -8432,9 +8566,9 @@ function ScoreDisplay({
8432
8566
  ...rest
8433
8567
  }) {
8434
8568
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
8435
- const [displayValue, setDisplayValue] = React126.useState(resolvedValue);
8436
- const [isAnimating, setIsAnimating] = React126.useState(false);
8437
- React126.useEffect(() => {
8569
+ const [displayValue, setDisplayValue] = React127.useState(resolvedValue);
8570
+ const [isAnimating, setIsAnimating] = React127.useState(false);
8571
+ React127.useEffect(() => {
8438
8572
  if (!animated || displayValue === resolvedValue) {
8439
8573
  setDisplayValue(resolvedValue);
8440
8574
  return;
@@ -8504,9 +8638,9 @@ function ControlButton({
8504
8638
  className
8505
8639
  }) {
8506
8640
  const eventBus = useEventBus();
8507
- const [isPressed, setIsPressed] = React126.useState(false);
8641
+ const [isPressed, setIsPressed] = React127.useState(false);
8508
8642
  const actualPressed = pressed ?? isPressed;
8509
- const handlePointerDown = React126.useCallback(
8643
+ const handlePointerDown = React127.useCallback(
8510
8644
  (e) => {
8511
8645
  e.preventDefault();
8512
8646
  if (disabled) return;
@@ -8516,7 +8650,7 @@ function ControlButton({
8516
8650
  },
8517
8651
  [disabled, pressEvent, eventBus, onPress]
8518
8652
  );
8519
- const handlePointerUp = React126.useCallback(
8653
+ const handlePointerUp = React127.useCallback(
8520
8654
  (e) => {
8521
8655
  e.preventDefault();
8522
8656
  if (disabled) return;
@@ -8526,7 +8660,7 @@ function ControlButton({
8526
8660
  },
8527
8661
  [disabled, releaseEvent, eventBus, onRelease]
8528
8662
  );
8529
- const handlePointerLeave = React126.useCallback(
8663
+ const handlePointerLeave = React127.useCallback(
8530
8664
  (e) => {
8531
8665
  if (isPressed) {
8532
8666
  setIsPressed(false);
@@ -9424,9 +9558,9 @@ function MiniMap({
9424
9558
  viewportRect,
9425
9559
  className
9426
9560
  }) {
9427
- const canvasRef = React126.useRef(null);
9428
- const frameRef = React126.useRef(0);
9429
- React126.useEffect(() => {
9561
+ const canvasRef = React127.useRef(null);
9562
+ const frameRef = React127.useRef(0);
9563
+ React127.useEffect(() => {
9430
9564
  const canvas = canvasRef.current;
9431
9565
  if (!canvas) return;
9432
9566
  const ctx = canvas.getContext("2d");
@@ -9765,7 +9899,7 @@ var init_ErrorBoundary = __esm({
9765
9899
  "use client";
9766
9900
  init_cn();
9767
9901
  init_ErrorState();
9768
- ErrorBoundary = class extends React126__default.Component {
9902
+ ErrorBoundary = class extends React127__default.Component {
9769
9903
  constructor(props) {
9770
9904
  super(props);
9771
9905
  __publicField(this, "reset", () => {
@@ -10238,8 +10372,8 @@ var init_Tooltip = __esm({
10238
10372
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
10239
10373
  };
10240
10374
  }, []);
10241
- const triggerElement = React126__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
10242
- const trigger = React126__default.cloneElement(triggerElement, {
10375
+ const triggerElement = React127__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
10376
+ const trigger = React127__default.cloneElement(triggerElement, {
10243
10377
  ref: triggerRef,
10244
10378
  onMouseEnter: handleMouseEnter,
10245
10379
  onMouseLeave: handleMouseLeave,
@@ -10360,8 +10494,8 @@ var init_Popover = __esm({
10360
10494
  onMouseEnter: handleOpen,
10361
10495
  onMouseLeave: handleClose
10362
10496
  };
10363
- const childElement = React126__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
10364
- const triggerElement = React126__default.cloneElement(
10497
+ const childElement = React127__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
10498
+ const triggerElement = React127__default.cloneElement(
10365
10499
  childElement,
10366
10500
  {
10367
10501
  ref: triggerRef,
@@ -10478,8 +10612,8 @@ var init_Menu = __esm({
10478
10612
  "bottom-start": "top-full left-0 mt-2",
10479
10613
  "bottom-end": "top-full right-0 mt-2"
10480
10614
  };
10481
- const triggerChild = React126__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
10482
- const triggerElement = React126__default.cloneElement(
10615
+ const triggerChild = React127__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
10616
+ const triggerElement = React127__default.cloneElement(
10483
10617
  triggerChild,
10484
10618
  {
10485
10619
  ref: triggerRef,
@@ -10998,7 +11132,7 @@ var init_MapView = __esm({
10998
11132
  shadowSize: [41, 41]
10999
11133
  });
11000
11134
  L.Marker.prototype.options.icon = defaultIcon;
11001
- const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback125, useState: useState125 } = React126__default;
11135
+ const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback125, useState: useState125 } = React127__default;
11002
11136
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
11003
11137
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
11004
11138
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -11229,7 +11363,7 @@ function InputPattern({
11229
11363
  fieldName
11230
11364
  }) {
11231
11365
  const { emit } = useEventBus();
11232
- const [localValue, setLocalValue] = React126__default.useState(value);
11366
+ const [localValue, setLocalValue] = React127__default.useState(value);
11233
11367
  const handleChange = (e) => {
11234
11368
  setLocalValue(e.target.value);
11235
11369
  if (onChange) {
@@ -11267,7 +11401,7 @@ function TextareaPattern({
11267
11401
  fieldName
11268
11402
  }) {
11269
11403
  const { emit } = useEventBus();
11270
- const [localValue, setLocalValue] = React126__default.useState(value);
11404
+ const [localValue, setLocalValue] = React127__default.useState(value);
11271
11405
  const handleChange = (e) => {
11272
11406
  setLocalValue(e.target.value);
11273
11407
  if (onChange) {
@@ -11299,7 +11433,7 @@ function SelectPattern({
11299
11433
  fieldName
11300
11434
  }) {
11301
11435
  const { emit } = useEventBus();
11302
- const [localValue, setLocalValue] = React126__default.useState(value);
11436
+ const [localValue, setLocalValue] = React127__default.useState(value);
11303
11437
  const handleChange = (e) => {
11304
11438
  setLocalValue(e.target.value);
11305
11439
  if (onChange) {
@@ -11328,7 +11462,7 @@ function CheckboxPattern({
11328
11462
  className
11329
11463
  }) {
11330
11464
  const { emit } = useEventBus();
11331
- const [localChecked, setLocalChecked] = React126__default.useState(checked);
11465
+ const [localChecked, setLocalChecked] = React127__default.useState(checked);
11332
11466
  const handleChange = (e) => {
11333
11467
  setLocalChecked(e.target.checked);
11334
11468
  if (onChange) {
@@ -11559,8 +11693,8 @@ function ActionButtons({
11559
11693
  disabled
11560
11694
  }) {
11561
11695
  const eventBus = useEventBus();
11562
- const [activeButtons, setActiveButtons] = React126.useState(/* @__PURE__ */ new Set());
11563
- const handlePress = React126.useCallback(
11696
+ const [activeButtons, setActiveButtons] = React127.useState(/* @__PURE__ */ new Set());
11697
+ const handlePress = React127.useCallback(
11564
11698
  (id) => {
11565
11699
  setActiveButtons((prev) => new Set(prev).add(id));
11566
11700
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -11568,7 +11702,7 @@ function ActionButtons({
11568
11702
  },
11569
11703
  [actionEvent, eventBus, onAction]
11570
11704
  );
11571
- const handleRelease = React126.useCallback(
11705
+ const handleRelease = React127.useCallback(
11572
11706
  (id) => {
11573
11707
  setActiveButtons((prev) => {
11574
11708
  const next = new Set(prev);
@@ -12154,7 +12288,7 @@ function bindEventBus(eventBus) {
12154
12288
  eventLog.length = 0;
12155
12289
  };
12156
12290
  if (eventBus.onAny) {
12157
- eventBus.onAny((event) => {
12291
+ const verificationRegistryEventLogger = (event) => {
12158
12292
  if (eventLog.length < 200) {
12159
12293
  eventLog.push({
12160
12294
  type: event.type,
@@ -12162,7 +12296,11 @@ function bindEventBus(eventBus) {
12162
12296
  timestamp: Date.now()
12163
12297
  });
12164
12298
  }
12299
+ };
12300
+ Object.defineProperty(verificationRegistryEventLogger, "name", {
12301
+ value: "verificationRegistry:eventLog"
12165
12302
  });
12303
+ eventBus.onAny(verificationRegistryEventLogger);
12166
12304
  }
12167
12305
  }
12168
12306
  }
@@ -13632,7 +13770,7 @@ var init_MarkdownContent = __esm({
13632
13770
  init_Box();
13633
13771
  init_useTranslate();
13634
13772
  init_cn();
13635
- MarkdownContent = React126__default.memo(
13773
+ MarkdownContent = React127__default.memo(
13636
13774
  ({ content, direction, className }) => {
13637
13775
  const { t: _t } = useTranslate();
13638
13776
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -13849,7 +13987,7 @@ var init_CodeBlock = __esm({
13849
13987
  loloStyle = { ...dark, ...loloStyleOverrides };
13850
13988
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
13851
13989
  HIDDEN_LINE_NUMBERS = { display: "none" };
13852
- CodeBlock = React126__default.memo(
13990
+ CodeBlock = React127__default.memo(
13853
13991
  ({
13854
13992
  code: rawCode,
13855
13993
  language = "text",
@@ -15158,7 +15296,7 @@ var init_StateMachineView = __esm({
15158
15296
  style: { top: title ? 30 : 0 },
15159
15297
  children: [
15160
15298
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
15161
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React126__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15299
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React127__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
15162
15300
  StateNode,
15163
15301
  {
15164
15302
  state,
@@ -20941,7 +21079,7 @@ function CraftingRecipe({
20941
21079
  className
20942
21080
  }) {
20943
21081
  const eventBus = useEventBus();
20944
- const handleCraft = React126.useCallback(() => {
21082
+ const handleCraft = React127.useCallback(() => {
20945
21083
  onCraft?.();
20946
21084
  if (craftEvent) {
20947
21085
  eventBus.emit(craftEvent, { output: output.label });
@@ -20958,7 +21096,7 @@ function CraftingRecipe({
20958
21096
  children: [
20959
21097
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
20960
21098
  const hasSufficient = ingredient.available >= ingredient.required;
20961
- return /* @__PURE__ */ jsxs(React126.Fragment, { children: [
21099
+ return /* @__PURE__ */ jsxs(React127.Fragment, { children: [
20962
21100
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
20963
21101
  ItemSlot,
20964
21102
  {
@@ -21252,8 +21390,8 @@ function DPad({
21252
21390
  }) {
21253
21391
  const eventBus = useEventBus();
21254
21392
  const sizes = sizeMap15[size];
21255
- const [activeDirections, setActiveDirections] = React126.useState(/* @__PURE__ */ new Set());
21256
- const handlePress = React126.useCallback(
21393
+ const [activeDirections, setActiveDirections] = React127.useState(/* @__PURE__ */ new Set());
21394
+ const handlePress = React127.useCallback(
21257
21395
  (direction) => {
21258
21396
  setActiveDirections((prev) => new Set(prev).add(direction));
21259
21397
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -21261,7 +21399,7 @@ function DPad({
21261
21399
  },
21262
21400
  [directionEvent, eventBus, onDirection]
21263
21401
  );
21264
- const handleRelease = React126.useCallback(
21402
+ const handleRelease = React127.useCallback(
21265
21403
  (direction) => {
21266
21404
  setActiveDirections((prev) => {
21267
21405
  const next = new Set(prev);
@@ -22140,7 +22278,7 @@ function DataList({
22140
22278
  }) {
22141
22279
  const eventBus = useEventBus();
22142
22280
  const { t } = useTranslate();
22143
- const [visibleCount, setVisibleCount] = React126__default.useState(pageSize || Infinity);
22281
+ const [visibleCount, setVisibleCount] = React127__default.useState(pageSize || Infinity);
22144
22282
  const fields = fieldsProp ?? columnsProp ?? [];
22145
22283
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
22146
22284
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -22181,7 +22319,7 @@ function DataList({
22181
22319
  const items2 = data.map((item) => item);
22182
22320
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
22183
22321
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
22184
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
22322
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
22185
22323
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
22186
22324
  group.items.map((itemData, index) => {
22187
22325
  const id = itemData.id || `${gi}-${index}`;
@@ -22373,7 +22511,7 @@ function DataList({
22373
22511
  className
22374
22512
  ),
22375
22513
  children: [
22376
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
22514
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
22377
22515
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
22378
22516
  group.items.map(
22379
22517
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -23181,20 +23319,21 @@ var init_InputGroup = __esm({
23181
23319
 
23182
23320
  // lib/debug.ts
23183
23321
  function isDebugEnabled() {
23184
- return DEBUG_ENABLED;
23322
+ if (DEBUG_ENABLED) return true;
23323
+ return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
23185
23324
  }
23186
23325
  function debug(...args) {
23187
- if (DEBUG_ENABLED) {
23326
+ if (isDebugEnabled()) {
23188
23327
  console.log("[DEBUG]", ...args);
23189
23328
  }
23190
23329
  }
23191
23330
  function debugGroup(label) {
23192
- if (DEBUG_ENABLED) {
23331
+ if (isDebugEnabled()) {
23193
23332
  console.group(`[DEBUG] ${label}`);
23194
23333
  }
23195
23334
  }
23196
23335
  function debugGroupEnd() {
23197
- if (DEBUG_ENABLED) {
23336
+ if (isDebugEnabled()) {
23198
23337
  console.groupEnd();
23199
23338
  }
23200
23339
  }
@@ -23645,7 +23784,7 @@ var init_WizardProgress = __esm({
23645
23784
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
23646
23785
  const isActive = index === currentStep;
23647
23786
  const isCompleted = index < currentStep;
23648
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
23787
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
23649
23788
  /* @__PURE__ */ jsx(
23650
23789
  "button",
23651
23790
  {
@@ -24556,7 +24695,7 @@ function InventoryGrid({
24556
24695
  const eventBus = useEventBus();
24557
24696
  const slotCount = totalSlots ?? items.length;
24558
24697
  const emptySlotCount = Math.max(0, slotCount - items.length);
24559
- const handleSelect = React126.useCallback(
24698
+ const handleSelect = React127.useCallback(
24560
24699
  (id) => {
24561
24700
  onSelect?.(id);
24562
24701
  if (selectEvent) {
@@ -24769,15 +24908,15 @@ function GameCanvas2D({
24769
24908
  fps = 60,
24770
24909
  className
24771
24910
  }) {
24772
- const canvasRef = React126.useRef(null);
24773
- const rafRef = React126.useRef(0);
24774
- const frameRef = React126.useRef(0);
24775
- const lastTimeRef = React126.useRef(0);
24776
- const onDrawRef = React126.useRef(onDraw);
24911
+ const canvasRef = React127.useRef(null);
24912
+ const rafRef = React127.useRef(0);
24913
+ const frameRef = React127.useRef(0);
24914
+ const lastTimeRef = React127.useRef(0);
24915
+ const onDrawRef = React127.useRef(onDraw);
24777
24916
  onDrawRef.current = onDraw;
24778
- const onTickRef = React126.useRef(onTick);
24917
+ const onTickRef = React127.useRef(onTick);
24779
24918
  onTickRef.current = onTick;
24780
- React126.useEffect(() => {
24919
+ React127.useEffect(() => {
24781
24920
  const canvas = canvasRef.current;
24782
24921
  if (!canvas) return;
24783
24922
  const ctx = canvas.getContext("2d");
@@ -25066,7 +25205,7 @@ function TurnPanel({
25066
25205
  className
25067
25206
  }) {
25068
25207
  const eventBus = useEventBus();
25069
- const handleAction = React126.useCallback(
25208
+ const handleAction = React127.useCallback(
25070
25209
  (event) => {
25071
25210
  if (event) {
25072
25211
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -25212,7 +25351,7 @@ function UnitCommandBar({
25212
25351
  className
25213
25352
  }) {
25214
25353
  const eventBus = useEventBus();
25215
- const handleCommand = React126.useCallback(
25354
+ const handleCommand = React127.useCallback(
25216
25355
  (event) => {
25217
25356
  if (event) {
25218
25357
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -25697,7 +25836,7 @@ function GameMenu({
25697
25836
  } catch {
25698
25837
  }
25699
25838
  const eventBus = eventBusProp || eventBusFromHook;
25700
- const handleOptionClick = React126.useCallback(
25839
+ const handleOptionClick = React127.useCallback(
25701
25840
  (option) => {
25702
25841
  if (option.event && eventBus) {
25703
25842
  eventBus.emit(`UI:${option.event}`, { option });
@@ -25811,7 +25950,7 @@ function GameOverScreen({
25811
25950
  } catch {
25812
25951
  }
25813
25952
  const eventBus = eventBusProp || eventBusFromHook;
25814
- const handleActionClick = React126.useCallback(
25953
+ const handleActionClick = React127.useCallback(
25815
25954
  (action) => {
25816
25955
  if (action.event && eventBus) {
25817
25956
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28915,7 +29054,7 @@ var init_StepFlow = __esm({
28915
29054
  className
28916
29055
  }) => {
28917
29056
  if (orientation === "vertical") {
28918
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React126__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
29057
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React127__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
28919
29058
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
28920
29059
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28921
29060
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -28926,7 +29065,7 @@ var init_StepFlow = __esm({
28926
29065
  ] })
28927
29066
  ] }) }, index)) });
28928
29067
  }
28929
- 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(React126__default.Fragment, { children: [
29068
+ 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(React127__default.Fragment, { children: [
28930
29069
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
28931
29070
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
28932
29071
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31040,7 +31179,7 @@ var init_DocumentViewer = __esm({
31040
31179
  }
31041
31180
  });
31042
31181
  function extractTitle(children) {
31043
- if (!React126__default.isValidElement(children)) return void 0;
31182
+ if (!React127__default.isValidElement(children)) return void 0;
31044
31183
  const props = children.props;
31045
31184
  if (typeof props.title === "string") {
31046
31185
  return props.title;
@@ -31095,7 +31234,7 @@ function LinearView({
31095
31234
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
31096
31235
  const isDone = i < currentIdx;
31097
31236
  const isCurrent = i === currentIdx;
31098
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
31237
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
31099
31238
  i > 0 && /* @__PURE__ */ jsx(
31100
31239
  Typography,
31101
31240
  {
@@ -31845,7 +31984,14 @@ var init_Form = __esm({
31845
31984
  // Schema-based props
31846
31985
  entity,
31847
31986
  fields,
31848
- initialData = {},
31987
+ // No `= {}` default: a fresh `{}` evaluated inline on every render
31988
+ // would change the prop reference every tick and bust the useMemo
31989
+ // cache below (`[entity, initialData]` deps), reigniting the
31990
+ // setFormData useEffect on every keystroke and producing an
31991
+ // infinite re-render loop with stuck form inputs. The memo and
31992
+ // submit handler both handle `undefined` already via the
31993
+ // `typeof initialData === 'object'` guard.
31994
+ initialData,
31849
31995
  isLoading = false,
31850
31996
  error,
31851
31997
  submitLabel,
@@ -31872,10 +32018,12 @@ var init_Form = __esm({
31872
32018
  const isSchemaEntity = isOrbitalEntitySchema(entity);
31873
32019
  const resolvedEntity = isSchemaEntity ? entity : void 0;
31874
32020
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
31875
- const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
31876
- const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
31877
- const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
31878
- const entityDerivedFields = React126__default.useMemo(() => {
32021
+ const normalizedInitialData = React127__default.useMemo(() => {
32022
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
32023
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
32024
+ return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
32025
+ }, [entity, initialData]);
32026
+ const entityDerivedFields = React127__default.useMemo(() => {
31879
32027
  if (fields && fields.length > 0) return void 0;
31880
32028
  if (!resolvedEntity) return void 0;
31881
32029
  return resolvedEntity.fields.map(
@@ -31894,14 +32042,27 @@ var init_Form = __esm({
31894
32042
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
31895
32043
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
31896
32044
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
31897
- const [formData, setFormData] = React126__default.useState(
32045
+ const [formData, setFormData] = React127__default.useState(
31898
32046
  normalizedInitialData
31899
32047
  );
31900
- const [collapsedSections, setCollapsedSections] = React126__default.useState(
32048
+ const [collapsedSections, setCollapsedSections] = React127__default.useState(
31901
32049
  /* @__PURE__ */ new Set()
31902
32050
  );
32051
+ const formMode = props.mode;
32052
+ const mountedRef = React127__default.useRef(false);
32053
+ if (!mountedRef.current) {
32054
+ mountedRef.current = true;
32055
+ debug("forms", "mount", {
32056
+ mode: formMode,
32057
+ submitEvent,
32058
+ cancelEvent,
32059
+ fieldNames: (fields ?? []).map((f3) => f3.name ?? f3.field).filter(Boolean),
32060
+ initialDataKeys: Object.keys(normalizedInitialData),
32061
+ initialData: normalizedInitialData
32062
+ });
32063
+ }
31903
32064
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
31904
- const evalContext = React126__default.useMemo(
32065
+ const evalContext = React127__default.useMemo(
31905
32066
  () => ({
31906
32067
  formValues: formData,
31907
32068
  globalVariables: externalContext?.globalVariables ?? {},
@@ -31910,12 +32071,18 @@ var init_Form = __esm({
31910
32071
  }),
31911
32072
  [formData, externalContext]
31912
32073
  );
31913
- React126__default.useEffect(() => {
32074
+ React127__default.useEffect(() => {
32075
+ debug("forms", "initialData-sync", {
32076
+ mode: formMode,
32077
+ normalizedInitialData,
32078
+ prevFormData: formData,
32079
+ willSet: Object.keys(normalizedInitialData).length > 0
32080
+ });
31914
32081
  if (Object.keys(normalizedInitialData).length > 0) {
31915
32082
  setFormData(normalizedInitialData);
31916
32083
  }
31917
32084
  }, [normalizedInitialData]);
31918
- const processCalculations = React126__default.useCallback(
32085
+ const processCalculations = React127__default.useCallback(
31919
32086
  (changedFieldId, newFormData) => {
31920
32087
  if (!hiddenCalculations.length) return;
31921
32088
  const context = {
@@ -31940,7 +32107,7 @@ var init_Form = __esm({
31940
32107
  },
31941
32108
  [hiddenCalculations, externalContext, eventBus]
31942
32109
  );
31943
- const checkViolations = React126__default.useCallback(
32110
+ const checkViolations = React127__default.useCallback(
31944
32111
  (changedFieldId, newFormData) => {
31945
32112
  if (!violationTriggers.length) return;
31946
32113
  const context = {
@@ -31967,6 +32134,7 @@ var init_Form = __esm({
31967
32134
  );
31968
32135
  const handleChange = (name, value) => {
31969
32136
  const newFormData = { ...formData, [name]: value };
32137
+ debug("forms", "field-change", { mode: formMode, name, value, prevFormData: formData, newFormData });
31970
32138
  setFormData(newFormData);
31971
32139
  eventBus.emit("UI:FIELD_CHANGED", {
31972
32140
  fieldId: name,
@@ -31977,7 +32145,7 @@ var init_Form = __esm({
31977
32145
  processCalculations(name, newFormData);
31978
32146
  checkViolations(name, newFormData);
31979
32147
  };
31980
- const isFieldVisible = React126__default.useCallback(
32148
+ const isFieldVisible = React127__default.useCallback(
31981
32149
  (fieldName) => {
31982
32150
  const condition = conditionalFields[fieldName];
31983
32151
  if (!condition) return true;
@@ -31985,7 +32153,7 @@ var init_Form = __esm({
31985
32153
  },
31986
32154
  [conditionalFields, evalContext]
31987
32155
  );
31988
- const isSectionVisible = React126__default.useCallback(
32156
+ const isSectionVisible = React127__default.useCallback(
31989
32157
  (section) => {
31990
32158
  if (!section.condition) return true;
31991
32159
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -32005,7 +32173,18 @@ var init_Form = __esm({
32005
32173
  };
32006
32174
  const handleSubmit = (e) => {
32007
32175
  e.preventDefault();
32008
- const payload = { data: formData };
32176
+ debug("forms", "submit-enter", {
32177
+ mode: formMode,
32178
+ submitEvent,
32179
+ formData,
32180
+ normalizedInitialData
32181
+ });
32182
+ const mergedData = {
32183
+ ...normalizedInitialData,
32184
+ ...formData
32185
+ };
32186
+ const payload = { data: mergedData };
32187
+ debug("forms", "submit-emit", { mode: formMode, submitEvent: `UI:${submitEvent}`, payloadData: payload.data });
32009
32188
  eventBus.emit(`UI:${submitEvent}`, payload);
32010
32189
  if (onSubmit) {
32011
32190
  eventBus.emit(`UI:${onSubmit}`, payload);
@@ -32018,7 +32197,7 @@ var init_Form = __esm({
32018
32197
  eventBus.emit(`UI:${onCancel}`);
32019
32198
  }
32020
32199
  };
32021
- const renderField = React126__default.useCallback(
32200
+ const renderField = React127__default.useCallback(
32022
32201
  (field) => {
32023
32202
  const fieldName = field.name || field.field;
32024
32203
  if (!fieldName) return null;
@@ -32039,7 +32218,7 @@ var init_Form = __esm({
32039
32218
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
32040
32219
  );
32041
32220
  const effectiveFields = entityDerivedFields ?? fields;
32042
- const normalizedFields = React126__default.useMemo(() => {
32221
+ const normalizedFields = React127__default.useMemo(() => {
32043
32222
  if (!effectiveFields || effectiveFields.length === 0) return [];
32044
32223
  return effectiveFields.map((field) => {
32045
32224
  if (typeof field === "string") {
@@ -32061,7 +32240,7 @@ var init_Form = __esm({
32061
32240
  return field;
32062
32241
  });
32063
32242
  }, [effectiveFields, resolvedEntity]);
32064
- const schemaFields = React126__default.useMemo(() => {
32243
+ const schemaFields = React127__default.useMemo(() => {
32065
32244
  if (normalizedFields.length === 0) return null;
32066
32245
  if (isDebugEnabled()) {
32067
32246
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -32071,7 +32250,7 @@ var init_Form = __esm({
32071
32250
  }
32072
32251
  return normalizedFields.map(renderField).filter(Boolean);
32073
32252
  }, [normalizedFields, renderField, entityName, conditionalFields]);
32074
- const sectionElements = React126__default.useMemo(() => {
32253
+ const sectionElements = React127__default.useMemo(() => {
32075
32254
  if (!sections || sections.length === 0) return null;
32076
32255
  return sections.map((section) => {
32077
32256
  if (!isSectionVisible(section)) {
@@ -33595,7 +33774,7 @@ var init_List = __esm({
33595
33774
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
33596
33775
  return [];
33597
33776
  }, [entity]);
33598
- const getItemActions = React126__default.useCallback(
33777
+ const getItemActions = React127__default.useCallback(
33599
33778
  (item) => {
33600
33779
  if (!itemActions) return [];
33601
33780
  if (typeof itemActions === "function") {
@@ -34032,7 +34211,7 @@ var init_MediaGallery = __esm({
34032
34211
  [selectable, selectedItems, selectionEvent, eventBus]
34033
34212
  );
34034
34213
  const entityData = Array.isArray(entity) ? entity : [];
34035
- const items = React126__default.useMemo(() => {
34214
+ const items = React127__default.useMemo(() => {
34036
34215
  if (propItems) return propItems;
34037
34216
  if (entityData.length === 0) return [];
34038
34217
  return entityData.map((record, idx) => ({
@@ -34196,7 +34375,7 @@ var init_MediaGallery = __esm({
34196
34375
  }
34197
34376
  });
34198
34377
  function extractTitle2(children) {
34199
- if (!React126__default.isValidElement(children)) return void 0;
34378
+ if (!React127__default.isValidElement(children)) return void 0;
34200
34379
  const props = children.props;
34201
34380
  if (typeof props.title === "string") {
34202
34381
  return props.title;
@@ -34909,7 +35088,7 @@ var init_PageHeader = __esm({
34909
35088
  info: "bg-info/10 text-info"
34910
35089
  };
34911
35090
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
34912
- 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(React126__default.Fragment, { children: [
35091
+ 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(React127__default.Fragment, { children: [
34913
35092
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
34914
35093
  crumb.href ? /* @__PURE__ */ jsx(
34915
35094
  "a",
@@ -35102,7 +35281,7 @@ var init_debugRegistry = __esm({
35102
35281
  }
35103
35282
  });
35104
35283
  function useDebugData() {
35105
- const [data, setData] = React126.useState(() => ({
35284
+ const [data, setData] = React127.useState(() => ({
35106
35285
  traits: [],
35107
35286
  ticks: [],
35108
35287
  guards: [],
@@ -35116,7 +35295,7 @@ function useDebugData() {
35116
35295
  },
35117
35296
  lastUpdate: Date.now()
35118
35297
  }));
35119
- React126.useEffect(() => {
35298
+ React127.useEffect(() => {
35120
35299
  const updateData = () => {
35121
35300
  setData({
35122
35301
  traits: getAllTraits(),
@@ -35225,12 +35404,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
35225
35404
  return positions;
35226
35405
  }
35227
35406
  function WalkMinimap() {
35228
- const [walkStep, setWalkStep] = React126.useState(null);
35229
- const [traits2, setTraits] = React126.useState([]);
35230
- const [coveredEdges, setCoveredEdges] = React126.useState([]);
35231
- const [completedTraits, setCompletedTraits] = React126.useState(/* @__PURE__ */ new Set());
35232
- const prevTraitRef = React126.useRef(null);
35233
- React126.useEffect(() => {
35407
+ const [walkStep, setWalkStep] = React127.useState(null);
35408
+ const [traits2, setTraits] = React127.useState([]);
35409
+ const [coveredEdges, setCoveredEdges] = React127.useState([]);
35410
+ const [completedTraits, setCompletedTraits] = React127.useState(/* @__PURE__ */ new Set());
35411
+ const prevTraitRef = React127.useRef(null);
35412
+ React127.useEffect(() => {
35234
35413
  const interval = setInterval(() => {
35235
35414
  const w = window;
35236
35415
  const step = w.__orbitalWalkStep;
@@ -35677,15 +35856,15 @@ var init_EntitiesTab = __esm({
35677
35856
  }
35678
35857
  });
35679
35858
  function EventFlowTab({ events: events2 }) {
35680
- const [filter, setFilter] = React126.useState("all");
35681
- const containerRef = React126.useRef(null);
35682
- const [autoScroll, setAutoScroll] = React126.useState(true);
35683
- React126.useEffect(() => {
35859
+ const [filter, setFilter] = React127.useState("all");
35860
+ const containerRef = React127.useRef(null);
35861
+ const [autoScroll, setAutoScroll] = React127.useState(true);
35862
+ React127.useEffect(() => {
35684
35863
  if (autoScroll && containerRef.current) {
35685
35864
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
35686
35865
  }
35687
35866
  }, [events2.length, autoScroll]);
35688
- const filteredEvents = React126.useMemo(() => {
35867
+ const filteredEvents = React127.useMemo(() => {
35689
35868
  if (filter === "all") return events2;
35690
35869
  return events2.filter((e) => e.type === filter);
35691
35870
  }, [events2, filter]);
@@ -35804,7 +35983,7 @@ var init_EventFlowTab = __esm({
35804
35983
  }
35805
35984
  });
35806
35985
  function GuardsPanel({ guards }) {
35807
- const [filter, setFilter] = React126.useState("all");
35986
+ const [filter, setFilter] = React127.useState("all");
35808
35987
  if (guards.length === 0) {
35809
35988
  return /* @__PURE__ */ jsx(
35810
35989
  EmptyState,
@@ -35817,7 +35996,7 @@ function GuardsPanel({ guards }) {
35817
35996
  }
35818
35997
  const passedCount = guards.filter((g) => g.result).length;
35819
35998
  const failedCount = guards.length - passedCount;
35820
- const filteredGuards = React126.useMemo(() => {
35999
+ const filteredGuards = React127.useMemo(() => {
35821
36000
  if (filter === "all") return guards;
35822
36001
  if (filter === "passed") return guards.filter((g) => g.result);
35823
36002
  return guards.filter((g) => !g.result);
@@ -35978,10 +36157,10 @@ function EffectBadge({ effect }) {
35978
36157
  ] });
35979
36158
  }
35980
36159
  function TransitionTimeline({ transitions }) {
35981
- const containerRef = React126.useRef(null);
35982
- const [autoScroll, setAutoScroll] = React126.useState(true);
35983
- const [expandedId, setExpandedId] = React126.useState(null);
35984
- React126.useEffect(() => {
36160
+ const containerRef = React127.useRef(null);
36161
+ const [autoScroll, setAutoScroll] = React127.useState(true);
36162
+ const [expandedId, setExpandedId] = React127.useState(null);
36163
+ React127.useEffect(() => {
35985
36164
  if (autoScroll && containerRef.current) {
35986
36165
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
35987
36166
  }
@@ -36267,9 +36446,9 @@ function getAllEvents(traits2) {
36267
36446
  }
36268
36447
  function EventDispatcherTab({ traits: traits2, schema }) {
36269
36448
  const eventBus = useEventBus();
36270
- const [log4, setLog] = React126.useState([]);
36271
- const prevStatesRef = React126.useRef(/* @__PURE__ */ new Map());
36272
- React126.useEffect(() => {
36449
+ const [log4, setLog] = React127.useState([]);
36450
+ const prevStatesRef = React127.useRef(/* @__PURE__ */ new Map());
36451
+ React127.useEffect(() => {
36273
36452
  for (const trait of traits2) {
36274
36453
  const prev = prevStatesRef.current.get(trait.id);
36275
36454
  if (prev && prev !== trait.currentState) {
@@ -36439,10 +36618,10 @@ function VerifyModePanel({
36439
36618
  serverCount,
36440
36619
  localCount
36441
36620
  }) {
36442
- const [expanded, setExpanded] = React126.useState(true);
36443
- const scrollRef = React126.useRef(null);
36444
- const prevCountRef = React126.useRef(0);
36445
- React126.useEffect(() => {
36621
+ const [expanded, setExpanded] = React127.useState(true);
36622
+ const scrollRef = React127.useRef(null);
36623
+ const prevCountRef = React127.useRef(0);
36624
+ React127.useEffect(() => {
36446
36625
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
36447
36626
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
36448
36627
  }
@@ -36508,10 +36687,10 @@ function RuntimeDebugger({
36508
36687
  defaultTab,
36509
36688
  schema
36510
36689
  }) {
36511
- const [isCollapsed, setIsCollapsed] = React126.useState(mode === "verify" ? true : defaultCollapsed);
36512
- const [isVisible, setIsVisible] = React126.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
36690
+ const [isCollapsed, setIsCollapsed] = React127.useState(mode === "verify" ? true : defaultCollapsed);
36691
+ const [isVisible, setIsVisible] = React127.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
36513
36692
  const debugData = useDebugData();
36514
- React126.useEffect(() => {
36693
+ React127.useEffect(() => {
36515
36694
  if (mode === "inline") return;
36516
36695
  return onDebugToggle((enabled) => {
36517
36696
  setIsVisible(enabled);
@@ -36520,7 +36699,7 @@ function RuntimeDebugger({
36520
36699
  }
36521
36700
  });
36522
36701
  }, [mode]);
36523
- React126.useEffect(() => {
36702
+ React127.useEffect(() => {
36524
36703
  if (mode === "inline") return;
36525
36704
  const handleKeyDown = (e) => {
36526
36705
  if (e.key === "`" && isVisible) {
@@ -37069,7 +37248,7 @@ function SequenceBar({
37069
37248
  onSlotRemove(index);
37070
37249
  }, [onSlotRemove, playing]);
37071
37250
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
37072
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
37251
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
37073
37252
  i > 0 && /* @__PURE__ */ jsx(
37074
37253
  Typography,
37075
37254
  {
@@ -38414,7 +38593,7 @@ var init_StatCard2 = __esm({
38414
38593
  const labelToUse = propLabel ?? propTitle;
38415
38594
  const eventBus = useEventBus();
38416
38595
  const { t } = useTranslate();
38417
- const handleActionClick = React126__default.useCallback(() => {
38596
+ const handleActionClick = React127__default.useCallback(() => {
38418
38597
  if (action?.event) {
38419
38598
  eventBus.emit(`UI:${action.event}`, {});
38420
38599
  }
@@ -38425,7 +38604,7 @@ var init_StatCard2 = __esm({
38425
38604
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
38426
38605
  const isLoading = externalLoading ?? false;
38427
38606
  const error = externalError;
38428
- const computeMetricValue = React126__default.useCallback(
38607
+ const computeMetricValue = React127__default.useCallback(
38429
38608
  (metric, items) => {
38430
38609
  if (metric.value !== void 0) {
38431
38610
  return metric.value;
@@ -38464,7 +38643,7 @@ var init_StatCard2 = __esm({
38464
38643
  },
38465
38644
  []
38466
38645
  );
38467
- const schemaStats = React126__default.useMemo(() => {
38646
+ const schemaStats = React127__default.useMemo(() => {
38468
38647
  if (!metrics || metrics.length === 0) return null;
38469
38648
  return metrics.map((metric) => ({
38470
38649
  label: metric.label,
@@ -38472,7 +38651,7 @@ var init_StatCard2 = __esm({
38472
38651
  format: metric.format
38473
38652
  }));
38474
38653
  }, [metrics, data, computeMetricValue]);
38475
- const calculatedTrend = React126__default.useMemo(() => {
38654
+ const calculatedTrend = React127__default.useMemo(() => {
38476
38655
  if (manualTrend !== void 0) return manualTrend;
38477
38656
  if (previousValue === void 0 || currentValue === void 0)
38478
38657
  return void 0;
@@ -39456,7 +39635,7 @@ var init_Timeline = __esm({
39456
39635
  }) => {
39457
39636
  const { t } = useTranslate();
39458
39637
  const entityData = Array.isArray(entity) ? entity : [];
39459
- const items = React126__default.useMemo(() => {
39638
+ const items = React127__default.useMemo(() => {
39460
39639
  if (propItems) return propItems;
39461
39640
  if (entityData.length === 0) return [];
39462
39641
  return entityData.map((record, idx) => {
@@ -39563,7 +39742,7 @@ var init_Timeline = __esm({
39563
39742
  }
39564
39743
  });
39565
39744
  function extractToastProps(children) {
39566
- if (!React126__default.isValidElement(children)) {
39745
+ if (!React127__default.isValidElement(children)) {
39567
39746
  if (typeof children === "string") {
39568
39747
  return { message: children };
39569
39748
  }
@@ -39601,7 +39780,7 @@ var init_ToastSlot = __esm({
39601
39780
  eventBus.emit("UI:CLOSE");
39602
39781
  };
39603
39782
  if (!isVisible) return null;
39604
- const isCustomContent = React126__default.isValidElement(children) && !message;
39783
+ const isCustomContent = React127__default.isValidElement(children) && !message;
39605
39784
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
39606
39785
  Toast,
39607
39786
  {
@@ -39870,7 +40049,7 @@ var init_WizardContainer = __esm({
39870
40049
  const isCompleted = index < currentStep;
39871
40050
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
39872
40051
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
39873
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
40052
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
39874
40053
  /* @__PURE__ */ jsx(
39875
40054
  Button,
39876
40055
  {
@@ -42059,7 +42238,7 @@ function UnitRenderer({
42059
42238
  onAnimationStateChange,
42060
42239
  animationSpeed = 1
42061
42240
  }) {
42062
- const handleUnitClick = React126__default.useCallback(
42241
+ const handleUnitClick = React127__default.useCallback(
42063
42242
  (unit) => {
42064
42243
  onUnitClick?.(unit);
42065
42244
  },
@@ -45253,7 +45432,7 @@ var init_Avl3DViewer = __esm({
45253
45432
  const handleTraitClick = useCallback((name) => {
45254
45433
  dispatch({ type: "ZOOM_INTO_TRAIT", trait: name, targetPosition: { x: 0, y: 0 } });
45255
45434
  }, []);
45256
- const [highlightedTrait, setHighlightedTrait] = React126__default.useState(null);
45435
+ const [highlightedTrait, setHighlightedTrait] = React127__default.useState(null);
45257
45436
  const handleTransitionClick = useCallback((index) => {
45258
45437
  dispatch({ type: "ZOOM_INTO_TRANSITION", transitionIndex: index, targetPosition: { x: 0, y: 0 } });
45259
45438
  }, []);
@@ -45340,7 +45519,7 @@ var init_Avl3DViewer = __esm({
45340
45519
  gap: "xs",
45341
45520
  align: "center",
45342
45521
  className: "absolute top-2 left-2 z-10 bg-surface/80 backdrop-blur rounded-md px-3 py-1.5",
45343
- children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
45522
+ children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
45344
45523
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "mx-1", children: "/" }),
45345
45524
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
45346
45525
  Box,
@@ -45718,12 +45897,12 @@ var init_three = __esm({
45718
45897
  }
45719
45898
  });
45720
45899
  function lazyThree(name, loader) {
45721
- const Lazy = React126__default.lazy(() => loader().then((m) => ({ default: m[name] })));
45900
+ const Lazy = React127__default.lazy(() => loader().then((m) => ({ default: m[name] })));
45722
45901
  function ThreeWrapper(props) {
45723
- return React126__default.createElement(
45724
- React126__default.Suspense,
45902
+ return React127__default.createElement(
45903
+ React127__default.Suspense,
45725
45904
  { fallback: null },
45726
- React126__default.createElement(Lazy, props)
45905
+ React127__default.createElement(Lazy, props)
45727
45906
  );
45728
45907
  }
45729
45908
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -46211,7 +46390,7 @@ function SuspenseConfigProvider({
46211
46390
  config,
46212
46391
  children
46213
46392
  }) {
46214
- return React126__default.createElement(
46393
+ return React127__default.createElement(
46215
46394
  SuspenseConfigContext.Provider,
46216
46395
  { value: config },
46217
46396
  children
@@ -46675,7 +46854,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46675
46854
  const key = `${parentId}-${index}-trait:${traitName}`;
46676
46855
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
46677
46856
  }
46678
- return /* @__PURE__ */ jsx(React126__default.Fragment, { children: child }, `${parentId}-${index}`);
46857
+ return /* @__PURE__ */ jsx(React127__default.Fragment, { children: child }, `${parentId}-${index}`);
46679
46858
  }
46680
46859
  if (!child || typeof child !== "object") return null;
46681
46860
  const childId = `${parentId}-${index}`;
@@ -46737,6 +46916,14 @@ function SlotContentRenderer({
46737
46916
  patternPath
46738
46917
  }) {
46739
46918
  const entityProp = content.props.entity;
46919
+ if (content.pattern === "form-section") {
46920
+ slotLog.debug("SlotContentRenderer:form-section-render", {
46921
+ contentId: content.id,
46922
+ sourceTrait: content.sourceTrait,
46923
+ entityRefId: refId(entityProp),
46924
+ entityIsObject: entityProp !== null && typeof entityProp === "object" && !Array.isArray(entityProp)
46925
+ });
46926
+ }
46740
46927
  if (typeof entityProp === "string" && entityProp.length > 0) {
46741
46928
  if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") {
46742
46929
  throw new Error(
@@ -46881,6 +47068,7 @@ var init_UISlotRenderer = __esm({
46881
47068
  init_Box();
46882
47069
  init_Typography();
46883
47070
  init_useEventBus();
47071
+ init_SlotsContext();
46884
47072
  init_cn();
46885
47073
  init_ErrorBoundary();
46886
47074
  init_Skeleton();
@@ -47307,7 +47495,7 @@ var AvlTransition = ({
47307
47495
  opacity = 1,
47308
47496
  className
47309
47497
  }) => {
47310
- const ids = React126__default.useMemo(() => {
47498
+ const ids = React127__default.useMemo(() => {
47311
47499
  avlTransitionId += 1;
47312
47500
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
47313
47501
  }, []);
@@ -48072,7 +48260,7 @@ var AvlStateMachine = ({
48072
48260
  color = "var(--color-primary)",
48073
48261
  animated = false
48074
48262
  }) => {
48075
- const ids = React126__default.useMemo(() => {
48263
+ const ids = React127__default.useMemo(() => {
48076
48264
  avlSmId += 1;
48077
48265
  const base = `avl-sm-${avlSmId}`;
48078
48266
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -48267,7 +48455,7 @@ var AvlOrbitalUnit = ({
48267
48455
  color = "var(--color-primary)",
48268
48456
  animated = false
48269
48457
  }) => {
48270
- const ids = React126__default.useMemo(() => {
48458
+ const ids = React127__default.useMemo(() => {
48271
48459
  avlOuId += 1;
48272
48460
  const base = `avl-ou-${avlOuId}`;
48273
48461
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -48359,7 +48547,7 @@ var AvlClosedCircuit = ({
48359
48547
  color = "var(--color-primary)",
48360
48548
  animated = false
48361
48549
  }) => {
48362
- const ids = React126__default.useMemo(() => {
48550
+ const ids = React127__default.useMemo(() => {
48363
48551
  avlCcId += 1;
48364
48552
  const base = `avl-cc-${avlCcId}`;
48365
48553
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -48512,7 +48700,7 @@ var AvlEmitListen = ({
48512
48700
  color = "var(--color-primary)",
48513
48701
  animated = false
48514
48702
  }) => {
48515
- const ids = React126__default.useMemo(() => {
48703
+ const ids = React127__default.useMemo(() => {
48516
48704
  avlElId += 1;
48517
48705
  const base = `avl-el-${avlElId}`;
48518
48706
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -48785,7 +48973,7 @@ function renderNode(node, color, glowId) {
48785
48973
  const baseR = node.type === "operator" ? 20 : 16;
48786
48974
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
48787
48975
  const nc = nodeColor(node.type, color);
48788
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
48976
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
48789
48977
  node.children.map((child, i) => {
48790
48978
  const childR = Math.max(
48791
48979
  child.type === "operator" ? 20 : 16,
@@ -48842,7 +49030,7 @@ var AvlExprTree = ({
48842
49030
  className,
48843
49031
  color = "var(--color-primary)"
48844
49032
  }) => {
48845
- const ids = React126__default.useMemo(() => {
49033
+ const ids = React127__default.useMemo(() => {
48846
49034
  avlEtId += 1;
48847
49035
  return { glow: `avl-et-${avlEtId}-glow` };
48848
49036
  }, []);
@@ -49816,7 +50004,7 @@ var SystemNode = ({ data }) => {
49816
50004
  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) => {
49817
50005
  const tc = transitionCounts[s.name] ?? 0;
49818
50006
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
49819
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
50007
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
49820
50008
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
49821
50009
  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 })
49822
50010
  ] }, s.name);
@@ -49856,7 +50044,7 @@ var MiniStateMachine = ({ data, className }) => {
49856
50044
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
49857
50045
  const tc = transitionCounts[s.name] ?? 0;
49858
50046
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
49859
- return /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
50047
+ return /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
49860
50048
  /* @__PURE__ */ jsx(
49861
50049
  AvlState,
49862
50050
  {
@@ -50954,7 +51142,7 @@ function VerificationProvider({
50954
51142
  useEffect(() => {
50955
51143
  if (!isEnabled) return;
50956
51144
  if (!eventBus.onAny) return;
50957
- const unsub = eventBus.onAny((evt) => {
51145
+ const verificationProviderLifecycleListener = (evt) => {
50958
51146
  const parsed = parseLifecycleEvent(evt.type);
50959
51147
  if (!parsed) return;
50960
51148
  log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
@@ -51044,7 +51232,11 @@ function VerificationProvider({
51044
51232
  });
51045
51233
  log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
51046
51234
  }
51235
+ };
51236
+ Object.defineProperty(verificationProviderLifecycleListener, "name", {
51237
+ value: "VerificationProvider:lifecycle"
51047
51238
  });
51239
+ const unsub = eventBus.onAny(verificationProviderLifecycleListener);
51048
51240
  registerCheck(
51049
51241
  "verification-provider",
51050
51242
  "VerificationProvider active (compiled path)",
@@ -51795,82 +51987,9 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51795
51987
  canHandleEvent
51796
51988
  };
51797
51989
  }
51798
- var DEFAULT_SOURCE_KEY2 = "__default__";
51799
- function slotEntriesInOrder(slot) {
51800
- if (!slot) return [];
51801
- const out = [];
51802
- for (const [sourceKey, entry] of Object.entries(slot)) {
51803
- if (entry.patterns.length > 0) {
51804
- out.push({ sourceKey, entry });
51805
- }
51806
- }
51807
- return out;
51808
- }
51809
- var SlotsStateContext = createContext({});
51810
- var SlotsActionsContext = createContext(null);
51811
- function SlotsProvider({ children }) {
51812
- const [slots, setSlots] = useState({});
51813
- const setSlotPatterns = useCallback((slot, patterns, source) => {
51814
- const sourceKey = source?.trait ?? DEFAULT_SOURCE_KEY2;
51815
- setSlots((prev) => {
51816
- const prevSlot = prev[slot] ?? {};
51817
- return {
51818
- ...prev,
51819
- [slot]: {
51820
- ...prevSlot,
51821
- [sourceKey]: { patterns, source }
51822
- }
51823
- };
51824
- });
51825
- }, []);
51826
- const clearSlot = useCallback((slot) => {
51827
- setSlots((prev) => {
51828
- const existing = prev[slot];
51829
- if (existing && Object.keys(existing).length === 0) {
51830
- return prev;
51831
- }
51832
- return { ...prev, [slot]: {} };
51833
- });
51834
- }, []);
51835
- const clearSlotForSource = useCallback((slot, sourceTrait) => {
51836
- setSlots((prev) => {
51837
- const existing = prev[slot];
51838
- if (!existing || !(sourceTrait in existing)) return prev;
51839
- const next = { ...existing };
51840
- delete next[sourceTrait];
51841
- return { ...prev, [slot]: next };
51842
- });
51843
- }, []);
51844
- const clearAllSlots = useCallback(() => {
51845
- setSlots({});
51846
- }, []);
51847
- const actionsRef = useRef({
51848
- setSlotPatterns,
51849
- clearSlot,
51850
- clearSlotForSource,
51851
- clearAllSlots
51852
- });
51853
- actionsRef.current = { setSlotPatterns, clearSlot, clearSlotForSource, clearAllSlots };
51854
- const [stableActions] = useState(() => ({
51855
- setSlotPatterns: (...args) => actionsRef.current.setSlotPatterns(...args),
51856
- clearSlot: (...args) => actionsRef.current.clearSlot(...args),
51857
- clearSlotForSource: (...args) => actionsRef.current.clearSlotForSource(...args),
51858
- clearAllSlots: () => actionsRef.current.clearAllSlots()
51859
- }));
51860
- return /* @__PURE__ */ jsx(SlotsActionsContext.Provider, { value: stableActions, children: /* @__PURE__ */ jsx(SlotsStateContext.Provider, { value: slots, children }) });
51861
- }
51862
- function useSlots() {
51863
- return useContext(SlotsStateContext);
51864
- }
51865
- function useSlotsActions() {
51866
- const actions = useContext(SlotsActionsContext);
51867
- if (!actions) {
51868
- throw new Error("useSlotsActions must be used within a SlotsProvider");
51869
- }
51870
- return actions;
51871
- }
51872
51990
 
51873
51991
  // runtime/OrbPreview.tsx
51992
+ init_SlotsContext();
51874
51993
  init_EntitySchemaContext();
51875
51994
 
51876
51995
  // runtime/ServerBridge.tsx
@@ -52090,6 +52209,10 @@ function SlotBridge() {
52090
52209
  const slots = useSlots();
52091
52210
  const { render, clear } = useUISlots();
52092
52211
  useEffect(() => {
52212
+ slotLog.debug("SlotBridge:effect-fired", {
52213
+ slotCount: Object.keys(slots).length,
52214
+ slots: Object.keys(slots)
52215
+ });
52093
52216
  for (const [slotName, slotState] of Object.entries(slots)) {
52094
52217
  const entries = slotEntriesInOrder(slotState);
52095
52218
  if (entries.length === 0) {
@@ -52111,6 +52234,12 @@ function SlotBridge() {
52111
52234
  const only = children[0];
52112
52235
  const { type, children: nested, ...rest } = only;
52113
52236
  const lastEntry = entries[entries.length - 1];
52237
+ slotLog.debug("SlotBridge:render-single", {
52238
+ slot: slotName,
52239
+ patternType: type,
52240
+ entityRefId: refId(rest.entity),
52241
+ sourceTrait: lastEntry.entry.source?.trait
52242
+ });
52114
52243
  render({
52115
52244
  target: slotName,
52116
52245
  pattern: type,
@@ -52765,7 +52894,7 @@ var OrbPreviewNodeInner = (props) => {
52765
52894
  }
52766
52895
  );
52767
52896
  };
52768
- var OrbPreviewNode = React126__default.memo(OrbPreviewNodeInner);
52897
+ var OrbPreviewNode = React127__default.memo(OrbPreviewNodeInner);
52769
52898
  OrbPreviewNode.displayName = "OrbPreviewNode";
52770
52899
  var EventFlowEdgeInner = (props) => {
52771
52900
  const {
@@ -52842,7 +52971,7 @@ var EventFlowEdgeInner = (props) => {
52842
52971
  ) })
52843
52972
  ] });
52844
52973
  };
52845
- var EventFlowEdge = React126__default.memo(EventFlowEdgeInner);
52974
+ var EventFlowEdge = React127__default.memo(EventFlowEdgeInner);
52846
52975
  EventFlowEdge.displayName = "EventFlowEdge";
52847
52976
 
52848
52977
  // components/molecules/avl/BehaviorComposeNode.tsx
@@ -52981,7 +53110,7 @@ var BehaviorComposeNodeInner = (props) => {
52981
53110
  }
52982
53111
  );
52983
53112
  };
52984
- var BehaviorComposeNode = React126__default.memo(BehaviorComposeNodeInner);
53113
+ var BehaviorComposeNode = React127__default.memo(BehaviorComposeNodeInner);
52985
53114
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
52986
53115
 
52987
53116
  // components/molecules/avl/avl-behavior-compose-converter.ts
@@ -53921,7 +54050,7 @@ var ZoomBreadcrumb = ({
53921
54050
  if (eventName && band === "detail") {
53922
54051
  segments.push({ icon: "\u26A1", label: eventName });
53923
54052
  }
53924
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-[11px] text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
54053
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-[11px] text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
53925
54054
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
53926
54055
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
53927
54056
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -54380,7 +54509,7 @@ var EventWireOverlay = ({
54380
54509
  containerW,
54381
54510
  containerH
54382
54511
  }) => {
54383
- const ids = React126__default.useMemo(() => {
54512
+ const ids = React127__default.useMemo(() => {
54384
54513
  avlOczWireId += 1;
54385
54514
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
54386
54515
  }, []);
@@ -54698,7 +54827,7 @@ var AvlOrbitalsCosmicZoom = ({
54698
54827
  borderRadius: 6,
54699
54828
  border: `1px solid ${color}`
54700
54829
  },
54701
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React126__default.Fragment, { children: [
54830
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
54702
54831
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
54703
54832
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
54704
54833
  Box,