@almadar/ui 5.132.0 → 5.134.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import * as React82 from 'react';
2
- import React82__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React83 from 'react';
2
+ import React83__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useSyncExternalStore, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScopeChain, useEntitySchemaOptional, useEntitySchema, getAllPages, matchPathAmong, OrbitalProvider, TraitScopeProvider, ServerBridgeProvider, useCurrentPagePath, useGameAudioContextOptional, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge } from '@almadar/ui/providers';
4
4
  export { EntitySchemaProvider, ServerBridgeProvider, TraitContext, TraitProvider, useEntitySchema, useEntitySchemaOptional, useServerBridge, useTrait, useTraitContext } from '@almadar/ui/providers';
5
5
  import { createLogger, setNamespaceLevel, isLogLevelEnabled } from '@almadar/logger';
@@ -928,7 +928,7 @@ var init_Box = __esm({
928
928
  fixed: "fixed",
929
929
  sticky: "sticky"
930
930
  };
931
- Box = React82__default.forwardRef(
931
+ Box = React83__default.forwardRef(
932
932
  ({
933
933
  padding,
934
934
  paddingX,
@@ -993,7 +993,7 @@ var init_Box = __esm({
993
993
  onPointerDown?.(e);
994
994
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
995
995
  const isClickable = action || onClick;
996
- return React82__default.createElement(
996
+ return React83__default.createElement(
997
997
  Component,
998
998
  {
999
999
  ref,
@@ -1210,7 +1210,7 @@ var init_Icon = __esm({
1210
1210
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
1211
1211
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
1212
1212
  const family = useIconFamily();
1213
- const RenderedComponent = React82__default.useMemo(() => {
1213
+ const RenderedComponent = React83__default.useMemo(() => {
1214
1214
  if (directIcon) return null;
1215
1215
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
1216
1216
  }, [directIcon, effectiveName, family]);
@@ -1330,7 +1330,7 @@ var init_atlasSlice = __esm({
1330
1330
  }
1331
1331
  });
1332
1332
  function useAtlasSliceDataUrl(asset) {
1333
- const [, bump] = React82.useReducer((x) => x + 1, 0);
1333
+ const [, bump] = React83.useReducer((x) => x + 1, 0);
1334
1334
  if (!isAtlasAsset(asset)) return void 0;
1335
1335
  const key = `${asset.atlas}#${asset.sprite}`;
1336
1336
  const cached = sliceDataUrlCache.get(key);
@@ -1393,13 +1393,13 @@ function AtlasImage({
1393
1393
  style,
1394
1394
  "aria-hidden": ariaHidden
1395
1395
  }) {
1396
- const [, bump] = React82.useReducer((x) => x + 1, 0);
1397
- const canvasRef = React82.useRef(null);
1396
+ const [, bump] = React83.useReducer((x) => x + 1, 0);
1397
+ const canvasRef = React83.useRef(null);
1398
1398
  const sliced = isAtlasAsset(asset);
1399
1399
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
1400
1400
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
1401
1401
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
1402
- React82.useEffect(() => {
1402
+ React83.useEffect(() => {
1403
1403
  const canvas = canvasRef.current;
1404
1404
  if (!canvas || !img || !rect) return;
1405
1405
  canvas.width = rect.sw;
@@ -1475,7 +1475,7 @@ function resolveIconProp(value, sizeClass) {
1475
1475
  const IconComp = value;
1476
1476
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1477
1477
  }
1478
- if (React82__default.isValidElement(value)) {
1478
+ if (React83__default.isValidElement(value)) {
1479
1479
  return value;
1480
1480
  }
1481
1481
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -1552,7 +1552,7 @@ var init_Button = __esm({
1552
1552
  md: "h-icon-default w-icon-default",
1553
1553
  lg: "h-icon-default w-icon-default"
1554
1554
  };
1555
- Button = React82__default.forwardRef(
1555
+ Button = React83__default.forwardRef(
1556
1556
  ({
1557
1557
  className,
1558
1558
  variant = "primary",
@@ -1622,7 +1622,7 @@ var Dialog;
1622
1622
  var init_Dialog = __esm({
1623
1623
  "components/core/atoms/Dialog.tsx"() {
1624
1624
  init_cn();
1625
- Dialog = React82__default.forwardRef(
1625
+ Dialog = React83__default.forwardRef(
1626
1626
  ({
1627
1627
  role = "dialog",
1628
1628
  "aria-modal": ariaModal = true,
@@ -1645,6 +1645,61 @@ var init_Dialog = __esm({
1645
1645
  }
1646
1646
  });
1647
1647
 
1648
+ // lib/format.ts
1649
+ function humanizeFieldName(name) {
1650
+ return name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()).replace(/\b([A-Z])([A-Z]+)\b/g, (_, first, rest) => first + rest.toLowerCase()).trim();
1651
+ }
1652
+ function humanizeEnumValue(value) {
1653
+ return /^[a-z0-9]+(?:[_-][a-z0-9]+)+$/.test(value) ? humanizeFieldName(value) : value;
1654
+ }
1655
+ function formatDate(value) {
1656
+ if (!value) return "";
1657
+ const d = new Date(String(value));
1658
+ if (isNaN(d.getTime())) return String(value);
1659
+ return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
1660
+ }
1661
+ function formatTime(value) {
1662
+ if (!value) return "";
1663
+ const d = new Date(String(value));
1664
+ if (isNaN(d.getTime())) return String(value);
1665
+ return d.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
1666
+ }
1667
+ function formatDateTime(value) {
1668
+ if (!value) return "";
1669
+ const d = new Date(String(value));
1670
+ if (isNaN(d.getTime())) return String(value);
1671
+ return `${formatDate(value)} ${formatTime(value)}`;
1672
+ }
1673
+ function asYesNo(value) {
1674
+ return value === false || value === 0 || String(value) === "false" ? "No" : "Yes";
1675
+ }
1676
+ function formatValue(value, format) {
1677
+ if (value === void 0 || value === null) return "";
1678
+ if (typeof value === "boolean") return asYesNo(value);
1679
+ switch (format) {
1680
+ case "date":
1681
+ return formatDate(value);
1682
+ case "time":
1683
+ return formatTime(value);
1684
+ case "datetime":
1685
+ return formatDateTime(value);
1686
+ case "currency":
1687
+ return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
1688
+ case "number":
1689
+ return typeof value === "number" ? value.toLocaleString() : String(value);
1690
+ case "percent":
1691
+ return typeof value === "number" ? `${Math.round(value)}%` : String(value);
1692
+ case "boolean":
1693
+ return asYesNo(value);
1694
+ default:
1695
+ return String(value);
1696
+ }
1697
+ }
1698
+ var init_format = __esm({
1699
+ "lib/format.ts"() {
1700
+ }
1701
+ });
1702
+
1648
1703
  // components/core/atoms/Typography.tsx
1649
1704
  var Typography_exports = {};
1650
1705
  __export(Typography_exports, {
@@ -1654,6 +1709,7 @@ var variantStyles2, colorStyles, weightStyles, defaultElements, typographySizeSt
1654
1709
  var init_Typography = __esm({
1655
1710
  "components/core/atoms/Typography.tsx"() {
1656
1711
  init_cn();
1712
+ init_format();
1657
1713
  variantStyles2 = {
1658
1714
  h1: "text-4xl font-bold tracking-tight text-foreground",
1659
1715
  h2: "text-3xl font-bold tracking-tight text-foreground",
@@ -1741,12 +1797,17 @@ var init_Typography = __esm({
1741
1797
  id,
1742
1798
  className,
1743
1799
  style,
1800
+ format,
1744
1801
  content,
1745
1802
  children
1746
1803
  }) => {
1747
1804
  const variant = variantProp ?? (level ? `h${level}` : "body1");
1748
1805
  const Component = as || defaultElements[variant];
1749
- return React82__default.createElement(
1806
+ let body = children ?? content;
1807
+ if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
1808
+ body = formatValue(body, format);
1809
+ }
1810
+ return React83__default.createElement(
1750
1811
  Component,
1751
1812
  {
1752
1813
  id,
@@ -1762,7 +1823,7 @@ var init_Typography = __esm({
1762
1823
  ),
1763
1824
  style
1764
1825
  },
1765
- children ?? content
1826
+ body
1766
1827
  );
1767
1828
  };
1768
1829
  Typography.displayName = "Typography";
@@ -2309,7 +2370,7 @@ var init_Badge = __esm({
2309
2370
  md: "px-2.5 py-1 text-sm",
2310
2371
  lg: "px-3 py-1.5 text-base"
2311
2372
  };
2312
- Badge = React82__default.forwardRef(
2373
+ Badge = React83__default.forwardRef(
2313
2374
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
2314
2375
  const iconSizes3 = {
2315
2376
  sm: "h-icon-default w-icon-default",
@@ -2659,7 +2720,7 @@ var init_SvgFlow = __esm({
2659
2720
  width = 100,
2660
2721
  height = 100
2661
2722
  }) => {
2662
- const markerId = React82__default.useMemo(() => {
2723
+ const markerId = React83__default.useMemo(() => {
2663
2724
  flowIdCounter += 1;
2664
2725
  return `almadar-flow-arrow-${flowIdCounter}`;
2665
2726
  }, []);
@@ -3252,7 +3313,7 @@ var init_SvgRing = __esm({
3252
3313
  width = 100,
3253
3314
  height = 100
3254
3315
  }) => {
3255
- const gradientId = React82__default.useMemo(() => {
3316
+ const gradientId = React83__default.useMemo(() => {
3256
3317
  ringIdCounter += 1;
3257
3318
  return `almadar-ring-glow-${ringIdCounter}`;
3258
3319
  }, []);
@@ -3433,7 +3494,7 @@ var init_Input = __esm({
3433
3494
  init_cn();
3434
3495
  init_Icon();
3435
3496
  init_useEventBus();
3436
- Input = React82__default.forwardRef(
3497
+ Input = React83__default.forwardRef(
3437
3498
  ({
3438
3499
  className,
3439
3500
  inputType,
@@ -3601,7 +3662,7 @@ var Label;
3601
3662
  var init_Label = __esm({
3602
3663
  "components/core/atoms/Label.tsx"() {
3603
3664
  init_cn();
3604
- Label = React82__default.forwardRef(
3665
+ Label = React83__default.forwardRef(
3605
3666
  ({ className, required, children, ...props }, ref) => {
3606
3667
  return /* @__PURE__ */ jsxs(
3607
3668
  "label",
@@ -3628,7 +3689,7 @@ var init_Textarea = __esm({
3628
3689
  "components/core/atoms/Textarea.tsx"() {
3629
3690
  init_cn();
3630
3691
  init_useEventBus();
3631
- Textarea = React82__default.forwardRef(
3692
+ Textarea = React83__default.forwardRef(
3632
3693
  ({ className, error, onChange, ...props }, ref) => {
3633
3694
  const eventBus = useEventBus();
3634
3695
  const handleChange = (e) => {
@@ -3867,7 +3928,7 @@ var init_Select = __esm({
3867
3928
  init_cn();
3868
3929
  init_Icon();
3869
3930
  init_useEventBus();
3870
- Select = React82__default.forwardRef(
3931
+ Select = React83__default.forwardRef(
3871
3932
  (props, _ref) => {
3872
3933
  const { multiple, searchable, clearable } = props;
3873
3934
  if (multiple || searchable || clearable) {
@@ -3884,7 +3945,7 @@ var init_Checkbox = __esm({
3884
3945
  "components/core/atoms/Checkbox.tsx"() {
3885
3946
  init_cn();
3886
3947
  init_useEventBus();
3887
- Checkbox = React82__default.forwardRef(
3948
+ Checkbox = React83__default.forwardRef(
3888
3949
  ({ className, label, id, onChange, ...props }, ref) => {
3889
3950
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3890
3951
  const eventBus = useEventBus();
@@ -3938,7 +3999,7 @@ var init_Spinner = __esm({
3938
3999
  md: "h-6 w-6",
3939
4000
  lg: "h-8 w-8"
3940
4001
  };
3941
- Spinner = React82__default.forwardRef(
4002
+ Spinner = React83__default.forwardRef(
3942
4003
  ({ className, size = "md", overlay, ...props }, ref) => {
3943
4004
  if (overlay) {
3944
4005
  return /* @__PURE__ */ jsx(
@@ -4028,7 +4089,7 @@ var init_Card = __esm({
4028
4089
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
4029
4090
  "tile-image-first": "p-0 overflow-hidden"
4030
4091
  };
4031
- Card = React82__default.forwardRef(
4092
+ Card = React83__default.forwardRef(
4032
4093
  ({
4033
4094
  className,
4034
4095
  variant = "bordered",
@@ -4077,9 +4138,9 @@ var init_Card = __esm({
4077
4138
  }
4078
4139
  );
4079
4140
  Card.displayName = "Card";
4080
- CardHeader = React82__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
4141
+ CardHeader = React83__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
4081
4142
  CardHeader.displayName = "CardHeader";
4082
- CardTitle = React82__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4143
+ CardTitle = React83__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4083
4144
  "h3",
4084
4145
  {
4085
4146
  ref,
@@ -4092,11 +4153,11 @@ var init_Card = __esm({
4092
4153
  }
4093
4154
  ));
4094
4155
  CardTitle.displayName = "CardTitle";
4095
- CardContent = React82__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
4156
+ CardContent = React83__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
4096
4157
  CardContent.displayName = "CardContent";
4097
4158
  CardBody = CardContent;
4098
4159
  CardBody.displayName = "CardBody";
4099
- CardFooter = React82__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4160
+ CardFooter = React83__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4100
4161
  "div",
4101
4162
  {
4102
4163
  ref,
@@ -4183,7 +4244,7 @@ var init_FilterPill = __esm({
4183
4244
  md: "w-3.5 h-3.5",
4184
4245
  lg: "w-4 h-4"
4185
4246
  };
4186
- FilterPill = React82__default.forwardRef(
4247
+ FilterPill = React83__default.forwardRef(
4187
4248
  ({
4188
4249
  className,
4189
4250
  variant = "default",
@@ -4312,8 +4373,8 @@ var init_Avatar = __esm({
4312
4373
  actionPayload
4313
4374
  }) => {
4314
4375
  const eventBus = useEventBus();
4315
- const [imgFailed, setImgFailed] = React82__default.useState(false);
4316
- React82__default.useEffect(() => {
4376
+ const [imgFailed, setImgFailed] = React83__default.useState(false);
4377
+ React83__default.useEffect(() => {
4317
4378
  setImgFailed(false);
4318
4379
  }, [src]);
4319
4380
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -4426,7 +4487,7 @@ var init_Center = __esm({
4426
4487
  as: Component = "div"
4427
4488
  }) => {
4428
4489
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
4429
- return React82__default.createElement(Component, {
4490
+ return React83__default.createElement(Component, {
4430
4491
  className: cn(
4431
4492
  inline ? "inline-flex" : "flex",
4432
4493
  horizontal && "justify-center",
@@ -4694,7 +4755,7 @@ var init_Radio = __esm({
4694
4755
  md: "w-2.5 h-2.5",
4695
4756
  lg: "w-3 h-3"
4696
4757
  };
4697
- Radio = React82__default.forwardRef(
4758
+ Radio = React83__default.forwardRef(
4698
4759
  ({
4699
4760
  label,
4700
4761
  helperText,
@@ -4711,12 +4772,12 @@ var init_Radio = __esm({
4711
4772
  onChange,
4712
4773
  ...props
4713
4774
  }, ref) => {
4714
- const reactId = React82__default.useId();
4775
+ const reactId = React83__default.useId();
4715
4776
  const baseId = id || `radio-${reactId}`;
4716
4777
  const hasError = !!error;
4717
4778
  const eventBus = useEventBus();
4718
- const [selected, setSelected] = React82__default.useState(value);
4719
- React82__default.useEffect(() => {
4779
+ const [selected, setSelected] = React83__default.useState(value);
4780
+ React83__default.useEffect(() => {
4720
4781
  if (value !== void 0) setSelected(value);
4721
4782
  }, [value]);
4722
4783
  const pick = (next, e) => {
@@ -4898,7 +4959,7 @@ var init_Switch = __esm({
4898
4959
  "components/core/atoms/Switch.tsx"() {
4899
4960
  "use client";
4900
4961
  init_cn();
4901
- Switch = React82.forwardRef(
4962
+ Switch = React83.forwardRef(
4902
4963
  ({
4903
4964
  checked,
4904
4965
  defaultChecked = false,
@@ -4909,10 +4970,10 @@ var init_Switch = __esm({
4909
4970
  name,
4910
4971
  className
4911
4972
  }, ref) => {
4912
- const [isChecked, setIsChecked] = React82.useState(
4973
+ const [isChecked, setIsChecked] = React83.useState(
4913
4974
  checked !== void 0 ? checked : defaultChecked
4914
4975
  );
4915
- React82.useEffect(() => {
4976
+ React83.useEffect(() => {
4916
4977
  if (checked !== void 0) {
4917
4978
  setIsChecked(checked);
4918
4979
  }
@@ -5075,7 +5136,7 @@ var init_Stack = __esm({
5075
5136
  };
5076
5137
  const isHorizontal = direction === "horizontal";
5077
5138
  const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
5078
- return React82__default.createElement(
5139
+ return React83__default.createElement(
5079
5140
  Component,
5080
5141
  {
5081
5142
  className: cn(
@@ -5275,7 +5336,7 @@ var Aside;
5275
5336
  var init_Aside = __esm({
5276
5337
  "components/core/atoms/Aside.tsx"() {
5277
5338
  init_cn();
5278
- Aside = React82__default.forwardRef(
5339
+ Aside = React83__default.forwardRef(
5279
5340
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
5280
5341
  );
5281
5342
  Aside.displayName = "Aside";
@@ -5354,9 +5415,9 @@ var init_LawReferenceTooltip = __esm({
5354
5415
  className
5355
5416
  }) => {
5356
5417
  const { t } = useTranslate();
5357
- const [isVisible, setIsVisible] = React82__default.useState(false);
5358
- const timeoutRef = React82__default.useRef(null);
5359
- const triggerRef = React82__default.useRef(null);
5418
+ const [isVisible, setIsVisible] = React83__default.useState(false);
5419
+ const timeoutRef = React83__default.useRef(null);
5420
+ const triggerRef = React83__default.useRef(null);
5360
5421
  const handleMouseEnter = () => {
5361
5422
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5362
5423
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -5367,7 +5428,7 @@ var init_LawReferenceTooltip = __esm({
5367
5428
  };
5368
5429
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
5369
5430
  const open = isVisible || revealed;
5370
- React82__default.useEffect(() => {
5431
+ React83__default.useEffect(() => {
5371
5432
  return () => {
5372
5433
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
5373
5434
  };
@@ -5577,7 +5638,7 @@ var init_StatusDot = __esm({
5577
5638
  md: "w-2.5 h-2.5",
5578
5639
  lg: "w-3 h-3"
5579
5640
  };
5580
- StatusDot = React82__default.forwardRef(
5641
+ StatusDot = React83__default.forwardRef(
5581
5642
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5582
5643
  return /* @__PURE__ */ jsx(
5583
5644
  "span",
@@ -5631,7 +5692,7 @@ var init_TrendIndicator = __esm({
5631
5692
  down: "trending-down",
5632
5693
  flat: "arrow-right"
5633
5694
  };
5634
- TrendIndicator = React82__default.forwardRef(
5695
+ TrendIndicator = React83__default.forwardRef(
5635
5696
  ({
5636
5697
  className,
5637
5698
  value,
@@ -5700,7 +5761,7 @@ var init_RangeSlider = __esm({
5700
5761
  md: "w-4 h-4",
5701
5762
  lg: "w-5 h-5"
5702
5763
  };
5703
- RangeSlider = React82__default.forwardRef(
5764
+ RangeSlider = React83__default.forwardRef(
5704
5765
  ({
5705
5766
  className,
5706
5767
  min = 0,
@@ -6276,7 +6337,7 @@ var init_ContentSection = __esm({
6276
6337
  md: "py-16",
6277
6338
  lg: "py-24"
6278
6339
  };
6279
- ContentSection = React82__default.forwardRef(
6340
+ ContentSection = React83__default.forwardRef(
6280
6341
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
6281
6342
  return /* @__PURE__ */ jsx(
6282
6343
  Box,
@@ -6810,7 +6871,7 @@ var init_AnimatedReveal = __esm({
6810
6871
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6811
6872
  "none": {}
6812
6873
  };
6813
- AnimatedReveal = React82__default.forwardRef(
6874
+ AnimatedReveal = React83__default.forwardRef(
6814
6875
  ({
6815
6876
  trigger = "scroll",
6816
6877
  animation = "fade-up",
@@ -6970,7 +7031,7 @@ var init_AnimatedGraphic = __esm({
6970
7031
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6971
7032
  "use client";
6972
7033
  init_cn();
6973
- AnimatedGraphic = React82__default.forwardRef(
7034
+ AnimatedGraphic = React83__default.forwardRef(
6974
7035
  ({
6975
7036
  src,
6976
7037
  svgContent,
@@ -6993,7 +7054,7 @@ var init_AnimatedGraphic = __esm({
6993
7054
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6994
7055
  const resolvedSvg = svgContent ?? fetchedSvg;
6995
7056
  const prevAnimateRef = useRef(animate);
6996
- const setRef = React82__default.useCallback(
7057
+ const setRef = React83__default.useCallback(
6997
7058
  (node) => {
6998
7059
  containerRef.current = node;
6999
7060
  if (typeof ref === "function") ref(node);
@@ -7721,9 +7782,9 @@ function ControlButton({
7721
7782
  className
7722
7783
  }) {
7723
7784
  const eventBus = useEventBus();
7724
- const [isPressed, setIsPressed] = React82.useState(false);
7785
+ const [isPressed, setIsPressed] = React83.useState(false);
7725
7786
  const actualPressed = pressed ?? isPressed;
7726
- const handlePointerDown = React82.useCallback(
7787
+ const handlePointerDown = React83.useCallback(
7727
7788
  (e) => {
7728
7789
  e.preventDefault();
7729
7790
  if (disabled) return;
@@ -7733,7 +7794,7 @@ function ControlButton({
7733
7794
  },
7734
7795
  [disabled, pressEvent, eventBus, onPress]
7735
7796
  );
7736
- const handlePointerUp = React82.useCallback(
7797
+ const handlePointerUp = React83.useCallback(
7737
7798
  (e) => {
7738
7799
  e.preventDefault();
7739
7800
  if (disabled) return;
@@ -7743,7 +7804,7 @@ function ControlButton({
7743
7804
  },
7744
7805
  [disabled, releaseEvent, eventBus, onRelease]
7745
7806
  );
7746
- const handlePointerLeave = React82.useCallback(
7807
+ const handlePointerLeave = React83.useCallback(
7747
7808
  (e) => {
7748
7809
  if (isPressed) {
7749
7810
  setIsPressed(false);
@@ -7814,7 +7875,7 @@ var init_ControlButton = __esm({
7814
7875
  ControlButton.displayName = "ControlButton";
7815
7876
  }
7816
7877
  });
7817
- function formatTime(seconds, format) {
7878
+ function formatTime2(seconds, format) {
7818
7879
  const clamped = Math.max(0, Math.floor(seconds));
7819
7880
  if (format === "ss") {
7820
7881
  return `${clamped}s`;
@@ -7851,7 +7912,7 @@ function TimerDisplay({
7851
7912
  ),
7852
7913
  children: [
7853
7914
  iconAsset && /* @__PURE__ */ jsx(GameIcon, { assetUrl: iconAsset, icon: "image", size: 16, className: "w-4 h-4 object-contain flex-shrink-0" }),
7854
- formatTime(seconds, format)
7915
+ formatTime2(seconds, format)
7855
7916
  ]
7856
7917
  }
7857
7918
  );
@@ -7984,6 +8045,210 @@ var init_ChoiceButton = __esm({
7984
8045
  ChoiceButton.displayName = "ChoiceButton";
7985
8046
  }
7986
8047
  });
8048
+ function SvgStage({
8049
+ cols,
8050
+ rows,
8051
+ tileSize = 32,
8052
+ background = "var(--color-background)",
8053
+ tileClickEvent,
8054
+ tileHoverEvent,
8055
+ tileLeaveEvent,
8056
+ keyMap,
8057
+ keyUpMap,
8058
+ className,
8059
+ children
8060
+ }) {
8061
+ const eventBus = useEventBus();
8062
+ const svgRef = useRef(null);
8063
+ const pointerDownRef = useRef(null);
8064
+ const cellFromClient = useCallback((clientX, clientY) => {
8065
+ const svg = svgRef.current;
8066
+ if (!svg) return null;
8067
+ const rect = svg.getBoundingClientRect();
8068
+ if (rect.width === 0 || rect.height === 0) return null;
8069
+ const vbW = cols * tileSize;
8070
+ const vbH = rows * tileSize;
8071
+ const meet = Math.min(rect.width / vbW, rect.height / vbH);
8072
+ const offsetX = (rect.width - vbW * meet) / 2;
8073
+ const offsetY = (rect.height - vbH * meet) / 2;
8074
+ const svgX = (clientX - rect.left - offsetX) / meet;
8075
+ const svgY = (clientY - rect.top - offsetY) / meet;
8076
+ return {
8077
+ x: Math.min(Math.max(Math.floor(svgX / tileSize), 0), cols - 1),
8078
+ y: Math.min(Math.max(Math.floor(svgY / tileSize), 0), rows - 1)
8079
+ };
8080
+ }, [cols, rows, tileSize]);
8081
+ const handlePointerDown = useCallback((e) => {
8082
+ pointerDownRef.current = { clientX: e.clientX, clientY: e.clientY };
8083
+ }, []);
8084
+ const handlePointerUp = useCallback((e) => {
8085
+ const down = pointerDownRef.current;
8086
+ pointerDownRef.current = null;
8087
+ if (!tileClickEvent) return;
8088
+ if (down && Math.hypot(e.clientX - down.clientX, e.clientY - down.clientY) > 5) return;
8089
+ const cell = cellFromClient(e.clientX, e.clientY);
8090
+ if (cell) eventBus.emit(`UI:${tileClickEvent}`, cell);
8091
+ }, [cellFromClient, tileClickEvent, eventBus]);
8092
+ const handlePointerMove = useCallback((e) => {
8093
+ if (!tileHoverEvent) return;
8094
+ const cell = cellFromClient(e.clientX, e.clientY);
8095
+ if (cell) eventBus.emit(`UI:${tileHoverEvent}`, cell);
8096
+ }, [cellFromClient, tileHoverEvent, eventBus]);
8097
+ const handlePointerLeave = useCallback(() => {
8098
+ pointerDownRef.current = null;
8099
+ if (tileLeaveEvent) eventBus.emit(`UI:${tileLeaveEvent}`, {});
8100
+ }, [tileLeaveEvent, eventBus]);
8101
+ useEffect(() => {
8102
+ if (!keyMap && !keyUpMap) return;
8103
+ const onDown = (e) => {
8104
+ const ev = keyMap?.[e.code];
8105
+ if (ev) {
8106
+ eventBus.emit(`UI:${ev}`, {});
8107
+ e.preventDefault();
8108
+ }
8109
+ };
8110
+ const onUp = (e) => {
8111
+ const ev = keyUpMap?.[e.code];
8112
+ if (ev) eventBus.emit(`UI:${ev}`, {});
8113
+ };
8114
+ window.addEventListener("keydown", onDown);
8115
+ window.addEventListener("keyup", onUp);
8116
+ return () => {
8117
+ window.removeEventListener("keydown", onDown);
8118
+ window.removeEventListener("keyup", onUp);
8119
+ };
8120
+ }, [keyMap, keyUpMap, eventBus]);
8121
+ useEffect(() => {
8122
+ if (!keyMap && !keyUpMap) return;
8123
+ svgRef.current?.focus();
8124
+ }, [keyMap, keyUpMap]);
8125
+ const stageContext = useMemo(() => ({ tileSize }), [tileSize]);
8126
+ return /* @__PURE__ */ jsxs(
8127
+ "svg",
8128
+ {
8129
+ ref: svgRef,
8130
+ "data-testid": "svg-stage",
8131
+ viewBox: `0 0 ${cols * tileSize} ${rows * tileSize}`,
8132
+ preserveAspectRatio: "xMidYMid meet",
8133
+ className: cn("block h-full w-full", className),
8134
+ tabIndex: keyMap || keyUpMap ? 0 : void 0,
8135
+ onPointerDown: handlePointerDown,
8136
+ onPointerMove: handlePointerMove,
8137
+ onPointerUp: handlePointerUp,
8138
+ onPointerLeave: handlePointerLeave,
8139
+ children: [
8140
+ /* @__PURE__ */ jsx("rect", { width: cols * tileSize, height: rows * tileSize, fill: background }),
8141
+ /* @__PURE__ */ jsx(SvgStageContext.Provider, { value: stageContext, children })
8142
+ ]
8143
+ }
8144
+ );
8145
+ }
8146
+ var SvgStageContext;
8147
+ var init_SvgStage = __esm({
8148
+ "components/game/molecules/SvgStage.tsx"() {
8149
+ "use client";
8150
+ init_cn();
8151
+ init_useEventBus();
8152
+ SvgStageContext = React83.createContext({ tileSize: 1 });
8153
+ SvgStage.displayName = "SvgStage";
8154
+ }
8155
+ });
8156
+ function SvgDrawShape({
8157
+ shape,
8158
+ x,
8159
+ y,
8160
+ width,
8161
+ height,
8162
+ radius,
8163
+ radiusY,
8164
+ points,
8165
+ d,
8166
+ x2,
8167
+ y2,
8168
+ fill,
8169
+ stroke,
8170
+ strokeWidth,
8171
+ opacity,
8172
+ className
8173
+ }) {
8174
+ const { tileSize } = useContext(SvgStageContext);
8175
+ const cell = (v) => v === void 0 ? void 0 : v * tileSize;
8176
+ const paint = {
8177
+ fill: fill ?? (stroke === void 0 ? "var(--color-primary)" : "none"),
8178
+ stroke,
8179
+ strokeWidth,
8180
+ opacity,
8181
+ className
8182
+ };
8183
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${x * tileSize} ${y * tileSize})`, children: [
8184
+ shape === "rect" && /* @__PURE__ */ jsx("rect", { width: cell(width), height: cell(height), ...paint }),
8185
+ shape === "circle" && /* @__PURE__ */ jsx("circle", { r: cell(radius), ...paint }),
8186
+ shape === "ellipse" && /* @__PURE__ */ jsx("ellipse", { rx: cell(radius), ry: cell(radiusY ?? radius), ...paint }),
8187
+ shape === "polygon" && /* @__PURE__ */ jsx("polygon", { points, ...paint }),
8188
+ shape === "polyline" && /* @__PURE__ */ jsx("polyline", { points, ...paint }),
8189
+ shape === "path" && /* @__PURE__ */ jsx("path", { d, ...paint }),
8190
+ shape === "line" && /* @__PURE__ */ jsx("line", { x2: cell(x2), y2: cell(y2), ...paint })
8191
+ ] });
8192
+ }
8193
+ var init_SvgDrawShape = __esm({
8194
+ "components/game/atoms/SvgDrawShape.tsx"() {
8195
+ "use client";
8196
+ init_SvgStage();
8197
+ SvgDrawShape.displayName = "SvgDrawShape";
8198
+ }
8199
+ });
8200
+ function SvgDrawGroup({
8201
+ x = 0,
8202
+ y = 0,
8203
+ scale,
8204
+ rotate,
8205
+ opacity,
8206
+ className,
8207
+ children
8208
+ }) {
8209
+ const { tileSize } = useContext(SvgStageContext);
8210
+ const transforms = [`translate(${x * tileSize} ${y * tileSize})`];
8211
+ if (rotate !== void 0) transforms.push(`rotate(${rotate})`);
8212
+ if (scale !== void 0) transforms.push(`scale(${scale})`);
8213
+ return /* @__PURE__ */ jsx("g", { transform: transforms.join(" "), opacity, className, children });
8214
+ }
8215
+ var init_SvgDrawGroup = __esm({
8216
+ "components/game/atoms/SvgDrawGroup.tsx"() {
8217
+ "use client";
8218
+ init_SvgStage();
8219
+ SvgDrawGroup.displayName = "SvgDrawGroup";
8220
+ }
8221
+ });
8222
+ function SvgDrawText({
8223
+ x,
8224
+ y,
8225
+ text,
8226
+ size = 12,
8227
+ fill = "var(--color-foreground)",
8228
+ anchor = "middle",
8229
+ className
8230
+ }) {
8231
+ const { tileSize } = useContext(SvgStageContext);
8232
+ return /* @__PURE__ */ jsx(
8233
+ "text",
8234
+ {
8235
+ x: x * tileSize,
8236
+ y: y * tileSize,
8237
+ fontSize: size,
8238
+ fill,
8239
+ textAnchor: anchor,
8240
+ className,
8241
+ children: text
8242
+ }
8243
+ );
8244
+ }
8245
+ var init_SvgDrawText = __esm({
8246
+ "components/game/atoms/SvgDrawText.tsx"() {
8247
+ "use client";
8248
+ init_SvgStage();
8249
+ SvgDrawText.displayName = "SvgDrawText";
8250
+ }
8251
+ });
7987
8252
  function ControlGrid({
7988
8253
  kind,
7989
8254
  buttons = DEFAULT_BUTTONS,
@@ -8001,8 +8266,8 @@ function ControlGrid({
8001
8266
  className
8002
8267
  }) {
8003
8268
  const eventBus = useEventBus();
8004
- const [active, setActive] = React82.useState(/* @__PURE__ */ new Set());
8005
- const handlePress = React82.useCallback(
8269
+ const [active, setActive] = React83.useState(/* @__PURE__ */ new Set());
8270
+ const handlePress = React83.useCallback(
8006
8271
  (id) => {
8007
8272
  setActive((prev) => new Set(prev).add(id));
8008
8273
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8016,7 +8281,7 @@ function ControlGrid({
8016
8281
  },
8017
8282
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
8018
8283
  );
8019
- const handleRelease = React82.useCallback(
8284
+ const handleRelease = React83.useCallback(
8020
8285
  (id) => {
8021
8286
  setActive((prev) => {
8022
8287
  const next = new Set(prev);
@@ -8374,7 +8639,7 @@ function GameMenu({
8374
8639
  }) {
8375
8640
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
8376
8641
  const eventBus = useEventBus();
8377
- const handleOptionClick = React82.useCallback(
8642
+ const handleOptionClick = React83.useCallback(
8378
8643
  (option) => {
8379
8644
  if (option.event) {
8380
8645
  eventBus.emit(`UI:${option.event}`, { option });
@@ -8610,7 +8875,7 @@ function StateGraph({
8610
8875
  }) {
8611
8876
  const eventBus = useEventBus();
8612
8877
  const nodes = states ?? [];
8613
- const positions = React82.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8878
+ const positions = React83.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8614
8879
  return /* @__PURE__ */ jsxs(
8615
8880
  Box,
8616
8881
  {
@@ -8681,8 +8946,8 @@ function MiniMap({
8681
8946
  tileAssets,
8682
8947
  unitAssets
8683
8948
  }) {
8684
- const canvasRef = React82.useRef(null);
8685
- const imgCacheRef = React82.useRef(/* @__PURE__ */ new Map());
8949
+ const canvasRef = React83.useRef(null);
8950
+ const imgCacheRef = React83.useRef(/* @__PURE__ */ new Map());
8686
8951
  function loadImg(url) {
8687
8952
  const cached = imgCacheRef.current.get(url);
8688
8953
  if (cached) return cached.complete ? cached : null;
@@ -8697,7 +8962,7 @@ function MiniMap({
8697
8962
  imgCacheRef.current.set(url, img);
8698
8963
  return null;
8699
8964
  }
8700
- React82.useEffect(() => {
8965
+ React83.useEffect(() => {
8701
8966
  const canvas = canvasRef.current;
8702
8967
  if (!canvas) return;
8703
8968
  const ctx = canvas.getContext("2d");
@@ -9902,6 +10167,32 @@ var init_Canvas = __esm({
9902
10167
  Canvas.displayName = "Canvas";
9903
10168
  }
9904
10169
  });
10170
+ function SvgDrawShapeLayer({
10171
+ items,
10172
+ fill,
10173
+ stroke,
10174
+ strokeWidth,
10175
+ opacity
10176
+ }) {
10177
+ return /* @__PURE__ */ jsx("g", { children: items.map(({ id, ...shape }) => /* @__PURE__ */ jsx(
10178
+ SvgDrawShape,
10179
+ {
10180
+ ...shape,
10181
+ fill: shape.fill ?? fill,
10182
+ stroke: shape.stroke ?? stroke,
10183
+ strokeWidth: shape.strokeWidth ?? strokeWidth,
10184
+ opacity: shape.opacity ?? opacity
10185
+ },
10186
+ id
10187
+ )) });
10188
+ }
10189
+ var init_SvgDrawShapeLayer = __esm({
10190
+ "components/game/molecules/SvgDrawShapeLayer.tsx"() {
10191
+ "use client";
10192
+ init_SvgDrawShape();
10193
+ SvgDrawShapeLayer.displayName = "SvgDrawShapeLayer";
10194
+ }
10195
+ });
9905
10196
  function GameAudioToggle({
9906
10197
  size = "sm",
9907
10198
  className,
@@ -10018,7 +10309,7 @@ function LinearView({
10018
10309
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
10019
10310
  const isDone = i < currentIdx;
10020
10311
  const isCurrent = i === currentIdx;
10021
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
10312
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
10022
10313
  i > 0 && /* @__PURE__ */ jsx(
10023
10314
  Typography,
10024
10315
  {
@@ -10553,7 +10844,7 @@ function SequenceBar({
10553
10844
  else onSlotRemove?.(index);
10554
10845
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
10555
10846
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
10556
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
10847
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
10557
10848
  i > 0 && /* @__PURE__ */ jsx(
10558
10849
  Typography,
10559
10850
  {
@@ -11202,7 +11493,7 @@ var init_ErrorBoundary = __esm({
11202
11493
  }
11203
11494
  );
11204
11495
  };
11205
- ErrorBoundary = class extends React82__default.Component {
11496
+ ErrorBoundary = class extends React83__default.Component {
11206
11497
  constructor(props) {
11207
11498
  super(props);
11208
11499
  __publicField(this, "reset", () => {
@@ -11471,7 +11762,7 @@ var init_Container = __esm({
11471
11762
  as: Component = "div"
11472
11763
  }) => {
11473
11764
  const resolvedSize = maxWidth ?? size ?? "lg";
11474
- return React82__default.createElement(
11765
+ return React83__default.createElement(
11475
11766
  Component,
11476
11767
  {
11477
11768
  className: cn(
@@ -14436,7 +14727,7 @@ var init_CodeBlock = __esm({
14436
14727
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
14437
14728
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
14438
14729
  HIDDEN_LINE_NUMBERS = { display: "none" };
14439
- CodeBlock = React82__default.memo(
14730
+ CodeBlock = React83__default.memo(
14440
14731
  ({
14441
14732
  code: rawCode,
14442
14733
  language = "text",
@@ -15024,7 +15315,7 @@ var init_MarkdownContent = __esm({
15024
15315
  init_Box();
15025
15316
  init_CodeBlock();
15026
15317
  init_cn();
15027
- MarkdownContent = React82__default.memo(
15318
+ MarkdownContent = React83__default.memo(
15028
15319
  ({ content, direction = "ltr", className }) => {
15029
15320
  const { t: _t } = useTranslate();
15030
15321
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -16301,7 +16592,7 @@ var init_StateMachineView = __esm({
16301
16592
  style: { top: title ? 30 : 0 },
16302
16593
  children: [
16303
16594
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
16304
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React82__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
16595
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React83__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
16305
16596
  StateNode2,
16306
16597
  {
16307
16598
  state,
@@ -18979,9 +19270,6 @@ function normalizeFields(fields) {
18979
19270
  if (!fields) return [];
18980
19271
  return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
18981
19272
  }
18982
- function fieldLabel(key) {
18983
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
18984
- }
18985
19273
  function asBooleanValue(value) {
18986
19274
  if (typeof value === "boolean") return value;
18987
19275
  if (value === "true") return true;
@@ -18992,12 +19280,6 @@ function isDateField(key) {
18992
19280
  const lower = key.toLowerCase();
18993
19281
  return lower.includes("date") || lower.includes("time") || lower.endsWith("at") || lower.endsWith("_at");
18994
19282
  }
18995
- function formatDate(value) {
18996
- if (!value) return "";
18997
- const d = new Date(String(value));
18998
- if (isNaN(d.getTime())) return String(value);
18999
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
19000
- }
19001
19283
  function statusVariant(value) {
19002
19284
  const v = value.toLowerCase();
19003
19285
  if (["active", "completed", "done", "approved", "published", "resolved", "open"].includes(v)) return "success";
@@ -19006,11 +19288,12 @@ function statusVariant(value) {
19006
19288
  if (["new", "created", "scheduled", "queued"].includes(v)) return "info";
19007
19289
  return "default";
19008
19290
  }
19009
- var STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
19291
+ var fieldLabel, STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
19010
19292
  var init_CardGrid = __esm({
19011
19293
  "components/core/organisms/CardGrid.tsx"() {
19012
19294
  "use client";
19013
19295
  init_cn();
19296
+ init_format();
19014
19297
  init_getNestedValue();
19015
19298
  init_useEventBus();
19016
19299
  init_atoms();
@@ -19019,6 +19302,7 @@ var init_CardGrid = __esm({
19019
19302
  init_Typography();
19020
19303
  init_Stack();
19021
19304
  init_Pagination();
19305
+ fieldLabel = humanizeFieldName;
19022
19306
  STATUS_FIELDS = /* @__PURE__ */ new Set(["status", "state", "priority", "type", "category", "role", "level", "tier"]);
19023
19307
  gapStyles3 = {
19024
19308
  none: "gap-0",
@@ -19526,7 +19810,7 @@ var init_CaseStudyOrganism = __esm({
19526
19810
  CaseStudyOrganism.displayName = "CaseStudyOrganism";
19527
19811
  }
19528
19812
  });
19529
- var CHART_COLORS, seriesColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
19813
+ var CHART_COLORS, seriesColor, barColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
19530
19814
  var init_Chart = __esm({
19531
19815
  "components/core/molecules/Chart.tsx"() {
19532
19816
  "use client";
@@ -19546,6 +19830,7 @@ var init_Chart = __esm({
19546
19830
  "var(--color-accent)"
19547
19831
  ];
19548
19832
  seriesColor = (series, idx) => series.color ?? CHART_COLORS[idx % CHART_COLORS.length];
19833
+ barColor = (series, sIdx, catIdx, seriesCount) => series.color ?? CHART_COLORS[(seriesCount === 1 ? catIdx : sIdx) % CHART_COLORS.length];
19549
19834
  monthFormatter = new Intl.DateTimeFormat(void 0, {
19550
19835
  month: "short",
19551
19836
  year: "2-digit"
@@ -19618,7 +19903,7 @@ var init_Chart = __esm({
19618
19903
  children: series.map((s, sIdx) => {
19619
19904
  const value = valueAt(s, label);
19620
19905
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
19621
- const color = seriesColor(s, sIdx);
19906
+ const color = barColor(s, sIdx, catIdx, series.length);
19622
19907
  return /* @__PURE__ */ jsx(
19623
19908
  Box,
19624
19909
  {
@@ -19673,7 +19958,7 @@ var init_Chart = __esm({
19673
19958
  /* @__PURE__ */ jsx(HStack, { gap: histogram ? "none" : "xs", align: "end", justify: histogram ? void 0 : "center", className: "w-full flex-1 min-h-0", children: series.map((s, sIdx) => {
19674
19959
  const value = valueAt(s, label);
19675
19960
  const barHeight = value / maxValue * 100;
19676
- const color = seriesColor(s, sIdx);
19961
+ const color = barColor(s, sIdx, catIdx, series.length);
19677
19962
  return /* @__PURE__ */ jsx(
19678
19963
  Box,
19679
19964
  {
@@ -19724,7 +20009,7 @@ var init_Chart = __esm({
19724
20009
  /* @__PURE__ */ jsx(VStack, { gap: "none", className: "w-full flex-1 min-h-0", justify: "end", children: series.map((s, sIdx) => {
19725
20010
  const value = valueAt(s, label);
19726
20011
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
19727
- const color = seriesColor(s, sIdx);
20012
+ const color = barColor(s, sIdx, catIdx, series.length);
19728
20013
  return /* @__PURE__ */ jsx(
19729
20014
  Box,
19730
20015
  {
@@ -22048,8 +22333,8 @@ var init_Menu = __esm({
22048
22333
  "bottom-end": "bottom-start"
22049
22334
  };
22050
22335
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
22051
- const triggerChild = React82__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
22052
- const triggerElement = React82__default.cloneElement(
22336
+ const triggerChild = React83__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
22337
+ const triggerElement = React83__default.cloneElement(
22053
22338
  triggerChild,
22054
22339
  {
22055
22340
  ref: triggerRef,
@@ -22144,14 +22429,14 @@ function useDataDnd(args) {
22144
22429
  const isZone = Boolean(dragGroup || accepts || sortable);
22145
22430
  const enabled = isZone || Boolean(dndRoot);
22146
22431
  const eventBus = useEventBus();
22147
- const parentRoot = React82__default.useContext(RootCtx);
22432
+ const parentRoot = React83__default.useContext(RootCtx);
22148
22433
  const isRoot = enabled && parentRoot === null;
22149
- const zoneId = React82__default.useId();
22434
+ const zoneId = React83__default.useId();
22150
22435
  const ownGroup = dragGroup ?? accepts ?? zoneId;
22151
- const [optimisticOrders, setOptimisticOrders] = React82__default.useState(() => /* @__PURE__ */ new Map());
22152
- const optimisticOrdersRef = React82__default.useRef(optimisticOrders);
22436
+ const [optimisticOrders, setOptimisticOrders] = React83__default.useState(() => /* @__PURE__ */ new Map());
22437
+ const optimisticOrdersRef = React83__default.useRef(optimisticOrders);
22153
22438
  optimisticOrdersRef.current = optimisticOrders;
22154
- const clearOptimisticOrder = React82__default.useCallback((group) => {
22439
+ const clearOptimisticOrder = React83__default.useCallback((group) => {
22155
22440
  setOptimisticOrders((prev) => {
22156
22441
  if (!prev.has(group)) return prev;
22157
22442
  const next = new Map(prev);
@@ -22176,7 +22461,7 @@ function useDataDnd(args) {
22176
22461
  const raw = it[dndItemIdField];
22177
22462
  return raw != null ? String(raw) : `__idx_${idx}`;
22178
22463
  }).join("|");
22179
- const itemIds = React82__default.useMemo(
22464
+ const itemIds = React83__default.useMemo(
22180
22465
  () => orderedItems.map((it, idx) => {
22181
22466
  const raw = it[dndItemIdField];
22182
22467
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -22187,7 +22472,7 @@ function useDataDnd(args) {
22187
22472
  const raw = it[dndItemIdField];
22188
22473
  return raw != null ? String(raw) : `__${idx}`;
22189
22474
  }).join("|");
22190
- React82__default.useEffect(() => {
22475
+ React83__default.useEffect(() => {
22191
22476
  const root = isRoot ? null : parentRoot;
22192
22477
  if (root) {
22193
22478
  root.clearOptimisticOrder(ownGroup);
@@ -22195,20 +22480,20 @@ function useDataDnd(args) {
22195
22480
  clearOptimisticOrder(ownGroup);
22196
22481
  }
22197
22482
  }, [itemsContentSig, ownGroup]);
22198
- const zonesRef = React82__default.useRef(/* @__PURE__ */ new Map());
22199
- const registerZone = React82__default.useCallback((zoneId2, meta2) => {
22483
+ const zonesRef = React83__default.useRef(/* @__PURE__ */ new Map());
22484
+ const registerZone = React83__default.useCallback((zoneId2, meta2) => {
22200
22485
  zonesRef.current.set(zoneId2, meta2);
22201
22486
  }, []);
22202
- const unregisterZone = React82__default.useCallback((zoneId2) => {
22487
+ const unregisterZone = React83__default.useCallback((zoneId2) => {
22203
22488
  zonesRef.current.delete(zoneId2);
22204
22489
  }, []);
22205
- const [activeDrag, setActiveDrag] = React82__default.useState(null);
22206
- const [overZoneGroup, setOverZoneGroup] = React82__default.useState(null);
22207
- const meta = React82__default.useMemo(
22490
+ const [activeDrag, setActiveDrag] = React83__default.useState(null);
22491
+ const [overZoneGroup, setOverZoneGroup] = React83__default.useState(null);
22492
+ const meta = React83__default.useMemo(
22208
22493
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
22209
22494
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
22210
22495
  );
22211
- React82__default.useEffect(() => {
22496
+ React83__default.useEffect(() => {
22212
22497
  const target = isRoot ? null : parentRoot;
22213
22498
  if (!target) {
22214
22499
  zonesRef.current.set(zoneId, meta);
@@ -22227,7 +22512,7 @@ function useDataDnd(args) {
22227
22512
  }, [parentRoot, isRoot, zoneId, meta]);
22228
22513
  const sensors = useAlmadarDndSensors(true);
22229
22514
  const collisionDetection = almadarDndCollisionDetection;
22230
- const findZoneByItem = React82__default.useCallback(
22515
+ const findZoneByItem = React83__default.useCallback(
22231
22516
  (id) => {
22232
22517
  for (const z of zonesRef.current.values()) {
22233
22518
  if (z.itemIds.includes(id)) return z;
@@ -22236,7 +22521,7 @@ function useDataDnd(args) {
22236
22521
  },
22237
22522
  []
22238
22523
  );
22239
- React82__default.useCallback(
22524
+ React83__default.useCallback(
22240
22525
  (group) => {
22241
22526
  for (const z of zonesRef.current.values()) {
22242
22527
  if (z.group === group) return z;
@@ -22245,7 +22530,7 @@ function useDataDnd(args) {
22245
22530
  },
22246
22531
  []
22247
22532
  );
22248
- const handleDragEnd = React82__default.useCallback(
22533
+ const handleDragEnd = React83__default.useCallback(
22249
22534
  (event) => {
22250
22535
  const { active, over } = event;
22251
22536
  const activeIdStr = String(active.id);
@@ -22336,8 +22621,8 @@ function useDataDnd(args) {
22336
22621
  },
22337
22622
  [eventBus]
22338
22623
  );
22339
- const sortableData = React82__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22340
- const SortableItem = React82__default.useCallback(
22624
+ const sortableData = React83__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22625
+ const SortableItem = React83__default.useCallback(
22341
22626
  ({ id, children }) => {
22342
22627
  const {
22343
22628
  attributes,
@@ -22377,7 +22662,7 @@ function useDataDnd(args) {
22377
22662
  id: droppableId,
22378
22663
  data: sortableData
22379
22664
  });
22380
- const ctx = React82__default.useContext(RootCtx);
22665
+ const ctx = React83__default.useContext(RootCtx);
22381
22666
  const activeDrag2 = ctx?.activeDrag ?? null;
22382
22667
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22383
22668
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22392,7 +22677,7 @@ function useDataDnd(args) {
22392
22677
  showForeignPlaceholder,
22393
22678
  ctxAvailable: ctx != null
22394
22679
  });
22395
- React82__default.useEffect(() => {
22680
+ React83__default.useEffect(() => {
22396
22681
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22397
22682
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22398
22683
  return /* @__PURE__ */ jsx(
@@ -22406,11 +22691,11 @@ function useDataDnd(args) {
22406
22691
  }
22407
22692
  );
22408
22693
  };
22409
- const rootContextValue = React82__default.useMemo(
22694
+ const rootContextValue = React83__default.useMemo(
22410
22695
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22411
22696
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22412
22697
  );
22413
- const handleDragStart = React82__default.useCallback((event) => {
22698
+ const handleDragStart = React83__default.useCallback((event) => {
22414
22699
  const sourceZone = findZoneByItem(event.active.id);
22415
22700
  const rect = event.active.rect.current.initial;
22416
22701
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22429,7 +22714,7 @@ function useDataDnd(args) {
22429
22714
  isRoot
22430
22715
  });
22431
22716
  }, [findZoneByItem, isRoot, zoneId]);
22432
- const handleDragOver = React82__default.useCallback((event) => {
22717
+ const handleDragOver = React83__default.useCallback((event) => {
22433
22718
  const { active, over } = event;
22434
22719
  const overData = over?.data?.current;
22435
22720
  const overGroup = overData?.dndGroup ?? null;
@@ -22499,7 +22784,7 @@ function useDataDnd(args) {
22499
22784
  return next;
22500
22785
  });
22501
22786
  }, []);
22502
- const handleDragCancel = React82__default.useCallback((event) => {
22787
+ const handleDragCancel = React83__default.useCallback((event) => {
22503
22788
  setActiveDrag(null);
22504
22789
  setOverZoneGroup(null);
22505
22790
  dndLog.warn("dragCancel", {
@@ -22507,12 +22792,12 @@ function useDataDnd(args) {
22507
22792
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22508
22793
  });
22509
22794
  }, []);
22510
- const handleDragEndWithCleanup = React82__default.useCallback((event) => {
22795
+ const handleDragEndWithCleanup = React83__default.useCallback((event) => {
22511
22796
  handleDragEnd(event);
22512
22797
  setActiveDrag(null);
22513
22798
  setOverZoneGroup(null);
22514
22799
  }, [handleDragEnd]);
22515
- const wrapContainer = React82__default.useCallback(
22800
+ const wrapContainer = React83__default.useCallback(
22516
22801
  (children) => {
22517
22802
  if (!enabled) return children;
22518
22803
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -22566,15 +22851,12 @@ var init_useDataDnd = __esm({
22566
22851
  init_useAlmadarDndCollision();
22567
22852
  init_Box();
22568
22853
  dndLog = createLogger("almadar:ui:dnd");
22569
- RootCtx = React82__default.createContext(null);
22854
+ RootCtx = React83__default.createContext(null);
22570
22855
  }
22571
22856
  });
22572
22857
  function renderIconInput(icon, props) {
22573
22858
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
22574
22859
  }
22575
- function fieldLabel2(key) {
22576
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
22577
- }
22578
22860
  function statusVariant2(value) {
22579
22861
  const v = value.toLowerCase();
22580
22862
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -22593,29 +22875,6 @@ function resolveBadgeVariant(field, value) {
22593
22875
  }
22594
22876
  return statusVariant2(value);
22595
22877
  }
22596
- function formatDate2(value) {
22597
- if (!value) return "";
22598
- const d = new Date(String(value));
22599
- if (isNaN(d.getTime())) return String(value);
22600
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
22601
- }
22602
- function formatValue(value, format) {
22603
- if (value === void 0 || value === null) return "";
22604
- switch (format) {
22605
- case "date":
22606
- return formatDate2(value);
22607
- case "currency":
22608
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
22609
- case "number":
22610
- return typeof value === "number" ? value.toLocaleString() : String(value);
22611
- case "percent":
22612
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
22613
- case "boolean":
22614
- return value ? "Yes" : "No";
22615
- default:
22616
- return String(value);
22617
- }
22618
- }
22619
22878
  function DataGrid({
22620
22879
  entity,
22621
22880
  fields,
@@ -22902,7 +23161,7 @@ function DataGrid({
22902
23161
  if (val === void 0 || val === null || val === "") return null;
22903
23162
  return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
22904
23163
  field.icon && renderIconInput(field.icon, { size: "xs" }),
22905
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: formatValue(val, field.format) })
23164
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: humanizeEnumValue(formatValue(val, field.format)) })
22906
23165
  ] }, field.name);
22907
23166
  }) })
22908
23167
  ] }),
@@ -23012,11 +23271,12 @@ function DataGrid({
23012
23271
  ] })
23013
23272
  );
23014
23273
  }
23015
- var dataGridLog, BADGE_VARIANTS, gapStyles5, lookStyles5;
23274
+ var dataGridLog, fieldLabel2, BADGE_VARIANTS, gapStyles5, lookStyles5;
23016
23275
  var init_DataGrid = __esm({
23017
23276
  "components/core/molecules/DataGrid.tsx"() {
23018
23277
  "use client";
23019
23278
  init_cn();
23279
+ init_format();
23020
23280
  init_getNestedValue();
23021
23281
  init_useEventBus();
23022
23282
  init_Box();
@@ -23029,6 +23289,7 @@ var init_DataGrid = __esm({
23029
23289
  init_Menu();
23030
23290
  init_useDataDnd();
23031
23291
  dataGridLog = createLogger("almadar:ui:data-grid");
23292
+ fieldLabel2 = humanizeFieldName;
23032
23293
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
23033
23294
  "default",
23034
23295
  "primary",
@@ -23060,9 +23321,6 @@ var init_DataGrid = __esm({
23060
23321
  function renderIconInput2(icon, props) {
23061
23322
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
23062
23323
  }
23063
- function fieldLabel3(key) {
23064
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
23065
- }
23066
23324
  function statusVariant3(value) {
23067
23325
  const v = value.toLowerCase();
23068
23326
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -23071,28 +23329,12 @@ function statusVariant3(value) {
23071
23329
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
23072
23330
  return "default";
23073
23331
  }
23074
- function formatDate3(value) {
23075
- if (!value) return "";
23076
- const d = new Date(String(value));
23077
- if (isNaN(d.getTime())) return String(value);
23078
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
23079
- }
23080
23332
  function formatValue2(value, format, boolLabels) {
23081
- if (value === void 0 || value === null) return "";
23082
- switch (format) {
23083
- case "date":
23084
- return formatDate3(value);
23085
- case "currency":
23086
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
23087
- case "number":
23088
- return typeof value === "number" ? value.toLocaleString() : String(value);
23089
- case "percent":
23090
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
23091
- case "boolean":
23092
- return value ? boolLabels?.yes ?? "Yes" : boolLabels?.no ?? "No";
23093
- default:
23094
- return String(value);
23333
+ if (value !== void 0 && value !== null && (format === "boolean" || typeof value === "boolean")) {
23334
+ const isNo = value === false || value === 0 || String(value) === "false";
23335
+ return isNo ? boolLabels?.no ?? "No" : boolLabels?.yes ?? "Yes";
23095
23336
  }
23337
+ return formatValue(value, format);
23096
23338
  }
23097
23339
  function groupData(items, field) {
23098
23340
  const groups = /* @__PURE__ */ new Map();
@@ -23115,7 +23357,9 @@ function DataList({
23115
23357
  variant = "default",
23116
23358
  groupBy,
23117
23359
  senderField,
23360
+ senderLabelField,
23118
23361
  currentUser,
23362
+ emptyMessage,
23119
23363
  className,
23120
23364
  isLoading = false,
23121
23365
  error = null,
@@ -23147,7 +23391,7 @@ function DataList({
23147
23391
  }) {
23148
23392
  const eventBus = useEventBus();
23149
23393
  const { t } = useTranslate();
23150
- const [visibleCount, setVisibleCount] = React82__default.useState(pageSize || Infinity);
23394
+ const [visibleCount, setVisibleCount] = React83__default.useState(pageSize || Infinity);
23151
23395
  const fieldDefs = fields ?? columns ?? [];
23152
23396
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
23153
23397
  const dnd = useDataDnd({
@@ -23166,7 +23410,7 @@ function DataList({
23166
23410
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
23167
23411
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
23168
23412
  const hasRenderProp = typeof children === "function";
23169
- React82__default.useEffect(() => {
23413
+ React83__default.useEffect(() => {
23170
23414
  const renderItemTypeOf = typeof schemaRenderItem;
23171
23415
  const childrenTypeOf = typeof children;
23172
23416
  if (data.length > 0 && !hasRenderProp) {
@@ -23254,7 +23498,7 @@ function DataList({
23254
23498
  return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
23255
23499
  }
23256
23500
  if (data.length === 0) {
23257
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") }) });
23501
+ const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
23258
23502
  return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
23259
23503
  }
23260
23504
  const gapClass = {
@@ -23270,51 +23514,93 @@ function DataList({
23270
23514
  const items2 = [...data];
23271
23515
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
23272
23516
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
23273
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
23274
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
23275
- group.items.map((itemData, index) => {
23276
- const id = itemData.id || `${gi}-${index}`;
23277
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
23278
- const isSent = Boolean(currentUser && sender === currentUser);
23279
- const content = getNestedValue(itemData, contentField);
23280
- const timestampField = fieldDefs.find((f3) => f3.format === "date");
23281
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
23282
- return /* @__PURE__ */ jsx(
23283
- Box,
23284
- {
23285
- className: cn(
23286
- "flex px-4",
23287
- isSent ? "justify-end" : "justify-start"
23288
- ),
23289
- children: /* @__PURE__ */ jsxs(
23290
- Box,
23291
- {
23292
- className: cn(
23293
- "max-w-[75%] px-4 py-2",
23294
- isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
23295
- ),
23296
- children: [
23297
- !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
23298
- /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
23299
- timestamp != null ? /* @__PURE__ */ jsx(
23300
- Typography,
23301
- {
23302
- variant: "caption",
23303
- className: cn(
23304
- "mt-1 text-xs",
23305
- isSent ? "opacity-70" : "text-muted-foreground"
23306
- ),
23307
- children: formatDate3(timestamp)
23308
- }
23309
- ) : null
23310
- ]
23311
- }
23312
- )
23313
- },
23314
- id
23315
- );
23316
- })
23317
- ] }, gi)) });
23517
+ const senderLabel = (itemData, raw) => {
23518
+ if (!senderLabelField) return raw;
23519
+ const v = getNestedValue(itemData, senderLabelField);
23520
+ return v === void 0 || v === null || v === "" ? raw : String(v);
23521
+ };
23522
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
23523
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
23524
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
23525
+ group.items.map((itemData, index) => {
23526
+ const id = itemData.id || `${gi}-${index}`;
23527
+ const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
23528
+ const isSent = Boolean(currentUser && sender === currentUser);
23529
+ const content = getNestedValue(itemData, contentField);
23530
+ const timestampField = fieldDefs.find((f3) => f3.format === "date");
23531
+ const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
23532
+ const metaFields = fieldDefs.filter(
23533
+ (f3) => f3.name !== contentField && f3.name !== timestampField?.name
23534
+ );
23535
+ return /* @__PURE__ */ jsx(
23536
+ Box,
23537
+ {
23538
+ "data-entity-row": true,
23539
+ "data-entity-id": id,
23540
+ onClick: itemClickEvent ? handleRowClick(itemData) : void 0,
23541
+ className: cn(
23542
+ "flex px-4 group/rowactions",
23543
+ itemClickEvent && "cursor-pointer",
23544
+ isSent ? "justify-end" : "justify-start"
23545
+ ),
23546
+ children: /* @__PURE__ */ jsxs(
23547
+ Box,
23548
+ {
23549
+ className: cn(
23550
+ "max-w-[75%] px-4 py-2",
23551
+ isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
23552
+ ),
23553
+ children: [
23554
+ !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
23555
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
23556
+ metaFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
23557
+ const v = getNestedValue(itemData, f3.name);
23558
+ if (v === void 0 || v === null || v === "") return null;
23559
+ return f3.variant === "badge" ? /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(v)), children: String(v) }, f3.name) : /* @__PURE__ */ jsx(
23560
+ Typography,
23561
+ {
23562
+ variant: "caption",
23563
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
23564
+ children: formatValue2(v, f3.format)
23565
+ },
23566
+ f3.name
23567
+ );
23568
+ }) }),
23569
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "mt-1 items-center justify-between", children: [
23570
+ timestamp != null ? /* @__PURE__ */ jsx(
23571
+ Typography,
23572
+ {
23573
+ variant: "caption",
23574
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
23575
+ children: formatDate(timestamp)
23576
+ }
23577
+ ) : /* @__PURE__ */ jsx("span", {}),
23578
+ renderItemActions(itemData)
23579
+ ] })
23580
+ ]
23581
+ }
23582
+ )
23583
+ },
23584
+ id
23585
+ );
23586
+ })
23587
+ ] }, gi)),
23588
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
23589
+ Button,
23590
+ {
23591
+ variant: "ghost",
23592
+ size: "sm",
23593
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
23594
+ children: [
23595
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
23596
+ t("common.showMore"),
23597
+ " (",
23598
+ t("common.remaining", { count: allData.length - visibleCount }),
23599
+ ")"
23600
+ ]
23601
+ }
23602
+ ) })
23603
+ ] });
23318
23604
  }
23319
23605
  const items = [...data];
23320
23606
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
@@ -23429,7 +23715,7 @@ function DataList({
23429
23715
  className
23430
23716
  ),
23431
23717
  children: [
23432
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
23718
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
23433
23719
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23434
23720
  group.items.map(
23435
23721
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -23463,11 +23749,12 @@ function DataList({
23463
23749
  )
23464
23750
  );
23465
23751
  }
23466
- var dataListLog, listLookStyles;
23752
+ var dataListLog, fieldLabel3, listLookStyles;
23467
23753
  var init_DataList = __esm({
23468
23754
  "components/core/molecules/DataList.tsx"() {
23469
23755
  "use client";
23470
23756
  init_cn();
23757
+ init_format();
23471
23758
  init_getNestedValue();
23472
23759
  init_useEventBus();
23473
23760
  init_Box();
@@ -23482,6 +23769,7 @@ var init_DataList = __esm({
23482
23769
  init_Menu();
23483
23770
  init_useDataDnd();
23484
23771
  dataListLog = createLogger("almadar:ui:data-list");
23772
+ fieldLabel3 = humanizeFieldName;
23485
23773
  listLookStyles = {
23486
23774
  dense: "[&_[data-entity-row]>div]:!py-1 [&_[data-entity-row]>div]:!px-3",
23487
23775
  spacious: "[&_[data-entity-row]>div]:!py-5 [&_[data-entity-row]>div]:!px-8",
@@ -23514,7 +23802,7 @@ var init_FormSection = __esm({
23514
23802
  columns = 1,
23515
23803
  className
23516
23804
  }) => {
23517
- const [collapsed, setCollapsed] = React82__default.useState(defaultCollapsed);
23805
+ const [collapsed, setCollapsed] = React83__default.useState(defaultCollapsed);
23518
23806
  const { t } = useTranslate();
23519
23807
  const eventBus = useEventBus();
23520
23808
  const gridClass = {
@@ -23522,7 +23810,7 @@ var init_FormSection = __esm({
23522
23810
  2: "grid-cols-1 md:grid-cols-2",
23523
23811
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
23524
23812
  }[columns];
23525
- React82__default.useCallback(() => {
23813
+ React83__default.useCallback(() => {
23526
23814
  if (collapsible) {
23527
23815
  setCollapsed((prev) => !prev);
23528
23816
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -24327,7 +24615,7 @@ var init_Flex = __esm({
24327
24615
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
24328
24616
  }
24329
24617
  }
24330
- return React82__default.createElement(Component, {
24618
+ return React83__default.createElement(Component, {
24331
24619
  className: cn(
24332
24620
  inline ? "inline-flex" : "flex",
24333
24621
  directionStyles[direction],
@@ -24446,7 +24734,7 @@ var init_Grid = __esm({
24446
24734
  as: Component = "div"
24447
24735
  }) => {
24448
24736
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
24449
- return React82__default.createElement(
24737
+ return React83__default.createElement(
24450
24738
  Component,
24451
24739
  {
24452
24740
  className: cn(
@@ -24654,9 +24942,9 @@ var init_Popover = __esm({
24654
24942
  onMouseLeave: handleClose,
24655
24943
  onPointerDown: tapTriggerProps.onPointerDown
24656
24944
  };
24657
- const childElement = React82__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
24945
+ const childElement = React83__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
24658
24946
  const childPointerDown = childElement.props.onPointerDown;
24659
- const triggerElement = React82__default.cloneElement(
24947
+ const triggerElement = React83__default.cloneElement(
24660
24948
  childElement,
24661
24949
  {
24662
24950
  ref: triggerRef,
@@ -25265,9 +25553,9 @@ var init_Tooltip = __esm({
25265
25553
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
25266
25554
  };
25267
25555
  }, []);
25268
- const triggerElement = React82__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25556
+ const triggerElement = React83__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25269
25557
  const childPointerDown = triggerElement.props.onPointerDown;
25270
- const trigger = React82__default.cloneElement(triggerElement, {
25558
+ const trigger = React83__default.cloneElement(triggerElement, {
25271
25559
  ref: triggerRef,
25272
25560
  onMouseEnter: handleMouseEnter,
25273
25561
  onMouseLeave: handleMouseLeave,
@@ -25357,7 +25645,7 @@ var init_WizardProgress = __esm({
25357
25645
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
25358
25646
  const isActive = index === currentStep;
25359
25647
  const isCompleted = index < currentStep;
25360
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
25648
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
25361
25649
  /* @__PURE__ */ jsx(
25362
25650
  "button",
25363
25651
  {
@@ -26918,13 +27206,13 @@ var init_MapView = __esm({
26918
27206
  shadowSize: [41, 41]
26919
27207
  });
26920
27208
  L.Marker.prototype.options.icon = defaultIcon;
26921
- const { useEffect: useEffect59, useRef: useRef60, useCallback: useCallback88, useState: useState89 } = React82__default;
27209
+ const { useEffect: useEffect60, useRef: useRef61, useCallback: useCallback89, useState: useState89 } = React83__default;
26922
27210
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
26923
27211
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
26924
27212
  function MapUpdater({ centerLat, centerLng, zoom }) {
26925
27213
  const map = useMap();
26926
- const prevRef = useRef60({ centerLat, centerLng, zoom });
26927
- useEffect59(() => {
27214
+ const prevRef = useRef61({ centerLat, centerLng, zoom });
27215
+ useEffect60(() => {
26928
27216
  const prev = prevRef.current;
26929
27217
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
26930
27218
  map.setView([centerLat, centerLng], zoom);
@@ -26935,7 +27223,7 @@ var init_MapView = __esm({
26935
27223
  }
26936
27224
  function MapClickHandler({ onMapClick }) {
26937
27225
  const map = useMap();
26938
- useEffect59(() => {
27226
+ useEffect60(() => {
26939
27227
  if (!onMapClick) return;
26940
27228
  const handler = (e) => {
26941
27229
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -26964,7 +27252,7 @@ var init_MapView = __esm({
26964
27252
  }) {
26965
27253
  const eventBus = useEventBus2();
26966
27254
  const [clickedPosition, setClickedPosition] = useState89(null);
26967
- const handleMapClick = useCallback88((lat, lng) => {
27255
+ const handleMapClick = useCallback89((lat, lng) => {
26968
27256
  if (showClickedPin) {
26969
27257
  setClickedPosition({ lat, lng });
26970
27258
  }
@@ -26973,7 +27261,7 @@ var init_MapView = __esm({
26973
27261
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
26974
27262
  }
26975
27263
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
26976
- const handleMarkerClick = useCallback88((marker) => {
27264
+ const handleMarkerClick = useCallback89((marker) => {
26977
27265
  onMarkerClick?.(marker);
26978
27266
  if (markerClickEvent) {
26979
27267
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -27753,7 +28041,7 @@ function renderIconInput3(icon, props) {
27753
28041
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
27754
28042
  }
27755
28043
  function columnLabel(col) {
27756
- return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
28044
+ return col.header ?? col.label ?? humanizeFieldName(col.key);
27757
28045
  }
27758
28046
  function asFieldValue(v) {
27759
28047
  if (v === void 0 || v === null) return v;
@@ -27772,25 +28060,6 @@ function statusVariant4(value) {
27772
28060
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
27773
28061
  return "default";
27774
28062
  }
27775
- function formatCell(value, format) {
27776
- if (value === void 0 || value === null) return "";
27777
- switch (format) {
27778
- case "date": {
27779
- const d = new Date(String(value));
27780
- return isNaN(d.getTime()) ? String(value) : d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
27781
- }
27782
- case "currency":
27783
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
27784
- case "number":
27785
- return typeof value === "number" ? value.toLocaleString() : String(value);
27786
- case "percent":
27787
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
27788
- case "boolean":
27789
- return value ? "Yes" : "No";
27790
- default:
27791
- return String(value);
27792
- }
27793
- }
27794
28063
  function groupData2(items, field) {
27795
28064
  const groups = /* @__PURE__ */ new Map();
27796
28065
  for (const item of items) {
@@ -27834,9 +28103,10 @@ function TableView({
27834
28103
  }) {
27835
28104
  const eventBus = useEventBus();
27836
28105
  const { t } = useTranslate();
27837
- const [visibleCount, setVisibleCount] = React82__default.useState(pageSize > 0 ? pageSize : Infinity);
27838
- const [localSelected, setLocalSelected] = React82__default.useState(/* @__PURE__ */ new Set());
27839
- const colDefs = columns ?? fields ?? [];
28106
+ const [visibleCount, setVisibleCount] = React83__default.useState(pageSize > 0 ? pageSize : Infinity);
28107
+ const [localSelected, setLocalSelected] = React83__default.useState(/* @__PURE__ */ new Set());
28108
+ const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
28109
+ const actionDefs = Array.isArray(itemActions) ? itemActions : [];
27840
28110
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
27841
28111
  const dnd = useDataDnd({
27842
28112
  items: allDataRaw,
@@ -27856,6 +28126,23 @@ function TableView({
27856
28126
  const hasRenderProp = typeof children === "function";
27857
28127
  const idField = dndItemIdField ?? "id";
27858
28128
  const isCoarsePointer = useMediaQuery("(pointer: coarse)");
28129
+ React83__default.useEffect(() => {
28130
+ tableViewLog.debug("render", {
28131
+ rowCount: data.length,
28132
+ colCount: colDefs.length,
28133
+ look,
28134
+ isLoading: Boolean(isLoading),
28135
+ hasError: Boolean(error),
28136
+ dnd: dnd.enabled
28137
+ });
28138
+ if (data.length > 0 && !hasRenderProp && colDefs.length === 0) {
28139
+ tableViewLog.warn("columns-unresolved", {
28140
+ rowCount: data.length,
28141
+ columnsIsArray: Array.isArray(columns),
28142
+ fieldsIsArray: Array.isArray(fields)
28143
+ });
28144
+ }
28145
+ }, [data, colDefs, look, isLoading, error, dnd.enabled, hasRenderProp, columns, fields]);
27859
28146
  const selected = selectedIds ? new Set(selectedIds) : localSelected;
27860
28147
  const emitSelection = (next) => {
27861
28148
  if (!selectedIds) setLocalSelected(next);
@@ -27888,7 +28175,7 @@ function TableView({
27888
28175
  };
27889
28176
  eventBus.emit(`UI:${action.event}`, payload);
27890
28177
  };
27891
- const colFloors = React82__default.useMemo(
28178
+ const colFloors = React83__default.useMemo(
27892
28179
  () => colDefs.map((col) => {
27893
28180
  const longest = data.reduce((widest, row) => {
27894
28181
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -27899,21 +28186,12 @@ function TableView({
27899
28186
  }),
27900
28187
  [colDefs, data]
27901
28188
  );
27902
- if (isLoading) {
27903
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") }) });
27904
- }
27905
- if (error) {
27906
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
27907
- }
27908
- if (data.length === 0) {
27909
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
27910
- return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
27911
- }
28189
+ const statusNode = isLoading ? /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") }) }) : error ? /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) }) : data.length === 0 ? /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) }) : null;
27912
28190
  const lk = LOOKS[look];
27913
- const hasActions = Boolean(itemActions && itemActions.length > 0);
28191
+ const hasActions = actionDefs.length > 0;
27914
28192
  const effectiveMaxInline = isCoarsePointer ? 0 : maxInlineActions;
27915
- const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(itemActions.length, effectiveMaxInline) : itemActions.length : 0;
27916
- const hasOverflowActions = hasActions && effectiveMaxInline != null && itemActions.length > effectiveMaxInline;
28193
+ const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(actionDefs.length, effectiveMaxInline) : actionDefs.length : 0;
28194
+ const hasOverflowActions = hasActions && effectiveMaxInline != null && actionDefs.length > effectiveMaxInline;
27917
28195
  const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
27918
28196
  const gridTemplateColumns = [
27919
28197
  selectable ? "auto" : null,
@@ -28001,11 +28279,11 @@ function TableView({
28001
28279
  col.className
28002
28280
  );
28003
28281
  if (col.format === "badge" && raw != null && raw !== "") {
28004
- return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx(Badge, { variant: statusVariant4(String(raw)), size: "sm", className: "whitespace-nowrap", children: String(raw) }) }, col.key);
28282
+ return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx(Badge, { variant: statusVariant4(String(raw)), size: "sm", className: "whitespace-nowrap", children: humanizeEnumValue(String(raw)) }) }, col.key);
28005
28283
  }
28006
28284
  return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format) }) }, col.key);
28007
28285
  }),
28008
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(
28286
+ hasActions && /* @__PURE__ */ jsxs(
28009
28287
  HStack,
28010
28288
  {
28011
28289
  gap: "xs",
@@ -28017,7 +28295,7 @@ function TableView({
28017
28295
  lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
28018
28296
  ),
28019
28297
  children: [
28020
- (effectiveMaxInline != null ? itemActions.slice(0, effectiveMaxInline) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
28298
+ (effectiveMaxInline != null ? actionDefs.slice(0, effectiveMaxInline) : actionDefs).map((action, i) => /* @__PURE__ */ jsxs(
28021
28299
  Button,
28022
28300
  {
28023
28301
  variant: action.variant === "primary" ? "primary" : "ghost",
@@ -28033,12 +28311,12 @@ function TableView({
28033
28311
  },
28034
28312
  i
28035
28313
  )),
28036
- effectiveMaxInline != null && itemActions.length > effectiveMaxInline && /* @__PURE__ */ jsx(
28314
+ effectiveMaxInline != null && actionDefs.length > effectiveMaxInline && /* @__PURE__ */ jsx(
28037
28315
  Menu,
28038
28316
  {
28039
28317
  position: "bottom-end",
28040
28318
  trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
28041
- items: itemActions.slice(effectiveMaxInline).map((action) => ({
28319
+ items: actionDefs.slice(effectiveMaxInline).map((action) => ({
28042
28320
  label: action.label,
28043
28321
  icon: action.icon,
28044
28322
  event: action.event,
@@ -28056,24 +28334,25 @@ function TableView({
28056
28334
  ]
28057
28335
  }
28058
28336
  );
28059
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React82__default.Fragment, { children: rowInner }, id);
28337
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React83__default.Fragment, { children: rowInner }, id);
28060
28338
  };
28061
28339
  const items = Array.from(data);
28062
28340
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
28063
28341
  let runningIndex = 0;
28064
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
28342
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
28065
28343
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
28066
28344
  group.items.map((row) => renderRow(row, runningIndex++))
28067
28345
  ] }, gi)) });
28346
+ const showHeader = colDefs.length > 0 || hasRenderProp;
28068
28347
  return /* @__PURE__ */ jsxs(
28069
28348
  Box,
28070
28349
  {
28071
28350
  role: "table",
28072
28351
  className: cn("w-full text-sm", className),
28073
28352
  children: [
28074
- header,
28075
- dnd.wrapContainer(body),
28076
- hasMore && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((p) => p + (pageSize || 5)), children: [
28353
+ showHeader && header,
28354
+ dnd.wrapContainer(statusNode ? /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: statusNode }) : body),
28355
+ !statusNode && hasMore && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((p) => p + (pageSize || 5)), children: [
28077
28356
  /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
28078
28357
  t("common.showMore"),
28079
28358
  " (",
@@ -28084,11 +28363,12 @@ function TableView({
28084
28363
  }
28085
28364
  );
28086
28365
  }
28087
- var MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
28366
+ var tableViewLog, formatCell, MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
28088
28367
  var init_TableView = __esm({
28089
28368
  "components/core/molecules/TableView.tsx"() {
28090
28369
  "use client";
28091
28370
  init_cn();
28371
+ init_format();
28092
28372
  init_getNestedValue();
28093
28373
  init_useEventBus();
28094
28374
  init_useMediaQuery();
@@ -28102,7 +28382,8 @@ var init_TableView = __esm({
28102
28382
  init_Divider();
28103
28383
  init_Menu();
28104
28384
  init_useDataDnd();
28105
- createLogger("almadar:ui:table-view");
28385
+ tableViewLog = createLogger("almadar:ui:table-view");
28386
+ formatCell = (value, format) => formatValue(value, format);
28106
28387
  MAX_MEASURED_COL_CH = 32;
28107
28388
  BADGE_CHROME_CH = 4;
28108
28389
  alignClass = {
@@ -29283,7 +29564,7 @@ var init_StepFlow = __esm({
29283
29564
  className
29284
29565
  }) => {
29285
29566
  if (orientation === "vertical") {
29286
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React82__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
29567
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React83__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
29287
29568
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
29288
29569
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
29289
29570
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -29294,7 +29575,7 @@ var init_StepFlow = __esm({
29294
29575
  ] })
29295
29576
  ] }) }, index)) });
29296
29577
  }
29297
- 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(React82__default.Fragment, { children: [
29578
+ 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(React83__default.Fragment, { children: [
29298
29579
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
29299
29580
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
29300
29581
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -30284,7 +30565,7 @@ var init_LikertScale = __esm({
30284
30565
  md: "text-base",
30285
30566
  lg: "text-lg"
30286
30567
  };
30287
- LikertScale = React82__default.forwardRef(
30568
+ LikertScale = React83__default.forwardRef(
30288
30569
  ({
30289
30570
  question,
30290
30571
  options = DEFAULT_LIKERT_OPTIONS,
@@ -30296,7 +30577,7 @@ var init_LikertScale = __esm({
30296
30577
  variant = "radios",
30297
30578
  className
30298
30579
  }, ref) => {
30299
- const groupId = React82__default.useId();
30580
+ const groupId = React83__default.useId();
30300
30581
  const eventBus = useEventBus();
30301
30582
  const handleSelect = useCallback(
30302
30583
  (next) => {
@@ -32585,7 +32866,7 @@ var init_DocBreadcrumb = __esm({
32585
32866
  "aria-label": t("aria.breadcrumb"),
32586
32867
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
32587
32868
  const isLast = idx === items.length - 1;
32588
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
32869
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
32589
32870
  idx > 0 && /* @__PURE__ */ jsx(
32590
32871
  Icon,
32591
32872
  {
@@ -33454,7 +33735,7 @@ var init_MiniStateMachine = __esm({
33454
33735
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
33455
33736
  const tc = transitionCounts[s.name] ?? 0;
33456
33737
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
33457
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
33738
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
33458
33739
  /* @__PURE__ */ jsx(
33459
33740
  AvlState,
33460
33741
  {
@@ -33658,7 +33939,7 @@ var init_PageHeader = __esm({
33658
33939
  info: "bg-info/10 text-info"
33659
33940
  };
33660
33941
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
33661
- 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(React82__default.Fragment, { children: [
33942
+ 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(React83__default.Fragment, { children: [
33662
33943
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
33663
33944
  crumb.href ? /* @__PURE__ */ jsx(
33664
33945
  "a",
@@ -34016,7 +34297,7 @@ var init_Section = __esm({
34016
34297
  as: Component = "section"
34017
34298
  }) => {
34018
34299
  const hasHeader = title || description || action;
34019
- return React82__default.createElement(
34300
+ return React83__default.createElement(
34020
34301
  Component,
34021
34302
  {
34022
34303
  className: cn(
@@ -34390,7 +34671,7 @@ var init_WizardContainer = __esm({
34390
34671
  const isCompleted = index < currentStep;
34391
34672
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
34392
34673
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
34393
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
34674
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
34394
34675
  /* @__PURE__ */ jsx(
34395
34676
  Button,
34396
34677
  {
@@ -35348,6 +35629,7 @@ var init_GraphCanvas = __esm({
35348
35629
  title,
35349
35630
  nodes: propNodes = NO_NODES,
35350
35631
  edges: propEdges = NO_EDGES,
35632
+ proposedEdges = NO_EDGES,
35351
35633
  similarity: propSimilarity = NO_SIM,
35352
35634
  height = 400,
35353
35635
  showLabels = true,
@@ -35355,6 +35637,7 @@ var init_GraphCanvas = __esm({
35355
35637
  draggable = true,
35356
35638
  actions,
35357
35639
  onNodeClick,
35640
+ onMarkClick,
35358
35641
  onNodeDoubleClick,
35359
35642
  onBadgeClick,
35360
35643
  nodeClickEvent,
@@ -35383,6 +35666,18 @@ var init_GraphCanvas = __esm({
35383
35666
  const laidOutRef = useRef(false);
35384
35667
  const [, forceUpdate] = useState(0);
35385
35668
  const [logicalW, setLogicalW] = useState(800);
35669
+ const hasProposed = useMemo(() => propNodes.some((n) => n.mark?.kind === "proposed"), [propNodes]);
35670
+ const [pulseTick, setPulseTick] = useState(0);
35671
+ useEffect(() => {
35672
+ if (!hasProposed) return;
35673
+ let raf = 0;
35674
+ const loop = () => {
35675
+ setPulseTick((t2) => (t2 + 1) % 1e6);
35676
+ raf = requestAnimationFrame(loop);
35677
+ };
35678
+ raf = requestAnimationFrame(loop);
35679
+ return () => cancelAnimationFrame(raf);
35680
+ }, [hasProposed]);
35386
35681
  useEffect(() => {
35387
35682
  const canvas = canvasRef.current;
35388
35683
  if (!canvas || typeof ResizeObserver === "undefined") return;
@@ -35684,18 +35979,38 @@ var init_GraphCanvas = __esm({
35684
35979
  }
35685
35980
  }
35686
35981
  ctx.globalAlpha = 1;
35982
+ ctx.setLineDash([4, 4]);
35983
+ for (const edge of proposedEdges) {
35984
+ const source = nodes.find((n) => n.id === edge.source);
35985
+ const target = nodes.find((n) => n.id === edge.target);
35986
+ if (!source || !target) continue;
35987
+ ctx.globalAlpha = 0.4;
35988
+ ctx.beginPath();
35989
+ ctx.moveTo(source.x, source.y);
35990
+ ctx.lineTo(target.x, target.y);
35991
+ ctx.strokeStyle = edge.color || mutedColor;
35992
+ ctx.lineWidth = 1;
35993
+ ctx.stroke();
35994
+ }
35995
+ ctx.setLineDash([]);
35996
+ ctx.globalAlpha = 1;
35687
35997
  for (const node of nodes) {
35688
35998
  const size = node.size || 8;
35689
35999
  const color = resolveColor3(node.color || getGroupColor(node.group, groups), canvas);
35690
36000
  const isHovered = hoveredNode === node.id;
35691
36001
  const isSelected = selectedNodeId !== void 0 && node.id === selectedNodeId;
35692
- ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 1;
36002
+ const mark = node.mark;
36003
+ ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : mark?.kind === "proposed" ? 0.55 : 1;
35693
36004
  const radius = isSelected ? size + 4 : isHovered ? size + 2 : size;
35694
36005
  ctx.beginPath();
35695
36006
  ctx.arc(node.x, node.y, radius, 0, Math.PI * 2);
35696
- ctx.fillStyle = color;
36007
+ ctx.fillStyle = mark?.kind === "proposed" ? mutedColor : color;
35697
36008
  ctx.fill();
35698
- if (isSelected) {
36009
+ if (mark?.kind === "proposed") {
36010
+ ctx.setLineDash([3, 3]);
36011
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
36012
+ ctx.lineWidth = 1.5;
36013
+ } else if (isSelected) {
35699
36014
  ctx.strokeStyle = accentColor;
35700
36015
  ctx.lineWidth = 3;
35701
36016
  } else {
@@ -35703,6 +36018,28 @@ var init_GraphCanvas = __esm({
35703
36018
  ctx.lineWidth = isHovered ? 2 : 1;
35704
36019
  }
35705
36020
  ctx.stroke();
36021
+ ctx.setLineDash([]);
36022
+ if (mark?.kind === "suggested") {
36023
+ ctx.beginPath();
36024
+ ctx.arc(node.x, node.y, radius + 3, 0, Math.PI * 2);
36025
+ ctx.strokeStyle = accentColor;
36026
+ ctx.lineWidth = 2;
36027
+ ctx.stroke();
36028
+ ctx.beginPath();
36029
+ ctx.arc(node.x + radius * 0.7, node.y - radius * 0.7, 2.5, 0, Math.PI * 2);
36030
+ ctx.fillStyle = accentColor;
36031
+ ctx.fill();
36032
+ } else if (mark?.kind === "proposed") {
36033
+ const phase = pulseTick % 60 / 60;
36034
+ const baseAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 0.55;
36035
+ ctx.globalAlpha = baseAlpha * (0.4 + 0.4 * (1 - Math.abs(phase * 2 - 1)));
36036
+ ctx.beginPath();
36037
+ ctx.arc(node.x, node.y, radius + 6 + Math.sin(phase * Math.PI * 2) * 3, 0, Math.PI * 2);
36038
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
36039
+ ctx.lineWidth = 1.5;
36040
+ ctx.stroke();
36041
+ ctx.globalAlpha = baseAlpha;
36042
+ }
35706
36043
  if (showLabels && node.label) {
35707
36044
  const displayLabel = truncateLabel(node.label);
35708
36045
  ctx.font = `${isSelected || isHovered ? "700" : "600"} 12px ${fontFamily}`;
@@ -35837,11 +36174,15 @@ var init_GraphCanvas = __esm({
35837
36174
  return;
35838
36175
  }
35839
36176
  }
36177
+ if (node.mark && onMarkClick) {
36178
+ onMarkClick(node);
36179
+ return;
36180
+ }
35840
36181
  handleNodeClick(node);
35841
36182
  }
35842
36183
  }
35843
36184
  },
35844
- [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
36185
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, onMarkClick, selectedNodeId]
35845
36186
  );
35846
36187
  const handlePointerLeave = useCallback(() => {
35847
36188
  setHoveredNode(null);
@@ -36117,7 +36458,7 @@ var init_ImportPreviewTree = __esm({
36117
36458
  const renderUnit = (unit, childrenByParent, depth) => {
36118
36459
  const summary = fieldSummary(unit);
36119
36460
  const children = childrenByParent.get(unit.ref) ?? [];
36120
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
36461
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
36121
36462
  /* @__PURE__ */ jsxs(
36122
36463
  Box,
36123
36464
  {
@@ -36214,7 +36555,7 @@ var init_ImportProgress = __esm({
36214
36555
  PIPELINE.map((key, index) => {
36215
36556
  const isComplete = index < currentIndex;
36216
36557
  const isActive = index === currentIndex;
36217
- return /* @__PURE__ */ jsxs(React82__default.Fragment, { children: [
36558
+ return /* @__PURE__ */ jsxs(React83__default.Fragment, { children: [
36218
36559
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
36219
36560
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
36220
36561
  /* @__PURE__ */ jsx(
@@ -36368,9 +36709,6 @@ var init_types2 = __esm({
36368
36709
  };
36369
36710
  }
36370
36711
  });
36371
- function humanizeFieldName(name) {
36372
- return name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()).replace(/\b([A-Z])([A-Z]+)\b/g, (_, first, rest) => first + rest.toLowerCase()).trim();
36373
- }
36374
36712
  function normalizeColumns(columns) {
36375
36713
  return columns.map((col) => {
36376
36714
  if (typeof col === "string") {
@@ -36432,7 +36770,17 @@ function DataTable({
36432
36770
  const currentPageSize = pageSize ?? 20;
36433
36771
  const total = totalCount ?? items.length;
36434
36772
  const totalPages = Math.ceil(total / currentPageSize);
36435
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36773
+ const withEventClick = (action) => {
36774
+ if (action.onClick || !action.event) return action;
36775
+ const event = action.event;
36776
+ return {
36777
+ ...action,
36778
+ onClick: (row) => {
36779
+ eventBus.emit(`UI:${event}`, { row });
36780
+ }
36781
+ };
36782
+ };
36783
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36436
36784
  label: action.label,
36437
36785
  icon: action.icon,
36438
36786
  variant: action.variant,
@@ -36452,7 +36800,17 @@ function DataTable({
36452
36800
  });
36453
36801
  }
36454
36802
  }
36455
- }));
36803
+ })))?.map(withEventClick);
36804
+ const normalizedBulkActions = bulkActions?.map((action) => {
36805
+ if (action.onClick || !action.event) return action;
36806
+ const event = action.event;
36807
+ return {
36808
+ ...action,
36809
+ onClick: (selectedRows2) => {
36810
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
36811
+ }
36812
+ };
36813
+ });
36456
36814
  const viewAction = itemActions?.find(
36457
36815
  (a) => a.event === "VIEW" || a.navigatesTo
36458
36816
  );
@@ -36560,7 +36918,7 @@ function DataTable({
36560
36918
  }
36561
36919
  )
36562
36920
  ] }),
36563
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36921
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36564
36922
  /* @__PURE__ */ jsx(
36565
36923
  Typography,
36566
36924
  {
@@ -36571,13 +36929,13 @@ function DataTable({
36571
36929
  })
36572
36930
  }
36573
36931
  ),
36574
- /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsx(
36932
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsx(
36575
36933
  Button,
36576
36934
  {
36577
36935
  variant: action.variant === "danger" ? "danger" : "secondary",
36578
36936
  size: "sm",
36579
36937
  leftIcon: action.icon,
36580
- onClick: () => action.onClick(selectedRows),
36938
+ onClick: () => action.onClick?.(selectedRows),
36581
36939
  children: action.label
36582
36940
  },
36583
36941
  idx
@@ -36739,7 +37097,7 @@ function DataTable({
36739
37097
  ),
36740
37098
  onClick: (e) => {
36741
37099
  e.stopPropagation();
36742
- action.onClick(row);
37100
+ action.onClick?.(row);
36743
37101
  setOpenActionMenu(null);
36744
37102
  },
36745
37103
  children: [
@@ -36775,6 +37133,7 @@ var init_DataTable = __esm({
36775
37133
  "components/core/organisms/DataTable.tsx"() {
36776
37134
  "use client";
36777
37135
  init_cn();
37136
+ init_format();
36778
37137
  init_getNestedValue();
36779
37138
  init_atoms();
36780
37139
  init_Box();
@@ -36827,9 +37186,6 @@ function getBadgeVariant(fieldName, value) {
36827
37186
  }
36828
37187
  return "default";
36829
37188
  }
36830
- function formatFieldLabel(fieldName) {
36831
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
36832
- }
36833
37189
  function formatFieldValue2(value, fieldName) {
36834
37190
  if (typeof value === "number") {
36835
37191
  if (fieldName.toLowerCase().includes("progress") || fieldName.toLowerCase().includes("percent")) {
@@ -36957,7 +37313,7 @@ function buildFieldTypeMap(fields) {
36957
37313
  }
36958
37314
  return map;
36959
37315
  }
36960
- var ReactMarkdown2, DetailPanel;
37316
+ var formatFieldLabel, ReactMarkdown2, DetailPanel;
36961
37317
  var init_DetailPanel = __esm({
36962
37318
  "components/core/organisms/DetailPanel.tsx"() {
36963
37319
  "use client";
@@ -36969,8 +37325,10 @@ var init_DetailPanel = __esm({
36969
37325
  init_ErrorState();
36970
37326
  init_EmptyState();
36971
37327
  init_cn();
37328
+ init_format();
36972
37329
  init_getNestedValue();
36973
37330
  init_useEventBus();
37331
+ formatFieldLabel = humanizeFieldName;
36974
37332
  ReactMarkdown2 = lazy(() => import('react-markdown'));
36975
37333
  DetailPanel = ({
36976
37334
  title: propTitle,
@@ -37300,7 +37658,7 @@ var init_DetailPanel = __esm({
37300
37658
  }
37301
37659
  });
37302
37660
  function extractTitle(children) {
37303
- if (!React82__default.isValidElement(children)) return void 0;
37661
+ if (!React83__default.isValidElement(children)) return void 0;
37304
37662
  const props = children.props;
37305
37663
  if (typeof props.title === "string") {
37306
37664
  return props.title;
@@ -37650,12 +38008,12 @@ var init_Form = __esm({
37650
38008
  const isSchemaEntity = isOrbitalEntitySchema(entity);
37651
38009
  const resolvedEntity = isSchemaEntity ? entity : void 0;
37652
38010
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
37653
- const normalizedInitialData = React82__default.useMemo(() => {
38011
+ const normalizedInitialData = React83__default.useMemo(() => {
37654
38012
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
37655
38013
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
37656
38014
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
37657
38015
  }, [entity, initialData]);
37658
- const entityDerivedFields = React82__default.useMemo(() => {
38016
+ const entityDerivedFields = React83__default.useMemo(() => {
37659
38017
  if (fields && fields.length > 0) return void 0;
37660
38018
  if (!resolvedEntity) return void 0;
37661
38019
  return resolvedEntity.fields.map(
@@ -37676,16 +38034,16 @@ var init_Form = __esm({
37676
38034
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
37677
38035
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
37678
38036
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
37679
- const [formData, setFormData] = React82__default.useState(
38037
+ const [formData, setFormData] = React83__default.useState(
37680
38038
  normalizedInitialData
37681
38039
  );
37682
- const [collapsedSections, setCollapsedSections] = React82__default.useState(
38040
+ const [collapsedSections, setCollapsedSections] = React83__default.useState(
37683
38041
  /* @__PURE__ */ new Set()
37684
38042
  );
37685
- const [submitError, setSubmitError] = React82__default.useState(null);
37686
- const formRef = React82__default.useRef(null);
38043
+ const [submitError, setSubmitError] = React83__default.useState(null);
38044
+ const formRef = React83__default.useRef(null);
37687
38045
  const formMode = props.mode;
37688
- const mountedRef = React82__default.useRef(false);
38046
+ const mountedRef = React83__default.useRef(false);
37689
38047
  if (!mountedRef.current) {
37690
38048
  mountedRef.current = true;
37691
38049
  debug("forms", "mount", {
@@ -37698,7 +38056,7 @@ var init_Form = __esm({
37698
38056
  });
37699
38057
  }
37700
38058
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
37701
- const evalContext = React82__default.useMemo(
38059
+ const evalContext = React83__default.useMemo(
37702
38060
  () => ({
37703
38061
  formValues: formData,
37704
38062
  globalVariables: externalContext?.globalVariables ?? {},
@@ -37707,7 +38065,7 @@ var init_Form = __esm({
37707
38065
  }),
37708
38066
  [formData, externalContext]
37709
38067
  );
37710
- React82__default.useEffect(() => {
38068
+ React83__default.useEffect(() => {
37711
38069
  debug("forms", "initialData-sync", {
37712
38070
  mode: formMode,
37713
38071
  normalizedInitialData,
@@ -37718,7 +38076,7 @@ var init_Form = __esm({
37718
38076
  setFormData(normalizedInitialData);
37719
38077
  }
37720
38078
  }, [normalizedInitialData]);
37721
- const processCalculations = React82__default.useCallback(
38079
+ const processCalculations = React83__default.useCallback(
37722
38080
  (changedFieldId, newFormData) => {
37723
38081
  if (!hiddenCalculations.length) return;
37724
38082
  const context = {
@@ -37743,7 +38101,7 @@ var init_Form = __esm({
37743
38101
  },
37744
38102
  [hiddenCalculations, externalContext, eventBus]
37745
38103
  );
37746
- const checkViolations = React82__default.useCallback(
38104
+ const checkViolations = React83__default.useCallback(
37747
38105
  (changedFieldId, newFormData) => {
37748
38106
  if (!violationTriggers.length) return;
37749
38107
  const context = {
@@ -37781,7 +38139,7 @@ var init_Form = __esm({
37781
38139
  processCalculations(name, newFormData);
37782
38140
  checkViolations(name, newFormData);
37783
38141
  };
37784
- const isFieldVisible = React82__default.useCallback(
38142
+ const isFieldVisible = React83__default.useCallback(
37785
38143
  (fieldName) => {
37786
38144
  const condition = conditionalFields[fieldName];
37787
38145
  if (!condition) return true;
@@ -37789,7 +38147,7 @@ var init_Form = __esm({
37789
38147
  },
37790
38148
  [conditionalFields, evalContext]
37791
38149
  );
37792
- const isSectionVisible = React82__default.useCallback(
38150
+ const isSectionVisible = React83__default.useCallback(
37793
38151
  (section) => {
37794
38152
  if (!section.condition) return true;
37795
38153
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -37865,7 +38223,7 @@ var init_Form = __esm({
37865
38223
  eventBus.emit(`UI:${onCancel}`);
37866
38224
  }
37867
38225
  };
37868
- const renderField = React82__default.useCallback(
38226
+ const renderField = React83__default.useCallback(
37869
38227
  (field) => {
37870
38228
  const fieldName = field.name || field.field;
37871
38229
  if (!fieldName) return null;
@@ -37886,7 +38244,7 @@ var init_Form = __esm({
37886
38244
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
37887
38245
  );
37888
38246
  const effectiveFields = entityDerivedFields ?? fields;
37889
- const normalizedFields = React82__default.useMemo(() => {
38247
+ const normalizedFields = React83__default.useMemo(() => {
37890
38248
  if (!effectiveFields || effectiveFields.length === 0) return [];
37891
38249
  return effectiveFields.map((field) => {
37892
38250
  if (typeof field === "string") {
@@ -37910,7 +38268,7 @@ var init_Form = __esm({
37910
38268
  return field;
37911
38269
  });
37912
38270
  }, [effectiveFields, resolvedEntity]);
37913
- const schemaFields = React82__default.useMemo(() => {
38271
+ const schemaFields = React83__default.useMemo(() => {
37914
38272
  if (normalizedFields.length === 0) return null;
37915
38273
  if (isDebugEnabled()) {
37916
38274
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -37920,7 +38278,7 @@ var init_Form = __esm({
37920
38278
  }
37921
38279
  return normalizedFields.map(renderField).filter(Boolean);
37922
38280
  }, [normalizedFields, renderField, entityName, conditionalFields]);
37923
- const sectionElements = React82__default.useMemo(() => {
38281
+ const sectionElements = React83__default.useMemo(() => {
37924
38282
  if (!sections || sections.length === 0) return null;
37925
38283
  return sections.map((section) => {
37926
38284
  if (!isSectionVisible(section)) {
@@ -38499,7 +38857,7 @@ function formatValue3(value, fieldName) {
38499
38857
  return String(value);
38500
38858
  }
38501
38859
  function formatFieldLabel2(fieldName) {
38502
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
38860
+ return humanizeFieldName(fieldName).replace(/\sId$/, "").trim();
38503
38861
  }
38504
38862
  var STATUS_STYLES, StatusBadge, ProgressIndicator, List3;
38505
38863
  var init_List = __esm({
@@ -38511,6 +38869,7 @@ var init_List = __esm({
38511
38869
  init_EmptyState();
38512
38870
  init_LoadingState();
38513
38871
  init_cn();
38872
+ init_format();
38514
38873
  init_getNestedValue();
38515
38874
  init_useEventBus();
38516
38875
  init_types2();
@@ -38645,7 +39004,7 @@ var init_List = __esm({
38645
39004
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
38646
39005
  return [];
38647
39006
  }, [entity]);
38648
- const getItemActions = React82__default.useCallback(
39007
+ const getItemActions = React83__default.useCallback(
38649
39008
  (item) => {
38650
39009
  if (!itemActions) return [];
38651
39010
  if (typeof itemActions === "function") {
@@ -39126,7 +39485,7 @@ var init_MediaGallery = __esm({
39126
39485
  [selectable, selectedItems, selectionEvent, eventBus]
39127
39486
  );
39128
39487
  const entityData = Array.isArray(entity) ? entity : [];
39129
- const items = React82__default.useMemo(() => {
39488
+ const items = React83__default.useMemo(() => {
39130
39489
  if (propItems && propItems.length > 0) return propItems;
39131
39490
  if (entityData.length === 0) return [];
39132
39491
  return entityData.map((record, idx) => {
@@ -39291,7 +39650,7 @@ var init_MediaGallery = __esm({
39291
39650
  }
39292
39651
  });
39293
39652
  function extractTitle2(children) {
39294
- if (!React82__default.isValidElement(children)) return void 0;
39653
+ if (!React83__default.isValidElement(children)) return void 0;
39295
39654
  const props = children.props;
39296
39655
  if (typeof props.title === "string") {
39297
39656
  return props.title;
@@ -39565,7 +39924,7 @@ var init_debugRegistry = __esm({
39565
39924
  }
39566
39925
  });
39567
39926
  function useDebugData() {
39568
- const [data, setData] = React82.useState(() => ({
39927
+ const [data, setData] = React83.useState(() => ({
39569
39928
  traits: [],
39570
39929
  ticks: [],
39571
39930
  guards: [],
@@ -39579,7 +39938,7 @@ function useDebugData() {
39579
39938
  },
39580
39939
  lastUpdate: Date.now()
39581
39940
  }));
39582
- React82.useEffect(() => {
39941
+ React83.useEffect(() => {
39583
39942
  const updateData = () => {
39584
39943
  setData({
39585
39944
  traits: getAllTraits(),
@@ -39688,12 +40047,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
39688
40047
  return positions;
39689
40048
  }
39690
40049
  function WalkMinimap() {
39691
- const [walkStep, setWalkStep] = React82.useState(null);
39692
- const [traits2, setTraits] = React82.useState([]);
39693
- const [coveredEdges, setCoveredEdges] = React82.useState([]);
39694
- const [completedTraits, setCompletedTraits] = React82.useState(/* @__PURE__ */ new Set());
39695
- const prevTraitRef = React82.useRef(null);
39696
- React82.useEffect(() => {
40050
+ const [walkStep, setWalkStep] = React83.useState(null);
40051
+ const [traits2, setTraits] = React83.useState([]);
40052
+ const [coveredEdges, setCoveredEdges] = React83.useState([]);
40053
+ const [completedTraits, setCompletedTraits] = React83.useState(/* @__PURE__ */ new Set());
40054
+ const prevTraitRef = React83.useRef(null);
40055
+ React83.useEffect(() => {
39697
40056
  const interval = setInterval(() => {
39698
40057
  const w = window;
39699
40058
  const step = w.__orbitalWalkStep;
@@ -39991,7 +40350,7 @@ function TicksTab({ ticks: ticks2 }) {
39991
40350
  }
39992
40351
  );
39993
40352
  }
39994
- const formatTime2 = (ms) => {
40353
+ const formatTime3 = (ms) => {
39995
40354
  if (ms === 0) return "never";
39996
40355
  const seconds = Math.floor((Date.now() - ms) / 1e3);
39997
40356
  if (seconds < 1) return "just now";
@@ -40017,7 +40376,7 @@ function TicksTab({ ticks: ticks2 }) {
40017
40376
  tick.executionTime.toFixed(1),
40018
40377
  "ms exec"
40019
40378
  ] }),
40020
- /* @__PURE__ */ jsx("span", { children: formatTime2(tick.lastRun) })
40379
+ /* @__PURE__ */ jsx("span", { children: formatTime3(tick.lastRun) })
40021
40380
  ] }),
40022
40381
  tick.guardName && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxs(Badge, { variant: tick.guardPassed ? "success" : "danger", size: "sm", children: [
40023
40382
  tick.guardName,
@@ -40129,19 +40488,19 @@ var init_EntitiesTab = __esm({
40129
40488
  });
40130
40489
  function EventFlowTab({ events: events2 }) {
40131
40490
  const { t } = useTranslate();
40132
- const [filter, setFilter] = React82.useState("all");
40133
- const containerRef = React82.useRef(null);
40134
- const [autoScroll, setAutoScroll] = React82.useState(true);
40135
- React82.useEffect(() => {
40491
+ const [filter, setFilter] = React83.useState("all");
40492
+ const containerRef = React83.useRef(null);
40493
+ const [autoScroll, setAutoScroll] = React83.useState(true);
40494
+ React83.useEffect(() => {
40136
40495
  if (autoScroll && containerRef.current) {
40137
40496
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
40138
40497
  }
40139
40498
  }, [events2.length, autoScroll]);
40140
- const filteredEvents = React82.useMemo(() => {
40499
+ const filteredEvents = React83.useMemo(() => {
40141
40500
  if (filter === "all") return events2;
40142
40501
  return events2.filter((e) => e.type === filter);
40143
40502
  }, [events2, filter]);
40144
- const formatTime2 = (timestamp) => {
40503
+ const formatTime3 = (timestamp) => {
40145
40504
  const date = new Date(timestamp);
40146
40505
  return date.toLocaleTimeString("en-US", {
40147
40506
  hour12: false,
@@ -40217,7 +40576,7 @@ function EventFlowTab({ events: events2 }) {
40217
40576
  {
40218
40577
  className: "flex items-start gap-2 text-xs py-1 hover:bg-muted/50 rounded px-1",
40219
40578
  children: [
40220
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(event.timestamp) }),
40579
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(event.timestamp) }),
40221
40580
  /* @__PURE__ */ jsx("span", { children: icon }),
40222
40581
  /* @__PURE__ */ jsx(Badge, { variant, size: "sm", className: "min-w-[60px] justify-center", children: event.source }),
40223
40582
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: event.message })
@@ -40253,7 +40612,7 @@ var init_EventFlowTab = __esm({
40253
40612
  });
40254
40613
  function GuardsPanel({ guards }) {
40255
40614
  const { t } = useTranslate();
40256
- const [filter, setFilter] = React82.useState("all");
40615
+ const [filter, setFilter] = React83.useState("all");
40257
40616
  if (guards.length === 0) {
40258
40617
  return /* @__PURE__ */ jsx(
40259
40618
  EmptyState,
@@ -40266,12 +40625,12 @@ function GuardsPanel({ guards }) {
40266
40625
  }
40267
40626
  const passedCount = guards.filter((g) => g.result).length;
40268
40627
  const failedCount = guards.length - passedCount;
40269
- const filteredGuards = React82.useMemo(() => {
40628
+ const filteredGuards = React83.useMemo(() => {
40270
40629
  if (filter === "all") return guards;
40271
40630
  if (filter === "passed") return guards.filter((g) => g.result);
40272
40631
  return guards.filter((g) => !g.result);
40273
40632
  }, [guards, filter]);
40274
- const formatTime2 = (timestamp) => {
40633
+ const formatTime3 = (timestamp) => {
40275
40634
  const date = new Date(timestamp);
40276
40635
  return date.toLocaleTimeString("en-US", {
40277
40636
  hour12: false,
@@ -40286,7 +40645,7 @@ function GuardsPanel({ guards }) {
40286
40645
  /* @__PURE__ */ jsx(Badge, { variant: guard.result ? "success" : "danger", size: "sm", children: guard.result ? "\u2713" : "\u2717" }),
40287
40646
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", className: "text-warning", children: guard.guardName }),
40288
40647
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: guard.context.type === "transition" ? `${guard.context.transitionFrom} \u2192 ${guard.context.transitionTo}` : guard.context.tickName }),
40289
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime2(guard.timestamp) })
40648
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime3(guard.timestamp) })
40290
40649
  ] }),
40291
40650
  content: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
40292
40651
  /* @__PURE__ */ jsxs("div", { children: [
@@ -40429,10 +40788,10 @@ function EffectBadge({ effect }) {
40429
40788
  }
40430
40789
  function TransitionTimeline({ transitions }) {
40431
40790
  const { t } = useTranslate();
40432
- const containerRef = React82.useRef(null);
40433
- const [autoScroll, setAutoScroll] = React82.useState(true);
40434
- const [expandedId, setExpandedId] = React82.useState(null);
40435
- React82.useEffect(() => {
40791
+ const containerRef = React83.useRef(null);
40792
+ const [autoScroll, setAutoScroll] = React83.useState(true);
40793
+ const [expandedId, setExpandedId] = React83.useState(null);
40794
+ React83.useEffect(() => {
40436
40795
  if (autoScroll && containerRef.current) {
40437
40796
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
40438
40797
  }
@@ -40447,7 +40806,7 @@ function TransitionTimeline({ transitions }) {
40447
40806
  }
40448
40807
  );
40449
40808
  }
40450
- const formatTime2 = (ts) => {
40809
+ const formatTime3 = (ts) => {
40451
40810
  const d = new Date(ts);
40452
40811
  return d.toLocaleTimeString("en-US", {
40453
40812
  hour12: false,
@@ -40495,7 +40854,7 @@ function TransitionTimeline({ transitions }) {
40495
40854
  ${hasFailedEffects ? "bg-error" : allPassed ? "bg-success" : "bg-muted-foreground"}
40496
40855
  ` }),
40497
40856
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs py-1 px-2", children: [
40498
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(trace.timestamp) }),
40857
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(trace.timestamp) }),
40499
40858
  /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", className: "min-w-[60px] justify-center", children: trace.traitName }),
40500
40859
  /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-muted-foreground", children: [
40501
40860
  trace.from,
@@ -40570,7 +40929,7 @@ function ServerBridgeTab({ bridge }) {
40570
40929
  }
40571
40930
  );
40572
40931
  }
40573
- const formatTime2 = (ts) => {
40932
+ const formatTime3 = (ts) => {
40574
40933
  if (ts === 0) return t("debug.never");
40575
40934
  const d = new Date(ts);
40576
40935
  return d.toLocaleTimeString("en-US", {
@@ -40613,7 +40972,7 @@ function ServerBridgeTab({ bridge }) {
40613
40972
  StatRow,
40614
40973
  {
40615
40974
  label: t("debug.lastHeartbeat"),
40616
- value: formatTime2(bridge.lastHeartbeat)
40975
+ value: formatTime3(bridge.lastHeartbeat)
40617
40976
  }
40618
40977
  )
40619
40978
  ] })
@@ -40712,9 +41071,9 @@ function getAllEvents(traits2) {
40712
41071
  function EventDispatcherTab({ traits: traits2, schema }) {
40713
41072
  const eventBus = useEventBus();
40714
41073
  const { t } = useTranslate();
40715
- const [log9, setLog] = React82.useState([]);
40716
- const prevStatesRef = React82.useRef(/* @__PURE__ */ new Map());
40717
- React82.useEffect(() => {
41074
+ const [log9, setLog] = React83.useState([]);
41075
+ const prevStatesRef = React83.useRef(/* @__PURE__ */ new Map());
41076
+ React83.useEffect(() => {
40718
41077
  for (const trait of traits2) {
40719
41078
  const prev = prevStatesRef.current.get(trait.id);
40720
41079
  if (prev && prev !== trait.currentState) {
@@ -40883,10 +41242,10 @@ function VerifyModePanel({
40883
41242
  localCount
40884
41243
  }) {
40885
41244
  const { t } = useTranslate();
40886
- const [expanded, setExpanded] = React82.useState(true);
40887
- const scrollRef = React82.useRef(null);
40888
- const prevCountRef = React82.useRef(0);
40889
- React82.useEffect(() => {
41245
+ const [expanded, setExpanded] = React83.useState(true);
41246
+ const scrollRef = React83.useRef(null);
41247
+ const prevCountRef = React83.useRef(0);
41248
+ React83.useEffect(() => {
40890
41249
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
40891
41250
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
40892
41251
  }
@@ -40943,10 +41302,10 @@ function RuntimeDebugger({
40943
41302
  schema
40944
41303
  }) {
40945
41304
  const { t } = useTranslate();
40946
- const [isCollapsed, setIsCollapsed] = React82.useState(mode === "verify" ? true : defaultCollapsed);
40947
- const [isVisible, setIsVisible] = React82.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
41305
+ const [isCollapsed, setIsCollapsed] = React83.useState(mode === "verify" ? true : defaultCollapsed);
41306
+ const [isVisible, setIsVisible] = React83.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
40948
41307
  const debugData = useDebugData();
40949
- React82.useEffect(() => {
41308
+ React83.useEffect(() => {
40950
41309
  if (mode === "inline") return;
40951
41310
  return onDebugToggle((enabled) => {
40952
41311
  setIsVisible(enabled);
@@ -40955,7 +41314,7 @@ function RuntimeDebugger({
40955
41314
  }
40956
41315
  });
40957
41316
  }, [mode]);
40958
- React82.useEffect(() => {
41317
+ React83.useEffect(() => {
40959
41318
  if (mode === "inline") return;
40960
41319
  const handleKeyDown = (e) => {
40961
41320
  if (e.key === "`" && isVisible) {
@@ -41475,7 +41834,7 @@ var init_StatCard = __esm({
41475
41834
  const labelToUse = propLabel ?? propTitle;
41476
41835
  const eventBus = useEventBus();
41477
41836
  const { t } = useTranslate();
41478
- const handleActionClick = React82__default.useCallback(() => {
41837
+ const handleActionClick = React83__default.useCallback(() => {
41479
41838
  if (action?.event) {
41480
41839
  eventBus.emit(`UI:${action.event}`, {});
41481
41840
  }
@@ -41486,7 +41845,7 @@ var init_StatCard = __esm({
41486
41845
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
41487
41846
  const isLoading = externalLoading ?? false;
41488
41847
  const error = externalError;
41489
- const computeMetricValue = React82__default.useCallback(
41848
+ const computeMetricValue = React83__default.useCallback(
41490
41849
  (metric, items) => {
41491
41850
  if (metric.value !== void 0) {
41492
41851
  return metric.value;
@@ -41525,7 +41884,7 @@ var init_StatCard = __esm({
41525
41884
  },
41526
41885
  []
41527
41886
  );
41528
- const schemaStats = React82__default.useMemo(() => {
41887
+ const schemaStats = React83__default.useMemo(() => {
41529
41888
  if (!metrics || metrics.length === 0) return null;
41530
41889
  return metrics.map((metric) => ({
41531
41890
  label: metric.label,
@@ -41533,7 +41892,7 @@ var init_StatCard = __esm({
41533
41892
  format: metric.format
41534
41893
  }));
41535
41894
  }, [metrics, data, computeMetricValue]);
41536
- const calculatedTrend = React82__default.useMemo(() => {
41895
+ const calculatedTrend = React83__default.useMemo(() => {
41537
41896
  if (manualTrend !== void 0) return manualTrend;
41538
41897
  if (previousValue === void 0 || currentValue === void 0)
41539
41898
  return void 0;
@@ -42173,8 +42532,8 @@ var init_SubagentTracePanel = __esm({
42173
42532
  ] });
42174
42533
  };
42175
42534
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
42176
- const endRef = React82__default.useRef(null);
42177
- React82__default.useEffect(() => {
42535
+ const endRef = React83__default.useRef(null);
42536
+ React83__default.useEffect(() => {
42178
42537
  if (!autoScroll) return;
42179
42538
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
42180
42539
  }, [activities.length, autoScroll]);
@@ -42268,7 +42627,7 @@ var init_SubagentTracePanel = __esm({
42268
42627
  };
42269
42628
  SubagentRichCard = ({ subagent }) => {
42270
42629
  const { t } = useTranslate();
42271
- const activities = React82__default.useMemo(
42630
+ const activities = React83__default.useMemo(
42272
42631
  () => subagentMessagesToActivities(subagent.messages),
42273
42632
  [subagent.messages]
42274
42633
  );
@@ -42345,8 +42704,8 @@ var init_SubagentTracePanel = __esm({
42345
42704
  ] });
42346
42705
  };
42347
42706
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
42348
- const endRef = React82__default.useRef(null);
42349
- React82__default.useEffect(() => {
42707
+ const endRef = React83__default.useRef(null);
42708
+ React83__default.useEffect(() => {
42350
42709
  if (!autoScroll) return;
42351
42710
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
42352
42711
  }, [messages.length, autoScroll]);
@@ -42725,7 +43084,7 @@ var init_TeamOrganism = __esm({
42725
43084
  TeamOrganism.displayName = "TeamOrganism";
42726
43085
  }
42727
43086
  });
42728
- function formatDate4(value) {
43087
+ function formatDate2(value) {
42729
43088
  const d = new Date(value);
42730
43089
  if (isNaN(d.getTime())) return value;
42731
43090
  return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
@@ -42781,7 +43140,7 @@ var init_Timeline = __esm({
42781
43140
  }) => {
42782
43141
  const { t } = useTranslate();
42783
43142
  const entityData = entity ?? [];
42784
- const items = React82__default.useMemo(() => {
43143
+ const items = React83__default.useMemo(() => {
42785
43144
  if (propItems) return propItems;
42786
43145
  if (entityData.length === 0) return [];
42787
43146
  return entityData.map((record, idx) => {
@@ -42857,7 +43216,7 @@ var init_Timeline = __esm({
42857
43216
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("flex-1 min-w-0", !isLast && "pb-6"), children: [
42858
43217
  /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "start", wrap: true, children: [
42859
43218
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", children: item.title }),
42860
- item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate4(item.date) })
43219
+ item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate2(item.date) })
42861
43220
  ] }),
42862
43221
  item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
42863
43222
  item.tags && item.tags.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: item.tags.map((tag, tagIdx) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: tag }, tagIdx)) }),
@@ -42883,7 +43242,7 @@ var init_Timeline = __esm({
42883
43242
  }
42884
43243
  });
42885
43244
  function extractToastProps(children) {
42886
- if (!React82__default.isValidElement(children)) {
43245
+ if (!React83__default.isValidElement(children)) {
42887
43246
  if (typeof children === "string") {
42888
43247
  return { message: children };
42889
43248
  }
@@ -42925,7 +43284,7 @@ var init_ToastSlot = __esm({
42925
43284
  eventBus.emit(`${prefix}CLOSE`);
42926
43285
  };
42927
43286
  if (!isVisible) return null;
42928
- const isCustomContent = React82__default.isValidElement(children) && !message;
43287
+ const isCustomContent = React83__default.isValidElement(children) && !message;
42929
43288
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
42930
43289
  Toast,
42931
43290
  {
@@ -43163,6 +43522,10 @@ var init_component_registry_generated = __esm({
43163
43522
  init_SubagentTracePanel();
43164
43523
  init_SvgBranch();
43165
43524
  init_SvgConnection();
43525
+ init_SvgDrawGroup();
43526
+ init_SvgDrawShape();
43527
+ init_SvgDrawShapeLayer();
43528
+ init_SvgDrawText();
43166
43529
  init_SvgFlow();
43167
43530
  init_SvgGrid();
43168
43531
  init_SvgLobe();
@@ -43173,6 +43536,7 @@ var init_component_registry_generated = __esm({
43173
43536
  init_SvgRing();
43174
43537
  init_SvgShield();
43175
43538
  init_SvgStack();
43539
+ init_SvgStage();
43176
43540
  init_SwipeableRow();
43177
43541
  init_Switch();
43178
43542
  init_TabbedContainer();
@@ -43434,6 +43798,10 @@ var init_component_registry_generated = __esm({
43434
43798
  "SubagentTracePanel": SubagentTracePanel,
43435
43799
  "SvgBranch": SvgBranch,
43436
43800
  "SvgConnection": SvgConnection,
43801
+ "SvgDrawGroup": SvgDrawGroup,
43802
+ "SvgDrawShape": SvgDrawShape,
43803
+ "SvgDrawShapeLayer": SvgDrawShapeLayer,
43804
+ "SvgDrawText": SvgDrawText,
43437
43805
  "SvgFlow": SvgFlow,
43438
43806
  "SvgGrid": SvgGrid,
43439
43807
  "SvgLobe": SvgLobe,
@@ -43444,6 +43812,7 @@ var init_component_registry_generated = __esm({
43444
43812
  "SvgRing": SvgRing,
43445
43813
  "SvgShield": SvgShield,
43446
43814
  "SvgStack": SvgStack,
43815
+ "SvgStage": SvgStage,
43447
43816
  "SwipeableRow": SwipeableRow,
43448
43817
  "Switch": Switch,
43449
43818
  "TabbedContainer": TabbedContainer,
@@ -43494,7 +43863,7 @@ function SuspenseConfigProvider({
43494
43863
  config,
43495
43864
  children
43496
43865
  }) {
43497
- return React82__default.createElement(
43866
+ return React83__default.createElement(
43498
43867
  SuspenseConfigContext.Provider,
43499
43868
  { value: config },
43500
43869
  children
@@ -43520,7 +43889,7 @@ function enrichFormFields(fields, entityDef) {
43520
43889
  if (entityField) {
43521
43890
  const enriched = {
43522
43891
  name: field,
43523
- label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
43892
+ label: humanizeFieldName(field),
43524
43893
  type: entityField.type,
43525
43894
  required: entityField.required ?? false
43526
43895
  };
@@ -43534,9 +43903,9 @@ function enrichFormFields(fields, entityDef) {
43534
43903
  }
43535
43904
  return enriched;
43536
43905
  }
43537
- return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
43906
+ return { name: field, label: humanizeFieldName(field) };
43538
43907
  }
43539
- if (field && typeof field === "object" && !Array.isArray(field) && !React82__default.isValidElement(field) && !(field instanceof Date)) {
43908
+ if (field && typeof field === "object" && !Array.isArray(field) && !React83__default.isValidElement(field) && !(field instanceof Date)) {
43540
43909
  const obj = field;
43541
43910
  const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
43542
43911
  if (!fieldName) return field;
@@ -43996,7 +44365,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
43996
44365
  const key = `${parentId}-${index}-trait:${traitName}`;
43997
44366
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
43998
44367
  }
43999
- return /* @__PURE__ */ jsx(React82__default.Fragment, { children: child }, `${parentId}-${index}`);
44368
+ return /* @__PURE__ */ jsx(React83__default.Fragment, { children: child }, `${parentId}-${index}`);
44000
44369
  }
44001
44370
  if (!child || typeof child !== "object") return null;
44002
44371
  const childId = `${parentId}-${index}`;
@@ -44053,14 +44422,14 @@ function isPatternConfig(value) {
44053
44422
  if (value === null || value === void 0) return false;
44054
44423
  if (typeof value !== "object") return false;
44055
44424
  if (Array.isArray(value)) return false;
44056
- if (React82__default.isValidElement(value)) return false;
44425
+ if (React83__default.isValidElement(value)) return false;
44057
44426
  if (value instanceof Date) return false;
44058
44427
  if (typeof value === "function") return false;
44059
44428
  const record = value;
44060
44429
  return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
44061
44430
  }
44062
44431
  function isPlainConfigObject(value) {
44063
- if (React82__default.isValidElement(value)) return false;
44432
+ if (React83__default.isValidElement(value)) return false;
44064
44433
  if (value instanceof Date) return false;
44065
44434
  const proto = Object.getPrototypeOf(value);
44066
44435
  return proto === Object.prototype || proto === null;
@@ -44188,10 +44557,11 @@ function SlotContentRenderer({
44188
44557
  for (const slotKey of CONTENT_NODE_SLOTS) {
44189
44558
  const slotVal = restProps[slotKey];
44190
44559
  if (slotVal === void 0 || slotVal === null) continue;
44191
- if (React82__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
44192
- if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
44560
+ if (React83__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
44561
+ const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
44562
+ if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
44193
44563
  nodeSlotOverrides[slotKey] = renderPatternChildren(
44194
- slotVal,
44564
+ typelessChildren ?? slotVal,
44195
44565
  onDismiss,
44196
44566
  `${content.id}-${slotKey}`,
44197
44567
  `${myPath}.${slotKey}`,
@@ -44241,7 +44611,7 @@ function SlotContentRenderer({
44241
44611
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
44242
44612
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
44243
44613
  const sample = resolvedItems[0];
44244
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React82__default.isValidElement(sample) && !(sample instanceof Date)) {
44614
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React83__default.isValidElement(sample) && !(sample instanceof Date)) {
44245
44615
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
44246
44616
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
44247
44617
  }
@@ -44370,6 +44740,7 @@ var init_UISlotRenderer = __esm({
44370
44740
  init_useEventBus();
44371
44741
  init_slot_types();
44372
44742
  init_cn();
44743
+ init_format();
44373
44744
  init_ErrorBoundary();
44374
44745
  init_Skeleton();
44375
44746
  init_renderer();
@@ -44612,7 +44983,7 @@ function resolveLambdaBindings(body, params, item, index) {
44612
44983
  }
44613
44984
  return substituted;
44614
44985
  }
44615
- if (body !== null && typeof body === "object" && !React82__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44986
+ if (body !== null && typeof body === "object" && !React83__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
44616
44987
  const out = {};
44617
44988
  for (const [k, v] of Object.entries(body)) {
44618
44989
  out[k] = recur(v);
@@ -44631,7 +45002,7 @@ function getSlotContentRenderer2() {
44631
45002
  function makeLambdaFn(params, lambdaBody, callerKey) {
44632
45003
  return (item, index) => {
44633
45004
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
44634
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React82__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
45005
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React83__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
44635
45006
  return null;
44636
45007
  }
44637
45008
  const record = resolvedBody;
@@ -44650,7 +45021,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
44650
45021
  props: childProps,
44651
45022
  priority: 0
44652
45023
  };
44653
- return React82__default.createElement(SlotContentRenderer2, { content: childContent });
45024
+ return React83__default.createElement(SlotContentRenderer2, { content: childContent });
44654
45025
  };
44655
45026
  }
44656
45027
  function convertNode(node, callerKey) {
@@ -44669,7 +45040,7 @@ function convertNode(node, callerKey) {
44669
45040
  });
44670
45041
  return anyChanged ? mapped : node;
44671
45042
  }
44672
- if (typeof node === "object" && !React82__default.isValidElement(node) && !(node instanceof Date)) {
45043
+ if (typeof node === "object" && !React83__default.isValidElement(node) && !(node instanceof Date)) {
44673
45044
  return convertObjectProps(node);
44674
45045
  }
44675
45046
  return node;
@@ -45716,7 +46087,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45716
46087
  return;
45717
46088
  }
45718
46089
  crossTraitLog.debug("self:fire", { traitName, busKey: selfBusKey, eventKey });
45719
- enqueueAndDrain(eventKey, event.payload);
46090
+ enqueueAndDrain(eventKey, event.payload, traitName);
45720
46091
  });
45721
46092
  unsubscribes.push(() => {
45722
46093
  crossTraitLog.debug("self:unsubscribe", { traitName, busKey: selfBusKey, eventKey });