@almadar/ui 3.9.1 → 4.0.1

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 React116 from 'react';
2
- import React116__default, { createContext, useContext, useRef, useEffect, useCallback, useMemo, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React115 from 'react';
2
+ import React115__default, { createContext, useContext, useRef, useEffect, useCallback, useMemo, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, OrbitalProvider, VerificationProvider } from '@almadar/ui/providers';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { clsx } from 'clsx';
@@ -1158,7 +1158,7 @@ var init_Box = __esm({
1158
1158
  fixed: "fixed",
1159
1159
  sticky: "sticky"
1160
1160
  };
1161
- Box = React116__default.forwardRef(
1161
+ Box = React115__default.forwardRef(
1162
1162
  ({
1163
1163
  padding,
1164
1164
  paddingX,
@@ -1941,7 +1941,7 @@ function resolveIconProp(value, sizeClass) {
1941
1941
  const IconComp = value;
1942
1942
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1943
1943
  }
1944
- if (React116__default.isValidElement(value)) {
1944
+ if (React115__default.isValidElement(value)) {
1945
1945
  return value;
1946
1946
  }
1947
1947
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -2017,7 +2017,7 @@ var init_Button = __esm({
2017
2017
  md: "h-4 w-4",
2018
2018
  lg: "h-5 w-5"
2019
2019
  };
2020
- Button = React116__default.forwardRef(
2020
+ Button = React115__default.forwardRef(
2021
2021
  ({
2022
2022
  className,
2023
2023
  variant = "primary",
@@ -2120,7 +2120,7 @@ var init_Badge = __esm({
2120
2120
  md: "px-2.5 py-1 text-sm",
2121
2121
  lg: "px-3 py-1.5 text-base"
2122
2122
  };
2123
- Badge = React116__default.forwardRef(
2123
+ Badge = React115__default.forwardRef(
2124
2124
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
2125
2125
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
2126
2126
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2261,7 +2261,7 @@ var Input;
2261
2261
  var init_Input = __esm({
2262
2262
  "components/atoms/Input.tsx"() {
2263
2263
  init_cn();
2264
- Input = React116__default.forwardRef(
2264
+ Input = React115__default.forwardRef(
2265
2265
  ({
2266
2266
  className,
2267
2267
  inputType,
@@ -2379,7 +2379,7 @@ var Label;
2379
2379
  var init_Label = __esm({
2380
2380
  "components/atoms/Label.tsx"() {
2381
2381
  init_cn();
2382
- Label = React116__default.forwardRef(
2382
+ Label = React115__default.forwardRef(
2383
2383
  ({ className, required, children, ...props }, ref) => {
2384
2384
  return /* @__PURE__ */ jsxs(
2385
2385
  "label",
@@ -2405,7 +2405,7 @@ var Textarea;
2405
2405
  var init_Textarea = __esm({
2406
2406
  "components/atoms/Textarea.tsx"() {
2407
2407
  init_cn();
2408
- Textarea = React116__default.forwardRef(
2408
+ Textarea = React115__default.forwardRef(
2409
2409
  ({ className, error, ...props }, ref) => {
2410
2410
  return /* @__PURE__ */ jsx(
2411
2411
  "textarea",
@@ -2434,7 +2434,7 @@ var Select;
2434
2434
  var init_Select = __esm({
2435
2435
  "components/atoms/Select.tsx"() {
2436
2436
  init_cn();
2437
- Select = React116__default.forwardRef(
2437
+ Select = React115__default.forwardRef(
2438
2438
  ({ className, options, placeholder, error, ...props }, ref) => {
2439
2439
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2440
2440
  /* @__PURE__ */ jsxs(
@@ -2476,7 +2476,7 @@ var Checkbox;
2476
2476
  var init_Checkbox = __esm({
2477
2477
  "components/atoms/Checkbox.tsx"() {
2478
2478
  init_cn();
2479
- Checkbox = React116__default.forwardRef(
2479
+ Checkbox = React115__default.forwardRef(
2480
2480
  ({ className, label, id, ...props }, ref) => {
2481
2481
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2482
2482
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2558,7 +2558,7 @@ var init_Card = __esm({
2558
2558
  md: "shadow",
2559
2559
  lg: "shadow-lg"
2560
2560
  };
2561
- Card = React116__default.forwardRef(
2561
+ Card = React115__default.forwardRef(
2562
2562
  ({
2563
2563
  className,
2564
2564
  variant = "bordered",
@@ -2594,9 +2594,9 @@ var init_Card = __esm({
2594
2594
  }
2595
2595
  );
2596
2596
  Card.displayName = "Card";
2597
- CardHeader = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2597
+ CardHeader = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2598
2598
  CardHeader.displayName = "CardHeader";
2599
- CardTitle = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2599
+ CardTitle = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2600
2600
  "h3",
2601
2601
  {
2602
2602
  ref,
@@ -2609,11 +2609,11 @@ var init_Card = __esm({
2609
2609
  }
2610
2610
  ));
2611
2611
  CardTitle.displayName = "CardTitle";
2612
- CardContent = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2612
+ CardContent = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2613
2613
  CardContent.displayName = "CardContent";
2614
2614
  CardBody = CardContent;
2615
2615
  CardBody.displayName = "CardBody";
2616
- CardFooter = React116__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2616
+ CardFooter = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2617
2617
  "div",
2618
2618
  {
2619
2619
  ref,
@@ -2634,7 +2634,7 @@ var init_Spinner = __esm({
2634
2634
  md: "h-6 w-6",
2635
2635
  lg: "h-8 w-8"
2636
2636
  };
2637
- Spinner = React116__default.forwardRef(
2637
+ Spinner = React115__default.forwardRef(
2638
2638
  ({ className, size = "md", ...props }, ref) => {
2639
2639
  return /* @__PURE__ */ jsx(
2640
2640
  "div",
@@ -3082,7 +3082,7 @@ var Radio;
3082
3082
  var init_Radio = __esm({
3083
3083
  "components/atoms/Radio.tsx"() {
3084
3084
  init_cn();
3085
- Radio = React116__default.forwardRef(
3085
+ Radio = React115__default.forwardRef(
3086
3086
  ({
3087
3087
  label,
3088
3088
  helperText,
@@ -3193,7 +3193,7 @@ var init_Switch = __esm({
3193
3193
  "components/atoms/Switch.tsx"() {
3194
3194
  "use client";
3195
3195
  init_cn();
3196
- Switch = React116.forwardRef(
3196
+ Switch = React115.forwardRef(
3197
3197
  ({
3198
3198
  checked,
3199
3199
  defaultChecked = false,
@@ -3204,10 +3204,10 @@ var init_Switch = __esm({
3204
3204
  name,
3205
3205
  className
3206
3206
  }, ref) => {
3207
- const [isChecked, setIsChecked] = React116.useState(
3207
+ const [isChecked, setIsChecked] = React115.useState(
3208
3208
  checked !== void 0 ? checked : defaultChecked
3209
3209
  );
3210
- React116.useEffect(() => {
3210
+ React115.useEffect(() => {
3211
3211
  if (checked !== void 0) {
3212
3212
  setIsChecked(checked);
3213
3213
  }
@@ -3758,8 +3758,8 @@ var init_LawReferenceTooltip = __esm({
3758
3758
  position = "top",
3759
3759
  className
3760
3760
  }) => {
3761
- const [isVisible, setIsVisible] = React116__default.useState(false);
3762
- const timeoutRef = React116__default.useRef(null);
3761
+ const [isVisible, setIsVisible] = React115__default.useState(false);
3762
+ const timeoutRef = React115__default.useRef(null);
3763
3763
  const handleMouseEnter = () => {
3764
3764
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3765
3765
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -3768,7 +3768,7 @@ var init_LawReferenceTooltip = __esm({
3768
3768
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3769
3769
  setIsVisible(false);
3770
3770
  };
3771
- React116__default.useEffect(() => {
3771
+ React115__default.useEffect(() => {
3772
3772
  return () => {
3773
3773
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3774
3774
  };
@@ -3978,7 +3978,7 @@ var init_StatusDot = __esm({
3978
3978
  md: "w-2.5 h-2.5",
3979
3979
  lg: "w-3 h-3"
3980
3980
  };
3981
- StatusDot = React116__default.forwardRef(
3981
+ StatusDot = React115__default.forwardRef(
3982
3982
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
3983
3983
  return /* @__PURE__ */ jsx(
3984
3984
  "span",
@@ -4031,7 +4031,7 @@ var init_TrendIndicator = __esm({
4031
4031
  down: TrendingDown,
4032
4032
  flat: ArrowRight
4033
4033
  };
4034
- TrendIndicator = React116__default.forwardRef(
4034
+ TrendIndicator = React115__default.forwardRef(
4035
4035
  ({
4036
4036
  className,
4037
4037
  value,
@@ -4098,7 +4098,7 @@ var init_RangeSlider = __esm({
4098
4098
  md: "w-4 h-4",
4099
4099
  lg: "w-5 h-5"
4100
4100
  };
4101
- RangeSlider = React116__default.forwardRef(
4101
+ RangeSlider = React115__default.forwardRef(
4102
4102
  ({
4103
4103
  className,
4104
4104
  min = 0,
@@ -4658,7 +4658,7 @@ var init_ContentSection = __esm({
4658
4658
  md: "py-16",
4659
4659
  lg: "py-24"
4660
4660
  };
4661
- ContentSection = React116__default.forwardRef(
4661
+ ContentSection = React115__default.forwardRef(
4662
4662
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4663
4663
  return /* @__PURE__ */ jsx(
4664
4664
  Box,
@@ -5192,7 +5192,7 @@ var init_AnimatedReveal = __esm({
5192
5192
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5193
5193
  "none": {}
5194
5194
  };
5195
- AnimatedReveal = React116__default.forwardRef(
5195
+ AnimatedReveal = React115__default.forwardRef(
5196
5196
  ({
5197
5197
  trigger = "scroll",
5198
5198
  animation = "fade-up",
@@ -5352,7 +5352,7 @@ var init_AnimatedGraphic = __esm({
5352
5352
  "components/atoms/AnimatedGraphic.tsx"() {
5353
5353
  "use client";
5354
5354
  init_cn();
5355
- AnimatedGraphic = React116__default.forwardRef(
5355
+ AnimatedGraphic = React115__default.forwardRef(
5356
5356
  ({
5357
5357
  src,
5358
5358
  svgContent,
@@ -5375,7 +5375,7 @@ var init_AnimatedGraphic = __esm({
5375
5375
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5376
5376
  const resolvedSvg = svgContent ?? fetchedSvg;
5377
5377
  const prevAnimateRef = useRef(animate);
5378
- const setRef = React116__default.useCallback(
5378
+ const setRef = React115__default.useCallback(
5379
5379
  (node) => {
5380
5380
  containerRef.current = node;
5381
5381
  if (typeof ref === "function") ref(node);
@@ -5593,9 +5593,9 @@ function ScoreDisplay({
5593
5593
  ...rest
5594
5594
  }) {
5595
5595
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
5596
- const [displayValue, setDisplayValue] = React116.useState(resolvedValue);
5597
- const [isAnimating, setIsAnimating] = React116.useState(false);
5598
- React116.useEffect(() => {
5596
+ const [displayValue, setDisplayValue] = React115.useState(resolvedValue);
5597
+ const [isAnimating, setIsAnimating] = React115.useState(false);
5598
+ React115.useEffect(() => {
5599
5599
  if (!animated || displayValue === resolvedValue) {
5600
5600
  setDisplayValue(resolvedValue);
5601
5601
  return;
@@ -5665,9 +5665,9 @@ function ControlButton({
5665
5665
  className
5666
5666
  }) {
5667
5667
  const eventBus = useEventBus();
5668
- const [isPressed, setIsPressed] = React116.useState(false);
5668
+ const [isPressed, setIsPressed] = React115.useState(false);
5669
5669
  const actualPressed = pressed ?? isPressed;
5670
- const handlePointerDown = React116.useCallback(
5670
+ const handlePointerDown = React115.useCallback(
5671
5671
  (e) => {
5672
5672
  e.preventDefault();
5673
5673
  if (disabled) return;
@@ -5677,7 +5677,7 @@ function ControlButton({
5677
5677
  },
5678
5678
  [disabled, pressEvent, eventBus, onPress]
5679
5679
  );
5680
- const handlePointerUp = React116.useCallback(
5680
+ const handlePointerUp = React115.useCallback(
5681
5681
  (e) => {
5682
5682
  e.preventDefault();
5683
5683
  if (disabled) return;
@@ -5687,7 +5687,7 @@ function ControlButton({
5687
5687
  },
5688
5688
  [disabled, releaseEvent, eventBus, onRelease]
5689
5689
  );
5690
- const handlePointerLeave = React116.useCallback(
5690
+ const handlePointerLeave = React115.useCallback(
5691
5691
  (e) => {
5692
5692
  if (isPressed) {
5693
5693
  setIsPressed(false);
@@ -6585,9 +6585,9 @@ function MiniMap({
6585
6585
  viewportRect,
6586
6586
  className
6587
6587
  }) {
6588
- const canvasRef = React116.useRef(null);
6589
- const frameRef = React116.useRef(0);
6590
- React116.useEffect(() => {
6588
+ const canvasRef = React115.useRef(null);
6589
+ const frameRef = React115.useRef(0);
6590
+ React115.useEffect(() => {
6591
6591
  const canvas = canvasRef.current;
6592
6592
  if (!canvas) return;
6593
6593
  const ctx = canvas.getContext("2d");
@@ -6795,7 +6795,7 @@ var init_ErrorBoundary = __esm({
6795
6795
  "use client";
6796
6796
  init_cn();
6797
6797
  init_ErrorState();
6798
- ErrorBoundary = class extends React116__default.Component {
6798
+ ErrorBoundary = class extends React115__default.Component {
6799
6799
  constructor(props) {
6800
6800
  super(props);
6801
6801
  __publicField(this, "reset", () => {
@@ -7268,8 +7268,8 @@ var init_Tooltip = __esm({
7268
7268
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7269
7269
  };
7270
7270
  }, []);
7271
- const triggerElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7272
- const trigger = React116__default.cloneElement(triggerElement, {
7271
+ const triggerElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7272
+ const trigger = React115__default.cloneElement(triggerElement, {
7273
7273
  ref: triggerRef,
7274
7274
  onMouseEnter: handleMouseEnter,
7275
7275
  onMouseLeave: handleMouseLeave,
@@ -7390,8 +7390,8 @@ var init_Popover = __esm({
7390
7390
  onMouseEnter: handleOpen,
7391
7391
  onMouseLeave: handleClose
7392
7392
  };
7393
- const childElement = React116__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7394
- const triggerElement = React116__default.cloneElement(
7393
+ const childElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7394
+ const triggerElement = React115__default.cloneElement(
7395
7395
  childElement,
7396
7396
  {
7397
7397
  ref: triggerRef,
@@ -7508,8 +7508,8 @@ var init_Menu = __esm({
7508
7508
  "bottom-start": "top-full left-0 mt-2",
7509
7509
  "bottom-end": "top-full right-0 mt-2"
7510
7510
  };
7511
- const triggerChild = React116__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7512
- const triggerElement = React116__default.cloneElement(
7511
+ const triggerChild = React115__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7512
+ const triggerElement = React115__default.cloneElement(
7513
7513
  triggerChild,
7514
7514
  {
7515
7515
  ref: triggerRef,
@@ -8023,13 +8023,13 @@ var init_MapView = __esm({
8023
8023
  shadowSize: [41, 41]
8024
8024
  });
8025
8025
  L.Marker.prototype.options.icon = defaultIcon;
8026
- const { useEffect: useEffect69, useRef: useRef65, useCallback: useCallback110, useState: useState104 } = React116__default;
8026
+ const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback110, useState: useState103 } = React115__default;
8027
8027
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8028
8028
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8029
8029
  function MapUpdater({ centerLat, centerLng, zoom }) {
8030
8030
  const map = useMap();
8031
8031
  const prevRef = useRef65({ centerLat, centerLng, zoom });
8032
- useEffect69(() => {
8032
+ useEffect68(() => {
8033
8033
  const prev = prevRef.current;
8034
8034
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
8035
8035
  map.setView([centerLat, centerLng], zoom);
@@ -8040,7 +8040,7 @@ var init_MapView = __esm({
8040
8040
  }
8041
8041
  function MapClickHandler({ onMapClick }) {
8042
8042
  const map = useMap();
8043
- useEffect69(() => {
8043
+ useEffect68(() => {
8044
8044
  if (!onMapClick) return;
8045
8045
  const handler = (e) => {
8046
8046
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -8067,7 +8067,7 @@ var init_MapView = __esm({
8067
8067
  showAttribution = true
8068
8068
  }) {
8069
8069
  const eventBus = useEventBus2();
8070
- const [clickedPosition, setClickedPosition] = useState104(null);
8070
+ const [clickedPosition, setClickedPosition] = useState103(null);
8071
8071
  const handleMapClick = useCallback110((lat, lng) => {
8072
8072
  if (showClickedPin) {
8073
8073
  setClickedPosition({ lat, lng });
@@ -8253,7 +8253,7 @@ function InputPattern({
8253
8253
  className
8254
8254
  }) {
8255
8255
  const { emit } = useEventBus();
8256
- const [localValue, setLocalValue] = React116__default.useState(value);
8256
+ const [localValue, setLocalValue] = React115__default.useState(value);
8257
8257
  const handleChange = (e) => {
8258
8258
  setLocalValue(e.target.value);
8259
8259
  if (onChange) {
@@ -8289,7 +8289,7 @@ function TextareaPattern({
8289
8289
  className
8290
8290
  }) {
8291
8291
  const { emit } = useEventBus();
8292
- const [localValue, setLocalValue] = React116__default.useState(value);
8292
+ const [localValue, setLocalValue] = React115__default.useState(value);
8293
8293
  const handleChange = (e) => {
8294
8294
  setLocalValue(e.target.value);
8295
8295
  if (onChange) {
@@ -8319,7 +8319,7 @@ function SelectPattern({
8319
8319
  className
8320
8320
  }) {
8321
8321
  const { emit } = useEventBus();
8322
- const [localValue, setLocalValue] = React116__default.useState(value);
8322
+ const [localValue, setLocalValue] = React115__default.useState(value);
8323
8323
  const handleChange = (e) => {
8324
8324
  setLocalValue(e.target.value);
8325
8325
  if (onChange) {
@@ -8347,7 +8347,7 @@ function CheckboxPattern({
8347
8347
  className
8348
8348
  }) {
8349
8349
  const { emit } = useEventBus();
8350
- const [localChecked, setLocalChecked] = React116__default.useState(checked);
8350
+ const [localChecked, setLocalChecked] = React115__default.useState(checked);
8351
8351
  const handleChange = (e) => {
8352
8352
  setLocalChecked(e.target.checked);
8353
8353
  if (onChange) {
@@ -8578,8 +8578,8 @@ function ActionButtons({
8578
8578
  disabled
8579
8579
  }) {
8580
8580
  const eventBus = useEventBus();
8581
- const [activeButtons, setActiveButtons] = React116.useState(/* @__PURE__ */ new Set());
8582
- const handlePress = React116.useCallback(
8581
+ const [activeButtons, setActiveButtons] = React115.useState(/* @__PURE__ */ new Set());
8582
+ const handlePress = React115.useCallback(
8583
8583
  (id) => {
8584
8584
  setActiveButtons((prev) => new Set(prev).add(id));
8585
8585
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8587,7 +8587,7 @@ function ActionButtons({
8587
8587
  },
8588
8588
  [actionEvent, eventBus, onAction]
8589
8589
  );
8590
- const handleRelease = React116.useCallback(
8590
+ const handleRelease = React115.useCallback(
8591
8591
  (id) => {
8592
8592
  setActiveButtons((prev) => {
8593
8593
  const next = new Set(prev);
@@ -10391,7 +10391,7 @@ var init_MarkdownContent = __esm({
10391
10391
  init_Box();
10392
10392
  init_useTranslate();
10393
10393
  init_cn();
10394
- MarkdownContent = React116__default.memo(
10394
+ MarkdownContent = React115__default.memo(
10395
10395
  ({ content, direction, className }) => {
10396
10396
  const { t: _t } = useTranslate();
10397
10397
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -10608,7 +10608,7 @@ var init_CodeBlock = __esm({
10608
10608
  loloStyle = { ...dark, ...loloStyleOverrides };
10609
10609
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
10610
10610
  HIDDEN_LINE_NUMBERS = { display: "none" };
10611
- CodeBlock = React116__default.memo(
10611
+ CodeBlock = React115__default.memo(
10612
10612
  ({
10613
10613
  code: rawCode,
10614
10614
  language = "text",
@@ -11867,7 +11867,7 @@ var init_StateMachineView = __esm({
11867
11867
  style: { top: title ? 30 : 0 },
11868
11868
  children: [
11869
11869
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
11870
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React116__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11870
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React115__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11871
11871
  StateNode,
11872
11872
  {
11873
11873
  state,
@@ -17581,7 +17581,7 @@ function CraftingRecipe({
17581
17581
  className
17582
17582
  }) {
17583
17583
  const eventBus = useEventBus();
17584
- const handleCraft = React116.useCallback(() => {
17584
+ const handleCraft = React115.useCallback(() => {
17585
17585
  onCraft?.();
17586
17586
  if (craftEvent) {
17587
17587
  eventBus.emit(craftEvent, { output: output.label });
@@ -17598,7 +17598,7 @@ function CraftingRecipe({
17598
17598
  children: [
17599
17599
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
17600
17600
  const hasSufficient = ingredient.available >= ingredient.required;
17601
- return /* @__PURE__ */ jsxs(React116.Fragment, { children: [
17601
+ return /* @__PURE__ */ jsxs(React115.Fragment, { children: [
17602
17602
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
17603
17603
  ItemSlot,
17604
17604
  {
@@ -17892,8 +17892,8 @@ function DPad({
17892
17892
  }) {
17893
17893
  const eventBus = useEventBus();
17894
17894
  const sizes = sizeMap15[size];
17895
- const [activeDirections, setActiveDirections] = React116.useState(/* @__PURE__ */ new Set());
17896
- const handlePress = React116.useCallback(
17895
+ const [activeDirections, setActiveDirections] = React115.useState(/* @__PURE__ */ new Set());
17896
+ const handlePress = React115.useCallback(
17897
17897
  (direction) => {
17898
17898
  setActiveDirections((prev) => new Set(prev).add(direction));
17899
17899
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -17901,7 +17901,7 @@ function DPad({
17901
17901
  },
17902
17902
  [directionEvent, eventBus, onDirection]
17903
17903
  );
17904
- const handleRelease = React116.useCallback(
17904
+ const handleRelease = React115.useCallback(
17905
17905
  (direction) => {
17906
17906
  setActiveDirections((prev) => {
17907
17907
  const next = new Set(prev);
@@ -18360,7 +18360,290 @@ function formatValue(value, format) {
18360
18360
  return String(value);
18361
18361
  }
18362
18362
  }
18363
- var gapStyles6, DataGrid;
18363
+ function DataGrid({
18364
+ entity,
18365
+ fields: fieldsProp,
18366
+ columns: columnsProp,
18367
+ itemActions,
18368
+ cols,
18369
+ gap = "md",
18370
+ minCardWidth = 280,
18371
+ className,
18372
+ isLoading = false,
18373
+ error = null,
18374
+ imageField,
18375
+ selectable = false,
18376
+ selectionEvent,
18377
+ infiniteScroll,
18378
+ loadMoreEvent,
18379
+ hasMore,
18380
+ children,
18381
+ pageSize = 0
18382
+ }) {
18383
+ const eventBus = useEventBus();
18384
+ const { t } = useTranslate();
18385
+ const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
18386
+ const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
18387
+ const fields = fieldsProp ?? columnsProp ?? [];
18388
+ const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18389
+ const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18390
+ const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
18391
+ const toggleSelection = useCallback((id) => {
18392
+ setSelectedIds((prev) => {
18393
+ const next = new Set(prev);
18394
+ if (next.has(id)) next.delete(id);
18395
+ else next.add(id);
18396
+ if (selectionEvent) {
18397
+ const payload = { selectedIds: Array.from(next) };
18398
+ eventBus.emit(`UI:${selectionEvent}`, payload);
18399
+ }
18400
+ return next;
18401
+ });
18402
+ }, [selectionEvent, eventBus]);
18403
+ const toggleAll = useCallback(() => {
18404
+ setSelectedIds((prev) => {
18405
+ const allIds2 = data.map((item, i) => item.id || String(i));
18406
+ const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
18407
+ const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
18408
+ if (selectionEvent) {
18409
+ const payload = { selectedIds: Array.from(next) };
18410
+ eventBus.emit(`UI:${selectionEvent}`, payload);
18411
+ }
18412
+ return next;
18413
+ });
18414
+ }, [data, selectionEvent, eventBus]);
18415
+ const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
18416
+ const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
18417
+ const bodyFields = fields.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
18418
+ const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
18419
+ const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
18420
+ const handleActionClick = (action, itemData) => (e) => {
18421
+ e.stopPropagation();
18422
+ const payload = {
18423
+ id: itemData.id,
18424
+ row: itemData
18425
+ };
18426
+ eventBus.emit(`UI:${action.event}`, payload);
18427
+ };
18428
+ const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
18429
+ const colsClass = cols ? {
18430
+ 1: "grid-cols-1",
18431
+ 2: "sm:grid-cols-2",
18432
+ 3: "sm:grid-cols-2 lg:grid-cols-3",
18433
+ 4: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
18434
+ 5: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",
18435
+ 6: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"
18436
+ }[cols] : void 0;
18437
+ if (isLoading) {
18438
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
18439
+ }
18440
+ if (error) {
18441
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
18442
+ }
18443
+ if (data.length === 0) {
18444
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
18445
+ }
18446
+ const hasRenderProp = typeof children === "function";
18447
+ const allIds = data.map((item, i) => item.id || String(i));
18448
+ const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
18449
+ const someSelected = selectedIds.size > 0;
18450
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
18451
+ selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
18452
+ /* @__PURE__ */ jsx(
18453
+ "input",
18454
+ {
18455
+ type: "checkbox",
18456
+ checked: allSelected,
18457
+ onChange: toggleAll,
18458
+ className: "w-4 h-4 accent-primary",
18459
+ "aria-label": "Select all"
18460
+ }
18461
+ ),
18462
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
18463
+ selectedIds.size,
18464
+ " ",
18465
+ t("common.selected") || "selected"
18466
+ ] })
18467
+ ] }),
18468
+ /* @__PURE__ */ jsx(
18469
+ Box,
18470
+ {
18471
+ className: cn("grid", gapStyles6[gap], colsClass, className),
18472
+ style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
18473
+ children: data.map((item, index) => {
18474
+ const itemData = item;
18475
+ const id = itemData.id || String(index);
18476
+ const isSelected = selectedIds.has(id);
18477
+ if (hasRenderProp) {
18478
+ return /* @__PURE__ */ jsx(
18479
+ Box,
18480
+ {
18481
+ "data-entity-row": true,
18482
+ "data-entity-id": id,
18483
+ className: cn(
18484
+ "bg-card rounded-lg",
18485
+ "border border-border",
18486
+ "shadow-sm hover:shadow-lg",
18487
+ "hover:border-primary transition-all",
18488
+ "p-4",
18489
+ isSelected && "ring-2 ring-primary border-primary"
18490
+ ),
18491
+ children: children(itemData, index)
18492
+ },
18493
+ id
18494
+ );
18495
+ }
18496
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
18497
+ return /* @__PURE__ */ jsxs(
18498
+ Box,
18499
+ {
18500
+ "data-entity-row": true,
18501
+ "data-entity-id": id,
18502
+ className: cn(
18503
+ "bg-card rounded-lg",
18504
+ "border border-border",
18505
+ "shadow-sm hover:shadow-lg",
18506
+ "hover:border-primary transition-all",
18507
+ "flex flex-col",
18508
+ isSelected && "ring-2 ring-primary border-primary"
18509
+ ),
18510
+ children: [
18511
+ imageField && (() => {
18512
+ const imgUrl = getNestedValue(itemData, imageField);
18513
+ if (!imgUrl || typeof imgUrl !== "string") return null;
18514
+ return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
18515
+ "img",
18516
+ {
18517
+ src: imgUrl,
18518
+ alt: titleValue !== void 0 ? String(titleValue) : "",
18519
+ className: "w-full h-full object-cover",
18520
+ loading: "lazy"
18521
+ }
18522
+ ) });
18523
+ })(),
18524
+ /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
18525
+ selectable && /* @__PURE__ */ jsx(
18526
+ "input",
18527
+ {
18528
+ type: "checkbox",
18529
+ checked: isSelected,
18530
+ onChange: () => toggleSelection(id),
18531
+ onClick: (e) => e.stopPropagation(),
18532
+ className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
18533
+ "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
18534
+ }
18535
+ ),
18536
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
18537
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18538
+ titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
18539
+ /* @__PURE__ */ jsx(
18540
+ Typography,
18541
+ {
18542
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
18543
+ className: "font-semibold truncate",
18544
+ children: String(titleValue)
18545
+ }
18546
+ )
18547
+ ] }),
18548
+ badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
18549
+ const val = getNestedValue(itemData, field.name);
18550
+ if (val === void 0 || val === null) return null;
18551
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18552
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
18553
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant2(String(val)), children: String(val) })
18554
+ ] }, field.name);
18555
+ }) })
18556
+ ] }),
18557
+ dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
18558
+ Button,
18559
+ {
18560
+ variant: "ghost",
18561
+ size: "sm",
18562
+ onClick: handleActionClick(action, itemData),
18563
+ "data-testid": `action-${action.event}`,
18564
+ className: "text-error hover:bg-error/10 px-2",
18565
+ children: [
18566
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
18567
+ action.label
18568
+ ]
18569
+ },
18570
+ idx
18571
+ )) })
18572
+ ] }) }),
18573
+ bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
18574
+ const value = getNestedValue(itemData, field.name);
18575
+ if (value === void 0 || value === null || value === "") return null;
18576
+ if (field.format === "boolean") {
18577
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
18578
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18579
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18580
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
18581
+ ] }),
18582
+ /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
18583
+ ] }, field.name);
18584
+ }
18585
+ return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
18586
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18587
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18588
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
18589
+ ] }),
18590
+ /* @__PURE__ */ jsx(
18591
+ Typography,
18592
+ {
18593
+ variant: field.variant === "caption" ? "caption" : "small",
18594
+ className: "text-right truncate max-w-[60%]",
18595
+ children: formatValue(value, field.format)
18596
+ }
18597
+ )
18598
+ ] }, field.name);
18599
+ }) }) }),
18600
+ primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
18601
+ Button,
18602
+ {
18603
+ variant: action.variant === "primary" ? "primary" : "ghost",
18604
+ size: "sm",
18605
+ onClick: handleActionClick(action, itemData),
18606
+ "data-testid": `action-${action.event}`,
18607
+ children: [
18608
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18609
+ action.label
18610
+ ]
18611
+ },
18612
+ idx
18613
+ )) }) })
18614
+ ]
18615
+ },
18616
+ id
18617
+ );
18618
+ })
18619
+ }
18620
+ ),
18621
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
18622
+ Button,
18623
+ {
18624
+ variant: "ghost",
18625
+ size: "sm",
18626
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
18627
+ children: [
18628
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
18629
+ t("common.showMore"),
18630
+ " (",
18631
+ allData.length - visibleCount,
18632
+ " remaining)"
18633
+ ]
18634
+ }
18635
+ ) }),
18636
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
18637
+ InfiniteScrollSentinel,
18638
+ {
18639
+ loadMoreEvent,
18640
+ isLoading,
18641
+ hasMore
18642
+ }
18643
+ )
18644
+ ] });
18645
+ }
18646
+ var gapStyles6;
18364
18647
  var init_DataGrid = __esm({
18365
18648
  "components/molecules/DataGrid.tsx"() {
18366
18649
  "use client";
@@ -18382,289 +18665,6 @@ var init_DataGrid = __esm({
18382
18665
  lg: "gap-6",
18383
18666
  xl: "gap-8"
18384
18667
  };
18385
- DataGrid = ({
18386
- entity,
18387
- fields: fieldsProp,
18388
- columns: columnsProp,
18389
- itemActions,
18390
- cols,
18391
- gap = "md",
18392
- minCardWidth = 280,
18393
- className,
18394
- isLoading = false,
18395
- error = null,
18396
- imageField,
18397
- selectable = false,
18398
- selectionEvent,
18399
- infiniteScroll,
18400
- loadMoreEvent,
18401
- hasMore,
18402
- children,
18403
- pageSize = 0
18404
- }) => {
18405
- const eventBus = useEventBus();
18406
- const { t } = useTranslate();
18407
- const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
18408
- const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
18409
- const fields = fieldsProp ?? columnsProp ?? [];
18410
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18411
- const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18412
- const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
18413
- const toggleSelection = useCallback((id) => {
18414
- setSelectedIds((prev) => {
18415
- const next = new Set(prev);
18416
- if (next.has(id)) next.delete(id);
18417
- else next.add(id);
18418
- if (selectionEvent) {
18419
- const payload = { selectedIds: Array.from(next) };
18420
- eventBus.emit(`UI:${selectionEvent}`, payload);
18421
- }
18422
- return next;
18423
- });
18424
- }, [selectionEvent, eventBus]);
18425
- const toggleAll = useCallback(() => {
18426
- setSelectedIds((prev) => {
18427
- const allIds2 = data.map((item, i) => item.id || String(i));
18428
- const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
18429
- const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
18430
- if (selectionEvent) {
18431
- const payload = { selectedIds: Array.from(next) };
18432
- eventBus.emit(`UI:${selectionEvent}`, payload);
18433
- }
18434
- return next;
18435
- });
18436
- }, [data, selectionEvent, eventBus]);
18437
- const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
18438
- const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
18439
- const bodyFields = fields.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
18440
- const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
18441
- const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
18442
- const handleActionClick = (action, itemData) => (e) => {
18443
- e.stopPropagation();
18444
- const payload = {
18445
- id: itemData.id,
18446
- row: itemData
18447
- };
18448
- eventBus.emit(`UI:${action.event}`, payload);
18449
- };
18450
- const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
18451
- const colsClass = cols ? {
18452
- 1: "grid-cols-1",
18453
- 2: "sm:grid-cols-2",
18454
- 3: "sm:grid-cols-2 lg:grid-cols-3",
18455
- 4: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
18456
- 5: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",
18457
- 6: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"
18458
- }[cols] : void 0;
18459
- if (isLoading) {
18460
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
18461
- }
18462
- if (error) {
18463
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
18464
- }
18465
- if (data.length === 0) {
18466
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
18467
- }
18468
- const hasRenderProp = typeof children === "function";
18469
- const allIds = data.map((item, i) => item.id || String(i));
18470
- const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
18471
- const someSelected = selectedIds.size > 0;
18472
- return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
18473
- selectable && someSelected && /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
18474
- /* @__PURE__ */ jsx(
18475
- "input",
18476
- {
18477
- type: "checkbox",
18478
- checked: allSelected,
18479
- onChange: toggleAll,
18480
- className: "w-4 h-4 accent-primary",
18481
- "aria-label": "Select all"
18482
- }
18483
- ),
18484
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "font-semibold", children: [
18485
- selectedIds.size,
18486
- " ",
18487
- t("common.selected") || "selected"
18488
- ] })
18489
- ] }),
18490
- /* @__PURE__ */ jsx(
18491
- Box,
18492
- {
18493
- className: cn("grid", gapStyles6[gap], colsClass, className),
18494
- style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
18495
- children: data.map((item, index) => {
18496
- const itemData = item;
18497
- const id = itemData.id || String(index);
18498
- const isSelected = selectedIds.has(id);
18499
- if (hasRenderProp) {
18500
- return /* @__PURE__ */ jsx(
18501
- Box,
18502
- {
18503
- "data-entity-row": true,
18504
- "data-entity-id": id,
18505
- className: cn(
18506
- "bg-card rounded-lg",
18507
- "border border-border",
18508
- "shadow-sm hover:shadow-lg",
18509
- "hover:border-primary transition-all",
18510
- "p-4",
18511
- isSelected && "ring-2 ring-primary border-primary"
18512
- ),
18513
- children: children(itemData, index)
18514
- },
18515
- id
18516
- );
18517
- }
18518
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
18519
- return /* @__PURE__ */ jsxs(
18520
- Box,
18521
- {
18522
- "data-entity-row": true,
18523
- "data-entity-id": id,
18524
- className: cn(
18525
- "bg-card rounded-lg",
18526
- "border border-border",
18527
- "shadow-sm hover:shadow-lg",
18528
- "hover:border-primary transition-all",
18529
- "flex flex-col",
18530
- isSelected && "ring-2 ring-primary border-primary"
18531
- ),
18532
- children: [
18533
- imageField && (() => {
18534
- const imgUrl = getNestedValue(itemData, imageField);
18535
- if (!imgUrl || typeof imgUrl !== "string") return null;
18536
- return /* @__PURE__ */ jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsx(
18537
- "img",
18538
- {
18539
- src: imgUrl,
18540
- alt: titleValue !== void 0 ? String(titleValue) : "",
18541
- className: "w-full h-full object-cover",
18542
- loading: "lazy"
18543
- }
18544
- ) });
18545
- })(),
18546
- /* @__PURE__ */ jsx(Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
18547
- selectable && /* @__PURE__ */ jsx(
18548
- "input",
18549
- {
18550
- type: "checkbox",
18551
- checked: isSelected,
18552
- onChange: () => toggleSelection(id),
18553
- onClick: (e) => e.stopPropagation(),
18554
- className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
18555
- "aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
18556
- }
18557
- ),
18558
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
18559
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18560
- titleField?.icon && /* @__PURE__ */ jsx(Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
18561
- /* @__PURE__ */ jsx(
18562
- Typography,
18563
- {
18564
- variant: titleField?.variant === "h3" ? "h3" : "h4",
18565
- className: "font-semibold truncate",
18566
- children: String(titleValue)
18567
- }
18568
- )
18569
- ] }),
18570
- badgeFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
18571
- const val = getNestedValue(itemData, field.name);
18572
- if (val === void 0 || val === null) return null;
18573
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18574
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
18575
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant2(String(val)), children: String(val) })
18576
- ] }, field.name);
18577
- }) })
18578
- ] }),
18579
- dangerActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxs(
18580
- Button,
18581
- {
18582
- variant: "ghost",
18583
- size: "sm",
18584
- onClick: handleActionClick(action, itemData),
18585
- "data-testid": `action-${action.event}`,
18586
- className: "text-error hover:bg-error/10 px-2",
18587
- children: [
18588
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs" }),
18589
- action.label
18590
- ]
18591
- },
18592
- idx
18593
- )) })
18594
- ] }) }),
18595
- bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
18596
- const value = getNestedValue(itemData, field.name);
18597
- if (value === void 0 || value === null || value === "") return null;
18598
- if (field.format === "boolean") {
18599
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
18600
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18601
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18602
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
18603
- ] }),
18604
- /* @__PURE__ */ jsx(Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
18605
- ] }, field.name);
18606
- }
18607
- return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-center", children: [
18608
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18609
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18610
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
18611
- ] }),
18612
- /* @__PURE__ */ jsx(
18613
- Typography,
18614
- {
18615
- variant: field.variant === "caption" ? "caption" : "small",
18616
- className: "text-right truncate max-w-[60%]",
18617
- children: formatValue(value, field.format)
18618
- }
18619
- )
18620
- ] }, field.name);
18621
- }) }) }),
18622
- primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsx(HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxs(
18623
- Button,
18624
- {
18625
- variant: action.variant === "primary" ? "primary" : "ghost",
18626
- size: "sm",
18627
- onClick: handleActionClick(action, itemData),
18628
- "data-testid": `action-${action.event}`,
18629
- children: [
18630
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18631
- action.label
18632
- ]
18633
- },
18634
- idx
18635
- )) }) })
18636
- ]
18637
- },
18638
- id
18639
- );
18640
- })
18641
- }
18642
- ),
18643
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
18644
- Button,
18645
- {
18646
- variant: "ghost",
18647
- size: "sm",
18648
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
18649
- children: [
18650
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
18651
- t("common.showMore"),
18652
- " (",
18653
- allData.length - visibleCount,
18654
- " remaining)"
18655
- ]
18656
- }
18657
- ) }),
18658
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
18659
- InfiniteScrollSentinel,
18660
- {
18661
- loadMoreEvent,
18662
- isLoading,
18663
- hasMore
18664
- }
18665
- )
18666
- ] });
18667
- };
18668
18668
  DataGrid.displayName = "DataGrid";
18669
18669
  }
18670
18670
  });
@@ -18712,318 +18712,317 @@ function groupData(items, field) {
18712
18712
  }
18713
18713
  return Array.from(groups.entries()).map(([label, groupItems]) => ({ label, items: groupItems }));
18714
18714
  }
18715
- var DataList;
18716
- var init_DataList = __esm({
18717
- "components/molecules/DataList.tsx"() {
18718
- "use client";
18719
- init_cn();
18720
- init_getNestedValue();
18721
- init_useEventBus();
18722
- init_useTranslate();
18723
- init_Box();
18724
- init_Stack();
18725
- init_Typography();
18726
- init_Badge();
18727
- init_Button();
18728
- init_Icon();
18729
- init_ProgressBar();
18730
- init_Divider();
18731
- init_InfiniteScrollSentinel();
18732
- DataList = ({
18733
- entity,
18734
- fields: fieldsProp,
18735
- columns: columnsProp,
18736
- itemActions,
18737
- gap = "none",
18738
- variant = "default",
18739
- groupBy,
18740
- senderField,
18741
- currentUser,
18742
- className,
18743
- isLoading = false,
18744
- error = null,
18745
- // Gesture props: reorderable, swipeLeftEvent, swipeRightEvent, longPressEvent
18746
- // are consumed by the compiler to wrap items in SwipeableRow/SortableList.
18747
- // DataList destructures them here to prevent DOM passthrough.
18748
- reorderable: _reorderable,
18749
- reorderEvent: _reorderEvent,
18750
- swipeLeftEvent: _swipeLeftEvent,
18751
- swipeLeftActions: _swipeLeftActions,
18752
- swipeRightEvent: _swipeRightEvent,
18753
- swipeRightActions: _swipeRightActions,
18754
- longPressEvent: _longPressEvent,
18755
- infiniteScroll,
18756
- loadMoreEvent,
18757
- hasMore,
18758
- children,
18759
- pageSize = 5
18760
- }) => {
18761
- const eventBus = useEventBus();
18762
- const { t } = useTranslate();
18763
- const [visibleCount, setVisibleCount] = React116__default.useState(pageSize || Infinity);
18764
- const fields = fieldsProp ?? columnsProp ?? [];
18765
- const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18766
- const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18767
- const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
18768
- const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
18769
- const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
18770
- const progressFields = fields.filter((f3) => f3.variant === "progress");
18771
- const bodyFields = fields.filter(
18772
- (f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
18773
- );
18774
- const handleActionClick = (action, itemData) => (e) => {
18775
- e.stopPropagation();
18776
- const payload = {
18777
- id: itemData.id,
18778
- row: itemData
18779
- };
18780
- eventBus.emit(`UI:${action.event}`, payload);
18781
- };
18782
- if (isLoading) {
18783
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
18784
- }
18785
- if (error) {
18786
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
18787
- }
18788
- if (data.length === 0) {
18789
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
18790
- }
18791
- const gapClass = {
18792
- none: "",
18793
- sm: "gap-1",
18794
- md: "gap-2",
18795
- lg: "gap-4"
18796
- }[gap];
18797
- const isCard = variant === "card";
18798
- const isCompact = variant === "compact";
18799
- const isMessage = variant === "message";
18800
- if (isMessage) {
18801
- const items2 = data.map((item) => item);
18802
- const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
18803
- const contentField = titleField?.name ?? fields[0]?.name ?? "";
18804
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
18805
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
18806
- group.items.map((itemData, index) => {
18807
- const id = itemData.id || `${gi}-${index}`;
18808
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
18809
- const isSent = Boolean(currentUser && sender === currentUser);
18810
- const content = getNestedValue(itemData, contentField);
18811
- const timestampField = fields.find((f3) => f3.format === "date");
18812
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
18813
- return /* @__PURE__ */ jsx(
18814
- Box,
18815
- {
18816
- className: cn(
18817
- "flex px-4",
18818
- isSent ? "justify-end" : "justify-start"
18819
- ),
18820
- children: /* @__PURE__ */ jsxs(
18821
- Box,
18822
- {
18823
- className: cn(
18824
- "max-w-[75%] px-4 py-2",
18825
- isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
18826
- ),
18827
- children: [
18828
- !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
18829
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: content !== void 0 && content !== null ? String(content) : "" }),
18830
- timestamp != null ? /* @__PURE__ */ jsx(
18831
- Typography,
18832
- {
18833
- variant: "caption",
18834
- className: cn(
18835
- "mt-1 text-[0.65rem]",
18836
- isSent ? "opacity-70" : "text-muted-foreground"
18837
- ),
18838
- children: formatDate3(timestamp)
18839
- }
18840
- ) : null
18841
- ]
18842
- }
18843
- )
18844
- },
18845
- id
18846
- );
18847
- })
18848
- ] }, gi)) });
18849
- }
18850
- const hasRenderProp = typeof children === "function";
18851
- const items = data.map((item) => item);
18852
- const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
18853
- const renderItem = (itemData, index, isLast) => {
18854
- if (hasRenderProp) {
18855
- const id2 = itemData.id || String(index);
18856
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
18857
- /* @__PURE__ */ jsxs(
18715
+ function DataList({
18716
+ entity,
18717
+ fields: fieldsProp,
18718
+ columns: columnsProp,
18719
+ itemActions,
18720
+ gap = "none",
18721
+ variant = "default",
18722
+ groupBy,
18723
+ senderField,
18724
+ currentUser,
18725
+ className,
18726
+ isLoading = false,
18727
+ error = null,
18728
+ // Gesture props: reorderable, swipeLeftEvent, swipeRightEvent, longPressEvent
18729
+ // are consumed by the compiler to wrap items in SwipeableRow/SortableList.
18730
+ // DataList destructures them here to prevent DOM passthrough.
18731
+ reorderable: _reorderable,
18732
+ reorderEvent: _reorderEvent,
18733
+ swipeLeftEvent: _swipeLeftEvent,
18734
+ swipeLeftActions: _swipeLeftActions,
18735
+ swipeRightEvent: _swipeRightEvent,
18736
+ swipeRightActions: _swipeRightActions,
18737
+ longPressEvent: _longPressEvent,
18738
+ infiniteScroll,
18739
+ loadMoreEvent,
18740
+ hasMore,
18741
+ children,
18742
+ pageSize = 5
18743
+ }) {
18744
+ const eventBus = useEventBus();
18745
+ const { t } = useTranslate();
18746
+ const [visibleCount, setVisibleCount] = React115__default.useState(pageSize || Infinity);
18747
+ const fields = fieldsProp ?? columnsProp ?? [];
18748
+ const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18749
+ const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18750
+ const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
18751
+ const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
18752
+ const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
18753
+ const progressFields = fields.filter((f3) => f3.variant === "progress");
18754
+ const bodyFields = fields.filter(
18755
+ (f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
18756
+ );
18757
+ const handleActionClick = (action, itemData) => (e) => {
18758
+ e.stopPropagation();
18759
+ const payload = {
18760
+ id: itemData.id,
18761
+ row: itemData
18762
+ };
18763
+ eventBus.emit(`UI:${action.event}`, payload);
18764
+ };
18765
+ if (isLoading) {
18766
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
18767
+ }
18768
+ if (error) {
18769
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
18770
+ }
18771
+ if (data.length === 0) {
18772
+ return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
18773
+ }
18774
+ const gapClass = {
18775
+ none: "",
18776
+ sm: "gap-1",
18777
+ md: "gap-2",
18778
+ lg: "gap-4"
18779
+ }[gap];
18780
+ const isCard = variant === "card";
18781
+ const isCompact = variant === "compact";
18782
+ const isMessage = variant === "message";
18783
+ if (isMessage) {
18784
+ const items2 = data.map((item) => item);
18785
+ const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
18786
+ const contentField = titleField?.name ?? fields[0]?.name ?? "";
18787
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
18788
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
18789
+ group.items.map((itemData, index) => {
18790
+ const id = itemData.id || `${gi}-${index}`;
18791
+ const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
18792
+ const isSent = Boolean(currentUser && sender === currentUser);
18793
+ const content = getNestedValue(itemData, contentField);
18794
+ const timestampField = fields.find((f3) => f3.format === "date");
18795
+ const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
18796
+ return /* @__PURE__ */ jsx(
18797
+ Box,
18798
+ {
18799
+ className: cn(
18800
+ "flex px-4",
18801
+ isSent ? "justify-end" : "justify-start"
18802
+ ),
18803
+ children: /* @__PURE__ */ jsxs(
18858
18804
  Box,
18859
18805
  {
18860
18806
  className: cn(
18861
- "group flex items-center gap-4 transition-all duration-200",
18862
- isCompact ? "px-4 py-2" : "px-6 py-4",
18863
- "hover:bg-muted/80",
18864
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
18807
+ "max-w-[75%] px-4 py-2",
18808
+ isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
18865
18809
  ),
18866
18810
  children: [
18867
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
18868
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
18869
- HStack,
18811
+ !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
18812
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: content !== void 0 && content !== null ? String(content) : "" }),
18813
+ timestamp != null ? /* @__PURE__ */ jsx(
18814
+ Typography,
18870
18815
  {
18871
- gap: "xs",
18872
- className: "flex-shrink-0",
18873
- children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
18874
- Button,
18875
- {
18876
- variant: action.variant ?? "ghost",
18877
- size: "sm",
18878
- onClick: handleActionClick(action, itemData),
18879
- "data-testid": `action-${action.event}`,
18880
- className: cn(
18881
- action.variant === "danger" && "text-error hover:bg-error/10"
18882
- ),
18883
- children: [
18884
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18885
- action.label
18886
- ]
18887
- },
18888
- idx
18889
- ))
18816
+ variant: "caption",
18817
+ className: cn(
18818
+ "mt-1 text-[0.65rem]",
18819
+ isSent ? "opacity-70" : "text-muted-foreground"
18820
+ ),
18821
+ children: formatDate3(timestamp)
18890
18822
  }
18891
- )
18823
+ ) : null
18892
18824
  ]
18893
18825
  }
18826
+ )
18827
+ },
18828
+ id
18829
+ );
18830
+ })
18831
+ ] }, gi)) });
18832
+ }
18833
+ const hasRenderProp = typeof children === "function";
18834
+ const items = data.map((item) => item);
18835
+ const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
18836
+ const renderItem = (itemData, index, isLast) => {
18837
+ if (hasRenderProp) {
18838
+ const id2 = itemData.id || String(index);
18839
+ return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, children: [
18840
+ /* @__PURE__ */ jsxs(
18841
+ Box,
18842
+ {
18843
+ className: cn(
18844
+ "group flex items-center gap-4 transition-all duration-200",
18845
+ isCompact ? "px-4 py-2" : "px-6 py-4",
18846
+ "hover:bg-muted/80",
18847
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
18894
18848
  ),
18895
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
18896
- ] }, id2);
18897
- }
18898
- const id = itemData.id || String(index);
18899
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
18900
- return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
18901
- /* @__PURE__ */ jsxs(
18902
- Box,
18903
- {
18904
- className: cn(
18905
- "group flex items-center gap-4 transition-all duration-200",
18906
- isCompact ? "px-4 py-2" : "px-6 py-4",
18907
- "hover:bg-muted/80",
18908
- !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
18909
- ),
18910
- children: [
18911
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
18912
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
18913
- titleField?.icon && /* @__PURE__ */ jsx(
18914
- Icon,
18915
- {
18916
- name: titleField.icon,
18917
- size: isCompact ? "xs" : "sm",
18918
- className: "text-primary flex-shrink-0"
18919
- }
18920
- ),
18921
- titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
18922
- Typography,
18923
- {
18924
- variant: titleField?.variant === "h3" ? "h3" : "h4",
18925
- className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
18926
- children: String(titleValue)
18927
- }
18928
- ),
18929
- badgeFields.map((field) => {
18930
- const val = getNestedValue(itemData, field.name);
18931
- if (val === void 0 || val === null) return null;
18932
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
18933
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
18934
- /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
18935
- ] }, field.name);
18936
- })
18937
- ] }),
18938
- bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
18939
- const value = getNestedValue(itemData, field.name);
18940
- if (value === void 0 || value === null || value === "") return null;
18941
- return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18942
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18943
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
18944
- field.label ?? fieldLabel3(field.name),
18945
- ":"
18946
- ] }),
18947
- /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
18948
- ] }, field.name);
18949
- }) }),
18950
- progressFields.map((field) => {
18951
- const value = getNestedValue(itemData, field.name);
18952
- if (typeof value !== "number") return null;
18953
- return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
18954
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
18955
- field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18956
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
18957
- ] }),
18958
- /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
18959
- ] }, field.name);
18960
- })
18961
- ] }),
18962
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
18963
- Button,
18964
- {
18965
- variant: action.variant ?? "ghost",
18966
- size: "sm",
18967
- onClick: handleActionClick(action, itemData),
18968
- "data-testid": `action-${action.event}`,
18969
- className: cn(
18970
- action.variant === "danger" && "text-error hover:bg-error/10"
18971
- ),
18972
- children: [
18973
- action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18974
- action.label
18975
- ]
18976
- },
18977
- idx
18978
- )) })
18979
- ]
18980
- }
18981
- ),
18982
- isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
18983
- ] }, id);
18984
- };
18985
- return /* @__PURE__ */ jsxs(
18849
+ children: [
18850
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
18851
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(
18852
+ HStack,
18853
+ {
18854
+ gap: "xs",
18855
+ className: "flex-shrink-0",
18856
+ children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
18857
+ Button,
18858
+ {
18859
+ variant: action.variant ?? "ghost",
18860
+ size: "sm",
18861
+ onClick: handleActionClick(action, itemData),
18862
+ "data-testid": `action-${action.event}`,
18863
+ className: cn(
18864
+ action.variant === "danger" && "text-error hover:bg-error/10"
18865
+ ),
18866
+ children: [
18867
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18868
+ action.label
18869
+ ]
18870
+ },
18871
+ idx
18872
+ ))
18873
+ }
18874
+ )
18875
+ ]
18876
+ }
18877
+ ),
18878
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
18879
+ ] }, id2);
18880
+ }
18881
+ const id = itemData.id || String(index);
18882
+ const titleValue = getNestedValue(itemData, titleField?.name ?? "");
18883
+ return /* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id, children: [
18884
+ /* @__PURE__ */ jsxs(
18986
18885
  Box,
18987
18886
  {
18988
18887
  className: cn(
18989
- isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
18990
- !isCard && gapClass,
18991
- className
18888
+ "group flex items-center gap-4 transition-all duration-200",
18889
+ isCompact ? "px-4 py-2" : "px-6 py-4",
18890
+ "hover:bg-muted/80",
18891
+ !isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
18992
18892
  ),
18993
18893
  children: [
18994
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
18995
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
18996
- group.items.map(
18997
- (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
18998
- )
18999
- ] }, gi)),
19000
- hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
18894
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
18895
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "items-center", children: [
18896
+ titleField?.icon && /* @__PURE__ */ jsx(
18897
+ Icon,
18898
+ {
18899
+ name: titleField.icon,
18900
+ size: isCompact ? "xs" : "sm",
18901
+ className: "text-primary flex-shrink-0"
18902
+ }
18903
+ ),
18904
+ titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsx(
18905
+ Typography,
18906
+ {
18907
+ variant: titleField?.variant === "h3" ? "h3" : "h4",
18908
+ className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
18909
+ children: String(titleValue)
18910
+ }
18911
+ ),
18912
+ badgeFields.map((field) => {
18913
+ const val = getNestedValue(itemData, field.name);
18914
+ if (val === void 0 || val === null) return null;
18915
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
18916
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
18917
+ /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(val)), children: String(val) })
18918
+ ] }, field.name);
18919
+ })
18920
+ ] }),
18921
+ bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
18922
+ const value = getNestedValue(itemData, field.name);
18923
+ if (value === void 0 || value === null || value === "") return null;
18924
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
18925
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18926
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", children: [
18927
+ field.label ?? fieldLabel3(field.name),
18928
+ ":"
18929
+ ] }),
18930
+ /* @__PURE__ */ jsx(Typography, { variant: "small", children: formatValue2(value, field.format) })
18931
+ ] }, field.name);
18932
+ }) }),
18933
+ progressFields.map((field) => {
18934
+ const value = getNestedValue(itemData, field.name);
18935
+ if (typeof value !== "number") return null;
18936
+ return /* @__PURE__ */ jsxs(Box, { className: "mt-2 max-w-xs", children: [
18937
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
18938
+ field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
18939
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
18940
+ ] }),
18941
+ /* @__PURE__ */ jsx(ProgressBar, { value, max: 100 })
18942
+ ] }, field.name);
18943
+ })
18944
+ ] }),
18945
+ itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
19001
18946
  Button,
19002
18947
  {
19003
- variant: "ghost",
18948
+ variant: action.variant ?? "ghost",
19004
18949
  size: "sm",
19005
- onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
18950
+ onClick: handleActionClick(action, itemData),
18951
+ "data-testid": `action-${action.event}`,
18952
+ className: cn(
18953
+ action.variant === "danger" && "text-error hover:bg-error/10"
18954
+ ),
19006
18955
  children: [
19007
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
19008
- t("common.showMore"),
19009
- " (",
19010
- allData.length - visibleCount,
19011
- " remaining)"
18956
+ action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
18957
+ action.label
19012
18958
  ]
19013
- }
19014
- ) }),
19015
- infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
19016
- InfiniteScrollSentinel,
19017
- {
19018
- loadMoreEvent,
19019
- isLoading,
19020
- hasMore
19021
- }
19022
- )
18959
+ },
18960
+ idx
18961
+ )) })
19023
18962
  ]
19024
18963
  }
19025
- );
19026
- };
18964
+ ),
18965
+ isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
18966
+ ] }, id);
18967
+ };
18968
+ return /* @__PURE__ */ jsxs(
18969
+ Box,
18970
+ {
18971
+ className: cn(
18972
+ isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
18973
+ !isCard && gapClass,
18974
+ className
18975
+ ),
18976
+ children: [
18977
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
18978
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
18979
+ group.items.map(
18980
+ (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
18981
+ )
18982
+ ] }, gi)),
18983
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
18984
+ Button,
18985
+ {
18986
+ variant: "ghost",
18987
+ size: "sm",
18988
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
18989
+ children: [
18990
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
18991
+ t("common.showMore"),
18992
+ " (",
18993
+ allData.length - visibleCount,
18994
+ " remaining)"
18995
+ ]
18996
+ }
18997
+ ) }),
18998
+ infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsx(
18999
+ InfiniteScrollSentinel,
19000
+ {
19001
+ loadMoreEvent,
19002
+ isLoading,
19003
+ hasMore
19004
+ }
19005
+ )
19006
+ ]
19007
+ }
19008
+ );
19009
+ }
19010
+ var init_DataList = __esm({
19011
+ "components/molecules/DataList.tsx"() {
19012
+ "use client";
19013
+ init_cn();
19014
+ init_getNestedValue();
19015
+ init_useEventBus();
19016
+ init_useTranslate();
19017
+ init_Box();
19018
+ init_Stack();
19019
+ init_Typography();
19020
+ init_Badge();
19021
+ init_Button();
19022
+ init_Icon();
19023
+ init_ProgressBar();
19024
+ init_Divider();
19025
+ init_InfiniteScrollSentinel();
19027
19026
  DataList.displayName = "DataList";
19028
19027
  }
19029
19028
  });
@@ -20160,7 +20159,10 @@ var init_WizardProgress = __esm({
20160
20159
  stepClickEvent
20161
20160
  }) => {
20162
20161
  const eventBus = useEventBus();
20163
- const totalSteps = steps.length;
20162
+ const normalizedSteps = steps.map(
20163
+ (s, i) => typeof s === "string" ? { id: `step-${i}`, title: s } : s
20164
+ );
20165
+ const totalSteps = normalizedSteps.length;
20164
20166
  const handleStepClick = (index) => {
20165
20167
  const isCompleted = index < currentStep;
20166
20168
  if (isCompleted && allowNavigation) {
@@ -20177,10 +20179,10 @@ var init_WizardProgress = __esm({
20177
20179
  compact ? "px-4 py-2" : "px-6 py-4",
20178
20180
  className
20179
20181
  ),
20180
- children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
20182
+ children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
20181
20183
  const isActive = index === currentStep;
20182
20184
  const isCompleted = index < currentStep;
20183
- return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
20185
+ return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
20184
20186
  /* @__PURE__ */ jsx(
20185
20187
  "button",
20186
20188
  {
@@ -21091,7 +21093,7 @@ function InventoryGrid({
21091
21093
  const eventBus = useEventBus();
21092
21094
  const slotCount = totalSlots ?? items.length;
21093
21095
  const emptySlotCount = Math.max(0, slotCount - items.length);
21094
- const handleSelect = React116.useCallback(
21096
+ const handleSelect = React115.useCallback(
21095
21097
  (id) => {
21096
21098
  onSelect?.(id);
21097
21099
  if (selectEvent) {
@@ -21304,15 +21306,15 @@ function GameCanvas2D({
21304
21306
  fps = 60,
21305
21307
  className
21306
21308
  }) {
21307
- const canvasRef = React116.useRef(null);
21308
- const rafRef = React116.useRef(0);
21309
- const frameRef = React116.useRef(0);
21310
- const lastTimeRef = React116.useRef(0);
21311
- const onDrawRef = React116.useRef(onDraw);
21309
+ const canvasRef = React115.useRef(null);
21310
+ const rafRef = React115.useRef(0);
21311
+ const frameRef = React115.useRef(0);
21312
+ const lastTimeRef = React115.useRef(0);
21313
+ const onDrawRef = React115.useRef(onDraw);
21312
21314
  onDrawRef.current = onDraw;
21313
- const onTickRef = React116.useRef(onTick);
21315
+ const onTickRef = React115.useRef(onTick);
21314
21316
  onTickRef.current = onTick;
21315
- React116.useEffect(() => {
21317
+ React115.useEffect(() => {
21316
21318
  const canvas = canvasRef.current;
21317
21319
  if (!canvas) return;
21318
21320
  const ctx = canvas.getContext("2d");
@@ -21601,7 +21603,7 @@ function TurnPanel({
21601
21603
  className
21602
21604
  }) {
21603
21605
  const eventBus = useEventBus();
21604
- const handleAction = React116.useCallback(
21606
+ const handleAction = React115.useCallback(
21605
21607
  (event) => {
21606
21608
  if (event) {
21607
21609
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -21747,7 +21749,7 @@ function UnitCommandBar({
21747
21749
  className
21748
21750
  }) {
21749
21751
  const eventBus = useEventBus();
21750
- const handleCommand = React116.useCallback(
21752
+ const handleCommand = React115.useCallback(
21751
21753
  (event) => {
21752
21754
  if (event) {
21753
21755
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -22232,7 +22234,7 @@ function GameMenu({
22232
22234
  } catch {
22233
22235
  }
22234
22236
  const eventBus = eventBusProp || eventBusFromHook;
22235
- const handleOptionClick = React116.useCallback(
22237
+ const handleOptionClick = React115.useCallback(
22236
22238
  (option) => {
22237
22239
  if (option.event && eventBus) {
22238
22240
  eventBus.emit(`UI:${option.event}`, { option });
@@ -22346,7 +22348,7 @@ function GameOverScreen({
22346
22348
  } catch {
22347
22349
  }
22348
22350
  const eventBus = eventBusProp || eventBusFromHook;
22349
- const handleActionClick = React116.useCallback(
22351
+ const handleActionClick = React115.useCallback(
22350
22352
  (action) => {
22351
22353
  if (action.event && eventBus) {
22352
22354
  eventBus.emit(`UI:${action.event}`, { action });
@@ -25312,7 +25314,7 @@ var init_StepFlow = __esm({
25312
25314
  className
25313
25315
  }) => {
25314
25316
  if (orientation === "vertical") {
25315
- 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: [
25317
+ 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: [
25316
25318
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
25317
25319
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25318
25320
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -25323,7 +25325,7 @@ var init_StepFlow = __esm({
25323
25325
  ] })
25324
25326
  ] }) }, index)) });
25325
25327
  }
25326
- 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: [
25328
+ 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: [
25327
25329
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
25328
25330
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25329
25331
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27436,7 +27438,7 @@ var init_DocumentViewer = __esm({
27436
27438
  }
27437
27439
  });
27438
27440
  function extractTitle(children) {
27439
- if (!React116__default.isValidElement(children)) return void 0;
27441
+ if (!React115__default.isValidElement(children)) return void 0;
27440
27442
  const props = children.props;
27441
27443
  if (typeof props.title === "string") {
27442
27444
  return props.title;
@@ -27491,7 +27493,7 @@ function LinearView({
27491
27493
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
27492
27494
  const isDone = i < currentIdx;
27493
27495
  const isCurrent = i === currentIdx;
27494
- return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
27496
+ return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
27495
27497
  i > 0 && /* @__PURE__ */ jsx(
27496
27498
  Typography,
27497
27499
  {
@@ -28258,7 +28260,7 @@ var init_Form = __esm({
28258
28260
  const normalizedInitialData = initialData ?? {};
28259
28261
  const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
28260
28262
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28261
- const entityDerivedFields = React116__default.useMemo(() => {
28263
+ const entityDerivedFields = React115__default.useMemo(() => {
28262
28264
  if (fields && fields.length > 0) return void 0;
28263
28265
  if (!resolvedEntity) return void 0;
28264
28266
  return resolvedEntity.fields.map(
@@ -28277,14 +28279,14 @@ var init_Form = __esm({
28277
28279
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
28278
28280
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
28279
28281
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
28280
- const [formData, setFormData] = React116__default.useState(
28282
+ const [formData, setFormData] = React115__default.useState(
28281
28283
  normalizedInitialData
28282
28284
  );
28283
- const [collapsedSections, setCollapsedSections] = React116__default.useState(
28285
+ const [collapsedSections, setCollapsedSections] = React115__default.useState(
28284
28286
  /* @__PURE__ */ new Set()
28285
28287
  );
28286
28288
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
28287
- const evalContext = React116__default.useMemo(
28289
+ const evalContext = React115__default.useMemo(
28288
28290
  () => ({
28289
28291
  formValues: formData,
28290
28292
  globalVariables: externalContext?.globalVariables ?? {},
@@ -28293,13 +28295,13 @@ var init_Form = __esm({
28293
28295
  }),
28294
28296
  [formData, externalContext]
28295
28297
  );
28296
- React116__default.useEffect(() => {
28298
+ React115__default.useEffect(() => {
28297
28299
  const data = initialData;
28298
28300
  if (data && Object.keys(data).length > 0) {
28299
28301
  setFormData(data);
28300
28302
  }
28301
28303
  }, [initialData]);
28302
- const processCalculations = React116__default.useCallback(
28304
+ const processCalculations = React115__default.useCallback(
28303
28305
  (changedFieldId, newFormData) => {
28304
28306
  if (!hiddenCalculations.length) return;
28305
28307
  const context = {
@@ -28324,7 +28326,7 @@ var init_Form = __esm({
28324
28326
  },
28325
28327
  [hiddenCalculations, externalContext, eventBus]
28326
28328
  );
28327
- const checkViolations = React116__default.useCallback(
28329
+ const checkViolations = React115__default.useCallback(
28328
28330
  (changedFieldId, newFormData) => {
28329
28331
  if (!violationTriggers.length) return;
28330
28332
  const context = {
@@ -28361,7 +28363,7 @@ var init_Form = __esm({
28361
28363
  processCalculations(name, newFormData);
28362
28364
  checkViolations(name, newFormData);
28363
28365
  };
28364
- const isFieldVisible = React116__default.useCallback(
28366
+ const isFieldVisible = React115__default.useCallback(
28365
28367
  (fieldName) => {
28366
28368
  const condition = conditionalFields[fieldName];
28367
28369
  if (!condition) return true;
@@ -28369,7 +28371,7 @@ var init_Form = __esm({
28369
28371
  },
28370
28372
  [conditionalFields, evalContext]
28371
28373
  );
28372
- const isSectionVisible = React116__default.useCallback(
28374
+ const isSectionVisible = React115__default.useCallback(
28373
28375
  (section) => {
28374
28376
  if (!section.condition) return true;
28375
28377
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -28402,7 +28404,7 @@ var init_Form = __esm({
28402
28404
  eventBus.emit(`UI:${onCancel}`);
28403
28405
  }
28404
28406
  };
28405
- const renderField = React116__default.useCallback(
28407
+ const renderField = React115__default.useCallback(
28406
28408
  (field) => {
28407
28409
  const fieldName = field.name || field.field;
28408
28410
  if (!fieldName) return null;
@@ -28423,7 +28425,7 @@ var init_Form = __esm({
28423
28425
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
28424
28426
  );
28425
28427
  const effectiveFields = entityDerivedFields ?? fields;
28426
- const normalizedFields = React116__default.useMemo(() => {
28428
+ const normalizedFields = React115__default.useMemo(() => {
28427
28429
  if (!effectiveFields || effectiveFields.length === 0) return [];
28428
28430
  return effectiveFields.map((field) => {
28429
28431
  if (typeof field === "string") {
@@ -28445,7 +28447,7 @@ var init_Form = __esm({
28445
28447
  return field;
28446
28448
  });
28447
28449
  }, [effectiveFields, resolvedEntity]);
28448
- const schemaFields = React116__default.useMemo(() => {
28450
+ const schemaFields = React115__default.useMemo(() => {
28449
28451
  if (normalizedFields.length === 0) return null;
28450
28452
  if (isDebugEnabled()) {
28451
28453
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -28455,7 +28457,7 @@ var init_Form = __esm({
28455
28457
  }
28456
28458
  return normalizedFields.map(renderField).filter(Boolean);
28457
28459
  }, [normalizedFields, renderField, entityName, conditionalFields]);
28458
- const sectionElements = React116__default.useMemo(() => {
28460
+ const sectionElements = React115__default.useMemo(() => {
28459
28461
  if (!sections || sections.length === 0) return null;
28460
28462
  return sections.map((section) => {
28461
28463
  if (!isSectionVisible(section)) {
@@ -29977,7 +29979,7 @@ var init_List = __esm({
29977
29979
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
29978
29980
  return [];
29979
29981
  }, [entity]);
29980
- const getItemActions = React116__default.useCallback(
29982
+ const getItemActions = React115__default.useCallback(
29981
29983
  (item) => {
29982
29984
  if (!itemActions) return [];
29983
29985
  if (typeof itemActions === "function") {
@@ -30414,7 +30416,7 @@ var init_MediaGallery = __esm({
30414
30416
  [selectable, selectedItems, selectionEvent, eventBus]
30415
30417
  );
30416
30418
  const entityData = Array.isArray(entity) ? entity : [];
30417
- const items = React116__default.useMemo(() => {
30419
+ const items = React115__default.useMemo(() => {
30418
30420
  if (propItems) return propItems;
30419
30421
  if (entityData.length === 0) return [];
30420
30422
  return entityData.map((record, idx) => ({
@@ -30578,7 +30580,7 @@ var init_MediaGallery = __esm({
30578
30580
  }
30579
30581
  });
30580
30582
  function extractTitle2(children) {
30581
- if (!React116__default.isValidElement(children)) return void 0;
30583
+ if (!React115__default.isValidElement(children)) return void 0;
30582
30584
  const props = children.props;
30583
30585
  if (typeof props.title === "string") {
30584
30586
  return props.title;
@@ -31291,7 +31293,7 @@ var init_PageHeader = __esm({
31291
31293
  info: "bg-info/10 text-info"
31292
31294
  };
31293
31295
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
31294
- 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: [
31296
+ 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: [
31295
31297
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
31296
31298
  crumb.href ? /* @__PURE__ */ jsx(
31297
31299
  "a",
@@ -31449,7 +31451,7 @@ var init_debugRegistry = __esm({
31449
31451
  }
31450
31452
  });
31451
31453
  function useDebugData() {
31452
- const [data, setData] = React116.useState(() => ({
31454
+ const [data, setData] = React115.useState(() => ({
31453
31455
  traits: [],
31454
31456
  ticks: [],
31455
31457
  guards: [],
@@ -31463,7 +31465,7 @@ function useDebugData() {
31463
31465
  },
31464
31466
  lastUpdate: Date.now()
31465
31467
  }));
31466
- React116.useEffect(() => {
31468
+ React115.useEffect(() => {
31467
31469
  const updateData = () => {
31468
31470
  setData({
31469
31471
  traits: getAllTraits(),
@@ -31572,12 +31574,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
31572
31574
  return positions;
31573
31575
  }
31574
31576
  function WalkMinimap() {
31575
- const [walkStep, setWalkStep] = React116.useState(null);
31576
- const [traits2, setTraits] = React116.useState([]);
31577
- const [coveredEdges, setCoveredEdges] = React116.useState([]);
31578
- const [completedTraits, setCompletedTraits] = React116.useState(/* @__PURE__ */ new Set());
31579
- const prevTraitRef = React116.useRef(null);
31580
- React116.useEffect(() => {
31577
+ const [walkStep, setWalkStep] = React115.useState(null);
31578
+ const [traits2, setTraits] = React115.useState([]);
31579
+ const [coveredEdges, setCoveredEdges] = React115.useState([]);
31580
+ const [completedTraits, setCompletedTraits] = React115.useState(/* @__PURE__ */ new Set());
31581
+ const prevTraitRef = React115.useRef(null);
31582
+ React115.useEffect(() => {
31581
31583
  const interval = setInterval(() => {
31582
31584
  const w = window;
31583
31585
  const step = w.__orbitalWalkStep;
@@ -32024,15 +32026,15 @@ var init_EntitiesTab = __esm({
32024
32026
  }
32025
32027
  });
32026
32028
  function EventFlowTab({ events: events2 }) {
32027
- const [filter, setFilter] = React116.useState("all");
32028
- const containerRef = React116.useRef(null);
32029
- const [autoScroll, setAutoScroll] = React116.useState(true);
32030
- React116.useEffect(() => {
32029
+ const [filter, setFilter] = React115.useState("all");
32030
+ const containerRef = React115.useRef(null);
32031
+ const [autoScroll, setAutoScroll] = React115.useState(true);
32032
+ React115.useEffect(() => {
32031
32033
  if (autoScroll && containerRef.current) {
32032
32034
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32033
32035
  }
32034
32036
  }, [events2.length, autoScroll]);
32035
- const filteredEvents = React116.useMemo(() => {
32037
+ const filteredEvents = React115.useMemo(() => {
32036
32038
  if (filter === "all") return events2;
32037
32039
  return events2.filter((e) => e.type === filter);
32038
32040
  }, [events2, filter]);
@@ -32151,7 +32153,7 @@ var init_EventFlowTab = __esm({
32151
32153
  }
32152
32154
  });
32153
32155
  function GuardsPanel({ guards }) {
32154
- const [filter, setFilter] = React116.useState("all");
32156
+ const [filter, setFilter] = React115.useState("all");
32155
32157
  if (guards.length === 0) {
32156
32158
  return /* @__PURE__ */ jsx(
32157
32159
  EmptyState,
@@ -32164,7 +32166,7 @@ function GuardsPanel({ guards }) {
32164
32166
  }
32165
32167
  const passedCount = guards.filter((g) => g.result).length;
32166
32168
  const failedCount = guards.length - passedCount;
32167
- const filteredGuards = React116.useMemo(() => {
32169
+ const filteredGuards = React115.useMemo(() => {
32168
32170
  if (filter === "all") return guards;
32169
32171
  if (filter === "passed") return guards.filter((g) => g.result);
32170
32172
  return guards.filter((g) => !g.result);
@@ -32325,10 +32327,10 @@ function EffectBadge({ effect }) {
32325
32327
  ] });
32326
32328
  }
32327
32329
  function TransitionTimeline({ transitions }) {
32328
- const containerRef = React116.useRef(null);
32329
- const [autoScroll, setAutoScroll] = React116.useState(true);
32330
- const [expandedId, setExpandedId] = React116.useState(null);
32331
- React116.useEffect(() => {
32330
+ const containerRef = React115.useRef(null);
32331
+ const [autoScroll, setAutoScroll] = React115.useState(true);
32332
+ const [expandedId, setExpandedId] = React115.useState(null);
32333
+ React115.useEffect(() => {
32332
32334
  if (autoScroll && containerRef.current) {
32333
32335
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32334
32336
  }
@@ -32614,9 +32616,9 @@ function getAllEvents(traits2) {
32614
32616
  }
32615
32617
  function EventDispatcherTab({ traits: traits2, schema }) {
32616
32618
  const eventBus = useEventBus();
32617
- const [log3, setLog] = React116.useState([]);
32618
- const prevStatesRef = React116.useRef(/* @__PURE__ */ new Map());
32619
- React116.useEffect(() => {
32619
+ const [log3, setLog] = React115.useState([]);
32620
+ const prevStatesRef = React115.useRef(/* @__PURE__ */ new Map());
32621
+ React115.useEffect(() => {
32620
32622
  for (const trait of traits2) {
32621
32623
  const prev = prevStatesRef.current.get(trait.id);
32622
32624
  if (prev && prev !== trait.currentState) {
@@ -32786,10 +32788,10 @@ function VerifyModePanel({
32786
32788
  serverCount,
32787
32789
  localCount
32788
32790
  }) {
32789
- const [expanded, setExpanded] = React116.useState(true);
32790
- const scrollRef = React116.useRef(null);
32791
- const prevCountRef = React116.useRef(0);
32792
- React116.useEffect(() => {
32791
+ const [expanded, setExpanded] = React115.useState(true);
32792
+ const scrollRef = React115.useRef(null);
32793
+ const prevCountRef = React115.useRef(0);
32794
+ React115.useEffect(() => {
32793
32795
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
32794
32796
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
32795
32797
  }
@@ -32855,10 +32857,10 @@ function RuntimeDebugger({
32855
32857
  defaultTab,
32856
32858
  schema
32857
32859
  }) {
32858
- const [isCollapsed, setIsCollapsed] = React116.useState(mode === "verify" ? true : defaultCollapsed);
32859
- const [isVisible, setIsVisible] = React116.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
32860
+ const [isCollapsed, setIsCollapsed] = React115.useState(mode === "verify" ? true : defaultCollapsed);
32861
+ const [isVisible, setIsVisible] = React115.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
32860
32862
  const debugData = useDebugData();
32861
- React116.useEffect(() => {
32863
+ React115.useEffect(() => {
32862
32864
  if (mode === "inline") return;
32863
32865
  return onDebugToggle((enabled) => {
32864
32866
  setIsVisible(enabled);
@@ -32867,7 +32869,7 @@ function RuntimeDebugger({
32867
32869
  }
32868
32870
  });
32869
32871
  }, [mode]);
32870
- React116.useEffect(() => {
32872
+ React115.useEffect(() => {
32871
32873
  if (mode === "inline") return;
32872
32874
  const handleKeyDown = (e) => {
32873
32875
  if (e.key === "`" && isVisible) {
@@ -33416,7 +33418,7 @@ function SequenceBar({
33416
33418
  onSlotRemove(index);
33417
33419
  }, [onSlotRemove, playing]);
33418
33420
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
33419
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
33421
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
33420
33422
  i > 0 && /* @__PURE__ */ jsx(
33421
33423
  Typography,
33422
33424
  {
@@ -34761,7 +34763,7 @@ var init_StatCard2 = __esm({
34761
34763
  const labelToUse = propLabel ?? propTitle;
34762
34764
  const eventBus = useEventBus();
34763
34765
  const { t } = useTranslate();
34764
- const handleActionClick = React116__default.useCallback(() => {
34766
+ const handleActionClick = React115__default.useCallback(() => {
34765
34767
  if (action?.event) {
34766
34768
  eventBus.emit(`UI:${action.event}`, {});
34767
34769
  }
@@ -34772,7 +34774,7 @@ var init_StatCard2 = __esm({
34772
34774
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
34773
34775
  const isLoading = externalLoading ?? false;
34774
34776
  const error = externalError;
34775
- const computeMetricValue = React116__default.useCallback(
34777
+ const computeMetricValue = React115__default.useCallback(
34776
34778
  (metric, items) => {
34777
34779
  if (metric.value !== void 0) {
34778
34780
  return metric.value;
@@ -34811,7 +34813,7 @@ var init_StatCard2 = __esm({
34811
34813
  },
34812
34814
  []
34813
34815
  );
34814
- const schemaStats = React116__default.useMemo(() => {
34816
+ const schemaStats = React115__default.useMemo(() => {
34815
34817
  if (!metrics || metrics.length === 0) return null;
34816
34818
  return metrics.map((metric) => ({
34817
34819
  label: metric.label,
@@ -34819,7 +34821,7 @@ var init_StatCard2 = __esm({
34819
34821
  format: metric.format
34820
34822
  }));
34821
34823
  }, [metrics, data, computeMetricValue]);
34822
- const calculatedTrend = React116__default.useMemo(() => {
34824
+ const calculatedTrend = React115__default.useMemo(() => {
34823
34825
  if (manualTrend !== void 0) return manualTrend;
34824
34826
  if (previousValue === void 0 || currentValue === void 0)
34825
34827
  return void 0;
@@ -35803,7 +35805,7 @@ var init_Timeline = __esm({
35803
35805
  }) => {
35804
35806
  const { t } = useTranslate();
35805
35807
  const entityData = Array.isArray(entity) ? entity : [];
35806
- const items = React116__default.useMemo(() => {
35808
+ const items = React115__default.useMemo(() => {
35807
35809
  if (propItems) return propItems;
35808
35810
  if (entityData.length === 0) return [];
35809
35811
  return entityData.map((record, idx) => {
@@ -35910,7 +35912,7 @@ var init_Timeline = __esm({
35910
35912
  }
35911
35913
  });
35912
35914
  function extractToastProps(children) {
35913
- if (!React116__default.isValidElement(children)) {
35915
+ if (!React115__default.isValidElement(children)) {
35914
35916
  if (typeof children === "string") {
35915
35917
  return { message: children };
35916
35918
  }
@@ -35948,7 +35950,7 @@ var init_ToastSlot = __esm({
35948
35950
  eventBus.emit("UI:CLOSE");
35949
35951
  };
35950
35952
  if (!isVisible) return null;
35951
- const isCustomContent = React116__default.isValidElement(children) && !message;
35953
+ const isCustomContent = React115__default.isValidElement(children) && !message;
35952
35954
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
35953
35955
  Toast,
35954
35956
  {
@@ -36217,7 +36219,7 @@ var init_WizardContainer = __esm({
36217
36219
  const isCompleted = index < currentStep;
36218
36220
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36219
36221
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36220
- return /* @__PURE__ */ jsxs(React116__default.Fragment, { children: [
36222
+ return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
36221
36223
  /* @__PURE__ */ jsx(
36222
36224
  Button,
36223
36225
  {
@@ -36599,12 +36601,12 @@ var init_WorldMapTemplate = __esm({
36599
36601
  }
36600
36602
  });
36601
36603
  function lazyThree(name, loader) {
36602
- const Lazy = React116__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36604
+ const Lazy = React115__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36603
36605
  function ThreeWrapper(props) {
36604
- return React116__default.createElement(
36605
- React116__default.Suspense,
36606
+ return React115__default.createElement(
36607
+ React115__default.Suspense,
36606
36608
  { fallback: null },
36607
- React116__default.createElement(Lazy, props)
36609
+ React115__default.createElement(Lazy, props)
36608
36610
  );
36609
36611
  }
36610
36612
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -37092,7 +37094,7 @@ function SuspenseConfigProvider({
37092
37094
  config,
37093
37095
  children
37094
37096
  }) {
37095
- return React116__default.createElement(
37097
+ return React115__default.createElement(
37096
37098
  SuspenseConfigContext.Provider,
37097
37099
  { value: config },
37098
37100
  children
@@ -37534,7 +37536,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37534
37536
  const key = `${parentId}-${index}-trait:${traitName}`;
37535
37537
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
37536
37538
  }
37537
- return /* @__PURE__ */ jsx(React116__default.Fragment, { children: child }, `${parentId}-${index}`);
37539
+ return /* @__PURE__ */ jsx(React115__default.Fragment, { children: child }, `${parentId}-${index}`);
37538
37540
  }
37539
37541
  if (!child || typeof child !== "object") return null;
37540
37542
  const childId = `${parentId}-${index}`;
@@ -37784,18 +37786,12 @@ init_useEventBus();
37784
37786
 
37785
37787
  // hooks/useUIEvents.ts
37786
37788
  init_useEventBus();
37787
- createContext(null);
37788
37789
 
37789
37790
  // hooks/index.ts
37790
37791
  init_useQuerySingleton();
37791
37792
 
37792
- // lib/api-client.ts
37793
- typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_API_URL : "/api";
37794
-
37795
37793
  // hooks/index.ts
37796
37794
  init_useTranslate();
37797
-
37798
- // hooks/index.ts
37799
37795
  init_useAuthContext();
37800
37796
  init_useSwipeGesture();
37801
37797
  init_useLongPress();
@@ -38479,33 +38475,66 @@ function useTrait(traitName) {
38479
38475
  const context = useTraitContext();
38480
38476
  return context.getTrait(traitName);
38481
38477
  }
38478
+ var DEFAULT_SOURCE_KEY = "__default__";
38479
+ function slotEntriesInOrder(slot) {
38480
+ if (!slot) return [];
38481
+ const out = [];
38482
+ for (const [sourceKey, entry] of Object.entries(slot)) {
38483
+ if (entry.patterns.length > 0) {
38484
+ out.push({ sourceKey, entry });
38485
+ }
38486
+ }
38487
+ return out;
38488
+ }
38482
38489
  var SlotsStateContext = createContext({});
38483
38490
  var SlotsActionsContext = createContext(null);
38484
38491
  function SlotsProvider({ children }) {
38485
38492
  const [slots, setSlots] = useState({});
38486
38493
  const setSlotPatterns = useCallback((slot, patterns, source) => {
38487
- setSlots((prev) => ({
38488
- ...prev,
38489
- [slot]: { patterns, source }
38490
- }));
38494
+ const sourceKey = source?.trait ?? DEFAULT_SOURCE_KEY;
38495
+ setSlots((prev) => {
38496
+ const prevSlot = prev[slot] ?? {};
38497
+ return {
38498
+ ...prev,
38499
+ [slot]: {
38500
+ ...prevSlot,
38501
+ [sourceKey]: { patterns, source }
38502
+ }
38503
+ };
38504
+ });
38491
38505
  }, []);
38492
38506
  const clearSlot = useCallback((slot) => {
38493
38507
  setSlots((prev) => {
38494
38508
  const existing = prev[slot];
38495
- if (existing && existing.patterns.length === 0 && !existing.source) {
38509
+ if (existing && Object.keys(existing).length === 0) {
38496
38510
  return prev;
38497
38511
  }
38498
- return { ...prev, [slot]: { patterns: [] } };
38512
+ return { ...prev, [slot]: {} };
38513
+ });
38514
+ }, []);
38515
+ const clearSlotForSource = useCallback((slot, sourceTrait) => {
38516
+ setSlots((prev) => {
38517
+ const existing = prev[slot];
38518
+ if (!existing || !(sourceTrait in existing)) return prev;
38519
+ const next = { ...existing };
38520
+ delete next[sourceTrait];
38521
+ return { ...prev, [slot]: next };
38499
38522
  });
38500
38523
  }, []);
38501
38524
  const clearAllSlots = useCallback(() => {
38502
38525
  setSlots({});
38503
38526
  }, []);
38504
- const actionsRef = useRef({ setSlotPatterns, clearSlot, clearAllSlots });
38505
- actionsRef.current = { setSlotPatterns, clearSlot, clearAllSlots };
38527
+ const actionsRef = useRef({
38528
+ setSlotPatterns,
38529
+ clearSlot,
38530
+ clearSlotForSource,
38531
+ clearAllSlots
38532
+ });
38533
+ actionsRef.current = { setSlotPatterns, clearSlot, clearSlotForSource, clearAllSlots };
38506
38534
  const [stableActions] = useState(() => ({
38507
38535
  setSlotPatterns: (...args) => actionsRef.current.setSlotPatterns(...args),
38508
38536
  clearSlot: (...args) => actionsRef.current.clearSlot(...args),
38537
+ clearSlotForSource: (...args) => actionsRef.current.clearSlotForSource(...args),
38509
38538
  clearAllSlots: () => actionsRef.current.clearAllSlots()
38510
38539
  }));
38511
38540
  return /* @__PURE__ */ jsx(SlotsActionsContext.Provider, { value: stableActions, children: /* @__PURE__ */ jsx(SlotsStateContext.Provider, { value: slots, children }) });
@@ -38749,34 +38778,60 @@ function SlotBridge() {
38749
38778
  const { render, clear } = useUISlots();
38750
38779
  useEffect(() => {
38751
38780
  for (const [slotName, slotState] of Object.entries(slots)) {
38752
- if (slotState.patterns.length === 0) {
38781
+ const entries = slotEntriesInOrder(slotState);
38782
+ if (entries.length === 0) {
38753
38783
  clear(slotName);
38754
38784
  continue;
38755
38785
  }
38756
- const entry = slotState.patterns[slotState.patterns.length - 1];
38757
- const patternRecord = entry.pattern;
38758
- const { type: patternType, children, ...inlineProps } = patternRecord;
38759
- const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
38760
- render({
38761
- target: slotName,
38762
- pattern: patternType,
38763
- props: {
38786
+ const children = entries.map(({ entry }) => entry.patterns[entry.patterns.length - 1]).filter((p2) => Boolean(p2)).map((entry) => {
38787
+ const record = entry.pattern;
38788
+ const { type: patternType, children: nested, ...inlineProps } = record;
38789
+ const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
38790
+ return {
38791
+ type: patternType,
38764
38792
  ...inlineProps,
38765
38793
  ...entry.props,
38766
- ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
38767
- },
38768
- sourceTrait: slotState.source?.trait
38794
+ ...normalizedNested !== void 0 ? { children: normalizedNested } : {}
38795
+ };
38769
38796
  });
38797
+ if (children.length === 1) {
38798
+ const only = children[0];
38799
+ const { type, children: nested, ...rest } = only;
38800
+ const lastEntry = entries[entries.length - 1];
38801
+ render({
38802
+ target: slotName,
38803
+ pattern: type,
38804
+ props: {
38805
+ ...rest,
38806
+ ...nested !== void 0 ? { children: nested } : {}
38807
+ },
38808
+ sourceTrait: lastEntry.entry.source?.trait
38809
+ });
38810
+ } else {
38811
+ const lastEntry = entries[entries.length - 1];
38812
+ render({
38813
+ target: slotName,
38814
+ pattern: "stack",
38815
+ props: {
38816
+ direction: "vertical",
38817
+ gap: "lg",
38818
+ children
38819
+ },
38820
+ sourceTrait: lastEntry.entry.source?.trait
38821
+ });
38822
+ }
38770
38823
  }
38771
38824
  }, [slots, render, clear]);
38772
38825
  return null;
38773
38826
  }
38774
38827
  function applyServerEffects(effects, uiSlots, onNavigate) {
38828
+ const perSlotRenders = /* @__PURE__ */ new Map();
38775
38829
  for (const eff of effects) {
38776
38830
  if (eff.type === "render-ui" && eff.slot && eff.pattern) {
38777
38831
  const patternRecord = eff.pattern;
38778
38832
  const { type: patternType, children, ...inlineProps } = patternRecord;
38779
38833
  const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
38834
+ const sourceTrait = eff.traitName ?? "server";
38780
38835
  uiSlots.render({
38781
38836
  target: eff.slot,
38782
38837
  pattern: patternType,
@@ -38784,12 +38839,38 @@ function applyServerEffects(effects, uiSlots, onNavigate) {
38784
38839
  ...inlineProps,
38785
38840
  ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
38786
38841
  },
38787
- sourceTrait: eff.traitName ?? "server"
38842
+ sourceTrait
38843
+ });
38844
+ const bucket = perSlotRenders.get(eff.slot) ?? [];
38845
+ bucket.push({
38846
+ sourceTrait,
38847
+ pattern: {
38848
+ type: patternType,
38849
+ ...inlineProps,
38850
+ ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
38851
+ }
38788
38852
  });
38853
+ perSlotRenders.set(eff.slot, bucket);
38789
38854
  } else if (eff.type === "navigate" && eff.route && onNavigate) {
38790
38855
  onNavigate(eff.route, eff.params);
38791
38856
  }
38792
38857
  }
38858
+ for (const [slot, bucket] of perSlotRenders) {
38859
+ const distinctSources = new Set(bucket.map((b) => b.sourceTrait));
38860
+ if (distinctSources.size <= 1) continue;
38861
+ uiSlots.render({
38862
+ target: slot,
38863
+ pattern: "stack",
38864
+ props: {
38865
+ direction: "vertical",
38866
+ gap: "lg",
38867
+ children: bucket.map((b) => b.pattern)
38868
+ },
38869
+ // Use a synthetic wrapper source trait; individual traits' frames
38870
+ // already live in the per-trait index from the per-effect loop.
38871
+ sourceTrait: "__multi_source_stack__"
38872
+ });
38873
+ }
38793
38874
  }
38794
38875
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback, persistence }) {
38795
38876
  const slotsActions = useSlotsActions();