@almadar/ui 5.133.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 React84 from 'react';
2
- import React84__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId, useSyncExternalStore } from 'react';
1
+ import * as React85 from 'react';
2
+ import React85__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId, useSyncExternalStore } from 'react';
3
3
  import { EventBusContext, useTraitScopeChain, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath, useGameAudioContextOptional } from '@almadar/ui/providers';
4
4
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { clsx } from 'clsx';
@@ -430,7 +430,7 @@ var init_Box = __esm({
430
430
  fixed: "fixed",
431
431
  sticky: "sticky"
432
432
  };
433
- Box = React84__default.forwardRef(
433
+ Box = React85__default.forwardRef(
434
434
  ({
435
435
  padding,
436
436
  paddingX,
@@ -495,7 +495,7 @@ var init_Box = __esm({
495
495
  onPointerDown?.(e);
496
496
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
497
497
  const isClickable = action || onClick;
498
- return React84__default.createElement(
498
+ return React85__default.createElement(
499
499
  Component,
500
500
  {
501
501
  ref,
@@ -712,7 +712,7 @@ var init_Icon = __esm({
712
712
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
713
713
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
714
714
  const family = useIconFamily();
715
- const RenderedComponent = React84__default.useMemo(() => {
715
+ const RenderedComponent = React85__default.useMemo(() => {
716
716
  if (directIcon) return null;
717
717
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
718
718
  }, [directIcon, effectiveName, family]);
@@ -832,7 +832,7 @@ var init_atlasSlice = __esm({
832
832
  }
833
833
  });
834
834
  function useAtlasSliceDataUrl(asset) {
835
- const [, bump] = React84.useReducer((x) => x + 1, 0);
835
+ const [, bump] = React85.useReducer((x) => x + 1, 0);
836
836
  if (!isAtlasAsset(asset)) return void 0;
837
837
  const key = `${asset.atlas}#${asset.sprite}`;
838
838
  const cached = sliceDataUrlCache.get(key);
@@ -895,13 +895,13 @@ function AtlasImage({
895
895
  style,
896
896
  "aria-hidden": ariaHidden
897
897
  }) {
898
- const [, bump] = React84.useReducer((x) => x + 1, 0);
899
- const canvasRef = React84.useRef(null);
898
+ const [, bump] = React85.useReducer((x) => x + 1, 0);
899
+ const canvasRef = React85.useRef(null);
900
900
  const sliced = isAtlasAsset(asset);
901
901
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
902
902
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
903
903
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
904
- React84.useEffect(() => {
904
+ React85.useEffect(() => {
905
905
  const canvas = canvasRef.current;
906
906
  if (!canvas || !img || !rect) return;
907
907
  canvas.width = rect.sw;
@@ -977,7 +977,7 @@ function resolveIconProp(value, sizeClass) {
977
977
  const IconComp = value;
978
978
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
979
979
  }
980
- if (React84__default.isValidElement(value)) {
980
+ if (React85__default.isValidElement(value)) {
981
981
  return value;
982
982
  }
983
983
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -1054,7 +1054,7 @@ var init_Button = __esm({
1054
1054
  md: "h-icon-default w-icon-default",
1055
1055
  lg: "h-icon-default w-icon-default"
1056
1056
  };
1057
- Button = React84__default.forwardRef(
1057
+ Button = React85__default.forwardRef(
1058
1058
  ({
1059
1059
  className,
1060
1060
  variant = "primary",
@@ -1124,7 +1124,7 @@ var Dialog;
1124
1124
  var init_Dialog = __esm({
1125
1125
  "components/core/atoms/Dialog.tsx"() {
1126
1126
  init_cn();
1127
- Dialog = React84__default.forwardRef(
1127
+ Dialog = React85__default.forwardRef(
1128
1128
  ({
1129
1129
  role = "dialog",
1130
1130
  "aria-modal": ariaModal = true,
@@ -1147,6 +1147,61 @@ var init_Dialog = __esm({
1147
1147
  }
1148
1148
  });
1149
1149
 
1150
+ // lib/format.ts
1151
+ function humanizeFieldName(name) {
1152
+ 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();
1153
+ }
1154
+ function humanizeEnumValue(value) {
1155
+ return /^[a-z0-9]+(?:[_-][a-z0-9]+)+$/.test(value) ? humanizeFieldName(value) : value;
1156
+ }
1157
+ function formatDate(value) {
1158
+ if (!value) return "";
1159
+ const d = new Date(String(value));
1160
+ if (isNaN(d.getTime())) return String(value);
1161
+ return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
1162
+ }
1163
+ function formatTime(value) {
1164
+ if (!value) return "";
1165
+ const d = new Date(String(value));
1166
+ if (isNaN(d.getTime())) return String(value);
1167
+ return d.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
1168
+ }
1169
+ function formatDateTime(value) {
1170
+ if (!value) return "";
1171
+ const d = new Date(String(value));
1172
+ if (isNaN(d.getTime())) return String(value);
1173
+ return `${formatDate(value)} ${formatTime(value)}`;
1174
+ }
1175
+ function asYesNo(value) {
1176
+ return value === false || value === 0 || String(value) === "false" ? "No" : "Yes";
1177
+ }
1178
+ function formatValue(value, format) {
1179
+ if (value === void 0 || value === null) return "";
1180
+ if (typeof value === "boolean") return asYesNo(value);
1181
+ switch (format) {
1182
+ case "date":
1183
+ return formatDate(value);
1184
+ case "time":
1185
+ return formatTime(value);
1186
+ case "datetime":
1187
+ return formatDateTime(value);
1188
+ case "currency":
1189
+ return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
1190
+ case "number":
1191
+ return typeof value === "number" ? value.toLocaleString() : String(value);
1192
+ case "percent":
1193
+ return typeof value === "number" ? `${Math.round(value)}%` : String(value);
1194
+ case "boolean":
1195
+ return asYesNo(value);
1196
+ default:
1197
+ return String(value);
1198
+ }
1199
+ }
1200
+ var init_format = __esm({
1201
+ "lib/format.ts"() {
1202
+ }
1203
+ });
1204
+
1150
1205
  // components/core/atoms/Typography.tsx
1151
1206
  var Typography_exports = {};
1152
1207
  __export(Typography_exports, {
@@ -1156,6 +1211,7 @@ var variantStyles2, colorStyles, weightStyles, defaultElements, typographySizeSt
1156
1211
  var init_Typography = __esm({
1157
1212
  "components/core/atoms/Typography.tsx"() {
1158
1213
  init_cn();
1214
+ init_format();
1159
1215
  variantStyles2 = {
1160
1216
  h1: "text-4xl font-bold tracking-tight text-foreground",
1161
1217
  h2: "text-3xl font-bold tracking-tight text-foreground",
@@ -1243,12 +1299,17 @@ var init_Typography = __esm({
1243
1299
  id,
1244
1300
  className,
1245
1301
  style,
1302
+ format,
1246
1303
  content,
1247
1304
  children
1248
1305
  }) => {
1249
1306
  const variant = variantProp ?? (level ? `h${level}` : "body1");
1250
1307
  const Component = as || defaultElements[variant];
1251
- return React84__default.createElement(
1308
+ let body = children ?? content;
1309
+ if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
1310
+ body = formatValue(body, format);
1311
+ }
1312
+ return React85__default.createElement(
1252
1313
  Component,
1253
1314
  {
1254
1315
  id,
@@ -1264,7 +1325,7 @@ var init_Typography = __esm({
1264
1325
  ),
1265
1326
  style
1266
1327
  },
1267
- children ?? content
1328
+ body
1268
1329
  );
1269
1330
  };
1270
1331
  Typography.displayName = "Typography";
@@ -1811,7 +1872,7 @@ var init_Badge = __esm({
1811
1872
  md: "px-2.5 py-1 text-sm",
1812
1873
  lg: "px-3 py-1.5 text-base"
1813
1874
  };
1814
- Badge = React84__default.forwardRef(
1875
+ Badge = React85__default.forwardRef(
1815
1876
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
1816
1877
  const iconSizes3 = {
1817
1878
  sm: "h-icon-default w-icon-default",
@@ -2161,7 +2222,7 @@ var init_SvgFlow = __esm({
2161
2222
  width = 100,
2162
2223
  height = 100
2163
2224
  }) => {
2164
- const markerId = React84__default.useMemo(() => {
2225
+ const markerId = React85__default.useMemo(() => {
2165
2226
  flowIdCounter += 1;
2166
2227
  return `almadar-flow-arrow-${flowIdCounter}`;
2167
2228
  }, []);
@@ -2754,7 +2815,7 @@ var init_SvgRing = __esm({
2754
2815
  width = 100,
2755
2816
  height = 100
2756
2817
  }) => {
2757
- const gradientId = React84__default.useMemo(() => {
2818
+ const gradientId = React85__default.useMemo(() => {
2758
2819
  ringIdCounter += 1;
2759
2820
  return `almadar-ring-glow-${ringIdCounter}`;
2760
2821
  }, []);
@@ -2935,7 +2996,7 @@ var init_Input = __esm({
2935
2996
  init_cn();
2936
2997
  init_Icon();
2937
2998
  init_useEventBus();
2938
- Input = React84__default.forwardRef(
2999
+ Input = React85__default.forwardRef(
2939
3000
  ({
2940
3001
  className,
2941
3002
  inputType,
@@ -3103,7 +3164,7 @@ var Label;
3103
3164
  var init_Label = __esm({
3104
3165
  "components/core/atoms/Label.tsx"() {
3105
3166
  init_cn();
3106
- Label = React84__default.forwardRef(
3167
+ Label = React85__default.forwardRef(
3107
3168
  ({ className, required, children, ...props }, ref) => {
3108
3169
  return /* @__PURE__ */ jsxs(
3109
3170
  "label",
@@ -3130,7 +3191,7 @@ var init_Textarea = __esm({
3130
3191
  "components/core/atoms/Textarea.tsx"() {
3131
3192
  init_cn();
3132
3193
  init_useEventBus();
3133
- Textarea = React84__default.forwardRef(
3194
+ Textarea = React85__default.forwardRef(
3134
3195
  ({ className, error, onChange, ...props }, ref) => {
3135
3196
  const eventBus = useEventBus();
3136
3197
  const handleChange = (e) => {
@@ -3369,7 +3430,7 @@ var init_Select = __esm({
3369
3430
  init_cn();
3370
3431
  init_Icon();
3371
3432
  init_useEventBus();
3372
- Select = React84__default.forwardRef(
3433
+ Select = React85__default.forwardRef(
3373
3434
  (props, _ref) => {
3374
3435
  const { multiple, searchable, clearable } = props;
3375
3436
  if (multiple || searchable || clearable) {
@@ -3386,7 +3447,7 @@ var init_Checkbox = __esm({
3386
3447
  "components/core/atoms/Checkbox.tsx"() {
3387
3448
  init_cn();
3388
3449
  init_useEventBus();
3389
- Checkbox = React84__default.forwardRef(
3450
+ Checkbox = React85__default.forwardRef(
3390
3451
  ({ className, label, id, onChange, ...props }, ref) => {
3391
3452
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
3392
3453
  const eventBus = useEventBus();
@@ -3440,7 +3501,7 @@ var init_Spinner = __esm({
3440
3501
  md: "h-6 w-6",
3441
3502
  lg: "h-8 w-8"
3442
3503
  };
3443
- Spinner = React84__default.forwardRef(
3504
+ Spinner = React85__default.forwardRef(
3444
3505
  ({ className, size = "md", overlay, ...props }, ref) => {
3445
3506
  if (overlay) {
3446
3507
  return /* @__PURE__ */ jsx(
@@ -3530,7 +3591,7 @@ var init_Card = __esm({
3530
3591
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
3531
3592
  "tile-image-first": "p-0 overflow-hidden"
3532
3593
  };
3533
- Card = React84__default.forwardRef(
3594
+ Card = React85__default.forwardRef(
3534
3595
  ({
3535
3596
  className,
3536
3597
  variant = "bordered",
@@ -3579,9 +3640,9 @@ var init_Card = __esm({
3579
3640
  }
3580
3641
  );
3581
3642
  Card.displayName = "Card";
3582
- CardHeader = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3643
+ CardHeader = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3583
3644
  CardHeader.displayName = "CardHeader";
3584
- CardTitle = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3645
+ CardTitle = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3585
3646
  "h3",
3586
3647
  {
3587
3648
  ref,
@@ -3594,11 +3655,11 @@ var init_Card = __esm({
3594
3655
  }
3595
3656
  ));
3596
3657
  CardTitle.displayName = "CardTitle";
3597
- CardContent = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3658
+ CardContent = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3598
3659
  CardContent.displayName = "CardContent";
3599
3660
  CardBody = CardContent;
3600
3661
  CardBody.displayName = "CardBody";
3601
- CardFooter = React84__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3662
+ CardFooter = React85__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3602
3663
  "div",
3603
3664
  {
3604
3665
  ref,
@@ -3685,7 +3746,7 @@ var init_FilterPill = __esm({
3685
3746
  md: "w-3.5 h-3.5",
3686
3747
  lg: "w-4 h-4"
3687
3748
  };
3688
- FilterPill = React84__default.forwardRef(
3749
+ FilterPill = React85__default.forwardRef(
3689
3750
  ({
3690
3751
  className,
3691
3752
  variant = "default",
@@ -3814,8 +3875,8 @@ var init_Avatar = __esm({
3814
3875
  actionPayload
3815
3876
  }) => {
3816
3877
  const eventBus = useEventBus();
3817
- const [imgFailed, setImgFailed] = React84__default.useState(false);
3818
- React84__default.useEffect(() => {
3878
+ const [imgFailed, setImgFailed] = React85__default.useState(false);
3879
+ React85__default.useEffect(() => {
3819
3880
  setImgFailed(false);
3820
3881
  }, [src]);
3821
3882
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -3928,7 +3989,7 @@ var init_Center = __esm({
3928
3989
  as: Component = "div"
3929
3990
  }) => {
3930
3991
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
3931
- return React84__default.createElement(Component, {
3992
+ return React85__default.createElement(Component, {
3932
3993
  className: cn(
3933
3994
  inline ? "inline-flex" : "flex",
3934
3995
  horizontal && "justify-center",
@@ -4196,7 +4257,7 @@ var init_Radio = __esm({
4196
4257
  md: "w-2.5 h-2.5",
4197
4258
  lg: "w-3 h-3"
4198
4259
  };
4199
- Radio = React84__default.forwardRef(
4260
+ Radio = React85__default.forwardRef(
4200
4261
  ({
4201
4262
  label,
4202
4263
  helperText,
@@ -4213,12 +4274,12 @@ var init_Radio = __esm({
4213
4274
  onChange,
4214
4275
  ...props
4215
4276
  }, ref) => {
4216
- const reactId = React84__default.useId();
4277
+ const reactId = React85__default.useId();
4217
4278
  const baseId = id || `radio-${reactId}`;
4218
4279
  const hasError = !!error;
4219
4280
  const eventBus = useEventBus();
4220
- const [selected, setSelected] = React84__default.useState(value);
4221
- React84__default.useEffect(() => {
4281
+ const [selected, setSelected] = React85__default.useState(value);
4282
+ React85__default.useEffect(() => {
4222
4283
  if (value !== void 0) setSelected(value);
4223
4284
  }, [value]);
4224
4285
  const pick = (next, e) => {
@@ -4400,7 +4461,7 @@ var init_Switch = __esm({
4400
4461
  "components/core/atoms/Switch.tsx"() {
4401
4462
  "use client";
4402
4463
  init_cn();
4403
- Switch = React84.forwardRef(
4464
+ Switch = React85.forwardRef(
4404
4465
  ({
4405
4466
  checked,
4406
4467
  defaultChecked = false,
@@ -4411,10 +4472,10 @@ var init_Switch = __esm({
4411
4472
  name,
4412
4473
  className
4413
4474
  }, ref) => {
4414
- const [isChecked, setIsChecked] = React84.useState(
4475
+ const [isChecked, setIsChecked] = React85.useState(
4415
4476
  checked !== void 0 ? checked : defaultChecked
4416
4477
  );
4417
- React84.useEffect(() => {
4478
+ React85.useEffect(() => {
4418
4479
  if (checked !== void 0) {
4419
4480
  setIsChecked(checked);
4420
4481
  }
@@ -4577,7 +4638,7 @@ var init_Stack = __esm({
4577
4638
  };
4578
4639
  const isHorizontal = direction === "horizontal";
4579
4640
  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";
4580
- return React84__default.createElement(
4641
+ return React85__default.createElement(
4581
4642
  Component,
4582
4643
  {
4583
4644
  className: cn(
@@ -4777,7 +4838,7 @@ var Aside;
4777
4838
  var init_Aside = __esm({
4778
4839
  "components/core/atoms/Aside.tsx"() {
4779
4840
  init_cn();
4780
- Aside = React84__default.forwardRef(
4841
+ Aside = React85__default.forwardRef(
4781
4842
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4782
4843
  );
4783
4844
  Aside.displayName = "Aside";
@@ -4856,9 +4917,9 @@ var init_LawReferenceTooltip = __esm({
4856
4917
  className
4857
4918
  }) => {
4858
4919
  const { t } = useTranslate();
4859
- const [isVisible, setIsVisible] = React84__default.useState(false);
4860
- const timeoutRef = React84__default.useRef(null);
4861
- const triggerRef = React84__default.useRef(null);
4920
+ const [isVisible, setIsVisible] = React85__default.useState(false);
4921
+ const timeoutRef = React85__default.useRef(null);
4922
+ const triggerRef = React85__default.useRef(null);
4862
4923
  const handleMouseEnter = () => {
4863
4924
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4864
4925
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4869,7 +4930,7 @@ var init_LawReferenceTooltip = __esm({
4869
4930
  };
4870
4931
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
4871
4932
  const open = isVisible || revealed;
4872
- React84__default.useEffect(() => {
4933
+ React85__default.useEffect(() => {
4873
4934
  return () => {
4874
4935
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4875
4936
  };
@@ -5079,7 +5140,7 @@ var init_StatusDot = __esm({
5079
5140
  md: "w-2.5 h-2.5",
5080
5141
  lg: "w-3 h-3"
5081
5142
  };
5082
- StatusDot = React84__default.forwardRef(
5143
+ StatusDot = React85__default.forwardRef(
5083
5144
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
5084
5145
  return /* @__PURE__ */ jsx(
5085
5146
  "span",
@@ -5133,7 +5194,7 @@ var init_TrendIndicator = __esm({
5133
5194
  down: "trending-down",
5134
5195
  flat: "arrow-right"
5135
5196
  };
5136
- TrendIndicator = React84__default.forwardRef(
5197
+ TrendIndicator = React85__default.forwardRef(
5137
5198
  ({
5138
5199
  className,
5139
5200
  value,
@@ -5202,7 +5263,7 @@ var init_RangeSlider = __esm({
5202
5263
  md: "w-4 h-4",
5203
5264
  lg: "w-5 h-5"
5204
5265
  };
5205
- RangeSlider = React84__default.forwardRef(
5266
+ RangeSlider = React85__default.forwardRef(
5206
5267
  ({
5207
5268
  className,
5208
5269
  min = 0,
@@ -5813,7 +5874,7 @@ var init_ContentSection = __esm({
5813
5874
  md: "py-16",
5814
5875
  lg: "py-24"
5815
5876
  };
5816
- ContentSection = React84__default.forwardRef(
5877
+ ContentSection = React85__default.forwardRef(
5817
5878
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5818
5879
  return /* @__PURE__ */ jsx(
5819
5880
  Box,
@@ -6347,7 +6408,7 @@ var init_AnimatedReveal = __esm({
6347
6408
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
6348
6409
  "none": {}
6349
6410
  };
6350
- AnimatedReveal = React84__default.forwardRef(
6411
+ AnimatedReveal = React85__default.forwardRef(
6351
6412
  ({
6352
6413
  trigger = "scroll",
6353
6414
  animation = "fade-up",
@@ -6507,7 +6568,7 @@ var init_AnimatedGraphic = __esm({
6507
6568
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6508
6569
  "use client";
6509
6570
  init_cn();
6510
- AnimatedGraphic = React84__default.forwardRef(
6571
+ AnimatedGraphic = React85__default.forwardRef(
6511
6572
  ({
6512
6573
  src,
6513
6574
  svgContent,
@@ -6530,7 +6591,7 @@ var init_AnimatedGraphic = __esm({
6530
6591
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6531
6592
  const resolvedSvg = svgContent ?? fetchedSvg;
6532
6593
  const prevAnimateRef = useRef(animate);
6533
- const setRef = React84__default.useCallback(
6594
+ const setRef = React85__default.useCallback(
6534
6595
  (node) => {
6535
6596
  containerRef.current = node;
6536
6597
  if (typeof ref === "function") ref(node);
@@ -7259,9 +7320,9 @@ function ControlButton({
7259
7320
  className
7260
7321
  }) {
7261
7322
  const eventBus = useEventBus();
7262
- const [isPressed, setIsPressed] = React84.useState(false);
7323
+ const [isPressed, setIsPressed] = React85.useState(false);
7263
7324
  const actualPressed = pressed ?? isPressed;
7264
- const handlePointerDown = React84.useCallback(
7325
+ const handlePointerDown = React85.useCallback(
7265
7326
  (e) => {
7266
7327
  e.preventDefault();
7267
7328
  if (disabled) return;
@@ -7271,7 +7332,7 @@ function ControlButton({
7271
7332
  },
7272
7333
  [disabled, pressEvent, eventBus, onPress]
7273
7334
  );
7274
- const handlePointerUp = React84.useCallback(
7335
+ const handlePointerUp = React85.useCallback(
7275
7336
  (e) => {
7276
7337
  e.preventDefault();
7277
7338
  if (disabled) return;
@@ -7281,7 +7342,7 @@ function ControlButton({
7281
7342
  },
7282
7343
  [disabled, releaseEvent, eventBus, onRelease]
7283
7344
  );
7284
- const handlePointerLeave = React84.useCallback(
7345
+ const handlePointerLeave = React85.useCallback(
7285
7346
  (e) => {
7286
7347
  if (isPressed) {
7287
7348
  setIsPressed(false);
@@ -7352,7 +7413,7 @@ var init_ControlButton = __esm({
7352
7413
  ControlButton.displayName = "ControlButton";
7353
7414
  }
7354
7415
  });
7355
- function formatTime(seconds, format) {
7416
+ function formatTime2(seconds, format) {
7356
7417
  const clamped = Math.max(0, Math.floor(seconds));
7357
7418
  if (format === "ss") {
7358
7419
  return `${clamped}s`;
@@ -7389,7 +7450,7 @@ function TimerDisplay({
7389
7450
  ),
7390
7451
  children: [
7391
7452
  iconAsset && /* @__PURE__ */ jsx(GameIcon, { assetUrl: iconAsset, icon: "image", size: 16, className: "w-4 h-4 object-contain flex-shrink-0" }),
7392
- formatTime(seconds, format)
7453
+ formatTime2(seconds, format)
7393
7454
  ]
7394
7455
  }
7395
7456
  );
@@ -7522,6 +7583,210 @@ var init_ChoiceButton = __esm({
7522
7583
  ChoiceButton.displayName = "ChoiceButton";
7523
7584
  }
7524
7585
  });
7586
+ function SvgStage({
7587
+ cols,
7588
+ rows,
7589
+ tileSize = 32,
7590
+ background = "var(--color-background)",
7591
+ tileClickEvent,
7592
+ tileHoverEvent,
7593
+ tileLeaveEvent,
7594
+ keyMap,
7595
+ keyUpMap,
7596
+ className,
7597
+ children
7598
+ }) {
7599
+ const eventBus = useEventBus();
7600
+ const svgRef = useRef(null);
7601
+ const pointerDownRef = useRef(null);
7602
+ const cellFromClient = useCallback((clientX, clientY) => {
7603
+ const svg = svgRef.current;
7604
+ if (!svg) return null;
7605
+ const rect = svg.getBoundingClientRect();
7606
+ if (rect.width === 0 || rect.height === 0) return null;
7607
+ const vbW = cols * tileSize;
7608
+ const vbH = rows * tileSize;
7609
+ const meet = Math.min(rect.width / vbW, rect.height / vbH);
7610
+ const offsetX = (rect.width - vbW * meet) / 2;
7611
+ const offsetY = (rect.height - vbH * meet) / 2;
7612
+ const svgX = (clientX - rect.left - offsetX) / meet;
7613
+ const svgY = (clientY - rect.top - offsetY) / meet;
7614
+ return {
7615
+ x: Math.min(Math.max(Math.floor(svgX / tileSize), 0), cols - 1),
7616
+ y: Math.min(Math.max(Math.floor(svgY / tileSize), 0), rows - 1)
7617
+ };
7618
+ }, [cols, rows, tileSize]);
7619
+ const handlePointerDown = useCallback((e) => {
7620
+ pointerDownRef.current = { clientX: e.clientX, clientY: e.clientY };
7621
+ }, []);
7622
+ const handlePointerUp = useCallback((e) => {
7623
+ const down = pointerDownRef.current;
7624
+ pointerDownRef.current = null;
7625
+ if (!tileClickEvent) return;
7626
+ if (down && Math.hypot(e.clientX - down.clientX, e.clientY - down.clientY) > 5) return;
7627
+ const cell = cellFromClient(e.clientX, e.clientY);
7628
+ if (cell) eventBus.emit(`UI:${tileClickEvent}`, cell);
7629
+ }, [cellFromClient, tileClickEvent, eventBus]);
7630
+ const handlePointerMove = useCallback((e) => {
7631
+ if (!tileHoverEvent) return;
7632
+ const cell = cellFromClient(e.clientX, e.clientY);
7633
+ if (cell) eventBus.emit(`UI:${tileHoverEvent}`, cell);
7634
+ }, [cellFromClient, tileHoverEvent, eventBus]);
7635
+ const handlePointerLeave = useCallback(() => {
7636
+ pointerDownRef.current = null;
7637
+ if (tileLeaveEvent) eventBus.emit(`UI:${tileLeaveEvent}`, {});
7638
+ }, [tileLeaveEvent, eventBus]);
7639
+ useEffect(() => {
7640
+ if (!keyMap && !keyUpMap) return;
7641
+ const onDown = (e) => {
7642
+ const ev = keyMap?.[e.code];
7643
+ if (ev) {
7644
+ eventBus.emit(`UI:${ev}`, {});
7645
+ e.preventDefault();
7646
+ }
7647
+ };
7648
+ const onUp = (e) => {
7649
+ const ev = keyUpMap?.[e.code];
7650
+ if (ev) eventBus.emit(`UI:${ev}`, {});
7651
+ };
7652
+ window.addEventListener("keydown", onDown);
7653
+ window.addEventListener("keyup", onUp);
7654
+ return () => {
7655
+ window.removeEventListener("keydown", onDown);
7656
+ window.removeEventListener("keyup", onUp);
7657
+ };
7658
+ }, [keyMap, keyUpMap, eventBus]);
7659
+ useEffect(() => {
7660
+ if (!keyMap && !keyUpMap) return;
7661
+ svgRef.current?.focus();
7662
+ }, [keyMap, keyUpMap]);
7663
+ const stageContext = useMemo(() => ({ tileSize }), [tileSize]);
7664
+ return /* @__PURE__ */ jsxs(
7665
+ "svg",
7666
+ {
7667
+ ref: svgRef,
7668
+ "data-testid": "svg-stage",
7669
+ viewBox: `0 0 ${cols * tileSize} ${rows * tileSize}`,
7670
+ preserveAspectRatio: "xMidYMid meet",
7671
+ className: cn("block h-full w-full", className),
7672
+ tabIndex: keyMap || keyUpMap ? 0 : void 0,
7673
+ onPointerDown: handlePointerDown,
7674
+ onPointerMove: handlePointerMove,
7675
+ onPointerUp: handlePointerUp,
7676
+ onPointerLeave: handlePointerLeave,
7677
+ children: [
7678
+ /* @__PURE__ */ jsx("rect", { width: cols * tileSize, height: rows * tileSize, fill: background }),
7679
+ /* @__PURE__ */ jsx(SvgStageContext.Provider, { value: stageContext, children })
7680
+ ]
7681
+ }
7682
+ );
7683
+ }
7684
+ var SvgStageContext;
7685
+ var init_SvgStage = __esm({
7686
+ "components/game/molecules/SvgStage.tsx"() {
7687
+ "use client";
7688
+ init_cn();
7689
+ init_useEventBus();
7690
+ SvgStageContext = React85.createContext({ tileSize: 1 });
7691
+ SvgStage.displayName = "SvgStage";
7692
+ }
7693
+ });
7694
+ function SvgDrawShape({
7695
+ shape,
7696
+ x,
7697
+ y,
7698
+ width,
7699
+ height,
7700
+ radius,
7701
+ radiusY,
7702
+ points,
7703
+ d,
7704
+ x2,
7705
+ y2,
7706
+ fill,
7707
+ stroke,
7708
+ strokeWidth,
7709
+ opacity,
7710
+ className
7711
+ }) {
7712
+ const { tileSize } = useContext(SvgStageContext);
7713
+ const cell = (v) => v === void 0 ? void 0 : v * tileSize;
7714
+ const paint = {
7715
+ fill: fill ?? (stroke === void 0 ? "var(--color-primary)" : "none"),
7716
+ stroke,
7717
+ strokeWidth,
7718
+ opacity,
7719
+ className
7720
+ };
7721
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${x * tileSize} ${y * tileSize})`, children: [
7722
+ shape === "rect" && /* @__PURE__ */ jsx("rect", { width: cell(width), height: cell(height), ...paint }),
7723
+ shape === "circle" && /* @__PURE__ */ jsx("circle", { r: cell(radius), ...paint }),
7724
+ shape === "ellipse" && /* @__PURE__ */ jsx("ellipse", { rx: cell(radius), ry: cell(radiusY ?? radius), ...paint }),
7725
+ shape === "polygon" && /* @__PURE__ */ jsx("polygon", { points, ...paint }),
7726
+ shape === "polyline" && /* @__PURE__ */ jsx("polyline", { points, ...paint }),
7727
+ shape === "path" && /* @__PURE__ */ jsx("path", { d, ...paint }),
7728
+ shape === "line" && /* @__PURE__ */ jsx("line", { x2: cell(x2), y2: cell(y2), ...paint })
7729
+ ] });
7730
+ }
7731
+ var init_SvgDrawShape = __esm({
7732
+ "components/game/atoms/SvgDrawShape.tsx"() {
7733
+ "use client";
7734
+ init_SvgStage();
7735
+ SvgDrawShape.displayName = "SvgDrawShape";
7736
+ }
7737
+ });
7738
+ function SvgDrawGroup({
7739
+ x = 0,
7740
+ y = 0,
7741
+ scale,
7742
+ rotate,
7743
+ opacity,
7744
+ className,
7745
+ children
7746
+ }) {
7747
+ const { tileSize } = useContext(SvgStageContext);
7748
+ const transforms = [`translate(${x * tileSize} ${y * tileSize})`];
7749
+ if (rotate !== void 0) transforms.push(`rotate(${rotate})`);
7750
+ if (scale !== void 0) transforms.push(`scale(${scale})`);
7751
+ return /* @__PURE__ */ jsx("g", { transform: transforms.join(" "), opacity, className, children });
7752
+ }
7753
+ var init_SvgDrawGroup = __esm({
7754
+ "components/game/atoms/SvgDrawGroup.tsx"() {
7755
+ "use client";
7756
+ init_SvgStage();
7757
+ SvgDrawGroup.displayName = "SvgDrawGroup";
7758
+ }
7759
+ });
7760
+ function SvgDrawText({
7761
+ x,
7762
+ y,
7763
+ text,
7764
+ size = 12,
7765
+ fill = "var(--color-foreground)",
7766
+ anchor = "middle",
7767
+ className
7768
+ }) {
7769
+ const { tileSize } = useContext(SvgStageContext);
7770
+ return /* @__PURE__ */ jsx(
7771
+ "text",
7772
+ {
7773
+ x: x * tileSize,
7774
+ y: y * tileSize,
7775
+ fontSize: size,
7776
+ fill,
7777
+ textAnchor: anchor,
7778
+ className,
7779
+ children: text
7780
+ }
7781
+ );
7782
+ }
7783
+ var init_SvgDrawText = __esm({
7784
+ "components/game/atoms/SvgDrawText.tsx"() {
7785
+ "use client";
7786
+ init_SvgStage();
7787
+ SvgDrawText.displayName = "SvgDrawText";
7788
+ }
7789
+ });
7525
7790
  function ControlGrid({
7526
7791
  kind,
7527
7792
  buttons = DEFAULT_BUTTONS,
@@ -7539,8 +7804,8 @@ function ControlGrid({
7539
7804
  className
7540
7805
  }) {
7541
7806
  const eventBus = useEventBus();
7542
- const [active, setActive] = React84.useState(/* @__PURE__ */ new Set());
7543
- const handlePress = React84.useCallback(
7807
+ const [active, setActive] = React85.useState(/* @__PURE__ */ new Set());
7808
+ const handlePress = React85.useCallback(
7544
7809
  (id) => {
7545
7810
  setActive((prev) => new Set(prev).add(id));
7546
7811
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -7554,7 +7819,7 @@ function ControlGrid({
7554
7819
  },
7555
7820
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
7556
7821
  );
7557
- const handleRelease = React84.useCallback(
7822
+ const handleRelease = React85.useCallback(
7558
7823
  (id) => {
7559
7824
  setActive((prev) => {
7560
7825
  const next = new Set(prev);
@@ -7912,7 +8177,7 @@ function GameMenu({
7912
8177
  }) {
7913
8178
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
7914
8179
  const eventBus = useEventBus();
7915
- const handleOptionClick = React84.useCallback(
8180
+ const handleOptionClick = React85.useCallback(
7916
8181
  (option) => {
7917
8182
  if (option.event) {
7918
8183
  eventBus.emit(`UI:${option.event}`, { option });
@@ -8148,7 +8413,7 @@ function StateGraph({
8148
8413
  }) {
8149
8414
  const eventBus = useEventBus();
8150
8415
  const nodes = states ?? [];
8151
- const positions = React84.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8416
+ const positions = React85.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
8152
8417
  return /* @__PURE__ */ jsxs(
8153
8418
  Box,
8154
8419
  {
@@ -8219,8 +8484,8 @@ function MiniMap({
8219
8484
  tileAssets,
8220
8485
  unitAssets
8221
8486
  }) {
8222
- const canvasRef = React84.useRef(null);
8223
- const imgCacheRef = React84.useRef(/* @__PURE__ */ new Map());
8487
+ const canvasRef = React85.useRef(null);
8488
+ const imgCacheRef = React85.useRef(/* @__PURE__ */ new Map());
8224
8489
  function loadImg(url) {
8225
8490
  const cached = imgCacheRef.current.get(url);
8226
8491
  if (cached) return cached.complete ? cached : null;
@@ -8235,7 +8500,7 @@ function MiniMap({
8235
8500
  imgCacheRef.current.set(url, img);
8236
8501
  return null;
8237
8502
  }
8238
- React84.useEffect(() => {
8503
+ React85.useEffect(() => {
8239
8504
  const canvas = canvasRef.current;
8240
8505
  if (!canvas) return;
8241
8506
  const ctx = canvas.getContext("2d");
@@ -9547,6 +9812,32 @@ var init_Canvas = __esm({
9547
9812
  Canvas.displayName = "Canvas";
9548
9813
  }
9549
9814
  });
9815
+ function SvgDrawShapeLayer({
9816
+ items,
9817
+ fill,
9818
+ stroke,
9819
+ strokeWidth,
9820
+ opacity
9821
+ }) {
9822
+ return /* @__PURE__ */ jsx("g", { children: items.map(({ id, ...shape }) => /* @__PURE__ */ jsx(
9823
+ SvgDrawShape,
9824
+ {
9825
+ ...shape,
9826
+ fill: shape.fill ?? fill,
9827
+ stroke: shape.stroke ?? stroke,
9828
+ strokeWidth: shape.strokeWidth ?? strokeWidth,
9829
+ opacity: shape.opacity ?? opacity
9830
+ },
9831
+ id
9832
+ )) });
9833
+ }
9834
+ var init_SvgDrawShapeLayer = __esm({
9835
+ "components/game/molecules/SvgDrawShapeLayer.tsx"() {
9836
+ "use client";
9837
+ init_SvgDrawShape();
9838
+ SvgDrawShapeLayer.displayName = "SvgDrawShapeLayer";
9839
+ }
9840
+ });
9550
9841
  function GameAudioToggle({
9551
9842
  size = "sm",
9552
9843
  className,
@@ -9930,7 +10221,7 @@ function LinearView({
9930
10221
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
9931
10222
  const isDone = i < currentIdx;
9932
10223
  const isCurrent = i === currentIdx;
9933
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
10224
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
9934
10225
  i > 0 && /* @__PURE__ */ jsx(
9935
10226
  Typography,
9936
10227
  {
@@ -10465,7 +10756,7 @@ function SequenceBar({
10465
10756
  else onSlotRemove?.(index);
10466
10757
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
10467
10758
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
10468
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
10759
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
10469
10760
  i > 0 && /* @__PURE__ */ jsx(
10470
10761
  Typography,
10471
10762
  {
@@ -11114,7 +11405,7 @@ var init_ErrorBoundary = __esm({
11114
11405
  }
11115
11406
  );
11116
11407
  };
11117
- ErrorBoundary = class extends React84__default.Component {
11408
+ ErrorBoundary = class extends React85__default.Component {
11118
11409
  constructor(props) {
11119
11410
  super(props);
11120
11411
  __publicField(this, "reset", () => {
@@ -11766,7 +12057,7 @@ var init_Container = __esm({
11766
12057
  as: Component = "div"
11767
12058
  }) => {
11768
12059
  const resolvedSize = maxWidth ?? size ?? "lg";
11769
- return React84__default.createElement(
12060
+ return React85__default.createElement(
11770
12061
  Component,
11771
12062
  {
11772
12063
  className: cn(
@@ -14731,7 +15022,7 @@ var init_CodeBlock = __esm({
14731
15022
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
14732
15023
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
14733
15024
  HIDDEN_LINE_NUMBERS = { display: "none" };
14734
- CodeBlock = React84__default.memo(
15025
+ CodeBlock = React85__default.memo(
14735
15026
  ({
14736
15027
  code: rawCode,
14737
15028
  language = "text",
@@ -15319,7 +15610,7 @@ var init_MarkdownContent = __esm({
15319
15610
  init_Box();
15320
15611
  init_CodeBlock();
15321
15612
  init_cn();
15322
- MarkdownContent = React84__default.memo(
15613
+ MarkdownContent = React85__default.memo(
15323
15614
  ({ content, direction = "ltr", className }) => {
15324
15615
  const { t: _t } = useTranslate();
15325
15616
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -16646,7 +16937,7 @@ var init_StateMachineView = __esm({
16646
16937
  style: { top: title ? 30 : 0 },
16647
16938
  children: [
16648
16939
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
16649
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React84__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
16940
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React85__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
16650
16941
  StateNode2,
16651
16942
  {
16652
16943
  state,
@@ -19391,9 +19682,6 @@ function normalizeFields(fields) {
19391
19682
  if (!fields) return [];
19392
19683
  return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
19393
19684
  }
19394
- function fieldLabel(key) {
19395
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
19396
- }
19397
19685
  function asBooleanValue(value) {
19398
19686
  if (typeof value === "boolean") return value;
19399
19687
  if (value === "true") return true;
@@ -19404,12 +19692,6 @@ function isDateField(key) {
19404
19692
  const lower = key.toLowerCase();
19405
19693
  return lower.includes("date") || lower.includes("time") || lower.endsWith("at") || lower.endsWith("_at");
19406
19694
  }
19407
- function formatDate(value) {
19408
- if (!value) return "";
19409
- const d = new Date(String(value));
19410
- if (isNaN(d.getTime())) return String(value);
19411
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
19412
- }
19413
19695
  function statusVariant(value) {
19414
19696
  const v = value.toLowerCase();
19415
19697
  if (["active", "completed", "done", "approved", "published", "resolved", "open"].includes(v)) return "success";
@@ -19418,11 +19700,12 @@ function statusVariant(value) {
19418
19700
  if (["new", "created", "scheduled", "queued"].includes(v)) return "info";
19419
19701
  return "default";
19420
19702
  }
19421
- var STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
19703
+ var fieldLabel, STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
19422
19704
  var init_CardGrid = __esm({
19423
19705
  "components/core/organisms/CardGrid.tsx"() {
19424
19706
  "use client";
19425
19707
  init_cn();
19708
+ init_format();
19426
19709
  init_getNestedValue();
19427
19710
  init_useEventBus();
19428
19711
  init_atoms();
@@ -19431,6 +19714,7 @@ var init_CardGrid = __esm({
19431
19714
  init_Typography();
19432
19715
  init_Stack();
19433
19716
  init_Pagination();
19717
+ fieldLabel = humanizeFieldName;
19434
19718
  STATUS_FIELDS = /* @__PURE__ */ new Set(["status", "state", "priority", "type", "category", "role", "level", "tier"]);
19435
19719
  gapStyles3 = {
19436
19720
  none: "gap-0",
@@ -19938,7 +20222,7 @@ var init_CaseStudyOrganism = __esm({
19938
20222
  CaseStudyOrganism.displayName = "CaseStudyOrganism";
19939
20223
  }
19940
20224
  });
19941
- var CHART_COLORS, seriesColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
20225
+ var CHART_COLORS, seriesColor, barColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
19942
20226
  var init_Chart = __esm({
19943
20227
  "components/core/molecules/Chart.tsx"() {
19944
20228
  "use client";
@@ -19958,6 +20242,7 @@ var init_Chart = __esm({
19958
20242
  "var(--color-accent)"
19959
20243
  ];
19960
20244
  seriesColor = (series, idx) => series.color ?? CHART_COLORS[idx % CHART_COLORS.length];
20245
+ barColor = (series, sIdx, catIdx, seriesCount) => series.color ?? CHART_COLORS[(seriesCount === 1 ? catIdx : sIdx) % CHART_COLORS.length];
19961
20246
  monthFormatter = new Intl.DateTimeFormat(void 0, {
19962
20247
  month: "short",
19963
20248
  year: "2-digit"
@@ -20030,7 +20315,7 @@ var init_Chart = __esm({
20030
20315
  children: series.map((s, sIdx) => {
20031
20316
  const value = valueAt(s, label);
20032
20317
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
20033
- const color = seriesColor(s, sIdx);
20318
+ const color = barColor(s, sIdx, catIdx, series.length);
20034
20319
  return /* @__PURE__ */ jsx(
20035
20320
  Box,
20036
20321
  {
@@ -20085,7 +20370,7 @@ var init_Chart = __esm({
20085
20370
  /* @__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) => {
20086
20371
  const value = valueAt(s, label);
20087
20372
  const barHeight = value / maxValue * 100;
20088
- const color = seriesColor(s, sIdx);
20373
+ const color = barColor(s, sIdx, catIdx, series.length);
20089
20374
  return /* @__PURE__ */ jsx(
20090
20375
  Box,
20091
20376
  {
@@ -20136,7 +20421,7 @@ var init_Chart = __esm({
20136
20421
  /* @__PURE__ */ jsx(VStack, { gap: "none", className: "w-full flex-1 min-h-0", justify: "end", children: series.map((s, sIdx) => {
20137
20422
  const value = valueAt(s, label);
20138
20423
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
20139
- const color = seriesColor(s, sIdx);
20424
+ const color = barColor(s, sIdx, catIdx, series.length);
20140
20425
  return /* @__PURE__ */ jsx(
20141
20426
  Box,
20142
20427
  {
@@ -22474,8 +22759,8 @@ var init_Menu = __esm({
22474
22759
  "bottom-end": "bottom-start"
22475
22760
  };
22476
22761
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
22477
- const triggerChild = React84__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
22478
- const triggerElement = React84__default.cloneElement(
22762
+ const triggerChild = React85__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
22763
+ const triggerElement = React85__default.cloneElement(
22479
22764
  triggerChild,
22480
22765
  {
22481
22766
  ref: triggerRef,
@@ -22570,14 +22855,14 @@ function useDataDnd(args) {
22570
22855
  const isZone = Boolean(dragGroup || accepts || sortable);
22571
22856
  const enabled = isZone || Boolean(dndRoot);
22572
22857
  const eventBus = useEventBus();
22573
- const parentRoot = React84__default.useContext(RootCtx);
22858
+ const parentRoot = React85__default.useContext(RootCtx);
22574
22859
  const isRoot = enabled && parentRoot === null;
22575
- const zoneId = React84__default.useId();
22860
+ const zoneId = React85__default.useId();
22576
22861
  const ownGroup = dragGroup ?? accepts ?? zoneId;
22577
- const [optimisticOrders, setOptimisticOrders] = React84__default.useState(() => /* @__PURE__ */ new Map());
22578
- const optimisticOrdersRef = React84__default.useRef(optimisticOrders);
22862
+ const [optimisticOrders, setOptimisticOrders] = React85__default.useState(() => /* @__PURE__ */ new Map());
22863
+ const optimisticOrdersRef = React85__default.useRef(optimisticOrders);
22579
22864
  optimisticOrdersRef.current = optimisticOrders;
22580
- const clearOptimisticOrder = React84__default.useCallback((group) => {
22865
+ const clearOptimisticOrder = React85__default.useCallback((group) => {
22581
22866
  setOptimisticOrders((prev) => {
22582
22867
  if (!prev.has(group)) return prev;
22583
22868
  const next = new Map(prev);
@@ -22602,7 +22887,7 @@ function useDataDnd(args) {
22602
22887
  const raw = it[dndItemIdField];
22603
22888
  return raw != null ? String(raw) : `__idx_${idx}`;
22604
22889
  }).join("|");
22605
- const itemIds = React84__default.useMemo(
22890
+ const itemIds = React85__default.useMemo(
22606
22891
  () => orderedItems.map((it, idx) => {
22607
22892
  const raw = it[dndItemIdField];
22608
22893
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -22613,7 +22898,7 @@ function useDataDnd(args) {
22613
22898
  const raw = it[dndItemIdField];
22614
22899
  return raw != null ? String(raw) : `__${idx}`;
22615
22900
  }).join("|");
22616
- React84__default.useEffect(() => {
22901
+ React85__default.useEffect(() => {
22617
22902
  const root = isRoot ? null : parentRoot;
22618
22903
  if (root) {
22619
22904
  root.clearOptimisticOrder(ownGroup);
@@ -22621,20 +22906,20 @@ function useDataDnd(args) {
22621
22906
  clearOptimisticOrder(ownGroup);
22622
22907
  }
22623
22908
  }, [itemsContentSig, ownGroup]);
22624
- const zonesRef = React84__default.useRef(/* @__PURE__ */ new Map());
22625
- const registerZone = React84__default.useCallback((zoneId2, meta2) => {
22909
+ const zonesRef = React85__default.useRef(/* @__PURE__ */ new Map());
22910
+ const registerZone = React85__default.useCallback((zoneId2, meta2) => {
22626
22911
  zonesRef.current.set(zoneId2, meta2);
22627
22912
  }, []);
22628
- const unregisterZone = React84__default.useCallback((zoneId2) => {
22913
+ const unregisterZone = React85__default.useCallback((zoneId2) => {
22629
22914
  zonesRef.current.delete(zoneId2);
22630
22915
  }, []);
22631
- const [activeDrag, setActiveDrag] = React84__default.useState(null);
22632
- const [overZoneGroup, setOverZoneGroup] = React84__default.useState(null);
22633
- const meta = React84__default.useMemo(
22916
+ const [activeDrag, setActiveDrag] = React85__default.useState(null);
22917
+ const [overZoneGroup, setOverZoneGroup] = React85__default.useState(null);
22918
+ const meta = React85__default.useMemo(
22634
22919
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
22635
22920
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
22636
22921
  );
22637
- React84__default.useEffect(() => {
22922
+ React85__default.useEffect(() => {
22638
22923
  const target = isRoot ? null : parentRoot;
22639
22924
  if (!target) {
22640
22925
  zonesRef.current.set(zoneId, meta);
@@ -22653,7 +22938,7 @@ function useDataDnd(args) {
22653
22938
  }, [parentRoot, isRoot, zoneId, meta]);
22654
22939
  const sensors = useAlmadarDndSensors(true);
22655
22940
  const collisionDetection = almadarDndCollisionDetection;
22656
- const findZoneByItem = React84__default.useCallback(
22941
+ const findZoneByItem = React85__default.useCallback(
22657
22942
  (id) => {
22658
22943
  for (const z of zonesRef.current.values()) {
22659
22944
  if (z.itemIds.includes(id)) return z;
@@ -22662,7 +22947,7 @@ function useDataDnd(args) {
22662
22947
  },
22663
22948
  []
22664
22949
  );
22665
- React84__default.useCallback(
22950
+ React85__default.useCallback(
22666
22951
  (group) => {
22667
22952
  for (const z of zonesRef.current.values()) {
22668
22953
  if (z.group === group) return z;
@@ -22671,7 +22956,7 @@ function useDataDnd(args) {
22671
22956
  },
22672
22957
  []
22673
22958
  );
22674
- const handleDragEnd = React84__default.useCallback(
22959
+ const handleDragEnd = React85__default.useCallback(
22675
22960
  (event) => {
22676
22961
  const { active, over } = event;
22677
22962
  const activeIdStr = String(active.id);
@@ -22762,8 +23047,8 @@ function useDataDnd(args) {
22762
23047
  },
22763
23048
  [eventBus]
22764
23049
  );
22765
- const sortableData = React84__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22766
- const SortableItem = React84__default.useCallback(
23050
+ const sortableData = React85__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
23051
+ const SortableItem = React85__default.useCallback(
22767
23052
  ({ id, children }) => {
22768
23053
  const {
22769
23054
  attributes,
@@ -22803,7 +23088,7 @@ function useDataDnd(args) {
22803
23088
  id: droppableId,
22804
23089
  data: sortableData
22805
23090
  });
22806
- const ctx = React84__default.useContext(RootCtx);
23091
+ const ctx = React85__default.useContext(RootCtx);
22807
23092
  const activeDrag2 = ctx?.activeDrag ?? null;
22808
23093
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22809
23094
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22818,7 +23103,7 @@ function useDataDnd(args) {
22818
23103
  showForeignPlaceholder,
22819
23104
  ctxAvailable: ctx != null
22820
23105
  });
22821
- React84__default.useEffect(() => {
23106
+ React85__default.useEffect(() => {
22822
23107
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22823
23108
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22824
23109
  return /* @__PURE__ */ jsx(
@@ -22832,11 +23117,11 @@ function useDataDnd(args) {
22832
23117
  }
22833
23118
  );
22834
23119
  };
22835
- const rootContextValue = React84__default.useMemo(
23120
+ const rootContextValue = React85__default.useMemo(
22836
23121
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22837
23122
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22838
23123
  );
22839
- const handleDragStart = React84__default.useCallback((event) => {
23124
+ const handleDragStart = React85__default.useCallback((event) => {
22840
23125
  const sourceZone = findZoneByItem(event.active.id);
22841
23126
  const rect = event.active.rect.current.initial;
22842
23127
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22855,7 +23140,7 @@ function useDataDnd(args) {
22855
23140
  isRoot
22856
23141
  });
22857
23142
  }, [findZoneByItem, isRoot, zoneId]);
22858
- const handleDragOver = React84__default.useCallback((event) => {
23143
+ const handleDragOver = React85__default.useCallback((event) => {
22859
23144
  const { active, over } = event;
22860
23145
  const overData = over?.data?.current;
22861
23146
  const overGroup = overData?.dndGroup ?? null;
@@ -22925,7 +23210,7 @@ function useDataDnd(args) {
22925
23210
  return next;
22926
23211
  });
22927
23212
  }, []);
22928
- const handleDragCancel = React84__default.useCallback((event) => {
23213
+ const handleDragCancel = React85__default.useCallback((event) => {
22929
23214
  setActiveDrag(null);
22930
23215
  setOverZoneGroup(null);
22931
23216
  dndLog.warn("dragCancel", {
@@ -22933,12 +23218,12 @@ function useDataDnd(args) {
22933
23218
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22934
23219
  });
22935
23220
  }, []);
22936
- const handleDragEndWithCleanup = React84__default.useCallback((event) => {
23221
+ const handleDragEndWithCleanup = React85__default.useCallback((event) => {
22937
23222
  handleDragEnd(event);
22938
23223
  setActiveDrag(null);
22939
23224
  setOverZoneGroup(null);
22940
23225
  }, [handleDragEnd]);
22941
- const wrapContainer = React84__default.useCallback(
23226
+ const wrapContainer = React85__default.useCallback(
22942
23227
  (children) => {
22943
23228
  if (!enabled) return children;
22944
23229
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -22992,15 +23277,12 @@ var init_useDataDnd = __esm({
22992
23277
  init_useAlmadarDndCollision();
22993
23278
  init_Box();
22994
23279
  dndLog = createLogger("almadar:ui:dnd");
22995
- RootCtx = React84__default.createContext(null);
23280
+ RootCtx = React85__default.createContext(null);
22996
23281
  }
22997
23282
  });
22998
23283
  function renderIconInput(icon, props) {
22999
23284
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
23000
23285
  }
23001
- function fieldLabel2(key) {
23002
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
23003
- }
23004
23286
  function statusVariant2(value) {
23005
23287
  const v = value.toLowerCase();
23006
23288
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -23019,29 +23301,6 @@ function resolveBadgeVariant(field, value) {
23019
23301
  }
23020
23302
  return statusVariant2(value);
23021
23303
  }
23022
- function formatDate2(value) {
23023
- if (!value) return "";
23024
- const d = new Date(String(value));
23025
- if (isNaN(d.getTime())) return String(value);
23026
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
23027
- }
23028
- function formatValue(value, format) {
23029
- if (value === void 0 || value === null) return "";
23030
- switch (format) {
23031
- case "date":
23032
- return formatDate2(value);
23033
- case "currency":
23034
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
23035
- case "number":
23036
- return typeof value === "number" ? value.toLocaleString() : String(value);
23037
- case "percent":
23038
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
23039
- case "boolean":
23040
- return value ? "Yes" : "No";
23041
- default:
23042
- return String(value);
23043
- }
23044
- }
23045
23304
  function DataGrid({
23046
23305
  entity,
23047
23306
  fields,
@@ -23328,7 +23587,7 @@ function DataGrid({
23328
23587
  if (val === void 0 || val === null || val === "") return null;
23329
23588
  return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
23330
23589
  field.icon && renderIconInput(field.icon, { size: "xs" }),
23331
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: formatValue(val, field.format) })
23590
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: humanizeEnumValue(formatValue(val, field.format)) })
23332
23591
  ] }, field.name);
23333
23592
  }) })
23334
23593
  ] }),
@@ -23438,11 +23697,12 @@ function DataGrid({
23438
23697
  ] })
23439
23698
  );
23440
23699
  }
23441
- var dataGridLog, BADGE_VARIANTS, gapStyles5, lookStyles5;
23700
+ var dataGridLog, fieldLabel2, BADGE_VARIANTS, gapStyles5, lookStyles5;
23442
23701
  var init_DataGrid = __esm({
23443
23702
  "components/core/molecules/DataGrid.tsx"() {
23444
23703
  "use client";
23445
23704
  init_cn();
23705
+ init_format();
23446
23706
  init_getNestedValue();
23447
23707
  init_useEventBus();
23448
23708
  init_Box();
@@ -23455,6 +23715,7 @@ var init_DataGrid = __esm({
23455
23715
  init_Menu();
23456
23716
  init_useDataDnd();
23457
23717
  dataGridLog = createLogger("almadar:ui:data-grid");
23718
+ fieldLabel2 = humanizeFieldName;
23458
23719
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
23459
23720
  "default",
23460
23721
  "primary",
@@ -23486,9 +23747,6 @@ var init_DataGrid = __esm({
23486
23747
  function renderIconInput2(icon, props) {
23487
23748
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
23488
23749
  }
23489
- function fieldLabel3(key) {
23490
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
23491
- }
23492
23750
  function statusVariant3(value) {
23493
23751
  const v = value.toLowerCase();
23494
23752
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -23497,28 +23755,12 @@ function statusVariant3(value) {
23497
23755
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
23498
23756
  return "default";
23499
23757
  }
23500
- function formatDate3(value) {
23501
- if (!value) return "";
23502
- const d = new Date(String(value));
23503
- if (isNaN(d.getTime())) return String(value);
23504
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
23505
- }
23506
23758
  function formatValue2(value, format, boolLabels) {
23507
- if (value === void 0 || value === null) return "";
23508
- switch (format) {
23509
- case "date":
23510
- return formatDate3(value);
23511
- case "currency":
23512
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
23513
- case "number":
23514
- return typeof value === "number" ? value.toLocaleString() : String(value);
23515
- case "percent":
23516
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
23517
- case "boolean":
23518
- return value ? boolLabels?.yes ?? "Yes" : boolLabels?.no ?? "No";
23519
- default:
23520
- return String(value);
23759
+ if (value !== void 0 && value !== null && (format === "boolean" || typeof value === "boolean")) {
23760
+ const isNo = value === false || value === 0 || String(value) === "false";
23761
+ return isNo ? boolLabels?.no ?? "No" : boolLabels?.yes ?? "Yes";
23521
23762
  }
23763
+ return formatValue(value, format);
23522
23764
  }
23523
23765
  function groupData(items, field) {
23524
23766
  const groups = /* @__PURE__ */ new Map();
@@ -23541,7 +23783,9 @@ function DataList({
23541
23783
  variant = "default",
23542
23784
  groupBy,
23543
23785
  senderField,
23786
+ senderLabelField,
23544
23787
  currentUser,
23788
+ emptyMessage,
23545
23789
  className,
23546
23790
  isLoading = false,
23547
23791
  error = null,
@@ -23573,7 +23817,7 @@ function DataList({
23573
23817
  }) {
23574
23818
  const eventBus = useEventBus();
23575
23819
  const { t } = useTranslate();
23576
- const [visibleCount, setVisibleCount] = React84__default.useState(pageSize || Infinity);
23820
+ const [visibleCount, setVisibleCount] = React85__default.useState(pageSize || Infinity);
23577
23821
  const fieldDefs = fields ?? columns ?? [];
23578
23822
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
23579
23823
  const dnd = useDataDnd({
@@ -23592,7 +23836,7 @@ function DataList({
23592
23836
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
23593
23837
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
23594
23838
  const hasRenderProp = typeof children === "function";
23595
- React84__default.useEffect(() => {
23839
+ React85__default.useEffect(() => {
23596
23840
  const renderItemTypeOf = typeof schemaRenderItem;
23597
23841
  const childrenTypeOf = typeof children;
23598
23842
  if (data.length > 0 && !hasRenderProp) {
@@ -23680,7 +23924,7 @@ function DataList({
23680
23924
  return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
23681
23925
  }
23682
23926
  if (data.length === 0) {
23683
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") }) });
23927
+ const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
23684
23928
  return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
23685
23929
  }
23686
23930
  const gapClass = {
@@ -23696,51 +23940,93 @@ function DataList({
23696
23940
  const items2 = [...data];
23697
23941
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
23698
23942
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
23699
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
23700
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
23701
- group.items.map((itemData, index) => {
23702
- const id = itemData.id || `${gi}-${index}`;
23703
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
23704
- const isSent = Boolean(currentUser && sender === currentUser);
23705
- const content = getNestedValue(itemData, contentField);
23706
- const timestampField = fieldDefs.find((f3) => f3.format === "date");
23707
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
23708
- return /* @__PURE__ */ jsx(
23709
- Box,
23710
- {
23711
- className: cn(
23712
- "flex px-4",
23713
- isSent ? "justify-end" : "justify-start"
23714
- ),
23715
- children: /* @__PURE__ */ jsxs(
23716
- Box,
23717
- {
23718
- className: cn(
23719
- "max-w-[75%] px-4 py-2",
23720
- isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
23721
- ),
23722
- children: [
23723
- !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
23724
- /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
23725
- timestamp != null ? /* @__PURE__ */ jsx(
23726
- Typography,
23727
- {
23728
- variant: "caption",
23729
- className: cn(
23730
- "mt-1 text-xs",
23731
- isSent ? "opacity-70" : "text-muted-foreground"
23732
- ),
23733
- children: formatDate3(timestamp)
23734
- }
23735
- ) : null
23736
- ]
23737
- }
23738
- )
23739
- },
23740
- id
23741
- );
23742
- })
23743
- ] }, gi)) });
23943
+ const senderLabel = (itemData, raw) => {
23944
+ if (!senderLabelField) return raw;
23945
+ const v = getNestedValue(itemData, senderLabelField);
23946
+ return v === void 0 || v === null || v === "" ? raw : String(v);
23947
+ };
23948
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
23949
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
23950
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
23951
+ group.items.map((itemData, index) => {
23952
+ const id = itemData.id || `${gi}-${index}`;
23953
+ const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
23954
+ const isSent = Boolean(currentUser && sender === currentUser);
23955
+ const content = getNestedValue(itemData, contentField);
23956
+ const timestampField = fieldDefs.find((f3) => f3.format === "date");
23957
+ const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
23958
+ const metaFields = fieldDefs.filter(
23959
+ (f3) => f3.name !== contentField && f3.name !== timestampField?.name
23960
+ );
23961
+ return /* @__PURE__ */ jsx(
23962
+ Box,
23963
+ {
23964
+ "data-entity-row": true,
23965
+ "data-entity-id": id,
23966
+ onClick: itemClickEvent ? handleRowClick(itemData) : void 0,
23967
+ className: cn(
23968
+ "flex px-4 group/rowactions",
23969
+ itemClickEvent && "cursor-pointer",
23970
+ isSent ? "justify-end" : "justify-start"
23971
+ ),
23972
+ children: /* @__PURE__ */ jsxs(
23973
+ Box,
23974
+ {
23975
+ className: cn(
23976
+ "max-w-[75%] px-4 py-2",
23977
+ isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
23978
+ ),
23979
+ children: [
23980
+ !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
23981
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
23982
+ metaFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
23983
+ const v = getNestedValue(itemData, f3.name);
23984
+ if (v === void 0 || v === null || v === "") return null;
23985
+ return f3.variant === "badge" ? /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(v)), children: String(v) }, f3.name) : /* @__PURE__ */ jsx(
23986
+ Typography,
23987
+ {
23988
+ variant: "caption",
23989
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
23990
+ children: formatValue2(v, f3.format)
23991
+ },
23992
+ f3.name
23993
+ );
23994
+ }) }),
23995
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "mt-1 items-center justify-between", children: [
23996
+ timestamp != null ? /* @__PURE__ */ jsx(
23997
+ Typography,
23998
+ {
23999
+ variant: "caption",
24000
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
24001
+ children: formatDate(timestamp)
24002
+ }
24003
+ ) : /* @__PURE__ */ jsx("span", {}),
24004
+ renderItemActions(itemData)
24005
+ ] })
24006
+ ]
24007
+ }
24008
+ )
24009
+ },
24010
+ id
24011
+ );
24012
+ })
24013
+ ] }, gi)),
24014
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
24015
+ Button,
24016
+ {
24017
+ variant: "ghost",
24018
+ size: "sm",
24019
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
24020
+ children: [
24021
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
24022
+ t("common.showMore"),
24023
+ " (",
24024
+ t("common.remaining", { count: allData.length - visibleCount }),
24025
+ ")"
24026
+ ]
24027
+ }
24028
+ ) })
24029
+ ] });
23744
24030
  }
23745
24031
  const items = [...data];
23746
24032
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
@@ -23855,7 +24141,7 @@ function DataList({
23855
24141
  className
23856
24142
  ),
23857
24143
  children: [
23858
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
24144
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
23859
24145
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23860
24146
  group.items.map(
23861
24147
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -23889,11 +24175,12 @@ function DataList({
23889
24175
  )
23890
24176
  );
23891
24177
  }
23892
- var dataListLog, listLookStyles;
24178
+ var dataListLog, fieldLabel3, listLookStyles;
23893
24179
  var init_DataList = __esm({
23894
24180
  "components/core/molecules/DataList.tsx"() {
23895
24181
  "use client";
23896
24182
  init_cn();
24183
+ init_format();
23897
24184
  init_getNestedValue();
23898
24185
  init_useEventBus();
23899
24186
  init_Box();
@@ -23908,6 +24195,7 @@ var init_DataList = __esm({
23908
24195
  init_Menu();
23909
24196
  init_useDataDnd();
23910
24197
  dataListLog = createLogger("almadar:ui:data-list");
24198
+ fieldLabel3 = humanizeFieldName;
23911
24199
  listLookStyles = {
23912
24200
  dense: "[&_[data-entity-row]>div]:!py-1 [&_[data-entity-row]>div]:!px-3",
23913
24201
  spacious: "[&_[data-entity-row]>div]:!py-5 [&_[data-entity-row]>div]:!px-8",
@@ -23940,7 +24228,7 @@ var init_FormSection = __esm({
23940
24228
  columns = 1,
23941
24229
  className
23942
24230
  }) => {
23943
- const [collapsed, setCollapsed] = React84__default.useState(defaultCollapsed);
24231
+ const [collapsed, setCollapsed] = React85__default.useState(defaultCollapsed);
23944
24232
  const { t } = useTranslate();
23945
24233
  const eventBus = useEventBus();
23946
24234
  const gridClass = {
@@ -23948,7 +24236,7 @@ var init_FormSection = __esm({
23948
24236
  2: "grid-cols-1 md:grid-cols-2",
23949
24237
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
23950
24238
  }[columns];
23951
- React84__default.useCallback(() => {
24239
+ React85__default.useCallback(() => {
23952
24240
  if (collapsible) {
23953
24241
  setCollapsed((prev) => !prev);
23954
24242
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -24817,7 +25105,7 @@ var init_Flex = __esm({
24817
25105
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
24818
25106
  }
24819
25107
  }
24820
- return React84__default.createElement(Component, {
25108
+ return React85__default.createElement(Component, {
24821
25109
  className: cn(
24822
25110
  inline ? "inline-flex" : "flex",
24823
25111
  directionStyles[direction],
@@ -24936,7 +25224,7 @@ var init_Grid = __esm({
24936
25224
  as: Component = "div"
24937
25225
  }) => {
24938
25226
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
24939
- return React84__default.createElement(
25227
+ return React85__default.createElement(
24940
25228
  Component,
24941
25229
  {
24942
25230
  className: cn(
@@ -25144,9 +25432,9 @@ var init_Popover = __esm({
25144
25432
  onMouseLeave: handleClose,
25145
25433
  onPointerDown: tapTriggerProps.onPointerDown
25146
25434
  };
25147
- const childElement = React84__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25435
+ const childElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25148
25436
  const childPointerDown = childElement.props.onPointerDown;
25149
- const triggerElement = React84__default.cloneElement(
25437
+ const triggerElement = React85__default.cloneElement(
25150
25438
  childElement,
25151
25439
  {
25152
25440
  ref: triggerRef,
@@ -25755,9 +26043,9 @@ var init_Tooltip = __esm({
25755
26043
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
25756
26044
  };
25757
26045
  }, []);
25758
- const triggerElement = React84__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
26046
+ const triggerElement = React85__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
25759
26047
  const childPointerDown = triggerElement.props.onPointerDown;
25760
- const trigger = React84__default.cloneElement(triggerElement, {
26048
+ const trigger = React85__default.cloneElement(triggerElement, {
25761
26049
  ref: triggerRef,
25762
26050
  onMouseEnter: handleMouseEnter,
25763
26051
  onMouseLeave: handleMouseLeave,
@@ -25847,7 +26135,7 @@ var init_WizardProgress = __esm({
25847
26135
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
25848
26136
  const isActive = index === currentStep;
25849
26137
  const isCompleted = index < currentStep;
25850
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
26138
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
25851
26139
  /* @__PURE__ */ jsx(
25852
26140
  "button",
25853
26141
  {
@@ -27408,13 +27696,13 @@ var init_MapView = __esm({
27408
27696
  shadowSize: [41, 41]
27409
27697
  });
27410
27698
  L.Marker.prototype.options.icon = defaultIcon;
27411
- const { useEffect: useEffect62, useRef: useRef60, useCallback: useCallback94, useState: useState91 } = React84__default;
27699
+ const { useEffect: useEffect63, useRef: useRef61, useCallback: useCallback95, useState: useState91 } = React85__default;
27412
27700
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
27413
27701
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
27414
27702
  function MapUpdater({ centerLat, centerLng, zoom }) {
27415
27703
  const map = useMap();
27416
- const prevRef = useRef60({ centerLat, centerLng, zoom });
27417
- useEffect62(() => {
27704
+ const prevRef = useRef61({ centerLat, centerLng, zoom });
27705
+ useEffect63(() => {
27418
27706
  const prev = prevRef.current;
27419
27707
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
27420
27708
  map.setView([centerLat, centerLng], zoom);
@@ -27425,7 +27713,7 @@ var init_MapView = __esm({
27425
27713
  }
27426
27714
  function MapClickHandler({ onMapClick }) {
27427
27715
  const map = useMap();
27428
- useEffect62(() => {
27716
+ useEffect63(() => {
27429
27717
  if (!onMapClick) return;
27430
27718
  const handler = (e) => {
27431
27719
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -27454,7 +27742,7 @@ var init_MapView = __esm({
27454
27742
  }) {
27455
27743
  const eventBus = useEventBus2();
27456
27744
  const [clickedPosition, setClickedPosition] = useState91(null);
27457
- const handleMapClick = useCallback94((lat, lng) => {
27745
+ const handleMapClick = useCallback95((lat, lng) => {
27458
27746
  if (showClickedPin) {
27459
27747
  setClickedPosition({ lat, lng });
27460
27748
  }
@@ -27463,7 +27751,7 @@ var init_MapView = __esm({
27463
27751
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
27464
27752
  }
27465
27753
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
27466
- const handleMarkerClick = useCallback94((marker) => {
27754
+ const handleMarkerClick = useCallback95((marker) => {
27467
27755
  onMarkerClick?.(marker);
27468
27756
  if (markerClickEvent) {
27469
27757
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -28263,7 +28551,7 @@ function renderIconInput3(icon, props) {
28263
28551
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
28264
28552
  }
28265
28553
  function columnLabel(col) {
28266
- return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
28554
+ return col.header ?? col.label ?? humanizeFieldName(col.key);
28267
28555
  }
28268
28556
  function asFieldValue(v) {
28269
28557
  if (v === void 0 || v === null) return v;
@@ -28282,25 +28570,6 @@ function statusVariant4(value) {
28282
28570
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
28283
28571
  return "default";
28284
28572
  }
28285
- function formatCell(value, format) {
28286
- if (value === void 0 || value === null) return "";
28287
- switch (format) {
28288
- case "date": {
28289
- const d = new Date(String(value));
28290
- return isNaN(d.getTime()) ? String(value) : d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
28291
- }
28292
- case "currency":
28293
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
28294
- case "number":
28295
- return typeof value === "number" ? value.toLocaleString() : String(value);
28296
- case "percent":
28297
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
28298
- case "boolean":
28299
- return value ? "Yes" : "No";
28300
- default:
28301
- return String(value);
28302
- }
28303
- }
28304
28573
  function groupData2(items, field) {
28305
28574
  const groups = /* @__PURE__ */ new Map();
28306
28575
  for (const item of items) {
@@ -28344,9 +28613,10 @@ function TableView({
28344
28613
  }) {
28345
28614
  const eventBus = useEventBus();
28346
28615
  const { t } = useTranslate();
28347
- const [visibleCount, setVisibleCount] = React84__default.useState(pageSize > 0 ? pageSize : Infinity);
28348
- const [localSelected, setLocalSelected] = React84__default.useState(/* @__PURE__ */ new Set());
28349
- const colDefs = columns ?? fields ?? [];
28616
+ const [visibleCount, setVisibleCount] = React85__default.useState(pageSize > 0 ? pageSize : Infinity);
28617
+ const [localSelected, setLocalSelected] = React85__default.useState(/* @__PURE__ */ new Set());
28618
+ const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
28619
+ const actionDefs = Array.isArray(itemActions) ? itemActions : [];
28350
28620
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
28351
28621
  const dnd = useDataDnd({
28352
28622
  items: allDataRaw,
@@ -28366,6 +28636,23 @@ function TableView({
28366
28636
  const hasRenderProp = typeof children === "function";
28367
28637
  const idField = dndItemIdField ?? "id";
28368
28638
  const isCoarsePointer = useMediaQuery("(pointer: coarse)");
28639
+ React85__default.useEffect(() => {
28640
+ tableViewLog.debug("render", {
28641
+ rowCount: data.length,
28642
+ colCount: colDefs.length,
28643
+ look,
28644
+ isLoading: Boolean(isLoading),
28645
+ hasError: Boolean(error),
28646
+ dnd: dnd.enabled
28647
+ });
28648
+ if (data.length > 0 && !hasRenderProp && colDefs.length === 0) {
28649
+ tableViewLog.warn("columns-unresolved", {
28650
+ rowCount: data.length,
28651
+ columnsIsArray: Array.isArray(columns),
28652
+ fieldsIsArray: Array.isArray(fields)
28653
+ });
28654
+ }
28655
+ }, [data, colDefs, look, isLoading, error, dnd.enabled, hasRenderProp, columns, fields]);
28369
28656
  const selected = selectedIds ? new Set(selectedIds) : localSelected;
28370
28657
  const emitSelection = (next) => {
28371
28658
  if (!selectedIds) setLocalSelected(next);
@@ -28398,7 +28685,7 @@ function TableView({
28398
28685
  };
28399
28686
  eventBus.emit(`UI:${action.event}`, payload);
28400
28687
  };
28401
- const colFloors = React84__default.useMemo(
28688
+ const colFloors = React85__default.useMemo(
28402
28689
  () => colDefs.map((col) => {
28403
28690
  const longest = data.reduce((widest, row) => {
28404
28691
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -28409,21 +28696,12 @@ function TableView({
28409
28696
  }),
28410
28697
  [colDefs, data]
28411
28698
  );
28412
- if (isLoading) {
28413
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") }) });
28414
- }
28415
- if (error) {
28416
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
28417
- }
28418
- if (data.length === 0) {
28419
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
28420
- return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
28421
- }
28699
+ 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;
28422
28700
  const lk = LOOKS[look];
28423
- const hasActions = Boolean(itemActions && itemActions.length > 0);
28701
+ const hasActions = actionDefs.length > 0;
28424
28702
  const effectiveMaxInline = isCoarsePointer ? 0 : maxInlineActions;
28425
- const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(itemActions.length, effectiveMaxInline) : itemActions.length : 0;
28426
- const hasOverflowActions = hasActions && effectiveMaxInline != null && itemActions.length > effectiveMaxInline;
28703
+ const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(actionDefs.length, effectiveMaxInline) : actionDefs.length : 0;
28704
+ const hasOverflowActions = hasActions && effectiveMaxInline != null && actionDefs.length > effectiveMaxInline;
28427
28705
  const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
28428
28706
  const gridTemplateColumns = [
28429
28707
  selectable ? "auto" : null,
@@ -28511,11 +28789,11 @@ function TableView({
28511
28789
  col.className
28512
28790
  );
28513
28791
  if (col.format === "badge" && raw != null && raw !== "") {
28514
- 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);
28792
+ 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);
28515
28793
  }
28516
28794
  return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format) }) }, col.key);
28517
28795
  }),
28518
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(
28796
+ hasActions && /* @__PURE__ */ jsxs(
28519
28797
  HStack,
28520
28798
  {
28521
28799
  gap: "xs",
@@ -28527,7 +28805,7 @@ function TableView({
28527
28805
  lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
28528
28806
  ),
28529
28807
  children: [
28530
- (effectiveMaxInline != null ? itemActions.slice(0, effectiveMaxInline) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
28808
+ (effectiveMaxInline != null ? actionDefs.slice(0, effectiveMaxInline) : actionDefs).map((action, i) => /* @__PURE__ */ jsxs(
28531
28809
  Button,
28532
28810
  {
28533
28811
  variant: action.variant === "primary" ? "primary" : "ghost",
@@ -28543,12 +28821,12 @@ function TableView({
28543
28821
  },
28544
28822
  i
28545
28823
  )),
28546
- effectiveMaxInline != null && itemActions.length > effectiveMaxInline && /* @__PURE__ */ jsx(
28824
+ effectiveMaxInline != null && actionDefs.length > effectiveMaxInline && /* @__PURE__ */ jsx(
28547
28825
  Menu,
28548
28826
  {
28549
28827
  position: "bottom-end",
28550
28828
  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" }) }),
28551
- items: itemActions.slice(effectiveMaxInline).map((action) => ({
28829
+ items: actionDefs.slice(effectiveMaxInline).map((action) => ({
28552
28830
  label: action.label,
28553
28831
  icon: action.icon,
28554
28832
  event: action.event,
@@ -28566,24 +28844,25 @@ function TableView({
28566
28844
  ]
28567
28845
  }
28568
28846
  );
28569
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React84__default.Fragment, { children: rowInner }, id);
28847
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React85__default.Fragment, { children: rowInner }, id);
28570
28848
  };
28571
28849
  const items = Array.from(data);
28572
28850
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
28573
28851
  let runningIndex = 0;
28574
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
28852
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
28575
28853
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
28576
28854
  group.items.map((row) => renderRow(row, runningIndex++))
28577
28855
  ] }, gi)) });
28856
+ const showHeader = colDefs.length > 0 || hasRenderProp;
28578
28857
  return /* @__PURE__ */ jsxs(
28579
28858
  Box,
28580
28859
  {
28581
28860
  role: "table",
28582
28861
  className: cn("w-full text-sm", className),
28583
28862
  children: [
28584
- header,
28585
- dnd.wrapContainer(body),
28586
- 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: [
28863
+ showHeader && header,
28864
+ dnd.wrapContainer(statusNode ? /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: statusNode }) : body),
28865
+ !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: [
28587
28866
  /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
28588
28867
  t("common.showMore"),
28589
28868
  " (",
@@ -28594,11 +28873,12 @@ function TableView({
28594
28873
  }
28595
28874
  );
28596
28875
  }
28597
- var MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
28876
+ var tableViewLog, formatCell, MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
28598
28877
  var init_TableView = __esm({
28599
28878
  "components/core/molecules/TableView.tsx"() {
28600
28879
  "use client";
28601
28880
  init_cn();
28881
+ init_format();
28602
28882
  init_getNestedValue();
28603
28883
  init_useEventBus();
28604
28884
  init_useMediaQuery();
@@ -28612,7 +28892,8 @@ var init_TableView = __esm({
28612
28892
  init_Divider();
28613
28893
  init_Menu();
28614
28894
  init_useDataDnd();
28615
- createLogger("almadar:ui:table-view");
28895
+ tableViewLog = createLogger("almadar:ui:table-view");
28896
+ formatCell = (value, format) => formatValue(value, format);
28616
28897
  MAX_MEASURED_COL_CH = 32;
28617
28898
  BADGE_CHROME_CH = 4;
28618
28899
  alignClass = {
@@ -29931,7 +30212,7 @@ var init_StepFlow = __esm({
29931
30212
  className
29932
30213
  }) => {
29933
30214
  if (orientation === "vertical") {
29934
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React84__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30215
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
29935
30216
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
29936
30217
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
29937
30218
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -29942,7 +30223,7 @@ var init_StepFlow = __esm({
29942
30223
  ] })
29943
30224
  ] }) }, index)) });
29944
30225
  }
29945
- 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(React84__default.Fragment, { children: [
30226
+ 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(React85__default.Fragment, { children: [
29946
30227
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
29947
30228
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
29948
30229
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -30932,7 +31213,7 @@ var init_LikertScale = __esm({
30932
31213
  md: "text-base",
30933
31214
  lg: "text-lg"
30934
31215
  };
30935
- LikertScale = React84__default.forwardRef(
31216
+ LikertScale = React85__default.forwardRef(
30936
31217
  ({
30937
31218
  question,
30938
31219
  options = DEFAULT_LIKERT_OPTIONS,
@@ -30944,7 +31225,7 @@ var init_LikertScale = __esm({
30944
31225
  variant = "radios",
30945
31226
  className
30946
31227
  }, ref) => {
30947
- const groupId = React84__default.useId();
31228
+ const groupId = React85__default.useId();
30948
31229
  const eventBus = useEventBus();
30949
31230
  const handleSelect = useCallback(
30950
31231
  (next) => {
@@ -33233,7 +33514,7 @@ var init_DocBreadcrumb = __esm({
33233
33514
  "aria-label": t("aria.breadcrumb"),
33234
33515
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
33235
33516
  const isLast = idx === items.length - 1;
33236
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
33517
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
33237
33518
  idx > 0 && /* @__PURE__ */ jsx(
33238
33519
  Icon,
33239
33520
  {
@@ -34102,7 +34383,7 @@ var init_MiniStateMachine = __esm({
34102
34383
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
34103
34384
  const tc = transitionCounts[s.name] ?? 0;
34104
34385
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
34105
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
34386
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
34106
34387
  /* @__PURE__ */ jsx(
34107
34388
  AvlState,
34108
34389
  {
@@ -34306,7 +34587,7 @@ var init_PageHeader = __esm({
34306
34587
  info: "bg-info/10 text-info"
34307
34588
  };
34308
34589
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
34309
- 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(React84__default.Fragment, { children: [
34590
+ 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(React85__default.Fragment, { children: [
34310
34591
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
34311
34592
  crumb.href ? /* @__PURE__ */ jsx(
34312
34593
  "a",
@@ -34664,7 +34945,7 @@ var init_Section = __esm({
34664
34945
  as: Component = "section"
34665
34946
  }) => {
34666
34947
  const hasHeader = title || description || action;
34667
- return React84__default.createElement(
34948
+ return React85__default.createElement(
34668
34949
  Component,
34669
34950
  {
34670
34951
  className: cn(
@@ -35038,7 +35319,7 @@ var init_WizardContainer = __esm({
35038
35319
  const isCompleted = index < currentStep;
35039
35320
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
35040
35321
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
35041
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
35322
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
35042
35323
  /* @__PURE__ */ jsx(
35043
35324
  Button,
35044
35325
  {
@@ -35996,6 +36277,7 @@ var init_GraphCanvas = __esm({
35996
36277
  title,
35997
36278
  nodes: propNodes = NO_NODES,
35998
36279
  edges: propEdges = NO_EDGES,
36280
+ proposedEdges = NO_EDGES,
35999
36281
  similarity: propSimilarity = NO_SIM,
36000
36282
  height = 400,
36001
36283
  showLabels = true,
@@ -36003,6 +36285,7 @@ var init_GraphCanvas = __esm({
36003
36285
  draggable = true,
36004
36286
  actions,
36005
36287
  onNodeClick,
36288
+ onMarkClick,
36006
36289
  onNodeDoubleClick,
36007
36290
  onBadgeClick,
36008
36291
  nodeClickEvent,
@@ -36031,6 +36314,18 @@ var init_GraphCanvas = __esm({
36031
36314
  const laidOutRef = useRef(false);
36032
36315
  const [, forceUpdate] = useState(0);
36033
36316
  const [logicalW, setLogicalW] = useState(800);
36317
+ const hasProposed = useMemo(() => propNodes.some((n) => n.mark?.kind === "proposed"), [propNodes]);
36318
+ const [pulseTick, setPulseTick] = useState(0);
36319
+ useEffect(() => {
36320
+ if (!hasProposed) return;
36321
+ let raf = 0;
36322
+ const loop = () => {
36323
+ setPulseTick((t2) => (t2 + 1) % 1e6);
36324
+ raf = requestAnimationFrame(loop);
36325
+ };
36326
+ raf = requestAnimationFrame(loop);
36327
+ return () => cancelAnimationFrame(raf);
36328
+ }, [hasProposed]);
36034
36329
  useEffect(() => {
36035
36330
  const canvas = canvasRef.current;
36036
36331
  if (!canvas || typeof ResizeObserver === "undefined") return;
@@ -36332,18 +36627,38 @@ var init_GraphCanvas = __esm({
36332
36627
  }
36333
36628
  }
36334
36629
  ctx.globalAlpha = 1;
36630
+ ctx.setLineDash([4, 4]);
36631
+ for (const edge of proposedEdges) {
36632
+ const source = nodes.find((n) => n.id === edge.source);
36633
+ const target = nodes.find((n) => n.id === edge.target);
36634
+ if (!source || !target) continue;
36635
+ ctx.globalAlpha = 0.4;
36636
+ ctx.beginPath();
36637
+ ctx.moveTo(source.x, source.y);
36638
+ ctx.lineTo(target.x, target.y);
36639
+ ctx.strokeStyle = edge.color || mutedColor;
36640
+ ctx.lineWidth = 1;
36641
+ ctx.stroke();
36642
+ }
36643
+ ctx.setLineDash([]);
36644
+ ctx.globalAlpha = 1;
36335
36645
  for (const node of nodes) {
36336
36646
  const size = node.size || 8;
36337
36647
  const color = resolveColor3(node.color || getGroupColor(node.group, groups), canvas);
36338
36648
  const isHovered = hoveredNode === node.id;
36339
36649
  const isSelected = selectedNodeId !== void 0 && node.id === selectedNodeId;
36340
- ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 1;
36650
+ const mark = node.mark;
36651
+ ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : mark?.kind === "proposed" ? 0.55 : 1;
36341
36652
  const radius = isSelected ? size + 4 : isHovered ? size + 2 : size;
36342
36653
  ctx.beginPath();
36343
36654
  ctx.arc(node.x, node.y, radius, 0, Math.PI * 2);
36344
- ctx.fillStyle = color;
36655
+ ctx.fillStyle = mark?.kind === "proposed" ? mutedColor : color;
36345
36656
  ctx.fill();
36346
- if (isSelected) {
36657
+ if (mark?.kind === "proposed") {
36658
+ ctx.setLineDash([3, 3]);
36659
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
36660
+ ctx.lineWidth = 1.5;
36661
+ } else if (isSelected) {
36347
36662
  ctx.strokeStyle = accentColor;
36348
36663
  ctx.lineWidth = 3;
36349
36664
  } else {
@@ -36351,6 +36666,28 @@ var init_GraphCanvas = __esm({
36351
36666
  ctx.lineWidth = isHovered ? 2 : 1;
36352
36667
  }
36353
36668
  ctx.stroke();
36669
+ ctx.setLineDash([]);
36670
+ if (mark?.kind === "suggested") {
36671
+ ctx.beginPath();
36672
+ ctx.arc(node.x, node.y, radius + 3, 0, Math.PI * 2);
36673
+ ctx.strokeStyle = accentColor;
36674
+ ctx.lineWidth = 2;
36675
+ ctx.stroke();
36676
+ ctx.beginPath();
36677
+ ctx.arc(node.x + radius * 0.7, node.y - radius * 0.7, 2.5, 0, Math.PI * 2);
36678
+ ctx.fillStyle = accentColor;
36679
+ ctx.fill();
36680
+ } else if (mark?.kind === "proposed") {
36681
+ const phase = pulseTick % 60 / 60;
36682
+ const baseAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 0.55;
36683
+ ctx.globalAlpha = baseAlpha * (0.4 + 0.4 * (1 - Math.abs(phase * 2 - 1)));
36684
+ ctx.beginPath();
36685
+ ctx.arc(node.x, node.y, radius + 6 + Math.sin(phase * Math.PI * 2) * 3, 0, Math.PI * 2);
36686
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
36687
+ ctx.lineWidth = 1.5;
36688
+ ctx.stroke();
36689
+ ctx.globalAlpha = baseAlpha;
36690
+ }
36354
36691
  if (showLabels && node.label) {
36355
36692
  const displayLabel = truncateLabel(node.label);
36356
36693
  ctx.font = `${isSelected || isHovered ? "700" : "600"} 12px ${fontFamily}`;
@@ -36485,11 +36822,15 @@ var init_GraphCanvas = __esm({
36485
36822
  return;
36486
36823
  }
36487
36824
  }
36825
+ if (node.mark && onMarkClick) {
36826
+ onMarkClick(node);
36827
+ return;
36828
+ }
36488
36829
  handleNodeClick(node);
36489
36830
  }
36490
36831
  }
36491
36832
  },
36492
- [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
36833
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, onMarkClick, selectedNodeId]
36493
36834
  );
36494
36835
  const handlePointerLeave = useCallback(() => {
36495
36836
  setHoveredNode(null);
@@ -36765,7 +37106,7 @@ var init_ImportPreviewTree = __esm({
36765
37106
  const renderUnit = (unit, childrenByParent, depth) => {
36766
37107
  const summary = fieldSummary(unit);
36767
37108
  const children = childrenByParent.get(unit.ref) ?? [];
36768
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
37109
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
36769
37110
  /* @__PURE__ */ jsxs(
36770
37111
  Box,
36771
37112
  {
@@ -36862,7 +37203,7 @@ var init_ImportProgress = __esm({
36862
37203
  PIPELINE.map((key, index) => {
36863
37204
  const isComplete = index < currentIndex;
36864
37205
  const isActive = index === currentIndex;
36865
- return /* @__PURE__ */ jsxs(React84__default.Fragment, { children: [
37206
+ return /* @__PURE__ */ jsxs(React85__default.Fragment, { children: [
36866
37207
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
36867
37208
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
36868
37209
  /* @__PURE__ */ jsx(
@@ -37016,9 +37357,6 @@ var init_types2 = __esm({
37016
37357
  };
37017
37358
  }
37018
37359
  });
37019
- function humanizeFieldName(name) {
37020
- 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();
37021
- }
37022
37360
  function normalizeColumns(columns) {
37023
37361
  return columns.map((col) => {
37024
37362
  if (typeof col === "string") {
@@ -37443,6 +37781,7 @@ var init_DataTable = __esm({
37443
37781
  "components/core/organisms/DataTable.tsx"() {
37444
37782
  "use client";
37445
37783
  init_cn();
37784
+ init_format();
37446
37785
  init_getNestedValue();
37447
37786
  init_atoms();
37448
37787
  init_Box();
@@ -37495,9 +37834,6 @@ function getBadgeVariant(fieldName, value) {
37495
37834
  }
37496
37835
  return "default";
37497
37836
  }
37498
- function formatFieldLabel(fieldName) {
37499
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
37500
- }
37501
37837
  function formatFieldValue2(value, fieldName) {
37502
37838
  if (typeof value === "number") {
37503
37839
  if (fieldName.toLowerCase().includes("progress") || fieldName.toLowerCase().includes("percent")) {
@@ -37625,7 +37961,7 @@ function buildFieldTypeMap(fields) {
37625
37961
  }
37626
37962
  return map;
37627
37963
  }
37628
- var ReactMarkdown2, DetailPanel;
37964
+ var formatFieldLabel, ReactMarkdown2, DetailPanel;
37629
37965
  var init_DetailPanel = __esm({
37630
37966
  "components/core/organisms/DetailPanel.tsx"() {
37631
37967
  "use client";
@@ -37637,8 +37973,10 @@ var init_DetailPanel = __esm({
37637
37973
  init_ErrorState();
37638
37974
  init_EmptyState();
37639
37975
  init_cn();
37976
+ init_format();
37640
37977
  init_getNestedValue();
37641
37978
  init_useEventBus();
37979
+ formatFieldLabel = humanizeFieldName;
37642
37980
  ReactMarkdown2 = lazy(() => import('react-markdown'));
37643
37981
  DetailPanel = ({
37644
37982
  title: propTitle,
@@ -37968,7 +38306,7 @@ var init_DetailPanel = __esm({
37968
38306
  }
37969
38307
  });
37970
38308
  function extractTitle(children) {
37971
- if (!React84__default.isValidElement(children)) return void 0;
38309
+ if (!React85__default.isValidElement(children)) return void 0;
37972
38310
  const props = children.props;
37973
38311
  if (typeof props.title === "string") {
37974
38312
  return props.title;
@@ -38318,12 +38656,12 @@ var init_Form = __esm({
38318
38656
  const isSchemaEntity = isOrbitalEntitySchema(entity);
38319
38657
  const resolvedEntity = isSchemaEntity ? entity : void 0;
38320
38658
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
38321
- const normalizedInitialData = React84__default.useMemo(() => {
38659
+ const normalizedInitialData = React85__default.useMemo(() => {
38322
38660
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
38323
38661
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
38324
38662
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
38325
38663
  }, [entity, initialData]);
38326
- const entityDerivedFields = React84__default.useMemo(() => {
38664
+ const entityDerivedFields = React85__default.useMemo(() => {
38327
38665
  if (fields && fields.length > 0) return void 0;
38328
38666
  if (!resolvedEntity) return void 0;
38329
38667
  return resolvedEntity.fields.map(
@@ -38344,16 +38682,16 @@ var init_Form = __esm({
38344
38682
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
38345
38683
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
38346
38684
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
38347
- const [formData, setFormData] = React84__default.useState(
38685
+ const [formData, setFormData] = React85__default.useState(
38348
38686
  normalizedInitialData
38349
38687
  );
38350
- const [collapsedSections, setCollapsedSections] = React84__default.useState(
38688
+ const [collapsedSections, setCollapsedSections] = React85__default.useState(
38351
38689
  /* @__PURE__ */ new Set()
38352
38690
  );
38353
- const [submitError, setSubmitError] = React84__default.useState(null);
38354
- const formRef = React84__default.useRef(null);
38691
+ const [submitError, setSubmitError] = React85__default.useState(null);
38692
+ const formRef = React85__default.useRef(null);
38355
38693
  const formMode = props.mode;
38356
- const mountedRef = React84__default.useRef(false);
38694
+ const mountedRef = React85__default.useRef(false);
38357
38695
  if (!mountedRef.current) {
38358
38696
  mountedRef.current = true;
38359
38697
  debug("forms", "mount", {
@@ -38366,7 +38704,7 @@ var init_Form = __esm({
38366
38704
  });
38367
38705
  }
38368
38706
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
38369
- const evalContext = React84__default.useMemo(
38707
+ const evalContext = React85__default.useMemo(
38370
38708
  () => ({
38371
38709
  formValues: formData,
38372
38710
  globalVariables: externalContext?.globalVariables ?? {},
@@ -38375,7 +38713,7 @@ var init_Form = __esm({
38375
38713
  }),
38376
38714
  [formData, externalContext]
38377
38715
  );
38378
- React84__default.useEffect(() => {
38716
+ React85__default.useEffect(() => {
38379
38717
  debug("forms", "initialData-sync", {
38380
38718
  mode: formMode,
38381
38719
  normalizedInitialData,
@@ -38386,7 +38724,7 @@ var init_Form = __esm({
38386
38724
  setFormData(normalizedInitialData);
38387
38725
  }
38388
38726
  }, [normalizedInitialData]);
38389
- const processCalculations = React84__default.useCallback(
38727
+ const processCalculations = React85__default.useCallback(
38390
38728
  (changedFieldId, newFormData) => {
38391
38729
  if (!hiddenCalculations.length) return;
38392
38730
  const context = {
@@ -38411,7 +38749,7 @@ var init_Form = __esm({
38411
38749
  },
38412
38750
  [hiddenCalculations, externalContext, eventBus]
38413
38751
  );
38414
- const checkViolations = React84__default.useCallback(
38752
+ const checkViolations = React85__default.useCallback(
38415
38753
  (changedFieldId, newFormData) => {
38416
38754
  if (!violationTriggers.length) return;
38417
38755
  const context = {
@@ -38449,7 +38787,7 @@ var init_Form = __esm({
38449
38787
  processCalculations(name, newFormData);
38450
38788
  checkViolations(name, newFormData);
38451
38789
  };
38452
- const isFieldVisible = React84__default.useCallback(
38790
+ const isFieldVisible = React85__default.useCallback(
38453
38791
  (fieldName) => {
38454
38792
  const condition = conditionalFields[fieldName];
38455
38793
  if (!condition) return true;
@@ -38457,7 +38795,7 @@ var init_Form = __esm({
38457
38795
  },
38458
38796
  [conditionalFields, evalContext]
38459
38797
  );
38460
- const isSectionVisible = React84__default.useCallback(
38798
+ const isSectionVisible = React85__default.useCallback(
38461
38799
  (section) => {
38462
38800
  if (!section.condition) return true;
38463
38801
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -38533,7 +38871,7 @@ var init_Form = __esm({
38533
38871
  eventBus.emit(`UI:${onCancel}`);
38534
38872
  }
38535
38873
  };
38536
- const renderField = React84__default.useCallback(
38874
+ const renderField = React85__default.useCallback(
38537
38875
  (field) => {
38538
38876
  const fieldName = field.name || field.field;
38539
38877
  if (!fieldName) return null;
@@ -38554,7 +38892,7 @@ var init_Form = __esm({
38554
38892
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
38555
38893
  );
38556
38894
  const effectiveFields = entityDerivedFields ?? fields;
38557
- const normalizedFields = React84__default.useMemo(() => {
38895
+ const normalizedFields = React85__default.useMemo(() => {
38558
38896
  if (!effectiveFields || effectiveFields.length === 0) return [];
38559
38897
  return effectiveFields.map((field) => {
38560
38898
  if (typeof field === "string") {
@@ -38578,7 +38916,7 @@ var init_Form = __esm({
38578
38916
  return field;
38579
38917
  });
38580
38918
  }, [effectiveFields, resolvedEntity]);
38581
- const schemaFields = React84__default.useMemo(() => {
38919
+ const schemaFields = React85__default.useMemo(() => {
38582
38920
  if (normalizedFields.length === 0) return null;
38583
38921
  if (isDebugEnabled()) {
38584
38922
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -38588,7 +38926,7 @@ var init_Form = __esm({
38588
38926
  }
38589
38927
  return normalizedFields.map(renderField).filter(Boolean);
38590
38928
  }, [normalizedFields, renderField, entityName, conditionalFields]);
38591
- const sectionElements = React84__default.useMemo(() => {
38929
+ const sectionElements = React85__default.useMemo(() => {
38592
38930
  if (!sections || sections.length === 0) return null;
38593
38931
  return sections.map((section) => {
38594
38932
  if (!isSectionVisible(section)) {
@@ -39167,7 +39505,7 @@ function formatValue3(value, fieldName) {
39167
39505
  return String(value);
39168
39506
  }
39169
39507
  function formatFieldLabel2(fieldName) {
39170
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
39508
+ return humanizeFieldName(fieldName).replace(/\sId$/, "").trim();
39171
39509
  }
39172
39510
  var STATUS_STYLES, StatusBadge, ProgressIndicator, List3;
39173
39511
  var init_List = __esm({
@@ -39179,6 +39517,7 @@ var init_List = __esm({
39179
39517
  init_EmptyState();
39180
39518
  init_LoadingState();
39181
39519
  init_cn();
39520
+ init_format();
39182
39521
  init_getNestedValue();
39183
39522
  init_useEventBus();
39184
39523
  init_types2();
@@ -39313,7 +39652,7 @@ var init_List = __esm({
39313
39652
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
39314
39653
  return [];
39315
39654
  }, [entity]);
39316
- const getItemActions = React84__default.useCallback(
39655
+ const getItemActions = React85__default.useCallback(
39317
39656
  (item) => {
39318
39657
  if (!itemActions) return [];
39319
39658
  if (typeof itemActions === "function") {
@@ -39794,7 +40133,7 @@ var init_MediaGallery = __esm({
39794
40133
  [selectable, selectedItems, selectionEvent, eventBus]
39795
40134
  );
39796
40135
  const entityData = Array.isArray(entity) ? entity : [];
39797
- const items = React84__default.useMemo(() => {
40136
+ const items = React85__default.useMemo(() => {
39798
40137
  if (propItems && propItems.length > 0) return propItems;
39799
40138
  if (entityData.length === 0) return [];
39800
40139
  return entityData.map((record, idx) => {
@@ -39959,7 +40298,7 @@ var init_MediaGallery = __esm({
39959
40298
  }
39960
40299
  });
39961
40300
  function extractTitle2(children) {
39962
- if (!React84__default.isValidElement(children)) return void 0;
40301
+ if (!React85__default.isValidElement(children)) return void 0;
39963
40302
  const props = children.props;
39964
40303
  if (typeof props.title === "string") {
39965
40304
  return props.title;
@@ -40214,7 +40553,7 @@ var init_debugRegistry = __esm({
40214
40553
  }
40215
40554
  });
40216
40555
  function useDebugData() {
40217
- const [data, setData] = React84.useState(() => ({
40556
+ const [data, setData] = React85.useState(() => ({
40218
40557
  traits: [],
40219
40558
  ticks: [],
40220
40559
  guards: [],
@@ -40228,7 +40567,7 @@ function useDebugData() {
40228
40567
  },
40229
40568
  lastUpdate: Date.now()
40230
40569
  }));
40231
- React84.useEffect(() => {
40570
+ React85.useEffect(() => {
40232
40571
  const updateData = () => {
40233
40572
  setData({
40234
40573
  traits: getAllTraits(),
@@ -40337,12 +40676,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
40337
40676
  return positions;
40338
40677
  }
40339
40678
  function WalkMinimap() {
40340
- const [walkStep, setWalkStep] = React84.useState(null);
40341
- const [traits2, setTraits] = React84.useState([]);
40342
- const [coveredEdges, setCoveredEdges] = React84.useState([]);
40343
- const [completedTraits, setCompletedTraits] = React84.useState(/* @__PURE__ */ new Set());
40344
- const prevTraitRef = React84.useRef(null);
40345
- React84.useEffect(() => {
40679
+ const [walkStep, setWalkStep] = React85.useState(null);
40680
+ const [traits2, setTraits] = React85.useState([]);
40681
+ const [coveredEdges, setCoveredEdges] = React85.useState([]);
40682
+ const [completedTraits, setCompletedTraits] = React85.useState(/* @__PURE__ */ new Set());
40683
+ const prevTraitRef = React85.useRef(null);
40684
+ React85.useEffect(() => {
40346
40685
  const interval = setInterval(() => {
40347
40686
  const w = window;
40348
40687
  const step = w.__orbitalWalkStep;
@@ -40640,7 +40979,7 @@ function TicksTab({ ticks: ticks2 }) {
40640
40979
  }
40641
40980
  );
40642
40981
  }
40643
- const formatTime2 = (ms) => {
40982
+ const formatTime3 = (ms) => {
40644
40983
  if (ms === 0) return "never";
40645
40984
  const seconds = Math.floor((Date.now() - ms) / 1e3);
40646
40985
  if (seconds < 1) return "just now";
@@ -40666,7 +41005,7 @@ function TicksTab({ ticks: ticks2 }) {
40666
41005
  tick.executionTime.toFixed(1),
40667
41006
  "ms exec"
40668
41007
  ] }),
40669
- /* @__PURE__ */ jsx("span", { children: formatTime2(tick.lastRun) })
41008
+ /* @__PURE__ */ jsx("span", { children: formatTime3(tick.lastRun) })
40670
41009
  ] }),
40671
41010
  tick.guardName && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxs(Badge, { variant: tick.guardPassed ? "success" : "danger", size: "sm", children: [
40672
41011
  tick.guardName,
@@ -40778,19 +41117,19 @@ var init_EntitiesTab = __esm({
40778
41117
  });
40779
41118
  function EventFlowTab({ events: events2 }) {
40780
41119
  const { t } = useTranslate();
40781
- const [filter, setFilter] = React84.useState("all");
40782
- const containerRef = React84.useRef(null);
40783
- const [autoScroll, setAutoScroll] = React84.useState(true);
40784
- React84.useEffect(() => {
41120
+ const [filter, setFilter] = React85.useState("all");
41121
+ const containerRef = React85.useRef(null);
41122
+ const [autoScroll, setAutoScroll] = React85.useState(true);
41123
+ React85.useEffect(() => {
40785
41124
  if (autoScroll && containerRef.current) {
40786
41125
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
40787
41126
  }
40788
41127
  }, [events2.length, autoScroll]);
40789
- const filteredEvents = React84.useMemo(() => {
41128
+ const filteredEvents = React85.useMemo(() => {
40790
41129
  if (filter === "all") return events2;
40791
41130
  return events2.filter((e) => e.type === filter);
40792
41131
  }, [events2, filter]);
40793
- const formatTime2 = (timestamp) => {
41132
+ const formatTime3 = (timestamp) => {
40794
41133
  const date = new Date(timestamp);
40795
41134
  return date.toLocaleTimeString("en-US", {
40796
41135
  hour12: false,
@@ -40866,7 +41205,7 @@ function EventFlowTab({ events: events2 }) {
40866
41205
  {
40867
41206
  className: "flex items-start gap-2 text-xs py-1 hover:bg-muted/50 rounded px-1",
40868
41207
  children: [
40869
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(event.timestamp) }),
41208
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(event.timestamp) }),
40870
41209
  /* @__PURE__ */ jsx("span", { children: icon }),
40871
41210
  /* @__PURE__ */ jsx(Badge, { variant, size: "sm", className: "min-w-[60px] justify-center", children: event.source }),
40872
41211
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: event.message })
@@ -40902,7 +41241,7 @@ var init_EventFlowTab = __esm({
40902
41241
  });
40903
41242
  function GuardsPanel({ guards }) {
40904
41243
  const { t } = useTranslate();
40905
- const [filter, setFilter] = React84.useState("all");
41244
+ const [filter, setFilter] = React85.useState("all");
40906
41245
  if (guards.length === 0) {
40907
41246
  return /* @__PURE__ */ jsx(
40908
41247
  EmptyState,
@@ -40915,12 +41254,12 @@ function GuardsPanel({ guards }) {
40915
41254
  }
40916
41255
  const passedCount = guards.filter((g) => g.result).length;
40917
41256
  const failedCount = guards.length - passedCount;
40918
- const filteredGuards = React84.useMemo(() => {
41257
+ const filteredGuards = React85.useMemo(() => {
40919
41258
  if (filter === "all") return guards;
40920
41259
  if (filter === "passed") return guards.filter((g) => g.result);
40921
41260
  return guards.filter((g) => !g.result);
40922
41261
  }, [guards, filter]);
40923
- const formatTime2 = (timestamp) => {
41262
+ const formatTime3 = (timestamp) => {
40924
41263
  const date = new Date(timestamp);
40925
41264
  return date.toLocaleTimeString("en-US", {
40926
41265
  hour12: false,
@@ -40935,7 +41274,7 @@ function GuardsPanel({ guards }) {
40935
41274
  /* @__PURE__ */ jsx(Badge, { variant: guard.result ? "success" : "danger", size: "sm", children: guard.result ? "\u2713" : "\u2717" }),
40936
41275
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", className: "text-warning", children: guard.guardName }),
40937
41276
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: guard.context.type === "transition" ? `${guard.context.transitionFrom} \u2192 ${guard.context.transitionTo}` : guard.context.tickName }),
40938
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime2(guard.timestamp) })
41277
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime3(guard.timestamp) })
40939
41278
  ] }),
40940
41279
  content: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
40941
41280
  /* @__PURE__ */ jsxs("div", { children: [
@@ -41078,10 +41417,10 @@ function EffectBadge({ effect }) {
41078
41417
  }
41079
41418
  function TransitionTimeline({ transitions }) {
41080
41419
  const { t } = useTranslate();
41081
- const containerRef = React84.useRef(null);
41082
- const [autoScroll, setAutoScroll] = React84.useState(true);
41083
- const [expandedId, setExpandedId] = React84.useState(null);
41084
- React84.useEffect(() => {
41420
+ const containerRef = React85.useRef(null);
41421
+ const [autoScroll, setAutoScroll] = React85.useState(true);
41422
+ const [expandedId, setExpandedId] = React85.useState(null);
41423
+ React85.useEffect(() => {
41085
41424
  if (autoScroll && containerRef.current) {
41086
41425
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
41087
41426
  }
@@ -41096,7 +41435,7 @@ function TransitionTimeline({ transitions }) {
41096
41435
  }
41097
41436
  );
41098
41437
  }
41099
- const formatTime2 = (ts) => {
41438
+ const formatTime3 = (ts) => {
41100
41439
  const d = new Date(ts);
41101
41440
  return d.toLocaleTimeString("en-US", {
41102
41441
  hour12: false,
@@ -41144,7 +41483,7 @@ function TransitionTimeline({ transitions }) {
41144
41483
  ${hasFailedEffects ? "bg-error" : allPassed ? "bg-success" : "bg-muted-foreground"}
41145
41484
  ` }),
41146
41485
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs py-1 px-2", children: [
41147
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(trace.timestamp) }),
41486
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(trace.timestamp) }),
41148
41487
  /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", className: "min-w-[60px] justify-center", children: trace.traitName }),
41149
41488
  /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-muted-foreground", children: [
41150
41489
  trace.from,
@@ -41219,7 +41558,7 @@ function ServerBridgeTab({ bridge }) {
41219
41558
  }
41220
41559
  );
41221
41560
  }
41222
- const formatTime2 = (ts) => {
41561
+ const formatTime3 = (ts) => {
41223
41562
  if (ts === 0) return t("debug.never");
41224
41563
  const d = new Date(ts);
41225
41564
  return d.toLocaleTimeString("en-US", {
@@ -41262,7 +41601,7 @@ function ServerBridgeTab({ bridge }) {
41262
41601
  StatRow,
41263
41602
  {
41264
41603
  label: t("debug.lastHeartbeat"),
41265
- value: formatTime2(bridge.lastHeartbeat)
41604
+ value: formatTime3(bridge.lastHeartbeat)
41266
41605
  }
41267
41606
  )
41268
41607
  ] })
@@ -41361,9 +41700,9 @@ function getAllEvents(traits2) {
41361
41700
  function EventDispatcherTab({ traits: traits2, schema }) {
41362
41701
  const eventBus = useEventBus();
41363
41702
  const { t } = useTranslate();
41364
- const [log13, setLog] = React84.useState([]);
41365
- const prevStatesRef = React84.useRef(/* @__PURE__ */ new Map());
41366
- React84.useEffect(() => {
41703
+ const [log13, setLog] = React85.useState([]);
41704
+ const prevStatesRef = React85.useRef(/* @__PURE__ */ new Map());
41705
+ React85.useEffect(() => {
41367
41706
  for (const trait of traits2) {
41368
41707
  const prev = prevStatesRef.current.get(trait.id);
41369
41708
  if (prev && prev !== trait.currentState) {
@@ -41532,10 +41871,10 @@ function VerifyModePanel({
41532
41871
  localCount
41533
41872
  }) {
41534
41873
  const { t } = useTranslate();
41535
- const [expanded, setExpanded] = React84.useState(true);
41536
- const scrollRef = React84.useRef(null);
41537
- const prevCountRef = React84.useRef(0);
41538
- React84.useEffect(() => {
41874
+ const [expanded, setExpanded] = React85.useState(true);
41875
+ const scrollRef = React85.useRef(null);
41876
+ const prevCountRef = React85.useRef(0);
41877
+ React85.useEffect(() => {
41539
41878
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
41540
41879
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
41541
41880
  }
@@ -41592,10 +41931,10 @@ function RuntimeDebugger({
41592
41931
  schema
41593
41932
  }) {
41594
41933
  const { t } = useTranslate();
41595
- const [isCollapsed, setIsCollapsed] = React84.useState(mode === "verify" ? true : defaultCollapsed);
41596
- const [isVisible, setIsVisible] = React84.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
41934
+ const [isCollapsed, setIsCollapsed] = React85.useState(mode === "verify" ? true : defaultCollapsed);
41935
+ const [isVisible, setIsVisible] = React85.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
41597
41936
  const debugData = useDebugData();
41598
- React84.useEffect(() => {
41937
+ React85.useEffect(() => {
41599
41938
  if (mode === "inline") return;
41600
41939
  return onDebugToggle((enabled) => {
41601
41940
  setIsVisible(enabled);
@@ -41604,7 +41943,7 @@ function RuntimeDebugger({
41604
41943
  }
41605
41944
  });
41606
41945
  }, [mode]);
41607
- React84.useEffect(() => {
41946
+ React85.useEffect(() => {
41608
41947
  if (mode === "inline") return;
41609
41948
  const handleKeyDown = (e) => {
41610
41949
  if (e.key === "`" && isVisible) {
@@ -42124,7 +42463,7 @@ var init_StatCard = __esm({
42124
42463
  const labelToUse = propLabel ?? propTitle;
42125
42464
  const eventBus = useEventBus();
42126
42465
  const { t } = useTranslate();
42127
- const handleActionClick = React84__default.useCallback(() => {
42466
+ const handleActionClick = React85__default.useCallback(() => {
42128
42467
  if (action?.event) {
42129
42468
  eventBus.emit(`UI:${action.event}`, {});
42130
42469
  }
@@ -42135,7 +42474,7 @@ var init_StatCard = __esm({
42135
42474
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
42136
42475
  const isLoading = externalLoading ?? false;
42137
42476
  const error = externalError;
42138
- const computeMetricValue = React84__default.useCallback(
42477
+ const computeMetricValue = React85__default.useCallback(
42139
42478
  (metric, items) => {
42140
42479
  if (metric.value !== void 0) {
42141
42480
  return metric.value;
@@ -42174,7 +42513,7 @@ var init_StatCard = __esm({
42174
42513
  },
42175
42514
  []
42176
42515
  );
42177
- const schemaStats = React84__default.useMemo(() => {
42516
+ const schemaStats = React85__default.useMemo(() => {
42178
42517
  if (!metrics || metrics.length === 0) return null;
42179
42518
  return metrics.map((metric) => ({
42180
42519
  label: metric.label,
@@ -42182,7 +42521,7 @@ var init_StatCard = __esm({
42182
42521
  format: metric.format
42183
42522
  }));
42184
42523
  }, [metrics, data, computeMetricValue]);
42185
- const calculatedTrend = React84__default.useMemo(() => {
42524
+ const calculatedTrend = React85__default.useMemo(() => {
42186
42525
  if (manualTrend !== void 0) return manualTrend;
42187
42526
  if (previousValue === void 0 || currentValue === void 0)
42188
42527
  return void 0;
@@ -42822,8 +43161,8 @@ var init_SubagentTracePanel = __esm({
42822
43161
  ] });
42823
43162
  };
42824
43163
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
42825
- const endRef = React84__default.useRef(null);
42826
- React84__default.useEffect(() => {
43164
+ const endRef = React85__default.useRef(null);
43165
+ React85__default.useEffect(() => {
42827
43166
  if (!autoScroll) return;
42828
43167
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
42829
43168
  }, [activities.length, autoScroll]);
@@ -42917,7 +43256,7 @@ var init_SubagentTracePanel = __esm({
42917
43256
  };
42918
43257
  SubagentRichCard = ({ subagent }) => {
42919
43258
  const { t } = useTranslate();
42920
- const activities = React84__default.useMemo(
43259
+ const activities = React85__default.useMemo(
42921
43260
  () => subagentMessagesToActivities(subagent.messages),
42922
43261
  [subagent.messages]
42923
43262
  );
@@ -42994,8 +43333,8 @@ var init_SubagentTracePanel = __esm({
42994
43333
  ] });
42995
43334
  };
42996
43335
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
42997
- const endRef = React84__default.useRef(null);
42998
- React84__default.useEffect(() => {
43336
+ const endRef = React85__default.useRef(null);
43337
+ React85__default.useEffect(() => {
42999
43338
  if (!autoScroll) return;
43000
43339
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
43001
43340
  }, [messages.length, autoScroll]);
@@ -43374,7 +43713,7 @@ var init_TeamOrganism = __esm({
43374
43713
  TeamOrganism.displayName = "TeamOrganism";
43375
43714
  }
43376
43715
  });
43377
- function formatDate4(value) {
43716
+ function formatDate2(value) {
43378
43717
  const d = new Date(value);
43379
43718
  if (isNaN(d.getTime())) return value;
43380
43719
  return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
@@ -43430,7 +43769,7 @@ var init_Timeline = __esm({
43430
43769
  }) => {
43431
43770
  const { t } = useTranslate();
43432
43771
  const entityData = entity ?? [];
43433
- const items = React84__default.useMemo(() => {
43772
+ const items = React85__default.useMemo(() => {
43434
43773
  if (propItems) return propItems;
43435
43774
  if (entityData.length === 0) return [];
43436
43775
  return entityData.map((record, idx) => {
@@ -43506,7 +43845,7 @@ var init_Timeline = __esm({
43506
43845
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("flex-1 min-w-0", !isLast && "pb-6"), children: [
43507
43846
  /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "start", wrap: true, children: [
43508
43847
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", children: item.title }),
43509
- item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate4(item.date) })
43848
+ item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate2(item.date) })
43510
43849
  ] }),
43511
43850
  item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
43512
43851
  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)) }),
@@ -43532,7 +43871,7 @@ var init_Timeline = __esm({
43532
43871
  }
43533
43872
  });
43534
43873
  function extractToastProps(children) {
43535
- if (!React84__default.isValidElement(children)) {
43874
+ if (!React85__default.isValidElement(children)) {
43536
43875
  if (typeof children === "string") {
43537
43876
  return { message: children };
43538
43877
  }
@@ -43574,7 +43913,7 @@ var init_ToastSlot = __esm({
43574
43913
  eventBus.emit(`${prefix}CLOSE`);
43575
43914
  };
43576
43915
  if (!isVisible) return null;
43577
- const isCustomContent = React84__default.isValidElement(children) && !message;
43916
+ const isCustomContent = React85__default.isValidElement(children) && !message;
43578
43917
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
43579
43918
  Toast,
43580
43919
  {
@@ -43812,6 +44151,10 @@ var init_component_registry_generated = __esm({
43812
44151
  init_SubagentTracePanel();
43813
44152
  init_SvgBranch();
43814
44153
  init_SvgConnection();
44154
+ init_SvgDrawGroup();
44155
+ init_SvgDrawShape();
44156
+ init_SvgDrawShapeLayer();
44157
+ init_SvgDrawText();
43815
44158
  init_SvgFlow();
43816
44159
  init_SvgGrid();
43817
44160
  init_SvgLobe();
@@ -43822,6 +44165,7 @@ var init_component_registry_generated = __esm({
43822
44165
  init_SvgRing();
43823
44166
  init_SvgShield();
43824
44167
  init_SvgStack();
44168
+ init_SvgStage();
43825
44169
  init_SwipeableRow();
43826
44170
  init_Switch();
43827
44171
  init_TabbedContainer();
@@ -44083,6 +44427,10 @@ var init_component_registry_generated = __esm({
44083
44427
  "SubagentTracePanel": SubagentTracePanel,
44084
44428
  "SvgBranch": SvgBranch,
44085
44429
  "SvgConnection": SvgConnection,
44430
+ "SvgDrawGroup": SvgDrawGroup,
44431
+ "SvgDrawShape": SvgDrawShape,
44432
+ "SvgDrawShapeLayer": SvgDrawShapeLayer,
44433
+ "SvgDrawText": SvgDrawText,
44086
44434
  "SvgFlow": SvgFlow,
44087
44435
  "SvgGrid": SvgGrid,
44088
44436
  "SvgLobe": SvgLobe,
@@ -44093,6 +44441,7 @@ var init_component_registry_generated = __esm({
44093
44441
  "SvgRing": SvgRing,
44094
44442
  "SvgShield": SvgShield,
44095
44443
  "SvgStack": SvgStack,
44444
+ "SvgStage": SvgStage,
44096
44445
  "SwipeableRow": SwipeableRow,
44097
44446
  "Switch": Switch,
44098
44447
  "TabbedContainer": TabbedContainer,
@@ -44143,7 +44492,7 @@ function SuspenseConfigProvider({
44143
44492
  config,
44144
44493
  children
44145
44494
  }) {
44146
- return React84__default.createElement(
44495
+ return React85__default.createElement(
44147
44496
  SuspenseConfigContext.Provider,
44148
44497
  { value: config },
44149
44498
  children
@@ -44169,7 +44518,7 @@ function enrichFormFields(fields, entityDef) {
44169
44518
  if (entityField) {
44170
44519
  const enriched = {
44171
44520
  name: field,
44172
- label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
44521
+ label: humanizeFieldName(field),
44173
44522
  type: entityField.type,
44174
44523
  required: entityField.required ?? false
44175
44524
  };
@@ -44183,9 +44532,9 @@ function enrichFormFields(fields, entityDef) {
44183
44532
  }
44184
44533
  return enriched;
44185
44534
  }
44186
- return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
44535
+ return { name: field, label: humanizeFieldName(field) };
44187
44536
  }
44188
- if (field && typeof field === "object" && !Array.isArray(field) && !React84__default.isValidElement(field) && !(field instanceof Date)) {
44537
+ if (field && typeof field === "object" && !Array.isArray(field) && !React85__default.isValidElement(field) && !(field instanceof Date)) {
44189
44538
  const obj = field;
44190
44539
  const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
44191
44540
  if (!fieldName) return field;
@@ -44645,7 +44994,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
44645
44994
  const key = `${parentId}-${index}-trait:${traitName}`;
44646
44995
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
44647
44996
  }
44648
- return /* @__PURE__ */ jsx(React84__default.Fragment, { children: child }, `${parentId}-${index}`);
44997
+ return /* @__PURE__ */ jsx(React85__default.Fragment, { children: child }, `${parentId}-${index}`);
44649
44998
  }
44650
44999
  if (!child || typeof child !== "object") return null;
44651
45000
  const childId = `${parentId}-${index}`;
@@ -44702,14 +45051,14 @@ function isPatternConfig(value) {
44702
45051
  if (value === null || value === void 0) return false;
44703
45052
  if (typeof value !== "object") return false;
44704
45053
  if (Array.isArray(value)) return false;
44705
- if (React84__default.isValidElement(value)) return false;
45054
+ if (React85__default.isValidElement(value)) return false;
44706
45055
  if (value instanceof Date) return false;
44707
45056
  if (typeof value === "function") return false;
44708
45057
  const record = value;
44709
45058
  return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
44710
45059
  }
44711
45060
  function isPlainConfigObject(value) {
44712
- if (React84__default.isValidElement(value)) return false;
45061
+ if (React85__default.isValidElement(value)) return false;
44713
45062
  if (value instanceof Date) return false;
44714
45063
  const proto = Object.getPrototypeOf(value);
44715
45064
  return proto === Object.prototype || proto === null;
@@ -44837,10 +45186,11 @@ function SlotContentRenderer({
44837
45186
  for (const slotKey of CONTENT_NODE_SLOTS) {
44838
45187
  const slotVal = restProps[slotKey];
44839
45188
  if (slotVal === void 0 || slotVal === null) continue;
44840
- if (React84__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
44841
- if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
45189
+ if (React85__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
45190
+ const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
45191
+ if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
44842
45192
  nodeSlotOverrides[slotKey] = renderPatternChildren(
44843
- slotVal,
45193
+ typelessChildren ?? slotVal,
44844
45194
  onDismiss,
44845
45195
  `${content.id}-${slotKey}`,
44846
45196
  `${myPath}.${slotKey}`,
@@ -44890,7 +45240,7 @@ function SlotContentRenderer({
44890
45240
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
44891
45241
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
44892
45242
  const sample = resolvedItems[0];
44893
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React84__default.isValidElement(sample) && !(sample instanceof Date)) {
45243
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React85__default.isValidElement(sample) && !(sample instanceof Date)) {
44894
45244
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
44895
45245
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
44896
45246
  }
@@ -45019,6 +45369,7 @@ var init_UISlotRenderer = __esm({
45019
45369
  init_useEventBus();
45020
45370
  init_slot_types();
45021
45371
  init_cn();
45372
+ init_format();
45022
45373
  init_ErrorBoundary();
45023
45374
  init_Skeleton();
45024
45375
  init_renderer();