@object-ui/plugin-detail 11.4.0 → 11.5.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/index.js CHANGED
@@ -2,16 +2,16 @@ import { ComponentRegistry as e, buildExpandFields as t, formatTitleTemplate as
2
2
  import * as i from "react";
3
3
  import a from "react";
4
4
  import { Alert as o, AlertDescription as s, AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, AlertTitle as g, Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Card as S, CardContent as C, CardHeader as w, CardTitle as T, Collapsible as E, CollapsibleContent as D, CollapsibleTrigger as O, DataEmptyState as k, Input as A, LazyIcon as j, Select as M, SelectContent as N, SelectItem as ee, SelectTrigger as te, SelectValue as ne, Sheet as re, SheetContent as ie, SheetHeader as P, SheetTitle as F, Skeleton as I, Tabs as L, TabsContent as R, TabsList as z, TabsTrigger as B, Tooltip as V, TooltipContent as H, TooltipProvider as ae, TooltipTrigger as U, buttonVariants as W, cn as G, useIsMobile as oe } from "@object-ui/components";
5
- import { Activity as se, AlertTriangle as ce, ArrowLeft as le, ArrowRight as ue, ArrowRightLeft as de, ArrowUpDown as K, AtSign as q, Bell as fe, BellOff as pe, Bold as me, Calendar as he, Check as ge, CheckSquare as _e, ChevronDown as ve, ChevronLeft as ye, ChevronRight as be, ChevronsLeft as xe, ChevronsRight as Se, Code as Ce, Columns2 as we, Copy as Te, Edit as Ee, ExternalLink as De, Eye as Oe, EyeOff as J, File as ke, FileArchive as Ae, FileText as je, History as Y, Image as Me, Inbox as Ne, Italic as Pe, Link as Fe, List as Ie, Loader2 as Le, Lock as Re, Mail as ze, MessageSquare as X, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Phone as We, Pin as Ge, Plus as Ke, PlusCircle as qe, RotateCcw as Je, Rows3 as Ye, Search as Xe, Send as Ze, SmilePlus as Qe, Star as $e, Trash2 as et, Upload as tt, X as nt, Zap as rt, icons as it } from "lucide-react";
6
- import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct, useDiscussionContext as lt, useHighlightFieldNames as ut, useMetadataItem as dt, useObjectTranslation as ft, useRecordContext as pt, useRegisterHighlightFields as mt, useRelatedRecordActions as ht, useSafeFieldLabel as gt } from "@object-ui/react";
7
- import { BooleanField as _t, LookupField as vt, RecordPickerDialog as yt, SelectField as bt, UserField as xt, coerceToSafeValue as St, getCellRenderer as Ct, humanizeLabel as wt, resolveCellRendererType as Tt } from "@object-ui/fields";
8
- import { Fragment as Et, jsx as Z, jsxs as Q } from "react/jsx-runtime";
9
- import { useFieldPermissions as Dt, usePermissions as Ot } from "@object-ui/permissions";
10
- import { resolveFieldCurrency as kt, useLocalization as At } from "@object-ui/i18n";
11
- import { Link as jt, useParams as Mt } from "react-router-dom";
12
- import { deriveFieldGroupLayout as Nt } from "@objectstack/spec/data";
5
+ import { Activity as K, AlertTriangle as se, ArrowLeft as ce, ArrowRight as le, ArrowRightLeft as ue, ArrowUpDown as de, AtSign as q, Bell as fe, BellOff as pe, Bold as me, Calendar as he, Check as ge, CheckSquare as _e, ChevronDown as ve, ChevronLeft as ye, ChevronRight as be, ChevronsLeft as xe, ChevronsRight as Se, Code as Ce, Columns2 as we, Copy as Te, Edit as Ee, ExternalLink as De, Eye as Oe, EyeOff as J, File as ke, FileArchive as Ae, FileText as je, History as Y, Image as Me, Inbox as Ne, Italic as Pe, Link as Fe, List as Ie, Loader2 as Le, Lock as Re, Mail as ze, MessageSquare as X, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Phone as We, Pin as Ge, Plus as Ke, PlusCircle as qe, RotateCcw as Je, Rows3 as Ye, Search as Xe, Send as Ze, SmilePlus as Qe, Star as $e, Trash2 as et, Upload as tt, X as nt, Zap as rt, icons as it } from "lucide-react";
6
+ import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct, useDataInvalidation as lt, useDiscussionContext as ut, useHighlightFieldNames as dt, useMetadataItem as ft, useObjectTranslation as pt, useRecordContext as mt, useRegisterHighlightFields as ht, useRelatedRecordActions as gt, useSafeFieldLabel as _t } from "@object-ui/react";
7
+ import { BooleanField as vt, LookupField as yt, RecordPickerDialog as bt, SelectField as xt, UserField as St, coerceToSafeValue as Ct, getCellRenderer as wt, humanizeLabel as Tt, resolveCellRendererType as Et } from "@object-ui/fields";
8
+ import { Fragment as Dt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
9
+ import { useFieldPermissions as Ot, usePermissions as kt } from "@object-ui/permissions";
10
+ import { resolveFieldCurrency as At, useLocalization as jt } from "@object-ui/i18n";
11
+ import { Link as Mt, useParams as Nt } from "react-router-dom";
12
+ import { deriveFieldGroupLayout as Pt } from "@objectstack/spec/data";
13
13
  //#region src/autoLayout.ts
14
- var Pt = /* @__PURE__ */ new Set([
14
+ var Ft = /* @__PURE__ */ new Set([
15
15
  "textarea",
16
16
  "markdown",
17
17
  "html",
@@ -23,36 +23,36 @@ var Pt = /* @__PURE__ */ new Set([
23
23
  "field:grid",
24
24
  "field:rich-text"
25
25
  ]);
26
- function Ft(e) {
27
- return Pt.has(e);
26
+ function It(e) {
27
+ return Ft.has(e);
28
28
  }
29
- function It(e, t) {
29
+ function Lt(e, t) {
30
30
  let n;
31
31
  return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
32
32
  }
33
- function Lt(e, t) {
34
- return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Ft(e.type) ? {
33
+ function Rt(e, t) {
34
+ return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && It(e.type) ? {
35
35
  ...e,
36
36
  span: t
37
37
  } : e);
38
38
  }
39
- function Rt(e, t, n) {
39
+ function zt(e, t, n) {
40
40
  if (t !== void 0) return {
41
- fields: Lt(e, t),
41
+ fields: Rt(e, t),
42
42
  columns: t
43
43
  };
44
- let r = It(e.length, n);
44
+ let r = Lt(e.length, n);
45
45
  return {
46
- fields: Lt(e, r),
46
+ fields: Rt(e, r),
47
47
  columns: r
48
48
  };
49
49
  }
50
50
  //#endregion
51
51
  //#region src/useDetailTranslation.ts
52
- function zt(e, t) {
52
+ function Bt(e, t) {
53
53
  return function() {
54
54
  try {
55
- let n = ft();
55
+ let n = pt();
56
56
  return n.t(t) === t ? { t: (t, n) => {
57
57
  let r = e[t] || t;
58
58
  if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
@@ -67,7 +67,7 @@ function zt(e, t) {
67
67
  }
68
68
  };
69
69
  }
70
- var Bt = {
70
+ var Vt = {
71
71
  "detail.back": "Back",
72
72
  "detail.edit": "Edit",
73
73
  "detail.editInline": "Edit",
@@ -193,29 +193,29 @@ var Bt = {
193
193
  "detail.concurrentUpdateReload": "Reload latest",
194
194
  "detail.concurrentUpdateOverwrite": "Overwrite anyway",
195
195
  "detail.concurrentUpdateCancel": "Cancel"
196
- }, $ = zt(Bt, "detail.back");
196
+ }, $ = Bt(Vt, "detail.back");
197
197
  //#endregion
198
198
  //#region src/DetailSection.tsx
199
- function Vt(e, t) {
199
+ function Ht(e, t) {
200
200
  return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "";
201
201
  }
202
- var Ht = /* @__PURE__ */ new Set([
202
+ var Ut = /* @__PURE__ */ new Set([
203
203
  "formula",
204
204
  "summary",
205
205
  "rollup",
206
206
  "auto_number"
207
207
  ]);
208
- function Ut(e) {
208
+ function Wt(e) {
209
209
  if (e == null) return e;
210
- if (Array.isArray(e)) return e.map(Ut);
210
+ if (Array.isArray(e)) return e.map(Wt);
211
211
  if (typeof e == "object") {
212
212
  let t = e;
213
213
  return t.id ?? t._id ?? t.value ?? "";
214
214
  }
215
215
  return e;
216
216
  }
217
- var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
218
- let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } = gt(), k = i.useCallback((e, t) => {
217
+ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
218
+ let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } = _t(), k = i.useCallback((e, t) => {
219
219
  let n = t == null ? "" : String(t);
220
220
  navigator.clipboard.writeText(n).then(() => {
221
221
  p(e), setTimeout(() => p(null), 2e3);
@@ -225,7 +225,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
225
225
  return n == null || n === "";
226
226
  }, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = oe(), N = M ? 3 : 4, ee = M ? .2 : .25, te = e.fields.length - j, ne = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= ee && te > 0, re = !g && (e.hideEmpty || ne) ? e.fields.filter((e) => !A(e)) : e.fields;
227
227
  if (re.length === 0 && j === e.fields.length) return null;
228
- let { fields: ie, columns: P } = Rt(re, e.columns), F = (e) => {
228
+ let { fields: ie, columns: P } = zt(re, e.columns), F = (e) => {
229
229
  let n = t?.[e.name] ?? e.value;
230
230
  if (e.render) return /* @__PURE__ */ Z(at, {
231
231
  schema: e.render,
@@ -234,11 +234,11 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
234
234
  value: n
235
235
  }
236
236
  });
237
- let i = Vt(e.span, P), l = r?.fields?.[e.name], u = { ...e };
237
+ let i = Ht(e.span, P), l = r?.fields?.[e.name], u = { ...e };
238
238
  if (l) {
239
239
  !e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.scale !== void 0 && u.scale === void 0 && (u.scale = l.scale), l.format && !u.format && (u.format = l.format);
240
240
  let t = l.reference_to || l.reference;
241
- t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field);
241
+ t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field), l.dueLike !== void 0 && u.dueLike === void 0 && (u.dueLike = l.dueLike);
242
242
  }
243
243
  a && Array.isArray(u.options) && u.options.length > 0 && (u.options = b(a, e.name, u.options));
244
244
  let d = (() => {
@@ -248,9 +248,9 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
248
248
  title: v("detail.noValue", { defaultValue: "No value" }),
249
249
  children: "—"
250
250
  });
251
- let t = Tt(u) || e.type;
251
+ let t = Et(u) || e.type;
252
252
  if (t) {
253
- let e = Ct(t);
253
+ let e = wt(t);
254
254
  if (e) return /* @__PURE__ */ Z(e, {
255
255
  value: n,
256
256
  field: u
@@ -282,20 +282,20 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
282
282
  className: "min-h-[44px] sm:min-h-0",
283
283
  children: (() => {
284
284
  let t = u.type || e.type;
285
- if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(bt, {
285
+ if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(xt, {
286
286
  field: u,
287
287
  value: n == null ? "" : String(n),
288
288
  onChange: (t) => s?.(e.name, t)
289
289
  });
290
- if (t === "boolean") return /* @__PURE__ */ Z(_t, {
290
+ if (t === "boolean") return /* @__PURE__ */ Z(vt, {
291
291
  field: u,
292
292
  value: !!n,
293
293
  onChange: (t) => s?.(e.name, t)
294
294
  });
295
- let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Ht.has(t);
296
- if (r || i) return /* @__PURE__ */ Z(r ? xt : vt, {
295
+ let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Ut.has(t);
296
+ if (r || i) return /* @__PURE__ */ Z(r ? St : yt, {
297
297
  field: u,
298
- value: Ut(n),
298
+ value: Wt(n),
299
299
  onChange: (t) => s?.(e.name, t),
300
300
  dataSource: c
301
301
  });
@@ -308,7 +308,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
308
308
  if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
309
309
  let t = new Date(e);
310
310
  return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
311
- })() : String(typeof n == "object" ? St(n) ?? "" : n),
311
+ })() : String(typeof n == "object" ? Ct(n) ?? "" : n),
312
312
  onChange: (t) => {
313
313
  let n = t.target.value;
314
314
  if (a && n) {
@@ -361,7 +361,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
361
361
  ie.length,
362
362
  L
363
363
  ]);
364
- let R = m === void 0 ? ie : ie.slice(0, m), z = j > 0 && (e.hideEmpty || ne), B = /* @__PURE__ */ Q(Et, { children: [M ? /* @__PURE__ */ Z("div", {
364
+ let R = m === void 0 ? ie : ie.slice(0, m), z = j > 0 && (e.hideEmpty || ne), B = /* @__PURE__ */ Q(Dt, { children: [M ? /* @__PURE__ */ Z("div", {
365
365
  className: "flex flex-col divide-y divide-border/60",
366
366
  children: R.map(F)
367
367
  }) : /* @__PURE__ */ Z("div", {
@@ -435,7 +435,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
435
435
  children: B
436
436
  })]
437
437
  });
438
- }, Gt = ({ tabs: e, data: t, className: n }) => {
438
+ }, Kt = ({ tabs: e, data: t, className: n }) => {
439
439
  let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
440
440
  return /* @__PURE__ */ Q(L, {
441
441
  value: r,
@@ -480,11 +480,11 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
480
480
  };
481
481
  //#endregion
482
482
  //#region src/RelatedList.tsx
483
- function Kt(e) {
483
+ function qt(e) {
484
484
  return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Ne;
485
485
  }
486
- var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, add: M, maxColumns: N = 6, pageSize: ee, sortable: te = !1, filterable: ne = !1, collapsible: re = !1, defaultCollapsed: ie = !1, referenceField: P, parentId: F, icon: I }) => {
487
- let L = r !== void 0, R = r ?? [], [z, B] = i.useState(R), [V, H] = i.useState(() => !!n && !L), [ae, U] = i.useState(0), [W, se] = i.useState(null), [ce, le] = i.useState("asc"), [ue, de] = i.useState(""), [q, fe] = i.useState(null), [pe, me] = i.useState(ie), [he, ge] = i.useState(!1), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(null), [we, Te] = i.useState(0), [Ee, Oe] = i.useState({}), { t: J } = $(), { fieldLabel: ke } = gt();
486
+ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, add: M, maxColumns: N = 6, pageSize: ee, sortable: te = !1, filterable: ne = !1, collapsible: re = !1, defaultCollapsed: ie = !1, referenceField: P, parentId: F, icon: I }) => {
487
+ let L = r !== void 0, R = r ?? [], [z, B] = i.useState(R), [V, H] = i.useState(() => !!n && !L), [ae, U] = i.useState(0), [W, K] = i.useState(null), [se, ce] = i.useState("asc"), [le, ue] = i.useState(""), [q, fe] = i.useState(null), [pe, me] = i.useState(ie), [he, ge] = i.useState(!1), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(null), [we, Te] = i.useState(0), [Ee, Oe] = i.useState({}), { t: J } = $(), { fieldLabel: ke } = _t();
488
488
  i.useEffect(() => {
489
489
  L && B(r ?? []);
490
490
  }, [r, L]), i.useEffect(() => {
@@ -582,30 +582,30 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
582
582
  z
583
583
  ]);
584
584
  let Ae = i.useMemo(() => {
585
- if (!ue) return z;
586
- let e = ue.toLowerCase();
585
+ if (!le) return z;
586
+ let e = le.toLowerCase();
587
587
  return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
588
- }, [z, ue]), je = i.useMemo(() => W ? [...Ae].sort((e, t) => {
588
+ }, [z, le]), je = i.useMemo(() => W ? [...Ae].sort((e, t) => {
589
589
  let n = e[W], r = t[W];
590
590
  if (n == null && r == null) return 0;
591
591
  if (n == null) return 1;
592
592
  if (r == null) return -1;
593
593
  let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
594
- return ce === "asc" ? i : -i;
594
+ return se === "asc" ? i : -i;
595
595
  }) : Ae, [
596
596
  Ae,
597
597
  W,
598
- ce
598
+ se
599
599
  ]), Y = ee && ee > 0 ? ee : 0, Me = Y ? Math.max(1, Math.ceil(je.length / Y)) : 1, Ne = Y ? je.slice(ae * Y, (ae + 1) * Y) : je;
600
600
  i.useEffect(() => {
601
601
  U(0);
602
602
  }, [
603
- ue,
603
+ le,
604
604
  W,
605
- ce
605
+ se
606
606
  ]);
607
607
  let Pe = i.useCallback((e) => {
608
- W === e ? le((e) => e === "asc" ? "desc" : "asc") : (se(e), le("asc"));
608
+ W === e ? ce((e) => e === "asc" ? "desc" : "asc") : (K(e), ce("asc"));
609
609
  }, [W]), [Fe, Ie] = i.useState(null), Le = i.useCallback((e) => {
610
610
  Ie(e);
611
611
  }, []), Re = i.useCallback(async () => {
@@ -640,7 +640,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
640
640
  n,
641
641
  P,
642
642
  F
643
- ]), X = Ot(), Be = i.useMemo(() => {
643
+ ]), X = kt(), Be = i.useMemo(() => {
644
644
  let e = _ || n || "", t = (t) => !X?.isLoaded || !e ? t : t.filter((t) => {
645
645
  let n = t?.accessorKey || t?.field || t?.name;
646
646
  return n ? X.checkField(e, String(n), "read") : !0;
@@ -649,7 +649,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
649
649
  return t ? z.some((e) => !a(e?.[t])) : !0;
650
650
  }) : e, c = (e, t) => {
651
651
  if (!t?.type) return;
652
- let n = Ct(Tt({
652
+ let n = wt(Et({
653
653
  type: t.type,
654
654
  format: t.format
655
655
  }) || t.type);
@@ -811,7 +811,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
811
811
  O,
812
812
  Ue,
813
813
  n
814
- ]), Ge = re ? "cursor-pointer select-none" : void 0, qe = re ? () => me((e) => !e) : void 0, Je = Kt(I), Ye = !V && z.length === 0, Xe = ne;
814
+ ]), Ge = re ? "cursor-pointer select-none" : void 0, qe = re ? () => me((e) => !e) : void 0, Je = qt(I), Ye = !V && z.length === 0, Xe = ne;
815
815
  return /* @__PURE__ */ Q(S, {
816
816
  className: G("shadow-none border-border/60 bg-transparent", Ye && "bg-muted/10", s),
817
817
  children: [
@@ -873,8 +873,8 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
873
873
  className: "mb-3",
874
874
  children: /* @__PURE__ */ Z(A, {
875
875
  placeholder: J("detail.filterPlaceholder"),
876
- value: ue,
877
- onChange: (e) => de(e.target.value),
876
+ value: le,
877
+ onChange: (e) => ue(e.target.value),
878
878
  className: "h-8 text-sm"
879
879
  })
880
880
  }),
@@ -890,9 +890,9 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
890
890
  className: "gap-1 h-7 text-xs",
891
891
  onClick: () => Pe(t),
892
892
  children: [
893
- /* @__PURE__ */ Z(K, { className: "h-3 w-3" }),
893
+ /* @__PURE__ */ Z(de, { className: "h-3 w-3" }),
894
894
  n,
895
- r && (ce === "asc" ? " ↑" : " ↓")
895
+ r && (se === "asc" ? " ↑" : " ↓")
896
896
  ]
897
897
  }, t);
898
898
  })
@@ -958,7 +958,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
958
958
  role: "alert",
959
959
  children: Se
960
960
  }),
961
- M && g && /* @__PURE__ */ Z(yt, {
961
+ M && g && /* @__PURE__ */ Z(bt, {
962
962
  open: he,
963
963
  onOpenChange: (e) => ge(e),
964
964
  multiple: !0,
@@ -972,10 +972,10 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
972
972
  })
973
973
  ]
974
974
  });
975
- }, Jt = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
975
+ }, Yt = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
976
976
  let l = e.collapsible ?? !0, [u, d] = i.useState(e.defaultCollapsed ?? !1), f = /* @__PURE__ */ Z("div", {
977
977
  className: "space-y-3 sm:space-y-4",
978
- children: e.sections.map((e, n) => /* @__PURE__ */ Z(Wt, {
978
+ children: e.sections.map((e, n) => /* @__PURE__ */ Z(Gt, {
979
979
  section: e,
980
980
  data: t,
981
981
  objectSchema: r,
@@ -1036,8 +1036,8 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1036
1036
  f
1037
1037
  ]
1038
1038
  });
1039
- }, Yt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
1040
- let { fieldLabel: a } = gt();
1039
+ }, Xt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
1040
+ let { fieldLabel: a } = _t();
1041
1041
  if (!e.length || !t) return null;
1042
1042
  let o = e.filter((e) => {
1043
1043
  let n = t?.[e.name];
@@ -1047,7 +1047,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1047
1047
  className: G("@container border-b border-border/60 pb-4", n),
1048
1048
  "aria-label": "Record highlights",
1049
1049
  children: /* @__PURE__ */ Z("div", {
1050
- className: G("flex flex-wrap gap-x-8 gap-y-3"),
1050
+ className: G("flex flex-wrap gap-y-4"),
1051
1051
  children: o.map((e) => {
1052
1052
  let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
1053
1053
  name: e.name,
@@ -1058,11 +1058,11 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1058
1058
  ...o?.precision !== void 0 && { precision: o.precision },
1059
1059
  ...o?.scale !== void 0 && { scale: o.scale },
1060
1060
  ...o?.format && { format: o.format }
1061
- }, l = Ct(Tt(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea", f = s === "boolean";
1061
+ }, l = wt(Et(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea" || s === "reference" || s === "lookup" || s === "master_detail", f = s === "boolean";
1062
1062
  return /* @__PURE__ */ Q("div", {
1063
- className: G("flex flex-col gap-1 min-w-[8rem] basis-[10rem]", d ? "max-w-[24rem] basis-[16rem]" : "max-w-[16rem]"),
1063
+ className: G("flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0", d ? "basis-[16rem] max-w-[24rem]" : "basis-[9rem] max-w-[16rem]"),
1064
1064
  children: [/* @__PURE__ */ Z("span", {
1065
- className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
1065
+ className: "text-xs font-medium text-muted-foreground",
1066
1066
  children: a(r || "", e.name, e.label)
1067
1067
  }), f ? n ? /* @__PURE__ */ Q("span", {
1068
1068
  className: "inline-flex items-center gap-1 self-start rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 ring-1 ring-inset ring-emerald-500/30 dark:text-emerald-400",
@@ -1077,7 +1077,8 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1077
1077
  "aria-hidden": !0
1078
1078
  }), "No"]
1079
1079
  }) : /* @__PURE__ */ Z("span", {
1080
- className: G("block min-w-0 truncate", u ? "text-xl md:text-2xl font-semibold leading-tight tabular-nums tracking-tight" : "text-sm font-semibold"),
1080
+ title: typeof n == "string" ? n : void 0,
1081
+ className: G("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
1081
1082
  children: /* @__PURE__ */ Z(l, {
1082
1083
  value: n,
1083
1084
  field: c
@@ -1090,7 +1091,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1090
1091
  };
1091
1092
  //#endregion
1092
1093
  //#region src/RecordComments.tsx
1093
- function Xt(e) {
1094
+ function Zt(e) {
1094
1095
  try {
1095
1096
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
1096
1097
  if (r < 1) return "just now";
@@ -1103,7 +1104,7 @@ function Xt(e) {
1103
1104
  return e;
1104
1105
  }
1105
1106
  }
1106
- var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
1107
+ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
1107
1108
  let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
1108
1109
  let e = s.trim();
1109
1110
  if (!(!e || !t)) {
@@ -1209,7 +1210,7 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1209
1210
  }),
1210
1211
  /* @__PURE__ */ Z("span", {
1211
1212
  className: "text-xs text-muted-foreground",
1212
- children: Xt(e.createdAt)
1213
+ children: Zt(e.createdAt)
1213
1214
  }),
1214
1215
  e.pinned && /* @__PURE__ */ Q("span", {
1215
1216
  className: "text-xs text-amber-600 flex items-center gap-0.5",
@@ -1235,20 +1236,20 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1235
1236
  ]
1236
1237
  })]
1237
1238
  });
1238
- }, Qt = {
1239
+ }, $t = {
1239
1240
  field_change: Ee,
1240
1241
  create: qe,
1241
1242
  delete: et,
1242
1243
  comment: X,
1243
- status_change: de
1244
- }, $t = {
1244
+ status_change: ue
1245
+ }, en = {
1245
1246
  field_change: "bg-blue-100 text-blue-600",
1246
1247
  create: "bg-green-100 text-green-600",
1247
1248
  delete: "bg-red-100 text-red-600",
1248
1249
  comment: "bg-purple-100 text-purple-600",
1249
1250
  status_change: "bg-amber-100 text-amber-600"
1250
1251
  };
1251
- function en(e) {
1252
+ function tn(e) {
1252
1253
  try {
1253
1254
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
1254
1255
  if (r < 1) return "just now";
@@ -1261,24 +1262,24 @@ function en(e) {
1261
1262
  return e;
1262
1263
  }
1263
1264
  }
1264
- function tn(e) {
1265
+ function nn(e) {
1265
1266
  return e.description ? e.description : e.type === "field_change" && e.field ? `Changed ${e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " ")} from "${e.oldValue == null ? "(empty)" : String(e.oldValue)}" to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : e.type === "create" ? "Created this record" : e.type === "delete" ? "Deleted this record" : e.type === "status_change" && e.field ? `Changed status to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : "Updated record";
1266
1267
  }
1267
- var nn = {
1268
+ var rn = {
1268
1269
  all: "All",
1269
1270
  field_change: "Field Changes",
1270
1271
  create: "Creates",
1271
1272
  delete: "Deletes",
1272
1273
  comment: "Comments",
1273
1274
  status_change: "Status Changes"
1274
- }, rn = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
1275
+ }, an = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
1275
1276
  let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
1276
1277
  return /* @__PURE__ */ Q(S, {
1277
1278
  className: G("", r),
1278
1279
  children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
1279
1280
  className: "flex items-center gap-2 text-base",
1280
1281
  children: [
1281
- /* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
1282
+ /* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
1282
1283
  "Activity",
1283
1284
  /* @__PURE__ */ Q("span", {
1284
1285
  className: "text-sm font-normal text-muted-foreground",
@@ -1293,12 +1294,12 @@ var nn = {
1293
1294
  className: "flex flex-wrap gap-1.5 mb-4",
1294
1295
  role: "group",
1295
1296
  "aria-label": "Activity type filter",
1296
- children: Object.keys(nn).map((e) => /* @__PURE__ */ Q("button", {
1297
+ children: Object.keys(rn).map((e) => /* @__PURE__ */ Q("button", {
1297
1298
  type: "button",
1298
1299
  className: G("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
1299
1300
  onClick: () => o(e),
1300
1301
  "aria-pressed": a === e,
1301
- children: [e !== "all" && i.createElement(Qt[e] || Ee, { className: "h-3 w-3" }), nn[e]]
1302
+ children: [e !== "all" && i.createElement($t[e] || Ee, { className: "h-3 w-3" }), rn[e]]
1302
1303
  }, e))
1303
1304
  }), s.length === 0 ? /* @__PURE__ */ Z(k, {
1304
1305
  title: "No activity recorded",
@@ -1308,11 +1309,11 @@ var nn = {
1308
1309
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
1309
1310
  className: "space-y-4",
1310
1311
  children: s.map((e) => {
1311
- let t = Qt[e.type] || Ee;
1312
+ let t = $t[e.type] || Ee;
1312
1313
  return /* @__PURE__ */ Q("div", {
1313
1314
  className: "flex gap-3 relative",
1314
1315
  children: [/* @__PURE__ */ Z("div", {
1315
- className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", $t[e.type] || "bg-gray-100 text-gray-600"),
1316
+ className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", en[e.type] || "bg-gray-100 text-gray-600"),
1316
1317
  children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
1317
1318
  }), /* @__PURE__ */ Q("div", {
1318
1319
  className: "flex-1 min-w-0 pt-1",
@@ -1326,12 +1327,12 @@ var nn = {
1326
1327
  " ",
1327
1328
  /* @__PURE__ */ Z("span", {
1328
1329
  className: "text-muted-foreground",
1329
- children: tn(e)
1330
+ children: nn(e)
1330
1331
  })
1331
1332
  ]
1332
1333
  }), /* @__PURE__ */ Z("p", {
1333
1334
  className: "text-xs text-muted-foreground mt-0.5",
1334
- children: en(e.timestamp)
1335
+ children: tn(e.timestamp)
1335
1336
  })]
1336
1337
  })]
1337
1338
  }, e.id);
@@ -1339,7 +1340,7 @@ var nn = {
1339
1340
  })]
1340
1341
  })] })]
1341
1342
  });
1342
- }, an = {
1343
+ }, on = {
1343
1344
  create: "default",
1344
1345
  update: "secondary",
1345
1346
  delete: "destructive",
@@ -1351,12 +1352,12 @@ var nn = {
1351
1352
  export: "outline",
1352
1353
  import: "outline"
1353
1354
  };
1354
- function on(e) {
1355
+ function sn(e) {
1355
1356
  if (!e) return "";
1356
1357
  let t = e instanceof Date ? e : new Date(e);
1357
1358
  return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
1358
1359
  }
1359
- var sn = [
1360
+ var cn = [
1360
1361
  [60, "second"],
1361
1362
  [60, "minute"],
1362
1363
  [24, "hour"],
@@ -1365,27 +1366,27 @@ var sn = [
1365
1366
  [12, "month"],
1366
1367
  [Infinity, "year"]
1367
1368
  ];
1368
- function cn(e, t) {
1369
+ function ln(e, t) {
1369
1370
  if (!e) return "";
1370
1371
  let n = e instanceof Date ? e : new Date(e);
1371
1372
  if (Number.isNaN(n.getTime())) return String(e);
1372
1373
  let r = (n.getTime() - Date.now()) / 1e3;
1373
- for (let [n, i] of sn) {
1374
+ for (let [n, i] of cn) {
1374
1375
  if (Math.abs(r) < n) try {
1375
1376
  return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
1376
1377
  } catch {
1377
- return on(e);
1378
+ return sn(e);
1378
1379
  }
1379
1380
  r /= n;
1380
1381
  }
1381
- return on(e);
1382
+ return sn(e);
1382
1383
  }
1383
- function ln(e) {
1384
+ function un(e) {
1384
1385
  if (!e) return "?";
1385
1386
  let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
1386
1387
  return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
1387
1388
  }
1388
- function un(e) {
1389
+ function dn(e) {
1389
1390
  if (e == null || e === "") return "—";
1390
1391
  if (typeof e == "string") return e;
1391
1392
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -1395,7 +1396,7 @@ function un(e) {
1395
1396
  return String(e);
1396
1397
  }
1397
1398
  }
1398
- function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1399
+ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1399
1400
  return t ? /* @__PURE__ */ Z("div", {
1400
1401
  className: G("space-y-3", r),
1401
1402
  children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
@@ -1413,7 +1414,7 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1413
1414
  children: /* @__PURE__ */ Z("ol", {
1414
1415
  className: G("space-y-4", r),
1415
1416
  children: e.map((e, t) => {
1416
- let n = (e.action ?? "").toLowerCase(), r = an[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = on(e.created_at), s = cn(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1417
+ let n = (e.action ?? "").toLowerCase(), r = on[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = sn(e.created_at), s = ln(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1417
1418
  return /* @__PURE__ */ Q("li", {
1418
1419
  className: "flex items-start gap-3",
1419
1420
  children: [/* @__PURE__ */ Q(_, {
@@ -1423,7 +1424,7 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1423
1424
  alt: a
1424
1425
  }) : null, /* @__PURE__ */ Z(v, {
1425
1426
  className: "text-[10px] font-medium",
1426
- children: ln(e.user_name)
1427
+ children: un(e.user_name)
1427
1428
  })]
1428
1429
  }), /* @__PURE__ */ Q("div", {
1429
1430
  className: "min-w-0 flex-1",
@@ -1474,7 +1475,7 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1474
1475
  ": ",
1475
1476
  /* @__PURE__ */ Z("span", {
1476
1477
  className: "text-foreground",
1477
- children: un(e.to)
1478
+ children: dn(e.to)
1478
1479
  })
1479
1480
  ]
1480
1481
  }, e.field))
@@ -1491,12 +1492,12 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1491
1492
  ": ",
1492
1493
  /* @__PURE__ */ Z("span", {
1493
1494
  className: "line-through opacity-70",
1494
- children: un(e.from)
1495
+ children: dn(e.from)
1495
1496
  }),
1496
1497
  " → ",
1497
1498
  /* @__PURE__ */ Z("span", {
1498
1499
  className: "text-foreground",
1499
- children: un(e.to)
1500
+ children: dn(e.to)
1500
1501
  })
1501
1502
  ]
1502
1503
  }, e.field))
@@ -1510,13 +1511,13 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1510
1511
  }
1511
1512
  //#endregion
1512
1513
  //#region src/RecordMetaFooter.tsx
1513
- var fn = {
1514
+ var pn = {
1514
1515
  createdAt: "created_at",
1515
1516
  createdBy: "created_by",
1516
1517
  updatedAt: "updated_at",
1517
1518
  updatedBy: "updated_by"
1518
1519
  };
1519
- function pn(e) {
1520
+ function mn(e) {
1520
1521
  if (!e) return null;
1521
1522
  if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
1522
1523
  if (typeof e == "string" || typeof e == "number") {
@@ -1525,7 +1526,7 @@ function pn(e) {
1525
1526
  }
1526
1527
  return null;
1527
1528
  }
1528
- function mn(e, t) {
1529
+ function hn(e, t) {
1529
1530
  let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
1530
1531
  if (r < 60) return t("detail.justNow");
1531
1532
  let i = Math.floor(r / 60);
@@ -1533,7 +1534,7 @@ function mn(e, t) {
1533
1534
  let a = Math.floor(i / 60);
1534
1535
  return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
1535
1536
  }
1536
- function hn(e) {
1537
+ function gn(e) {
1537
1538
  try {
1538
1539
  return new Intl.DateTimeFormat(void 0, {
1539
1540
  dateStyle: "medium",
@@ -1543,16 +1544,16 @@ function hn(e) {
1543
1544
  return e.toISOString();
1544
1545
  }
1545
1546
  }
1546
- var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
1547
+ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1547
1548
  if (e == null || e === "") return null;
1548
1549
  let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
1549
1550
  name: n,
1550
1551
  type: r?.type || (i ? "lookup" : "text"),
1551
1552
  ...i && { reference_to: i },
1552
1553
  ...r?.reference_field && { reference_field: r.reference_field }
1553
- }, o = Tt(a) || a.type;
1554
+ }, o = Et(a) || a.type;
1554
1555
  if (o) {
1555
- let t = Ct(o);
1556
+ let t = wt(o);
1556
1557
  if (t) return /* @__PURE__ */ Z("span", {
1557
1558
  className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
1558
1559
  children: /* @__PURE__ */ Z(t, {
@@ -1562,7 +1563,7 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
1562
1563
  });
1563
1564
  }
1564
1565
  return /* @__PURE__ */ Z("span", { children: String(e) });
1565
- }, _n = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1566
+ }, vn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1566
1567
  if (!t && !n) return null;
1567
1568
  let o = n ? /* @__PURE__ */ Z(ae, {
1568
1569
  delayDuration: 200,
@@ -1571,11 +1572,11 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
1571
1572
  children: /* @__PURE__ */ Z("time", {
1572
1573
  dateTime: n.toISOString(),
1573
1574
  className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
1574
- children: mn(n, a)
1575
+ children: hn(n, a)
1575
1576
  })
1576
1577
  }), /* @__PURE__ */ Z(H, {
1577
1578
  side: "top",
1578
- children: hn(n)
1579
+ children: gn(n)
1579
1580
  })] })
1580
1581
  }) : null;
1581
1582
  return /* @__PURE__ */ Q("span", {
@@ -1585,7 +1586,7 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
1585
1586
  className: "text-muted-foreground/70",
1586
1587
  children: e
1587
1588
  }),
1588
- t ? /* @__PURE__ */ Z(gn, {
1589
+ t ? /* @__PURE__ */ Z(_n, {
1589
1590
  value: t,
1590
1591
  objectSchema: r,
1591
1592
  fieldName: i
@@ -1597,31 +1598,31 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
1597
1598
  o
1598
1599
  ]
1599
1600
  });
1600
- }, vn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1601
+ }, yn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1601
1602
  let { t: i } = $();
1602
1603
  if (!e) return null;
1603
- let a = pn(e[fn.createdAt]), o = pn(e[fn.updatedAt]), s = e[fn.createdBy], c = e[fn.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
1604
+ let a = mn(e[pn.createdAt]), o = mn(e[pn.updatedAt]), s = e[pn.createdBy], c = e[pn.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
1604
1605
  return !l && !d ? null : /* @__PURE__ */ Q("div", {
1605
1606
  className: G("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
1606
1607
  "data-testid": "record-meta-footer",
1607
- children: [l && /* @__PURE__ */ Z(_n, {
1608
+ children: [l && /* @__PURE__ */ Z(vn, {
1608
1609
  label: i("detail.createdBy"),
1609
1610
  user: s,
1610
1611
  date: a,
1611
1612
  objectSchema: t,
1612
- userField: fn.createdBy,
1613
+ userField: pn.createdBy,
1613
1614
  t: i
1614
- }), d && /* @__PURE__ */ Z(_n, {
1615
+ }), d && /* @__PURE__ */ Z(vn, {
1615
1616
  label: i("detail.updatedBy"),
1616
1617
  user: c,
1617
1618
  date: o,
1618
1619
  objectSchema: t,
1619
- userField: fn.updatedBy,
1620
+ userField: pn.updatedBy,
1620
1621
  t: i
1621
1622
  })]
1622
1623
  });
1623
- }, yn = 5;
1624
- function bn(e, t, i, a) {
1624
+ }, bn = 5;
1625
+ function xn(e, t, i, a) {
1625
1626
  if (e && typeof e == "object") {
1626
1627
  if (t.primaryField) {
1627
1628
  let n = e[t.primaryField];
@@ -1641,8 +1642,8 @@ function bn(e, t, i, a) {
1641
1642
  }
1642
1643
  return a;
1643
1644
  }
1644
- var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
1645
- let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0), [P, F] = i.useState(!1), { t: W } = $(), { currency: se } = At(), { fieldOptionLabel: ce } = gt(), ue = oe(), de = Ot(), K = i.useMemo(() => {
1645
+ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
1646
+ let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0), P = lt(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [F, W] = i.useState(!1), { t: K } = $(), { currency: se } = jt(), { fieldOptionLabel: le } = _t(), ue = oe(), de = kt(), q = i.useMemo(() => {
1646
1647
  if (!de?.isLoaded || !e.objectName) return e;
1647
1648
  let t = (t) => de.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1648
1649
  let n = typeof e == "string" ? e : e?.name;
@@ -1661,9 +1662,9 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1661
1662
  i.useEffect(() => {
1662
1663
  g && p && p(g);
1663
1664
  }, [g, p]);
1664
- let q = i.useMemo(() => {
1665
- if (K.summaryFields && K.summaryFields.length > 0) return [];
1666
- let e = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []], t = {};
1665
+ let fe = i.useMemo(() => {
1666
+ if (q.summaryFields && q.summaryFields.length > 0) return [];
1667
+ let e = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []], t = {};
1667
1668
  for (let n of e) t[n.name] || (t[n.name] = n);
1668
1669
  if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
1669
1670
  ...t[e] || {},
@@ -1682,26 +1683,26 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1682
1683
  let o = Object.keys(t).find((e) => (t[e]?.type === "date" || t[e]?.type === "datetime") && /close|due|start|end|expected/i.test(e) && n(e));
1683
1684
  return o && !r.includes(o) && r.push(o), r;
1684
1685
  }, [
1685
- K.summaryFields,
1686
- K.sections,
1687
- K.fields,
1686
+ q.summaryFields,
1687
+ q.sections,
1688
+ q.fields,
1688
1689
  N,
1689
1690
  g
1690
- ]), fe = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : q, pe = i.useCallback(() => {
1691
- K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
1691
+ ]), pe = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : fe, me = i.useCallback(() => {
1692
+ q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
1692
1693
  ne(!0), setTimeout(() => ne(!1), 1500);
1693
1694
  });
1694
- }, [K.resourceId]);
1695
+ }, [q.resourceId]);
1695
1696
  i.useEffect(() => {
1696
1697
  let e = !0;
1697
- if (K.data) return _(K.data), y(!1), n?.getObjectSchema && K.objectName && n.getObjectSchema(K.objectName).then((t) => {
1698
+ if (q.data) return _(q.data), y(!1), n?.getObjectSchema && q.objectName && n.getObjectSchema(q.objectName).then((t) => {
1698
1699
  e && ee(t);
1699
1700
  }).catch(() => {}), () => {
1700
1701
  e = !1;
1701
1702
  };
1702
- if (n && K.objectName && K.resourceId) {
1703
+ if (n && q.objectName && q.resourceId) {
1703
1704
  y(!0), ee(null), _(null);
1704
- let r = K.objectName, i = K.resourceId, a = `${r}-`, o = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []];
1705
+ let r = q.objectName, i = q.resourceId, a = `${r}-`, o = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []];
1705
1706
  (n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
1706
1707
  if (!e) return;
1707
1708
  ee(s);
@@ -1725,7 +1726,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1725
1726
  }).catch((t) => {
1726
1727
  e && (console.error("Failed to fetch detail data:", t), y(!1));
1727
1728
  });
1728
- } else K.api && K.resourceId && (y(!0), fetch(`${K.api}/${K.resourceId}`).then((e) => e.json()).then((t) => {
1729
+ } else q.api && q.resourceId && (y(!0), fetch(`${q.api}/${q.resourceId}`).then((e) => e.json()).then((t) => {
1729
1730
  e && _(t?.data || t);
1730
1731
  }).catch((e) => {
1731
1732
  console.error("Failed to fetch detail data:", e);
@@ -1736,71 +1737,72 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1736
1737
  e = !1;
1737
1738
  };
1738
1739
  }, [
1739
- K.api,
1740
- K.resourceId,
1741
- K.objectName,
1740
+ q.api,
1741
+ q.resourceId,
1742
+ q.objectName,
1742
1743
  n,
1743
- K.sections,
1744
- K.fields,
1745
- re
1744
+ q.sections,
1745
+ q.fields,
1746
+ re,
1747
+ P
1746
1748
  ]);
1747
- let me = i.useCallback(() => {
1749
+ let he = i.useCallback(() => {
1748
1750
  if (s) s();
1749
- else if (K.onNavigate) {
1750
- let e = K.backUrl || (K.objectName ? `/${K.objectName}` : "/");
1751
- K.onNavigate(e, { replace: !0 });
1752
- } else K.backUrl ? window.location.href = K.backUrl : window.history.back();
1753
- }, [s, K]), he = i.useCallback(() => {
1754
- a ? a() : K.onNavigate && K.editUrl ? K.onNavigate(K.editUrl) : K.onNavigate && K.objectName && K.resourceId ? K.onNavigate(`/${K.objectName}/${K.resourceId}/edit`) : K.editUrl && (window.location.href = K.editUrl);
1755
- }, [a, K]), _e = i.useCallback(async () => {
1756
- if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
1757
- M(W("detail.cancelApprovalUnavailable"));
1751
+ else if (q.onNavigate) {
1752
+ let e = q.backUrl || (q.objectName ? `/${q.objectName}` : "/");
1753
+ q.onNavigate(e, { replace: !0 });
1754
+ } else q.backUrl ? window.location.href = q.backUrl : window.history.back();
1755
+ }, [s, q]), _e = i.useCallback(() => {
1756
+ a ? a() : q.onNavigate && q.editUrl ? q.onNavigate(q.editUrl) : q.onNavigate && q.objectName && q.resourceId ? q.onNavigate(`/${q.objectName}/${q.resourceId}/edit`) : q.editUrl && (window.location.href = q.editUrl);
1757
+ }, [a, q]), ve = i.useCallback(async () => {
1758
+ if (!n?.cancelPendingApproval || !q.objectName || !q.resourceId) {
1759
+ M(K("detail.cancelApprovalUnavailable"));
1758
1760
  return;
1759
1761
  }
1760
- F(!0), M(null);
1762
+ W(!0), M(null);
1761
1763
  try {
1762
- if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
1763
- let e = await n.findOne(String(K.objectName), String(K.resourceId));
1764
+ if (await n.cancelPendingApproval(String(q.objectName), String(q.resourceId)), n.findOne) try {
1765
+ let e = await n.findOne(String(q.objectName), String(q.resourceId));
1764
1766
  e && _(e);
1765
1767
  } catch {}
1766
1768
  ie((e) => e + 1);
1767
1769
  try {
1768
1770
  window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
1769
- objectName: String(K.objectName),
1770
- recordId: String(K.resourceId),
1771
+ objectName: String(q.objectName),
1772
+ recordId: String(q.resourceId),
1771
1773
  reason: "approval-recalled"
1772
1774
  } }));
1773
1775
  } catch {}
1774
1776
  } catch (e) {
1775
1777
  let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
1776
- M(`${W("detail.cancelApprovalFailed")}: ${t}`);
1778
+ M(`${K("detail.cancelApprovalFailed")}: ${t}`);
1777
1779
  } finally {
1778
- F(!1);
1780
+ W(!1);
1779
1781
  }
1780
1782
  }, [
1781
1783
  n,
1782
- K.objectName,
1783
- K.resourceId,
1784
- W
1785
- ]), ve = i.useCallback(() => {
1786
- let e = K.deleteConfirmation || W("detail.deleteConfirmation");
1787
- window.confirm(e) && (o?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
1788
- }, [o, K]), xe = i.useCallback(() => {
1789
- navigator.share && K.objectName && K.resourceId ? navigator.share({
1790
- title: K.title || W("detail.details"),
1791
- text: `${K.objectName} #${K.resourceId}`,
1784
+ q.objectName,
1785
+ q.resourceId,
1786
+ K
1787
+ ]), xe = i.useCallback(() => {
1788
+ let e = q.deleteConfirmation || K("detail.deleteConfirmation");
1789
+ window.confirm(e) && (o?.(), q.onNavigate && q.objectName && q.onNavigate(`/${q.objectName}`, { replace: !0 }));
1790
+ }, [o, q]), Se = i.useCallback(() => {
1791
+ navigator.share && q.objectName && q.resourceId ? navigator.share({
1792
+ title: q.title || K("detail.details"),
1793
+ text: `${q.objectName} #${q.resourceId}`,
1792
1794
  url: window.location.href
1793
1795
  }).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
1794
1796
  console.log("Link copied to clipboard");
1795
1797
  });
1796
- }, [K]), Se = i.useCallback(() => {
1798
+ }, [q]), Ce = i.useCallback(() => {
1797
1799
  let e = !w;
1798
1800
  h && h(e), m === void 0 && C(e);
1799
1801
  }, [
1800
1802
  w,
1801
1803
  m,
1802
1804
  h
1803
- ]), Ce = i.useCallback(async () => {
1805
+ ]), we = i.useCallback(async () => {
1804
1806
  if (T) {
1805
1807
  let e = Object.entries(D);
1806
1808
  if (e.length > 0) {
@@ -1827,79 +1829,79 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1827
1829
  D,
1828
1830
  g,
1829
1831
  l
1830
- ]), we = i.useCallback(() => {
1832
+ ]), De = i.useCallback(() => {
1831
1833
  O({}), E(!1), M(null);
1832
- }, []), De = i.useCallback((e, t) => {
1834
+ }, []), Oe = i.useCallback((e, t) => {
1833
1835
  O((n) => ({
1834
1836
  ...n,
1835
1837
  [e]: t
1836
1838
  }));
1837
1839
  }, []);
1838
1840
  i.useEffect(() => {
1839
- if (!K.recordNavigation) return;
1840
- let e = K.recordNavigation, t = (t) => {
1841
+ if (!q.recordNavigation) return;
1842
+ let e = q.recordNavigation, t = (t) => {
1841
1843
  let n = t.target?.tagName;
1842
1844
  n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable || (t.key === "ArrowLeft" && e.currentIndex > 0 ? (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex - 1])) : t.key === "ArrowRight" && e.currentIndex < e.recordIds.length - 1 && (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex + 1])));
1843
1845
  };
1844
1846
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1845
- }, [K.recordNavigation]), i.useEffect(() => {
1846
- if (!c || K.showHeader !== !1) return;
1847
+ }, [q.recordNavigation]), i.useEffect(() => {
1848
+ if (!c || q.showHeader !== !1) return;
1847
1849
  let e = "objectui:record:inline-edit-toggle", t = (e) => {
1848
1850
  let t = e.detail;
1849
- t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName || Ce();
1851
+ t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName || we();
1850
1852
  };
1851
1853
  return window.addEventListener(e, t), () => window.removeEventListener(e, t);
1852
1854
  }, [
1853
1855
  c,
1854
- K.showHeader,
1855
- K.recordId,
1856
- K.objectName,
1857
- Ce
1856
+ q.showHeader,
1857
+ q.recordId,
1858
+ q.objectName,
1859
+ we
1858
1860
  ]);
1859
- let Oe = i.useMemo(() => K.related ?? [], [K.related]), J = i.useMemo(() => {
1861
+ let J = i.useMemo(() => q.related ?? [], [q.related]), ke = i.useMemo(() => {
1860
1862
  let e = [];
1861
1863
  return e.push({
1862
1864
  name: "sys_share",
1863
- label: W("detail.share"),
1865
+ label: K("detail.share"),
1864
1866
  icon: "share-2",
1865
1867
  type: "script",
1866
- onClick: xe
1867
- }), K.showEdit && e.push({
1868
+ onClick: Se
1869
+ }), q.showEdit && e.push({
1868
1870
  name: "sys_edit_mobile",
1869
- label: W("detail.edit"),
1871
+ label: K("detail.edit"),
1870
1872
  icon: "edit",
1871
1873
  type: "script",
1872
1874
  className: "sm:hidden",
1873
- onClick: he
1875
+ onClick: _e
1874
1876
  }), c && e.push({
1875
1877
  name: "sys_toggle_inline_edit_mobile",
1876
- label: W(T ? "detail.save" : "detail.editInline"),
1878
+ label: K(T ? "detail.save" : "detail.editInline"),
1877
1879
  icon: "edit",
1878
1880
  type: "script",
1879
1881
  className: "sm:hidden",
1880
- onClick: Ce
1881
- }), K.showDelete && e.push({
1882
+ onClick: we
1883
+ }), q.showDelete && e.push({
1882
1884
  name: "sys_delete",
1883
- label: W("detail.delete"),
1885
+ label: K("detail.delete"),
1884
1886
  icon: "trash-2",
1885
1887
  type: "script",
1886
1888
  variant: "destructive",
1887
1889
  tags: ["separator-before"],
1888
- onClick: ve
1890
+ onClick: xe
1889
1891
  }), e;
1890
1892
  }, [
1891
- W,
1892
- K.showEdit,
1893
- K.showDelete,
1893
+ K,
1894
+ q.showEdit,
1895
+ q.showDelete,
1894
1896
  c,
1895
1897
  T,
1896
- xe,
1897
- he,
1898
- Ce,
1899
- ve
1900
- ]), ke = i.useMemo(() => {
1901
- let e = K.actions ?? [];
1902
- if (J.length === 0) return e;
1898
+ Se,
1899
+ _e,
1900
+ we,
1901
+ xe
1902
+ ]), Ae = i.useMemo(() => {
1903
+ let e = q.actions ?? [];
1904
+ if (ke.length === 0) return e;
1903
1905
  let t = !1, n = e.map((e) => {
1904
1906
  let n = e;
1905
1907
  if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
@@ -1907,7 +1909,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1907
1909
  let e = Array.isArray(n.systemActions) ? n.systemActions : [];
1908
1910
  return {
1909
1911
  ...n,
1910
- systemActions: [...e, ...J]
1912
+ systemActions: [...e, ...ke]
1911
1913
  };
1912
1914
  }
1913
1915
  return e;
@@ -1915,69 +1917,69 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1915
1917
  return t || n.push({
1916
1918
  type: "action:bar",
1917
1919
  location: "record_header",
1918
- systemActions: J
1920
+ systemActions: ke
1919
1921
  }), n;
1920
- }, [K.actions, J]);
1921
- return v || K.loading ? /* @__PURE__ */ Q("div", {
1922
+ }, [q.actions, ke]);
1923
+ return v || q.loading ? /* @__PURE__ */ Q("div", {
1922
1924
  className: G("space-y-4", r),
1923
1925
  children: [
1924
1926
  /* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
1925
1927
  /* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
1926
1928
  /* @__PURE__ */ Z(I, { className: "h-48 w-full" })
1927
1929
  ]
1928
- }) : !g && !K.data ? /* @__PURE__ */ Q("div", {
1930
+ }) : !g && !q.data ? /* @__PURE__ */ Q("div", {
1929
1931
  className: G("flex flex-col items-center justify-center py-16 text-center", r),
1930
1932
  children: [
1931
1933
  /* @__PURE__ */ Z("p", {
1932
1934
  className: "text-lg font-semibold",
1933
- children: W("detail.recordNotFound")
1935
+ children: K("detail.recordNotFound")
1934
1936
  }),
1935
1937
  /* @__PURE__ */ Z("p", {
1936
1938
  className: "text-sm text-muted-foreground mt-1",
1937
- children: W("detail.recordNotFoundDescription")
1939
+ children: K("detail.recordNotFoundDescription")
1938
1940
  }),
1939
- (K.showBack ?? !0) && /* @__PURE__ */ Q(x, {
1941
+ (q.showBack ?? !0) && /* @__PURE__ */ Q(x, {
1940
1942
  variant: "outline",
1941
1943
  size: "sm",
1942
- onClick: me,
1944
+ onClick: he,
1943
1945
  className: "mt-4 gap-2",
1944
- children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }), W("detail.goBack")]
1946
+ children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), K("detail.goBack")]
1945
1947
  })
1946
1948
  ]
1947
1949
  }) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
1948
1950
  className: G("space-y-6", r),
1949
1951
  children: [
1950
- K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1952
+ q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1951
1953
  className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
1952
1954
  children: [/* @__PURE__ */ Q("div", {
1953
1955
  className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
1954
- children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1956
+ children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1955
1957
  asChild: !0,
1956
1958
  children: /* @__PURE__ */ Z(x, {
1957
1959
  variant: "ghost",
1958
1960
  size: "icon",
1959
- onClick: me,
1961
+ onClick: he,
1960
1962
  className: "shrink-0 mt-1",
1961
- children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
1963
+ children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
1962
1964
  })
1963
- }), /* @__PURE__ */ Z(H, { children: W("detail.back") })] }), /* @__PURE__ */ Q("div", {
1965
+ }), /* @__PURE__ */ Z(H, { children: K("detail.back") })] }), /* @__PURE__ */ Q("div", {
1964
1966
  className: "flex-1 min-w-0",
1965
1967
  children: [/* @__PURE__ */ Q("div", {
1966
1968
  className: "flex items-center gap-2 flex-wrap",
1967
1969
  children: [
1968
1970
  /* @__PURE__ */ Z("h1", {
1969
1971
  className: "text-xl sm:text-2xl font-bold truncate",
1970
- children: bn(g, K, N, W("detail.details"))
1972
+ children: xn(g, q, N, K("detail.details"))
1971
1973
  }),
1972
- fe.map((e) => {
1974
+ pe.map((e) => {
1973
1975
  let t = g?.[e];
1974
1976
  if (t == null || t === "") return null;
1975
- let n = (K.sections || []).flatMap((e) => e.fields).concat(K.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
1977
+ let n = (q.sections || []).flatMap((e) => e.fields).concat(q.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
1976
1978
  try {
1977
1979
  if (i === "currency") {
1978
1980
  let e = Number(t);
1979
1981
  if (!Number.isNaN(e)) {
1980
- let t = kt({
1982
+ let t = At({
1981
1983
  ...r,
1982
1984
  ...n
1983
1985
  }, se);
@@ -2009,7 +2011,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2009
2011
  let e = i[String(t)];
2010
2012
  e?.label && (o = e.label);
2011
2013
  }
2012
- a = K.objectName ? ce(K.objectName, e, String(t), o) : o;
2014
+ a = q.objectName ? le(q.objectName, e, String(t), o) : o;
2013
2015
  }
2014
2016
  } catch {}
2015
2017
  return o === null ? /* @__PURE__ */ Z(b, {
@@ -2037,34 +2039,34 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2037
2039
  variant: "ghost",
2038
2040
  size: "icon",
2039
2041
  className: "h-6 w-6 shrink-0",
2040
- onClick: Se,
2041
- "aria-label": W(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2042
+ onClick: Ce,
2043
+ "aria-label": K(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2042
2044
  children: w ? /* @__PURE__ */ Z($e, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z($e, { className: "h-4 w-4 text-muted-foreground" })
2043
2045
  })
2044
- }), /* @__PURE__ */ Z(H, { children: W(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2046
+ }), /* @__PURE__ */ Z(H, { children: K(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2045
2047
  ]
2046
- }), K.objectName && /* @__PURE__ */ Q("p", {
2048
+ }), q.objectName && /* @__PURE__ */ Q("p", {
2047
2049
  className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
2048
2050
  children: [/* @__PURE__ */ Z("span", {
2049
2051
  className: "font-medium",
2050
- children: f || K.objectName
2051
- }), K.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2052
+ children: f || q.objectName
2053
+ }), q.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2052
2054
  asChild: !0,
2053
2055
  children: /* @__PURE__ */ Z(x, {
2054
2056
  variant: "ghost",
2055
2057
  size: "icon",
2056
2058
  className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
2057
- onClick: pe,
2058
- "aria-label": W("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2059
+ onClick: me,
2060
+ "aria-label": K("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2059
2061
  children: te ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
2060
2062
  })
2061
- }), /* @__PURE__ */ Z(H, { children: te ? W("detail.copied", { defaultValue: "Copied" }) : W("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2063
+ }), /* @__PURE__ */ Z(H, { children: te ? K("detail.copied", { defaultValue: "Copied" }) : K("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2062
2064
  })]
2063
2065
  })]
2064
2066
  }), /* @__PURE__ */ Q("div", {
2065
2067
  className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
2066
2068
  children: [
2067
- K.recordNavigation && /* @__PURE__ */ Q("div", {
2069
+ q.recordNavigation && /* @__PURE__ */ Q("div", {
2068
2070
  className: "flex items-center gap-1 mr-2",
2069
2071
  children: [
2070
2072
  /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
@@ -2073,19 +2075,19 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2073
2075
  variant: "outline",
2074
2076
  size: "icon",
2075
2077
  className: "h-8 w-8",
2076
- disabled: K.recordNavigation.currentIndex <= 0,
2078
+ disabled: q.recordNavigation.currentIndex <= 0,
2077
2079
  onClick: () => {
2078
- let e = K.recordNavigation;
2080
+ let e = q.recordNavigation;
2079
2081
  e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
2080
2082
  },
2081
2083
  children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
2082
2084
  })
2083
- }), /* @__PURE__ */ Z(H, { children: W("detail.previousRecord") })] }),
2085
+ }), /* @__PURE__ */ Z(H, { children: K("detail.previousRecord") })] }),
2084
2086
  /* @__PURE__ */ Z("span", {
2085
2087
  className: "text-xs text-muted-foreground whitespace-nowrap px-1",
2086
- children: W("detail.recordOf", {
2087
- current: K.recordNavigation.currentIndex + 1,
2088
- total: K.recordNavigation.recordIds.length
2088
+ children: K("detail.recordOf", {
2089
+ current: q.recordNavigation.currentIndex + 1,
2090
+ total: q.recordNavigation.recordIds.length
2089
2091
  })
2090
2092
  }),
2091
2093
  /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
@@ -2094,110 +2096,110 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2094
2096
  variant: "outline",
2095
2097
  size: "icon",
2096
2098
  className: "h-8 w-8",
2097
- disabled: K.recordNavigation.currentIndex >= K.recordNavigation.recordIds.length - 1,
2099
+ disabled: q.recordNavigation.currentIndex >= q.recordNavigation.recordIds.length - 1,
2098
2100
  onClick: () => {
2099
- let e = K.recordNavigation;
2101
+ let e = q.recordNavigation;
2100
2102
  e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
2101
2103
  },
2102
2104
  children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
2103
2105
  })
2104
- }), /* @__PURE__ */ Z(H, { children: W("detail.nextRecord") })] })
2106
+ }), /* @__PURE__ */ Z(H, { children: K("detail.nextRecord") })] })
2105
2107
  ]
2106
2108
  }),
2107
- c && /* @__PURE__ */ Q(Et, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2109
+ c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2108
2110
  asChild: !0,
2109
2111
  children: /* @__PURE__ */ Q(x, {
2110
2112
  variant: "ghost",
2111
2113
  size: "sm",
2112
- onClick: we,
2114
+ onClick: De,
2113
2115
  className: "gap-2 hidden sm:inline-flex",
2114
2116
  children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2115
2117
  className: "hidden sm:inline",
2116
- children: W("detail.cancel")
2118
+ children: K("detail.cancel")
2117
2119
  })]
2118
2120
  })
2119
- }), /* @__PURE__ */ Z(H, { children: W("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2121
+ }), /* @__PURE__ */ Z(H, { children: K("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2120
2122
  asChild: !0,
2121
2123
  children: /* @__PURE__ */ Z(x, {
2122
2124
  variant: T ? "default" : "outline",
2123
2125
  size: "sm",
2124
- onClick: Ce,
2126
+ onClick: we,
2125
2127
  className: "gap-2 hidden sm:inline-flex",
2126
- children: T ? /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2128
+ children: T ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2127
2129
  className: "hidden sm:inline",
2128
- children: W("detail.save")
2129
- })] }) : /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2130
+ children: K("detail.save")
2131
+ })] }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2130
2132
  className: "hidden sm:inline",
2131
- children: W("detail.editInline")
2133
+ children: K("detail.editInline")
2132
2134
  })] })
2133
2135
  })
2134
- }), /* @__PURE__ */ Z(H, { children: W(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2135
- K.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2136
+ }), /* @__PURE__ */ Z(H, { children: K(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2137
+ q.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2136
2138
  asChild: !0,
2137
2139
  children: /* @__PURE__ */ Q(x, {
2138
2140
  variant: "default",
2139
- onClick: he,
2141
+ onClick: _e,
2140
2142
  className: "gap-2 hidden sm:inline-flex",
2141
2143
  children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2142
2144
  className: "hidden sm:inline",
2143
- children: W("detail.edit")
2145
+ children: K("detail.edit")
2144
2146
  })]
2145
2147
  })
2146
- }), /* @__PURE__ */ Z(H, { children: W("detail.editRecord") })] }),
2147
- ke.map((e, t) => /* @__PURE__ */ Z(at, {
2148
+ }), /* @__PURE__ */ Z(H, { children: K("detail.editRecord") })] }),
2149
+ Ae.map((e, t) => /* @__PURE__ */ Z(at, {
2148
2150
  schema: e,
2149
2151
  data: g
2150
2152
  }, `header-action-${t}`))
2151
2153
  ]
2152
2154
  })]
2153
2155
  }),
2154
- K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2155
- schema: K.header,
2156
+ q.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2157
+ schema: q.header,
2156
2158
  data: g
2157
2159
  }) }),
2158
- K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Yt, {
2159
- fields: K.highlightFields,
2160
+ q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
2161
+ fields: q.highlightFields,
2160
2162
  data: g,
2161
- objectName: K.objectName,
2163
+ objectName: q.objectName,
2162
2164
  objectSchema: N
2163
2165
  }),
2164
- c && K.showHeader === !1 && (() => {
2166
+ c && q.showHeader === !1 && (() => {
2165
2167
  let e = g?.approval_status, t = e === "pending" || e === "in_approval";
2166
2168
  return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
2167
2169
  className: "flex flex-col items-end gap-1",
2168
2170
  children: [/* @__PURE__ */ Q("div", {
2169
2171
  className: "flex items-center justify-end gap-2",
2170
2172
  children: [
2171
- t && !T && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Q("span", {
2173
+ t && !T && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("span", {
2172
2174
  role: "status",
2173
2175
  className: "inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-1 text-xs text-amber-800",
2174
- title: W("detail.lockedTooltip"),
2175
- children: [/* @__PURE__ */ Z(Re, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: W("detail.lockedByApproval") })]
2176
+ title: K("detail.lockedTooltip"),
2177
+ children: [/* @__PURE__ */ Z(Re, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: K("detail.lockedByApproval") })]
2176
2178
  }), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
2177
2179
  variant: "outline",
2178
2180
  size: "sm",
2179
- onClick: _e,
2180
- disabled: P,
2181
+ onClick: ve,
2182
+ disabled: F,
2181
2183
  className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
2182
- title: W("detail.cancelApprovalTooltip"),
2183
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W(P ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2184
+ title: K("detail.cancelApprovalTooltip"),
2185
+ children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(F ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2184
2186
  })] }),
2185
2187
  T && /* @__PURE__ */ Q(x, {
2186
2188
  variant: "ghost",
2187
2189
  size: "sm",
2188
- onClick: we,
2190
+ onClick: De,
2189
2191
  className: "gap-2",
2190
2192
  disabled: k,
2191
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W("detail.cancel") })]
2193
+ children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K("detail.cancel") })]
2192
2194
  }),
2193
2195
  /* @__PURE__ */ Q(x, {
2194
2196
  variant: T ? "default" : "outline",
2195
2197
  size: "sm",
2196
- onClick: Ce,
2198
+ onClick: we,
2197
2199
  className: "gap-2",
2198
2200
  disabled: k || t && !T,
2199
- title: t && !T ? W("detail.lockedTooltip") : void 0,
2200
- children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2201
+ title: t && !T ? K("detail.lockedTooltip") : void 0,
2202
+ children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2201
2203
  })
2202
2204
  ]
2203
2205
  }), j && /* @__PURE__ */ Z("div", {
@@ -2207,60 +2209,67 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2207
2209
  })]
2208
2210
  });
2209
2211
  })(),
2210
- K.autoTabs && !K.tabs?.length ? (() => {
2211
- let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a = /* @__PURE__ */ Q("div", {
2212
+ q.autoTabs && !q.tabs?.length ? (() => {
2213
+ let e = J.length > 0, t = !!q.activities && q.activities.length > 0, r = !!u, i = !!q.history, a = [
2214
+ "details",
2215
+ ...e ? ["related"] : [],
2216
+ ...t ? ["activity"] : [],
2217
+ ...r ? ["discussion"] : [],
2218
+ ...i ? ["history"] : []
2219
+ ], o = q.defaultTab, s = o && a.includes(o) ? o : "details", c = q.onTabChange, l = /* @__PURE__ */ Q("div", {
2212
2220
  className: "space-y-3 sm:space-y-4",
2213
2221
  children: [
2214
- K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Jt, {
2222
+ q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2215
2223
  group: e,
2216
2224
  data: {
2217
2225
  ...g,
2218
2226
  ...D
2219
2227
  },
2220
2228
  objectSchema: N,
2221
- objectName: K.objectName,
2229
+ objectName: q.objectName,
2222
2230
  isEditing: T,
2223
- onFieldChange: De,
2231
+ onFieldChange: Oe,
2224
2232
  dataSource: n
2225
2233
  }, t)),
2226
- K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Wt, {
2234
+ q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2227
2235
  section: e,
2228
2236
  data: {
2229
2237
  ...g,
2230
2238
  ...D
2231
2239
  },
2232
2240
  objectSchema: N,
2233
- objectName: K.objectName,
2241
+ objectName: q.objectName,
2234
2242
  isEditing: T,
2235
- onFieldChange: De,
2243
+ onFieldChange: Oe,
2236
2244
  dataSource: n
2237
2245
  }, t)),
2238
- K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Wt, {
2246
+ q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
2239
2247
  section: {
2240
- fields: K.fields,
2241
- columns: K.columns
2248
+ fields: q.fields,
2249
+ columns: q.columns
2242
2250
  },
2243
2251
  data: {
2244
2252
  ...g,
2245
2253
  ...D
2246
2254
  },
2247
2255
  objectSchema: N,
2248
- objectName: K.objectName,
2256
+ objectName: q.objectName,
2249
2257
  isEditing: T,
2250
- onFieldChange: De,
2258
+ onFieldChange: Oe,
2251
2259
  dataSource: n
2252
2260
  }),
2253
- K.comments && /* @__PURE__ */ Z(Zt, {
2254
- comments: K.comments,
2255
- onAddComment: K.onAddComment
2261
+ q.comments && /* @__PURE__ */ Z(Qt, {
2262
+ comments: q.comments,
2263
+ onAddComment: q.onAddComment
2256
2264
  })
2257
2265
  ]
2258
2266
  });
2259
2267
  return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
2260
2268
  className: "mt-2",
2261
- children: a
2269
+ children: l
2262
2270
  }) : /* @__PURE__ */ Q(L, {
2263
- defaultValue: "details",
2271
+ defaultValue: s,
2272
+ onValueChange: c,
2264
2273
  className: "w-full",
2265
2274
  children: [
2266
2275
  /* @__PURE__ */ Q(z, {
@@ -2269,17 +2278,17 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2269
2278
  /* @__PURE__ */ Z(B, {
2270
2279
  value: "details",
2271
2280
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2272
- children: W("detail.details")
2281
+ children: K("detail.details")
2273
2282
  }),
2274
2283
  e && /* @__PURE__ */ Z(B, {
2275
2284
  value: "related",
2276
2285
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2277
2286
  children: /* @__PURE__ */ Q("span", {
2278
2287
  className: "flex items-center gap-1.5",
2279
- children: [W("detail.related"), /* @__PURE__ */ Z(b, {
2288
+ children: [K("detail.related"), /* @__PURE__ */ Z(b, {
2280
2289
  variant: "secondary",
2281
2290
  className: "text-xs bg-primary/10 text-primary border-transparent",
2282
- children: Oe.length
2291
+ children: J.length
2283
2292
  })]
2284
2293
  })
2285
2294
  }),
@@ -2288,27 +2297,27 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2288
2297
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2289
2298
  children: /* @__PURE__ */ Q("span", {
2290
2299
  className: "flex items-center gap-1.5",
2291
- children: [W("detail.activity"), /* @__PURE__ */ Z(b, {
2300
+ children: [K("detail.activity"), /* @__PURE__ */ Z(b, {
2292
2301
  variant: "secondary",
2293
2302
  className: "text-xs bg-primary/10 text-primary border-transparent",
2294
- children: K.activities.length
2303
+ children: q.activities.length
2295
2304
  })]
2296
2305
  })
2297
2306
  }),
2298
2307
  r && /* @__PURE__ */ Z(B, {
2299
2308
  value: "discussion",
2300
2309
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2301
- children: W("detail.discussion", { defaultValue: "Discussion" })
2310
+ children: K("detail.discussion", { defaultValue: "Discussion" })
2302
2311
  }),
2303
2312
  i && /* @__PURE__ */ Z(B, {
2304
2313
  value: "history",
2305
2314
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2306
2315
  children: /* @__PURE__ */ Q("span", {
2307
2316
  className: "flex items-center gap-1.5",
2308
- children: [W("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2317
+ children: [K("detail.history", { defaultValue: "History" }), !q.history.loading && q.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2309
2318
  variant: "secondary",
2310
2319
  className: "text-xs bg-primary/10 text-primary border-transparent",
2311
- children: K.history.entries.length
2320
+ children: q.history.entries.length
2312
2321
  })]
2313
2322
  })
2314
2323
  })
@@ -2317,14 +2326,14 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2317
2326
  /* @__PURE__ */ Z(R, {
2318
2327
  value: "details",
2319
2328
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2320
- children: a
2329
+ children: l
2321
2330
  }),
2322
2331
  e && /* @__PURE__ */ Z(R, {
2323
2332
  value: "related",
2324
2333
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2325
2334
  children: /* @__PURE__ */ Z("div", {
2326
2335
  className: "space-y-3",
2327
- children: Oe.map((e, t) => /* @__PURE__ */ Z(qt, {
2336
+ children: J.map((e, t) => /* @__PURE__ */ Z(Jt, {
2328
2337
  title: e.title,
2329
2338
  type: e.type,
2330
2339
  api: e.api,
@@ -2341,14 +2350,14 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2341
2350
  onRowDelete: e.onRowDelete,
2342
2351
  collapsible: !0,
2343
2352
  defaultCollapsed: ue && t > 0,
2344
- pageSize: yn
2353
+ pageSize: bn
2345
2354
  }, t))
2346
2355
  })
2347
2356
  }),
2348
2357
  t && /* @__PURE__ */ Z(R, {
2349
2358
  value: "activity",
2350
2359
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2351
- children: /* @__PURE__ */ Z(rn, { activities: K.activities })
2360
+ children: /* @__PURE__ */ Z(an, { activities: q.activities })
2352
2361
  }),
2353
2362
  r && /* @__PURE__ */ Z(R, {
2354
2363
  value: "discussion",
@@ -2358,70 +2367,70 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2358
2367
  i && /* @__PURE__ */ Z(R, {
2359
2368
  value: "history",
2360
2369
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2361
- children: /* @__PURE__ */ Z(dn, {
2362
- entries: K.history.entries,
2363
- loading: K.history.loading,
2364
- emptyText: K.history.emptyText ?? W("detail.historyEmpty", { defaultValue: "No history yet" })
2370
+ children: /* @__PURE__ */ Z(fn, {
2371
+ entries: q.history.entries,
2372
+ loading: q.history.loading,
2373
+ emptyText: q.history.emptyText ?? K("detail.historyEmpty", { defaultValue: "No history yet" })
2365
2374
  })
2366
2375
  })
2367
2376
  ]
2368
2377
  });
2369
- })() : /* @__PURE__ */ Q(Et, { children: [
2370
- K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2378
+ })() : /* @__PURE__ */ Q(Dt, { children: [
2379
+ q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2371
2380
  className: "space-y-3 sm:space-y-4",
2372
- children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Jt, {
2381
+ children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2373
2382
  group: e,
2374
2383
  data: {
2375
2384
  ...g,
2376
2385
  ...D
2377
2386
  },
2378
2387
  objectSchema: N,
2379
- objectName: K.objectName,
2388
+ objectName: q.objectName,
2380
2389
  isEditing: T,
2381
- onFieldChange: De,
2390
+ onFieldChange: Oe,
2382
2391
  dataSource: n
2383
2392
  }, t))
2384
2393
  }),
2385
- K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
2394
+ q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
2386
2395
  className: "space-y-3 sm:space-y-4",
2387
- children: K.sections.map((e, t) => /* @__PURE__ */ Z(Wt, {
2396
+ children: q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2388
2397
  section: e,
2389
2398
  data: {
2390
2399
  ...g,
2391
2400
  ...D
2392
2401
  },
2393
2402
  objectSchema: N,
2394
- objectName: K.objectName,
2403
+ objectName: q.objectName,
2395
2404
  isEditing: T,
2396
- onFieldChange: De,
2405
+ onFieldChange: Oe,
2397
2406
  dataSource: n
2398
2407
  }, t))
2399
2408
  }),
2400
- K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Wt, {
2409
+ q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
2401
2410
  section: {
2402
- fields: K.fields,
2403
- columns: K.columns
2411
+ fields: q.fields,
2412
+ columns: q.columns
2404
2413
  },
2405
2414
  data: {
2406
2415
  ...g,
2407
2416
  ...D
2408
2417
  },
2409
2418
  objectSchema: N,
2410
- objectName: K.objectName,
2419
+ objectName: q.objectName,
2411
2420
  isEditing: T,
2412
- onFieldChange: De,
2421
+ onFieldChange: Oe,
2413
2422
  dataSource: n
2414
2423
  }),
2415
- K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Gt, {
2416
- tabs: K.tabs,
2424
+ q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
2425
+ tabs: q.tabs,
2417
2426
  data: g
2418
2427
  }),
2419
- Oe.length > 0 && /* @__PURE__ */ Q("div", {
2428
+ J.length > 0 && /* @__PURE__ */ Q("div", {
2420
2429
  className: "space-y-3",
2421
2430
  children: [/* @__PURE__ */ Z("h2", {
2422
2431
  className: "text-lg font-semibold",
2423
- children: W("detail.related")
2424
- }), Oe.map((e, t) => /* @__PURE__ */ Z(qt, {
2432
+ children: K("detail.related")
2433
+ }), J.map((e, t) => /* @__PURE__ */ Z(Jt, {
2425
2434
  title: e.title,
2426
2435
  type: e.type,
2427
2436
  api: e.api,
@@ -2438,30 +2447,30 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2438
2447
  onRowDelete: e.onRowDelete,
2439
2448
  collapsible: !0,
2440
2449
  defaultCollapsed: ue && t > 0,
2441
- pageSize: yn
2450
+ pageSize: bn
2442
2451
  }, t))]
2443
2452
  }),
2444
- K.comments && /* @__PURE__ */ Z(Zt, {
2445
- comments: K.comments,
2446
- onAddComment: K.onAddComment
2453
+ q.comments && /* @__PURE__ */ Z(Qt, {
2454
+ comments: q.comments,
2455
+ onAddComment: q.onAddComment
2447
2456
  }),
2448
- K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(rn, { activities: K.activities })
2457
+ q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: q.activities })
2449
2458
  ] }),
2450
- /* @__PURE__ */ Z(vn, {
2459
+ /* @__PURE__ */ Z(yn, {
2451
2460
  data: {
2452
2461
  ...g,
2453
2462
  ...D
2454
2463
  },
2455
2464
  objectSchema: N,
2456
- objectName: K.objectName
2465
+ objectName: q.objectName
2457
2466
  }),
2458
- K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2459
- schema: K.footer,
2467
+ q.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2468
+ schema: q.footer,
2460
2469
  data: g
2461
2470
  }) })
2462
2471
  ]
2463
2472
  }) });
2464
- }, Sn = (e) => {
2473
+ }, Cn = (e) => {
2465
2474
  if (e == null) return "—";
2466
2475
  if (typeof e == "string") return e.length > 0 ? e : "\"\"";
2467
2476
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -2470,7 +2479,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2470
2479
  } catch {
2471
2480
  return String(e);
2472
2481
  }
2473
- }, Cn = (e) => {
2482
+ }, wn = (e) => {
2474
2483
  if (typeof e != "string" || e.length === 0) return null;
2475
2484
  let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
2476
2485
  if (Number.isNaN(n.getTime())) return null;
@@ -2479,13 +2488,13 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2479
2488
  } catch {
2480
2489
  return n.toISOString();
2481
2490
  }
2482
- }, wn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
2483
- let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Sn(t.pendingValue) : "", u = t ? Sn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
2491
+ }, Tn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
2492
+ let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Cn(t.pendingValue) : "", u = t ? Cn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
2484
2493
  let e = [g.updated_by_name, g.updated_by_label];
2485
2494
  for (let t of e) if (typeof t == "string" && t.length > 0) return t;
2486
2495
  let t = g.updated_by;
2487
2496
  return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
2488
- })(), v = Cn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
2497
+ })(), v = wn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
2489
2498
  return /* @__PURE__ */ Z(c, {
2490
2499
  open: e,
2491
2500
  onOpenChange: (e) => {
@@ -2499,7 +2508,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2499
2508
  children: [/* @__PURE__ */ Z("span", {
2500
2509
  className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
2501
2510
  "aria-hidden": "true",
2502
- children: /* @__PURE__ */ Z(ce, { className: "h-5 w-5" })
2511
+ children: /* @__PURE__ */ Z(se, { className: "h-5 w-5" })
2503
2512
  }), /* @__PURE__ */ Q("div", {
2504
2513
  className: "flex-1",
2505
2514
  children: [/* @__PURE__ */ Z(h, { children: o("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(f, {
@@ -2578,14 +2587,14 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2578
2587
  })
2579
2588
  });
2580
2589
  };
2581
- function Tn(e) {
2590
+ function En(e) {
2582
2591
  if (!e || typeof e != "object") return !1;
2583
2592
  let t = e;
2584
2593
  return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
2585
2594
  }
2586
2595
  //#endregion
2587
2596
  //#region src/renderers/record-details.tsx
2588
- var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Dn = (e) => {
2597
+ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, On = (e) => {
2589
2598
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2590
2599
  return {
2591
2600
  designer: {
@@ -2595,8 +2604,80 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2595
2604
  },
2596
2605
  rest: i
2597
2606
  };
2598
- }, On = ({ schema: e = {}, className: t, ...n }) => {
2599
- let r = pt(), { designer: i } = Dn(n);
2607
+ }, kn = ({ schema: e = {}, className: t, ...n }) => {
2608
+ let r = mt(), { designer: i } = On(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), { sectionLabel: l } = _t(), u = dt(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
2609
+ let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
2610
+ for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
2611
+ }, [e.fields, e.sections]), g = a.useCallback(async (e, t) => {
2612
+ let n = r?.dataSource, i = r?.recordId, a = r?.objectName;
2613
+ if (!n || !i || !a) return;
2614
+ let o = typeof r?.data?.updated_at == "string" ? (r?.data).updated_at : void 0, s = o ? { ifMatch: o } : void 0;
2615
+ try {
2616
+ if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
2617
+ else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
2618
+ else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
2619
+ else {
2620
+ console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
2621
+ return;
2622
+ }
2623
+ typeof r?.refresh == "function" && await r.refresh();
2624
+ } catch (n) {
2625
+ if (En(n)) {
2626
+ let r = n.currentRecord ?? null;
2627
+ throw f({
2628
+ field: e,
2629
+ label: h(e),
2630
+ pendingValue: t,
2631
+ currentValue: r ? r[e] : void 0,
2632
+ currentVersion: n.currentVersion,
2633
+ currentRecord: r
2634
+ }), n;
2635
+ }
2636
+ throw console.error("[record:details] Inline-edit save failed", n), n;
2637
+ }
2638
+ }, [
2639
+ r?.dataSource,
2640
+ r?.recordId,
2641
+ r?.objectName,
2642
+ r?.data,
2643
+ r?.refresh,
2644
+ h
2645
+ ]), _ = a.useCallback(() => {
2646
+ f(null), m(!1);
2647
+ }, []), v = a.useCallback(async () => {
2648
+ m(!0);
2649
+ try {
2650
+ typeof r?.refresh == "function" && await r.refresh();
2651
+ } finally {
2652
+ _();
2653
+ }
2654
+ }, [r?.refresh, _]), y = a.useCallback(async () => {
2655
+ if (!d) {
2656
+ _();
2657
+ return;
2658
+ }
2659
+ let e = r?.dataSource, t = r?.recordId, n = r?.objectName;
2660
+ if (!e || !t || !n) {
2661
+ _();
2662
+ return;
2663
+ }
2664
+ m(!0);
2665
+ try {
2666
+ let i = d.currentVersion ? { ifMatch: d.currentVersion } : void 0;
2667
+ typeof e.update == "function" ? await e.update(n, t, { [d.field]: d.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [d.field]: d.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [d.field]: d.pendingValue }, i), typeof r?.refresh == "function" && await r.refresh();
2668
+ } catch (e) {
2669
+ console.error("[record:details] Overwrite-on-conflict failed", e);
2670
+ } finally {
2671
+ _();
2672
+ }
2673
+ }, [
2674
+ d,
2675
+ r?.dataSource,
2676
+ r?.recordId,
2677
+ r?.objectName,
2678
+ r?.refresh,
2679
+ _
2680
+ ]);
2600
2681
  if (!r) return /* @__PURE__ */ Z("div", {
2601
2682
  className: t,
2602
2683
  "data-record-details-placeholder": !0,
@@ -2606,8 +2687,8 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2606
2687
  children: "record:details — bind a record to preview"
2607
2688
  })
2608
2689
  });
2609
- let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = r.objectName || "", c = Ot(), { readableFields: l } = Dt(s), { sectionLabel: u } = gt(), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2610
- if (d.length > 0 && s && !d.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
2690
+ let b = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2691
+ if (b.length > 0 && o && !b.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2611
2692
  className: t,
2612
2693
  ...i,
2613
2694
  role: "status",
@@ -2617,20 +2698,20 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2617
2698
  children: "Insufficient permissions to view details."
2618
2699
  })
2619
2700
  });
2620
- let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = (e) => {
2621
- if (!e || !f && p.length === 0) return e;
2622
- let t = e.map(En).filter((e) => !!e), n = new Set((f && s ? l(t) : t).filter((e) => !p.includes(e)));
2701
+ let x = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", S = e.enforceFieldSecurity === !0, C = Array.isArray(e.redactFields) ? e.redactFields : [], w = (e) => {
2702
+ if (!e || !S && C.length === 0) return e;
2703
+ let t = e.map(Dn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
2623
2704
  return e.filter((e) => {
2624
- let t = En(e);
2705
+ let t = Dn(e);
2625
2706
  return t ? n.has(t) : !0;
2626
2707
  });
2627
- }, h = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
2708
+ }, T = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
2628
2709
  ...e,
2629
2710
  name: e.field
2630
- } : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ut(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : En(e)).filter((e) => !!e));
2631
- for (let e of _) v.add(e);
2632
- let y = r.objectSchema, b = r.data ?? {}, x = [
2633
- y?.primaryField,
2711
+ } : e, E = (e) => Array.isArray(e) ? e.map(T) : e, D = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Dn(e)).filter((e) => !!e));
2712
+ for (let e of u) D.add(e);
2713
+ let O = r.objectSchema, k = r.data ?? {}, A = [
2714
+ O?.primaryField,
2634
2715
  "name",
2635
2716
  "full_name",
2636
2717
  "title",
@@ -2638,125 +2719,53 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2638
2719
  "display_name",
2639
2720
  "label"
2640
2721
  ].filter((e) => typeof e == "string" && e.length > 0);
2641
- for (let e of x) if (b[e] !== void 0 && b[e] !== null && b[e] !== "") {
2642
- v.add(e);
2722
+ for (let e of A) if (k[e] !== void 0 && k[e] !== null && k[e] !== "") {
2723
+ D.add(e);
2643
2724
  break;
2644
2725
  }
2645
- let S = (e) => !e || v.size === 0 ? e : e.filter((e) => {
2646
- let t = En(e);
2647
- return t ? !v.has(t) : !0;
2648
- }), C = S(g(m(e.fields))), w = Array.isArray(e.sections) ? e.sections.map((e) => {
2649
- let t = e.title ?? e.label, n = e.name && s ? u(s, e.name, t ?? e.name) : t;
2726
+ let j = (e) => !e || D.size === 0 ? e : e.filter((e) => {
2727
+ let t = Dn(e);
2728
+ return t ? !D.has(t) : !0;
2729
+ }), M = j(E(w(e.fields))), N = Array.isArray(e.sections) ? e.sections.map((e) => {
2730
+ let t = e.title ?? e.label, n = e.name && o ? l(o, e.name, t ?? e.name) : t;
2650
2731
  return {
2651
2732
  ...e,
2652
2733
  title: n,
2653
2734
  showBorder: e.showBorder ?? !!n,
2654
2735
  hideEmpty: e.hideEmpty ?? !0,
2655
- fields: S(g(m(e.fields)))
2736
+ fields: j(E(w(e.fields)))
2656
2737
  };
2657
- }) : e.sections, T = e.inlineEdit ?? !0, [E, D] = a.useState(null), [O, k] = a.useState(!1), A = a.useCallback((t) => {
2658
- let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
2659
- for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
2660
- }, [e.fields, e.sections]), j = a.useCallback(async (e, t) => {
2661
- let n = r.dataSource, i = r.recordId, a = r.objectName;
2662
- if (!n || !i || !a) return;
2663
- let o = typeof r.data?.updated_at == "string" ? r.data.updated_at : void 0, s = o ? { ifMatch: o } : void 0;
2664
- try {
2665
- if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
2666
- else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
2667
- else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
2668
- else {
2669
- console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
2670
- return;
2671
- }
2672
- typeof r.refresh == "function" && await r.refresh();
2673
- } catch (n) {
2674
- if (Tn(n)) {
2675
- let r = n.currentRecord ?? null;
2676
- throw D({
2677
- field: e,
2678
- label: A(e),
2679
- pendingValue: t,
2680
- currentValue: r ? r[e] : void 0,
2681
- currentVersion: n.currentVersion,
2682
- currentRecord: r
2683
- }), n;
2684
- }
2685
- throw console.error("[record:details] Inline-edit save failed", n), n;
2686
- }
2687
- }, [
2688
- r.dataSource,
2689
- r.recordId,
2690
- r.objectName,
2691
- r.data,
2692
- r.refresh,
2693
- A
2694
- ]), M = a.useCallback(() => {
2695
- D(null), k(!1);
2696
- }, []), N = a.useCallback(async () => {
2697
- k(!0);
2698
- try {
2699
- typeof r.refresh == "function" && await r.refresh();
2700
- } finally {
2701
- M();
2702
- }
2703
- }, [r.refresh, M]), ee = a.useCallback(async () => {
2704
- if (!E) {
2705
- M();
2706
- return;
2707
- }
2708
- let e = r.dataSource, t = r.recordId, n = r.objectName;
2709
- if (!e || !t || !n) {
2710
- M();
2711
- return;
2712
- }
2713
- k(!0);
2714
- try {
2715
- let i = E.currentVersion ? { ifMatch: E.currentVersion } : void 0;
2716
- typeof e.update == "function" ? await e.update(n, t, { [E.field]: E.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [E.field]: E.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [E.field]: E.pendingValue }, i), typeof r.refresh == "function" && await r.refresh();
2717
- } catch (e) {
2718
- console.error("[record:details] Overwrite-on-conflict failed", e);
2719
- } finally {
2720
- M();
2721
- }
2722
- }, [
2723
- E,
2724
- r.dataSource,
2725
- r.recordId,
2726
- r.objectName,
2727
- r.refresh,
2728
- M
2729
- ]), te = {
2738
+ }) : e.sections, ee = e.inlineEdit ?? !0, te = {
2730
2739
  type: "detail-view",
2731
2740
  objectName: r.objectName,
2732
2741
  resourceId: r.recordId,
2733
2742
  data: r.data,
2734
- layout: o,
2743
+ layout: x,
2735
2744
  columns: e.columns,
2736
- sections: w,
2737
- fields: C,
2745
+ sections: N,
2746
+ fields: M,
2738
2747
  showBack: !1,
2739
2748
  showHeader: e.showHeader ?? !1,
2740
- inlineEdit: T
2749
+ inlineEdit: ee
2741
2750
  };
2742
2751
  return /* @__PURE__ */ Q("div", {
2743
2752
  className: t,
2744
2753
  ...i,
2745
- children: [/* @__PURE__ */ Z(xn, {
2754
+ children: [/* @__PURE__ */ Z(Sn, {
2746
2755
  schema: te,
2747
2756
  dataSource: r.dataSource,
2748
- inlineEdit: T,
2749
- onFieldSave: j
2750
- }), /* @__PURE__ */ Z(wn, {
2751
- open: !!E,
2752
- conflict: E,
2753
- busy: O,
2754
- onCancel: M,
2755
- onReload: N,
2756
- onOverwrite: ee
2757
+ inlineEdit: ee,
2758
+ onFieldSave: g
2759
+ }), /* @__PURE__ */ Z(Tn, {
2760
+ open: !!d,
2761
+ conflict: d,
2762
+ busy: p,
2763
+ onCancel: _,
2764
+ onReload: v,
2765
+ onOverwrite: y
2757
2766
  })]
2758
2767
  });
2759
- }, kn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, An = (e) => e?.id ?? e?._id ?? null, jn = (e) => {
2768
+ }, An = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, jn = (e) => e?.id ?? e?._id ?? null, Mn = (e) => {
2760
2769
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2761
2770
  return {
2762
2771
  designer: {
@@ -2766,11 +2775,11 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2766
2775
  },
2767
2776
  rest: i
2768
2777
  };
2769
- }, Mn = ({ schema: e = {}, className: t, ...n }) => {
2770
- let r = pt(), { designer: i } = jn(n), o = gt(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
2778
+ }, Nn = ({ schema: e = {}, className: t, ...n }) => {
2779
+ let r = mt(), { designer: i } = Mn(n), o = _t(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
2771
2780
  name: s,
2772
- label: wt(s)
2773
- }) : s ? wt(s) : "", l = e.title || c || "Related";
2781
+ label: Tt(s)
2782
+ }) : s ? Tt(s) : "", l = e.title || c || "Related";
2774
2783
  if (!s) return /* @__PURE__ */ Z("div", {
2775
2784
  className: t,
2776
2785
  ...i,
@@ -2779,7 +2788,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2779
2788
  children: "record:related_list — missing objectName"
2780
2789
  })
2781
2790
  });
2782
- let u = Ot(), { readableFields: d } = Dt(s), f = ht(), p = a.useMemo(() => f?.resolve({
2791
+ let u = kt(), { readableFields: d } = Ot(s), f = gt(), p = a.useMemo(() => f?.resolve({
2783
2792
  objectName: s,
2784
2793
  relationshipField: e.relationshipField,
2785
2794
  parentId: r?.recordId ?? null
@@ -2801,16 +2810,16 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2801
2810
  });
2802
2811
  let h = e.enforceFieldSecurity === !0, g = Array.isArray(e.redactFields) ? e.redactFields : [], _ = Array.isArray(e.columns) ? e.columns : [], v = _;
2803
2812
  if (h || g.length > 0) {
2804
- let e = _.map(kn).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
2813
+ let e = _.map(An).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
2805
2814
  v = _.filter((e) => {
2806
- let n = kn(e);
2815
+ let n = An(e);
2807
2816
  return n ? t.has(n) : !0;
2808
2817
  });
2809
2818
  }
2810
2819
  return /* @__PURE__ */ Z("div", {
2811
2820
  className: t,
2812
2821
  ...i,
2813
- children: /* @__PURE__ */ Z(qt, {
2822
+ children: /* @__PURE__ */ Z(Jt, {
2814
2823
  title: l,
2815
2824
  type: "table",
2816
2825
  api: s,
@@ -2825,15 +2834,15 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2825
2834
  onRowAction: p?.onRowAction,
2826
2835
  onNew: p?.onCreate,
2827
2836
  onRowClick: p?.onView ? (e) => {
2828
- let t = An(e);
2837
+ let t = jn(e);
2829
2838
  t != null && p.onView(t, e);
2830
2839
  } : void 0,
2831
2840
  onRowEdit: p?.onEdit ? (e) => {
2832
- let t = An(e);
2841
+ let t = jn(e);
2833
2842
  t != null && p.onEdit(t, e);
2834
2843
  } : void 0,
2835
2844
  onRowDelete: p?.onDelete ? (e) => {
2836
- let t = An(e);
2845
+ let t = jn(e);
2837
2846
  if (t != null) return p.onDelete(t, e);
2838
2847
  } : e.add && r?.dataSource ? async (e) => {
2839
2848
  let t = e?.id ?? e?._id;
@@ -2841,7 +2850,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2841
2850
  } : void 0
2842
2851
  })
2843
2852
  });
2844
- }, Nn = (e) => {
2853
+ }, Pn = (e) => {
2845
2854
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2846
2855
  return {
2847
2856
  designer: {
@@ -2851,8 +2860,8 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2851
2860
  },
2852
2861
  rest: i
2853
2862
  };
2854
- }, Pn = ({ schema: e = {}, className: t, ...n }) => {
2855
- let r = pt(), { designer: i } = Nn(n), o = r?.objectName || "", s = Ot(), { readableFields: c } = Dt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2863
+ }, Fn = ({ schema: e = {}, className: t, ...n }) => {
2864
+ let r = mt(), { designer: i } = Pn(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2856
2865
  if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2857
2866
  className: t,
2858
2867
  ...i,
@@ -2869,17 +2878,17 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2869
2878
  icon: e?.icon,
2870
2879
  type: e?.type
2871
2880
  }).filter((e) => typeof e.name == "string" && e.name.length > 0), d = e.enforceFieldSecurity === !0, f = Array.isArray(e.redactFields) ? e.redactFields : [], p = d && o ? new Set(c(u.map((e) => e.name))) : null, m = u.filter((e) => !(f.includes(e.name) || p && !p.has(e.name)));
2872
- return mt(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
2881
+ return ht(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
2873
2882
  className: t,
2874
2883
  ...i,
2875
- children: /* @__PURE__ */ Z(Yt, {
2884
+ children: /* @__PURE__ */ Z(Xt, {
2876
2885
  fields: m,
2877
2886
  data: r?.data,
2878
2887
  objectName: r?.objectName,
2879
2888
  objectSchema: r?.objectSchema
2880
2889
  })
2881
2890
  });
2882
- }, Fn = ({ change: e, className: t }) => {
2891
+ }, In = ({ change: e, className: t }) => {
2883
2892
  let n = e.fieldLabel ?? e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " "), r = e.oldDisplayValue ?? (e.oldValue == null ? "(empty)" : String(e.oldValue)), i = e.newDisplayValue ?? (e.newValue == null ? "(empty)" : String(e.newValue));
2884
2893
  return /* @__PURE__ */ Q("div", {
2885
2894
  className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
@@ -2892,21 +2901,21 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2892
2901
  className: "text-muted-foreground line-through",
2893
2902
  children: r
2894
2903
  }),
2895
- /* @__PURE__ */ Z(ue, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2904
+ /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2896
2905
  /* @__PURE__ */ Z("span", {
2897
2906
  className: "text-foreground",
2898
2907
  children: i
2899
2908
  })
2900
2909
  ]
2901
2910
  });
2902
- }, In = [
2911
+ }, Ln = [
2903
2912
  "👍",
2904
2913
  "❤️",
2905
2914
  "🎉",
2906
2915
  "😂",
2907
2916
  "😮",
2908
2917
  "😢"
2909
- ], Ln = ({ reactions: e, onToggleReaction: t, emojiOptions: n = In, className: r }) => {
2918
+ ], Rn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Ln, className: r }) => {
2910
2919
  let [a, o] = i.useState(!1), s = i.useCallback((e) => {
2911
2920
  t?.(e), o(!1);
2912
2921
  }, [t]);
@@ -2946,7 +2955,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2946
2955
  };
2947
2956
  //#endregion
2948
2957
  //#region src/ThreadedReplies.tsx
2949
- function Rn(e, t) {
2958
+ function zn(e, t) {
2950
2959
  try {
2951
2960
  let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
2952
2961
  if (i < 1) return t("detail.justNow");
@@ -2959,7 +2968,7 @@ function Rn(e, t) {
2959
2968
  return e;
2960
2969
  }
2961
2970
  }
2962
- var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
2971
+ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
2963
2972
  let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
2964
2973
  let t = l.trim();
2965
2974
  if (!(!t || !n)) {
@@ -3014,7 +3023,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3014
3023
  children: e.actor
3015
3024
  }), /* @__PURE__ */ Z("span", {
3016
3025
  className: "text-[10px] text-muted-foreground",
3017
- children: Rn(e.createdAt, o)
3026
+ children: zn(e.createdAt, o)
3018
3027
  })]
3019
3028
  }), /* @__PURE__ */ Z("p", {
3020
3029
  className: "text-xs whitespace-pre-wrap break-words",
@@ -3044,7 +3053,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3044
3053
  })
3045
3054
  ]
3046
3055
  });
