@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.
package/dist/avl/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React91 from 'react';
3
- import React91__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
2
+ import * as React92 from 'react';
3
+ import React92__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
4
4
  import { getAllPages, matchPathAmong, OrbitalProvider, EventBusContext, useTraitScopeChain, ServerBridgeProvider, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge, useEntitySchema, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath, useGameAudioContextOptional } from '@almadar/ui/providers';
5
5
  import { createLogger, setNamespaceLevel, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
@@ -3112,6 +3112,61 @@ var init_cn = __esm({
3112
3112
  }
3113
3113
  });
3114
3114
 
3115
+ // lib/format.ts
3116
+ function humanizeFieldName(name) {
3117
+ 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();
3118
+ }
3119
+ function humanizeEnumValue(value) {
3120
+ return /^[a-z0-9]+(?:[_-][a-z0-9]+)+$/.test(value) ? humanizeFieldName(value) : value;
3121
+ }
3122
+ function formatDate(value) {
3123
+ if (!value) return "";
3124
+ const d = new Date(String(value));
3125
+ if (isNaN(d.getTime())) return String(value);
3126
+ return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
3127
+ }
3128
+ function formatTime(value) {
3129
+ if (!value) return "";
3130
+ const d = new Date(String(value));
3131
+ if (isNaN(d.getTime())) return String(value);
3132
+ return d.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
3133
+ }
3134
+ function formatDateTime(value) {
3135
+ if (!value) return "";
3136
+ const d = new Date(String(value));
3137
+ if (isNaN(d.getTime())) return String(value);
3138
+ return `${formatDate(value)} ${formatTime(value)}`;
3139
+ }
3140
+ function asYesNo(value) {
3141
+ return value === false || value === 0 || String(value) === "false" ? "No" : "Yes";
3142
+ }
3143
+ function formatValue(value, format) {
3144
+ if (value === void 0 || value === null) return "";
3145
+ if (typeof value === "boolean") return asYesNo(value);
3146
+ switch (format) {
3147
+ case "date":
3148
+ return formatDate(value);
3149
+ case "time":
3150
+ return formatTime(value);
3151
+ case "datetime":
3152
+ return formatDateTime(value);
3153
+ case "currency":
3154
+ return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
3155
+ case "number":
3156
+ return typeof value === "number" ? value.toLocaleString() : String(value);
3157
+ case "percent":
3158
+ return typeof value === "number" ? `${Math.round(value)}%` : String(value);
3159
+ case "boolean":
3160
+ return asYesNo(value);
3161
+ default:
3162
+ return String(value);
3163
+ }
3164
+ }
3165
+ var init_format = __esm({
3166
+ "lib/format.ts"() {
3167
+ }
3168
+ });
3169
+
3115
3170
  // components/core/atoms/Typography.tsx
3116
3171
  var Typography_exports = {};
