@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.
@@ -1,5 +1,5 @@
1
- import * as React115 from 'react';
2
- import React115__default, { createContext, useContext, useRef, useEffect, useCallback, Suspense, useState, useMemo, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React116 from 'react';
2
+ import React116__default, { createContext, useContext, useRef, useEffect, useCallback, Suspense, useState, useMemo, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { EventBusContext } from '@almadar/ui/providers';
5
5
  import { clsx } from 'clsx';
@@ -699,7 +699,7 @@ var init_Box = __esm({
699
699
  fixed: "fixed",
700
700
  sticky: "sticky"
701
701
  };
702
- Box = React115__default.forwardRef(
702
+ Box = React116__default.forwardRef(
703
703
  ({
704
704
  padding,
705
705
  paddingX,
@@ -1398,7 +1398,7 @@ function resolveIconProp(value, sizeClass) {
1398
1398
  const IconComp = value;
1399
1399
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1400
1400
  }
1401
- if (React115__default.isValidElement(value)) {
1401
+ if (React116__default.isValidElement(value)) {
1402
1402
  return value;
1403
1403
  }
1404
1404
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1474,7 +1474,7 @@ var init_Button = __esm({
1474
1474
  md: "h-4 w-4",
1475
1475
  lg: "h-5 w-5"
1476
1476
  };
1477
- Button = React115__default.forwardRef(
1477
+ Button = React116__default.forwardRef(
1478
1478
  ({
1479
1479
  className,
1480
1480
  variant = "primary",
@@ -1577,7 +1577,7 @@ var init_Badge = __esm({
1577
1577
  md: "px-2.5 py-1 text-sm",
1578
1578
  lg: "px-3 py-1.5 text-base"
1579
1579
  };
1580
- Badge = React115__default.forwardRef(
1580
+ Badge = React116__default.forwardRef(
1581
1581
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1582
1582
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1583
1583
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -1714,11 +1714,30 @@ var init_Toast = __esm({
1714
1714
  Toast.displayName = "Toast";
1715
1715
  }
1716
1716
  });
1717
+ function refId(obj) {
1718
+ if (obj === null || obj === void 0 || typeof obj !== "object") return null;
1719
+ const existing = refIds.get(obj);
1720
+ if (existing !== void 0) return existing;
1721
+ const id = nextRefId++;
1722
+ refIds.set(obj, id);
1723
+ return id;
1724
+ }
1725
+ var slotLog, refIds, nextRefId;
1726
+ var init_SlotsContext = __esm({
1727
+ "runtime/ui/SlotsContext.tsx"() {
1728
+ init_logger();
1729
+ slotLog = createLogger("almadar:ui:slot-render");
1730
+ refIds = /* @__PURE__ */ new WeakMap();
1731
+ nextRefId = 1;
1732
+ createContext({});
1733
+ createContext(null);
1734
+ }
1735
+ });
1717
1736
  var Input;
1718
1737
  var init_Input = __esm({
1719
1738
  "components/atoms/Input.tsx"() {
1720
1739
  init_cn();
1721
- Input = React115__default.forwardRef(
1740
+ Input = React116__default.forwardRef(
1722
1741
  ({
1723
1742
  className,
1724
1743
  inputType,
@@ -1836,7 +1855,7 @@ var Label;
1836
1855
  var init_Label = __esm({
1837
1856
  "components/atoms/Label.tsx"() {
1838
1857
  init_cn();
1839
- Label = React115__default.forwardRef(
1858
+ Label = React116__default.forwardRef(
1840
1859
  ({ className, required, children, ...props }, ref) => {
1841
1860
  return /* @__PURE__ */ jsxs(
1842
1861
  "label",
@@ -1862,7 +1881,7 @@ var Textarea;
1862
1881
  var init_Textarea = __esm({
1863
1882
  "components/atoms/Textarea.tsx"() {
1864
1883
  init_cn();
1865
- Textarea = React115__default.forwardRef(
1884
+ Textarea = React116__default.forwardRef(
1866
1885
  ({ className, error, ...props }, ref) => {
1867
1886
  return /* @__PURE__ */ jsx(
1868
1887
  "textarea",
@@ -1891,7 +1910,7 @@ var Select;
1891
1910
  var init_Select = __esm({
1892
1911
  "components/atoms/Select.tsx"() {
1893
1912
  init_cn();
1894
- Select = React115__default.forwardRef(
1913
+ Select = React116__default.forwardRef(
1895
1914
  ({ className, options, placeholder, error, ...props }, ref) => {
1896
1915
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1897
1916
  /* @__PURE__ */ jsxs(
@@ -1933,7 +1952,7 @@ var Checkbox;
1933
1952
  var init_Checkbox = __esm({
1934
1953
  "components/atoms/Checkbox.tsx"() {
1935
1954
  init_cn();
1936
- Checkbox = React115__default.forwardRef(
1955
+ Checkbox = React116__default.forwardRef(
1937
1956
  ({ className, label, id, ...props }, ref) => {
1938
1957
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
1939
1958
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2015,7 +2034,7 @@ var init_Card = __esm({
2015
2034
  md: "shadow",
2016
2035
  lg: "shadow-lg"
2017
2036
  };
2018
- Card = React115__default.forwardRef(
2037
+ Card = React116__default.forwardRef(
2019
2038
  ({
2020
2039
  className,
2021
2040
  variant = "bordered",
@@ -2051,9 +2070,9 @@ var init_Card = __esm({
2051
2070
  }
2052
2071
  );
2053
2072
  Card.displayName = "Card";
2054
- CardHeader = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2073
+ CardHeader = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2055
2074
  CardHeader.displayName = "CardHeader";
2056
- CardTitle = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2075
+ CardTitle = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2057
2076
  "h3",
2058
2077
  {
2059
2078
  ref,
@@ -2066,11 +2085,11 @@ var init_Card = __esm({
2066
2085
  }
2067
2086
  ));
2068
2087
  CardTitle.displayName = "CardTitle";
2069
- CardContent = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2088
+ CardContent = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2070
2089
  CardContent.displayName = "CardContent";
2071
2090
  CardBody = CardContent;
2072
2091
  CardBody.displayName = "CardBody";
2073
- CardFooter = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2092
+ CardFooter = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2074
2093
  "div",
2075
2094
  {
2076
2095
  ref,
@@ -2091,7 +2110,7 @@ var init_Spinner = __esm({
2091
2110
  md: "h-6 w-6",
2092
2111
  lg: "h-8 w-8"
2093
2112
  };
2094
- Spinner = React115__default.forwardRef(
2113
+ Spinner = React116__default.forwardRef(
2095
2114
  ({ className, size = "md", ...props }, ref) => {
2096
2115
  return /* @__PURE__ */ jsx(
2097
2116
  "div",
@@ -2539,7 +2558,7 @@ var Radio;
2539
2558
  var init_Radio = __esm({
2540
2559
  "components/atoms/Radio.tsx"() {
2541
2560
  init_cn();
2542
- Radio = React115__default.forwardRef(
2561
+ Radio = React116__default.forwardRef(
2543
2562
  ({
2544
2563
  label,
2545
2564
  helperText,
@@ -2650,7 +2669,7 @@ var init_Switch = __esm({
2650
2669
  "components/atoms/Switch.tsx"() {
2651
2670
  "use client";
2652
2671
  init_cn();
2653
- Switch = React115.forwardRef(
2672
+ Switch = React116.forwardRef(
2654
2673
  ({
2655
2674
  checked,
2656
2675
  defaultChecked = false,
@@ -2661,10 +2680,10 @@ var init_Switch = __esm({
2661
2680
  name,
2662
2681
  className
2663
2682
  }, ref) => {
2664
- const [isChecked, setIsChecked] = React115.useState(
2683
+ const [isChecked, setIsChecked] = React116.useState(
2665
2684
  checked !== void 0 ? checked : defaultChecked
2666
2685
  );
2667
- React115.useEffect(() => {
2686
+ React116.useEffect(() => {
2668
2687
  if (checked !== void 0) {
2669
2688
  setIsChecked(checked);
2670
2689
  }
@@ -3090,8 +3109,8 @@ var init_LawReferenceTooltip = __esm({
3090
3109
  position = "top",
3091
3110
  className
3092
3111
  }) => {
3093
- const [isVisible, setIsVisible] = React115__default.useState(false);
3094
- const timeoutRef = React115__default.useRef(null);
3112
+ const [isVisible, setIsVisible] = React116__default.useState(false);
3113
+ const timeoutRef = React116__default.useRef(null);
3095
3114
  const handleMouseEnter = () => {
3096
3115
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3097
3116
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -3100,7 +3119,7 @@ var init_LawReferenceTooltip = __esm({
3100
3119
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3101
3120
  setIsVisible(false);
3102
3121
  };
3103
- React115__default.useEffect(() => {
3122
+ React116__default.useEffect(() => {
3104
3123
  return () => {
3105
3124
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3106
3125
  };
@@ -3310,7 +3329,7 @@ var init_StatusDot = __esm({
3310
3329
  md: "w-2.5 h-2.5",
3311
3330
  lg: "w-3 h-3"
3312
3331
  };
3313
- StatusDot = React115__default.forwardRef(
3332
+ StatusDot = React116__default.forwardRef(
3314
3333
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
3315
3334
  return /* @__PURE__ */ jsx(
3316
3335
  "span",
@@ -3363,7 +3382,7 @@ var init_TrendIndicator = __esm({
3363
3382
  down: TrendingDown,
3364
3383
  flat: ArrowRight
3365
3384
  };
3366
- TrendIndicator = React115__default.forwardRef(
3385
+ TrendIndicator = React116__default.forwardRef(
3367
3386
  ({
3368
3387
  className,
3369
3388
  value,
@@ -3430,7 +3449,7 @@ var init_RangeSlider = __esm({
3430
3449
  md: "w-4 h-4",
3431
3450
  lg: "w-5 h-5"
3432
3451
  };
3433
- RangeSlider = React115__default.forwardRef(
3452
+ RangeSlider = React116__default.forwardRef(
3434
3453
  ({
3435
3454
  className,
3436
3455
  min = 0,
@@ -4026,7 +4045,7 @@ var init_ContentSection = __esm({
4026
4045
  md: "py-16",
4027
4046
  lg: "py-24"
4028
4047
  };
4029
- ContentSection = React115__default.forwardRef(
4048
+ ContentSection = React116__default.forwardRef(
4030
4049
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4031
4050
  return /* @__PURE__ */ jsx(
4032
4051
  Box,
@@ -4560,7 +4579,7 @@ var init_AnimatedReveal = __esm({
4560
4579
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
4561
4580
  "none": {}
4562
4581
  };
4563
- AnimatedReveal = React115__default.forwardRef(
4582
+ AnimatedReveal = React116__default.forwardRef(
4564
4583
  ({
4565
4584
  trigger = "scroll",
4566
4585
  animation = "fade-up",
@@ -4720,7 +4739,7 @@ var init_AnimatedGraphic = __esm({
4720
4739
  "components/atoms/AnimatedGraphic.tsx"() {
4721
4740
  "use client";
4722
4741
  init_cn();
4723
- AnimatedGraphic = React115__default.forwardRef(
4742
+ AnimatedGraphic = React116__default.forwardRef(
4724
4743
  ({
4725
4744
  src,
4726
4745
  svgContent,
@@ -4743,7 +4762,7 @@ var init_AnimatedGraphic = __esm({
4743
4762
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
4744
4763
  const resolvedSvg = svgContent ?? fetchedSvg;
4745
4764
  const prevAnimateRef = useRef(animate);
4746
- const setRef = React115__default.useCallback(
4765
+ const setRef = React116__default.useCallback(
4747
4766
  (node) => {
4748
4767
  containerRef.current = node;
4749
4768
  if (typeof ref === "function") ref(node);
@@ -4961,9 +4980,9 @@ function ScoreDisplay({
4961
4980
  ...rest
4962
4981
  }) {
4963
4982
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
4964
- const [displayValue, setDisplayValue] = React115.useState(resolvedValue);
4965
- const [isAnimating, setIsAnimating] = React115.useState(false);
4966
- React115.useEffect(() => {
4983
+ const [displayValue, setDisplayValue] = React116.useState(resolvedValue);
4984
+ const [isAnimating, setIsAnimating] = React116.useState(false);
4985
+ React116.useEffect(() => {
4967
4986
  if (!animated || displayValue === resolvedValue) {
4968
4987
  setDisplayValue(resolvedValue);
4969
4988
  return;
@@ -5033,9 +5052,9 @@ function ControlButton({
5033
5052
  className
5034
5053
  }) {
5035
5054
  const eventBus = useEventBus();
5036
- const [isPressed, setIsPressed] = React115.useState(false);
5055
+ const [isPressed, setIsPressed] = React116.useState(false);
5037
5056
  const actualPressed = pressed ?? isPressed;
5038
- const handlePointerDown = React115.useCallback(
5057
+ const handlePointerDown = React116.useCallback(
5039
5058
  (e) => {
5040
5059
  e.preventDefault();
5041
5060
  if (disabled) return;
@@ -5045,7 +5064,7 @@ function ControlButton({
5045
5064
  },
5046
5065
  [disabled, pressEvent, eventBus, onPress]
5047
5066
  );
5048
- const handlePointerUp = React115.useCallback(
5067
+ const handlePointerUp = React116.useCallback(
5049
5068
  (e) => {
5050
5069
  e.preventDefault();
5051
5070
  if (disabled) return;
@@ -5055,7 +5074,7 @@ function ControlButton({
5055
5074
  },
5056
5075
  [disabled, releaseEvent, eventBus, onRelease]
5057
5076
  );
5058
- const handlePointerLeave = React115.useCallback(
5077
+ const handlePointerLeave = React116.useCallback(
5059
5078
  (e) => {
5060
5079
  if (isPressed) {
5061
5080
  setIsPressed(false);
@@ -5953,9 +5972,9 @@ function MiniMap({
5953
5972
  viewportRect,
5954
5973
  className
5955
5974
  }) {
5956
- const canvasRef = React115.useRef(null);
5957
- const frameRef = React115.useRef(0);
5958
- React115.useEffect(() => {
5975
+ const canvasRef = React116.useRef(null);
5976
+ const frameRef = React116.useRef(0);
5977
+ React116.useEffect(() => {
5959
5978
  const canvas = canvasRef.current;
5960
5979
  if (!canvas) return;
5961
5980
  const ctx = canvas.getContext("2d");
@@ -6294,7 +6313,7 @@ var init_ErrorBoundary = __esm({
6294
6313
  "use client";
6295
6314
  init_cn();
6296
6315
  init_ErrorState();
6297
- ErrorBoundary = class extends React115__default.Component {
6316
+ ErrorBoundary = class extends React116__default.Component {
6298
6317
  constructor(props) {
6299
6318
  super(props);
6300
6319
  __publicField(this, "reset", () => {
@@ -7118,8 +7137,8 @@ var init_Tooltip = __esm({
7118
7137
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7119
7138
  };
7120
7139
  }, []);
7121
- const triggerElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7122
- const trigger = React115__default.cloneElement(triggerElement, {
7140
+ const triggerElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7141
+ const trigger = React116__default.cloneElement(triggerElement, {
7123
7142
  ref: triggerRef,
7124
7143
  onMouseEnter: handleMouseEnter,
7125
7144
  onMouseLeave: handleMouseLeave,
@@ -7240,8 +7259,8 @@ var init_Popover = __esm({
7240
7259
  onMouseEnter: handleOpen,
7241
7260
  onMouseLeave: handleClose
7242
7261
  };
7243
- const childElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7244
- const triggerElement = React115__default.cloneElement(
7262
+ const childElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7263
+ const triggerElement = React116__default.cloneElement(
7245
7264
  childElement,
7246
7265
  {
7247
7266
  ref: triggerRef,
@@ -7358,8 +7377,8 @@ var init_Menu = __esm({
7358
7377
  "bottom-start": "top-full left-0 mt-2",
7359
7378
  "bottom-end": "top-full right-0 mt-2"
7360
7379
  };
7361
- const triggerChild = React115__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7362
- const triggerElement = React115__default.cloneElement(
7380
+ const triggerChild = React116__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7381
+ const triggerElement = React116__default.cloneElement(
7363
7382
  triggerChild,
7364
7383
  {
7365
7384
  ref: triggerRef,
@@ -7878,12 +7897,12 @@ var init_MapView = __esm({
7878
7897
  shadowSize: [41, 41]
7879
7898
  });
7880
7899
  L.Marker.prototype.options.icon = defaultIcon;
7881
- const { useEffect: useEffect62, useRef: useRef62, useCallback: useCallback94, useState: useState86 } = React115__default;
7900
+ const { useEffect: useEffect62, useRef: useRef63, useCallback: useCallback95, useState: useState87 } = React116__default;
7882
7901
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
7883
7902
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
7884
7903
  function MapUpdater({ centerLat, centerLng, zoom }) {
7885
7904
  const map = useMap();
7886
- const prevRef = useRef62({ centerLat, centerLng, zoom });
7905
+ const prevRef = useRef63({ centerLat, centerLng, zoom });
7887
7906
  useEffect62(() => {
7888
7907
  const prev = prevRef.current;
7889
7908
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -7922,8 +7941,8 @@ var init_MapView = __esm({
7922
7941
  showAttribution = true
7923
7942
  }) {
7924
7943
  const eventBus = useEventBus2();
7925
- const [clickedPosition, setClickedPosition] = useState86(null);
7926
- const handleMapClick = useCallback94((lat, lng) => {
7944
+ const [clickedPosition, setClickedPosition] = useState87(null);
7945
+ const handleMapClick = useCallback95((lat, lng) => {
7927
7946
  if (showClickedPin) {
7928
7947
  setClickedPosition({ lat, lng });
7929
7948
  }
@@ -7932,7 +7951,7 @@ var init_MapView = __esm({
7932
7951
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
7933
7952
  }
7934
7953
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
7935
- const handleMarkerClick = useCallback94((marker) => {
7954
+ const handleMarkerClick = useCallback95((marker) => {
7936
7955
  onMarkerClick?.(marker);
7937
7956
  if (markerClickEvent) {
7938
7957
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -8109,7 +8128,7 @@ function InputPattern({
8109
8128
  fieldName
8110
8129
  }) {
8111
8130
  const { emit } = useEventBus();
8112
- const [localValue, setLocalValue] = React115__default.useState(value);
8131
+ const [localValue, setLocalValue] = React116__default.useState(value);
8113
8132
  const handleChange = (e) => {
8114
8133
  setLocalValue(e.target.value);
8115
8134
  if (onChange) {
@@ -8147,7 +8166,7 @@ function TextareaPattern({
8147
8166
  fieldName
8148
8167
  }) {
8149
8168
  const { emit } = useEventBus();
8150
- const [localValue, setLocalValue] = React115__default.useState(value);
8169
+ const [localValue, setLocalValue] = React116__default.useState(value);
8151
8170
  const handleChange = (e) => {
8152
8171
  setLocalValue(e.target.value);
8153
8172
  if (onChange) {
@@ -8179,7 +8198,7 @@ function SelectPattern({
8179
8198
  fieldName
8180
8199
  }) {
8181
8200
  const { emit } = useEventBus();
8182
- const [localValue, setLocalValue] = React115__default.useState(value);
8201
+ const [localValue, setLocalValue] = React116__default.useState(value);
8183
8202
  const handleChange = (e) => {
8184
8203
  setLocalValue(e.target.value);
8185
8204
  if (onChange) {
@@ -8208,7 +8227,7 @@ function CheckboxPattern({
8208
8227
  className
8209
8228
  }) {
8210
8229
  const { emit } = useEventBus();
8211
- const [localChecked, setLocalChecked] = React115__default.useState(checked);
8230
+ const [localChecked, setLocalChecked] = React116__default.useState(checked);
8212
8231
  const handleChange = (e) => {
8213
8232
  setLocalChecked(e.target.checked);
8214
8233
  if (onChange) {
@@ -8439,8 +8458,8 @@ function ActionButtons({
8439
8458
  disabled
8440
8459
  }) {
8441
8460
  const eventBus = useEventBus();
8442
- const [activeButtons, setActiveButtons] = React115.useState(/* @__PURE__ */ new Set());
8443
- const handlePress = React115.useCallback(
8461
+ const [activeButtons, setActiveButtons] = React116.useState(/* @__PURE__ */ new Set());
8462
+ const handlePress = React116.useCallback(
8444
8463
  (id) => {
8445
8464
  setActiveButtons((prev) => new Set(prev).add(id));
8446
8465
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8448,7 +8467,7 @@ function ActionButtons({
8448
8467
  },
8449
8468
  [actionEvent, eventBus, onAction]
8450
8469
  );
8451
- const handleRelease = React115.useCallback(
8470
+ const handleRelease = React116.useCallback(
8452
8471
  (id) => {
8453
8472
  setActiveButtons((prev) => {
8454
8473
  const next = new Set(prev);
@@ -9004,7 +9023,7 @@ function bindEventBus(eventBus) {
9004
9023
  eventLog.length = 0;
9005
9024
  };
9006
9025
  if (eventBus.onAny) {
9007
- eventBus.onAny((event) => {
9026
+ const verificationRegistryEventLogger = (event) => {
9008
9027
  if (eventLog.length < 200) {
9009
9028
  eventLog.push({
9010
9029
  type: event.type,
@@ -9012,7 +9031,11 @@ function bindEventBus(eventBus) {
9012
9031
  timestamp: Date.now()
9013
9032
  });
9014
9033
  }
9034
+ };
9035
+ Object.defineProperty(verificationRegistryEventLogger, "name", {
9036
+ value: "verificationRegistry:eventLog"
9015
9037
  });
9038
+ eventBus.onAny(verificationRegistryEventLogger);
9016
9039
  }
9017
9040
  }
9018
9041
  }
@@ -10468,7 +10491,7 @@ var init_MarkdownContent = __esm({
10468
10491
  init_Box();
10469
10492
  init_useTranslate();
10470
10493
  init_cn();
10471
- MarkdownContent = React115__default.memo(
10494
+ MarkdownContent = React116__default.memo(
10472
10495
  ({ content, direction, className }) => {
10473
10496
  const { t: _t } = useTranslate();
10474
10497
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -10685,7 +10708,7 @@ var init_CodeBlock = __esm({
10685
10708
  loloStyle = { ...dark, ...loloStyleOverrides };
10686
10709
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
10687
10710
  HIDDEN_LINE_NUMBERS = { display: "none" };
10688
- CodeBlock = React115__default.memo(
10711
+ CodeBlock = React116__default.memo(
10689
10712
  ({
10690
10713
  code: rawCode,
10691
10714
  language = "text",
@@ -11994,7 +12017,7 @@ var init_StateMachineView = __esm({
11994
12017
  style: { top: title ? 30 : 0 },
11995
12018
  children: [
11996
12019
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
11997
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React115__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12020
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React116__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11998
12021
  StateNode,
11999
12022
  {
12000
12023
  state,
@@ -17777,7 +17800,7 @@ function CraftingRecipe({
17777
17800
  className
17778
17801
  }) {
17779
17802
  const eventBus = useEventBus();
17780
- const handleCraft = React115.useCallback(() => {
17803
+ const handleCraft = React116.useCallback(() => {
17781
17804
  onCraft?.();
17782
17805
  if (craftEvent) {
17783
17806
  eventBus.emit(craftEvent, { output: output.label });
@@ -17794,7 +17817,7 @@ function CraftingRecipe({
17794
17817
  children: [
17795
17818
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
17796
17819
  const hasSufficient = ingredient.available >= ingredient.required;
17797
- return /* @__PURE__ */ jsxs(React115.Fragment, { children: [
17820
+ return /* @__PURE__ */ jsxs(React116.Fragment, { children: [
17798
17821
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
17799
17822
  ItemSlot,
17800
17823
  {
@@ -18088,8 +18111,8 @@ function DPad({
18088
18111
  }) {
18089
18112
  const eventBus = useEventBus();
18090
18113
  const sizes = sizeMap15[size];
18091
- const [activeDirections, setActiveDirections] = React115.useState(/* @__PURE__ */ new Set());
18092
- const handlePress = React115.useCallback(
18114
+ const [activeDirections, setActiveDirections] = React116.useState(/* @__PURE__ */ new Set());
18115
+ const handlePress = React116.useCallback(
18093
18116
  (direction) => {
18094
18117
  setActiveDirections((prev) => new Set(prev).add(direction));
18095
18118
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -18097,7 +18120,7 @@ function DPad({
18097
18120
  },
18098
18121
  [directionEvent, eventBus, onDirection]
18099
18122
  );
18100
- const handleRelease = React115.useCallback(
18123
+ const handleRelease = React116.useCallback(
18101
18124
  (direction) => {
18102
18125
  setActiveDirections((prev) => {
18103
18126
  const next = new Set(prev);
@@ -18976,7 +18999,7 @@ function DataList({
18976
18999
  }) {
18977
19000
  const eventBus = useEventBus();
18978
19001
  const { t } = useTranslate();
18979
- const [visibleCount, setVisibleCount] = React115__default.useState(pageSize || Infinity);
19002
+ const [visibleCount, setVisibleCount] = React116__default.useState(pageSize || Infinity);
18980
19003
  const fields = fieldsProp ?? columnsProp ?? [];
18981
19004
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18982
19005
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
@@ -19017,7 +19040,7 @@ function DataList({
19017
19040
  const items2 = data.map((item) => item);
19018
19041
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
19019
19042
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
19020
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
19043
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
19021
19044
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
19022
19045
  group.items.map((itemData, index) => {
19023
19046
  const id = itemData.id || `${gi}-${index}`;
@@ -19209,7 +19232,7 @@ function DataList({
19209
19232
  className
19210
19233
  ),
19211
19234
  children: [
19212
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
19235
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
19213
19236
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
19214
19237
  group.items.map(
19215
19238
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -20017,20 +20040,21 @@ var init_InputGroup = __esm({
20017
20040
 
20018
20041
  // lib/debug.ts
20019
20042
  function isDebugEnabled() {
20020
- return DEBUG_ENABLED;
20043
+ if (DEBUG_ENABLED) return true;
20044
+ return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
20021
20045
  }
20022
20046
  function debug(...args) {
20023
- if (DEBUG_ENABLED) {
20047
+ if (isDebugEnabled()) {
20024
20048
  console.log("[DEBUG]", ...args);
20025
20049
  }
20026
20050
  }
20027
20051
  function debugGroup(label) {
20028
- if (DEBUG_ENABLED) {
20052
+ if (isDebugEnabled()) {
20029
20053
  console.group(`[DEBUG] ${label}`);
20030
20054
  }
20031
20055
  }
20032
20056
  function debugGroupEnd() {
20033
- if (DEBUG_ENABLED) {
20057
+ if (isDebugEnabled()) {
20034
20058
  console.groupEnd();
20035
20059
  }
20036
20060
  }
@@ -20481,7 +20505,7 @@ var init_WizardProgress = __esm({
20481
20505
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
20482
20506
  const isActive = index === currentStep;
20483
20507
  const isCompleted = index < currentStep;
20484
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
20508
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
20485
20509
  /* @__PURE__ */ jsx(
20486
20510
  "button",
20487
20511
  {
@@ -21392,7 +21416,7 @@ function InventoryGrid({
21392
21416
  const eventBus = useEventBus();
21393
21417
  const slotCount = totalSlots ?? items.length;
21394
21418
  const emptySlotCount = Math.max(0, slotCount - items.length);
21395
- const handleSelect = React115.useCallback(
21419
+ const handleSelect = React116.useCallback(
21396
21420
  (id) => {
21397
21421
  onSelect?.(id);
21398
21422
  if (selectEvent) {
@@ -21605,15 +21629,15 @@ function GameCanvas2D({
21605
21629
  fps = 60,
21606
21630
  className
21607
21631
  }) {
21608
- const canvasRef = React115.useRef(null);
21609
- const rafRef = React115.useRef(0);
21610
- const frameRef = React115.useRef(0);
21611
- const lastTimeRef = React115.useRef(0);
21612
- const onDrawRef = React115.useRef(onDraw);
21632
+ const canvasRef = React116.useRef(null);
21633
+ const rafRef = React116.useRef(0);
21634
+ const frameRef = React116.useRef(0);
21635
+ const lastTimeRef = React116.useRef(0);
21636
+ const onDrawRef = React116.useRef(onDraw);
21613
21637
  onDrawRef.current = onDraw;
21614
- const onTickRef = React115.useRef(onTick);
21638
+ const onTickRef = React116.useRef(onTick);
21615
21639
  onTickRef.current = onTick;
21616
- React115.useEffect(() => {
21640
+ React116.useEffect(() => {
21617
21641
  const canvas = canvasRef.current;
21618
21642
  if (!canvas) return;
21619
21643
  const ctx = canvas.getContext("2d");
@@ -21902,7 +21926,7 @@ function TurnPanel({
21902
21926
  className
21903
21927
  }) {
21904
21928
  const eventBus = useEventBus();
21905
- const handleAction = React115.useCallback(
21929
+ const handleAction = React116.useCallback(
21906
21930
  (event) => {
21907
21931
  if (event) {
21908
21932
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -22048,7 +22072,7 @@ function UnitCommandBar({
22048
22072
  className
22049
22073
  }) {
22050
22074
  const eventBus = useEventBus();
22051
- const handleCommand = React115.useCallback(
22075
+ const handleCommand = React116.useCallback(
22052
22076
  (event) => {
22053
22077
  if (event) {
22054
22078
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -22533,7 +22557,7 @@ function GameMenu({
22533
22557
  } catch {
22534
22558
  }
22535
22559
  const eventBus = eventBusProp || eventBusFromHook;
22536
- const handleOptionClick = React115.useCallback(
22560
+ const handleOptionClick = React116.useCallback(
22537
22561
  (option) => {
22538
22562
  if (option.event && eventBus) {
22539
22563
  eventBus.emit(`UI:${option.event}`, { option });
@@ -22647,7 +22671,7 @@ function GameOverScreen({
22647
22671
  } catch {
22648
22672
  }
22649
22673
  const eventBus = eventBusProp || eventBusFromHook;
22650
- const handleActionClick = React115.useCallback(
22674
+ const handleActionClick = React116.useCallback(
22651
22675
  (action) => {
22652
22676
  if (action.event && eventBus) {
22653
22677
  eventBus.emit(`UI:${action.event}`, { action });
@@ -25751,7 +25775,7 @@ var init_StepFlow = __esm({
25751
25775
  className
25752
25776
  }) => {
25753
25777
  if (orientation === "vertical") {
25754
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React115__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
25778
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React116__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
25755
25779
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
25756
25780
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25757
25781
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -25762,7 +25786,7 @@ var init_StepFlow = __esm({
25762
25786
  ] })
25763
25787
  ] }) }, index)) });
25764
25788
  }
25765
- 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(React115__default.Fragment, { children: [
25789
+ 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(React116__default.Fragment, { children: [
25766
25790
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
25767
25791
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25768
25792
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27876,7 +27900,7 @@ var init_DocumentViewer = __esm({
27876
27900
  }
27877
27901
  });
27878
27902
  function extractTitle(children) {
27879
- if (!React115__default.isValidElement(children)) return void 0;
27903
+ if (!React116__default.isValidElement(children)) return void 0;
27880
27904
  const props = children.props;
27881
27905
  if (typeof props.title === "string") {
27882
27906
  return props.title;
@@ -27931,7 +27955,7 @@ function LinearView({
27931
27955
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
27932
27956
  const isDone = i < currentIdx;
27933
27957
  const isCurrent = i === currentIdx;
27934
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
27958
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
27935
27959
  i > 0 && /* @__PURE__ */ jsx(
27936
27960
  Typography,
27937
27961
  {
@@ -28681,7 +28705,14 @@ var init_Form = __esm({
28681
28705
  // Schema-based props
28682
28706
  entity,
28683
28707
  fields,
28684
- initialData = {},
28708
+ // No `= {}` default: a fresh `{}` evaluated inline on every render
28709
+ // would change the prop reference every tick and bust the useMemo
28710
+ // cache below (`[entity, initialData]` deps), reigniting the
28711
+ // setFormData useEffect on every keystroke and producing an
28712
+ // infinite re-render loop with stuck form inputs. The memo and
28713
+ // submit handler both handle `undefined` already via the
28714
+ // `typeof initialData === 'object'` guard.
28715
+ initialData,
28685
28716
  isLoading = false,
28686
28717
  error,
28687
28718
  submitLabel,
@@ -28708,10 +28739,12 @@ var init_Form = __esm({
28708
28739
  const isSchemaEntity = isOrbitalEntitySchema(entity);
28709
28740
  const resolvedEntity = isSchemaEntity ? entity : void 0;
28710
28741
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28711
- const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28712
- const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28713
- const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28714
- const entityDerivedFields = React115__default.useMemo(() => {
28742
+ const normalizedInitialData = React116__default.useMemo(() => {
28743
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28744
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28745
+ return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28746
+ }, [entity, initialData]);
28747
+ const entityDerivedFields = React116__default.useMemo(() => {
28715
28748
  if (fields && fields.length > 0) return void 0;
28716
28749
  if (!resolvedEntity) return void 0;
28717
28750
  return resolvedEntity.fields.map(
@@ -28730,14 +28763,27 @@ var init_Form = __esm({
28730
28763
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
28731
28764
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
28732
28765
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
28733
- const [formData, setFormData] = React115__default.useState(
28766
+ const [formData, setFormData] = React116__default.useState(
28734
28767
  normalizedInitialData
28735
28768
  );
28736
- const [collapsedSections, setCollapsedSections] = React115__default.useState(
28769
+ const [collapsedSections, setCollapsedSections] = React116__default.useState(
28737
28770
  /* @__PURE__ */ new Set()
28738
28771
  );
28772
+ const formMode = props.mode;
28773
+ const mountedRef = React116__default.useRef(false);
28774
+ if (!mountedRef.current) {
28775
+ mountedRef.current = true;
28776
+ debug("forms", "mount", {
28777
+ mode: formMode,
28778
+ submitEvent,
28779
+ cancelEvent,
28780
+ fieldNames: (fields ?? []).map((f3) => f3.name ?? f3.field).filter(Boolean),
28781
+ initialDataKeys: Object.keys(normalizedInitialData),
28782
+ initialData: normalizedInitialData
28783
+ });
28784
+ }
28739
28785
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
28740
- const evalContext = React115__default.useMemo(
28786
+ const evalContext = React116__default.useMemo(
28741
28787
  () => ({
28742
28788
  formValues: formData,
28743
28789
  globalVariables: externalContext?.globalVariables ?? {},
@@ -28746,12 +28792,18 @@ var init_Form = __esm({
28746
28792
  }),
28747
28793
  [formData, externalContext]
28748
28794
  );
28749
- React115__default.useEffect(() => {
28795
+ React116__default.useEffect(() => {
28796
+ debug("forms", "initialData-sync", {
28797
+ mode: formMode,
28798
+ normalizedInitialData,
28799
+ prevFormData: formData,
28800
+ willSet: Object.keys(normalizedInitialData).length > 0
28801
+ });
28750
28802
  if (Object.keys(normalizedInitialData).length > 0) {
28751
28803
  setFormData(normalizedInitialData);
28752
28804
  }
28753
28805
  }, [normalizedInitialData]);
28754
- const processCalculations = React115__default.useCallback(
28806
+ const processCalculations = React116__default.useCallback(
28755
28807
  (changedFieldId, newFormData) => {
28756
28808
  if (!hiddenCalculations.length) return;
28757
28809
  const context = {
@@ -28776,7 +28828,7 @@ var init_Form = __esm({
28776
28828
  },
28777
28829
  [hiddenCalculations, externalContext, eventBus]
28778
28830
  );
28779
- const checkViolations = React115__default.useCallback(
28831
+ const checkViolations = React116__default.useCallback(
28780
28832
  (changedFieldId, newFormData) => {
28781
28833
  if (!violationTriggers.length) return;
28782
28834
  const context = {
@@ -28803,6 +28855,7 @@ var init_Form = __esm({
28803
28855
  );
28804
28856
  const handleChange = (name, value) => {
28805
28857
  const newFormData = { ...formData, [name]: value };
28858
+ debug("forms", "field-change", { mode: formMode, name, value, prevFormData: formData, newFormData });
28806
28859
  setFormData(newFormData);
28807
28860
  eventBus.emit("UI:FIELD_CHANGED", {
28808
28861
  fieldId: name,
@@ -28813,7 +28866,7 @@ var init_Form = __esm({
28813
28866
  processCalculations(name, newFormData);
28814
28867
  checkViolations(name, newFormData);
28815
28868
  };
28816
- const isFieldVisible = React115__default.useCallback(
28869
+ const isFieldVisible = React116__default.useCallback(
28817
28870
  (fieldName) => {
28818
28871
  const condition = conditionalFields[fieldName];
28819
28872
  if (!condition) return true;
@@ -28821,7 +28874,7 @@ var init_Form = __esm({
28821
28874
  },
28822
28875
  [conditionalFields, evalContext]
28823
28876
  );
28824
- const isSectionVisible = React115__default.useCallback(
28877
+ const isSectionVisible = React116__default.useCallback(
28825
28878
  (section) => {
28826
28879
  if (!section.condition) return true;
28827
28880
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -28841,7 +28894,18 @@ var init_Form = __esm({
28841
28894
  };
28842
28895
  const handleSubmit = (e) => {
28843
28896
  e.preventDefault();
28844
- const payload = { data: formData };
28897
+ debug("forms", "submit-enter", {
28898
+ mode: formMode,
28899
+ submitEvent,
28900
+ formData,
28901
+ normalizedInitialData
28902
+ });
28903
+ const mergedData = {
28904
+ ...normalizedInitialData,
28905
+ ...formData
28906
+ };
28907
+ const payload = { data: mergedData };
28908
+ debug("forms", "submit-emit", { mode: formMode, submitEvent: `UI:${submitEvent}`, payloadData: payload.data });
28845
28909
  eventBus.emit(`UI:${submitEvent}`, payload);
28846
28910
  if (onSubmit) {
28847
28911
  eventBus.emit(`UI:${onSubmit}`, payload);
@@ -28854,7 +28918,7 @@ var init_Form = __esm({
28854
28918
  eventBus.emit(`UI:${onCancel}`);
28855
28919
  }
28856
28920
  };
28857
- const renderField = React115__default.useCallback(
28921
+ const renderField = React116__default.useCallback(
28858
28922
  (field) => {
28859
28923
  const fieldName = field.name || field.field;
28860
28924
  if (!fieldName) return null;
@@ -28875,7 +28939,7 @@ var init_Form = __esm({
28875
28939
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
28876
28940
  );
28877
28941
  const effectiveFields = entityDerivedFields ?? fields;
28878
- const normalizedFields = React115__default.useMemo(() => {
28942
+ const normalizedFields = React116__default.useMemo(() => {
28879
28943
  if (!effectiveFields || effectiveFields.length === 0) return [];
28880
28944
  return effectiveFields.map((field) => {
28881
28945
  if (typeof field === "string") {
@@ -28897,7 +28961,7 @@ var init_Form = __esm({
28897
28961
  return field;
28898
28962
  });
28899
28963
  }, [effectiveFields, resolvedEntity]);
28900
- const schemaFields = React115__default.useMemo(() => {
28964
+ const schemaFields = React116__default.useMemo(() => {
28901
28965
  if (normalizedFields.length === 0) return null;
28902
28966
  if (isDebugEnabled()) {
28903
28967
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -28907,7 +28971,7 @@ var init_Form = __esm({
28907
28971
  }
28908
28972
  return normalizedFields.map(renderField).filter(Boolean);
28909
28973
  }, [normalizedFields, renderField, entityName, conditionalFields]);
28910
- const sectionElements = React115__default.useMemo(() => {
28974
+ const sectionElements = React116__default.useMemo(() => {
28911
28975
  if (!sections || sections.length === 0) return null;
28912
28976
  return sections.map((section) => {
28913
28977
  if (!isSectionVisible(section)) {
@@ -30431,7 +30495,7 @@ var init_List = __esm({
30431
30495
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
30432
30496
  return [];
30433
30497
  }, [entity]);
30434
- const getItemActions = React115__default.useCallback(
30498
+ const getItemActions = React116__default.useCallback(
30435
30499
  (item) => {
30436
30500
  if (!itemActions) return [];
30437
30501
  if (typeof itemActions === "function") {
@@ -30868,7 +30932,7 @@ var init_MediaGallery = __esm({
30868
30932
  [selectable, selectedItems, selectionEvent, eventBus]
30869
30933
  );
30870
30934
  const entityData = Array.isArray(entity) ? entity : [];
30871
- const items = React115__default.useMemo(() => {
30935
+ const items = React116__default.useMemo(() => {
30872
30936
  if (propItems) return propItems;
30873
30937
  if (entityData.length === 0) return [];
30874
30938
  return entityData.map((record, idx) => ({
@@ -31032,7 +31096,7 @@ var init_MediaGallery = __esm({
31032
31096
  }
31033
31097
  });
31034
31098
  function extractTitle2(children) {
31035
- if (!React115__default.isValidElement(children)) return void 0;
31099
+ if (!React116__default.isValidElement(children)) return void 0;
31036
31100
  const props = children.props;
31037
31101
  if (typeof props.title === "string") {
31038
31102
  return props.title;
@@ -31745,7 +31809,7 @@ var init_PageHeader = __esm({
31745
31809
  info: "bg-info/10 text-info"
31746
31810
  };
31747
31811
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
31748
- 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(React115__default.Fragment, { children: [
31812
+ 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(React116__default.Fragment, { children: [
31749
31813
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
31750
31814
  crumb.href ? /* @__PURE__ */ jsx(
31751
31815
  "a",
@@ -31919,7 +31983,7 @@ var init_debugRegistry = __esm({
31919
31983
  }
31920
31984
  });
31921
31985
  function useDebugData() {
31922
- const [data, setData] = React115.useState(() => ({
31986
+ const [data, setData] = React116.useState(() => ({
31923
31987
  traits: [],
31924
31988
  ticks: [],
31925
31989
  guards: [],
@@ -31933,7 +31997,7 @@ function useDebugData() {
31933
31997
  },
31934
31998
  lastUpdate: Date.now()
31935
31999
  }));
31936
- React115.useEffect(() => {
32000
+ React116.useEffect(() => {
31937
32001
  const updateData = () => {
31938
32002
  setData({
31939
32003
  traits: getAllTraits(),
@@ -32042,12 +32106,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
32042
32106
  return positions;
32043
32107
  }
32044
32108
  function WalkMinimap() {
32045
- const [walkStep, setWalkStep] = React115.useState(null);
32046
- const [traits2, setTraits] = React115.useState([]);
32047
- const [coveredEdges, setCoveredEdges] = React115.useState([]);
32048
- const [completedTraits, setCompletedTraits] = React115.useState(/* @__PURE__ */ new Set());
32049
- const prevTraitRef = React115.useRef(null);
32050
- React115.useEffect(() => {
32109
+ const [walkStep, setWalkStep] = React116.useState(null);
32110
+ const [traits2, setTraits] = React116.useState([]);
32111
+ const [coveredEdges, setCoveredEdges] = React116.useState([]);
32112
+ const [completedTraits, setCompletedTraits] = React116.useState(/* @__PURE__ */ new Set());
32113
+ const prevTraitRef = React116.useRef(null);
32114
+ React116.useEffect(() => {
32051
32115
  const interval = setInterval(() => {
32052
32116
  const w = window;
32053
32117
  const step = w.__orbitalWalkStep;
@@ -32494,15 +32558,15 @@ var init_EntitiesTab = __esm({
32494
32558
  }
32495
32559
  });
32496
32560
  function EventFlowTab({ events: events2 }) {
32497
- const [filter, setFilter] = React115.useState("all");
32498
- const containerRef = React115.useRef(null);
32499
- const [autoScroll, setAutoScroll] = React115.useState(true);
32500
- React115.useEffect(() => {
32561
+ const [filter, setFilter] = React116.useState("all");
32562
+ const containerRef = React116.useRef(null);
32563
+ const [autoScroll, setAutoScroll] = React116.useState(true);
32564
+ React116.useEffect(() => {
32501
32565
  if (autoScroll && containerRef.current) {
32502
32566
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32503
32567
  }
32504
32568
  }, [events2.length, autoScroll]);
32505
- const filteredEvents = React115.useMemo(() => {
32569
+ const filteredEvents = React116.useMemo(() => {
32506
32570
  if (filter === "all") return events2;
32507
32571
  return events2.filter((e) => e.type === filter);
32508
32572
  }, [events2, filter]);
@@ -32621,7 +32685,7 @@ var init_EventFlowTab = __esm({
32621
32685
  }
32622
32686
  });
32623
32687
  function GuardsPanel({ guards }) {
32624
- const [filter, setFilter] = React115.useState("all");
32688
+ const [filter, setFilter] = React116.useState("all");
32625
32689
  if (guards.length === 0) {
32626
32690
  return /* @__PURE__ */ jsx(
32627
32691
  EmptyState,
@@ -32634,7 +32698,7 @@ function GuardsPanel({ guards }) {
32634
32698
  }
32635
32699
  const passedCount = guards.filter((g) => g.result).length;
32636
32700
  const failedCount = guards.length - passedCount;
32637
- const filteredGuards = React115.useMemo(() => {
32701
+ const filteredGuards = React116.useMemo(() => {
32638
32702
  if (filter === "all") return guards;
32639
32703
  if (filter === "passed") return guards.filter((g) => g.result);
32640
32704
  return guards.filter((g) => !g.result);
@@ -32795,10 +32859,10 @@ function EffectBadge({ effect }) {
32795
32859
  ] });
32796
32860
  }
32797
32861
  function TransitionTimeline({ transitions }) {
32798
- const containerRef = React115.useRef(null);
32799
- const [autoScroll, setAutoScroll] = React115.useState(true);
32800
- const [expandedId, setExpandedId] = React115.useState(null);
32801
- React115.useEffect(() => {
32862
+ const containerRef = React116.useRef(null);
32863
+ const [autoScroll, setAutoScroll] = React116.useState(true);
32864
+ const [expandedId, setExpandedId] = React116.useState(null);
32865
+ React116.useEffect(() => {
32802
32866
  if (autoScroll && containerRef.current) {
32803
32867
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32804
32868
  }
@@ -33084,9 +33148,9 @@ function getAllEvents(traits2) {
33084
33148
  }
33085
33149
  function EventDispatcherTab({ traits: traits2, schema }) {
33086
33150
  const eventBus = useEventBus();
33087
- const [log4, setLog] = React115.useState([]);
33088
- const prevStatesRef = React115.useRef(/* @__PURE__ */ new Map());
33089
- React115.useEffect(() => {
33151
+ const [log4, setLog] = React116.useState([]);
33152
+ const prevStatesRef = React116.useRef(/* @__PURE__ */ new Map());
33153
+ React116.useEffect(() => {
33090
33154
  for (const trait of traits2) {
33091
33155
  const prev = prevStatesRef.current.get(trait.id);
33092
33156
  if (prev && prev !== trait.currentState) {
@@ -33256,10 +33320,10 @@ function VerifyModePanel({
33256
33320
  serverCount,
33257
33321
  localCount
33258
33322
  }) {
33259
- const [expanded, setExpanded] = React115.useState(true);
33260
- const scrollRef = React115.useRef(null);
33261
- const prevCountRef = React115.useRef(0);
33262
- React115.useEffect(() => {
33323
+ const [expanded, setExpanded] = React116.useState(true);
33324
+ const scrollRef = React116.useRef(null);
33325
+ const prevCountRef = React116.useRef(0);
33326
+ React116.useEffect(() => {
33263
33327
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
33264
33328
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
33265
33329
  }
@@ -33325,10 +33389,10 @@ function RuntimeDebugger({
33325
33389
  defaultTab,
33326
33390
  schema
33327
33391
  }) {
33328
- const [isCollapsed, setIsCollapsed] = React115.useState(mode === "verify" ? true : defaultCollapsed);
33329
- const [isVisible, setIsVisible] = React115.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33392
+ const [isCollapsed, setIsCollapsed] = React116.useState(mode === "verify" ? true : defaultCollapsed);
33393
+ const [isVisible, setIsVisible] = React116.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33330
33394
  const debugData = useDebugData();
33331
- React115.useEffect(() => {
33395
+ React116.useEffect(() => {
33332
33396
  if (mode === "inline") return;
33333
33397
  return onDebugToggle((enabled) => {
33334
33398
  setIsVisible(enabled);
@@ -33337,7 +33401,7 @@ function RuntimeDebugger({
33337
33401
  }
33338
33402
  });
33339
33403
  }, [mode]);
33340
- React115.useEffect(() => {
33404
+ React116.useEffect(() => {
33341
33405
  if (mode === "inline") return;
33342
33406
  const handleKeyDown = (e) => {
33343
33407
  if (e.key === "`" && isVisible) {
@@ -33886,7 +33950,7 @@ function SequenceBar({
33886
33950
  onSlotRemove(index);
33887
33951
  }, [onSlotRemove, playing]);
33888
33952
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
33889
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
33953
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
33890
33954
  i > 0 && /* @__PURE__ */ jsx(
33891
33955
  Typography,
33892
33956
  {
@@ -35231,7 +35295,7 @@ var init_StatCard2 = __esm({
35231
35295
  const labelToUse = propLabel ?? propTitle;
35232
35296
  const eventBus = useEventBus();
35233
35297
  const { t } = useTranslate();
35234
- const handleActionClick = React115__default.useCallback(() => {
35298
+ const handleActionClick = React116__default.useCallback(() => {
35235
35299
  if (action?.event) {
35236
35300
  eventBus.emit(`UI:${action.event}`, {});
35237
35301
  }
@@ -35242,7 +35306,7 @@ var init_StatCard2 = __esm({
35242
35306
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
35243
35307
  const isLoading = externalLoading ?? false;
35244
35308
  const error = externalError;
35245
- const computeMetricValue = React115__default.useCallback(
35309
+ const computeMetricValue = React116__default.useCallback(
35246
35310
  (metric, items) => {
35247
35311
  if (metric.value !== void 0) {
35248
35312
  return metric.value;
@@ -35281,7 +35345,7 @@ var init_StatCard2 = __esm({
35281
35345
  },
35282
35346
  []
35283
35347
  );
35284
- const schemaStats = React115__default.useMemo(() => {
35348
+ const schemaStats = React116__default.useMemo(() => {
35285
35349
  if (!metrics || metrics.length === 0) return null;
35286
35350
  return metrics.map((metric) => ({
35287
35351
  label: metric.label,
@@ -35289,7 +35353,7 @@ var init_StatCard2 = __esm({
35289
35353
  format: metric.format
35290
35354
  }));
35291
35355
  }, [metrics, data, computeMetricValue]);
35292
- const calculatedTrend = React115__default.useMemo(() => {
35356
+ const calculatedTrend = React116__default.useMemo(() => {
35293
35357
  if (manualTrend !== void 0) return manualTrend;
35294
35358
  if (previousValue === void 0 || currentValue === void 0)
35295
35359
  return void 0;
@@ -36273,7 +36337,7 @@ var init_Timeline = __esm({
36273
36337
  }) => {
36274
36338
  const { t } = useTranslate();
36275
36339
  const entityData = Array.isArray(entity) ? entity : [];
36276
- const items = React115__default.useMemo(() => {
36340
+ const items = React116__default.useMemo(() => {
36277
36341
  if (propItems) return propItems;
36278
36342
  if (entityData.length === 0) return [];
36279
36343
  return entityData.map((record, idx) => {
@@ -36380,7 +36444,7 @@ var init_Timeline = __esm({
36380
36444
  }
36381
36445
  });
36382
36446
  function extractToastProps(children) {
36383
- if (!React115__default.isValidElement(children)) {
36447
+ if (!React116__default.isValidElement(children)) {
36384
36448
  if (typeof children === "string") {
36385
36449
  return { message: children };
36386
36450
  }
@@ -36418,7 +36482,7 @@ var init_ToastSlot = __esm({
36418
36482
  eventBus.emit("UI:CLOSE");
36419
36483
  };
36420
36484
  if (!isVisible) return null;
36421
- const isCustomContent = React115__default.isValidElement(children) && !message;
36485
+ const isCustomContent = React116__default.isValidElement(children) && !message;
36422
36486
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
36423
36487
  Toast,
36424
36488
  {
@@ -36687,7 +36751,7 @@ var init_WizardContainer = __esm({
36687
36751
  const isCompleted = index < currentStep;
36688
36752
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36689
36753
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36690
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
36754
+ return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
36691
36755
  /* @__PURE__ */ jsx(
36692
36756
  Button,
36693
36757
  {
@@ -37069,12 +37133,12 @@ var init_WorldMapTemplate = __esm({
37069
37133
  }
37070
37134
  });
37071
37135
  function lazyThree(name, loader) {
37072
- const Lazy = React115__default.lazy(() => loader().then((m) => ({ default: m[name] })));
37136
+ const Lazy = React116__default.lazy(() => loader().then((m) => ({ default: m[name] })));
37073
37137
  function ThreeWrapper(props) {
37074
- return React115__default.createElement(
37075
- React115__default.Suspense,
37138
+ return React116__default.createElement(
37139
+ React116__default.Suspense,
37076
37140
  { fallback: null },
37077
- React115__default.createElement(Lazy, props)
37141
+ React116__default.createElement(Lazy, props)
37078
37142
  );
37079
37143
  }
37080
37144
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -37562,7 +37626,7 @@ function SuspenseConfigProvider({
37562
37626
  config,
37563
37627
  children
37564
37628
  }) {
37565
- return React115__default.createElement(
37629
+ return React116__default.createElement(
37566
37630
  SuspenseConfigContext.Provider,
37567
37631
  { value: config },
37568
37632
  children
@@ -38026,7 +38090,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
38026
38090
  const key = `${parentId}-${index}-trait:${traitName}`;
38027
38091
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
38028
38092
  }
38029
- return /* @__PURE__ */ jsx(React115__default.Fragment, { children: child }, `${parentId}-${index}`);
38093
+ return /* @__PURE__ */ jsx(React116__default.Fragment, { children: child }, `${parentId}-${index}`);
38030
38094
  }
38031
38095
  if (!child || typeof child !== "object") return null;
38032
38096
  const childId = `${parentId}-${index}`;
@@ -38088,6 +38152,14 @@ function SlotContentRenderer({
38088
38152
  patternPath
38089
38153
  }) {
38090
38154
  const entityProp = content.props.entity;
38155
+ if (content.pattern === "form-section") {
38156
+ slotLog.debug("SlotContentRenderer:form-section-render", {
38157
+ contentId: content.id,
38158
+ sourceTrait: content.sourceTrait,
38159
+ entityRefId: refId(entityProp),
38160
+ entityIsObject: entityProp !== null && typeof entityProp === "object" && !Array.isArray(entityProp)
38161
+ });
38162
+ }
38091
38163
  if (typeof entityProp === "string" && entityProp.length > 0) {
38092
38164
  if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") {
38093
38165
  throw new Error(
@@ -38231,6 +38303,7 @@ var init_UISlotRenderer = __esm({
38231
38303
  init_Box();
38232
38304
  init_Typography();
38233
38305
  init_useEventBus();
38306
+ init_SlotsContext();
38234
38307
  init_cn();
38235
38308
  init_ErrorBoundary();
38236
38309
  init_Skeleton();
@@ -38293,6 +38366,25 @@ init_logger();
38293
38366
  var busLog = createLogger("almadar:eventbus");
38294
38367
  var subLog2 = createLogger("almadar:eventbus:subscribe");
38295
38368
  var EventBusContext2 = createContext(null);
38369
+ var listenerTags = /* @__PURE__ */ new WeakMap();
38370
+ function captureSubscriberTag(listener) {
38371
+ const fnName = listener.name;
38372
+ if (typeof fnName === "string" && fnName.length > 0 && fnName !== "listener") {
38373
+ return fnName;
38374
+ }
38375
+ const stack = new Error().stack ?? "";
38376
+ const lines = stack.split("\n");
38377
+ for (const raw of lines.slice(2)) {
38378
+ const line = raw.trim();
38379
+ if (!line) continue;
38380
+ if (line.includes("EventBusProvider") || line.includes("useEventBus")) continue;
38381
+ if (line.includes("captureSubscriberTag")) continue;
38382
+ const match = line.match(/([^/\\)]+\.(?:tsx?|jsx?))(?::(\d+))?/);
38383
+ if (match) return match[2] ? `${match[1]}:${match[2]}` : match[1];
38384
+ return line.slice(0, 120);
38385
+ }
38386
+ return "unknown";
38387
+ }
38296
38388
  function EventBusProvider({ children, debug: debug2 = false }) {
38297
38389
  const listenersRef = useRef(/* @__PURE__ */ new Map());
38298
38390
  const anyListenersRef = useRef(/* @__PURE__ */ new Set());
@@ -38333,7 +38425,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
38333
38425
  }
38334
38426
  if (listeners6) {
38335
38427
  const listenersCopy = Array.from(listeners6);
38336
- for (const listener of listenersCopy) {
38428
+ for (let i = 0; i < listenersCopy.length; i++) {
38429
+ const listener = listenersCopy[i];
38430
+ busLog.debug("emit:listener", {
38431
+ type,
38432
+ kind: "specific",
38433
+ index: i,
38434
+ tag: listenerTags.get(listener) ?? "untagged"
38435
+ });
38337
38436
  try {
38338
38437
  listener(event);
38339
38438
  } catch (error) {
@@ -38342,7 +38441,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
38342
38441
  }
38343
38442
  }
38344
38443
  const anyListeners = Array.from(anyListenersRef.current);
38345
- for (const listener of anyListeners) {
38444
+ for (let i = 0; i < anyListeners.length; i++) {
38445
+ const listener = anyListeners[i];
38446
+ busLog.debug("emit:listener", {
38447
+ type,
38448
+ kind: "onAny",
38449
+ index: i,
38450
+ tag: listenerTags.get(listener) ?? "untagged"
38451
+ });
38346
38452
  try {
38347
38453
  listener(event);
38348
38454
  } catch (error) {
@@ -38356,7 +38462,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
38356
38462
  }
38357
38463
  const listeners6 = listenersRef.current.get(type);
38358
38464
  listeners6.add(listener);
38359
- subLog2.debug("subscribe", { type, totalListeners: listeners6.size });
38465
+ if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
38466
+ subLog2.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
38360
38467
  if (debug2) {
38361
38468
  console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
38362
38469
  }
@@ -38383,7 +38490,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
38383
38490
  }, []);
38384
38491
  const onAny = useCallback((listener) => {
38385
38492
  anyListenersRef.current.add(listener);
38386
- subLog2.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size });
38493
+ if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
38494
+ subLog2.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
38387
38495
  if (debug2) {
38388
38496
  console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
38389
38497
  }
@@ -38555,7 +38663,7 @@ function VerificationProvider({
38555
38663
  useEffect(() => {
38556
38664
  if (!isEnabled) return;
38557
38665
  if (!eventBus.onAny) return;
38558
- const unsub = eventBus.onAny((evt) => {
38666
+ const verificationProviderLifecycleListener = (evt) => {
38559
38667
  const parsed = parseLifecycleEvent(evt.type);
38560
38668
  if (!parsed) return;
38561
38669
  log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
@@ -38645,7 +38753,11 @@ function VerificationProvider({
38645
38753
  });
38646
38754
  log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
38647
38755
  }
38756
+ };
38757
+ Object.defineProperty(verificationProviderLifecycleListener, "name", {
38758
+ value: "VerificationProvider:lifecycle"
38648
38759
  });
38760
+ const unsub = eventBus.onAny(verificationProviderLifecycleListener);
38649
38761
  registerCheck(
38650
38762
  "verification-provider",
38651
38763
  "VerificationProvider active (compiled path)",