3047
- }, Bn = ({ subscription: e, onToggle: t, className: n }) => {
3056
+ }, Vn = ({ subscription: e, onToggle: t, className: n }) => {
3048
3057
  let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
3049
3058
  if (t) {
3050
3059
  o(!0);
@@ -3068,11 +3077,11 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3068
3077
  };
3069
3078
  //#endregion
3070
3079
  //#region src/RichTextCommentInput.tsx
3071
- function Vn(e) {
3080
+ function Hn(e) {
3072
3081
  let t = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/```([\s\S]*?)```/g, "<pre class=\"bg-muted rounded p-2 text-xs font-mono my-1 overflow-x-auto\">$1</pre>").replace(/`([^`]+)`/g, "<code class=\"bg-muted rounded px-1 py-0.5 text-xs font-mono\">$1</code>").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/@(\w+)/g, "<span class=\"text-primary font-medium\">@$1</span>").replace(/^- (.+)$/gm, "<li class=\"ml-4 list-disc\">$1</li>").replace(/\n/g, "<br/>");
3073
3082
  return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
3074
3083
  }
3075
- var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
3084
+ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
3076
3085
  let { t: u } = $(), [d, f] = i.useState(!1), [p, m] = i.useState(!1), [h, g] = i.useState(""), [_, v] = i.useState(0), y = i.useRef(null), b = i.useMemo(() => {
3077
3086
  if (!h) return r;
3078
3087
  let e = h.toLowerCase();
@@ -3207,8 +3216,8 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3207
3216
  className: "relative",
3208
3217
  children: d ? /* @__PURE__ */ Z("div", {
3209
3218
  className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
3210
- dangerouslySetInnerHTML: { __html: Vn(e) }
3211
- }) : /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z("textarea", {
3219
+ dangerouslySetInnerHTML: { __html: Hn(e) }
3220
+ }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("textarea", {
3212
3221
  ref: y,
3213
3222
  className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
3214
3223
  placeholder: a ?? u("detail.writeComment"),
@@ -3244,16 +3253,16 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3244
3253
  };
3245
3254
  //#endregion
3246
3255
  //#region src/CommentAttachment.tsx
3247
- function Un(e) {
3256
+ function Wn(e) {
3248
3257
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
3249
3258
  }
3250
- function Wn(e) {
3259
+ function Gn(e) {
3251
3260
  return e.startsWith("image/");
3252
3261
  }
3253
- function Gn(e) {
3254
- return Wn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? je : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Ae : ke;
3262
+ function Kn(e) {
3263
+ return Gn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? je : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Ae : ke;
3255
3264
  }
3256
- var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
3265
+ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
3257
3266
  let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
3258
3267
  e.preventDefault(), e.stopPropagation(), c(!0);
3259
3268
  }, []), d = i.useCallback((e) => {
@@ -3298,7 +3307,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3298
3307
  }), /* @__PURE__ */ Z("div", {
3299
3308
  className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
3300
3309
  children: e.map((e) => {
3301
- let t = Wn(e.type), r = Gn(e.type);
3310
+ let t = Gn(e.type), r = Kn(e.type);
3302
3311
  return /* @__PURE__ */ Q("div", {
3303
3312
  className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
3304
3313
  children: [
@@ -3317,7 +3326,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3317
3326
  children: e.name
3318
3327
  }), /* @__PURE__ */ Z("p", {
3319
3328
  className: "text-[10px] text-muted-foreground",
3320
- children: Un(e.size)
3329
+ children: Wn(e.size)
3321
3330
  })]
3322
3331
  }),
3323
3332
  n && !a && /* @__PURE__ */ Z(x, {
@@ -3334,7 +3343,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3334
3343
  })]
3335
3344
  })]
3336
3345
  });
3337
- }, qn = {
3346
+ }, Jn = {
3338
3347
  comment: X,
3339
3348
  field_change: Ee,
3340
3349
  task: _e,
@@ -3342,7 +3351,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3342
3351
  system: rt,
3343
3352
  email: ze,
3344
3353
  call: We
3345
- }, Jn = {
3354
+ }, Yn = {
3346
3355
  comment: "bg-purple-100 text-purple-600",
3347
3356
  field_change: "bg-blue-100 text-blue-600",
3348
3357
  task: "bg-green-100 text-green-600",
@@ -3351,7 +3360,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3351
3360
  email: "bg-indigo-100 text-indigo-600",
3352
3361
  call: "bg-teal-100 text-teal-600"
3353
3362
  };
3354
- function Yn(e) {
3363
+ function Xn(e) {
3355
3364
  return [
3356
3365
  {
3357
3366
  value: "all",
@@ -3371,7 +3380,7 @@ function Yn(e) {
3371
3380
  }
3372
3381
  ];
3373
3382
  }
3374
- function Xn(e, t) {
3383
+ function Zn(e, t) {
3375
3384
  try {
3376
3385
  let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
3377
3386
  if (i < 1) return t("detail.justNow");
@@ -3384,7 +3393,7 @@ function Xn(e, t) {
3384
3393
  return e;
3385
3394
  }
3386
3395
  }
3387
- function Zn(e, t) {
3396
+ function Qn(e, t) {
3388
3397
  switch (t) {
3389
3398
  case "comments_only": return e.filter((e) => e.type === "comment");
3390
3399
  case "changes_only": return e.filter((e) => e.type === "field_change");
@@ -3392,8 +3401,8 @@ function Zn(e, t) {
3392
3401
  default: return e;
3393
3402
  }
3394
3403
  }
3395
- var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
3396
- let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [re, ie] = i.useState(!1), P = n ?? b, F = t?.showFilterToggle !== !1, I = t?.showCommentInput !== !1 && !!c, L = t?.enableReactions ?? !1, R = t?.enableThreading ?? !1, z = t?.showSubscriptionToggle ?? !1, B = i.useMemo(() => Zn(e, P), [e, P]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
3404
+ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
3405
+ let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [re, ie] = i.useState(!1), P = n ?? b, F = t?.showFilterToggle !== !1, I = t?.showCommentInput !== !1 && !!c, L = t?.enableReactions ?? !1, R = t?.enableThreading ?? !1, z = t?.showSubscriptionToggle ?? !1, B = i.useMemo(() => Qn(e, P), [e, P]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
3397
3406
  if (!R) return /* @__PURE__ */ new Map();
3398
3407
  let e = /* @__PURE__ */ new Map();
3399
3408
  for (let t of B) if (t.parentId) {
@@ -3429,7 +3438,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3429
3438
  }
3430
3439
  }, [h]), oe = i.useCallback((e) => {
3431
3440
  j((t) => t.filter((t) => t.id !== e));
3432
- }, []), ce = i.useCallback(async () => {
3441
+ }, []), se = i.useCallback(async () => {
3433
3442
  if (o) {
3434
3443
  O(!0);
3435
3444
  try {
@@ -3449,7 +3458,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3449
3458
  children: [/* @__PURE__ */ Q("h2", {
3450
3459
  className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
3451
3460
  children: [
3452
- /* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
3461
+ /* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
3453
3462
  g ?? y("detail.activity"),
3454
3463
  /* @__PURE__ */ Q("span", {
3455
3464
  className: "text-sm font-normal text-muted-foreground",
@@ -3462,7 +3471,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3462
3471
  ]
3463
3472
  }), /* @__PURE__ */ Z("div", {
3464
3473
  className: "flex items-center gap-1",
3465
- children: z && d && /* @__PURE__ */ Z(Bn, {
3474
+ children: z && d && /* @__PURE__ */ Z(Vn, {
3466
3475
  subscription: d,
3467
3476
  onToggle: f
3468
3477
  })
@@ -3480,13 +3489,13 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3480
3489
  "aria-label": y("detail.filterActivity"),
3481
3490
  className: "h-8 w-auto min-w-[140px] py-1 text-sm",
3482
3491
  children: /* @__PURE__ */ Z(ne, {})
3483
- }), /* @__PURE__ */ Z(N, { children: Yn(y).map((e) => /* @__PURE__ */ Z(ee, {
3492
+ }), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(ee, {
3484
3493
  value: e.value,
3485
3494
  children: e.label
3486
3495
  }, e.value)) })]
3487
3496
  })
3488
3497
  }),
3489
- I && /* @__PURE__ */ Z(Hn, {
3498
+ I && /* @__PURE__ */ Z(Un, {
3490
3499
  value: C,
3491
3500
  onChange: w,
3492
3501
  onSubmit: U,
@@ -3494,12 +3503,12 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3494
3503
  placeholder: y("detail.leaveCommentPlaceholder"),
3495
3504
  disabled: T,
3496
3505
  canSubmitEmpty: A.length > 0,
3497
- extraSlot: h ? /* @__PURE__ */ Z(Kn, {
3506
+ extraSlot: h ? /* @__PURE__ */ Z(qn, {
3498
3507
  attachments: A,
3499
3508
  onUpload: W,
3500
3509
  onRemove: oe,
3501
3510
  readOnly: T || re
3502
- }) : A.length > 0 ? /* @__PURE__ */ Z(Kn, {
3511
+ }) : A.length > 0 ? /* @__PURE__ */ Z(qn, {
3503
3512
  attachments: A,
3504
3513
  onRemove: oe,
3505
3514
  readOnly: T
@@ -3513,7 +3522,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3513
3522
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
3514
3523
  className: "space-y-4",
3515
3524
  children: V.map((e) => {
3516
- let t = qn[e.type] || rt, n = Jn[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
3525
+ let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
3517
3526
  return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
3518
3527
  className: "flex gap-3 relative",
3519
3528
  children: [/* @__PURE__ */ Z("div", {
@@ -3539,7 +3548,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3539
3548
  }),
3540
3549
  /* @__PURE__ */ Z("span", {
3541
3550
  className: "text-xs text-muted-foreground",
3542
- children: Xn(e.createdAt, y)
3551
+ children: Zn(e.createdAt, y)
3543
3552
  }),
3544
3553
  e.edited && /* @__PURE__ */ Z("span", {
3545
3554
  className: "text-xs text-muted-foreground italic",
@@ -3566,25 +3575,25 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3566
3575
  }),
3567
3576
  e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
3568
3577
  className: "space-y-1 mt-1",
3569
- children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Fn, { change: e }, t))
3578
+ children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(In, { change: e }, t))
3570
3579
  }),
3571
3580
  L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3572
3581
  className: "mt-1.5",
3573
- children: /* @__PURE__ */ Z(Ln, {
3582
+ children: /* @__PURE__ */ Z(Rn, {
3574
3583
  reactions: e.reactions,
3575
3584
  onToggleReaction: u ? (t) => u(e.id, t) : void 0
3576
3585
  })
3577
3586
  }),
3578
3587
  L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3579
3588
  className: "mt-1.5",
3580
- children: /* @__PURE__ */ Z(Ln, {
3589
+ children: /* @__PURE__ */ Z(Rn, {
3581
3590
  reactions: [],
3582
3591
  onToggleReaction: (t) => u(e.id, t)
3583
3592
  })
3584
3593
  })
3585
3594
  ]
3586
3595
  })]
3587
- }), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(zn, {
3596
+ }), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
3588
3597
  parentItem: e,
3589
3598
  replies: r,
3590
3599
  onAddReply: l,
@@ -3598,7 +3607,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3598
3607
  children: /* @__PURE__ */ Q(x, {
3599
3608
  variant: "ghost",
3600
3609
  size: "sm",
3601
- onClick: ce,
3610
+ onClick: se,
3602
3611
  disabled: D,
3603
3612
  "aria-label": y("detail.loadMore"),
3604
3613
  children: [D ? /* @__PURE__ */ Z(Le, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ve, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
@@ -3607,7 +3616,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3607
3616
  ]
3608
3617
  })]
3609
3618
  });
3610
- }, $n = (e) => {
3619
+ }, er = (e) => {
3611
3620
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3612
3621
  return {
3613
3622
  designer: {
@@ -3617,18 +3626,18 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3617
3626
  },
3618
3627
  rest: i
3619
3628
  };
3620
- }, er = ({ schema: e = {}, className: t, ...n }) => {
3621
- pt();
3622
- let { designer: r } = $n(n);
3629
+ }, tr = ({ schema: e = {}, className: t, ...n }) => {
3630
+ mt();
3631
+ let { designer: r } = er(n);
3623
3632
  return /* @__PURE__ */ Z("div", {
3624
3633
  className: t,
3625
3634
  ...r,
3626
- children: /* @__PURE__ */ Z(Qn, {
3635
+ children: /* @__PURE__ */ Z($n, {
3627
3636
  items: [],
3628
3637
  config: e
3629
3638
  })
3630
3639
  });
3631
- }, tr = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
3640
+ }, nr = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
3632
3641
  let _ = e?.position ?? "right", v = e?.width ?? "360px", y = e?.collapsible ?? !0, b = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: S } = $(), [C, w] = i.useState(b);
3633
3642
  return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
3634
3643
  className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
@@ -3664,7 +3673,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3664
3673
  })]
3665
3674
  }), /* @__PURE__ */ Z("div", {
3666
3675
  className: "flex-1 overflow-y-auto",
3667
- children: /* @__PURE__ */ Z(Qn, {
3676
+ children: /* @__PURE__ */ Z($n, {
3668
3677
  items: t,
3669
3678
  config: e?.feed,
3670
3679
  hasMore: n,
@@ -3706,7 +3715,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3706
3715
  "aria-label": S("detail.hideDiscussion"),
3707
3716
  children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
3708
3717
  })]
3709
- }), /* @__PURE__ */ Z(Qn, {
3718
+ }), /* @__PURE__ */ Z($n, {
3710
3719
  items: t,
3711
3720
  config: e?.feed,
3712
3721
  hasMore: n,
@@ -3726,7 +3735,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3726
3735
  emptyLabel: S("detail.noCommentsYet")
3727
3736
  })] })
3728
3737
  });
3729
- }, nr = (e) => {
3738
+ }, rr = (e) => {
3730
3739
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3731
3740
  return {
3732
3741
  designer: {
@@ -3736,9 +3745,9 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3736
3745
  },
3737
3746
  rest: i
3738
3747
  };
3739
- }, rr = ({ schema: e = {}, className: t, ...n }) => {
3740
- pt();
3741
- let r = lt(), { designer: i } = nr(n), a = {
3748
+ }, ir = ({ schema: e = {}, className: t, ...n }) => {
3749
+ mt();
3750
+ let r = ut(), { designer: i } = rr(n), a = {
3742
3751
  position: "bottom",
3743
3752
  collapsible: !1,
3744
3753
  feed: {
@@ -3751,7 +3760,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3751
3760
  return /* @__PURE__ */ Z("div", {
3752
3761
  className: t,
3753
3762
  ...i,
3754
- children: /* @__PURE__ */ Z(tr, {
3763
+ children: /* @__PURE__ */ Z(nr, {
3755
3764
  items: r?.items || [],
3756
3765
  config: a,
3757
3766
  onAddComment: r?.onAddComment,
@@ -3761,7 +3770,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3761
3770
  onUploadAttachments: r?.onUploadAttachments
3762
3771
  })
3763
3772
  });
3764
- }, ir = (e) => {
3773
+ }, ar = (e) => {
3765
3774
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3766
3775
  return {
3767
3776
  designer: {
@@ -3771,8 +3780,8 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3771
3780
  },
3772
3781
  rest: i
3773
3782
  };
3774
- }, ar = ({ schema: e = {}, className: t, ...n }) => {
3775
- let r = pt(), { translateOptions: i } = gt(), { designer: o } = ir(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
3783
+ }, or = ({ schema: e = {}, className: t, ...n }) => {
3784
+ let r = mt(), { translateOptions: i } = _t(), { designer: o } = ar(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
3776
3785
  if (s.length === 0 || !c || !r?.objectName) return s;
3777
3786
  let e = i(r.objectName, c, s);
3778
3787
  return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
@@ -3884,7 +3893,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3884
3893
  })
3885
3894
  })]
3886
3895
  });
3887
- }, or = (e) => {
3896
+ }, sr = (e) => {
3888
3897
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3889
3898
  return {
3890
3899
  designer: {
@@ -3894,8 +3903,8 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3894
3903
  },
3895
3904
  rest: i
3896
3905
  };
3897
- }, sr = ({ schema: e = {}, className: t, ...n }) => {
3898
- let r = pt(), { designer: i } = or(n), a = Ot(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = dt("object", u ? c : null), f = u ? (() => {
3906
+ }, cr = ({ schema: e = {}, className: t, ...n }) => {
3907
+ let r = mt(), { designer: i } = sr(n), a = kt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = ft("object", u ? c : null), f = u ? (() => {
3899
3908
  let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
3900
3909
  return l.map((e) => t.get(e)).filter((e) => !!e);
3901
3910
  })() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
@@ -3931,7 +3940,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3931
3940
  role: "toolbar",
3932
3941
  "aria-label": e.aria?.label || "Quick actions",
3933
3942
  ...i,
3934
- children: _.map((t, n) => /* @__PURE__ */ Z(cr, {
3943
+ children: _.map((t, n) => /* @__PURE__ */ Z(lr, {
3935
3944
  action: t,
3936
3945
  record: r?.data,
3937
3946
  variant: t.variant || e.variant || "default",
@@ -3943,7 +3952,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3943
3952
  }, t.name || `qa-${n}`))
3944
3953
  });
3945
3954
  };
3946
- function cr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3955
+ function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3947
3956
  let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = ot(e.disabled), d = ct(typeof u == "string" ? u : void 0, l);
3948
3957
  return /* @__PURE__ */ Q(x, {
3949
3958
  variant: n,
@@ -3962,7 +3971,7 @@ function cr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3962
3971
  }
3963
3972
  //#endregion
3964
3973
  //#region src/renderers/record-history.tsx
3965
- var lr = (e) => {
3974
+ var ur = (e) => {
3966
3975
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3967
3976
  return {
3968
3977
  designer: {
@@ -3972,14 +3981,14 @@ var lr = (e) => {
3972
3981
  },
3973
3982
  rest: i
3974
3983
  };
3975
- }, ur = /* @__PURE__ */ new Set([
3984
+ }, dr = /* @__PURE__ */ new Set([
3976
3985
  "created",
3977
3986
  "updated",
3978
3987
  "assigned",
3979
3988
  "shared",
3980
3989
  "deleted"
3981
- ]), dr = ({ schema: e = {}, className: t, ...n }) => {
3982
- let { designer: r } = lr(n), i = pt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
3990
+ ]), fr = ({ schema: e = {}, className: t, ...n }) => {
3991
+ let { designer: r } = ur(n), i = mt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
3983
3992
  a.useEffect(() => {
3984
3993
  if (!p) return;
3985
3994
  let e = !1;
@@ -3991,7 +4000,7 @@ var lr = (e) => {
3991
4000
  $orderby: { timestamp: "desc" },
3992
4001
  $top: Math.max(1, l)
3993
4002
  })).then((t) => {
3994
- e || h((t?.data ?? t?.records ?? []).filter((e) => ur.has(e?.type)).map((e) => {
4003
+ e || h((t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
3995
4004
  let t = e.timestamp;
3996
4005
  return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
3997
4006
  id: e.id,
@@ -4020,13 +4029,13 @@ var lr = (e) => {
4020
4029
  return /* @__PURE__ */ Z("div", {
4021
4030
  className: t,
4022
4031
  ...r,
4023
- children: /* @__PURE__ */ Z(dn, {
4032
+ children: /* @__PURE__ */ Z(fn, {
4024
4033
  entries: v,
4025
4034
  loading: y,
4026
4035
  emptyText: c
4027
4036
  })
4028
4037
  });
4029
- }, fr = (e) => {
4038
+ }, pr = (e) => {
4030
4039
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
4031
4040
  return {
4032
4041
  designer: {
@@ -4036,8 +4045,8 @@ var lr = (e) => {
4036
4045
  },
4037
4046
  rest: i
4038
4047
  };
4039
- }, pr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), mr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", hr = ({ schema: e = {}, className: t, ...n }) => {
4040
- let r = pt(), i = gt(), { t: o } = $(), { designer: s } = fr(n), c = Mt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
4048
+ }, mr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), hr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", gr = ({ schema: e = {}, className: t, ...n }) => {
4049
+ let r = mt(), i = _t(), { t: o } = $(), { designer: s } = pr(n), c = Nt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
4041
4050
  a.useEffect(() => (_.current = !0, () => {
4042
4051
  _.current = !1;
4043
4052
  }), []);
@@ -4117,8 +4126,8 @@ var lr = (e) => {
4117
4126
  return x && t && !t.loading && !t.error && t.total === 0;
4118
4127
  }).map((e) => e.objectName)), k = l.filter((e) => E || !O.has(e.objectName)), A = l.filter((e) => O.has(e.objectName)).map((e) => e.title || (i?.objectLabel ? i.objectLabel({
4119
4128
  name: e.objectName,
4120
- label: pr(e.objectName)
4121
- }) : pr(e.objectName)));
4129
+ label: mr(e.objectName)
4130
+ }) : mr(e.objectName)));
4122
4131
  return /* @__PURE__ */ Q("div", {
4123
4132
  ref: m,
4124
4133
  className: G("flex flex-col gap-3", e.className, t),
@@ -4137,15 +4146,15 @@ var lr = (e) => {
4137
4146
  className: "text-sm font-semibold tracking-tight truncate",
4138
4147
  children: e.title || (i?.objectLabel ? i.objectLabel({
4139
4148
  name: e.objectName,
4140
- label: pr(e.objectName)
4141
- }) : pr(e.objectName))
4149
+ label: mr(e.objectName)
4150
+ }) : mr(e.objectName))
4142
4151
  }), /* @__PURE__ */ Q("div", {
4143
4152
  className: "flex items-center gap-2 shrink-0",
4144
4153
  children: [!n.loading && /* @__PURE__ */ Z(b, {
4145
4154
  variant: "secondary",
4146
4155
  className: "tabular-nums",
4147
4156
  children: n.total
4148
- }), c && u && /* @__PURE__ */ Z(jt, {
4157
+ }), c && u && /* @__PURE__ */ Z(Mt, {
4149
4158
  to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
4150
4159
  className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
4151
4160
  title: o("detail.viewAll", { defaultValue: "View all" }),
@@ -4167,10 +4176,10 @@ var lr = (e) => {
4167
4176
  }) : /* @__PURE__ */ Z("ul", {
4168
4177
  className: "divide-y",
4169
4178
  children: n.items.map((t) => {
4170
- let n = t.id || t._id, r = mr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
4179
+ let n = t.id || t._id, r = hr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
4171
4180
  return /* @__PURE__ */ Z("li", {
4172
4181
  className: "px-4 py-2",
4173
- children: i ? /* @__PURE__ */ Q(jt, {
4182
+ children: i ? /* @__PURE__ */ Q(Mt, {
4174
4183
  to: i,
4175
4184
  className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
4176
4185
  children: [/* @__PURE__ */ Z("span", {
@@ -4204,7 +4213,7 @@ var lr = (e) => {
4204
4213
  })]
4205
4214
  })]
4206
4215
  });
4207
- }, gr = {
4216
+ }, _r = {
4208
4217
  info: {
4209
4218
  wrap: "border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300",
4210
4219
  icon: "Info"
@@ -4222,20 +4231,20 @@ var lr = (e) => {
4222
4231
  icon: "CheckCircle2"
4223
4232
  }
4224
4233
  };
4225
- function _r(e) {
4234
+ function vr(e) {
4226
4235
  let t = e?.properties ?? {};
4227
4236
  return {
4228
4237
  ...e,
4229
4238
  ...t
4230
4239
  };
4231
4240
  }
4232
- var vr = ({ schema: e = {}, className: t }) => {
4233
- let n = _r(e), r = pt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
4241
+ var yr = ({ schema: e = {}, className: t }) => {
4242
+ let n = vr(e), r = mt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
4234
4243
  "info",
4235
4244
  "warning",
4236
4245
  "error",
4237
4246
  "success"
4238
- ].includes(n.severity) ? n.severity : "info", d = gr[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
4247
+ ].includes(n.severity) ? n.severity : "info", d = _r[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
4239
4248
  if (!n.dismissible) return null;
4240
4249
  let e = n.dismissKey || n.title || u;
4241
4250
  return `os.record-alert:${c}:${l ?? "_"}:${e}`;
@@ -4253,7 +4262,7 @@ var vr = ({ schema: e = {}, className: t }) => {
4253
4262
  } catch {
4254
4263
  return !1;
4255
4264
  }
4256
- }), y = n.action?.actionName, { item: b } = dt("object", y && c ? c : null), S = i.useMemo(() => {
4265
+ }), y = n.action?.actionName, { item: b } = ft("object", y && c ? c : null), S = i.useMemo(() => {
4257
4266
  if (!(!y || !b?.actions)) return b.actions.find((e) => e.name === y);
4258
4267
  }, [y, b]), { executeAction: C } = st({
4259
4268
  actions: i.useMemo(() => S ? [S] : [], [S]),
@@ -4302,7 +4311,7 @@ var vr = ({ schema: e = {}, className: t }) => {
4302
4311
  }) : null
4303
4312
  ]
4304
4313
  });
4305
- }, yr = /* @__PURE__ */ new Set([
4314
+ }, br = /* @__PURE__ */ new Set([
4306
4315
  "id",
4307
4316
  "_id",
4308
4317
  "__v",
@@ -4317,15 +4326,15 @@ var vr = ({ schema: e = {}, className: t }) => {
4317
4326
  "owner_id",
4318
4327
  "deleted_at",
4319
4328
  "is_deleted"
4320
- ]), br = 480, xr = 95;
4321
- function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = yr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
4329
+ ]), xr = 480, Sr = 95;
4330
+ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = br, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
4322
4331
  let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
4323
4332
  if (typeof window > "u" || !m) return null;
4324
4333
  try {
4325
4334
  let e = window.localStorage.getItem(_);
4326
4335
  if (e) {
4327
4336
  let t = parseInt(e, 10);
4328
- if (Number.isFinite(t) && t >= br) return t;
4337
+ if (Number.isFinite(t) && t >= xr) return t;
4329
4338
  }
4330
4339
  } catch {}
4331
4340
  return null;
@@ -4347,7 +4356,7 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4347
4356
  let n = (e) => {
4348
4357
  let t = S.current;
4349
4358
  if (!t) return;
4350
- let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * xr / 100 : 1600, i = Math.min(r, Math.max(br, t.startWidth + n));
4359
+ let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * Sr / 100 : 1600, i = Math.min(r, Math.max(xr, t.startWidth + n));
4351
4360
  y(Math.round(i));
4352
4361
  }, r = () => {
4353
4362
  S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
@@ -4404,7 +4413,7 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4404
4413
  }),
4405
4414
  /* @__PURE__ */ Z("div", {
4406
4415
  className: "px-6 pt-6 pb-6",
4407
- children: /* @__PURE__ */ Z(xn, {
4416
+ children: /* @__PURE__ */ Z(Sn, {
4408
4417
  dataSource: s,
4409
4418
  inlineEdit: !0,
4410
4419
  schema: {
@@ -4447,14 +4456,14 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4447
4456
  })
4448
4457
  });
4449
4458
  }
4450
- function Cr(e, t) {
4459
+ function wr(e, t) {
4451
4460
  if (typeof window > "u") return null;
4452
4461
  let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
4453
4462
  return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
4454
4463
  }
4455
4464
  //#endregion
4456
4465
  //#region src/InlineCreateRelated.tsx
4457
- var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
4466
+ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
4458
4467
  let [l, u] = i.useState(!1), [d, f] = i.useState("create"), [p, m] = i.useState({}), [h, g] = i.useState(""), [_, v] = i.useState(s), [y, b] = i.useState(!1), [E, D] = i.useState(!1), O = i.useMemo(() => {
4459
4468
  if (!h.trim()) return _;
4460
4469
  let e = h.toLowerCase();
@@ -4627,7 +4636,7 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4627
4636
  };
4628
4637
  //#endregion
4629
4638
  //#region src/DiffView.tsx
4630
- function Tr(e, t) {
4639
+ function Er(e, t) {
4631
4640
  if (e == null) return ["(empty)"];
4632
4641
  switch (t) {
4633
4642
  case "json": try {
@@ -4646,7 +4655,7 @@ function Tr(e, t) {
4646
4655
  default: return String(e).split("\n");
4647
4656
  }
4648
4657
  }
4649
- function Er(e, t) {
4658
+ function Dr(e, t) {
4650
4659
  let n = [], r = Math.max(e.length, t.length);
4651
4660
  for (let i = 0; i < r; i++) {
4652
4661
  let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
@@ -4663,16 +4672,16 @@ function Er(e, t) {
4663
4672
  }
4664
4673
  return n;
4665
4674
  }
4666
- var Dr = {
4675
+ var Or = {
4667
4676
  added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
4668
4677
  removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
4669
4678
  unchanged: "text-muted-foreground"
4670
- }, Or = {
4679
+ }, kr = {
4671
4680
  added: "+",
4672
4681
  removed: "-",
4673
4682
  unchanged: " "
4674
- }, kr = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
4675
- let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Tr(e, r), [e, r]), d = i.useMemo(() => Tr(t, r), [t, r]), f = i.useMemo(() => Er(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
4683
+ }, Ar = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
4684
+ let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Er(e, r), [e, r]), d = i.useMemo(() => Er(t, r), [t, r]), f = i.useMemo(() => Dr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
4676
4685
  if (c !== "side-by-side") return [];
4677
4686
  let e = [], t = 0;
4678
4687
  for (; t < f.length;) {
@@ -4730,10 +4739,10 @@ var Dr = {
4730
4739
  children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
4731
4740
  className: "font-mono text-xs overflow-x-auto",
4732
4741
  children: f.map((e, t) => /* @__PURE__ */ Q("div", {
4733
- className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Dr[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
4742
+ className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Or[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
4734
4743
  children: [/* @__PURE__ */ Z("span", {
4735
4744
  className: "select-none mr-2 inline-block w-3 text-center opacity-60",
4736
- children: Or[e.type]
4745
+ children: kr[e.type]
4737
4746
  }), e.value]
4738
4747
  }, t))
4739
4748
  }) : /* @__PURE__ */ Z("div", {
@@ -4750,10 +4759,10 @@ var Dr = {
4750
4759
  children: s("detail.currentVersion")
4751
4760
  }),
4752
4761
  m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
4753
- className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Dr[e.left.type] : "bg-muted/20"),
4762
+ className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
4754
4763
  children: e.left?.value ?? ""
4755
4764
  }), /* @__PURE__ */ Z("div", {
4756
- className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Dr[e.right.type] : "bg-muted/20"),
4765
+ className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
4757
4766
  children: e.right?.value ?? ""
4758
4767
  })] }, t))
4759
4768
  ]
@@ -4764,7 +4773,7 @@ var Dr = {
4764
4773
  })
4765
4774
  })]
4766
4775
  });
4767
- }, Ar = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
4776
+ }, jr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
4768
4777
  let { t: s } = $(), [c, l] = i.useState(""), [u, d] = i.useState(!1), f = i.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, g = e < t - 1, _ = i.useCallback(() => {
4769
4778
  p && r(n[0]);
4770
4779
  }, [
@@ -4877,7 +4886,7 @@ var Dr = {
4877
4886
  title: s("detail.lastRecord"),
4878
4887
  children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
4879
4888
  }),
4880
- a && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(x, {
4889
+ a && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(x, {
4881
4890
  variant: u ? "secondary" : "ghost",
4882
4891
  size: "icon",
4883
4892
  className: "h-8 w-8",
@@ -4897,18 +4906,18 @@ var Dr = {
4897
4906
  })] })
4898
4907
  ]
4899
4908
  });
4900
- }, jr = 28, Mr = [
4909
+ }, Mr = 28, Nr = [
4901
4910
  "fill-primary stroke-primary",
4902
4911
  "fill-blue-500 stroke-blue-500",
4903
4912
  "fill-emerald-500 stroke-emerald-500",
4904
4913
  "fill-amber-500 stroke-amber-500"
4905
- ], Nr = [
4914
+ ], Pr = [
4906
4915
  "fill-primary-foreground",
4907
4916
  "fill-white",
4908
4917
  "fill-white",
4909
4918
  "fill-white"
4910
4919
  ];
4911
- function Pr(e, t, n, r, i) {
4920
+ function Fr(e, t, n, r, i) {
4912
4921
  let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
4913
4922
  a.push({
4914
4923
  id: e.id,
@@ -4972,10 +4981,10 @@ function Pr(e, t, n, r, i) {
4972
4981
  edges: o
4973
4982
  };
4974
4983
  }
4975
- function Fr(e, t = 6) {
4984
+ function Ir(e, t = 6) {
4976
4985
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
4977
4986
  }
4978
- var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
4987
+ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
4979
4988
  let o = i.useRef(null), [s, c] = i.useState({
4980
4989
  width: 500,
4981
4990
  height: 400
@@ -4996,7 +5005,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
4996
5005
  });
4997
5006
  return n.observe(t), () => n.disconnect();
4998
5007
  }, []);
4999
- let { nodes: d, edges: f } = i.useMemo(() => Pr(e, t, n, s.width, s.height), [
5008
+ let { nodes: d, edges: f } = i.useMemo(() => Fr(e, t, n, s.width, s.height), [
5000
5009
  e,
5001
5010
  t,
5002
5011
  n,
@@ -5038,7 +5047,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5038
5047
  strokeWidth: 1.5,
5039
5048
  strokeOpacity: .5
5040
5049
  }, `edge-${t}`)), d.map((e) => {
5041
- let t = l === e.id, n = Mr[Math.min(e.level, Mr.length - 1)], i = Nr[Math.min(e.level, Nr.length - 1)], a = e.level === 0 ? 34 : jr;
5050
+ let t = l === e.id, n = Nr[Math.min(e.level, Nr.length - 1)], i = Pr[Math.min(e.level, Pr.length - 1)], a = e.level === 0 ? 34 : Mr;
5042
5051
  return /* @__PURE__ */ Q("g", {
5043
5052
  className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
5044
5053
  onClick: () => r?.(e.id),
@@ -5060,7 +5069,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5060
5069
  textAnchor: "middle",
5061
5070
  dominantBaseline: "central",
5062
5071
  className: G("text-[10px] font-medium pointer-events-none", i),
5063
- children: Fr(e.label)
5072
+ children: Ir(e.label)
5064
5073
  }),
5065
5074
  e.type && /* @__PURE__ */ Z("text", {
5066
5075
  x: e.x,
@@ -5069,7 +5078,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5069
5078
  className: "fill-muted-foreground text-[9px] pointer-events-none",
5070
5079
  children: e.type
5071
5080
  }),
5072
- t && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z("rect", {
5081
+ t && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("rect", {
5073
5082
  x: e.x - 50,
5074
5083
  y: e.y - a - 28,
5075
5084
  width: 100,
@@ -5094,7 +5103,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5094
5103
  };
5095
5104
  //#endregion
5096
5105
  //#region src/PointInTimeRestore.tsx
5097
- function Lr(e) {
5106
+ function Rr(e) {
5098
5107
  try {
5099
5108
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
5100
5109
  if (r < 1) return "just now";
@@ -5105,7 +5114,7 @@ function Lr(e) {
5105
5114
  return e;
5106
5115
  }
5107
5116
  }
5108
- var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5117
+ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5109
5118
  let [a, o] = i.useState(null), [s, c] = i.useState(!1), [l, u] = i.useState(!1), d = i.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = i.useCallback(async () => {
5110
5119
  if (!(!d || !n)) {
5111
5120
  if (!s) {
@@ -5177,7 +5186,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5177
5186
  children: e.user
5178
5187
  }), /* @__PURE__ */ Z("span", {
5179
5188
  className: "text-xs text-muted-foreground",
5180
- children: Lr(e.timestamp)
5189
+ children: Rr(e.timestamp)
5181
5190
  })]
5182
5191
  }), /* @__PURE__ */ Q("p", {
5183
5192
  className: "text-xs text-muted-foreground mt-0.5",
@@ -5245,12 +5254,12 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5245
5254
  }),
5246
5255
  n && /* @__PURE__ */ Z("div", {
5247
5256
  className: "pt-1 space-y-2",
5248
- children: s ? /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Q("p", {
5257
+ children: s ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("p", {
5249
5258
  className: "text-xs text-amber-600 dark:text-amber-400",
5250
5259
  children: [
5251
5260
  "This will restore the record to its state at",
5252
5261
  " ",
5253
- Lr(d.timestamp),
5262
+ Rr(d.timestamp),
5254
5263
  ". Continue?"
5255
5264
  ]
5256
5265
  }), /* @__PURE__ */ Q("div", {
@@ -5281,7 +5290,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5281
5290
  })]
5282
5291
  }) })]
5283
5292
  });
5284
- }, zr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
5293
+ }, Br = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
5285
5294
  let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
5286
5295
  let t = a.trim();
5287
5296
  if (t) {
@@ -5314,7 +5323,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5314
5323
  children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
5315
5324
  })]
5316
5325
  });
5317
- }, Br = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
5326
+ }, Vr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
5318
5327
  let s = i.useMemo(() => {
5319
5328
  if (!e) return t;
5320
5329
  let n = e.toLowerCase();
@@ -5356,7 +5365,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5356
5365
  }, e.id))
5357
5366
  });
5358
5367
  };
5359
- function Vr(e, t, n) {
5368
+ function Hr(e, t, n) {
5360
5369
  return {
5361
5370
  type: e.type,
5362
5371
  id: e.id,
@@ -5367,7 +5376,7 @@ function Vr(e, t, n) {
5367
5376
  }
5368
5377
  //#endregion
5369
5378
  //#region src/extractMentions.ts
5370
- function Hr(e, t) {
5379
+ function Ur(e, t) {
5371
5380
  if (!e || !t.length) return [];
5372
5381
  let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
5373
5382
  for (let e of n) {
@@ -5379,10 +5388,10 @@ function Hr(e, t) {
5379
5388
  }
5380
5389
  //#endregion
5381
5390
  //#region src/synth/buildDefaultPageSchema.ts
5382
- function Ur(e) {
5391
+ function Wr(e) {
5383
5392
  return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
5384
5393
  }
5385
- function Wr(e) {
5394
+ function Gr(e) {
5386
5395
  if (!e) return null;
5387
5396
  let t = e.stageField;
5388
5397
  if (t === !1) return null;
@@ -5400,7 +5409,7 @@ function Wr(e) {
5400
5409
  }
5401
5410
  return null;
5402
5411
  }
5403
- function Gr(e, t) {
5412
+ function Kr(e, t) {
5404
5413
  if (!e || !t) return null;
5405
5414
  let n = e.fields?.[t]?.options;
5406
5415
  return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
@@ -5408,7 +5417,7 @@ function Gr(e, t) {
5408
5417
  label: e.label
5409
5418
  }));
5410
5419
  }
5411
- function Kr(e, t, n = 4) {
5420
+ function qr(e, t, n = 4) {
5412
5421
  if (!e) return [];
5413
5422
  let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
5414
5423
  if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
@@ -5483,22 +5492,22 @@ function Kr(e, t, n = 4) {
5483
5492
  }
5484
5493
  return s;
5485
5494
  }
5486
- function qr(e, t = {}) {
5495
+ function Jr(e, t = {}) {
5487
5496
  return {
5488
5497
  type: "page:header",
5489
5498
  recordChrome: t.recordChrome !== !1,
5490
5499
  ...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
5491
5500
  };
5492
5501
  }
5493
- function Jr(e, t) {
5502
+ function Yr(e, t) {
5494
5503
  return !Array.isArray(t) || t.length === 0 ? null : {
5495
5504
  type: "record:quick_actions",
5496
5505
  actions: t,
5497
5506
  location: "record_header"
5498
5507
  };
5499
5508
  }
5500
- function Yr(e, t = {}) {
5501
- let n = t.statusField ?? Wr(e), r = t.stages ?? (n ? Gr(e, n) : null), i = t.highlightFields ?? Kr(e, n), a = [];
5509
+ function Xr(e, t = {}) {
5510
+ let n = t.statusField ?? Gr(e), r = t.stages ?? (n ? Kr(e, n) : null), i = t.highlightFields ?? qr(e, n), a = [];
5502
5511
  return !t.hideHighlights && i.length > 0 && a.push({
5503
5512
  type: "record:highlights",
5504
5513
  fields: i
@@ -5508,9 +5517,9 @@ function Yr(e, t = {}) {
5508
5517
  stages: r
5509
5518
  }), a;
5510
5519
  }
5511
- function Xr(e) {
5520
+ function Zr(e) {
5512
5521
  if (!e) return null;
5513
- let t = Nt(e);
5522
+ let t = Pt(e);
5514
5523
  if (!t) return null;
5515
5524
  let n = e.fields || {}, r = (e) => {
5516
5525
  let t = n[e] || {};
@@ -5534,20 +5543,21 @@ function Xr(e) {
5534
5543
  fields: e.fields.map(r)
5535
5544
  }));
5536
5545
  }
5537
- function Zr(e, t) {
5538
- return Array.isArray(t) && t.length > 0 ? t : Xr(e) ?? void 0;
5546
+ function Qr(e, t) {
5547
+ return Array.isArray(t) && t.length > 0 ? t : Zr(e) ?? void 0;
5539
5548
  }
5540
- function Qr(e, t, n) {
5549
+ function $r(e, t, n) {
5541
5550
  return {
5542
5551
  type: "record:details",
5543
- sections: Zr(e, t),
5552
+ sections: Qr(e, t),
5544
5553
  ...n && n.length > 0 ? { hideFields: n } : {}
5545
5554
  };
5546
5555
  }
5547
- function $r(e, t = {}) {
5548
- let n = t.statusField ?? Wr(e), r = t.highlightFields ?? Kr(e, n), i = [{
5556
+ function ei(e, t = {}) {
5557
+ let n = t.statusField ?? Gr(e), r = t.highlightFields ?? qr(e, n), i = [{
5549
5558
  label: "Details",
5550
- children: [Qr(e, t.sections, r)]
5559
+ value: "details",
5560
+ children: [$r(e, t.sections, r)]
5551
5561
  }];
5552
5562
  if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
5553
5563
  let e = (e) => ({
@@ -5560,12 +5570,14 @@ function $r(e, t = {}) {
5560
5570
  ...e.icon ? { icon: e.icon } : {}
5561
5571
  }), n = (t) => ({
5562
5572
  label: t.title || t.objectName,
5573
+ value: `related:${t.objectName}`,
5563
5574
  ...t.icon ? { icon: t.icon } : {},
5564
5575
  children: [e(t)]
5565
5576
  });
5566
5577
  if (t.relatedLayout === "tabs") for (let e of t.related) i.push(n(e));
5567
5578
  else if (t.relatedLayout === "stack") i.push({
5568
5579
  label: "Related",
5580
+ value: "related",
5569
5581
  children: t.related.map(e)
5570
5582
  });
5571
5583
  else {
@@ -5573,15 +5585,18 @@ function $r(e, t = {}) {
5573
5585
  for (let e of r) i.push(n(e));
5574
5586
  a.length > 0 && i.push({
5575
5587
  label: "Related",
5588
+ value: "related",
5576
5589
  children: a.map(e)
5577
5590
  });
5578
5591
  }
5579
5592
  }
5580
5593
  return t.showActivity && i.push({
5581
5594
  label: "Activity",
5595
+ value: "activity",
5582
5596
  children: [{ type: "record:activity" }]
5583
5597
  }), t.history && i.push({
5584
5598
  label: "History",
5599
+ value: "history",
5585
5600
  children: [{
5586
5601
  type: "record:history",
5587
5602
  entries: t.history.entries,
@@ -5593,15 +5608,15 @@ function $r(e, t = {}) {
5593
5608
  items: i
5594
5609
  };
5595
5610
  }
5596
- function ei() {
5611
+ function ti() {
5597
5612
  return { type: "record:discussion" };
5598
5613
  }
5599
- function ti(e, t = {}) {
5614
+ function ni(e, t = {}) {
5600
5615
  let n = t.slots || {}, r = [];
5601
- "header" in n && n.header !== void 0 ? r.push(...Ur(n.header)) : r.push(qr(e, {
5616
+ "header" in n && n.header !== void 0 ? r.push(...Wr(n.header)) : r.push(Jr(e, {
5602
5617
  recordChrome: t.recordChrome,
5603
5618
  actions: t.headerActions
5604
- })), "actions" in n && n.actions !== void 0 && r.push(...Ur(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Ur(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Ur(n.highlights)) : r.push(...Yr(e, {
5619
+ })), "actions" in n && n.actions !== void 0 && r.push(...Wr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Wr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Wr(n.highlights)) : r.push(...Xr(e, {
5605
5620
  highlightFields: t.highlightFields,
5606
5621
  statusField: t.statusField,
5607
5622
  stages: t.stages,
@@ -5609,9 +5624,9 @@ function ti(e, t = {}) {
5609
5624
  hidePath: t.hidePath
5610
5625
  }));
5611
5626
  let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
5612
- if ("tabs" in n && n.tabs !== void 0) r.push(...Ur(n.tabs));
5627
+ if ("tabs" in n && n.tabs !== void 0) r.push(...Wr(n.tabs));
5613
5628
  else if ("details" in n && n.details !== void 0) {
5614
- let i = Ur(n.details), o = $r(e, {
5629
+ let i = Wr(n.details), o = ei(e, {
5615
5630
  sections: t.sections,
5616
5631
  related: t.related,
5617
5632
  showActivity: t.showActivity,
@@ -5625,7 +5640,7 @@ function ti(e, t = {}) {
5625
5640
  ...o.items[0],
5626
5641
  children: i
5627
5642
  }), r.push(o);
5628
- } else r.push($r(e, {
5643
+ } else r.push(ei(e, {
5629
5644
  sections: t.sections,
5630
5645
  related: t.related,
5631
5646
  showActivity: t.showActivity,
@@ -5635,12 +5650,12 @@ function ti(e, t = {}) {
5635
5650
  hideRelatedTab: a,
5636
5651
  relatedLayout: t.relatedLayout
5637
5652
  }));
5638
- "discussion" in n && n.discussion !== void 0 ? r.push(...Ur(n.discussion)) : t.hideDiscussion || r.push(ei());
5653
+ "discussion" in n && n.discussion !== void 0 ? r.push(...Wr(n.discussion)) : t.hideDiscussion || r.push(ti());
5639
5654
  let o = [{
5640
5655
  name: "main",
5641
5656
  width: "full",
5642
5657
  components: r
5643
- }], s = Ur(n.rightRail);
5658
+ }], s = Wr(n.rightRail);
5644
5659
  if (i || s.length > 0) {
5645
5660
  let e = [];
5646
5661
  i && e.push({
@@ -5668,7 +5683,7 @@ function ti(e, t = {}) {
5668
5683
  regions: o
5669
5684
  };
5670
5685
  }
5671
- e.register("detail-view", xn, {
5686
+ e.register("detail-view", Sn, {
5672
5687
  namespace: "plugin-detail",
5673
5688
  label: "Detail View",
5674
5689
  category: "Views",
@@ -5798,7 +5813,7 @@ e.register("detail-view", xn, {
5798
5813
  tabs: [],
5799
5814
  related: []
5800
5815
  }
5801
- }), e.register("detail-section", Wt, {
5816
+ }), e.register("detail-section", Gt, {
5802
5817
  namespace: "plugin-detail",
5803
5818
  label: "Detail Section",
5804
5819
  category: "Detail Components",
@@ -5849,7 +5864,7 @@ e.register("detail-view", xn, {
5849
5864
  label: "Header Color"
5850
5865
  }
5851
5866
  ]
5852
- }), e.register("related-list", qt, {
5867
+ }), e.register("related-list", Jt, {
5853
5868
  namespace: "plugin-detail",
5854
5869
  label: "Related List",
5855
5870
  category: "Detail Components",
@@ -5896,7 +5911,7 @@ e.register("detail-view", xn, {
5896
5911
  label: "Columns"
5897
5912
  }
5898
5913
  ]
5899
- }), e.register("detail", xn, {
5914
+ }), e.register("detail", Sn, {
5900
5915
  namespace: "view",
5901
5916
  category: "view",
5902
5917
  label: "Detail",
@@ -5919,7 +5934,7 @@ e.register("detail-view", xn, {
5919
5934
  label: "Fields"
5920
5935
  }
5921
5936
  ]
5922
- }), e.register("record:details", On, {
5937
+ }), e.register("record:details", kn, {
5923
5938
  namespace: "record",
5924
5939
  category: "record",
5925
5940
  label: "Record Details",
@@ -5959,7 +5974,7 @@ e.register("detail-view", xn, {
5959
5974
  description: "Explicit field list (overrides highlightFields)"
5960
5975
  }
5961
5976
  ]
5962
- }), e.register("record:related_list", Mn, {
5977
+ }), e.register("record:related_list", Nn, {
5963
5978
  namespace: "record",
5964
5979
  category: "record",
5965
5980
  label: "Related List",
@@ -6022,7 +6037,7 @@ e.register("detail-view", xn, {
6022
6037
  description: "Action IDs available for related records"
6023
6038
  }
6024
6039
  ]
6025
- }), e.register("record:highlights", Pn, {
6040
+ }), e.register("record:highlights", Fn, {
6026
6041
  namespace: "record",
6027
6042
  category: "record",
6028
6043
  label: "Highlights Panel",
@@ -6041,22 +6056,22 @@ e.register("detail-view", xn, {
6041
6056
  defaultValue: "horizontal",
6042
6057
  description: "Layout orientation for highlight fields"
6043
6058
  }]
6044
- }), e.register("record:activity", er, {
6059
+ }), e.register("record:activity", tr, {
6045
6060
  namespace: "record",
6046
6061
  category: "record",
6047
6062
  label: "Activity Timeline",
6048
6063
  icon: "Activity"
6049
- }), e.register("record:chatter", rr, {
6064
+ }), e.register("record:chatter", ir, {
6050
6065
  namespace: "record",
6051
6066
  category: "record",
6052
6067
  label: "Chatter Feed",
6053
6068
  icon: "MessageSquare"
6054
- }), e.register("record:discussion", rr, {
6069
+ }), e.register("record:discussion", ir, {
6055
6070
  namespace: "record",
6056
6071
  category: "record",
6057
6072
  label: "Discussion",
6058
6073
  icon: "MessageSquare"
6059
- }), e.register("record:path", ar, {
6074
+ }), e.register("record:path", or, {
6060
6075
  namespace: "record",
6061
6076
  category: "record",
6062
6077
  label: "Path / Stepper",
@@ -6073,26 +6088,26 @@ e.register("detail-view", xn, {
6073
6088
  label: "Stages",
6074
6089
  description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
6075
6090
  }]
6076
- }), e.register("record:quick_actions", sr, {
6091
+ }), e.register("record:quick_actions", cr, {
6077
6092
  namespace: "record",
6078
6093
  category: "record",
6079
6094
  label: "Quick Actions",
6080
6095
  icon: "Zap"
6081
- }), e.register("record:history", dr, {
6096
+ }), e.register("record:history", fr, {
6082
6097
  namespace: "record",
6083
6098
  category: "record",
6084
6099
  label: "History Timeline",
6085
6100
  icon: "Clock"
6086
- }), e.register("record:reference_rail", hr, {
6101
+ }), e.register("record:reference_rail", gr, {
6087
6102
  namespace: "record",
6088
6103
  category: "record",
6089
6104
  label: "Reference Rail",
6090
6105
  icon: "PanelRight"
6091
- }), e.register("record:alert", vr, {
6106
+ }), e.register("record:alert", yr, {
6092
6107
  namespace: "record",
6093
6108
  category: "record",
6094
6109
  label: "Alert Banner",
6095
6110
  icon: "AlertTriangle"
6096
6111
  });
6097
6112
  //#endregion
6098
- export { rn as ActivityTimeline, Kn as CommentAttachment, zr as CommentInput, wn as ConcurrentUpdateDialog, Bt as DETAIL_DEFAULT_TRANSLATIONS, Wt as DetailSection, Gt as DetailTabs, xn as DetailView, kr as DiffView, Fn as FieldChangeItem, Yt as HeaderHighlight, dn as HistoryTimeline, wr as InlineCreateRelated, Br as MentionAutocomplete, Rr as PointInTimeRestore, Ln as ReactionPicker, er as RecordActivityRenderer, Qn as RecordActivityTimeline, vr as RecordAlertRenderer, tr as RecordChatterPanel, rr as RecordChatterRenderer, Zt as RecordComments, Sr as RecordDetailDrawer, On as RecordDetailsRenderer, Pn as RecordHighlightsRenderer, dr as RecordHistoryRenderer, vn as RecordMetaFooter, Ar as RecordNavigationEnhanced, ar as RecordPathRenderer, sr as RecordQuickActionsRenderer, hr as RecordReferenceRailRenderer, Mn as RecordRelatedListRenderer, qt as RelatedList, Ir as RelationshipGraph, Hn as RichTextCommentInput, Jt as SectionGroup, Bn as SubscriptionToggle, zn as ThreadedReplies, Lt as applyAutoSpan, Rt as applyDetailAutoLayout, Jr as buildDefaultActions, Qr as buildDefaultDetails, ei as buildDefaultDiscussion, qr as buildDefaultHeader, Yr as buildDefaultHighlights, ti as buildDefaultPageSchema, $r as buildDefaultTabs, Vr as createMentionFromSuggestion, zt as createSafeTranslationHook, Xr as deriveFieldGroupDetailSections, Kr as deriveHighlightFields, Cr as deriveRecordPageHref, Gr as deriveStages, Wr as detectStatusField, Hr as extractMentions, It as inferDetailColumns, Tn as isConcurrentUpdateError, Ft as isWideFieldType, Zr as resolveDetailSections, $ as useDetailTranslation };
6113
+ export { an as ActivityTimeline, qn as CommentAttachment, Br as CommentInput, Tn as ConcurrentUpdateDialog, Vt as DETAIL_DEFAULT_TRANSLATIONS, Gt as DetailSection, Kt as DetailTabs, Sn as DetailView, Ar as DiffView, In as FieldChangeItem, Xt as HeaderHighlight, fn as HistoryTimeline, Tr as InlineCreateRelated, Vr as MentionAutocomplete, zr as PointInTimeRestore, Rn as ReactionPicker, tr as RecordActivityRenderer, $n as RecordActivityTimeline, yr as RecordAlertRenderer, nr as RecordChatterPanel, ir as RecordChatterRenderer, Qt as RecordComments, Cr as RecordDetailDrawer, kn as RecordDetailsRenderer, Fn as RecordHighlightsRenderer, fr as RecordHistoryRenderer, yn as RecordMetaFooter, jr as RecordNavigationEnhanced, or as RecordPathRenderer, cr as RecordQuickActionsRenderer, gr as RecordReferenceRailRenderer, Nn as RecordRelatedListRenderer, Jt as RelatedList, Lr as RelationshipGraph, Un as RichTextCommentInput, Yt as SectionGroup, Vn as SubscriptionToggle, Bn as ThreadedReplies, Rt as applyAutoSpan, zt as applyDetailAutoLayout, Yr as buildDefaultActions, $r as buildDefaultDetails, ti as buildDefaultDiscussion, Jr as buildDefaultHeader, Xr as buildDefaultHighlights, ni as buildDefaultPageSchema, ei as buildDefaultTabs, Hr as createMentionFromSuggestion, Bt as createSafeTranslationHook, Zr as deriveFieldGroupDetailSections, qr as deriveHighlightFields, wr as deriveRecordPageHref, Kr as deriveStages, Gr as detectStatusField, Ur as extractMentions, Lt as inferDetailColumns, En as isConcurrentUpdateError, It as isWideFieldType, Qr as resolveDetailSections, $ as useDetailTranslation };