3117
3172
  __export(Typography_exports, {
@@ -3121,6 +3176,7 @@ var variantStyles, colorStyles, weightStyles, defaultElements, typographySizeSty
3121
3176
  var init_Typography = __esm({
3122
3177
  "components/core/atoms/Typography.tsx"() {
3123
3178
  init_cn();
3179
+ init_format();
3124
3180
  variantStyles = {
3125
3181
  h1: "text-4xl font-bold tracking-tight text-foreground",
3126
3182
  h2: "text-3xl font-bold tracking-tight text-foreground",
@@ -3208,12 +3264,17 @@ var init_Typography = __esm({
3208
3264
  id,
3209
3265
  className,
3210
3266
  style,
3267
+ format,
3211
3268
  content,
3212
3269
  children
3213
3270
  }) => {
3214
3271
  const variant = variantProp ?? (level ? `h${level}` : "body1");
3215
3272
  const Component = as || defaultElements[variant];
3216
- return React91__default.createElement(
3273
+ let body = children ?? content;
3274
+ if (format !== void 0 && format !== "none" && (typeof body === "string" || typeof body === "number" || body instanceof Date)) {
3275
+ body = formatValue(body, format);
3276
+ }
3277
+ return React92__default.createElement(
3217
3278
  Component,
3218
3279
  {
3219
3280
  id,
@@ -3229,7 +3290,7 @@ var init_Typography = __esm({
3229
3290
  ),
3230
3291
  style
3231
3292
  },
3232
- children ?? content
3293
+ body
3233
3294
  );
3234
3295
  };
3235
3296
  Typography.displayName = "Typography";
@@ -3559,7 +3620,7 @@ var init_Box = __esm({
3559
3620
  fixed: "fixed",
3560
3621
  sticky: "sticky"
3561
3622
  };
3562
- Box = React91__default.forwardRef(
3623
+ Box = React92__default.forwardRef(
3563
3624
  ({
3564
3625
  padding,
3565
3626
  paddingX,
@@ -3624,7 +3685,7 @@ var init_Box = __esm({
3624
3685
  onPointerDown?.(e);
3625
3686
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3626
3687
  const isClickable = action || onClick;
3627
- return React91__default.createElement(
3688
+ return React92__default.createElement(
3628
3689
  Component,
3629
3690
  {
3630
3691
  ref,
@@ -3720,7 +3781,7 @@ var init_Stack = __esm({
3720
3781
  };
3721
3782
  const isHorizontal = direction === "horizontal";
3722
3783
  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";
3723
- return React91__default.createElement(
3784
+ return React92__default.createElement(
3724
3785
  Component,
3725
3786
  {
3726
3787
  className: cn(
@@ -4212,7 +4273,7 @@ var init_MiniStateMachine = __esm({
4212
4273
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4213
4274
  const tc = transitionCounts[s.name] ?? 0;
4214
4275
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
4215
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
4276
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
4216
4277
  /* @__PURE__ */ jsx(
4217
4278
  AvlState,
4218
4279
  {
@@ -4663,7 +4724,7 @@ var init_Icon = __esm({
4663
4724
  const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
4664
4725
  const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
4665
4726
  const family = useIconFamily();
4666
- const RenderedComponent = React91__default.useMemo(() => {
4727
+ const RenderedComponent = React92__default.useMemo(() => {
4667
4728
  if (directIcon) return null;
4668
4729
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
4669
4730
  }, [directIcon, effectiveName, family]);
@@ -4783,7 +4844,7 @@ var init_atlasSlice = __esm({
4783
4844
  }
4784
4845
  });
4785
4846
  function useAtlasSliceDataUrl(asset) {
4786
- const [, bump] = React91.useReducer((x) => x + 1, 0);
4847
+ const [, bump] = React92.useReducer((x) => x + 1, 0);
4787
4848
  if (!isAtlasAsset(asset)) return void 0;
4788
4849
  const key = `${asset.atlas}#${asset.sprite}`;
4789
4850
  const cached = sliceDataUrlCache.get(key);
@@ -4846,13 +4907,13 @@ function AtlasImage({
4846
4907
  style,
4847
4908
  "aria-hidden": ariaHidden
4848
4909
  }) {
4849
- const [, bump] = React91.useReducer((x) => x + 1, 0);
4850
- const canvasRef = React91.useRef(null);
4910
+ const [, bump] = React92.useReducer((x) => x + 1, 0);
4911
+ const canvasRef = React92.useRef(null);
4851
4912
  const sliced = isAtlasAsset(asset);
4852
4913
  const atlas = sliced ? getAtlas(asset.atlas, bump) : void 0;
4853
4914
  const img = sliced && asset?.url ? getSheetImage(asset.url, bump) : null;
4854
4915
  const rect = sliced && atlas ? subRectFor(atlas, asset.sprite) : null;
4855
- React91.useEffect(() => {
4916
+ React92.useEffect(() => {
4856
4917
  const canvas = canvasRef.current;
4857
4918
  if (!canvas || !img || !rect) return;
4858
4919
  canvas.width = rect.sw;
@@ -4928,7 +4989,7 @@ function resolveIconProp(value, sizeClass) {
4928
4989
  const IconComp = value;
4929
4990
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
4930
4991
  }
4931
- if (React91__default.isValidElement(value)) {
4992
+ if (React92__default.isValidElement(value)) {
4932
4993
  return value;
4933
4994
  }
4934
4995
  if (typeof value === "object" && value !== null && isIconLike(value)) {
@@ -5005,7 +5066,7 @@ var init_Button = __esm({
5005
5066
  md: "h-icon-default w-icon-default",
5006
5067
  lg: "h-icon-default w-icon-default"
5007
5068
  };
5008
- Button = React91__default.forwardRef(
5069
+ Button = React92__default.forwardRef(
5009
5070
  ({
5010
5071
  className,
5011
5072
  variant = "primary",
@@ -5075,7 +5136,7 @@ var Dialog;
5075
5136
  var init_Dialog = __esm({
5076
5137
  "components/core/atoms/Dialog.tsx"() {
5077
5138
  init_cn();
5078
- Dialog = React91__default.forwardRef(
5139
+ Dialog = React92__default.forwardRef(
5079
5140
  ({
5080
5141
  role = "dialog",
5081
5142
  "aria-modal": ariaModal = true,
@@ -5638,7 +5699,7 @@ var init_Badge = __esm({
5638
5699
  md: "px-2.5 py-1 text-sm",
5639
5700
  lg: "px-3 py-1.5 text-base"
5640
5701
  };
5641
- Badge = React91__default.forwardRef(
5702
+ Badge = React92__default.forwardRef(
5642
5703
  ({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
5643
5704
  const iconSizes3 = {
5644
5705
  sm: "h-icon-default w-icon-default",
@@ -5988,7 +6049,7 @@ var init_SvgFlow = __esm({
5988
6049
  width = 100,
5989
6050
  height = 100
5990
6051
  }) => {
5991
- const markerId = React91__default.useMemo(() => {
6052
+ const markerId = React92__default.useMemo(() => {
5992
6053
  flowIdCounter += 1;
5993
6054
  return `almadar-flow-arrow-${flowIdCounter}`;
5994
6055
  }, []);
@@ -6581,7 +6642,7 @@ var init_SvgRing = __esm({
6581
6642
  width = 100,
6582
6643
  height = 100
6583
6644
  }) => {
6584
- const gradientId = React91__default.useMemo(() => {
6645
+ const gradientId = React92__default.useMemo(() => {
6585
6646
  ringIdCounter += 1;
6586
6647
  return `almadar-ring-glow-${ringIdCounter}`;
6587
6648
  }, []);
@@ -6762,7 +6823,7 @@ var init_Input = __esm({
6762
6823
  init_cn();
6763
6824
  init_Icon();
6764
6825
  init_useEventBus();
6765
- Input = React91__default.forwardRef(
6826
+ Input = React92__default.forwardRef(
6766
6827
  ({
6767
6828
  className,
6768
6829
  inputType,
@@ -6930,7 +6991,7 @@ var Label;
6930
6991
  var init_Label = __esm({
6931
6992
  "components/core/atoms/Label.tsx"() {
6932
6993
  init_cn();
6933
- Label = React91__default.forwardRef(
6994
+ Label = React92__default.forwardRef(
6934
6995
  ({ className, required, children, ...props }, ref) => {
6935
6996
  return /* @__PURE__ */ jsxs(
6936
6997
  "label",
@@ -6957,7 +7018,7 @@ var init_Textarea = __esm({
6957
7018
  "components/core/atoms/Textarea.tsx"() {
6958
7019
  init_cn();
6959
7020
  init_useEventBus();
6960
- Textarea = React91__default.forwardRef(
7021
+ Textarea = React92__default.forwardRef(
6961
7022
  ({ className, error, onChange, ...props }, ref) => {
6962
7023
  const eventBus = useEventBus();
6963
7024
  const handleChange = (e) => {
@@ -7196,7 +7257,7 @@ var init_Select = __esm({
7196
7257
  init_cn();
7197
7258
  init_Icon();
7198
7259
  init_useEventBus();
7199
- Select = React91__default.forwardRef(
7260
+ Select = React92__default.forwardRef(
7200
7261
  (props, _ref) => {
7201
7262
  const { multiple, searchable, clearable } = props;
7202
7263
  if (multiple || searchable || clearable) {
@@ -7213,7 +7274,7 @@ var init_Checkbox = __esm({
7213
7274
  "components/core/atoms/Checkbox.tsx"() {
7214
7275
  init_cn();
7215
7276
  init_useEventBus();
7216
- Checkbox = React91__default.forwardRef(
7277
+ Checkbox = React92__default.forwardRef(
7217
7278
  ({ className, label, id, onChange, ...props }, ref) => {
7218
7279
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7219
7280
  const eventBus = useEventBus();
@@ -7267,7 +7328,7 @@ var init_Spinner = __esm({
7267
7328
  md: "h-6 w-6",
7268
7329
  lg: "h-8 w-8"
7269
7330
  };
7270
- Spinner = React91__default.forwardRef(
7331
+ Spinner = React92__default.forwardRef(
7271
7332
  ({ className, size = "md", overlay, ...props }, ref) => {
7272
7333
  if (overlay) {
7273
7334
  return /* @__PURE__ */ jsx(
@@ -7357,7 +7418,7 @@ var init_Card = __esm({
7357
7418
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7358
7419
  "tile-image-first": "p-0 overflow-hidden"
7359
7420
  };
7360
- Card = React91__default.forwardRef(
7421
+ Card = React92__default.forwardRef(
7361
7422
  ({
7362
7423
  className,
7363
7424
  variant = "bordered",
@@ -7406,9 +7467,9 @@ var init_Card = __esm({
7406
7467
  }
7407
7468
  );
7408
7469
  Card.displayName = "Card";
7409
- CardHeader = React91__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7470
+ CardHeader = React92__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7410
7471
  CardHeader.displayName = "CardHeader";
7411
- CardTitle = React91__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7472
+ CardTitle = React92__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7412
7473
  "h3",
7413
7474
  {
7414
7475
  ref,
@@ -7421,11 +7482,11 @@ var init_Card = __esm({
7421
7482
  }
7422
7483
  ));
7423
7484
  CardTitle.displayName = "CardTitle";
7424
- CardContent = React91__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7485
+ CardContent = React92__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7425
7486
  CardContent.displayName = "CardContent";
7426
7487
  CardBody = CardContent;
7427
7488
  CardBody.displayName = "CardBody";
7428
- CardFooter = React91__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7489
+ CardFooter = React92__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7429
7490
  "div",
7430
7491
  {
7431
7492
  ref,
@@ -7512,7 +7573,7 @@ var init_FilterPill = __esm({
7512
7573
  md: "w-3.5 h-3.5",
7513
7574
  lg: "w-4 h-4"
7514
7575
  };
7515
- FilterPill = React91__default.forwardRef(
7576
+ FilterPill = React92__default.forwardRef(
7516
7577
  ({
7517
7578
  className,
7518
7579
  variant = "default",
@@ -7641,8 +7702,8 @@ var init_Avatar = __esm({
7641
7702
  actionPayload
7642
7703
  }) => {
7643
7704
  const eventBus = useEventBus();
7644
- const [imgFailed, setImgFailed] = React91__default.useState(false);
7645
- React91__default.useEffect(() => {
7705
+ const [imgFailed, setImgFailed] = React92__default.useState(false);
7706
+ React92__default.useEffect(() => {
7646
7707
  setImgFailed(false);
7647
7708
  }, [src]);
7648
7709
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -7755,7 +7816,7 @@ var init_Center = __esm({
7755
7816
  as: Component = "div"
7756
7817
  }) => {
7757
7818
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
7758
- return React91__default.createElement(Component, {
7819
+ return React92__default.createElement(Component, {
7759
7820
  className: cn(
7760
7821
  inline ? "inline-flex" : "flex",
7761
7822
  horizontal && "justify-center",
@@ -8023,7 +8084,7 @@ var init_Radio = __esm({
8023
8084
  md: "w-2.5 h-2.5",
8024
8085
  lg: "w-3 h-3"
8025
8086
  };
8026
- Radio = React91__default.forwardRef(
8087
+ Radio = React92__default.forwardRef(
8027
8088
  ({
8028
8089
  label,
8029
8090
  helperText,
@@ -8040,12 +8101,12 @@ var init_Radio = __esm({
8040
8101
  onChange,
8041
8102
  ...props
8042
8103
  }, ref) => {
8043
- const reactId = React91__default.useId();
8104
+ const reactId = React92__default.useId();
8044
8105
  const baseId = id || `radio-${reactId}`;
8045
8106
  const hasError = !!error;
8046
8107
  const eventBus = useEventBus();
8047
- const [selected, setSelected] = React91__default.useState(value);
8048
- React91__default.useEffect(() => {
8108
+ const [selected, setSelected] = React92__default.useState(value);
8109
+ React92__default.useEffect(() => {
8049
8110
  if (value !== void 0) setSelected(value);
8050
8111
  }, [value]);
8051
8112
  const pick = (next, e) => {
@@ -8227,7 +8288,7 @@ var init_Switch = __esm({
8227
8288
  "components/core/atoms/Switch.tsx"() {
8228
8289
  "use client";
8229
8290
  init_cn();
8230
- Switch = React91.forwardRef(
8291
+ Switch = React92.forwardRef(
8231
8292
  ({
8232
8293
  checked,
8233
8294
  defaultChecked = false,
@@ -8238,10 +8299,10 @@ var init_Switch = __esm({
8238
8299
  name,
8239
8300
  className
8240
8301
  }, ref) => {
8241
- const [isChecked, setIsChecked] = React91.useState(
8302
+ const [isChecked, setIsChecked] = React92.useState(
8242
8303
  checked !== void 0 ? checked : defaultChecked
8243
8304
  );
8244
- React91.useEffect(() => {
8305
+ React92.useEffect(() => {
8245
8306
  if (checked !== void 0) {
8246
8307
  setIsChecked(checked);
8247
8308
  }
@@ -8519,7 +8580,7 @@ var Aside;
8519
8580
  var init_Aside = __esm({
8520
8581
  "components/core/atoms/Aside.tsx"() {
8521
8582
  init_cn();
8522
- Aside = React91__default.forwardRef(
8583
+ Aside = React92__default.forwardRef(
8523
8584
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8524
8585
  );
8525
8586
  Aside.displayName = "Aside";
@@ -8598,9 +8659,9 @@ var init_LawReferenceTooltip = __esm({
8598
8659
  className
8599
8660
  }) => {
8600
8661
  const { t } = useTranslate();
8601
- const [isVisible, setIsVisible] = React91__default.useState(false);
8602
- const timeoutRef = React91__default.useRef(null);
8603
- const triggerRef = React91__default.useRef(null);
8662
+ const [isVisible, setIsVisible] = React92__default.useState(false);
8663
+ const timeoutRef = React92__default.useRef(null);
8664
+ const triggerRef = React92__default.useRef(null);
8604
8665
  const handleMouseEnter = () => {
8605
8666
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8606
8667
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8611,7 +8672,7 @@ var init_LawReferenceTooltip = __esm({
8611
8672
  };
8612
8673
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
8613
8674
  const open = isVisible || revealed;
8614
- React91__default.useEffect(() => {
8675
+ React92__default.useEffect(() => {
8615
8676
  return () => {
8616
8677
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8617
8678
  };
@@ -8821,7 +8882,7 @@ var init_StatusDot = __esm({
8821
8882
  md: "w-2.5 h-2.5",
8822
8883
  lg: "w-3 h-3"
8823
8884
  };
8824
- StatusDot = React91__default.forwardRef(
8885
+ StatusDot = React92__default.forwardRef(
8825
8886
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
8826
8887
  return /* @__PURE__ */ jsx(
8827
8888
  "span",
@@ -8875,7 +8936,7 @@ var init_TrendIndicator = __esm({
8875
8936
  down: "trending-down",
8876
8937
  flat: "arrow-right"
8877
8938
  };
8878
- TrendIndicator = React91__default.forwardRef(
8939
+ TrendIndicator = React92__default.forwardRef(
8879
8940
  ({
8880
8941
  className,
8881
8942
  value,
@@ -8944,7 +9005,7 @@ var init_RangeSlider = __esm({
8944
9005
  md: "w-4 h-4",
8945
9006
  lg: "w-5 h-5"
8946
9007
  };
8947
- RangeSlider = React91__default.forwardRef(
9008
+ RangeSlider = React92__default.forwardRef(
8948
9009
  ({
8949
9010
  className,
8950
9011
  min = 0,
@@ -9555,7 +9616,7 @@ var init_ContentSection = __esm({
9555
9616
  md: "py-16",
9556
9617
  lg: "py-24"
9557
9618
  };
9558
- ContentSection = React91__default.forwardRef(
9619
+ ContentSection = React92__default.forwardRef(
9559
9620
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9560
9621
  return /* @__PURE__ */ jsx(
9561
9622
  Box,
@@ -10089,7 +10150,7 @@ var init_AnimatedReveal = __esm({
10089
10150
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10090
10151
  "none": {}
10091
10152
  };
10092
- AnimatedReveal = React91__default.forwardRef(
10153
+ AnimatedReveal = React92__default.forwardRef(
10093
10154
  ({
10094
10155
  trigger = "scroll",
10095
10156
  animation = "fade-up",
@@ -10249,7 +10310,7 @@ var init_AnimatedGraphic = __esm({
10249
10310
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10250
10311
  "use client";
10251
10312
  init_cn();
10252
- AnimatedGraphic = React91__default.forwardRef(
10313
+ AnimatedGraphic = React92__default.forwardRef(
10253
10314
  ({
10254
10315
  src,
10255
10316
  svgContent,
@@ -10272,7 +10333,7 @@ var init_AnimatedGraphic = __esm({
10272
10333
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10273
10334
  const resolvedSvg = svgContent ?? fetchedSvg;
10274
10335
  const prevAnimateRef = useRef(animate);
10275
- const setRef = React91__default.useCallback(
10336
+ const setRef = React92__default.useCallback(
10276
10337
  (node) => {
10277
10338
  containerRef.current = node;
10278
10339
  if (typeof ref === "function") ref(node);
@@ -11000,9 +11061,9 @@ function ControlButton({
11000
11061
  className
11001
11062
  }) {
11002
11063
  const eventBus = useEventBus();
11003
- const [isPressed, setIsPressed] = React91.useState(false);
11064
+ const [isPressed, setIsPressed] = React92.useState(false);
11004
11065
  const actualPressed = pressed ?? isPressed;
11005
- const handlePointerDown = React91.useCallback(
11066
+ const handlePointerDown = React92.useCallback(
11006
11067
  (e) => {
11007
11068
  e.preventDefault();
11008
11069
  if (disabled) return;
@@ -11012,7 +11073,7 @@ function ControlButton({
11012
11073
  },
11013
11074
  [disabled, pressEvent, eventBus, onPress]
11014
11075
  );
11015
- const handlePointerUp = React91.useCallback(
11076
+ const handlePointerUp = React92.useCallback(
11016
11077
  (e) => {
11017
11078
  e.preventDefault();
11018
11079
  if (disabled) return;
@@ -11022,7 +11083,7 @@ function ControlButton({
11022
11083
  },
11023
11084
  [disabled, releaseEvent, eventBus, onRelease]
11024
11085
  );
11025
- const handlePointerLeave = React91.useCallback(
11086
+ const handlePointerLeave = React92.useCallback(
11026
11087
  (e) => {
11027
11088
  if (isPressed) {
11028
11089
  setIsPressed(false);
@@ -11093,7 +11154,7 @@ var init_ControlButton = __esm({
11093
11154
  ControlButton.displayName = "ControlButton";
11094
11155
  }
11095
11156
  });
11096
- function formatTime(seconds, format) {
11157
+ function formatTime2(seconds, format) {
11097
11158
  const clamped = Math.max(0, Math.floor(seconds));
11098
11159
  if (format === "ss") {
11099
11160
  return `${clamped}s`;
@@ -11130,7 +11191,7 @@ function TimerDisplay({
11130
11191
  ),
11131
11192
  children: [
11132
11193
  iconAsset && /* @__PURE__ */ jsx(GameIcon, { assetUrl: iconAsset, icon: "image", size: 16, className: "w-4 h-4 object-contain flex-shrink-0" }),
11133
- formatTime(seconds, format)
11194
+ formatTime2(seconds, format)
11134
11195
  ]
11135
11196
  }
11136
11197
  );
@@ -11263,6 +11324,210 @@ var init_ChoiceButton = __esm({
11263
11324
  ChoiceButton.displayName = "ChoiceButton";
11264
11325
  }
11265
11326
  });
11327
+ function SvgStage({
11328
+ cols,
11329
+ rows,
11330
+ tileSize = 32,
11331
+ background = "var(--color-background)",
11332
+ tileClickEvent,
11333
+ tileHoverEvent,
11334
+ tileLeaveEvent,
11335
+ keyMap,
11336
+ keyUpMap,
11337
+ className,
11338
+ children
11339
+ }) {
11340
+ const eventBus = useEventBus();
11341
+ const svgRef = useRef(null);
11342
+ const pointerDownRef = useRef(null);
11343
+ const cellFromClient = useCallback((clientX, clientY) => {
11344
+ const svg = svgRef.current;
11345
+ if (!svg) return null;
11346
+ const rect = svg.getBoundingClientRect();
11347
+ if (rect.width === 0 || rect.height === 0) return null;
11348
+ const vbW = cols * tileSize;
11349
+ const vbH = rows * tileSize;
11350
+ const meet = Math.min(rect.width / vbW, rect.height / vbH);
11351
+ const offsetX = (rect.width - vbW * meet) / 2;
11352
+ const offsetY = (rect.height - vbH * meet) / 2;
11353
+ const svgX = (clientX - rect.left - offsetX) / meet;
11354
+ const svgY = (clientY - rect.top - offsetY) / meet;
11355
+ return {
11356
+ x: Math.min(Math.max(Math.floor(svgX / tileSize), 0), cols - 1),
11357
+ y: Math.min(Math.max(Math.floor(svgY / tileSize), 0), rows - 1)
11358
+ };
11359
+ }, [cols, rows, tileSize]);
11360
+ const handlePointerDown = useCallback((e) => {
11361
+ pointerDownRef.current = { clientX: e.clientX, clientY: e.clientY };
11362
+ }, []);
11363
+ const handlePointerUp = useCallback((e) => {
11364
+ const down = pointerDownRef.current;
11365
+ pointerDownRef.current = null;
11366
+ if (!tileClickEvent) return;
11367
+ if (down && Math.hypot(e.clientX - down.clientX, e.clientY - down.clientY) > 5) return;
11368
+ const cell = cellFromClient(e.clientX, e.clientY);
11369
+ if (cell) eventBus.emit(`UI:${tileClickEvent}`, cell);
11370
+ }, [cellFromClient, tileClickEvent, eventBus]);
11371
+ const handlePointerMove = useCallback((e) => {
11372
+ if (!tileHoverEvent) return;
11373
+ const cell = cellFromClient(e.clientX, e.clientY);
11374
+ if (cell) eventBus.emit(`UI:${tileHoverEvent}`, cell);
11375
+ }, [cellFromClient, tileHoverEvent, eventBus]);
11376
+ const handlePointerLeave = useCallback(() => {
11377
+ pointerDownRef.current = null;
11378
+ if (tileLeaveEvent) eventBus.emit(`UI:${tileLeaveEvent}`, {});
11379
+ }, [tileLeaveEvent, eventBus]);
11380
+ useEffect(() => {
11381
+ if (!keyMap && !keyUpMap) return;
11382
+ const onDown = (e) => {
11383
+ const ev = keyMap?.[e.code];
11384
+ if (ev) {
11385
+ eventBus.emit(`UI:${ev}`, {});
11386
+ e.preventDefault();
11387
+ }
11388
+ };
11389
+ const onUp = (e) => {
11390
+ const ev = keyUpMap?.[e.code];
11391
+ if (ev) eventBus.emit(`UI:${ev}`, {});
11392
+ };
11393
+ window.addEventListener("keydown", onDown);
11394
+ window.addEventListener("keyup", onUp);
11395
+ return () => {
11396
+ window.removeEventListener("keydown", onDown);
11397
+ window.removeEventListener("keyup", onUp);
11398
+ };
11399
+ }, [keyMap, keyUpMap, eventBus]);
11400
+ useEffect(() => {
11401
+ if (!keyMap && !keyUpMap) return;
11402
+ svgRef.current?.focus();
11403
+ }, [keyMap, keyUpMap]);
11404
+ const stageContext = useMemo(() => ({ tileSize }), [tileSize]);
11405
+ return /* @__PURE__ */ jsxs(
11406
+ "svg",
11407
+ {
11408
+ ref: svgRef,
11409
+ "data-testid": "svg-stage",
11410
+ viewBox: `0 0 ${cols * tileSize} ${rows * tileSize}`,
11411
+ preserveAspectRatio: "xMidYMid meet",
11412
+ className: cn("block h-full w-full", className),
11413
+ tabIndex: keyMap || keyUpMap ? 0 : void 0,
11414
+ onPointerDown: handlePointerDown,
11415
+ onPointerMove: handlePointerMove,
11416
+ onPointerUp: handlePointerUp,
11417
+ onPointerLeave: handlePointerLeave,
11418
+ children: [
11419
+ /* @__PURE__ */ jsx("rect", { width: cols * tileSize, height: rows * tileSize, fill: background }),
11420
+ /* @__PURE__ */ jsx(SvgStageContext.Provider, { value: stageContext, children })
11421
+ ]
11422
+ }
11423
+ );
11424
+ }
11425
+ var SvgStageContext;
11426
+ var init_SvgStage = __esm({
11427
+ "components/game/molecules/SvgStage.tsx"() {
11428
+ "use client";
11429
+ init_cn();
11430
+ init_useEventBus();
11431
+ SvgStageContext = React92.createContext({ tileSize: 1 });
11432
+ SvgStage.displayName = "SvgStage";
11433
+ }
11434
+ });
11435
+ function SvgDrawShape({
11436
+ shape,
11437
+ x,
11438
+ y,
11439
+ width,
11440
+ height,
11441
+ radius,
11442
+ radiusY,
11443
+ points,
11444
+ d,
11445
+ x2,
11446
+ y2,
11447
+ fill,
11448
+ stroke,
11449
+ strokeWidth,
11450
+ opacity,
11451
+ className
11452
+ }) {
11453
+ const { tileSize } = useContext(SvgStageContext);
11454
+ const cell = (v) => v === void 0 ? void 0 : v * tileSize;
11455
+ const paint = {
11456
+ fill: fill ?? (stroke === void 0 ? "var(--color-primary)" : "none"),
11457
+ stroke,
11458
+ strokeWidth,
11459
+ opacity,
11460
+ className
11461
+ };
11462
+ return /* @__PURE__ */ jsxs("g", { transform: `translate(${x * tileSize} ${y * tileSize})`, children: [
11463
+ shape === "rect" && /* @__PURE__ */ jsx("rect", { width: cell(width), height: cell(height), ...paint }),
11464
+ shape === "circle" && /* @__PURE__ */ jsx("circle", { r: cell(radius), ...paint }),
11465
+ shape === "ellipse" && /* @__PURE__ */ jsx("ellipse", { rx: cell(radius), ry: cell(radiusY ?? radius), ...paint }),
11466
+ shape === "polygon" && /* @__PURE__ */ jsx("polygon", { points, ...paint }),
11467
+ shape === "polyline" && /* @__PURE__ */ jsx("polyline", { points, ...paint }),
11468
+ shape === "path" && /* @__PURE__ */ jsx("path", { d, ...paint }),
11469
+ shape === "line" && /* @__PURE__ */ jsx("line", { x2: cell(x2), y2: cell(y2), ...paint })
11470
+ ] });
11471
+ }
11472
+ var init_SvgDrawShape = __esm({
11473
+ "components/game/atoms/SvgDrawShape.tsx"() {
11474
+ "use client";
11475
+ init_SvgStage();
11476
+ SvgDrawShape.displayName = "SvgDrawShape";
11477
+ }
11478
+ });
11479
+ function SvgDrawGroup({
11480
+ x = 0,
11481
+ y = 0,
11482
+ scale,
11483
+ rotate,
11484
+ opacity,
11485
+ className,
11486
+ children
11487
+ }) {
11488
+ const { tileSize } = useContext(SvgStageContext);
11489
+ const transforms = [`translate(${x * tileSize} ${y * tileSize})`];
11490
+ if (rotate !== void 0) transforms.push(`rotate(${rotate})`);
11491
+ if (scale !== void 0) transforms.push(`scale(${scale})`);
11492
+ return /* @__PURE__ */ jsx("g", { transform: transforms.join(" "), opacity, className, children });
11493
+ }
11494
+ var init_SvgDrawGroup = __esm({
11495
+ "components/game/atoms/SvgDrawGroup.tsx"() {
11496
+ "use client";
11497
+ init_SvgStage();
11498
+ SvgDrawGroup.displayName = "SvgDrawGroup";
11499
+ }
11500
+ });
11501
+ function SvgDrawText({
11502
+ x,
11503
+ y,
11504
+ text,
11505
+ size = 12,
11506
+ fill = "var(--color-foreground)",
11507
+ anchor = "middle",
11508
+ className
11509
+ }) {
11510
+ const { tileSize } = useContext(SvgStageContext);
11511
+ return /* @__PURE__ */ jsx(
11512
+ "text",
11513
+ {
11514
+ x: x * tileSize,
11515
+ y: y * tileSize,
11516
+ fontSize: size,
11517
+ fill,
11518
+ textAnchor: anchor,
11519
+ className,
11520
+ children: text
11521
+ }
11522
+ );
11523
+ }
11524
+ var init_SvgDrawText = __esm({
11525
+ "components/game/atoms/SvgDrawText.tsx"() {
11526
+ "use client";
11527
+ init_SvgStage();
11528
+ SvgDrawText.displayName = "SvgDrawText";
11529
+ }
11530
+ });
11266
11531
  function ControlGrid({
11267
11532
  kind,
11268
11533
  buttons = DEFAULT_BUTTONS,
@@ -11280,8 +11545,8 @@ function ControlGrid({
11280
11545
  className
11281
11546
  }) {
11282
11547
  const eventBus = useEventBus();
11283
- const [active, setActive] = React91.useState(/* @__PURE__ */ new Set());
11284
- const handlePress = React91.useCallback(
11548
+ const [active, setActive] = React92.useState(/* @__PURE__ */ new Set());
11549
+ const handlePress = React92.useCallback(
11285
11550
  (id) => {
11286
11551
  setActive((prev) => new Set(prev).add(id));
11287
11552
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -11295,7 +11560,7 @@ function ControlGrid({
11295
11560
  },
11296
11561
  [kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
11297
11562
  );
11298
- const handleRelease = React91.useCallback(
11563
+ const handleRelease = React92.useCallback(
11299
11564
  (id) => {
11300
11565
  setActive((prev) => {
11301
11566
  const next = new Set(prev);
@@ -11653,7 +11918,7 @@ function GameMenu({
11653
11918
  }) {
11654
11919
  const resolvedOptions = (options?.length ? options : void 0) ?? (menuItems?.length ? menuItems : void 0) ?? DEFAULT_MENU_OPTIONS;
11655
11920
  const eventBus = useEventBus();
11656
- const handleOptionClick = React91.useCallback(
11921
+ const handleOptionClick = React92.useCallback(
11657
11922
  (option) => {
11658
11923
  if (option.event) {
11659
11924
  eventBus.emit(`UI:${option.event}`, { option });
@@ -11889,7 +12154,7 @@ function StateGraph({
11889
12154
  }) {
11890
12155
  const eventBus = useEventBus();
11891
12156
  const nodes = states ?? [];
11892
- const positions = React91.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
12157
+ const positions = React92.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
11893
12158
  return /* @__PURE__ */ jsxs(
11894
12159
  Box,
11895
12160
  {
@@ -11960,8 +12225,8 @@ function MiniMap({
11960
12225
  tileAssets,
11961
12226
  unitAssets
11962
12227
  }) {
11963
- const canvasRef = React91.useRef(null);
11964
- const imgCacheRef = React91.useRef(/* @__PURE__ */ new Map());
12228
+ const canvasRef = React92.useRef(null);
12229
+ const imgCacheRef = React92.useRef(/* @__PURE__ */ new Map());
11965
12230
  function loadImg(url) {
11966
12231
  const cached = imgCacheRef.current.get(url);
11967
12232
  if (cached) return cached.complete ? cached : null;
@@ -11976,7 +12241,7 @@ function MiniMap({
11976
12241
  imgCacheRef.current.set(url, img);
11977
12242
  return null;
11978
12243
  }
11979
- React91.useEffect(() => {
12244
+ React92.useEffect(() => {
11980
12245
  const canvas = canvasRef.current;
11981
12246
  if (!canvas) return;
11982
12247
  const ctx = canvas.getContext("2d");
@@ -13288,6 +13553,32 @@ var init_Canvas = __esm({
13288
13553
  Canvas.displayName = "Canvas";
13289
13554
  }
13290
13555
  });
13556
+ function SvgDrawShapeLayer({
13557
+ items,
13558
+ fill,
13559
+ stroke,
13560
+ strokeWidth,
13561
+ opacity
13562
+ }) {
13563
+ return /* @__PURE__ */ jsx("g", { children: items.map(({ id, ...shape }) => /* @__PURE__ */ jsx(
13564
+ SvgDrawShape,
13565
+ {
13566
+ ...shape,
13567
+ fill: shape.fill ?? fill,
13568
+ stroke: shape.stroke ?? stroke,
13569
+ strokeWidth: shape.strokeWidth ?? strokeWidth,
13570
+ opacity: shape.opacity ?? opacity
13571
+ },
13572
+ id
13573
+ )) });
13574
+ }
13575
+ var init_SvgDrawShapeLayer = __esm({
13576
+ "components/game/molecules/SvgDrawShapeLayer.tsx"() {
13577
+ "use client";
13578
+ init_SvgDrawShape();
13579
+ SvgDrawShapeLayer.displayName = "SvgDrawShapeLayer";
13580
+ }
13581
+ });
13291
13582
  function GameAudioToggle({
13292
13583
  size = "sm",
13293
13584
  className,
@@ -13404,7 +13695,7 @@ function LinearView({
13404
13695
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
13405
13696
  const isDone = i < currentIdx;
13406
13697
  const isCurrent = i === currentIdx;
13407
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
13698
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
13408
13699
  i > 0 && /* @__PURE__ */ jsx(
13409
13700
  Typography,
13410
13701
  {
@@ -13939,7 +14230,7 @@ function SequenceBar({
13939
14230
  else onSlotRemove?.(index);
13940
14231
  }, [emit, slotRemoveEvent, onSlotRemove, playing]);
13941
14232
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
13942
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
14233
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
13943
14234
  i > 0 && /* @__PURE__ */ jsx(
13944
14235
  Typography,
13945
14236
  {
@@ -14588,7 +14879,7 @@ var init_ErrorBoundary = __esm({
14588
14879
  }
14589
14880
  );
14590
14881
  };
14591
- ErrorBoundary = class extends React91__default.Component {
14882
+ ErrorBoundary = class extends React92__default.Component {
14592
14883
  constructor(props) {
14593
14884
  super(props);
14594
14885
  __publicField(this, "reset", () => {
@@ -14857,7 +15148,7 @@ var init_Container = __esm({
14857
15148
  as: Component = "div"
14858
15149
  }) => {
14859
15150
  const resolvedSize = maxWidth ?? size ?? "lg";
14860
- return React91__default.createElement(
15151
+ return React92__default.createElement(
14861
15152
  Component,
14862
15153
  {
14863
15154
  className: cn(
@@ -16995,7 +17286,7 @@ var init_CodeBlock = __esm({
16995
17286
  DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
16996
17287
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16997
17288
  HIDDEN_LINE_NUMBERS = { display: "none" };
16998
- CodeBlock = React91__default.memo(
17289
+ CodeBlock = React92__default.memo(
16999
17290
  ({
17000
17291
  code: rawCode,
17001
17292
  language = "text",
@@ -17583,7 +17874,7 @@ var init_MarkdownContent = __esm({
17583
17874
  init_Box();
17584
17875
  init_CodeBlock();
17585
17876
  init_cn();
17586
- MarkdownContent = React91__default.memo(
17877
+ MarkdownContent = React92__default.memo(
17587
17878
  ({ content, direction = "ltr", className }) => {
17588
17879
  const { t: _t } = useTranslate();
17589
17880
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18910,7 +19201,7 @@ var init_StateMachineView = __esm({
18910
19201
  style: { top: title ? 30 : 0 },
18911
19202
  children: [
18912
19203
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
18913
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React91__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
19204
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React92__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18914
19205
  StateNode2,
18915
19206
  {
18916
19207
  state,
@@ -21655,9 +21946,6 @@ function normalizeFields(fields) {
21655
21946
  if (!fields) return [];
21656
21947
  return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
21657
21948
  }
21658
- function fieldLabel(key) {
21659
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
21660
- }
21661
21949
  function asBooleanValue(value) {
21662
21950
  if (typeof value === "boolean") return value;
21663
21951
  if (value === "true") return true;
@@ -21668,12 +21956,6 @@ function isDateField(key) {
21668
21956
  const lower = key.toLowerCase();
21669
21957
  return lower.includes("date") || lower.includes("time") || lower.endsWith("at") || lower.endsWith("_at");
21670
21958
  }
21671
- function formatDate(value) {
21672
- if (!value) return "";
21673
- const d = new Date(String(value));
21674
- if (isNaN(d.getTime())) return String(value);
21675
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
21676
- }
21677
21959
  function statusVariant(value) {
21678
21960
  const v = value.toLowerCase();
21679
21961
  if (["active", "completed", "done", "approved", "published", "resolved", "open"].includes(v)) return "success";
@@ -21682,11 +21964,12 @@ function statusVariant(value) {
21682
21964
  if (["new", "created", "scheduled", "queued"].includes(v)) return "info";
21683
21965
  return "default";
21684
21966
  }
21685
- var STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
21967
+ var fieldLabel, STATUS_FIELDS, gapStyles3, alignStyles2, CardGrid;
21686
21968
  var init_CardGrid = __esm({
21687
21969
  "components/core/organisms/CardGrid.tsx"() {
21688
21970
  "use client";
21689
21971
  init_cn();
21972
+ init_format();
21690
21973
  init_getNestedValue();
21691
21974
  init_useEventBus();
21692
21975
  init_atoms();
@@ -21695,6 +21978,7 @@ var init_CardGrid = __esm({
21695
21978
  init_Typography();
21696
21979
  init_Stack();
21697
21980
  init_Pagination();
21981
+ fieldLabel = humanizeFieldName;
21698
21982
  STATUS_FIELDS = /* @__PURE__ */ new Set(["status", "state", "priority", "type", "category", "role", "level", "tier"]);
21699
21983
  gapStyles3 = {
21700
21984
  none: "gap-0",
@@ -22202,7 +22486,7 @@ var init_CaseStudyOrganism = __esm({
22202
22486
  CaseStudyOrganism.displayName = "CaseStudyOrganism";
22203
22487
  }
22204
22488
  });
22205
- var CHART_COLORS, seriesColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
22489
+ var CHART_COLORS, seriesColor, barColor, monthFormatter, formatTimeLabel, BarChart, PieChart, LineChart, ScatterChart, LOOK_FROM_CHART_TYPE, Chart;
22206
22490
  var init_Chart = __esm({
22207
22491
  "components/core/molecules/Chart.tsx"() {
22208
22492
  "use client";
@@ -22222,6 +22506,7 @@ var init_Chart = __esm({
22222
22506
  "var(--color-accent)"
22223
22507
  ];
22224
22508
  seriesColor = (series, idx) => series.color ?? CHART_COLORS[idx % CHART_COLORS.length];
22509
+ barColor = (series, sIdx, catIdx, seriesCount) => series.color ?? CHART_COLORS[(seriesCount === 1 ? catIdx : sIdx) % CHART_COLORS.length];
22225
22510
  monthFormatter = new Intl.DateTimeFormat(void 0, {
22226
22511
  month: "short",
22227
22512
  year: "2-digit"
@@ -22294,7 +22579,7 @@ var init_Chart = __esm({
22294
22579
  children: series.map((s, sIdx) => {
22295
22580
  const value = valueAt(s, label);
22296
22581
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
22297
- const color = seriesColor(s, sIdx);
22582
+ const color = barColor(s, sIdx, catIdx, series.length);
22298
22583
  return /* @__PURE__ */ jsx(
22299
22584
  Box,
22300
22585
  {
@@ -22349,7 +22634,7 @@ var init_Chart = __esm({
22349
22634
  /* @__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) => {
22350
22635
  const value = valueAt(s, label);
22351
22636
  const barHeight = value / maxValue * 100;
22352
- const color = seriesColor(s, sIdx);
22637
+ const color = barColor(s, sIdx, catIdx, series.length);
22353
22638
  return /* @__PURE__ */ jsx(
22354
22639
  Box,
22355
22640
  {
@@ -22400,7 +22685,7 @@ var init_Chart = __esm({
22400
22685
  /* @__PURE__ */ jsx(VStack, { gap: "none", className: "w-full flex-1 min-h-0", justify: "end", children: series.map((s, sIdx) => {
22401
22686
  const value = valueAt(s, label);
22402
22687
  const ratio = stack === "normalize" ? total === 0 ? 0 : value / total * 100 : value / maxValue * 100;
22403
- const color = seriesColor(s, sIdx);
22688
+ const color = barColor(s, sIdx, catIdx, series.length);
22404
22689
  return /* @__PURE__ */ jsx(
22405
22690
  Box,
22406
22691
  {
@@ -24738,8 +25023,8 @@ var init_Menu = __esm({
24738
25023
  "bottom-end": "bottom-start"
24739
25024
  };
24740
25025
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
24741
- const triggerChild = React91__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
24742
- const triggerElement = React91__default.cloneElement(
25026
+ const triggerChild = React92__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
25027
+ const triggerElement = React92__default.cloneElement(
24743
25028
  triggerChild,
24744
25029
  {
24745
25030
  ref: triggerRef,
@@ -24834,14 +25119,14 @@ function useDataDnd(args) {
24834
25119
  const isZone = Boolean(dragGroup || accepts || sortable);
24835
25120
  const enabled = isZone || Boolean(dndRoot);
24836
25121
  const eventBus = useEventBus();
24837
- const parentRoot = React91__default.useContext(RootCtx);
25122
+ const parentRoot = React92__default.useContext(RootCtx);
24838
25123
  const isRoot = enabled && parentRoot === null;
24839
- const zoneId = React91__default.useId();
25124
+ const zoneId = React92__default.useId();
24840
25125
  const ownGroup = dragGroup ?? accepts ?? zoneId;
24841
- const [optimisticOrders, setOptimisticOrders] = React91__default.useState(() => /* @__PURE__ */ new Map());
24842
- const optimisticOrdersRef = React91__default.useRef(optimisticOrders);
25126
+ const [optimisticOrders, setOptimisticOrders] = React92__default.useState(() => /* @__PURE__ */ new Map());
25127
+ const optimisticOrdersRef = React92__default.useRef(optimisticOrders);
24843
25128
  optimisticOrdersRef.current = optimisticOrders;
24844
- const clearOptimisticOrder = React91__default.useCallback((group) => {
25129
+ const clearOptimisticOrder = React92__default.useCallback((group) => {
24845
25130
  setOptimisticOrders((prev) => {
24846
25131
  if (!prev.has(group)) return prev;
24847
25132
  const next = new Map(prev);
@@ -24866,7 +25151,7 @@ function useDataDnd(args) {
24866
25151
  const raw = it[dndItemIdField];
24867
25152
  return raw != null ? String(raw) : `__idx_${idx}`;
24868
25153
  }).join("|");
24869
- const itemIds = React91__default.useMemo(
25154
+ const itemIds = React92__default.useMemo(
24870
25155
  () => orderedItems.map((it, idx) => {
24871
25156
  const raw = it[dndItemIdField];
24872
25157
  return raw != null ? String(raw) : `__idx_${idx}`;
@@ -24877,7 +25162,7 @@ function useDataDnd(args) {
24877
25162
  const raw = it[dndItemIdField];
24878
25163
  return raw != null ? String(raw) : `__${idx}`;
24879
25164
  }).join("|");
24880
- React91__default.useEffect(() => {
25165
+ React92__default.useEffect(() => {
24881
25166
  const root = isRoot ? null : parentRoot;
24882
25167
  if (root) {
24883
25168
  root.clearOptimisticOrder(ownGroup);
@@ -24885,20 +25170,20 @@ function useDataDnd(args) {
24885
25170
  clearOptimisticOrder(ownGroup);
24886
25171
  }
24887
25172
  }, [itemsContentSig, ownGroup]);
24888
- const zonesRef = React91__default.useRef(/* @__PURE__ */ new Map());
24889
- const registerZone = React91__default.useCallback((zoneId2, meta2) => {
25173
+ const zonesRef = React92__default.useRef(/* @__PURE__ */ new Map());
25174
+ const registerZone = React92__default.useCallback((zoneId2, meta2) => {
24890
25175
  zonesRef.current.set(zoneId2, meta2);
24891
25176
  }, []);
24892
- const unregisterZone = React91__default.useCallback((zoneId2) => {
25177
+ const unregisterZone = React92__default.useCallback((zoneId2) => {
24893
25178
  zonesRef.current.delete(zoneId2);
24894
25179
  }, []);
24895
- const [activeDrag, setActiveDrag] = React91__default.useState(null);
24896
- const [overZoneGroup, setOverZoneGroup] = React91__default.useState(null);
24897
- const meta = React91__default.useMemo(
25180
+ const [activeDrag, setActiveDrag] = React92__default.useState(null);
25181
+ const [overZoneGroup, setOverZoneGroup] = React92__default.useState(null);
25182
+ const meta = React92__default.useMemo(
24898
25183
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
24899
25184
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
24900
25185
  );
24901
- React91__default.useEffect(() => {
25186
+ React92__default.useEffect(() => {
24902
25187
  const target = isRoot ? null : parentRoot;
24903
25188
  if (!target) {
24904
25189
  zonesRef.current.set(zoneId, meta);
@@ -24917,7 +25202,7 @@ function useDataDnd(args) {
24917
25202
  }, [parentRoot, isRoot, zoneId, meta]);
24918
25203
  const sensors = useAlmadarDndSensors(true);
24919
25204
  const collisionDetection = almadarDndCollisionDetection;
24920
- const findZoneByItem = React91__default.useCallback(
25205
+ const findZoneByItem = React92__default.useCallback(
24921
25206
  (id) => {
24922
25207
  for (const z of zonesRef.current.values()) {
24923
25208
  if (z.itemIds.includes(id)) return z;
@@ -24926,7 +25211,7 @@ function useDataDnd(args) {
24926
25211
  },
24927
25212
  []
24928
25213
  );
24929
- React91__default.useCallback(
25214
+ React92__default.useCallback(
24930
25215
  (group) => {
24931
25216
  for (const z of zonesRef.current.values()) {
24932
25217
  if (z.group === group) return z;
@@ -24935,7 +25220,7 @@ function useDataDnd(args) {
24935
25220
  },
24936
25221
  []
24937
25222
  );
24938
- const handleDragEnd = React91__default.useCallback(
25223
+ const handleDragEnd = React92__default.useCallback(
24939
25224
  (event) => {
24940
25225
  const { active, over } = event;
24941
25226
  const activeIdStr = String(active.id);
@@ -25026,8 +25311,8 @@ function useDataDnd(args) {
25026
25311
  },
25027
25312
  [eventBus]
25028
25313
  );
25029
- const sortableData = React91__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25030
- const SortableItem = React91__default.useCallback(
25314
+ const sortableData = React92__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25315
+ const SortableItem = React92__default.useCallback(
25031
25316
  ({ id, children }) => {
25032
25317
  const {
25033
25318
  attributes,
@@ -25067,7 +25352,7 @@ function useDataDnd(args) {
25067
25352
  id: droppableId,
25068
25353
  data: sortableData
25069
25354
  });
25070
- const ctx = React91__default.useContext(RootCtx);
25355
+ const ctx = React92__default.useContext(RootCtx);
25071
25356
  const activeDrag2 = ctx?.activeDrag ?? null;
25072
25357
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
25073
25358
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -25082,7 +25367,7 @@ function useDataDnd(args) {
25082
25367
  showForeignPlaceholder,
25083
25368
  ctxAvailable: ctx != null
25084
25369
  });
25085
- React91__default.useEffect(() => {
25370
+ React92__default.useEffect(() => {
25086
25371
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
25087
25372
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
25088
25373
  return /* @__PURE__ */ jsx(
@@ -25096,11 +25381,11 @@ function useDataDnd(args) {
25096
25381
  }
25097
25382
  );
25098
25383
  };
25099
- const rootContextValue = React91__default.useMemo(
25384
+ const rootContextValue = React92__default.useMemo(
25100
25385
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
25101
25386
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
25102
25387
  );
25103
- const handleDragStart = React91__default.useCallback((event) => {
25388
+ const handleDragStart = React92__default.useCallback((event) => {
25104
25389
  const sourceZone = findZoneByItem(event.active.id);
25105
25390
  const rect = event.active.rect.current.initial;
25106
25391
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -25119,7 +25404,7 @@ function useDataDnd(args) {
25119
25404
  isRoot
25120
25405
  });
25121
25406
  }, [findZoneByItem, isRoot, zoneId]);
25122
- const handleDragOver = React91__default.useCallback((event) => {
25407
+ const handleDragOver = React92__default.useCallback((event) => {
25123
25408
  const { active, over } = event;
25124
25409
  const overData = over?.data?.current;
25125
25410
  const overGroup = overData?.dndGroup ?? null;
@@ -25189,7 +25474,7 @@ function useDataDnd(args) {
25189
25474
  return next;
25190
25475
  });
25191
25476
  }, []);
25192
- const handleDragCancel = React91__default.useCallback((event) => {
25477
+ const handleDragCancel = React92__default.useCallback((event) => {
25193
25478
  setActiveDrag(null);
25194
25479
  setOverZoneGroup(null);
25195
25480
  dndLog.warn("dragCancel", {
@@ -25197,12 +25482,12 @@ function useDataDnd(args) {
25197
25482
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
25198
25483
  });
25199
25484
  }, []);
25200
- const handleDragEndWithCleanup = React91__default.useCallback((event) => {
25485
+ const handleDragEndWithCleanup = React92__default.useCallback((event) => {
25201
25486
  handleDragEnd(event);
25202
25487
  setActiveDrag(null);
25203
25488
  setOverZoneGroup(null);
25204
25489
  }, [handleDragEnd]);
25205
- const wrapContainer = React91__default.useCallback(
25490
+ const wrapContainer = React92__default.useCallback(
25206
25491
  (children) => {
25207
25492
  if (!enabled) return children;
25208
25493
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -25256,15 +25541,12 @@ var init_useDataDnd = __esm({
25256
25541
  init_useAlmadarDndCollision();
25257
25542
  init_Box();
25258
25543
  dndLog = createLogger("almadar:ui:dnd");
25259
- RootCtx = React91__default.createContext(null);
25544
+ RootCtx = React92__default.createContext(null);
25260
25545
  }
25261
25546
  });
25262
25547
  function renderIconInput(icon, props) {
25263
25548
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
25264
25549
  }
25265
- function fieldLabel2(key) {
25266
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
25267
- }
25268
25550
  function statusVariant2(value) {
25269
25551
  const v = value.toLowerCase();
25270
25552
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -25283,29 +25565,6 @@ function resolveBadgeVariant(field, value) {
25283
25565
  }
25284
25566
  return statusVariant2(value);
25285
25567
  }
25286
- function formatDate2(value) {
25287
- if (!value) return "";
25288
- const d = new Date(String(value));
25289
- if (isNaN(d.getTime())) return String(value);
25290
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
25291
- }
25292
- function formatValue(value, format) {
25293
- if (value === void 0 || value === null) return "";
25294
- switch (format) {
25295
- case "date":
25296
- return formatDate2(value);
25297
- case "currency":
25298
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
25299
- case "number":
25300
- return typeof value === "number" ? value.toLocaleString() : String(value);
25301
- case "percent":
25302
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
25303
- case "boolean":
25304
- return value ? "Yes" : "No";
25305
- default:
25306
- return String(value);
25307
- }
25308
- }
25309
25568
  function DataGrid({
25310
25569
  entity,
25311
25570
  fields,
@@ -25592,7 +25851,7 @@ function DataGrid({
25592
25851
  if (val === void 0 || val === null || val === "") return null;
25593
25852
  return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
25594
25853
  field.icon && renderIconInput(field.icon, { size: "xs" }),
25595
- /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: formatValue(val, field.format) })
25854
+ /* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: humanizeEnumValue(formatValue(val, field.format)) })
25596
25855
  ] }, field.name);
25597
25856
  }) })
25598
25857
  ] }),
@@ -25702,11 +25961,12 @@ function DataGrid({
25702
25961
  ] })
25703
25962
  );
25704
25963
  }
25705
- var dataGridLog, BADGE_VARIANTS, gapStyles5, lookStyles5;
25964
+ var dataGridLog, fieldLabel2, BADGE_VARIANTS, gapStyles5, lookStyles5;
25706
25965
  var init_DataGrid = __esm({
25707
25966
  "components/core/molecules/DataGrid.tsx"() {
25708
25967
  "use client";
25709
25968
  init_cn();
25969
+ init_format();
25710
25970
  init_getNestedValue();
25711
25971
  init_useEventBus();
25712
25972
  init_Box();
@@ -25719,6 +25979,7 @@ var init_DataGrid = __esm({
25719
25979
  init_Menu();
25720
25980
  init_useDataDnd();
25721
25981
  dataGridLog = createLogger("almadar:ui:data-grid");
25982
+ fieldLabel2 = humanizeFieldName;
25722
25983
  BADGE_VARIANTS = /* @__PURE__ */ new Set([
25723
25984
  "default",
25724
25985
  "primary",
@@ -25750,9 +26011,6 @@ var init_DataGrid = __esm({
25750
26011
  function renderIconInput2(icon, props) {
25751
26012
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
25752
26013
  }
25753
- function fieldLabel3(key) {
25754
- return key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
25755
- }
25756
26014
  function statusVariant3(value) {
25757
26015
  const v = value.toLowerCase();
25758
26016
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online"].includes(v)) return "success";
@@ -25761,28 +26019,12 @@ function statusVariant3(value) {
25761
26019
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
25762
26020
  return "default";
25763
26021
  }
25764
- function formatDate3(value) {
25765
- if (!value) return "";
25766
- const d = new Date(String(value));
25767
- if (isNaN(d.getTime())) return String(value);
25768
- return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
25769
- }
25770
26022
  function formatValue2(value, format, boolLabels) {
25771
- if (value === void 0 || value === null) return "";
25772
- switch (format) {
25773
- case "date":
25774
- return formatDate3(value);
25775
- case "currency":
25776
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
25777
- case "number":
25778
- return typeof value === "number" ? value.toLocaleString() : String(value);
25779
- case "percent":
25780
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
25781
- case "boolean":
25782
- return value ? boolLabels?.yes ?? "Yes" : boolLabels?.no ?? "No";
25783
- default:
25784
- return String(value);
26023
+ if (value !== void 0 && value !== null && (format === "boolean" || typeof value === "boolean")) {
26024
+ const isNo = value === false || value === 0 || String(value) === "false";
26025
+ return isNo ? boolLabels?.no ?? "No" : boolLabels?.yes ?? "Yes";
25785
26026
  }
26027
+ return formatValue(value, format);
25786
26028
  }
25787
26029
  function groupData(items, field) {
25788
26030
  const groups = /* @__PURE__ */ new Map();
@@ -25805,7 +26047,9 @@ function DataList({
25805
26047
  variant = "default",
25806
26048
  groupBy,
25807
26049
  senderField,
26050
+ senderLabelField,
25808
26051
  currentUser,
26052
+ emptyMessage,
25809
26053
  className,
25810
26054
  isLoading = false,
25811
26055
  error = null,
@@ -25837,7 +26081,7 @@ function DataList({
25837
26081
  }) {
25838
26082
  const eventBus = useEventBus();
25839
26083
  const { t } = useTranslate();
25840
- const [visibleCount, setVisibleCount] = React91__default.useState(pageSize || Infinity);
26084
+ const [visibleCount, setVisibleCount] = React92__default.useState(pageSize || Infinity);
25841
26085
  const fieldDefs = fields ?? columns ?? [];
25842
26086
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
25843
26087
  const dnd = useDataDnd({
@@ -25856,7 +26100,7 @@ function DataList({
25856
26100
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
25857
26101
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
25858
26102
  const hasRenderProp = typeof children === "function";
25859
- React91__default.useEffect(() => {
26103
+ React92__default.useEffect(() => {
25860
26104
  const renderItemTypeOf = typeof schemaRenderItem;
25861
26105
  const childrenTypeOf = typeof children;
25862
26106
  if (data.length > 0 && !hasRenderProp) {
@@ -25944,7 +26188,7 @@ function DataList({
25944
26188
  return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
25945
26189
  }
25946
26190
  if (data.length === 0) {
25947
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") }) });
26191
+ const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
25948
26192
  return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
25949
26193
  }
25950
26194
  const gapClass = {
@@ -25960,51 +26204,93 @@ function DataList({
25960
26204
  const items2 = [...data];
25961
26205
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
25962
26206
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
25963
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
25964
- group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
25965
- group.items.map((itemData, index) => {
25966
- const id = itemData.id || `${gi}-${index}`;
25967
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
25968
- const isSent = Boolean(currentUser && sender === currentUser);
25969
- const content = getNestedValue(itemData, contentField);
25970
- const timestampField = fieldDefs.find((f3) => f3.format === "date");
25971
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
25972
- return /* @__PURE__ */ jsx(
25973
- Box,
25974
- {
25975
- className: cn(
25976
- "flex px-4",
25977
- isSent ? "justify-end" : "justify-start"
25978
- ),
25979
- children: /* @__PURE__ */ jsxs(
25980
- Box,
25981
- {
25982
- className: cn(
25983
- "max-w-[75%] px-4 py-2",
25984
- isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
25985
- ),
25986
- children: [
25987
- !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
25988
- /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
25989
- timestamp != null ? /* @__PURE__ */ jsx(
25990
- Typography,
25991
- {
25992
- variant: "caption",
25993
- className: cn(
25994
- "mt-1 text-xs",
25995
- isSent ? "opacity-70" : "text-muted-foreground"
25996
- ),
25997
- children: formatDate3(timestamp)
25998
- }
25999
- ) : null
26000
- ]
26001
- }
26002
- )
26003
- },
26004
- id
26005
- );
26006
- })
26007
- ] }, gi)) });
26207
+ const senderLabel = (itemData, raw) => {
26208
+ if (!senderLabelField) return raw;
26209
+ const v = getNestedValue(itemData, senderLabelField);
26210
+ return v === void 0 || v === null || v === "" ? raw : String(v);
26211
+ };
26212
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
26213
+ groups2.map((group, gi) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
26214
+ group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
26215
+ group.items.map((itemData, index) => {
26216
+ const id = itemData.id || `${gi}-${index}`;
26217
+ const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
26218
+ const isSent = Boolean(currentUser && sender === currentUser);
26219
+ const content = getNestedValue(itemData, contentField);
26220
+ const timestampField = fieldDefs.find((f3) => f3.format === "date");
26221
+ const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
26222
+ const metaFields = fieldDefs.filter(
26223
+ (f3) => f3.name !== contentField && f3.name !== timestampField?.name
26224
+ );
26225
+ return /* @__PURE__ */ jsx(
26226
+ Box,
26227
+ {
26228
+ "data-entity-row": true,
26229
+ "data-entity-id": id,
26230
+ onClick: itemClickEvent ? handleRowClick(itemData) : void 0,
26231
+ className: cn(
26232
+ "flex px-4 group/rowactions",
26233
+ itemClickEvent && "cursor-pointer",
26234
+ isSent ? "justify-end" : "justify-start"
26235
+ ),
26236
+ children: /* @__PURE__ */ jsxs(
26237
+ Box,
26238
+ {
26239
+ className: cn(
26240
+ "max-w-[75%] px-4 py-2",
26241
+ isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
26242
+ ),
26243
+ children: [
26244
+ !isSent && senderField && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
26245
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
26246
+ metaFields.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
26247
+ const v = getNestedValue(itemData, f3.name);
26248
+ if (v === void 0 || v === null || v === "") return null;
26249
+ return f3.variant === "badge" ? /* @__PURE__ */ jsx(Badge, { variant: statusVariant3(String(v)), children: String(v) }, f3.name) : /* @__PURE__ */ jsx(
26250
+ Typography,
26251
+ {
26252
+ variant: "caption",
26253
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
26254
+ children: formatValue2(v, f3.format)
26255
+ },
26256
+ f3.name
26257
+ );
26258
+ }) }),
26259
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "mt-1 items-center justify-between", children: [
26260
+ timestamp != null ? /* @__PURE__ */ jsx(
26261
+ Typography,
26262
+ {
26263
+ variant: "caption",
26264
+ className: cn("text-xs", isSent ? "opacity-70" : "text-muted-foreground"),
26265
+ children: formatDate(timestamp)
26266
+ }
26267
+ ) : /* @__PURE__ */ jsx("span", {}),
26268
+ renderItemActions(itemData)
26269
+ ] })
26270
+ ]
26271
+ }
26272
+ )
26273
+ },
26274
+ id
26275
+ );
26276
+ })
26277
+ ] }, gi)),
26278
+ hasMoreLocal && /* @__PURE__ */ jsx(Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxs(
26279
+ Button,
26280
+ {
26281
+ variant: "ghost",
26282
+ size: "sm",
26283
+ onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
26284
+ children: [
26285
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
26286
+ t("common.showMore"),
26287
+ " (",
26288
+ t("common.remaining", { count: allData.length - visibleCount }),
26289
+ ")"
26290
+ ]
26291
+ }
26292
+ ) })
26293
+ ] });
26008
26294
  }
26009
26295
  const items = [...data];
26010
26296
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
@@ -26119,7 +26405,7 @@ function DataList({
26119
26405
  className
26120
26406
  ),
26121
26407
  children: [
26122
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
26408
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
26123
26409
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
26124
26410
  group.items.map(
26125
26411
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -26153,11 +26439,12 @@ function DataList({
26153
26439
  )
26154
26440
  );
26155
26441
  }
26156
- var dataListLog, listLookStyles;
26442
+ var dataListLog, fieldLabel3, listLookStyles;
26157
26443
  var init_DataList = __esm({
26158
26444
  "components/core/molecules/DataList.tsx"() {
26159
26445
  "use client";
26160
26446
  init_cn();
26447
+ init_format();
26161
26448
  init_getNestedValue();
26162
26449
  init_useEventBus();
26163
26450
  init_Box();
@@ -26172,6 +26459,7 @@ var init_DataList = __esm({
26172
26459
  init_Menu();
26173
26460
  init_useDataDnd();
26174
26461
  dataListLog = createLogger("almadar:ui:data-list");
26462
+ fieldLabel3 = humanizeFieldName;
26175
26463
  listLookStyles = {
26176
26464
  dense: "[&_[data-entity-row]>div]:!py-1 [&_[data-entity-row]>div]:!px-3",
26177
26465
  spacious: "[&_[data-entity-row]>div]:!py-5 [&_[data-entity-row]>div]:!px-8",
@@ -26204,7 +26492,7 @@ var init_FormSection = __esm({
26204
26492
  columns = 1,
26205
26493
  className
26206
26494
  }) => {
26207
- const [collapsed, setCollapsed] = React91__default.useState(defaultCollapsed);
26495
+ const [collapsed, setCollapsed] = React92__default.useState(defaultCollapsed);
26208
26496
  const { t } = useTranslate();
26209
26497
  const eventBus = useEventBus();
26210
26498
  const gridClass = {
@@ -26212,7 +26500,7 @@ var init_FormSection = __esm({
26212
26500
  2: "grid-cols-1 md:grid-cols-2",
26213
26501
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
26214
26502
  }[columns];
26215
- React91__default.useCallback(() => {
26503
+ React92__default.useCallback(() => {
26216
26504
  if (collapsible) {
26217
26505
  setCollapsed((prev) => !prev);
26218
26506
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -27081,7 +27369,7 @@ var init_Flex = __esm({
27081
27369
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
27082
27370
  }
27083
27371
  }
27084
- return React91__default.createElement(Component, {
27372
+ return React92__default.createElement(Component, {
27085
27373
  className: cn(
27086
27374
  inline ? "inline-flex" : "flex",
27087
27375
  directionStyles[direction],
@@ -27200,7 +27488,7 @@ var init_Grid = __esm({
27200
27488
  as: Component = "div"
27201
27489
  }) => {
27202
27490
  const mergedStyle = rows ? { gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))`, ...style } : style;
27203
- return React91__default.createElement(
27491
+ return React92__default.createElement(
27204
27492
  Component,
27205
27493
  {
27206
27494
  className: cn(
@@ -27408,9 +27696,9 @@ var init_Popover = __esm({
27408
27696
  onMouseLeave: handleClose,
27409
27697
  onPointerDown: tapTriggerProps.onPointerDown
27410
27698
  };
27411
- const childElement = React91__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
27699
+ const childElement = React92__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
27412
27700
  const childPointerDown = childElement.props.onPointerDown;
27413
- const triggerElement = React91__default.cloneElement(
27701
+ const triggerElement = React92__default.cloneElement(
27414
27702
  childElement,
27415
27703
  {
27416
27704
  ref: triggerRef,
@@ -28019,9 +28307,9 @@ var init_Tooltip = __esm({
28019
28307
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
28020
28308
  };
28021
28309
  }, []);
28022
- const triggerElement = React91__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
28310
+ const triggerElement = React92__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
28023
28311
  const childPointerDown = triggerElement.props.onPointerDown;
28024
- const trigger = React91__default.cloneElement(triggerElement, {
28312
+ const trigger = React92__default.cloneElement(triggerElement, {
28025
28313
  ref: triggerRef,
28026
28314
  onMouseEnter: handleMouseEnter,
28027
28315
  onMouseLeave: handleMouseLeave,
@@ -28111,7 +28399,7 @@ var init_WizardProgress = __esm({
28111
28399
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
28112
28400
  const isActive = index === currentStep;
28113
28401
  const isCompleted = index < currentStep;
28114
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
28402
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
28115
28403
  /* @__PURE__ */ jsx(
28116
28404
  "button",
28117
28405
  {
@@ -29672,13 +29960,13 @@ var init_MapView = __esm({
29672
29960
  shadowSize: [41, 41]
29673
29961
  });
29674
29962
  L.Marker.prototype.options.icon = defaultIcon;
29675
- const { useEffect: useEffect63, useRef: useRef62, useCallback: useCallback94, useState: useState97 } = React91__default;
29963
+ const { useEffect: useEffect64, useRef: useRef63, useCallback: useCallback95, useState: useState97 } = React92__default;
29676
29964
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
29677
29965
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
29678
29966
  function MapUpdater({ centerLat, centerLng, zoom }) {
29679
29967
  const map = useMap();
29680
- const prevRef = useRef62({ centerLat, centerLng, zoom });
29681
- useEffect63(() => {
29968
+ const prevRef = useRef63({ centerLat, centerLng, zoom });
29969
+ useEffect64(() => {
29682
29970
  const prev = prevRef.current;
29683
29971
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
29684
29972
  map.setView([centerLat, centerLng], zoom);
@@ -29689,7 +29977,7 @@ var init_MapView = __esm({
29689
29977
  }
29690
29978
  function MapClickHandler({ onMapClick }) {
29691
29979
  const map = useMap();
29692
- useEffect63(() => {
29980
+ useEffect64(() => {
29693
29981
  if (!onMapClick) return;
29694
29982
  const handler = (e) => {
29695
29983
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -29718,7 +30006,7 @@ var init_MapView = __esm({
29718
30006
  }) {
29719
30007
  const eventBus = useEventBus2();
29720
30008
  const [clickedPosition, setClickedPosition] = useState97(null);
29721
- const handleMapClick = useCallback94((lat, lng) => {
30009
+ const handleMapClick = useCallback95((lat, lng) => {
29722
30010
  if (showClickedPin) {
29723
30011
  setClickedPosition({ lat, lng });
29724
30012
  }
@@ -29727,7 +30015,7 @@ var init_MapView = __esm({
29727
30015
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
29728
30016
  }
29729
30017
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
29730
- const handleMarkerClick = useCallback94((marker) => {
30018
+ const handleMarkerClick = useCallback95((marker) => {
29731
30019
  onMarkerClick?.(marker);
29732
30020
  if (markerClickEvent) {
29733
30021
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -30527,7 +30815,7 @@ function renderIconInput3(icon, props) {
30527
30815
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
30528
30816
  }
30529
30817
  function columnLabel(col) {
30530
- return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
30818
+ return col.header ?? col.label ?? humanizeFieldName(col.key);
30531
30819
  }
30532
30820
  function asFieldValue(v) {
30533
30821
  if (v === void 0 || v === null) return v;
@@ -30546,25 +30834,6 @@ function statusVariant4(value) {
30546
30834
  if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
30547
30835
  return "default";
30548
30836
  }
30549
- function formatCell(value, format) {
30550
- if (value === void 0 || value === null) return "";
30551
- switch (format) {
30552
- case "date": {
30553
- const d = new Date(String(value));
30554
- return isNaN(d.getTime()) ? String(value) : d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
30555
- }
30556
- case "currency":
30557
- return typeof value === "number" ? `$${value.toFixed(2)}` : String(value);
30558
- case "number":
30559
- return typeof value === "number" ? value.toLocaleString() : String(value);
30560
- case "percent":
30561
- return typeof value === "number" ? `${Math.round(value)}%` : String(value);
30562
- case "boolean":
30563
- return value ? "Yes" : "No";
30564
- default:
30565
- return String(value);
30566
- }
30567
- }
30568
30837
  function groupData2(items, field) {
30569
30838
  const groups = /* @__PURE__ */ new Map();
30570
30839
  for (const item of items) {
@@ -30608,9 +30877,10 @@ function TableView({
30608
30877
  }) {
30609
30878
  const eventBus = useEventBus();
30610
30879
  const { t } = useTranslate();
30611
- const [visibleCount, setVisibleCount] = React91__default.useState(pageSize > 0 ? pageSize : Infinity);
30612
- const [localSelected, setLocalSelected] = React91__default.useState(/* @__PURE__ */ new Set());
30613
- const colDefs = columns ?? fields ?? [];
30880
+ const [visibleCount, setVisibleCount] = React92__default.useState(pageSize > 0 ? pageSize : Infinity);
30881
+ const [localSelected, setLocalSelected] = React92__default.useState(/* @__PURE__ */ new Set());
30882
+ const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
30883
+ const actionDefs = Array.isArray(itemActions) ? itemActions : [];
30614
30884
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
30615
30885
  const dnd = useDataDnd({
30616
30886
  items: allDataRaw,
@@ -30630,6 +30900,23 @@ function TableView({
30630
30900
  const hasRenderProp = typeof children === "function";
30631
30901
  const idField = dndItemIdField ?? "id";
30632
30902
  const isCoarsePointer = useMediaQuery("(pointer: coarse)");
30903
+ React92__default.useEffect(() => {
30904
+ tableViewLog.debug("render", {
30905
+ rowCount: data.length,
30906
+ colCount: colDefs.length,
30907
+ look,
30908
+ isLoading: Boolean(isLoading),
30909
+ hasError: Boolean(error),
30910
+ dnd: dnd.enabled
30911
+ });
30912
+ if (data.length > 0 && !hasRenderProp && colDefs.length === 0) {
30913
+ tableViewLog.warn("columns-unresolved", {
30914
+ rowCount: data.length,
30915
+ columnsIsArray: Array.isArray(columns),
30916
+ fieldsIsArray: Array.isArray(fields)
30917
+ });
30918
+ }
30919
+ }, [data, colDefs, look, isLoading, error, dnd.enabled, hasRenderProp, columns, fields]);
30633
30920
  const selected = selectedIds ? new Set(selectedIds) : localSelected;
30634
30921
  const emitSelection = (next) => {
30635
30922
  if (!selectedIds) setLocalSelected(next);
@@ -30662,7 +30949,7 @@ function TableView({
30662
30949
  };
30663
30950
  eventBus.emit(`UI:${action.event}`, payload);
30664
30951
  };
30665
- const colFloors = React91__default.useMemo(
30952
+ const colFloors = React92__default.useMemo(
30666
30953
  () => colDefs.map((col) => {
30667
30954
  const longest = data.reduce((widest, row) => {
30668
30955
  const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
@@ -30673,21 +30960,12 @@ function TableView({
30673
30960
  }),
30674
30961
  [colDefs, data]
30675
30962
  );
30676
- if (isLoading) {
30677
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") }) });
30678
- }
30679
- if (error) {
30680
- return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "error", children: error.message }) });
30681
- }
30682
- if (data.length === 0) {
30683
- const emptyNode = /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: emptyMessage || t("empty.noItems") }) });
30684
- return dnd.enabled ? /* @__PURE__ */ jsx(Fragment, { children: dnd.wrapContainer(emptyNode) }) : emptyNode;
30685
- }
30963
+ 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;
30686
30964
  const lk = LOOKS[look];
30687
- const hasActions = Boolean(itemActions && itemActions.length > 0);
30965
+ const hasActions = actionDefs.length > 0;
30688
30966
  const effectiveMaxInline = isCoarsePointer ? 0 : maxInlineActions;
30689
- const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(itemActions.length, effectiveMaxInline) : itemActions.length : 0;
30690
- const hasOverflowActions = hasActions && effectiveMaxInline != null && itemActions.length > effectiveMaxInline;
30967
+ const inlineActionCount = hasActions ? effectiveMaxInline != null ? Math.min(actionDefs.length, effectiveMaxInline) : actionDefs.length : 0;
30968
+ const hasOverflowActions = hasActions && effectiveMaxInline != null && actionDefs.length > effectiveMaxInline;
30691
30969
  const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
30692
30970
  const gridTemplateColumns = [
30693
30971
  selectable ? "auto" : null,
@@ -30775,11 +31053,11 @@ function TableView({
30775
31053
  col.className
30776
31054
  );
30777
31055
  if (col.format === "badge" && raw != null && raw !== "") {
30778
- 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);
31056
+ 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);
30779
31057
  }
30780
31058
  return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format) }) }, col.key);
30781
31059
  }),
30782
- itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(
31060
+ hasActions && /* @__PURE__ */ jsxs(
30783
31061
  HStack,
30784
31062
  {
30785
31063
  gap: "xs",
@@ -30791,7 +31069,7 @@ function TableView({
30791
31069
  lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
30792
31070
  ),
30793
31071
  children: [
30794
- (effectiveMaxInline != null ? itemActions.slice(0, effectiveMaxInline) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
31072
+ (effectiveMaxInline != null ? actionDefs.slice(0, effectiveMaxInline) : actionDefs).map((action, i) => /* @__PURE__ */ jsxs(
30795
31073
  Button,
30796
31074
  {
30797
31075
  variant: action.variant === "primary" ? "primary" : "ghost",
@@ -30807,12 +31085,12 @@ function TableView({
30807
31085
  },
30808
31086
  i
30809
31087
  )),
30810
- effectiveMaxInline != null && itemActions.length > effectiveMaxInline && /* @__PURE__ */ jsx(
31088
+ effectiveMaxInline != null && actionDefs.length > effectiveMaxInline && /* @__PURE__ */ jsx(
30811
31089
  Menu,
30812
31090
  {
30813
31091
  position: "bottom-end",
30814
31092
  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" }) }),
30815
- items: itemActions.slice(effectiveMaxInline).map((action) => ({
31093
+ items: actionDefs.slice(effectiveMaxInline).map((action) => ({
30816
31094
  label: action.label,
30817
31095
  icon: action.icon,
30818
31096
  event: action.event,
@@ -30830,24 +31108,25 @@ function TableView({
30830
31108
  ]
30831
31109
  }
30832
31110
  );
30833
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React91__default.Fragment, { children: rowInner }, id);
31111
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React92__default.Fragment, { children: rowInner }, id);
30834
31112
  };
30835
31113
  const items = Array.from(data);
30836
31114
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
30837
31115
  let runningIndex = 0;
30838
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
31116
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
30839
31117
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
30840
31118
  group.items.map((row) => renderRow(row, runningIndex++))
30841
31119
  ] }, gi)) });
31120
+ const showHeader = colDefs.length > 0 || hasRenderProp;
30842
31121
  return /* @__PURE__ */ jsxs(
30843
31122
  Box,
30844
31123
  {
30845
31124
  role: "table",
30846
31125
  className: cn("w-full text-sm", className),
30847
31126
  children: [
30848
- header,
30849
- dnd.wrapContainer(body),
30850
- 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: [
31127
+ showHeader && header,
31128
+ dnd.wrapContainer(statusNode ? /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: statusNode }) : body),
31129
+ !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: [
30851
31130
  /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
30852
31131
  t("common.showMore"),
30853
31132
  " (",
@@ -30858,11 +31137,12 @@ function TableView({
30858
31137
  }
30859
31138
  );
30860
31139
  }
30861
- var MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
31140
+ var tableViewLog, formatCell, MAX_MEASURED_COL_CH, BADGE_CHROME_CH, alignClass, weightClass, LOOKS;
30862
31141
  var init_TableView = __esm({
30863
31142
  "components/core/molecules/TableView.tsx"() {
30864
31143
  "use client";
30865
31144
  init_cn();
31145
+ init_format();
30866
31146
  init_getNestedValue();
30867
31147
  init_useEventBus();
30868
31148
  init_useMediaQuery();
@@ -30876,7 +31156,8 @@ var init_TableView = __esm({
30876
31156
  init_Divider();
30877
31157
  init_Menu();
30878
31158
  init_useDataDnd();
30879
- createLogger("almadar:ui:table-view");
31159
+ tableViewLog = createLogger("almadar:ui:table-view");
31160
+ formatCell = (value, format) => formatValue(value, format);
30880
31161
  MAX_MEASURED_COL_CH = 32;
30881
31162
  BADGE_CHROME_CH = 4;
30882
31163
  alignClass = {
@@ -32195,7 +32476,7 @@ var init_StepFlow = __esm({
32195
32476
  className
32196
32477
  }) => {
32197
32478
  if (orientation === "vertical") {
32198
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React91__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
32479
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React92__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
32199
32480
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
32200
32481
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
32201
32482
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -32206,7 +32487,7 @@ var init_StepFlow = __esm({
32206
32487
  ] })
32207
32488
  ] }) }, index)) });
32208
32489
  }
32209
- 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(React91__default.Fragment, { children: [
32490
+ 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(React92__default.Fragment, { children: [
32210
32491
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
32211
32492
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
32212
32493
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -33196,7 +33477,7 @@ var init_LikertScale = __esm({
33196
33477
  md: "text-base",
33197
33478
  lg: "text-lg"
33198
33479
  };
33199
- LikertScale = React91__default.forwardRef(
33480
+ LikertScale = React92__default.forwardRef(
33200
33481
  ({
33201
33482
  question,
33202
33483
  options = DEFAULT_LIKERT_OPTIONS,
@@ -33208,7 +33489,7 @@ var init_LikertScale = __esm({
33208
33489
  variant = "radios",
33209
33490
  className
33210
33491
  }, ref) => {
33211
- const groupId = React91__default.useId();
33492
+ const groupId = React92__default.useId();
33212
33493
  const eventBus = useEventBus();
33213
33494
  const handleSelect = useCallback(
33214
33495
  (next) => {
@@ -35497,7 +35778,7 @@ var init_DocBreadcrumb = __esm({
35497
35778
  "aria-label": t("aria.breadcrumb"),
35498
35779
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
35499
35780
  const isLast = idx === items.length - 1;
35500
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
35781
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
35501
35782
  idx > 0 && /* @__PURE__ */ jsx(
35502
35783
  Icon,
35503
35784
  {
@@ -36161,7 +36442,7 @@ var init_PageHeader = __esm({
36161
36442
  info: "bg-info/10 text-info"
36162
36443
  };
36163
36444
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
36164
- 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(React91__default.Fragment, { children: [
36445
+ 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(React92__default.Fragment, { children: [
36165
36446
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
36166
36447
  crumb.href ? /* @__PURE__ */ jsx(
36167
36448
  "a",
@@ -36519,7 +36800,7 @@ var init_Section = __esm({
36519
36800
  as: Component = "section"
36520
36801
  }) => {
36521
36802
  const hasHeader = title || description || action;
36522
- return React91__default.createElement(
36803
+ return React92__default.createElement(
36523
36804
  Component,
36524
36805
  {
36525
36806
  className: cn(
@@ -36893,7 +37174,7 @@ var init_WizardContainer = __esm({
36893
37174
  const isCompleted = index < currentStep;
36894
37175
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36895
37176
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36896
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
37177
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
36897
37178
  /* @__PURE__ */ jsx(
36898
37179
  Button,
36899
37180
  {
@@ -37851,6 +38132,7 @@ var init_GraphCanvas = __esm({
37851
38132
  title,
37852
38133
  nodes: propNodes = NO_NODES,
37853
38134
  edges: propEdges = NO_EDGES,
38135
+ proposedEdges = NO_EDGES,
37854
38136
  similarity: propSimilarity = NO_SIM,
37855
38137
  height = 400,
37856
38138
  showLabels = true,
@@ -37858,6 +38140,7 @@ var init_GraphCanvas = __esm({
37858
38140
  draggable = true,
37859
38141
  actions,
37860
38142
  onNodeClick,
38143
+ onMarkClick,
37861
38144
  onNodeDoubleClick,
37862
38145
  onBadgeClick,
37863
38146
  nodeClickEvent,
@@ -37886,6 +38169,18 @@ var init_GraphCanvas = __esm({
37886
38169
  const laidOutRef = useRef(false);
37887
38170
  const [, forceUpdate] = useState(0);
37888
38171
  const [logicalW, setLogicalW] = useState(800);
38172
+ const hasProposed = useMemo(() => propNodes.some((n) => n.mark?.kind === "proposed"), [propNodes]);
38173
+ const [pulseTick, setPulseTick] = useState(0);
38174
+ useEffect(() => {
38175
+ if (!hasProposed) return;
38176
+ let raf = 0;
38177
+ const loop = () => {
38178
+ setPulseTick((t2) => (t2 + 1) % 1e6);
38179
+ raf = requestAnimationFrame(loop);
38180
+ };
38181
+ raf = requestAnimationFrame(loop);
38182
+ return () => cancelAnimationFrame(raf);
38183
+ }, [hasProposed]);
37889
38184
  useEffect(() => {
37890
38185
  const canvas = canvasRef.current;
37891
38186
  if (!canvas || typeof ResizeObserver === "undefined") return;
@@ -38187,18 +38482,38 @@ var init_GraphCanvas = __esm({
38187
38482
  }
38188
38483
  }
38189
38484
  ctx.globalAlpha = 1;
38485
+ ctx.setLineDash([4, 4]);
38486
+ for (const edge of proposedEdges) {
38487
+ const source = nodes.find((n) => n.id === edge.source);
38488
+ const target = nodes.find((n) => n.id === edge.target);
38489
+ if (!source || !target) continue;
38490
+ ctx.globalAlpha = 0.4;
38491
+ ctx.beginPath();
38492
+ ctx.moveTo(source.x, source.y);
38493
+ ctx.lineTo(target.x, target.y);
38494
+ ctx.strokeStyle = edge.color || mutedColor;
38495
+ ctx.lineWidth = 1;
38496
+ ctx.stroke();
38497
+ }
38498
+ ctx.setLineDash([]);
38499
+ ctx.globalAlpha = 1;
38190
38500
  for (const node of nodes) {
38191
38501
  const size = node.size || 8;
38192
38502
  const color = resolveColor3(node.color || getGroupColor(node.group, groups), canvas);
38193
38503
  const isHovered = hoveredNode === node.id;
38194
38504
  const isSelected = selectedNodeId !== void 0 && node.id === selectedNodeId;
38195
- ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 1;
38505
+ const mark = node.mark;
38506
+ ctx.globalAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : mark?.kind === "proposed" ? 0.55 : 1;
38196
38507
  const radius = isSelected ? size + 4 : isHovered ? size + 2 : size;
38197
38508
  ctx.beginPath();
38198
38509
  ctx.arc(node.x, node.y, radius, 0, Math.PI * 2);
38199
- ctx.fillStyle = color;
38510
+ ctx.fillStyle = mark?.kind === "proposed" ? mutedColor : color;
38200
38511
  ctx.fill();
38201
- if (isSelected) {
38512
+ if (mark?.kind === "proposed") {
38513
+ ctx.setLineDash([3, 3]);
38514
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
38515
+ ctx.lineWidth = 1.5;
38516
+ } else if (isSelected) {
38202
38517
  ctx.strokeStyle = accentColor;
38203
38518
  ctx.lineWidth = 3;
38204
38519
  } else {
@@ -38206,6 +38521,28 @@ var init_GraphCanvas = __esm({
38206
38521
  ctx.lineWidth = isHovered ? 2 : 1;
38207
38522
  }
38208
38523
  ctx.stroke();
38524
+ ctx.setLineDash([]);
38525
+ if (mark?.kind === "suggested") {
38526
+ ctx.beginPath();
38527
+ ctx.arc(node.x, node.y, radius + 3, 0, Math.PI * 2);
38528
+ ctx.strokeStyle = accentColor;
38529
+ ctx.lineWidth = 2;
38530
+ ctx.stroke();
38531
+ ctx.beginPath();
38532
+ ctx.arc(node.x + radius * 0.7, node.y - radius * 0.7, 2.5, 0, Math.PI * 2);
38533
+ ctx.fillStyle = accentColor;
38534
+ ctx.fill();
38535
+ } else if (mark?.kind === "proposed") {
38536
+ const phase = pulseTick % 60 / 60;
38537
+ const baseAlpha = hoveredNode && !neighbors.has(node.id) ? 0.2 : 0.55;
38538
+ ctx.globalAlpha = baseAlpha * (0.4 + 0.4 * (1 - Math.abs(phase * 2 - 1)));
38539
+ ctx.beginPath();
38540
+ ctx.arc(node.x, node.y, radius + 6 + Math.sin(phase * Math.PI * 2) * 3, 0, Math.PI * 2);
38541
+ ctx.strokeStyle = resolveColor3(mark.tint ?? "var(--color-warning)", canvas);
38542
+ ctx.lineWidth = 1.5;
38543
+ ctx.stroke();
38544
+ ctx.globalAlpha = baseAlpha;
38545
+ }
38209
38546
  if (showLabels && node.label) {
38210
38547
  const displayLabel = truncateLabel(node.label);
38211
38548
  ctx.font = `${isSelected || isHovered ? "700" : "600"} 12px ${fontFamily}`;
@@ -38340,11 +38677,15 @@ var init_GraphCanvas = __esm({
38340
38677
  return;
38341
38678
  }
38342
38679
  }
38680
+ if (node.mark && onMarkClick) {
38681
+ onMarkClick(node);
38682
+ return;
38683
+ }
38343
38684
  handleNodeClick(node);
38344
38685
  }
38345
38686
  }
38346
38687
  },
38347
- [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
38688
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, onMarkClick, selectedNodeId]
38348
38689
  );
38349
38690
  const handlePointerLeave = useCallback(() => {
38350
38691
  setHoveredNode(null);
@@ -38620,7 +38961,7 @@ var init_ImportPreviewTree = __esm({
38620
38961
  const renderUnit = (unit, childrenByParent, depth) => {
38621
38962
  const summary = fieldSummary(unit);
38622
38963
  const children = childrenByParent.get(unit.ref) ?? [];
38623
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
38964
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
38624
38965
  /* @__PURE__ */ jsxs(
38625
38966
  Box,
38626
38967
  {
@@ -38717,7 +39058,7 @@ var init_ImportProgress = __esm({
38717
39058
  PIPELINE.map((key, index) => {
38718
39059
  const isComplete = index < currentIndex;
38719
39060
  const isActive = index === currentIndex;
38720
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
39061
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
38721
39062
  index > 0 ? /* @__PURE__ */ jsx(Box, { className: "h-px w-4 bg-border" }) : null,
38722
39063
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", "data-testid": `import-progress-step-${key}`, children: [
38723
39064
  /* @__PURE__ */ jsx(
@@ -38871,9 +39212,6 @@ var init_types2 = __esm({
38871
39212
  };
38872
39213
  }
38873
39214
  });
38874
- function humanizeFieldName(name) {
38875
- 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();
38876
- }
38877
39215
  function normalizeColumns(columns) {
38878
39216
  return columns.map((col) => {
38879
39217
  if (typeof col === "string") {
@@ -39298,6 +39636,7 @@ var init_DataTable = __esm({
39298
39636
  "components/core/organisms/DataTable.tsx"() {
39299
39637
  "use client";
39300
39638
  init_cn();
39639
+ init_format();
39301
39640
  init_getNestedValue();
39302
39641
  init_atoms();
39303
39642
  init_Box();
@@ -39350,9 +39689,6 @@ function getBadgeVariant(fieldName, value) {
39350
39689
  }
39351
39690
  return "default";
39352
39691
  }
39353
- function formatFieldLabel(fieldName) {
39354
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
39355
- }
39356
39692
  function formatFieldValue2(value, fieldName) {
39357
39693
  if (typeof value === "number") {
39358
39694
  if (fieldName.toLowerCase().includes("progress") || fieldName.toLowerCase().includes("percent")) {
@@ -39480,7 +39816,7 @@ function buildFieldTypeMap(fields) {
39480
39816
  }
39481
39817
  return map;
39482
39818
  }
39483
- var ReactMarkdown2, DetailPanel;
39819
+ var formatFieldLabel, ReactMarkdown2, DetailPanel;
39484
39820
  var init_DetailPanel = __esm({
39485
39821
  "components/core/organisms/DetailPanel.tsx"() {
39486
39822
  "use client";
@@ -39492,8 +39828,10 @@ var init_DetailPanel = __esm({
39492
39828
  init_ErrorState();
39493
39829
  init_EmptyState();
39494
39830
  init_cn();
39831
+ init_format();
39495
39832
  init_getNestedValue();
39496
39833
  init_useEventBus();
39834
+ formatFieldLabel = humanizeFieldName;
39497
39835
  ReactMarkdown2 = lazy(() => import('react-markdown'));
39498
39836
  DetailPanel = ({
39499
39837
  title: propTitle,
@@ -39823,7 +40161,7 @@ var init_DetailPanel = __esm({
39823
40161
  }
39824
40162
  });
39825
40163
  function extractTitle(children) {
39826
- if (!React91__default.isValidElement(children)) return void 0;
40164
+ if (!React92__default.isValidElement(children)) return void 0;
39827
40165
  const props = children.props;
39828
40166
  if (typeof props.title === "string") {
39829
40167
  return props.title;
@@ -40173,12 +40511,12 @@ var init_Form = __esm({
40173
40511
  const isSchemaEntity = isOrbitalEntitySchema(entity);
40174
40512
  const resolvedEntity = isSchemaEntity ? entity : void 0;
40175
40513
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
40176
- const normalizedInitialData = React91__default.useMemo(() => {
40514
+ const normalizedInitialData = React92__default.useMemo(() => {
40177
40515
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
40178
40516
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
40179
40517
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
40180
40518
  }, [entity, initialData]);
40181
- const entityDerivedFields = React91__default.useMemo(() => {
40519
+ const entityDerivedFields = React92__default.useMemo(() => {
40182
40520
  if (fields && fields.length > 0) return void 0;
40183
40521
  if (!resolvedEntity) return void 0;
40184
40522
  return resolvedEntity.fields.map(
@@ -40199,16 +40537,16 @@ var init_Form = __esm({
40199
40537
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
40200
40538
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
40201
40539
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
40202
- const [formData, setFormData] = React91__default.useState(
40540
+ const [formData, setFormData] = React92__default.useState(
40203
40541
  normalizedInitialData
40204
40542
  );
40205
- const [collapsedSections, setCollapsedSections] = React91__default.useState(
40543
+ const [collapsedSections, setCollapsedSections] = React92__default.useState(
40206
40544
  /* @__PURE__ */ new Set()
40207
40545
  );
40208
- const [submitError, setSubmitError] = React91__default.useState(null);
40209
- const formRef = React91__default.useRef(null);
40546
+ const [submitError, setSubmitError] = React92__default.useState(null);
40547
+ const formRef = React92__default.useRef(null);
40210
40548
  const formMode = props.mode;
40211
- const mountedRef = React91__default.useRef(false);
40549
+ const mountedRef = React92__default.useRef(false);
40212
40550
  if (!mountedRef.current) {
40213
40551
  mountedRef.current = true;
40214
40552
  debug("forms", "mount", {
@@ -40221,7 +40559,7 @@ var init_Form = __esm({
40221
40559
  });
40222
40560
  }
40223
40561
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
40224
- const evalContext = React91__default.useMemo(
40562
+ const evalContext = React92__default.useMemo(
40225
40563
  () => ({
40226
40564
  formValues: formData,
40227
40565
  globalVariables: externalContext?.globalVariables ?? {},
@@ -40230,7 +40568,7 @@ var init_Form = __esm({
40230
40568
  }),
40231
40569
  [formData, externalContext]
40232
40570
  );
40233
- React91__default.useEffect(() => {
40571
+ React92__default.useEffect(() => {
40234
40572
  debug("forms", "initialData-sync", {
40235
40573
  mode: formMode,
40236
40574
  normalizedInitialData,
@@ -40241,7 +40579,7 @@ var init_Form = __esm({
40241
40579
  setFormData(normalizedInitialData);
40242
40580
  }
40243
40581
  }, [normalizedInitialData]);
40244
- const processCalculations = React91__default.useCallback(
40582
+ const processCalculations = React92__default.useCallback(
40245
40583
  (changedFieldId, newFormData) => {
40246
40584
  if (!hiddenCalculations.length) return;
40247
40585
  const context = {
@@ -40266,7 +40604,7 @@ var init_Form = __esm({
40266
40604
  },
40267
40605
  [hiddenCalculations, externalContext, eventBus]
40268
40606
  );
40269
- const checkViolations = React91__default.useCallback(
40607
+ const checkViolations = React92__default.useCallback(
40270
40608
  (changedFieldId, newFormData) => {
40271
40609
  if (!violationTriggers.length) return;
40272
40610
  const context = {
@@ -40304,7 +40642,7 @@ var init_Form = __esm({
40304
40642
  processCalculations(name, newFormData);
40305
40643
  checkViolations(name, newFormData);
40306
40644
  };
40307
- const isFieldVisible = React91__default.useCallback(
40645
+ const isFieldVisible = React92__default.useCallback(
40308
40646
  (fieldName) => {
40309
40647
  const condition = conditionalFields[fieldName];
40310
40648
  if (!condition) return true;
@@ -40312,7 +40650,7 @@ var init_Form = __esm({
40312
40650
  },
40313
40651
  [conditionalFields, evalContext]
40314
40652
  );
40315
- const isSectionVisible = React91__default.useCallback(
40653
+ const isSectionVisible = React92__default.useCallback(
40316
40654
  (section) => {
40317
40655
  if (!section.condition) return true;
40318
40656
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -40388,7 +40726,7 @@ var init_Form = __esm({
40388
40726
  eventBus.emit(`UI:${onCancel}`);
40389
40727
  }
40390
40728
  };
40391
- const renderField = React91__default.useCallback(
40729
+ const renderField = React92__default.useCallback(
40392
40730
  (field) => {
40393
40731
  const fieldName = field.name || field.field;
40394
40732
  if (!fieldName) return null;
@@ -40409,7 +40747,7 @@ var init_Form = __esm({
40409
40747
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
40410
40748
  );
40411
40749
  const effectiveFields = entityDerivedFields ?? fields;
40412
- const normalizedFields = React91__default.useMemo(() => {
40750
+ const normalizedFields = React92__default.useMemo(() => {
40413
40751
  if (!effectiveFields || effectiveFields.length === 0) return [];
40414
40752
  return effectiveFields.map((field) => {
40415
40753
  if (typeof field === "string") {
@@ -40433,7 +40771,7 @@ var init_Form = __esm({
40433
40771
  return field;
40434
40772
  });
40435
40773
  }, [effectiveFields, resolvedEntity]);
40436
- const schemaFields = React91__default.useMemo(() => {
40774
+ const schemaFields = React92__default.useMemo(() => {
40437
40775
  if (normalizedFields.length === 0) return null;
40438
40776
  if (isDebugEnabled()) {
40439
40777
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -40443,7 +40781,7 @@ var init_Form = __esm({
40443
40781
  }
40444
40782
  return normalizedFields.map(renderField).filter(Boolean);
40445
40783
  }, [normalizedFields, renderField, entityName, conditionalFields]);
40446
- const sectionElements = React91__default.useMemo(() => {
40784
+ const sectionElements = React92__default.useMemo(() => {
40447
40785
  if (!sections || sections.length === 0) return null;
40448
40786
  return sections.map((section) => {
40449
40787
  if (!isSectionVisible(section)) {
@@ -41022,7 +41360,7 @@ function formatValue3(value, fieldName) {
41022
41360
  return String(value);
41023
41361
  }
41024
41362
  function formatFieldLabel2(fieldName) {
41025
- return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
41363
+ return humanizeFieldName(fieldName).replace(/\sId$/, "").trim();
41026
41364
  }
41027
41365
  var STATUS_STYLES, StatusBadge, ProgressIndicator, List3;
41028
41366
  var init_List = __esm({
@@ -41034,6 +41372,7 @@ var init_List = __esm({
41034
41372
  init_EmptyState();
41035
41373
  init_LoadingState();
41036
41374
  init_cn();
41375
+ init_format();
41037
41376
  init_getNestedValue();
41038
41377
  init_useEventBus();
41039
41378
  init_types2();
@@ -41168,7 +41507,7 @@ var init_List = __esm({
41168
41507
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
41169
41508
  return [];
41170
41509
  }, [entity]);
41171
- const getItemActions = React91__default.useCallback(
41510
+ const getItemActions = React92__default.useCallback(
41172
41511
  (item) => {
41173
41512
  if (!itemActions) return [];
41174
41513
  if (typeof itemActions === "function") {
@@ -41649,7 +41988,7 @@ var init_MediaGallery = __esm({
41649
41988
  [selectable, selectedItems, selectionEvent, eventBus]
41650
41989
  );
41651
41990
  const entityData = Array.isArray(entity) ? entity : [];
41652
- const items = React91__default.useMemo(() => {
41991
+ const items = React92__default.useMemo(() => {
41653
41992
  if (propItems && propItems.length > 0) return propItems;
41654
41993
  if (entityData.length === 0) return [];
41655
41994
  return entityData.map((record, idx) => {
@@ -41814,7 +42153,7 @@ var init_MediaGallery = __esm({
41814
42153
  }
41815
42154
  });
41816
42155
  function extractTitle2(children) {
41817
- if (!React91__default.isValidElement(children)) return void 0;
42156
+ if (!React92__default.isValidElement(children)) return void 0;
41818
42157
  const props = children.props;
41819
42158
  if (typeof props.title === "string") {
41820
42159
  return props.title;
@@ -42088,7 +42427,7 @@ var init_debugRegistry = __esm({
42088
42427
  }
42089
42428
  });
42090
42429
  function useDebugData() {
42091
- const [data, setData] = React91.useState(() => ({
42430
+ const [data, setData] = React92.useState(() => ({
42092
42431
  traits: [],
42093
42432
  ticks: [],
42094
42433
  guards: [],
@@ -42102,7 +42441,7 @@ function useDebugData() {
42102
42441
  },
42103
42442
  lastUpdate: Date.now()
42104
42443
  }));
42105
- React91.useEffect(() => {
42444
+ React92.useEffect(() => {
42106
42445
  const updateData = () => {
42107
42446
  setData({
42108
42447
  traits: getAllTraits(),
@@ -42211,12 +42550,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42211
42550
  return positions;
42212
42551
  }
42213
42552
  function WalkMinimap() {
42214
- const [walkStep, setWalkStep] = React91.useState(null);
42215
- const [traits2, setTraits] = React91.useState([]);
42216
- const [coveredEdges, setCoveredEdges] = React91.useState([]);
42217
- const [completedTraits, setCompletedTraits] = React91.useState(/* @__PURE__ */ new Set());
42218
- const prevTraitRef = React91.useRef(null);
42219
- React91.useEffect(() => {
42553
+ const [walkStep, setWalkStep] = React92.useState(null);
42554
+ const [traits2, setTraits] = React92.useState([]);
42555
+ const [coveredEdges, setCoveredEdges] = React92.useState([]);
42556
+ const [completedTraits, setCompletedTraits] = React92.useState(/* @__PURE__ */ new Set());
42557
+ const prevTraitRef = React92.useRef(null);
42558
+ React92.useEffect(() => {
42220
42559
  const interval = setInterval(() => {
42221
42560
  const w = window;
42222
42561
  const step = w.__orbitalWalkStep;
@@ -42514,7 +42853,7 @@ function TicksTab({ ticks: ticks2 }) {
42514
42853
  }
42515
42854
  );
42516
42855
  }
42517
- const formatTime2 = (ms) => {
42856
+ const formatTime3 = (ms) => {
42518
42857
  if (ms === 0) return "never";
42519
42858
  const seconds = Math.floor((Date.now() - ms) / 1e3);
42520
42859
  if (seconds < 1) return "just now";
@@ -42540,7 +42879,7 @@ function TicksTab({ ticks: ticks2 }) {
42540
42879
  tick.executionTime.toFixed(1),
42541
42880
  "ms exec"
42542
42881
  ] }),
42543
- /* @__PURE__ */ jsx("span", { children: formatTime2(tick.lastRun) })
42882
+ /* @__PURE__ */ jsx("span", { children: formatTime3(tick.lastRun) })
42544
42883
  ] }),
42545
42884
  tick.guardName && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxs(Badge, { variant: tick.guardPassed ? "success" : "danger", size: "sm", children: [
42546
42885
  tick.guardName,
@@ -42652,19 +42991,19 @@ var init_EntitiesTab = __esm({
42652
42991
  });
42653
42992
  function EventFlowTab({ events: events2 }) {
42654
42993
  const { t } = useTranslate();
42655
- const [filter, setFilter] = React91.useState("all");
42656
- const containerRef = React91.useRef(null);
42657
- const [autoScroll, setAutoScroll] = React91.useState(true);
42658
- React91.useEffect(() => {
42994
+ const [filter, setFilter] = React92.useState("all");
42995
+ const containerRef = React92.useRef(null);
42996
+ const [autoScroll, setAutoScroll] = React92.useState(true);
42997
+ React92.useEffect(() => {
42659
42998
  if (autoScroll && containerRef.current) {
42660
42999
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42661
43000
  }
42662
43001
  }, [events2.length, autoScroll]);
42663
- const filteredEvents = React91.useMemo(() => {
43002
+ const filteredEvents = React92.useMemo(() => {
42664
43003
  if (filter === "all") return events2;
42665
43004
  return events2.filter((e) => e.type === filter);
42666
43005
  }, [events2, filter]);
42667
- const formatTime2 = (timestamp) => {
43006
+ const formatTime3 = (timestamp) => {
42668
43007
  const date = new Date(timestamp);
42669
43008
  return date.toLocaleTimeString("en-US", {
42670
43009
  hour12: false,
@@ -42740,7 +43079,7 @@ function EventFlowTab({ events: events2 }) {
42740
43079
  {
42741
43080
  className: "flex items-start gap-2 text-xs py-1 hover:bg-muted/50 rounded px-1",
42742
43081
  children: [
42743
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(event.timestamp) }),
43082
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(event.timestamp) }),
42744
43083
  /* @__PURE__ */ jsx("span", { children: icon }),
42745
43084
  /* @__PURE__ */ jsx(Badge, { variant, size: "sm", className: "min-w-[60px] justify-center", children: event.source }),
42746
43085
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: event.message })
@@ -42776,7 +43115,7 @@ var init_EventFlowTab = __esm({
42776
43115
  });
42777
43116
  function GuardsPanel({ guards }) {
42778
43117
  const { t } = useTranslate();
42779
- const [filter, setFilter] = React91.useState("all");
43118
+ const [filter, setFilter] = React92.useState("all");
42780
43119
  if (guards.length === 0) {
42781
43120
  return /* @__PURE__ */ jsx(
42782
43121
  EmptyState,
@@ -42789,12 +43128,12 @@ function GuardsPanel({ guards }) {
42789
43128
  }
42790
43129
  const passedCount = guards.filter((g) => g.result).length;
42791
43130
  const failedCount = guards.length - passedCount;
42792
- const filteredGuards = React91.useMemo(() => {
43131
+ const filteredGuards = React92.useMemo(() => {
42793
43132
  if (filter === "all") return guards;
42794
43133
  if (filter === "passed") return guards.filter((g) => g.result);
42795
43134
  return guards.filter((g) => !g.result);
42796
43135
  }, [guards, filter]);
42797
- const formatTime2 = (timestamp) => {
43136
+ const formatTime3 = (timestamp) => {
42798
43137
  const date = new Date(timestamp);
42799
43138
  return date.toLocaleTimeString("en-US", {
42800
43139
  hour12: false,
@@ -42809,7 +43148,7 @@ function GuardsPanel({ guards }) {
42809
43148
  /* @__PURE__ */ jsx(Badge, { variant: guard.result ? "success" : "danger", size: "sm", children: guard.result ? "\u2713" : "\u2717" }),
42810
43149
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", className: "text-warning", children: guard.guardName }),
42811
43150
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: guard.context.type === "transition" ? `${guard.context.transitionFrom} \u2192 ${guard.context.transitionTo}` : guard.context.tickName }),
42812
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime2(guard.timestamp) })
43151
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground ml-auto", children: formatTime3(guard.timestamp) })
42813
43152
  ] }),
42814
43153
  content: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
42815
43154
  /* @__PURE__ */ jsxs("div", { children: [
@@ -42952,10 +43291,10 @@ function EffectBadge({ effect }) {
42952
43291
  }
42953
43292
  function TransitionTimeline({ transitions }) {
42954
43293
  const { t } = useTranslate();
42955
- const containerRef = React91.useRef(null);
42956
- const [autoScroll, setAutoScroll] = React91.useState(true);
42957
- const [expandedId, setExpandedId] = React91.useState(null);
42958
- React91.useEffect(() => {
43294
+ const containerRef = React92.useRef(null);
43295
+ const [autoScroll, setAutoScroll] = React92.useState(true);
43296
+ const [expandedId, setExpandedId] = React92.useState(null);
43297
+ React92.useEffect(() => {
42959
43298
  if (autoScroll && containerRef.current) {
42960
43299
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42961
43300
  }
@@ -42970,7 +43309,7 @@ function TransitionTimeline({ transitions }) {
42970
43309
  }
42971
43310
  );
42972
43311
  }
42973
- const formatTime2 = (ts) => {
43312
+ const formatTime3 = (ts) => {
42974
43313
  const d = new Date(ts);
42975
43314
  return d.toLocaleTimeString("en-US", {
42976
43315
  hour12: false,
@@ -43018,7 +43357,7 @@ function TransitionTimeline({ transitions }) {
43018
43357
  ${hasFailedEffects ? "bg-error" : allPassed ? "bg-success" : "bg-muted-foreground"}
43019
43358
  ` }),
43020
43359
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs py-1 px-2", children: [
43021
- /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime2(trace.timestamp) }),
43360
+ /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground font-mono min-w-[65px]", children: formatTime3(trace.timestamp) }),
43022
43361
  /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", className: "min-w-[60px] justify-center", children: trace.traitName }),
43023
43362
  /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-muted-foreground", children: [
43024
43363
  trace.from,
@@ -43093,7 +43432,7 @@ function ServerBridgeTab({ bridge }) {
43093
43432
  }
43094
43433
  );
43095
43434
  }
43096
- const formatTime2 = (ts) => {
43435
+ const formatTime3 = (ts) => {
43097
43436
  if (ts === 0) return t("debug.never");
43098
43437
  const d = new Date(ts);
43099
43438
  return d.toLocaleTimeString("en-US", {
@@ -43136,7 +43475,7 @@ function ServerBridgeTab({ bridge }) {
43136
43475
  StatRow,
43137
43476
  {
43138
43477
  label: t("debug.lastHeartbeat"),
43139
- value: formatTime2(bridge.lastHeartbeat)
43478
+ value: formatTime3(bridge.lastHeartbeat)
43140
43479
  }
43141
43480
  )
43142
43481
  ] })
@@ -43235,9 +43574,9 @@ function getAllEvents(traits2) {
43235
43574
  function EventDispatcherTab({ traits: traits2, schema }) {
43236
43575
  const eventBus = useEventBus();
43237
43576
  const { t } = useTranslate();
43238
- const [log11, setLog] = React91.useState([]);
43239
- const prevStatesRef = React91.useRef(/* @__PURE__ */ new Map());
43240
- React91.useEffect(() => {
43577
+ const [log11, setLog] = React92.useState([]);
43578
+ const prevStatesRef = React92.useRef(/* @__PURE__ */ new Map());
43579
+ React92.useEffect(() => {
43241
43580
  for (const trait of traits2) {
43242
43581
  const prev = prevStatesRef.current.get(trait.id);
43243
43582
  if (prev && prev !== trait.currentState) {
@@ -43406,10 +43745,10 @@ function VerifyModePanel({
43406
43745
  localCount
43407
43746
  }) {
43408
43747
  const { t } = useTranslate();
43409
- const [expanded, setExpanded] = React91.useState(true);
43410
- const scrollRef = React91.useRef(null);
43411
- const prevCountRef = React91.useRef(0);
43412
- React91.useEffect(() => {
43748
+ const [expanded, setExpanded] = React92.useState(true);
43749
+ const scrollRef = React92.useRef(null);
43750
+ const prevCountRef = React92.useRef(0);
43751
+ React92.useEffect(() => {
43413
43752
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43414
43753
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43415
43754
  }
@@ -43466,10 +43805,10 @@ function RuntimeDebugger({
43466
43805
  schema
43467
43806
  }) {
43468
43807
  const { t } = useTranslate();
43469
- const [isCollapsed, setIsCollapsed] = React91.useState(mode === "verify" ? true : defaultCollapsed);
43470
- const [isVisible, setIsVisible] = React91.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43808
+ const [isCollapsed, setIsCollapsed] = React92.useState(mode === "verify" ? true : defaultCollapsed);
43809
+ const [isVisible, setIsVisible] = React92.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43471
43810
  const debugData = useDebugData();
43472
- React91.useEffect(() => {
43811
+ React92.useEffect(() => {
43473
43812
  if (mode === "inline") return;
43474
43813
  return onDebugToggle((enabled) => {
43475
43814
  setIsVisible(enabled);
@@ -43478,7 +43817,7 @@ function RuntimeDebugger({
43478
43817
  }
43479
43818
  });
43480
43819
  }, [mode]);
43481
- React91.useEffect(() => {
43820
+ React92.useEffect(() => {
43482
43821
  if (mode === "inline") return;
43483
43822
  const handleKeyDown = (e) => {
43484
43823
  if (e.key === "`" && isVisible) {
@@ -43998,7 +44337,7 @@ var init_StatCard = __esm({
43998
44337
  const labelToUse = propLabel ?? propTitle;
43999
44338
  const eventBus = useEventBus();
44000
44339
  const { t } = useTranslate();
44001
- const handleActionClick = React91__default.useCallback(() => {
44340
+ const handleActionClick = React92__default.useCallback(() => {
44002
44341
  if (action?.event) {
44003
44342
  eventBus.emit(`UI:${action.event}`, {});
44004
44343
  }
@@ -44009,7 +44348,7 @@ var init_StatCard = __esm({
44009
44348
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
44010
44349
  const isLoading = externalLoading ?? false;
44011
44350
  const error = externalError;
44012
- const computeMetricValue = React91__default.useCallback(
44351
+ const computeMetricValue = React92__default.useCallback(
44013
44352
  (metric, items) => {
44014
44353
  if (metric.value !== void 0) {
44015
44354
  return metric.value;
@@ -44048,7 +44387,7 @@ var init_StatCard = __esm({
44048
44387
  },
44049
44388
  []
44050
44389
  );
44051
- const schemaStats = React91__default.useMemo(() => {
44390
+ const schemaStats = React92__default.useMemo(() => {
44052
44391
  if (!metrics || metrics.length === 0) return null;
44053
44392
  return metrics.map((metric) => ({
44054
44393
  label: metric.label,
@@ -44056,7 +44395,7 @@ var init_StatCard = __esm({
44056
44395
  format: metric.format
44057
44396
  }));
44058
44397
  }, [metrics, data, computeMetricValue]);
44059
- const calculatedTrend = React91__default.useMemo(() => {
44398
+ const calculatedTrend = React92__default.useMemo(() => {
44060
44399
  if (manualTrend !== void 0) return manualTrend;
44061
44400
  if (previousValue === void 0 || currentValue === void 0)
44062
44401
  return void 0;
@@ -44696,8 +45035,8 @@ var init_SubagentTracePanel = __esm({
44696
45035
  ] });
44697
45036
  };
44698
45037
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
44699
- const endRef = React91__default.useRef(null);
44700
- React91__default.useEffect(() => {
45038
+ const endRef = React92__default.useRef(null);
45039
+ React92__default.useEffect(() => {
44701
45040
  if (!autoScroll) return;
44702
45041
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
44703
45042
  }, [activities.length, autoScroll]);
@@ -44791,7 +45130,7 @@ var init_SubagentTracePanel = __esm({
44791
45130
  };
44792
45131
  SubagentRichCard = ({ subagent }) => {
44793
45132
  const { t } = useTranslate();
44794
- const activities = React91__default.useMemo(
45133
+ const activities = React92__default.useMemo(
44795
45134
  () => subagentMessagesToActivities(subagent.messages),
44796
45135
  [subagent.messages]
44797
45136
  );
@@ -44868,8 +45207,8 @@ var init_SubagentTracePanel = __esm({
44868
45207
  ] });
44869
45208
  };
44870
45209
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
44871
- const endRef = React91__default.useRef(null);
44872
- React91__default.useEffect(() => {
45210
+ const endRef = React92__default.useRef(null);
45211
+ React92__default.useEffect(() => {
44873
45212
  if (!autoScroll) return;
44874
45213
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
44875
45214
  }, [messages.length, autoScroll]);
@@ -45248,7 +45587,7 @@ var init_TeamOrganism = __esm({
45248
45587
  TeamOrganism.displayName = "TeamOrganism";
45249
45588
  }
45250
45589
  });
45251
- function formatDate4(value) {
45590
+ function formatDate2(value) {
45252
45591
  const d = new Date(value);
45253
45592
  if (isNaN(d.getTime())) return value;
45254
45593
  return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
@@ -45304,7 +45643,7 @@ var init_Timeline = __esm({
45304
45643
  }) => {
45305
45644
  const { t } = useTranslate();
45306
45645
  const entityData = entity ?? [];
45307
- const items = React91__default.useMemo(() => {
45646
+ const items = React92__default.useMemo(() => {
45308
45647
  if (propItems) return propItems;
45309
45648
  if (entityData.length === 0) return [];
45310
45649
  return entityData.map((record, idx) => {
@@ -45380,7 +45719,7 @@ var init_Timeline = __esm({
45380
45719
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("flex-1 min-w-0", !isLast && "pb-6"), children: [
45381
45720
  /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "start", wrap: true, children: [
45382
45721
  /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", children: item.title }),
45383
- item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate4(item.date) })
45722
+ item.date && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "flex-shrink-0", children: formatDate2(item.date) })
45384
45723
  ] }),
45385
45724
  item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
45386
45725
  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)) }),
@@ -45406,7 +45745,7 @@ var init_Timeline = __esm({
45406
45745
  }
45407
45746
  });
45408
45747
  function extractToastProps(children) {
45409
- if (!React91__default.isValidElement(children)) {
45748
+ if (!React92__default.isValidElement(children)) {
45410
45749
  if (typeof children === "string") {
45411
45750
  return { message: children };
45412
45751
  }
@@ -45448,7 +45787,7 @@ var init_ToastSlot = __esm({
45448
45787
  eventBus.emit(`${prefix}CLOSE`);
45449
45788
  };
45450
45789
  if (!isVisible) return null;
45451
- const isCustomContent = React91__default.isValidElement(children) && !message;
45790
+ const isCustomContent = React92__default.isValidElement(children) && !message;
45452
45791
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
45453
45792
  Toast,
45454
45793
  {
@@ -45686,6 +46025,10 @@ var init_component_registry_generated = __esm({
45686
46025
  init_SubagentTracePanel();
45687
46026
  init_SvgBranch();
45688
46027
  init_SvgConnection();
46028
+ init_SvgDrawGroup();
46029
+ init_SvgDrawShape();
46030
+ init_SvgDrawShapeLayer();
46031
+ init_SvgDrawText();
45689
46032
  init_SvgFlow();
45690
46033
  init_SvgGrid();
45691
46034
  init_SvgLobe();
@@ -45696,6 +46039,7 @@ var init_component_registry_generated = __esm({
45696
46039
  init_SvgRing();
45697
46040
  init_SvgShield();
45698
46041
  init_SvgStack();
46042
+ init_SvgStage();
45699
46043
  init_SwipeableRow();
45700
46044
  init_Switch();
45701
46045
  init_TabbedContainer();
@@ -45957,6 +46301,10 @@ var init_component_registry_generated = __esm({
45957
46301
  "SubagentTracePanel": SubagentTracePanel,
45958
46302
  "SvgBranch": SvgBranch,
45959
46303
  "SvgConnection": SvgConnection,
46304
+ "SvgDrawGroup": SvgDrawGroup,
46305
+ "SvgDrawShape": SvgDrawShape,
46306
+ "SvgDrawShapeLayer": SvgDrawShapeLayer,
46307
+ "SvgDrawText": SvgDrawText,
45960
46308
  "SvgFlow": SvgFlow,
45961
46309
  "SvgGrid": SvgGrid,
45962
46310
  "SvgLobe": SvgLobe,
@@ -45967,6 +46315,7 @@ var init_component_registry_generated = __esm({
45967
46315
  "SvgRing": SvgRing,
45968
46316
  "SvgShield": SvgShield,
45969
46317
  "SvgStack": SvgStack,
46318
+ "SvgStage": SvgStage,
45970
46319
  "SwipeableRow": SwipeableRow,
45971
46320
  "Switch": Switch,
45972
46321
  "TabbedContainer": TabbedContainer,
@@ -46017,7 +46366,7 @@ function SuspenseConfigProvider({
46017
46366
  config,
46018
46367
  children
46019
46368
  }) {
46020
- return React91__default.createElement(
46369
+ return React92__default.createElement(
46021
46370
  SuspenseConfigContext.Provider,
46022
46371
  { value: config },
46023
46372
  children
@@ -46043,7 +46392,7 @@ function enrichFormFields(fields, entityDef) {
46043
46392
  if (entityField) {
46044
46393
  const enriched = {
46045
46394
  name: field,
46046
- label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
46395
+ label: humanizeFieldName(field),
46047
46396
  type: entityField.type,
46048
46397
  required: entityField.required ?? false
46049
46398
  };
@@ -46057,9 +46406,9 @@ function enrichFormFields(fields, entityDef) {
46057
46406
  }
46058
46407
  return enriched;
46059
46408
  }
46060
- return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
46409
+ return { name: field, label: humanizeFieldName(field) };
46061
46410
  }
46062
- if (field && typeof field === "object" && !Array.isArray(field) && !React91__default.isValidElement(field) && !(field instanceof Date)) {
46411
+ if (field && typeof field === "object" && !Array.isArray(field) && !React92__default.isValidElement(field) && !(field instanceof Date)) {
46063
46412
  const obj = field;
46064
46413
  const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
46065
46414
  if (!fieldName) return field;
@@ -46519,7 +46868,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46519
46868
  const key = `${parentId}-${index}-trait:${traitName}`;
46520
46869
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
46521
46870
  }
46522
- return /* @__PURE__ */ jsx(React91__default.Fragment, { children: child }, `${parentId}-${index}`);
46871
+ return /* @__PURE__ */ jsx(React92__default.Fragment, { children: child }, `${parentId}-${index}`);
46523
46872
  }
46524
46873
  if (!child || typeof child !== "object") return null;
46525
46874
  const childId = `${parentId}-${index}`;
@@ -46576,14 +46925,14 @@ function isPatternConfig(value) {
46576
46925
  if (value === null || value === void 0) return false;
46577
46926
  if (typeof value !== "object") return false;
46578
46927
  if (Array.isArray(value)) return false;
46579
- if (React91__default.isValidElement(value)) return false;
46928
+ if (React92__default.isValidElement(value)) return false;
46580
46929
  if (value instanceof Date) return false;
46581
46930
  if (typeof value === "function") return false;
46582
46931
  const record = value;
46583
46932
  return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
46584
46933
  }
46585
46934
  function isPlainConfigObject(value) {
46586
- if (React91__default.isValidElement(value)) return false;
46935
+ if (React92__default.isValidElement(value)) return false;
46587
46936
  if (value instanceof Date) return false;
46588
46937
  const proto = Object.getPrototypeOf(value);
46589
46938
  return proto === Object.prototype || proto === null;
@@ -46711,10 +47060,11 @@ function SlotContentRenderer({
46711
47060
  for (const slotKey of CONTENT_NODE_SLOTS) {
46712
47061
  const slotVal = restProps[slotKey];
46713
47062
  if (slotVal === void 0 || slotVal === null) continue;
46714
- if (React91__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
46715
- if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
47063
+ if (React92__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
47064
+ const typelessChildren = !Array.isArray(slotVal) && typeof slotVal === "object" && !("type" in slotVal) && Array.isArray(slotVal.children) ? slotVal.children : void 0;
47065
+ if (typelessChildren !== void 0 || Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
46716
47066
  nodeSlotOverrides[slotKey] = renderPatternChildren(
46717
- slotVal,
47067
+ typelessChildren ?? slotVal,
46718
47068
  onDismiss,
46719
47069
  `${content.id}-${slotKey}`,
46720
47070
  `${myPath}.${slotKey}`,
@@ -46764,7 +47114,7 @@ function SlotContentRenderer({
46764
47114
  const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
46765
47115
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
46766
47116
  const sample = resolvedItems[0];
46767
- if (sample && typeof sample === "object" && !Array.isArray(sample) && !React91__default.isValidElement(sample) && !(sample instanceof Date)) {
47117
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React92__default.isValidElement(sample) && !(sample instanceof Date)) {
46768
47118
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
46769
47119
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
46770
47120
  }
@@ -46893,6 +47243,7 @@ var init_UISlotRenderer = __esm({
46893
47243
  init_useEventBus();
46894
47244
  init_slot_types();
46895
47245
  init_cn();
47246
+ init_format();
46896
47247
  init_ErrorBoundary();
46897
47248
  init_Skeleton();
46898
47249
  init_renderer();
@@ -47129,7 +47480,7 @@ var AvlTransition = ({
47129
47480
  opacity = 1,
47130
47481
  className
47131
47482
  }) => {
47132
- const ids = React91__default.useMemo(() => {
47483
+ const ids = React92__default.useMemo(() => {
47133
47484
  avlTransitionId += 1;
47134
47485
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
47135
47486
  }, []);
@@ -47690,7 +48041,7 @@ var AvlStateMachine = ({
47690
48041
  color = "var(--color-primary)",
47691
48042
  animated = false
47692
48043
  }) => {
47693
- const ids = React91__default.useMemo(() => {
48044
+ const ids = React92__default.useMemo(() => {
47694
48045
  avlSmId += 1;
47695
48046
  const base = `avl-sm-${avlSmId}`;
47696
48047
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -47889,7 +48240,7 @@ var AvlOrbitalUnit = ({
47889
48240
  color = "var(--color-primary)",
47890
48241
  animated = false
47891
48242
  }) => {
47892
- const ids = React91__default.useMemo(() => {
48243
+ const ids = React92__default.useMemo(() => {
47893
48244
  avlOuId += 1;
47894
48245
  const base = `avl-ou-${avlOuId}`;
47895
48246
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -47985,7 +48336,7 @@ var AvlClosedCircuit = ({
47985
48336
  color = "var(--color-primary)",
47986
48337
  animated = false
47987
48338
  }) => {
47988
- const ids = React91__default.useMemo(() => {
48339
+ const ids = React92__default.useMemo(() => {
47989
48340
  avlCcId += 1;
47990
48341
  const base = `avl-cc-${avlCcId}`;
47991
48342
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -48140,7 +48491,7 @@ var AvlEmitListen = ({
48140
48491
  color = "var(--color-primary)",
48141
48492
  animated = false
48142
48493
  }) => {
48143
- const ids = React91__default.useMemo(() => {
48494
+ const ids = React92__default.useMemo(() => {
48144
48495
  avlElId += 1;
48145
48496
  const base = `avl-el-${avlElId}`;
48146
48497
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -48414,7 +48765,7 @@ function renderNode(node, color, glowId) {
48414
48765
  const baseR = node.type === "operator" ? 20 : 16;
48415
48766
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
48416
48767
  const nc = nodeColor(node.type, color);
48417
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
48768
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
48418
48769
  node.children.map((child, i) => {
48419
48770
  const childR = Math.max(
48420
48771
  child.type === "operator" ? 20 : 16,
@@ -48471,7 +48822,7 @@ var AvlExprTree = ({
48471
48822
  className,
48472
48823
  color = "var(--color-primary)"
48473
48824
  }) => {
48474
- const ids = React91__default.useMemo(() => {
48825
+ const ids = React92__default.useMemo(() => {
48475
48826
  avlEtId += 1;
48476
48827
  return { glow: `avl-et-${avlEtId}-glow` };
48477
48828
  }, []);
@@ -49306,7 +49657,7 @@ var SystemNode = ({ data }) => {
49306
49657
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
49307
49658
  const tc = transitionCounts[s.name] ?? 0;
49308
49659
  const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
49309
- return /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
49660
+ return /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
49310
49661
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
49311
49662
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
49312
49663
  ] }, s.name);
@@ -50390,7 +50741,7 @@ function resolveLambdaBindings(body, params, item, index) {
50390
50741
  }
50391
50742
  return substituted;
50392
50743
  }
50393
- if (body !== null && typeof body === "object" && !React91__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
50744
+ if (body !== null && typeof body === "object" && !React92__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
50394
50745
  const out = {};
50395
50746
  for (const [k, v] of Object.entries(body)) {
50396
50747
  out[k] = recur(v);
@@ -50409,7 +50760,7 @@ function getSlotContentRenderer2() {
50409
50760
  function makeLambdaFn(params, lambdaBody, callerKey) {
50410
50761
  return (item, index) => {
50411
50762
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
50412
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React91__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
50763
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React92__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
50413
50764
  return null;
50414
50765
  }
50415
50766
  const record = resolvedBody;
@@ -50428,7 +50779,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
50428
50779
  props: childProps,
50429
50780
  priority: 0
50430
50781
  };
50431
- return React91__default.createElement(SlotContentRenderer2, { content: childContent });
50782
+ return React92__default.createElement(SlotContentRenderer2, { content: childContent });
50432
50783
  };
50433
50784
  }
50434
50785
  function convertNode(node, callerKey) {
@@ -50447,7 +50798,7 @@ function convertNode(node, callerKey) {
50447
50798
  });
50448
50799
  return anyChanged ? mapped : node;
50449
50800
  }
50450
- if (typeof node === "object" && !React91__default.isValidElement(node) && !(node instanceof Date)) {
50801
+ if (typeof node === "object" && !React92__default.isValidElement(node) && !(node instanceof Date)) {
50451
50802
  return convertObjectProps(node);
50452
50803
  }
50453
50804
  return node;
@@ -51615,7 +51966,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51615
51966
  return;
51616
51967
  }
51617
51968
  crossTraitLog.debug("self:fire", { traitName, busKey: selfBusKey, eventKey });
51618
- enqueueAndDrain(eventKey, event.payload);
51969
+ enqueueAndDrain(eventKey, event.payload, traitName);
51619
51970
  });
51620
51971
  unsubscribes.push(() => {
51621
51972
  crossTraitLog.debug("self:unsubscribe", { traitName, busKey: selfBusKey, eventKey });
@@ -52362,8 +52713,8 @@ function CanvasDndProvider({
52362
52713
  }) {
52363
52714
  const eventBus = useEventBus();
52364
52715
  const sensors = useAlmadarDndSensors(false);
52365
- const [activePayload, setActivePayload] = React91__default.useState(null);
52366
- const handleDragStart = React91__default.useCallback((e) => {
52716
+ const [activePayload, setActivePayload] = React92__default.useState(null);
52717
+ const handleDragStart = React92__default.useCallback((e) => {
52367
52718
  const data = e.active.data.current;
52368
52719
  const payload = data?.payload;
52369
52720
  if (payload) {
@@ -52374,7 +52725,7 @@ function CanvasDndProvider({
52374
52725
  log9.warn("dragStart:missing-payload", { id: e.active.id });
52375
52726
  }
52376
52727
  }, [eventBus]);
52377
- const handleDragEnd = React91__default.useCallback((e) => {
52728
+ const handleDragEnd = React92__default.useCallback((e) => {
52378
52729
  setActivePayload(null);
52379
52730
  const activeData = e.active.data.current;
52380
52731
  const payload = activeData?.payload;
@@ -52403,7 +52754,7 @@ function CanvasDndProvider({
52403
52754
  const suppressed = onDrop ? onDrop(drop) === true : false;
52404
52755
  if (!suppressed) defaultEmit(eventBus, drop);
52405
52756
  }, [eventBus, onDrop]);
52406
- const handleDragCancel = React91__default.useCallback(() => {
52757
+ const handleDragCancel = React92__default.useCallback(() => {
52407
52758
  setActivePayload(null);
52408
52759
  log9.info("dragCancel");
52409
52760
  }, []);
@@ -53161,7 +53512,7 @@ var OrbPreviewNodeInner = (props) => {
53161
53512
  }
53162
53513
  );
53163
53514
  };
53164
- var OrbPreviewNode = React91__default.memo(OrbPreviewNodeInner);
53515
+ var OrbPreviewNode = React92__default.memo(OrbPreviewNodeInner);
53165
53516
  OrbPreviewNode.displayName = "OrbPreviewNode";
53166
53517
  orbPreviewLog.debug("export-resolved", () => ({
53167
53518
  type: typeof OrbPreviewNode,
@@ -53266,7 +53617,7 @@ var EventFlowEdgeInner = (props) => {
53266
53617
  ) })
53267
53618
  ] });
53268
53619
  };
53269
- var EventFlowEdge = React91__default.memo(EventFlowEdgeInner);
53620
+ var EventFlowEdge = React92__default.memo(EventFlowEdgeInner);
53270
53621
  EventFlowEdge.displayName = "EventFlowEdge";
53271
53622
 
53272
53623
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -53413,7 +53764,7 @@ var BehaviorComposeNodeInner = (props) => {
53413
53764
  }
53414
53765
  );
53415
53766
  };
53416
- var BehaviorComposeNode = React91__default.memo(BehaviorComposeNodeInner);
53767
+ var BehaviorComposeNode = React92__default.memo(BehaviorComposeNodeInner);
53417
53768
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
53418
53769
 
53419
53770
  // components/avl/lib/avl-behavior-compose-converter.ts
@@ -54439,7 +54790,7 @@ var TraitCardNodeInner = (props) => {
54439
54790
  }
54440
54791
  );
54441
54792
  };
54442
- var TraitCardNode = React91__default.memo(TraitCardNodeInner);
54793
+ var TraitCardNode = React92__default.memo(TraitCardNodeInner);
54443
54794
  TraitCardNode.displayName = "TraitCardNode";
54444
54795
 
54445
54796
  // components/avl/organisms/FlowCanvas.tsx
@@ -54520,7 +54871,7 @@ function FlowCanvasInner({
54520
54871
  initialOrbital
54521
54872
  );
54522
54873
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
54523
- const screenSizeUserOverrideRef = React91__default.useRef(false);
54874
+ const screenSizeUserOverrideRef = React92__default.useRef(false);
54524
54875
  const [screenSize, setScreenSize] = useState(
54525
54876
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
54526
54877
  );
@@ -54904,7 +55255,7 @@ var ZoomBreadcrumb = ({
54904
55255
  if (eventName && band === "detail") {
54905
55256
  segments.push({ icon: "\u26A1", label: eventName });
54906
55257
  }
54907
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
55258
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
54908
55259
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
54909
55260
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
54910
55261
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -55245,7 +55596,7 @@ var EventWireOverlay = ({
55245
55596
  containerW,
55246
55597
  containerH
55247
55598
  }) => {
55248
- const ids = React91__default.useMemo(() => {
55599
+ const ids = React92__default.useMemo(() => {
55249
55600
  avlOczWireId += 1;
55250
55601
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
55251
55602
  }, []);
@@ -55612,7 +55963,7 @@ var AvlOrbitalsCosmicZoom = ({
55612
55963
  borderRadius: 6,
55613
55964
  border: `1px solid ${color}`
55614
55965
  },
55615
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React91__default.Fragment, { children: [
55966
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React92__default.Fragment, { children: [
55616
55967
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
55617
55968
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
55618
55969
  Box,