@object-ui/plugin-detail 11.5.0 → 13.1.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
@@ -1,8 +1,8 @@
1
1
  import { ComponentRegistry as e, buildExpandFields as t, formatTitleTemplate as n, getRecordDisplayName as r } from "@object-ui/core";
2
2
  import * as i from "react";
3
3
  import a from "react";
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 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";
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 P, SelectTrigger as ee, SelectValue as te, Sheet as ne, SheetContent as re, SheetHeader as ie, SheetTitle as ae, Skeleton as F, Tabs as I, TabsContent as L, TabsList as R, TabsTrigger as z, Tooltip as B, TooltipContent as V, TooltipProvider as oe, TooltipTrigger as H, buttonVariants as U, cn as W, useIsMobile as se } from "@object-ui/components";
5
+ import { Activity as G, AlertTriangle as ce, ArrowLeft as le, ArrowRight as ue, ArrowRightLeft as de, ArrowUpDown as fe, AtSign as K, Bell as pe, BellOff as q, 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 J, EyeOff as Oe, File as ke, FileArchive as Y, FileText as Ae, History as je, Image as Me, Inbox as X, Italic as Ne, Link as Pe, List as Fe, Loader2 as Ie, Lock as Le, Mail as Re, MessageSquare as ze, 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
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
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
8
  import { Fragment as Dt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
@@ -28,7 +28,7 @@ function It(e) {
28
28
  }
29
29
  function Lt(e, t) {
30
30
  let n;
31
- return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
31
+ return n = e <= 3 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
32
32
  }
33
33
  function Rt(e, t) {
34
34
  return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && It(e.type) ? {
@@ -197,7 +197,7 @@ var Vt = {
197
197
  //#endregion
198
198
  //#region src/DetailSection.tsx
199
199
  function Ht(e, t) {
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" : "";
200
+ return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : t === 3 ? e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "" : e === 2 ? "md:col-span-2" : e === 3 ? "md:col-span-2 lg:col-span-3" : e >= 4 ? "md:col-span-2 lg:col-span-3 xl:col-span-4" : "";
201
201
  }
202
202
  var Ut = /* @__PURE__ */ new Set([
203
203
  "formula",
@@ -223,9 +223,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
223
223
  }, []), A = i.useCallback((e) => {
224
224
  let n = t?.[e.name] ?? e.value;
225
225
  return n == null || n === "";
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
- if (re.length === 0 && j === e.fields.length) return null;
228
- let { fields: ie, columns: P } = zt(re, e.columns), F = (e) => {
226
+ }, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = se(), N = M ? 3 : 4, P = M ? .2 : .25, ee = e.fields.length - j, te = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= P && ee > 0, ne = !g && (e.hideEmpty || te) ? e.fields.filter((e) => !A(e)) : e.fields, { fields: re, columns: ie } = zt(ne, e.columns), ae = Math.min(ie, Math.max(1, ne.length)), F = (e) => {
229
227
  let n = t?.[e.name] ?? e.value;
230
228
  if (e.render) return /* @__PURE__ */ Z(at, {
231
229
  schema: e.render,
@@ -234,7 +232,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
234
232
  value: n
235
233
  }
236
234
  });
237
- let i = Ht(e.span, P), l = r?.fields?.[e.name], u = { ...e };
235
+ let i = Ht(e.span, ae), l = r?.fields?.[e.name], u = { ...e };
238
236
  if (l) {
239
237
  !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
238
  let t = l.reference_to || l.reference;
@@ -259,7 +257,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
259
257
  return String(n);
260
258
  })(), p = n != null && n !== "", m = f === e.name, h = y(a || "", e.name, e.label || e.name);
261
259
  return M && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
262
- className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
260
+ className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
263
261
  onClick: p ? () => k(e.name, n) : void 0,
264
262
  onKeyDown: p ? (t) => {
265
263
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
@@ -274,7 +272,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
274
272
  children: d
275
273
  })]
276
274
  }, e.name) : /* @__PURE__ */ Q("div", {
277
- className: G("space-y-1.5 group", i),
275
+ className: W("space-y-1.5 group min-w-0", i),
278
276
  children: [/* @__PURE__ */ Z("div", {
279
277
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
280
278
  children: y(a || "", e.name, e.label || e.name)
@@ -319,7 +317,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
319
317
  });
320
318
  })()
321
319
  }) : /* @__PURE__ */ Q("div", {
322
- className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
320
+ className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
323
321
  onClick: p ? () => k(e.name, n) : void 0,
324
322
  onKeyDown: p ? (t) => {
325
323
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
@@ -327,9 +325,9 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
327
325
  role: p ? "button" : void 0,
328
326
  tabIndex: p ? 0 : void 0,
329
327
  children: [/* @__PURE__ */ Z("div", {
330
- className: "text-sm flex-1 break-words py-1",
328
+ className: "text-sm flex-1 min-w-0 break-words py-1",
331
329
  children: d
332
- }), p && /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
330
+ }), p && /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
333
331
  asChild: !0,
334
332
  children: /* @__PURE__ */ Z(x, {
335
333
  variant: "ghost",
@@ -340,16 +338,16 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
340
338
  },
341
339
  children: m ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
342
340
  })
343
- }), /* @__PURE__ */ Z(H, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
341
+ }), /* @__PURE__ */ Z(V, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
344
342
  })]
345
343
  }, e.name);
346
344
  }, I = l?.enabled === !0, L = l?.batchSize ?? 20;
347
- i.useEffect(() => {
345
+ if (i.useEffect(() => {
348
346
  if (!I) {
349
347
  h(void 0);
350
348
  return;
351
349
  }
352
- if (ie.length <= L) {
350
+ if (re.length <= L) {
353
351
  h(void 0);
354
352
  return;
355
353
  }
@@ -358,14 +356,14 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
358
356
  return () => clearTimeout(e);
359
357
  }, [
360
358
  I,
361
- ie.length,
359
+ re.length,
362
360
  L
363
- ]);
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", {
361
+ ]), ne.length === 0 && j === e.fields.length) return null;
362
+ let R = m === void 0 ? re : re.slice(0, m), z = j > 0 && (e.hideEmpty || te), U = /* @__PURE__ */ Q(Dt, { children: [M ? /* @__PURE__ */ Z("div", {
365
363
  className: "flex flex-col divide-y divide-border/60",
366
364
  children: R.map(F)
367
365
  }) : /* @__PURE__ */ Z("div", {
368
- className: G("grid gap-3 sm:gap-4", P === 1 ? "grid-cols-1" : P === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
366
+ className: W("grid gap-3 sm:gap-4", ae === 1 ? "grid-cols-1" : ae === 2 ? "grid-cols-1 md:grid-cols-2" : ae === 3 ? "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),
369
367
  children: R.map(F)
370
368
  }), z && /* @__PURE__ */ Z("div", {
371
369
  className: "mt-3 -ml-2",
@@ -375,15 +373,15 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
375
373
  size: "sm",
376
374
  onClick: () => _((e) => !e),
377
375
  className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
378
- children: [Z(g ? J : Oe, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
376
+ children: [Z(g ? Oe : J, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
379
377
  count: j,
380
378
  defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
381
379
  })]
382
380
  })
383
381
  })] });
384
382
  return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
385
- className: G(n),
386
- children: B
383
+ className: W(n),
384
+ children: U
387
385
  }) : e.collapsible ? /* @__PURE__ */ Z(E, {
388
386
  open: !u,
389
387
  onOpenChange: (e) => d(!e),
@@ -391,7 +389,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
391
389
  children: /* @__PURE__ */ Q(S, { children: [/* @__PURE__ */ Z(O, {
392
390
  asChild: !0,
393
391
  children: /* @__PURE__ */ Q(w, {
394
- className: G("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
392
+ className: W("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
395
393
  children: [/* @__PURE__ */ Q(T, {
396
394
  className: "flex items-center justify-between text-base font-semibold tracking-tight",
397
395
  children: [/* @__PURE__ */ Q("div", {
@@ -411,12 +409,12 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
411
409
  })
412
410
  }), /* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(C, {
413
411
  className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
414
- children: B
412
+ children: U
415
413
  }) })] })
416
414
  }) : /* @__PURE__ */ Q(S, {
417
- className: G(e.showBorder === !1 ? "border-none shadow-none" : "", n),
415
+ className: W(e.showBorder === !1 ? "border-none shadow-none" : "", n),
418
416
  children: [e.title && /* @__PURE__ */ Q(w, {
419
- className: G("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
417
+ className: W("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
420
418
  children: [/* @__PURE__ */ Z(T, {
421
419
  className: "flex items-center justify-between text-base font-semibold tracking-tight",
422
420
  children: /* @__PURE__ */ Q("div", {
@@ -432,18 +430,18 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
432
430
  })]
433
431
  }), /* @__PURE__ */ Z(C, {
434
432
  className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
435
- children: B
433
+ children: U
436
434
  })]
437
435
  });
438
436
  }, Kt = ({ tabs: e, data: t, className: n }) => {
439
437
  let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
440
- return /* @__PURE__ */ Q(L, {
438
+ return /* @__PURE__ */ Q(I, {
441
439
  value: r,
442
440
  onValueChange: a,
443
441
  className: n,
444
- children: [/* @__PURE__ */ Z(z, {
442
+ children: [/* @__PURE__ */ Z(R, {
445
443
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
446
- children: o.map((e) => /* @__PURE__ */ Z(B, {
444
+ children: o.map((e) => /* @__PURE__ */ Z(z, {
447
445
  value: e.key,
448
446
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
449
447
  children: /* @__PURE__ */ Q("div", {
@@ -459,7 +457,7 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
459
457
  ]
460
458
  })
461
459
  }, e.key))
462
- }), o.map((e) => /* @__PURE__ */ Z(R, {
460
+ }), o.map((e) => /* @__PURE__ */ Z(L, {
463
461
  value: e.key,
464
462
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
465
463
  children: /* @__PURE__ */ Z(i.Suspense, {
@@ -481,33 +479,35 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
481
479
  //#endregion
482
480
  //#region src/RelatedList.tsx
483
481
  function qt(e) {
484
- return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Ne;
482
+ return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
485
483
  }
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();
484
+ 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, toolbarActions: M, onToolbarAction: N, add: P, maxColumns: ee = 6, pageSize: te, sortable: ne = !1, filterable: re = !1, collapsible: ie = !1, defaultCollapsed: ae = !1, referenceField: F, parentId: I, icon: L }) => {
485
+ let R = r !== void 0, z = r ?? [], [B, V] = i.useState(z), [oe, H] = i.useState(() => !!n && !R), [U, G] = i.useState(0), [ce, le] = i.useState(null), [ue, de] = i.useState("asc"), [K, pe] = i.useState(""), [q, me] = i.useState(null), [he, ge] = i.useState(ae), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(!1), [we, Te] = i.useState(null), [Ee, J] = i.useState(0), [Oe, ke] = i.useState({}), { t: Y } = $(), { fieldLabel: Ae } = _t();
488
486
  i.useEffect(() => {
489
- L && B(r ?? []);
490
- }, [r, L]), i.useEffect(() => {
491
- n && g?.getObjectSchema && g.getObjectSchema(n).then(fe).catch((e) => {
487
+ R && V(r ?? []);
488
+ }, [r, R]), i.useEffect(() => {
489
+ n && g?.getObjectSchema && g.getObjectSchema(n).then(me).catch((e) => {
492
490
  console.warn(`[RelatedList] Failed to fetch schema for ${n}:`, e);
493
491
  });
494
492
  }, [n, g]), i.useEffect(() => {
495
- if (n && !L) {
496
- if (!(P && F != null && F !== "")) {
497
- n && (F == null || F === "") && !P && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), B([]), H(!1);
493
+ if (n && !R) {
494
+ if (!(F && I != null && I !== "")) {
495
+ n && (I == null || I === "") && !F && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), H(!1);
498
496
  return;
499
497
  }
500
498
  H(!0);
501
- let e = { [P]: F };
499
+ let e = { [F]: I };
502
500
  if (g && typeof g.find == "function") g.find(n, { $filter: e }).then((e) => {
503
- B(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), H(!1);
501
+ let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [];
502
+ V(t), H(!1);
504
503
  }).catch((e) => {
505
504
  console.error("Failed to fetch related data:", e), H(!1);
506
505
  });
507
506
  else {
508
- let e = new URLSearchParams({ [`filter[${P}]`]: String(F) }).toString();
507
+ let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
509
508
  fetch(`${n}?${e}`).then((e) => e.json()).then((e) => {
510
- B(Array.isArray(e) ? e : e?.data || []);
509
+ let t = Array.isArray(e) ? e : e?.data || [];
510
+ V(t);
511
511
  }).catch((e) => {
512
512
  console.error("Failed to fetch related data:", e);
513
513
  }).finally(() => H(!1));
@@ -515,31 +515,31 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
515
515
  }
516
516
  }, [
517
517
  n,
518
- L,
518
+ R,
519
519
  g,
520
- P,
521
520
  F,
522
- we
521
+ I,
522
+ Ee
523
523
  ]), i.useEffect(() => {
524
- if (!n || L) return;
524
+ if (!n || R) return;
525
525
  let e = (e) => {
526
526
  let t = e.detail || {};
527
- t.objectName && t.objectName !== n || Te((e) => e + 1);
527
+ t.objectName && t.objectName !== n || J((e) => e + 1);
528
528
  };
529
529
  return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
530
- }, [n, L]), i.useEffect(() => {
531
- if (!g?.find || !q?.fields || !z.length) return;
530
+ }, [n, R]), i.useEffect(() => {
531
+ if (!g?.find || !q?.fields || !B.length) return;
532
532
  let e = q.fields, t = [];
533
533
  for (let [n, r] of Object.entries(e)) {
534
534
  if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
535
535
  let e = r.reference_to || r.reference;
536
536
  if (!e) continue;
537
537
  let i = /* @__PURE__ */ new Set();
538
- for (let e of z) {
538
+ for (let e of B) {
539
539
  let t = e?.[n];
540
540
  t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
541
541
  }
542
- let a = Ee[n] || {}, o = Array.from(i).filter((e) => !(e in a));
542
+ let a = Oe[n] || {}, o = Array.from(i).filter((e) => !(e in a));
543
543
  o.length > 0 && t.push({
544
544
  fieldName: n,
545
545
  target: e,
@@ -565,7 +565,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
565
565
  fieldName: e,
566
566
  map: {}
567
567
  })))).then((e) => {
568
- n || Oe((t) => {
568
+ n || ke((t) => {
569
569
  let n = { ...t };
570
570
  for (let { fieldName: t, map: r } of e) n[t] = {
571
571
  ...n[t] || {},
@@ -579,74 +579,74 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
579
579
  }, [
580
580
  g,
581
581
  q,
582
- z
582
+ B
583
583
  ]);
584
- let Ae = i.useMemo(() => {
585
- if (!le) return z;
586
- let e = le.toLowerCase();
587
- return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
588
- }, [z, le]), je = i.useMemo(() => W ? [...Ae].sort((e, t) => {
589
- let n = e[W], r = t[W];
584
+ let je = i.useMemo(() => {
585
+ if (!K) return B;
586
+ let e = K.toLowerCase();
587
+ return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
588
+ }, [B, K]), Me = i.useMemo(() => ce ? [...je].sort((e, t) => {
589
+ let n = e[ce], r = t[ce];
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 se === "asc" ? i : -i;
595
- }) : Ae, [
596
- Ae,
597
- W,
598
- se
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;
594
+ return ue === "asc" ? i : -i;
595
+ }) : je, [
596
+ je,
597
+ ce,
598
+ ue
599
+ ]), X = te && te > 0 ? te : 0, Ne = X ? Math.max(1, Math.ceil(Me.length / X)) : 1, Pe = X ? Me.slice(U * X, (U + 1) * X) : Me;
600
600
  i.useEffect(() => {
601
- U(0);
601
+ G(0);
602
602
  }, [
603
- le,
604
- W,
605
- se
603
+ K,
604
+ ce,
605
+ ue
606
606
  ]);
607
- let Pe = i.useCallback((e) => {
608
- W === e ? ce((e) => e === "asc" ? "desc" : "asc") : (K(e), ce("asc"));
609
- }, [W]), [Fe, Ie] = i.useState(null), Le = i.useCallback((e) => {
610
- Ie(e);
611
- }, []), Re = i.useCallback(async () => {
612
- if (Fe) try {
613
- await D?.(Fe), Te((e) => e + 1);
607
+ let Fe = i.useCallback((e) => {
608
+ ce === e ? de((e) => e === "asc" ? "desc" : "asc") : (le(e), de("asc"));
609
+ }, [ce]), [Ie, Le] = i.useState(null), Re = i.useCallback((e) => {
610
+ Le(e);
611
+ }, []), ze = i.useCallback(async () => {
612
+ if (Ie) try {
613
+ await D?.(Ie), J((e) => e + 1);
614
614
  } catch (e) {
615
615
  console.error("[RelatedList] remove failed", e);
616
616
  }
617
- Ie(null);
618
- }, [Fe, D]), ze = i.useCallback(async (e) => {
619
- if (!M || !g || !n || P == null || F == null) return;
620
- let t = M.picker.valueField || "id";
621
- xe(!0), Ce(null);
617
+ Le(null);
618
+ }, [Ie, D]), Be = i.useCallback(async (e) => {
619
+ if (!P || !g || !n || F == null || I == null) return;
620
+ let t = P.picker.valueField || "id";
621
+ Ce(!0), Te(null);
622
622
  try {
623
623
  for (let r of e || []) {
624
624
  let e = r?.[t] ?? r?.id;
625
- e != null && (M.linkField ? await g.create?.(n, {
626
- [P]: F,
627
- [M.linkField]: e
628
- }) : await g.update?.(M.picker.object, String(e), { [P]: F }));
625
+ e != null && (P.linkField ? await g.create?.(n, {
626
+ [F]: I,
627
+ [P.linkField]: e
628
+ }) : await g.update?.(P.picker.object, String(e), { [F]: I }));
629
629
  }
630
- Te((e) => e + 1);
630
+ J((e) => e + 1);
631
631
  } catch (e) {
632
632
  let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
633
- Ce(typeof t == "string" ? t : "Failed to add");
633
+ Te(typeof t == "string" ? t : "Failed to add");
634
634
  } finally {
635
- xe(!1), ge(!1);
635
+ Ce(!1), xe(!1);
636
636
  }
637
637
  }, [
638
- M,
638
+ P,
639
639
  g,
640
640
  n,
641
- P,
642
- F
643
- ]), X = kt(), Be = i.useMemo(() => {
644
- let e = _ || n || "", t = (t) => !X?.isLoaded || !e ? t : t.filter((t) => {
641
+ F,
642
+ I
643
+ ]), Ve = kt(), He = i.useMemo(() => {
644
+ let e = _ || n || "", t = (t) => !Ve?.isLoaded || !e ? t : t.filter((t) => {
645
645
  let n = t?.accessorKey || t?.field || t?.name;
646
- return n ? X.checkField(e, String(n), "read") : !0;
647
- }), r = (e) => P ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== P) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => z.length ? e.filter((e) => {
646
+ return n ? Ve.checkField(e, String(n), "read") : !0;
647
+ }), r = (e) => F ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== F) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => B.length ? e.filter((e) => {
648
648
  let t = e?.accessorKey || e?.field || e?.name;
649
- return t ? z.some((e) => !a(e?.[t])) : !0;
649
+ return t ? B.some((e) => !a(e?.[t])) : !0;
650
650
  }) : e, c = (e, t) => {
651
651
  if (!t?.type) return;
652
652
  let n = wt(Et({
@@ -654,7 +654,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
654
654
  format: t.format
655
655
  }) || t.type);
656
656
  if (!n) return;
657
- let r = t.type === "lookup" || t.type === "master_detail" ? Ee[e] : void 0, a = r && Object.keys(r).length > 0 ? Object.entries(r).map(([e, t]) => ({
657
+ let r = t.type === "lookup" || t.type === "master_detail" ? Oe[e] : void 0, a = r && Object.keys(r).length > 0 ? Object.entries(r).map(([e, t]) => ({
658
658
  value: e,
659
659
  label: t
660
660
  })) : void 0, o = {
@@ -687,7 +687,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
687
687
  }
688
688
  let n = q?.fields?.[t], r = {
689
689
  accessorKey: t,
690
- header: n?.label || ke(e, t, n) || t,
690
+ header: n?.label || Ae(e, t, n) || t,
691
691
  fieldDef: n,
692
692
  fieldType: n?.type
693
693
  }, i = n ? c(t, n) : void 0;
@@ -698,7 +698,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
698
698
  let u = Array.isArray(q.highlightFields) ? q.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
699
699
  if (u.length > 0) {
700
700
  let e = s(t(r(u.map(l))));
701
- if (e.length > 0) return e.slice(0, Math.max(1, N));
701
+ if (e.length > 0) return e.slice(0, Math.max(1, ee));
702
702
  }
703
703
  let d = e, f = /* @__PURE__ */ new Set([
704
704
  "image",
@@ -716,7 +716,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
716
716
  "label",
717
717
  "code",
718
718
  "number"
719
- ], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === P || t?.hidden || t?.type && f.has(t.type) || X?.isLoaded && d && !X.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
719
+ ], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && f.has(t.type) || Ve?.isLoaded && d && !Ve.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
720
720
  "created_at",
721
721
  "updated_at",
722
722
  "created_by",
@@ -734,32 +734,32 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
734
734
  }), s(m.map(([e, t]) => {
735
735
  let n = {
736
736
  accessorKey: e,
737
- header: ke(d, e, t.label || e)
737
+ header: Ae(d, e, t.label || e)
738
738
  };
739
739
  if (t.type) {
740
740
  let r = c(e, t);
741
741
  r && (n.cell = r);
742
742
  }
743
743
  return n;
744
- })).slice(0, Math.max(1, N));
744
+ })).slice(0, Math.max(1, ee));
745
745
  }, [
746
746
  o,
747
747
  q,
748
748
  _,
749
749
  n,
750
- ke,
751
- P,
752
- z,
753
- N,
754
- Ee,
755
- X
756
- ]), Ve = Array.isArray(k) && k.length > 0, He = !!E || !!D || Ve, Ue = oe(), We = i.useMemo(() => {
750
+ Ae,
751
+ F,
752
+ B,
753
+ ee,
754
+ Oe,
755
+ Ve
756
+ ]), Ue = Array.isArray(k) && k.length > 0, We = !!E || !!D || Ue, Ge = se(), qe = i.useMemo(() => {
757
757
  if (a) return a;
758
- if (Ue && (t === "grid" || t === "table")) {
759
- let e = Be[0]?.accessorKey || Be[0]?.field || Be[0]?.name, t = Be.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
758
+ if (Ge && (t === "grid" || t === "table")) {
759
+ let e = He[0]?.accessorKey || He[0]?.field || He[0]?.name, t = He.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
760
760
  return {
761
761
  type: "object-gallery",
762
- data: Ne,
762
+ data: Pe,
763
763
  objectName: n,
764
764
  gallery: {
765
765
  titleField: e || "name",
@@ -773,22 +773,22 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
773
773
  case "grid":
774
774
  case "table": return {
775
775
  type: "data-table",
776
- data: Ne,
777
- columns: Be,
776
+ data: Pe,
777
+ columns: He,
778
778
  pagination: !1,
779
- pageSize: Y || 10,
779
+ pageSize: X || 10,
780
780
  searchable: !1,
781
781
  exportable: !1,
782
- rowActions: He,
782
+ rowActions: We,
783
783
  onRowEdit: E,
784
- onRowDelete: D ? Le : void 0,
784
+ onRowDelete: D ? Re : void 0,
785
785
  onRowClick: O,
786
- rowActionDefs: Ve ? k : void 0,
787
- onRowActionDef: Ve ? j : void 0
786
+ rowActionDefs: Ue ? k : void 0,
787
+ onRowActionDef: Ue ? j : void 0
788
788
  };
789
789
  case "list": return {
790
790
  type: "data-list",
791
- data: Ne
791
+ data: Pe
792
792
  };
793
793
  default: return {
794
794
  type: "div",
@@ -797,139 +797,154 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
797
797
  }
798
798
  }, [
799
799
  t,
800
- Ne,
801
- Be,
802
- a,
803
- Y,
800
+ Pe,
804
801
  He,
805
- Ve,
802
+ a,
803
+ X,
804
+ We,
805
+ Ue,
806
806
  k,
807
807
  j,
808
808
  E,
809
809
  D,
810
- Le,
810
+ Re,
811
811
  O,
812
- Ue,
812
+ Ge,
813
813
  n
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;
814
+ ]), Je = ie ? "cursor-pointer select-none" : void 0, Ye = ie ? () => ge((e) => !e) : void 0, Xe = qt(L), Ze = !oe && B.length === 0, Qe = re;
815
815
  return /* @__PURE__ */ Q(S, {
816
- className: G("shadow-none border-border/60 bg-transparent", Ye && "bg-muted/10", s),
816
+ className: W("shadow-none border-border/60 bg-transparent", Ze && "bg-muted/10", s),
817
817
  children: [
818
818
  /* @__PURE__ */ Z(w, {
819
- className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Ge),
820
- onClick: qe,
819
+ className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Je),
820
+ onClick: Ye,
821
821
  children: /* @__PURE__ */ Q(T, {
822
822
  className: "flex items-center justify-between gap-2 text-sm font-semibold",
823
823
  children: [/* @__PURE__ */ Q("div", {
824
824
  className: "flex items-center gap-2 min-w-0",
825
825
  children: [
826
- re && Z(pe ? be : ve, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
827
- /* @__PURE__ */ Z(Je, {
826
+ ie && Z(he ? be : ve, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
827
+ /* @__PURE__ */ Z(Xe, {
828
828
  className: "h-4 w-4 text-muted-foreground shrink-0",
829
829
  "aria-hidden": !0
830
830
  }),
831
831
  /* @__PURE__ */ Z("span", {
832
- className: G("truncate", Ye && "text-muted-foreground font-medium"),
832
+ className: W("truncate", Ze && "text-muted-foreground font-medium"),
833
833
  children: e
834
834
  }),
835
835
  /* @__PURE__ */ Z(b, {
836
836
  variant: "secondary",
837
- className: G("text-xs font-normal h-5 px-1.5", z.length === 0 && "bg-muted text-muted-foreground"),
838
- "aria-label": `${z.length} records`,
839
- children: z.length
837
+ className: W("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
838
+ "aria-label": `${B.length} records`,
839
+ children: B.length
840
840
  }),
841
- Ye && /* @__PURE__ */ Z("span", {
841
+ Ze && /* @__PURE__ */ Z("span", {
842
842
  className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
843
- children: J("detail.noRelatedRecords")
843
+ children: Y("detail.noRelatedRecords")
844
844
  })
845
845
  ]
846
846
  }), /* @__PURE__ */ Q("div", {
847
847
  className: "flex items-center gap-1 shrink-0",
848
- children: [M && /* @__PURE__ */ Q(x, {
849
- variant: Ye ? "ghost" : "outline",
850
- size: "sm",
851
- disabled: _e,
852
- onClick: (e) => {
853
- e.stopPropagation(), Ce(null), ge(!0);
854
- },
855
- className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
856
- children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), M.label || J("detail.add", { defaultValue: "Add" })]
857
- }), v && /* @__PURE__ */ Q(x, {
858
- variant: Ye ? "ghost" : "outline",
859
- size: "sm",
860
- onClick: (e) => {
861
- e.stopPropagation(), v();
862
- },
863
- className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
864
- children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), J("detail.new")]
865
- })]
848
+ children: [
849
+ N && (M ?? []).map((e) => {
850
+ let t = e.icon ? qt(e.icon) : null;
851
+ return /* @__PURE__ */ Q(x, {
852
+ variant: e.variant === "primary" ? "default" : "outline",
853
+ size: "sm",
854
+ onClick: (t) => {
855
+ t.stopPropagation(), N(e);
856
+ },
857
+ className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
858
+ children: [t && /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" }), e.label || e.name]
859
+ }, e.name);
860
+ }),
861
+ P && /* @__PURE__ */ Q(x, {
862
+ variant: Ze ? "ghost" : "outline",
863
+ size: "sm",
864
+ disabled: Se,
865
+ onClick: (e) => {
866
+ e.stopPropagation(), Te(null), xe(!0);
867
+ },
868
+ className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
869
+ children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), P.label || Y("detail.add", { defaultValue: "Add" })]
870
+ }),
871
+ v && /* @__PURE__ */ Q(x, {
872
+ variant: Ze ? "ghost" : "outline",
873
+ size: "sm",
874
+ onClick: (e) => {
875
+ e.stopPropagation(), v();
876
+ },
877
+ className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
878
+ children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), Y("detail.new")]
879
+ })
880
+ ]
866
881
  })]
867
882
  })
868
883
  }),
869
- !pe && !Ye && /* @__PURE__ */ Q(C, {
870
- className: G("pt-0 pb-4 px-4"),
884
+ !he && !Ze && /* @__PURE__ */ Q(C, {
885
+ className: W("pt-0 pb-4 px-4"),
871
886
  children: [
872
- Xe && /* @__PURE__ */ Z("div", {
887
+ Qe && /* @__PURE__ */ Z("div", {
873
888
  className: "mb-3",
874
889
  children: /* @__PURE__ */ Z(A, {
875
- placeholder: J("detail.filterPlaceholder"),
876
- value: le,
877
- onChange: (e) => ue(e.target.value),
890
+ placeholder: Y("detail.filterPlaceholder"),
891
+ value: K,
892
+ onChange: (e) => pe(e.target.value),
878
893
  className: "h-8 text-sm"
879
894
  })
880
895
  }),
881
- te && Be && Be.length > 0 && z.length > 0 && /* @__PURE__ */ Z("div", {
896
+ ne && He && He.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
882
897
  className: "flex flex-wrap gap-1 mb-3",
883
- children: Be.map((e) => {
898
+ children: He.map((e) => {
884
899
  let t = e.accessorKey || e.field || e.name;
885
900
  if (!t) return null;
886
- let n = e.header || e.label || t, r = W === t;
901
+ let n = e.header || e.label || t, r = ce === t;
887
902
  return /* @__PURE__ */ Q(x, {
888
903
  variant: r ? "secondary" : "ghost",
889
904
  size: "sm",
890
905
  className: "gap-1 h-7 text-xs",
891
- onClick: () => Pe(t),
906
+ onClick: () => Fe(t),
892
907
  children: [
893
- /* @__PURE__ */ Z(de, { className: "h-3 w-3" }),
908
+ /* @__PURE__ */ Z(fe, { className: "h-3 w-3" }),
894
909
  n,
895
- r && (se === "asc" ? " ↑" : " ↓")
910
+ r && (ue === "asc" ? " ↑" : " ↓")
896
911
  ]
897
912
  }, t);
898
913
  })
899
914
  }),
900
- V ? /* @__PURE__ */ Z("div", {
915
+ oe ? /* @__PURE__ */ Z("div", {
901
916
  className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
902
- children: J("detail.loading")
903
- }) : /* @__PURE__ */ Z(at, { schema: We }),
904
- Y > 0 && je.length > Y && /* @__PURE__ */ Q("div", {
917
+ children: Y("detail.loading")
918
+ }) : /* @__PURE__ */ Z(at, { schema: qe }),
919
+ X > 0 && Me.length > X && /* @__PURE__ */ Q("div", {
905
920
  className: "flex items-center justify-between mt-3 pt-3 border-t",
906
921
  children: [
907
922
  /* @__PURE__ */ Q(x, {
908
923
  variant: "outline",
909
924
  size: "sm",
910
925
  className: "h-7 text-xs gap-1",
911
- disabled: ae === 0,
912
- onClick: () => U((e) => Math.max(0, e - 1)),
913
- children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }), J("detail.previousPage")]
926
+ disabled: U === 0,
927
+ onClick: () => G((e) => Math.max(0, e - 1)),
928
+ children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }), Y("detail.previousPage")]
914
929
  }),
915
930
  /* @__PURE__ */ Z("span", {
916
931
  className: "text-xs text-muted-foreground",
917
- children: J("detail.pageOf", {
918
- current: ae + 1,
919
- total: Me
932
+ children: Y("detail.pageOf", {
933
+ current: U + 1,
934
+ total: Ne
920
935
  })
921
936
  }),
922
937
  /* @__PURE__ */ Q(x, {
923
938
  variant: "outline",
924
939
  size: "sm",
925
940
  className: "h-7 text-xs gap-1",
926
- disabled: ae >= Me - 1,
927
- onClick: () => U((e) => Math.min(Me - 1, e + 1)),
928
- children: [J("detail.nextPage"), /* @__PURE__ */ Z(be, { className: "h-3 w-3" })]
941
+ disabled: U >= Ne - 1,
942
+ onClick: () => G((e) => Math.min(Ne - 1, e + 1)),
943
+ children: [Y("detail.nextPage"), /* @__PURE__ */ Z(be, { className: "h-3 w-3" })]
929
944
  })
930
945
  ]
931
946
  }),
932
- y && !Ye && Y > 0 && je.length > Y && /* @__PURE__ */ Z("div", {
947
+ y && !Ze && X > 0 && Me.length > X && /* @__PURE__ */ Z("div", {
933
948
  className: "mt-3 pt-3 border-t flex justify-center",
934
949
  children: /* @__PURE__ */ Q("button", {
935
950
  type: "button",
@@ -937,37 +952,37 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
937
952
  e.stopPropagation(), y();
938
953
  },
939
954
  className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
940
- children: [J("detail.viewAll"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
955
+ children: [Y("detail.viewAll"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
941
956
  })
942
957
  })
943
958
  ]
944
959
  }),
945
960
  /* @__PURE__ */ Z(c, {
946
- open: Fe !== null,
961
+ open: Ie !== null,
947
962
  onOpenChange: (e) => {
948
- e || Ie(null);
963
+ e || Le(null);
949
964
  },
950
- children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children: J("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(f, { children: J("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(p, { children: [/* @__PURE__ */ Z(u, { children: J("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(l, {
951
- onClick: Re,
965
+ children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children: Y("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(f, { children: Y("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(p, { children: [/* @__PURE__ */ Z(u, { children: Y("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(l, {
966
+ onClick: ze,
952
967
  className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
953
- children: J("detail.delete", { defaultValue: "Delete" })
968
+ children: Y("detail.delete", { defaultValue: "Delete" })
954
969
  })] })] })
955
970
  }),
956
- Se && /* @__PURE__ */ Z("div", {
971
+ we && /* @__PURE__ */ Z("div", {
957
972
  className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
958
973
  role: "alert",
959
- children: Se
974
+ children: we
960
975
  }),
961
- M && g && /* @__PURE__ */ Z(bt, {
962
- open: he,
963
- onOpenChange: (e) => ge(e),
976
+ P && g && /* @__PURE__ */ Z(bt, {
977
+ open: _e,
978
+ onOpenChange: (e) => xe(e),
964
979
  multiple: !0,
965
980
  dataSource: g,
966
- objectName: M.picker.object,
967
- title: M.label || J("detail.add", { defaultValue: "Add" }),
981
+ objectName: P.picker.object,
982
+ title: P.label || Y("detail.add", { defaultValue: "Add" }),
968
983
  onSelect: () => {},
969
984
  onSelectRecords: (e) => {
970
- ze(e);
985
+ Be(e);
971
986
  }
972
987
  })
973
988
  ]
@@ -1017,7 +1032,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1017
1032
  }) })
1018
1033
  ]
1019
1034
  }) : /* @__PURE__ */ Q("div", {
1020
- className: G("space-y-3", n),
1035
+ className: W("space-y-3", n),
1021
1036
  children: [
1022
1037
  /* @__PURE__ */ Q("div", {
1023
1038
  className: "flex items-center gap-2 pb-2 border-b",
@@ -1044,10 +1059,10 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1044
1059
  return n != null && n !== "";
1045
1060
  });
1046
1061
  return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
1047
- className: G("@container border-b border-border/60 pb-4", n),
1062
+ className: W("@container border-b border-border/60 pb-4", n),
1048
1063
  "aria-label": "Record highlights",
1049
1064
  children: /* @__PURE__ */ Z("div", {
1050
- className: G("flex flex-wrap gap-y-4"),
1065
+ className: W("flex flex-wrap gap-y-4"),
1051
1066
  children: o.map((e) => {
1052
1067
  let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
1053
1068
  name: e.name,
@@ -1060,7 +1075,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1060
1075
  ...o?.format && { format: o.format }
1061
1076
  }, 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
1077
  return /* @__PURE__ */ Q("div", {
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]"),
1078
+ className: W("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
1079
  children: [/* @__PURE__ */ Z("span", {
1065
1080
  className: "text-xs font-medium text-muted-foreground",
1066
1081
  children: a(r || "", e.name, e.label)
@@ -1078,7 +1093,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1078
1093
  }), "No"]
1079
1094
  }) : /* @__PURE__ */ Z("span", {
1080
1095
  title: typeof n == "string" ? n : void 0,
1081
- className: G("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
1096
+ className: W("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
1082
1097
  children: /* @__PURE__ */ Z(l, {
1083
1098
  value: n,
1084
1099
  field: c
@@ -1122,11 +1137,11 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1122
1137
  return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
1123
1138
  }) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
1124
1139
  return /* @__PURE__ */ Q(S, {
1125
- className: G("", a),
1140
+ className: W("", a),
1126
1141
  children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
1127
1142
  className: "flex items-center gap-2 text-base",
1128
1143
  children: [
1129
- /* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
1144
+ /* @__PURE__ */ Z(ze, { className: "h-4 w-4" }),
1130
1145
  o("detail.comments"),
1131
1146
  /* @__PURE__ */ Q("span", {
1132
1147
  className: "text-sm font-normal text-muted-foreground",
@@ -1187,7 +1202,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1187
1202
  }) : /* @__PURE__ */ Z("div", {
1188
1203
  className: "space-y-3",
1189
1204
  children: h.map((e) => /* @__PURE__ */ Q("div", {
1190
- className: G("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1205
+ className: W("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1191
1206
  children: [/* @__PURE__ */ Z("div", {
1192
1207
  className: "shrink-0",
1193
1208
  children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
@@ -1240,8 +1255,8 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1240
1255
  field_change: Ee,
1241
1256
  create: qe,
1242
1257
  delete: et,
1243
- comment: X,
1244
- status_change: ue
1258
+ comment: ze,
1259
+ status_change: de
1245
1260
  }, en = {
1246
1261
  field_change: "bg-blue-100 text-blue-600",
1247
1262
  create: "bg-green-100 text-green-600",
@@ -1275,11 +1290,11 @@ var rn = {
1275
1290
  }, an = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
1276
1291
  let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
1277
1292
  return /* @__PURE__ */ Q(S, {
1278
- className: G("", r),
1293
+ className: W("", r),
1279
1294
  children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
1280
1295
  className: "flex items-center gap-2 text-base",
1281
1296
  children: [
1282
- /* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
1297
+ /* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
1283
1298
  "Activity",
1284
1299
  /* @__PURE__ */ Q("span", {
1285
1300
  className: "text-sm font-normal text-muted-foreground",
@@ -1296,7 +1311,7 @@ var rn = {
1296
1311
  "aria-label": "Activity type filter",
1297
1312
  children: Object.keys(rn).map((e) => /* @__PURE__ */ Q("button", {
1298
1313
  type: "button",
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"),
1314
+ className: W("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"),
1300
1315
  onClick: () => o(e),
1301
1316
  "aria-pressed": a === e,
1302
1317
  children: [e !== "all" && i.createElement($t[e] || Ee, { className: "h-3 w-3" }), rn[e]]
@@ -1313,7 +1328,7 @@ var rn = {
1313
1328
  return /* @__PURE__ */ Q("div", {
1314
1329
  className: "flex gap-3 relative",
1315
1330
  children: [/* @__PURE__ */ Z("div", {
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"),
1331
+ className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", en[e.type] || "bg-gray-100 text-gray-600"),
1317
1332
  children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
1318
1333
  }), /* @__PURE__ */ Q("div", {
1319
1334
  className: "flex-1 min-w-0 pt-1",
@@ -1398,21 +1413,21 @@ function dn(e) {
1398
1413
  }
1399
1414
  function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1400
1415
  return t ? /* @__PURE__ */ Z("div", {
1401
- className: G("space-y-3", r),
1416
+ className: W("space-y-3", r),
1402
1417
  children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
1403
1418
  className: "flex items-start gap-3",
1404
- children: [/* @__PURE__ */ Z(I, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1419
+ children: [/* @__PURE__ */ Z(F, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1405
1420
  className: "flex-1 space-y-2",
1406
- children: [/* @__PURE__ */ Z(I, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(I, { className: "h-3 w-1/2" })]
1421
+ children: [/* @__PURE__ */ Z(F, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(F, { className: "h-3 w-1/2" })]
1407
1422
  })]
1408
1423
  }, t))
1409
1424
  }) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
1410
- className: G("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1425
+ className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1411
1426
  children: n ?? "No history yet"
1412
- }) : /* @__PURE__ */ Z(ae, {
1427
+ }) : /* @__PURE__ */ Z(oe, {
1413
1428
  delayDuration: 150,
1414
1429
  children: /* @__PURE__ */ Z("ol", {
1415
- className: G("space-y-4", r),
1430
+ className: W("space-y-4", r),
1416
1431
  children: e.map((e, t) => {
1417
1432
  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;
1418
1433
  return /* @__PURE__ */ Q("li", {
@@ -1441,14 +1456,14 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1441
1456
  className: "text-[10px] uppercase tracking-wide",
1442
1457
  children: e.action
1443
1458
  }),
1444
- o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1459
+ o && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
1445
1460
  asChild: !0,
1446
1461
  children: /* @__PURE__ */ Z("span", {
1447
1462
  className: "text-xs text-muted-foreground cursor-help",
1448
1463
  "aria-label": o,
1449
1464
  children: s || o
1450
1465
  })
1451
- }), /* @__PURE__ */ Z(H, { children: o })] })
1466
+ }), /* @__PURE__ */ Z(V, { children: o })] })
1452
1467
  ]
1453
1468
  }),
1454
1469
  e.summary && /* @__PURE__ */ Z("p", {
@@ -1565,16 +1580,16 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1565
1580
  return /* @__PURE__ */ Z("span", { children: String(e) });
1566
1581
  }, vn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1567
1582
  if (!t && !n) return null;
1568
- let o = n ? /* @__PURE__ */ Z(ae, {
1583
+ let o = n ? /* @__PURE__ */ Z(oe, {
1569
1584
  delayDuration: 200,
1570
- children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1585
+ children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
1571
1586
  asChild: !0,
1572
1587
  children: /* @__PURE__ */ Z("time", {
1573
1588
  dateTime: n.toISOString(),
1574
1589
  className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
1575
1590
  children: hn(n, a)
1576
1591
  })
1577
- }), /* @__PURE__ */ Z(H, {
1592
+ }), /* @__PURE__ */ Z(V, {
1578
1593
  side: "top",
1579
1594
  children: gn(n)
1580
1595
  })] })
@@ -1603,7 +1618,7 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1603
1618
  if (!e) return null;
1604
1619
  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));
1605
1620
  return !l && !d ? null : /* @__PURE__ */ Q("div", {
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),
1621
+ className: W("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),
1607
1622
  "data-testid": "record-meta-footer",
1608
1623
  children: [l && /* @__PURE__ */ Z(vn, {
1609
1624
  label: i("detail.createdBy"),
@@ -1643,9 +1658,9 @@ function xn(e, t, i, a) {
1643
1658
  return a;
1644
1659
  }
1645
1660
  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(() => {
1647
- if (!de?.isLoaded || !e.objectName) return e;
1648
- let t = (t) => de.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1661
+ 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, P] = i.useState(null), [ee, te] = i.useState(!1), [ne, re] = i.useState(0), ie = lt(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [ae, U] = i.useState(!1), { t: G } = $(), { currency: ce } = jt(), { fieldOptionLabel: ue } = _t(), de = se(), fe = kt(), K = i.useMemo(() => {
1662
+ if (!fe?.isLoaded || !e.objectName) return e;
1663
+ let t = (t) => fe.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1649
1664
  let n = typeof e == "string" ? e : e?.name;
1650
1665
  return !n || t(n);
1651
1666
  });
@@ -1658,13 +1673,13 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1658
1673
  })),
1659
1674
  summaryFields: n(e.summaryFields)
1660
1675
  };
1661
- }, [e, de]);
1676
+ }, [e, fe]);
1662
1677
  i.useEffect(() => {
1663
1678
  g && p && p(g);
1664
1679
  }, [g, p]);
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 = {};
1680
+ let pe = i.useMemo(() => {
1681
+ if (K.summaryFields && K.summaryFields.length > 0) return [];
1682
+ let e = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []], t = {};
1668
1683
  for (let n of e) t[n.name] || (t[n.name] = n);
1669
1684
  if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
1670
1685
  ...t[e] || {},
@@ -1683,29 +1698,29 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1683
1698
  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));
1684
1699
  return o && !r.includes(o) && r.push(o), r;
1685
1700
  }, [
1686
- q.summaryFields,
1687
- q.sections,
1688
- q.fields,
1701
+ K.summaryFields,
1702
+ K.sections,
1703
+ K.fields,
1689
1704
  N,
1690
1705
  g
1691
- ]), pe = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : fe, me = i.useCallback(() => {
1692
- q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
1693
- ne(!0), setTimeout(() => ne(!1), 1500);
1706
+ ]), q = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : pe, me = i.useCallback(() => {
1707
+ K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
1708
+ te(!0), setTimeout(() => te(!1), 1500);
1694
1709
  });
1695
- }, [q.resourceId]);
1710
+ }, [K.resourceId]);
1696
1711
  i.useEffect(() => {
1697
1712
  let e = !0;
1698
- if (q.data) return _(q.data), y(!1), n?.getObjectSchema && q.objectName && n.getObjectSchema(q.objectName).then((t) => {
1699
- e && ee(t);
1713
+ if (K.data) return _(K.data), y(!1), n?.getObjectSchema && K.objectName && n.getObjectSchema(K.objectName).then((t) => {
1714
+ e && P(t);
1700
1715
  }).catch(() => {}), () => {
1701
1716
  e = !1;
1702
1717
  };
1703
- if (n && q.objectName && q.resourceId) {
1704
- y(!0), ee(null), _(null);
1705
- let r = q.objectName, i = q.resourceId, a = `${r}-`, o = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []];
1718
+ if (n && K.objectName && K.resourceId) {
1719
+ y(!0), P(null), _(null);
1720
+ let r = K.objectName, i = K.resourceId, a = `${r}-`, o = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []];
1706
1721
  (n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
1707
1722
  if (!e) return;
1708
- ee(s);
1723
+ P(s);
1709
1724
  let c = t(s?.fields, o), l = c.length > 0 ? { $expand: c } : void 0, u = l ? n.findOne(r, i, l) : n.findOne(r, i), d = () => {
1710
1725
  let t = String(i), o = t.startsWith(a) ? t.slice(a.length) : `${a}${t}`;
1711
1726
  return (l ? n.findOne(r, o, l) : n.findOne(r, o)).then((t) => {
@@ -1726,7 +1741,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1726
1741
  }).catch((t) => {
1727
1742
  e && (console.error("Failed to fetch detail data:", t), y(!1));
1728
1743
  });
1729
- } else q.api && q.resourceId && (y(!0), fetch(`${q.api}/${q.resourceId}`).then((e) => e.json()).then((t) => {
1744
+ } else K.api && K.resourceId && (y(!0), fetch(`${K.api}/${K.resourceId}`).then((e) => e.json()).then((t) => {
1730
1745
  e && _(t?.data || t);
1731
1746
  }).catch((e) => {
1732
1747
  console.error("Failed to fetch detail data:", e);
@@ -1737,65 +1752,65 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1737
1752
  e = !1;
1738
1753
  };
1739
1754
  }, [
1740
- q.api,
1741
- q.resourceId,
1742
- q.objectName,
1755
+ K.api,
1756
+ K.resourceId,
1757
+ K.objectName,
1743
1758
  n,
1744
- q.sections,
1745
- q.fields,
1746
- re,
1747
- P
1759
+ K.sections,
1760
+ K.fields,
1761
+ ne,
1762
+ ie
1748
1763
  ]);
1749
1764
  let he = i.useCallback(() => {
1750
1765
  if (s) s();
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"));
1766
+ else if (K.onNavigate) {
1767
+ let e = K.backUrl || (K.objectName ? `/${K.objectName}` : "/");
1768
+ K.onNavigate(e, { replace: !0 });
1769
+ } else K.backUrl ? window.location.href = K.backUrl : window.history.back();
1770
+ }, [s, K]), _e = i.useCallback(() => {
1771
+ 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);
1772
+ }, [a, K]), ve = i.useCallback(async () => {
1773
+ if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
1774
+ M(G("detail.cancelApprovalUnavailable"));
1760
1775
  return;
1761
1776
  }
1762
- W(!0), M(null);
1777
+ U(!0), M(null);
1763
1778
  try {
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));
1779
+ if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
1780
+ let e = await n.findOne(String(K.objectName), String(K.resourceId));
1766
1781
  e && _(e);
1767
1782
  } catch {}
1768
- ie((e) => e + 1);
1783
+ re((e) => e + 1);
1769
1784
  try {
1770
1785
  window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
1771
- objectName: String(q.objectName),
1772
- recordId: String(q.resourceId),
1786
+ objectName: String(K.objectName),
1787
+ recordId: String(K.resourceId),
1773
1788
  reason: "approval-recalled"
1774
1789
  } }));
1775
1790
  } catch {}
1776
1791
  } catch (e) {
1777
1792
  let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
1778
- M(`${K("detail.cancelApprovalFailed")}: ${t}`);
1793
+ M(`${G("detail.cancelApprovalFailed")}: ${t}`);
1779
1794
  } finally {
1780
- W(!1);
1795
+ U(!1);
1781
1796
  }
1782
1797
  }, [
1783
1798
  n,
1784
- q.objectName,
1785
- q.resourceId,
1786
- K
1799
+ K.objectName,
1800
+ K.resourceId,
1801
+ G
1787
1802
  ]), 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}`,
1803
+ let e = K.deleteConfirmation || G("detail.deleteConfirmation");
1804
+ window.confirm(e) && (o?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
1805
+ }, [o, K]), Se = i.useCallback(() => {
1806
+ navigator.share && K.objectName && K.resourceId ? navigator.share({
1807
+ title: K.title || G("detail.details"),
1808
+ text: `${K.objectName} #${K.resourceId}`,
1794
1809
  url: window.location.href
1795
1810
  }).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
1796
1811
  console.log("Link copied to clipboard");
1797
1812
  });
1798
- }, [q]), Ce = i.useCallback(() => {
1813
+ }, [K]), Ce = i.useCallback(() => {
1799
1814
  let e = !w;
1800
1815
  h && h(e), m === void 0 && C(e);
1801
1816
  }, [
@@ -1815,7 +1830,9 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1815
1830
  if (l) for (let [t, r] of e) await l(t, r, n);
1816
1831
  O({}), E(!1);
1817
1832
  } catch (e) {
1818
- _(t), M((e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, ""));
1833
+ _(t);
1834
+ let n = (e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
1835
+ M(n);
1819
1836
  } finally {
1820
1837
  A(!1);
1821
1838
  }
@@ -1831,58 +1848,58 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1831
1848
  l
1832
1849
  ]), De = i.useCallback(() => {
1833
1850
  O({}), E(!1), M(null);
1834
- }, []), Oe = i.useCallback((e, t) => {
1851
+ }, []), J = i.useCallback((e, t) => {
1835
1852
  O((n) => ({
1836
1853
  ...n,
1837
1854
  [e]: t
1838
1855
  }));
1839
1856
  }, []);
1840
1857
  i.useEffect(() => {
1841
- if (!q.recordNavigation) return;
1842
- let e = q.recordNavigation, t = (t) => {
1858
+ if (!K.recordNavigation) return;
1859
+ let e = K.recordNavigation, t = (t) => {
1843
1860
  let n = t.target?.tagName;
1844
1861
  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])));
1845
1862
  };
1846
1863
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1847
- }, [q.recordNavigation]), i.useEffect(() => {
1848
- if (!c || q.showHeader !== !1) return;
1864
+ }, [K.recordNavigation]), i.useEffect(() => {
1865
+ if (!c || K.showHeader !== !1) return;
1849
1866
  let e = "objectui:record:inline-edit-toggle", t = (e) => {
1850
1867
  let t = e.detail;
1851
- t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName || we();
1868
+ t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName || we();
1852
1869
  };
1853
1870
  return window.addEventListener(e, t), () => window.removeEventListener(e, t);
1854
1871
  }, [
1855
1872
  c,
1856
- q.showHeader,
1857
- q.recordId,
1858
- q.objectName,
1873
+ K.showHeader,
1874
+ K.recordId,
1875
+ K.objectName,
1859
1876
  we
1860
1877
  ]);
1861
- let J = i.useMemo(() => q.related ?? [], [q.related]), ke = i.useMemo(() => {
1878
+ let Oe = i.useMemo(() => K.related ?? [], [K.related]), ke = i.useMemo(() => {
1862
1879
  let e = [];
1863
1880
  return e.push({
1864
1881
  name: "sys_share",
1865
- label: K("detail.share"),
1882
+ label: G("detail.share"),
1866
1883
  icon: "share-2",
1867
1884
  type: "script",
1868
1885
  onClick: Se
1869
- }), q.showEdit && e.push({
1886
+ }), K.showEdit && e.push({
1870
1887
  name: "sys_edit_mobile",
1871
- label: K("detail.edit"),
1888
+ label: G("detail.edit"),
1872
1889
  icon: "edit",
1873
1890
  type: "script",
1874
1891
  className: "sm:hidden",
1875
1892
  onClick: _e
1876
1893
  }), c && e.push({
1877
1894
  name: "sys_toggle_inline_edit_mobile",
1878
- label: K(T ? "detail.save" : "detail.editInline"),
1895
+ label: G(T ? "detail.save" : "detail.editInline"),
1879
1896
  icon: "edit",
1880
1897
  type: "script",
1881
1898
  className: "sm:hidden",
1882
1899
  onClick: we
1883
- }), q.showDelete && e.push({
1900
+ }), K.showDelete && e.push({
1884
1901
  name: "sys_delete",
1885
- label: K("detail.delete"),
1902
+ label: G("detail.delete"),
1886
1903
  icon: "trash-2",
1887
1904
  type: "script",
1888
1905
  variant: "destructive",
@@ -1890,17 +1907,17 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1890
1907
  onClick: xe
1891
1908
  }), e;
1892
1909
  }, [
1893
- K,
1894
- q.showEdit,
1895
- q.showDelete,
1910
+ G,
1911
+ K.showEdit,
1912
+ K.showDelete,
1896
1913
  c,
1897
1914
  T,
1898
1915
  Se,
1899
1916
  _e,
1900
1917
  we,
1901
1918
  xe
1902
- ]), Ae = i.useMemo(() => {
1903
- let e = q.actions ?? [];
1919
+ ]), Y = i.useMemo(() => {
1920
+ let e = K.actions ?? [];
1904
1921
  if (ke.length === 0) return e;
1905
1922
  let t = !1, n = e.map((e) => {
1906
1923
  let n = e;
@@ -1919,62 +1936,62 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1919
1936
  location: "record_header",
1920
1937
  systemActions: ke
1921
1938
  }), n;
1922
- }, [q.actions, ke]);
1923
- return v || q.loading ? /* @__PURE__ */ Q("div", {
1924
- className: G("space-y-4", r),
1939
+ }, [K.actions, ke]);
1940
+ return v || K.loading ? /* @__PURE__ */ Q("div", {
1941
+ className: W("space-y-4", r),
1925
1942
  children: [
1926
- /* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
1927
- /* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
1928
- /* @__PURE__ */ Z(I, { className: "h-48 w-full" })
1943
+ /* @__PURE__ */ Z(F, { className: "h-10 w-full" }),
1944
+ /* @__PURE__ */ Z(F, { className: "h-64 w-full" }),
1945
+ /* @__PURE__ */ Z(F, { className: "h-48 w-full" })
1929
1946
  ]
1930
- }) : !g && !q.data ? /* @__PURE__ */ Q("div", {
1931
- className: G("flex flex-col items-center justify-center py-16 text-center", r),
1947
+ }) : !g && !K.data ? /* @__PURE__ */ Q("div", {
1948
+ className: W("flex flex-col items-center justify-center py-16 text-center", r),
1932
1949
  children: [
1933
1950
  /* @__PURE__ */ Z("p", {
1934
1951
  className: "text-lg font-semibold",
1935
- children: K("detail.recordNotFound")
1952
+ children: G("detail.recordNotFound")
1936
1953
  }),
1937
1954
  /* @__PURE__ */ Z("p", {
1938
1955
  className: "text-sm text-muted-foreground mt-1",
1939
- children: K("detail.recordNotFoundDescription")
1956
+ children: G("detail.recordNotFoundDescription")
1940
1957
  }),
1941
- (q.showBack ?? !0) && /* @__PURE__ */ Q(x, {
1958
+ (K.showBack ?? !0) && /* @__PURE__ */ Q(x, {
1942
1959
  variant: "outline",
1943
1960
  size: "sm",
1944
1961
  onClick: he,
1945
1962
  className: "mt-4 gap-2",
1946
- children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), K("detail.goBack")]
1963
+ children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }), G("detail.goBack")]
1947
1964
  })
1948
1965
  ]
1949
- }) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
1950
- className: G("space-y-6", r),
1966
+ }) : /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q("div", {
1967
+ className: W("space-y-6", r),
1951
1968
  children: [
1952
- q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1969
+ K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1953
1970
  className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
1954
1971
  children: [/* @__PURE__ */ Q("div", {
1955
1972
  className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
1956
- children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1973
+ children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
1957
1974
  asChild: !0,
1958
1975
  children: /* @__PURE__ */ Z(x, {
1959
1976
  variant: "ghost",
1960
1977
  size: "icon",
1961
1978
  onClick: he,
1962
1979
  className: "shrink-0 mt-1",
1963
- children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
1980
+ children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
1964
1981
  })
1965
- }), /* @__PURE__ */ Z(H, { children: K("detail.back") })] }), /* @__PURE__ */ Q("div", {
1982
+ }), /* @__PURE__ */ Z(V, { children: G("detail.back") })] }), /* @__PURE__ */ Q("div", {
1966
1983
  className: "flex-1 min-w-0",
1967
1984
  children: [/* @__PURE__ */ Q("div", {
1968
1985
  className: "flex items-center gap-2 flex-wrap",
1969
1986
  children: [
1970
1987
  /* @__PURE__ */ Z("h1", {
1971
1988
  className: "text-xl sm:text-2xl font-bold truncate",
1972
- children: xn(g, q, N, K("detail.details"))
1989
+ children: xn(g, K, N, G("detail.details"))
1973
1990
  }),
1974
- pe.map((e) => {
1991
+ q.map((e) => {
1975
1992
  let t = g?.[e];
1976
1993
  if (t == null || t === "") return 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;
1994
+ 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;
1978
1995
  try {
1979
1996
  if (i === "currency") {
1980
1997
  let e = Number(t);
@@ -1982,7 +1999,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1982
1999
  let t = At({
1983
2000
  ...r,
1984
2001
  ...n
1985
- }, se);
2002
+ }, ce);
1986
2003
  a = t ? new Intl.NumberFormat(void 0, {
1987
2004
  style: "currency",
1988
2005
  currency: t,
@@ -2011,7 +2028,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2011
2028
  let e = i[String(t)];
2012
2029
  e?.label && (o = e.label);
2013
2030
  }
2014
- a = q.objectName ? le(q.objectName, e, String(t), o) : o;
2031
+ a = K.objectName ? ue(K.objectName, e, String(t), o) : o;
2015
2032
  }
2016
2033
  } catch {}
2017
2034
  return o === null ? /* @__PURE__ */ Z(b, {
@@ -2033,80 +2050,80 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2033
2050
  }), a]
2034
2051
  }, e);
2035
2052
  }),
2036
- /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2053
+ /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2037
2054
  asChild: !0,
2038
2055
  children: /* @__PURE__ */ Z(x, {
2039
2056
  variant: "ghost",
2040
2057
  size: "icon",
2041
2058
  className: "h-6 w-6 shrink-0",
2042
2059
  onClick: Ce,
2043
- "aria-label": K(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2060
+ "aria-label": G(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2044
2061
  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" })
2045
2062
  })
2046
- }), /* @__PURE__ */ Z(H, { children: K(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2063
+ }), /* @__PURE__ */ Z(V, { children: G(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2047
2064
  ]
2048
- }), q.objectName && /* @__PURE__ */ Q("p", {
2065
+ }), K.objectName && /* @__PURE__ */ Q("p", {
2049
2066
  className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
2050
2067
  children: [/* @__PURE__ */ Z("span", {
2051
2068
  className: "font-medium",
2052
- children: f || q.objectName
2053
- }), q.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2069
+ children: f || K.objectName
2070
+ }), K.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2054
2071
  asChild: !0,
2055
2072
  children: /* @__PURE__ */ Z(x, {
2056
2073
  variant: "ghost",
2057
2074
  size: "icon",
2058
2075
  className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
2059
2076
  onClick: me,
2060
- "aria-label": K("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2061
- children: te ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
2077
+ "aria-label": G("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2078
+ children: ee ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
2062
2079
  })
2063
- }), /* @__PURE__ */ Z(H, { children: te ? K("detail.copied", { defaultValue: "Copied" }) : K("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2080
+ }), /* @__PURE__ */ Z(V, { children: ee ? G("detail.copied", { defaultValue: "Copied" }) : G("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2064
2081
  })]
2065
2082
  })]
2066
2083
  }), /* @__PURE__ */ Q("div", {
2067
2084
  className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
2068
2085
  children: [
2069
- q.recordNavigation && /* @__PURE__ */ Q("div", {
2086
+ K.recordNavigation && /* @__PURE__ */ Q("div", {
2070
2087
  className: "flex items-center gap-1 mr-2",
2071
2088
  children: [
2072
- /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2089
+ /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2073
2090
  asChild: !0,
2074
2091
  children: /* @__PURE__ */ Z(x, {
2075
2092
  variant: "outline",
2076
2093
  size: "icon",
2077
2094
  className: "h-8 w-8",
2078
- disabled: q.recordNavigation.currentIndex <= 0,
2095
+ disabled: K.recordNavigation.currentIndex <= 0,
2079
2096
  onClick: () => {
2080
- let e = q.recordNavigation;
2097
+ let e = K.recordNavigation;
2081
2098
  e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
2082
2099
  },
2083
2100
  children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
2084
2101
  })
2085
- }), /* @__PURE__ */ Z(H, { children: K("detail.previousRecord") })] }),
2102
+ }), /* @__PURE__ */ Z(V, { children: G("detail.previousRecord") })] }),
2086
2103
  /* @__PURE__ */ Z("span", {
2087
2104
  className: "text-xs text-muted-foreground whitespace-nowrap px-1",
2088
- children: K("detail.recordOf", {
2089
- current: q.recordNavigation.currentIndex + 1,
2090
- total: q.recordNavigation.recordIds.length
2105
+ children: G("detail.recordOf", {
2106
+ current: K.recordNavigation.currentIndex + 1,
2107
+ total: K.recordNavigation.recordIds.length
2091
2108
  })
2092
2109
  }),
2093
- /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2110
+ /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2094
2111
  asChild: !0,
2095
2112
  children: /* @__PURE__ */ Z(x, {
2096
2113
  variant: "outline",
2097
2114
  size: "icon",
2098
2115
  className: "h-8 w-8",
2099
- disabled: q.recordNavigation.currentIndex >= q.recordNavigation.recordIds.length - 1,
2116
+ disabled: K.recordNavigation.currentIndex >= K.recordNavigation.recordIds.length - 1,
2100
2117
  onClick: () => {
2101
- let e = q.recordNavigation;
2118
+ let e = K.recordNavigation;
2102
2119
  e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
2103
2120
  },
2104
2121
  children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
2105
2122
  })
2106
- }), /* @__PURE__ */ Z(H, { children: K("detail.nextRecord") })] })
2123
+ }), /* @__PURE__ */ Z(V, { children: G("detail.nextRecord") })] })
2107
2124
  ]
2108
2125
  }),
2109
- c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2126
+ c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2110
2127
  asChild: !0,
2111
2128
  children: /* @__PURE__ */ Q(x, {
2112
2129
  variant: "ghost",
@@ -2115,10 +2132,10 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2115
2132
  className: "gap-2 hidden sm:inline-flex",
2116
2133
  children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2117
2134
  className: "hidden sm:inline",
2118
- children: K("detail.cancel")
2135
+ children: G("detail.cancel")
2119
2136
  })]
2120
2137
  })
2121
- }), /* @__PURE__ */ Z(H, { children: K("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2138
+ }), /* @__PURE__ */ Z(V, { children: G("detail.cancelEdit") })] }), /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2122
2139
  asChild: !0,
2123
2140
  children: /* @__PURE__ */ Z(x, {
2124
2141
  variant: T ? "default" : "outline",
@@ -2127,14 +2144,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2127
2144
  className: "gap-2 hidden sm:inline-flex",
2128
2145
  children: T ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2129
2146
  className: "hidden sm:inline",
2130
- children: K("detail.save")
2147
+ children: G("detail.save")
2131
2148
  })] }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2132
2149
  className: "hidden sm:inline",
2133
- children: K("detail.editInline")
2150
+ children: G("detail.editInline")
2134
2151
  })] })
2135
2152
  })
2136
- }), /* @__PURE__ */ Z(H, { children: K(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2137
- q.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2153
+ }), /* @__PURE__ */ Z(V, { children: G(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2154
+ K.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2138
2155
  asChild: !0,
2139
2156
  children: /* @__PURE__ */ Q(x, {
2140
2157
  variant: "default",
@@ -2142,28 +2159,28 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2142
2159
  className: "gap-2 hidden sm:inline-flex",
2143
2160
  children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2144
2161
  className: "hidden sm:inline",
2145
- children: K("detail.edit")
2162
+ children: G("detail.edit")
2146
2163
  })]
2147
2164
  })
2148
- }), /* @__PURE__ */ Z(H, { children: K("detail.editRecord") })] }),
2149
- Ae.map((e, t) => /* @__PURE__ */ Z(at, {
2165
+ }), /* @__PURE__ */ Z(V, { children: G("detail.editRecord") })] }),
2166
+ Y.map((e, t) => /* @__PURE__ */ Z(at, {
2150
2167
  schema: e,
2151
2168
  data: g
2152
2169
  }, `header-action-${t}`))
2153
2170
  ]
2154
2171
  })]
2155
2172
  }),
2156
- q.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2157
- schema: q.header,
2173
+ K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2174
+ schema: K.header,
2158
2175
  data: g
2159
2176
  }) }),
2160
- q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
2161
- fields: q.highlightFields,
2177
+ K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
2178
+ fields: K.highlightFields,
2162
2179
  data: g,
2163
- objectName: q.objectName,
2180
+ objectName: K.objectName,
2164
2181
  objectSchema: N
2165
2182
  }),
2166
- c && q.showHeader === !1 && (() => {
2183
+ c && K.showHeader === !1 && (() => {
2167
2184
  let e = g?.approval_status, t = e === "pending" || e === "in_approval";
2168
2185
  return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
2169
2186
  className: "flex flex-col items-end gap-1",
@@ -2173,16 +2190,16 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2173
2190
  t && !T && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("span", {
2174
2191
  role: "status",
2175
2192
  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",
2176
- title: K("detail.lockedTooltip"),
2177
- children: [/* @__PURE__ */ Z(Re, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: K("detail.lockedByApproval") })]
2193
+ title: G("detail.lockedTooltip"),
2194
+ children: [/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: G("detail.lockedByApproval") })]
2178
2195
  }), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
2179
2196
  variant: "outline",
2180
2197
  size: "sm",
2181
2198
  onClick: ve,
2182
- disabled: F,
2199
+ disabled: ae,
2183
2200
  className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
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") })]
2201
+ title: G("detail.cancelApprovalTooltip"),
2202
+ children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(ae ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2186
2203
  })] }),
2187
2204
  T && /* @__PURE__ */ Q(x, {
2188
2205
  variant: "ghost",
@@ -2190,7 +2207,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2190
2207
  onClick: De,
2191
2208
  className: "gap-2",
2192
2209
  disabled: k,
2193
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K("detail.cancel") })]
2210
+ children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G("detail.cancel") })]
2194
2211
  }),
2195
2212
  /* @__PURE__ */ Q(x, {
2196
2213
  variant: T ? "default" : "outline",
@@ -2198,8 +2215,8 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2198
2215
  onClick: we,
2199
2216
  className: "gap-2",
2200
2217
  disabled: k || t && !T,
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") })]
2218
+ title: t && !T ? G("detail.lockedTooltip") : void 0,
2219
+ children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2203
2220
  })
2204
2221
  ]
2205
2222
  }), j && /* @__PURE__ */ Z("div", {
@@ -2209,131 +2226,131 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2209
2226
  })]
2210
2227
  });
2211
2228
  })(),
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 = [
2229
+ K.autoTabs && !K.tabs?.length ? (() => {
2230
+ let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a = [
2214
2231
  "details",
2215
2232
  ...e ? ["related"] : [],
2216
2233
  ...t ? ["activity"] : [],
2217
2234
  ...r ? ["discussion"] : [],
2218
2235
  ...i ? ["history"] : []
2219
- ], o = q.defaultTab, s = o && a.includes(o) ? o : "details", c = q.onTabChange, l = /* @__PURE__ */ Q("div", {
2236
+ ], o = K.defaultTab, s = o && a.includes(o) ? o : "details", c = K.onTabChange, l = /* @__PURE__ */ Q("div", {
2220
2237
  className: "space-y-3 sm:space-y-4",
2221
2238
  children: [
2222
- q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2239
+ K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2223
2240
  group: e,
2224
2241
  data: {
2225
2242
  ...g,
2226
2243
  ...D
2227
2244
  },
2228
2245
  objectSchema: N,
2229
- objectName: q.objectName,
2246
+ objectName: K.objectName,
2230
2247
  isEditing: T,
2231
- onFieldChange: Oe,
2248
+ onFieldChange: J,
2232
2249
  dataSource: n
2233
2250
  }, t)),
2234
- q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2251
+ K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2235
2252
  section: e,
2236
2253
  data: {
2237
2254
  ...g,
2238
2255
  ...D
2239
2256
  },
2240
2257
  objectSchema: N,
2241
- objectName: q.objectName,
2258
+ objectName: K.objectName,
2242
2259
  isEditing: T,
2243
- onFieldChange: Oe,
2260
+ onFieldChange: J,
2244
2261
  dataSource: n
2245
2262
  }, t)),
2246
- q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
2263
+ K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
2247
2264
  section: {
2248
- fields: q.fields,
2249
- columns: q.columns
2265
+ fields: K.fields,
2266
+ columns: K.columns
2250
2267
  },
2251
2268
  data: {
2252
2269
  ...g,
2253
2270
  ...D
2254
2271
  },
2255
2272
  objectSchema: N,
2256
- objectName: q.objectName,
2273
+ objectName: K.objectName,
2257
2274
  isEditing: T,
2258
- onFieldChange: Oe,
2275
+ onFieldChange: J,
2259
2276
  dataSource: n
2260
2277
  }),
2261
- q.comments && /* @__PURE__ */ Z(Qt, {
2262
- comments: q.comments,
2263
- onAddComment: q.onAddComment
2278
+ K.comments && /* @__PURE__ */ Z(Qt, {
2279
+ comments: K.comments,
2280
+ onAddComment: K.onAddComment
2264
2281
  })
2265
2282
  ]
2266
2283
  });
2267
2284
  return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
2268
2285
  className: "mt-2",
2269
2286
  children: l
2270
- }) : /* @__PURE__ */ Q(L, {
2287
+ }) : /* @__PURE__ */ Q(I, {
2271
2288
  defaultValue: s,
2272
2289
  onValueChange: c,
2273
2290
  className: "w-full",
2274
2291
  children: [
2275
- /* @__PURE__ */ Q(z, {
2292
+ /* @__PURE__ */ Q(R, {
2276
2293
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
2277
2294
  children: [
2278
- /* @__PURE__ */ Z(B, {
2295
+ /* @__PURE__ */ Z(z, {
2279
2296
  value: "details",
2280
2297
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2281
- children: K("detail.details")
2298
+ children: G("detail.details")
2282
2299
  }),
2283
- e && /* @__PURE__ */ Z(B, {
2300
+ e && /* @__PURE__ */ Z(z, {
2284
2301
  value: "related",
2285
2302
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2286
2303
  children: /* @__PURE__ */ Q("span", {
2287
2304
  className: "flex items-center gap-1.5",
2288
- children: [K("detail.related"), /* @__PURE__ */ Z(b, {
2305
+ children: [G("detail.related"), /* @__PURE__ */ Z(b, {
2289
2306
  variant: "secondary",
2290
2307
  className: "text-xs bg-primary/10 text-primary border-transparent",
2291
- children: J.length
2308
+ children: Oe.length
2292
2309
  })]
2293
2310
  })
2294
2311
  }),
2295
- t && /* @__PURE__ */ Z(B, {
2312
+ t && /* @__PURE__ */ Z(z, {
2296
2313
  value: "activity",
2297
2314
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2298
2315
  children: /* @__PURE__ */ Q("span", {
2299
2316
  className: "flex items-center gap-1.5",
2300
- children: [K("detail.activity"), /* @__PURE__ */ Z(b, {
2317
+ children: [G("detail.activity"), /* @__PURE__ */ Z(b, {
2301
2318
  variant: "secondary",
2302
2319
  className: "text-xs bg-primary/10 text-primary border-transparent",
2303
- children: q.activities.length
2320
+ children: K.activities.length
2304
2321
  })]
2305
2322
  })
2306
2323
  }),
2307
- r && /* @__PURE__ */ Z(B, {
2324
+ r && /* @__PURE__ */ Z(z, {
2308
2325
  value: "discussion",
2309
2326
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2310
- children: K("detail.discussion", { defaultValue: "Discussion" })
2327
+ children: G("detail.discussion", { defaultValue: "Discussion" })
2311
2328
  }),
2312
- i && /* @__PURE__ */ Z(B, {
2329
+ i && /* @__PURE__ */ Z(z, {
2313
2330
  value: "history",
2314
2331
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2315
2332
  children: /* @__PURE__ */ Q("span", {
2316
2333
  className: "flex items-center gap-1.5",
2317
- children: [K("detail.history", { defaultValue: "History" }), !q.history.loading && q.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2334
+ children: [G("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2318
2335
  variant: "secondary",
2319
2336
  className: "text-xs bg-primary/10 text-primary border-transparent",
2320
- children: q.history.entries.length
2337
+ children: K.history.entries.length
2321
2338
  })]
2322
2339
  })
2323
2340
  })
2324
2341
  ]
2325
2342
  }),
2326
- /* @__PURE__ */ Z(R, {
2343
+ /* @__PURE__ */ Z(L, {
2327
2344
  value: "details",
2328
2345
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2329
2346
  children: l
2330
2347
  }),
2331
- e && /* @__PURE__ */ Z(R, {
2348
+ e && /* @__PURE__ */ Z(L, {
2332
2349
  value: "related",
2333
2350
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2334
2351
  children: /* @__PURE__ */ Z("div", {
2335
2352
  className: "space-y-3",
2336
- children: J.map((e, t) => /* @__PURE__ */ Z(Jt, {
2353
+ children: Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
2337
2354
  title: e.title,
2338
2355
  type: e.type,
2339
2356
  api: e.api,
@@ -2349,88 +2366,88 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2349
2366
  onRowEdit: e.onRowEdit,
2350
2367
  onRowDelete: e.onRowDelete,
2351
2368
  collapsible: !0,
2352
- defaultCollapsed: ue && t > 0,
2369
+ defaultCollapsed: de && t > 0,
2353
2370
  pageSize: bn
2354
2371
  }, t))
2355
2372
  })
2356
2373
  }),
2357
- t && /* @__PURE__ */ Z(R, {
2374
+ t && /* @__PURE__ */ Z(L, {
2358
2375
  value: "activity",
2359
2376
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2360
- children: /* @__PURE__ */ Z(an, { activities: q.activities })
2377
+ children: /* @__PURE__ */ Z(an, { activities: K.activities })
2361
2378
  }),
2362
- r && /* @__PURE__ */ Z(R, {
2379
+ r && /* @__PURE__ */ Z(L, {
2363
2380
  value: "discussion",
2364
2381
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2365
2382
  children: u
2366
2383
  }),
2367
- i && /* @__PURE__ */ Z(R, {
2384
+ i && /* @__PURE__ */ Z(L, {
2368
2385
  value: "history",
2369
2386
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2370
2387
  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" })
2388
+ entries: K.history.entries,
2389
+ loading: K.history.loading,
2390
+ emptyText: K.history.emptyText ?? G("detail.historyEmpty", { defaultValue: "No history yet" })
2374
2391
  })
2375
2392
  })
2376
2393
  ]
2377
2394
  });
2378
2395
  })() : /* @__PURE__ */ Q(Dt, { children: [
2379
- q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2396
+ K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2380
2397
  className: "space-y-3 sm:space-y-4",
2381
- children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2398
+ children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2382
2399
  group: e,
2383
2400
  data: {
2384
2401
  ...g,
2385
2402
  ...D
2386
2403
  },
2387
2404
  objectSchema: N,
2388
- objectName: q.objectName,
2405
+ objectName: K.objectName,
2389
2406
  isEditing: T,
2390
- onFieldChange: Oe,
2407
+ onFieldChange: J,
2391
2408
  dataSource: n
2392
2409
  }, t))
2393
2410
  }),
2394
- q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
2411
+ K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
2395
2412
  className: "space-y-3 sm:space-y-4",
2396
- children: q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2413
+ children: K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2397
2414
  section: e,
2398
2415
  data: {
2399
2416
  ...g,
2400
2417
  ...D
2401
2418
  },
2402
2419
  objectSchema: N,
2403
- objectName: q.objectName,
2420
+ objectName: K.objectName,
2404
2421
  isEditing: T,
2405
- onFieldChange: Oe,
2422
+ onFieldChange: J,
2406
2423
  dataSource: n
2407
2424
  }, t))
2408
2425
  }),
2409
- q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
2426
+ K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
2410
2427
  section: {
2411
- fields: q.fields,
2412
- columns: q.columns
2428
+ fields: K.fields,
2429
+ columns: K.columns
2413
2430
  },
2414
2431
  data: {
2415
2432
  ...g,
2416
2433
  ...D
2417
2434
  },
2418
2435
  objectSchema: N,
2419
- objectName: q.objectName,
2436
+ objectName: K.objectName,
2420
2437
  isEditing: T,
2421
- onFieldChange: Oe,
2438
+ onFieldChange: J,
2422
2439
  dataSource: n
2423
2440
  }),
2424
- q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
2425
- tabs: q.tabs,
2441
+ K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
2442
+ tabs: K.tabs,
2426
2443
  data: g
2427
2444
  }),
2428
- J.length > 0 && /* @__PURE__ */ Q("div", {
2445
+ Oe.length > 0 && /* @__PURE__ */ Q("div", {
2429
2446
  className: "space-y-3",
2430
2447
  children: [/* @__PURE__ */ Z("h2", {
2431
2448
  className: "text-lg font-semibold",
2432
- children: K("detail.related")
2433
- }), J.map((e, t) => /* @__PURE__ */ Z(Jt, {
2449
+ children: G("detail.related")
2450
+ }), Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
2434
2451
  title: e.title,
2435
2452
  type: e.type,
2436
2453
  api: e.api,
@@ -2446,15 +2463,15 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2446
2463
  onRowEdit: e.onRowEdit,
2447
2464
  onRowDelete: e.onRowDelete,
2448
2465
  collapsible: !0,
2449
- defaultCollapsed: ue && t > 0,
2466
+ defaultCollapsed: de && t > 0,
2450
2467
  pageSize: bn
2451
2468
  }, t))]
2452
2469
  }),
2453
- q.comments && /* @__PURE__ */ Z(Qt, {
2454
- comments: q.comments,
2455
- onAddComment: q.onAddComment
2470
+ K.comments && /* @__PURE__ */ Z(Qt, {
2471
+ comments: K.comments,
2472
+ onAddComment: K.onAddComment
2456
2473
  }),
2457
- q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: q.activities })
2474
+ K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: K.activities })
2458
2475
  ] }),
2459
2476
  /* @__PURE__ */ Z(yn, {
2460
2477
  data: {
@@ -2462,10 +2479,10 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2462
2479
  ...D
2463
2480
  },
2464
2481
  objectSchema: N,
2465
- objectName: q.objectName
2482
+ objectName: K.objectName
2466
2483
  }),
2467
- q.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2468
- schema: q.footer,
2484
+ K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2485
+ schema: K.footer,
2469
2486
  data: g
2470
2487
  }) })
2471
2488
  ]
@@ -2508,7 +2525,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2508
2525
  children: [/* @__PURE__ */ Z("span", {
2509
2526
  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",
2510
2527
  "aria-hidden": "true",
2511
- children: /* @__PURE__ */ Z(se, { className: "h-5 w-5" })
2528
+ children: /* @__PURE__ */ Z(ce, { className: "h-5 w-5" })
2512
2529
  }), /* @__PURE__ */ Q("div", {
2513
2530
  className: "flex-1",
2514
2531
  children: [/* @__PURE__ */ Z(h, { children: o("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(f, {
@@ -2563,14 +2580,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2563
2580
  type: "button",
2564
2581
  disabled: a,
2565
2582
  onClick: i,
2566
- className: G(W({ variant: "ghost" }), "mt-2 sm:mt-0"),
2583
+ className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
2567
2584
  children: o("detail.concurrentUpdateCancel")
2568
2585
  }),
2569
2586
  /* @__PURE__ */ Z("button", {
2570
2587
  type: "button",
2571
2588
  disabled: a,
2572
2589
  onClick: r,
2573
- className: G(W({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
2590
+ className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
2574
2591
  children: o("detail.concurrentUpdateOverwrite")
2575
2592
  }),
2576
2593
  /* @__PURE__ */ Z("button", {
@@ -2578,7 +2595,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2578
2595
  disabled: a,
2579
2596
  onClick: n,
2580
2597
  autoFocus: !0,
2581
- className: G(W({ variant: "default" }), "mt-2 sm:mt-0"),
2598
+ className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
2582
2599
  children: o("detail.concurrentUpdateReload")
2583
2600
  })
2584
2601
  ]
@@ -2735,7 +2752,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2735
2752
  hideEmpty: e.hideEmpty ?? !0,
2736
2753
  fields: j(E(w(e.fields)))
2737
2754
  };
2738
- }) : e.sections, ee = e.inlineEdit ?? !0, te = {
2755
+ }) : e.sections, P = e.inlineEdit ?? !0, ee = {
2739
2756
  type: "detail-view",
2740
2757
  objectName: r.objectName,
2741
2758
  resourceId: r.recordId,
@@ -2746,15 +2763,15 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2746
2763
  fields: M,
2747
2764
  showBack: !1,
2748
2765
  showHeader: e.showHeader ?? !1,
2749
- inlineEdit: ee
2766
+ inlineEdit: P
2750
2767
  };
2751
2768
  return /* @__PURE__ */ Q("div", {
2752
2769
  className: t,
2753
2770
  ...i,
2754
2771
  children: [/* @__PURE__ */ Z(Sn, {
2755
- schema: te,
2772
+ schema: ee,
2756
2773
  dataSource: r.dataSource,
2757
- inlineEdit: ee,
2774
+ inlineEdit: P,
2758
2775
  onFieldSave: g
2759
2776
  }), /* @__PURE__ */ Z(Tn, {
2760
2777
  open: !!d,
@@ -2832,6 +2849,8 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2832
2849
  add: e.add,
2833
2850
  rowActions: p?.rowActions,
2834
2851
  onRowAction: p?.onRowAction,
2852
+ toolbarActions: p?.toolbarActions,
2853
+ onToolbarAction: p?.onToolbarAction,
2835
2854
  onNew: p?.onCreate,
2836
2855
  onRowClick: p?.onView ? (e) => {
2837
2856
  let t = jn(e);
@@ -2891,7 +2910,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2891
2910
  }, In = ({ change: e, className: t }) => {
2892
2911
  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));
2893
2912
  return /* @__PURE__ */ Q("div", {
2894
- className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
2913
+ className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
2895
2914
  children: [
2896
2915
  /* @__PURE__ */ Z("span", {
2897
2916
  className: "font-medium text-foreground",
@@ -2901,7 +2920,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2901
2920
  className: "text-muted-foreground line-through",
2902
2921
  children: r
2903
2922
  }),
2904
- /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2923
+ /* @__PURE__ */ Z(ue, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2905
2924
  /* @__PURE__ */ Z("span", {
2906
2925
  className: "text-foreground",
2907
2926
  children: i
@@ -2920,10 +2939,10 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2920
2939
  t?.(e), o(!1);
2921
2940
  }, [t]);
2922
2941
  return /* @__PURE__ */ Q("div", {
2923
- className: G("flex items-center gap-1 flex-wrap", r),
2942
+ className: W("flex items-center gap-1 flex-wrap", r),
2924
2943
  children: [e.map((e) => /* @__PURE__ */ Q("button", {
2925
2944
  type: "button",
2926
- className: G("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
2945
+ className: W("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
2927
2946
  onClick: () => s(e.emoji),
2928
2947
  disabled: !t,
2929
2948
  "aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
@@ -2987,7 +3006,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
2987
3006
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
2988
3007
  }, [p]);
2989
3008
  return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
2990
- className: G("ml-10 mt-1", a),
3009
+ className: W("ml-10 mt-1", a),
2991
3010
  children: [
2992
3011
  t.length > 0 && /* @__PURE__ */ Q("button", {
2993
3012
  type: "button",
@@ -2996,7 +3015,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
2996
3015
  "aria-expanded": s,
2997
3016
  children: [
2998
3017
  Z(s ? ve : be, { className: "h-3 w-3" }),
2999
- /* @__PURE__ */ Z(X, { className: "h-3 w-3" }),
3018
+ /* @__PURE__ */ Z(ze, { className: "h-3 w-3" }),
3000
3019
  /* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
3001
3020
  ]
3002
3021
  }),
@@ -3067,12 +3086,12 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3067
3086
  return /* @__PURE__ */ Z(x, {
3068
3087
  variant: "ghost",
3069
3088
  size: "icon",
3070
- className: G("h-8 w-8", n),
3089
+ className: W("h-8 w-8", n),
3071
3090
  onClick: s,
3072
3091
  disabled: a || !t,
3073
3092
  "aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
3074
3093
  title: e.subscribed ? r("detail.subscribedTooltip") : r("detail.unsubscribedTooltip"),
3075
- children: e.subscribed ? /* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(pe, { className: "h-4 w-4 text-muted-foreground" })
3094
+ children: e.subscribed ? /* @__PURE__ */ Z(pe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(q, { className: "h-4 w-4 text-muted-foreground" })
3076
3095
  });
3077
3096
  };
3078
3097
  //#endregion
@@ -3142,7 +3161,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3142
3161
  n
3143
3162
  ]);
3144
3163
  return /* @__PURE__ */ Q("div", {
3145
- className: G("border rounded-md", o),
3164
+ className: W("border rounded-md", o),
3146
3165
  children: [
3147
3166
  /* @__PURE__ */ Q("div", {
3148
3167
  className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
@@ -3163,7 +3182,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3163
3182
  onClick: w,
3164
3183
  disabled: s || d,
3165
3184
  title: u("detail.italic"),
3166
- children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
3185
+ children: /* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" })
3167
3186
  }),
3168
3187
  /* @__PURE__ */ Z(x, {
3169
3188
  variant: "ghost",
@@ -3172,7 +3191,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3172
3191
  onClick: T,
3173
3192
  disabled: s || d,
3174
3193
  title: u("detail.listFormat"),
3175
- children: /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5" })
3194
+ children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
3176
3195
  }),
3177
3196
  /* @__PURE__ */ Z(x, {
3178
3197
  variant: "ghost",
@@ -3190,7 +3209,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3190
3209
  onClick: D,
3191
3210
  disabled: s || d,
3192
3211
  title: u("detail.mentionSomeone"),
3193
- children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
3212
+ children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
3194
3213
  }),
3195
3214
  /* @__PURE__ */ Z("div", { className: "flex-1" }),
3196
3215
  /* @__PURE__ */ Z(x, {
@@ -3199,7 +3218,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3199
3218
  className: "h-7 w-7",
3200
3219
  onClick: () => f(!d),
3201
3220
  title: u(d ? "detail.edit" : "detail.preview"),
3202
- children: Z(d ? Ee : Oe, { className: "h-3.5 w-3.5" })
3221
+ children: Z(d ? Ee : J, { className: "h-3.5 w-3.5" })
3203
3222
  }),
3204
3223
  n && /* @__PURE__ */ Z(x, {
3205
3224
  variant: "ghost",
@@ -3229,7 +3248,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3229
3248
  className: "absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto",
3230
3249
  children: b.map((e, t) => /* @__PURE__ */ Q("button", {
3231
3250
  type: "button",
3232
- className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
3251
+ className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
3233
3252
  onMouseDown: (t) => {
3234
3253
  t.preventDefault(), O(e);
3235
3254
  },
@@ -3260,7 +3279,7 @@ function Gn(e) {
3260
3279
  return e.startsWith("image/");
3261
3280
  }
3262
3281
  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;
3282
+ return Gn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? Ae : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : ke;
3264
3283
  }
3265
3284
  var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
3266
3285
  let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
@@ -3273,9 +3292,9 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3273
3292
  t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
3274
3293
  }, [t]);
3275
3294
  return /* @__PURE__ */ Q("div", {
3276
- className: G("space-y-2", r),
3295
+ className: W("space-y-2", r),
3277
3296
  children: [t && !a && /* @__PURE__ */ Q("div", {
3278
- className: G("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
3297
+ className: W("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
3279
3298
  onDragOver: u,
3280
3299
  onDragLeave: d,
3281
3300
  onDrop: f,
@@ -3344,12 +3363,12 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3344
3363
  })]
3345
3364
  });
3346
3365
  }, Jn = {
3347
- comment: X,
3366
+ comment: ze,
3348
3367
  field_change: Ee,
3349
3368
  task: _e,
3350
3369
  event: he,
3351
3370
  system: rt,
3352
- email: ze,
3371
+ email: Re,
3353
3372
  call: We
3354
3373
  }, Yn = {
3355
3374
  comment: "bg-purple-100 text-purple-600",
@@ -3402,17 +3421,17 @@ function Qn(e, t) {
3402
3421
  }
3403
3422
  }
3404
3423
  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(() => {
3406
- if (!R) return /* @__PURE__ */ new Map();
3424
+ 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([]), [ne, re] = i.useState(!1), ie = n ?? b, ae = t?.showFilterToggle !== !1, F = t?.showCommentInput !== !1 && !!c, I = t?.enableReactions ?? !1, L = t?.enableThreading ?? !1, R = t?.showSubscriptionToggle ?? !1, z = i.useMemo(() => Qn(e, ie), [e, ie]), B = i.useMemo(() => L ? z.filter((e) => !e.parentId) : z, [z, L]), V = i.useMemo(() => {
3425
+ if (!L) return /* @__PURE__ */ new Map();
3407
3426
  let e = /* @__PURE__ */ new Map();
3408
- for (let t of B) if (t.parentId) {
3427
+ for (let t of z) if (t.parentId) {
3409
3428
  let n = e.get(t.parentId) ?? [];
3410
3429
  n.push(t), e.set(t.parentId, n);
3411
3430
  }
3412
3431
  return e;
3413
- }, [B, R]), ae = i.useCallback((e) => {
3432
+ }, [z, L]), oe = i.useCallback((e) => {
3414
3433
  r ? r(e) : S(e);
3415
- }, [r]), U = i.useCallback(async () => {
3434
+ }, [r]), H = i.useCallback(async () => {
3416
3435
  let e = C.trim();
3417
3436
  if (c && !(!e && A.length === 0)) {
3418
3437
  E(!0);
@@ -3426,19 +3445,19 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3426
3445
  C,
3427
3446
  A,
3428
3447
  c
3429
- ]), W = i.useCallback(async (e) => {
3448
+ ]), U = i.useCallback(async (e) => {
3430
3449
  if (!(!h || e.length === 0)) {
3431
- ie(!0);
3450
+ re(!0);
3432
3451
  try {
3433
3452
  let t = await h(e);
3434
3453
  Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
3435
3454
  } finally {
3436
- ie(!1);
3455
+ re(!1);
3437
3456
  }
3438
3457
  }
3439
- }, [h]), oe = i.useCallback((e) => {
3458
+ }, [h]), se = i.useCallback((e) => {
3440
3459
  j((t) => t.filter((t) => t.id !== e));
3441
- }, []), se = i.useCallback(async () => {
3460
+ }, []), ce = i.useCallback(async () => {
3442
3461
  if (o) {
3443
3462
  O(!0);
3444
3463
  try {
@@ -3449,7 +3468,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3449
3468
  }
3450
3469
  }, [o]);
3451
3470
  return /* @__PURE__ */ Q("section", {
3452
- className: G("border-t border-border/60 pt-5", v),
3471
+ className: W("border-t border-border/60 pt-5", v),
3453
3472
  "aria-label": "Discussion",
3454
3473
  children: [/* @__PURE__ */ Z("header", {
3455
3474
  className: "mb-4",
@@ -3458,20 +3477,20 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3458
3477
  children: [/* @__PURE__ */ Q("h2", {
3459
3478
  className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
3460
3479
  children: [
3461
- /* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
3480
+ /* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
3462
3481
  g ?? y("detail.activity"),
3463
3482
  /* @__PURE__ */ Q("span", {
3464
3483
  className: "text-sm font-normal text-muted-foreground",
3465
3484
  children: [
3466
3485
  "(",
3467
- B.length,
3486
+ z.length,
3468
3487
  ")"
3469
3488
  ]
3470
3489
  })
3471
3490
  ]
3472
3491
  }), /* @__PURE__ */ Z("div", {
3473
3492
  className: "flex items-center gap-1",
3474
- children: z && d && /* @__PURE__ */ Z(Vn, {
3493
+ children: R && d && /* @__PURE__ */ Z(Vn, {
3475
3494
  subscription: d,
3476
3495
  onToggle: f
3477
3496
  })
@@ -3480,53 +3499,53 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3480
3499
  }), /* @__PURE__ */ Q("div", {
3481
3500
  className: "space-y-4",
3482
3501
  children: [
3483
- F && /* @__PURE__ */ Z("div", {
3502
+ ae && /* @__PURE__ */ Z("div", {
3484
3503
  className: "flex items-center gap-2",
3485
3504
  children: /* @__PURE__ */ Q(M, {
3486
- value: P,
3487
- onValueChange: (e) => ae(e),
3488
- children: [/* @__PURE__ */ Z(te, {
3505
+ value: ie,
3506
+ onValueChange: (e) => oe(e),
3507
+ children: [/* @__PURE__ */ Z(ee, {
3489
3508
  "aria-label": y("detail.filterActivity"),
3490
3509
  className: "h-8 w-auto min-w-[140px] py-1 text-sm",
3491
- children: /* @__PURE__ */ Z(ne, {})
3492
- }), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(ee, {
3510
+ children: /* @__PURE__ */ Z(te, {})
3511
+ }), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(P, {
3493
3512
  value: e.value,
3494
3513
  children: e.label
3495
3514
  }, e.value)) })]
3496
3515
  })
3497
3516
  }),
3498
- I && /* @__PURE__ */ Z(Un, {
3517
+ F && /* @__PURE__ */ Z(Un, {
3499
3518
  value: C,
3500
3519
  onChange: w,
3501
- onSubmit: U,
3520
+ onSubmit: H,
3502
3521
  mentionSuggestions: m,
3503
3522
  placeholder: y("detail.leaveCommentPlaceholder"),
3504
3523
  disabled: T,
3505
3524
  canSubmitEmpty: A.length > 0,
3506
3525
  extraSlot: h ? /* @__PURE__ */ Z(qn, {
3507
3526
  attachments: A,
3508
- onUpload: W,
3509
- onRemove: oe,
3510
- readOnly: T || re
3527
+ onUpload: U,
3528
+ onRemove: se,
3529
+ readOnly: T || ne
3511
3530
  }) : A.length > 0 ? /* @__PURE__ */ Z(qn, {
3512
3531
  attachments: A,
3513
- onRemove: oe,
3532
+ onRemove: se,
3514
3533
  readOnly: T
3515
3534
  }) : void 0
3516
3535
  }),
3517
- B.length === 0 ? p ? null : /* @__PURE__ */ Z(k, {
3536
+ z.length === 0 ? p ? null : /* @__PURE__ */ Z(k, {
3518
3537
  title: _ ?? y("detail.noActivity"),
3519
3538
  className: "py-6"
3520
3539
  }) : /* @__PURE__ */ Q("div", {
3521
3540
  className: "relative",
3522
3541
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
3523
3542
  className: "space-y-4",
3524
- children: V.map((e) => {
3525
- let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
3543
+ children: B.map((e) => {
3544
+ let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = V.get(e.id) ?? [];
3526
3545
  return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
3527
3546
  className: "flex gap-3 relative",
3528
3547
  children: [/* @__PURE__ */ Z("div", {
3529
- className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3548
+ className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3530
3549
  children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
3531
3550
  src: e.actorAvatarUrl,
3532
3551
  alt: e.actor,
@@ -3577,14 +3596,14 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3577
3596
  className: "space-y-1 mt-1",
3578
3597
  children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(In, { change: e }, t))
3579
3598
  }),
3580
- L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3599
+ I && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3581
3600
  className: "mt-1.5",
3582
3601
  children: /* @__PURE__ */ Z(Rn, {
3583
3602
  reactions: e.reactions,
3584
3603
  onToggleReaction: u ? (t) => u(e.id, t) : void 0
3585
3604
  })
3586
3605
  }),
3587
- L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3606
+ I && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3588
3607
  className: "mt-1.5",
3589
3608
  children: /* @__PURE__ */ Z(Rn, {
3590
3609
  reactions: [],
@@ -3593,7 +3612,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3593
3612
  })
3594
3613
  ]
3595
3614
  })]
3596
- }), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
3615
+ }), L && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
3597
3616
  parentItem: e,
3598
3617
  replies: r,
3599
3618
  onAddReply: l,
@@ -3607,10 +3626,10 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3607
3626
  children: /* @__PURE__ */ Q(x, {
3608
3627
  variant: "ghost",
3609
3628
  size: "sm",
3610
- onClick: se,
3629
+ onClick: ce,
3611
3630
  disabled: D,
3612
3631
  "aria-label": y("detail.loadMore"),
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")]
3632
+ children: [D ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ve, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
3614
3633
  })
3615
3634
  })
3616
3635
  ]
@@ -3640,7 +3659,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3640
3659
  }, 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 }) => {
3641
3660
  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);
3642
3661
  return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
3643
- className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
3662
+ className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
3644
3663
  children: /* @__PURE__ */ Z(x, {
3645
3664
  variant: "ghost",
3646
3665
  size: "icon",
@@ -3650,7 +3669,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3650
3669
  children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
3651
3670
  })
3652
3671
  }) : /* @__PURE__ */ Q("div", {
3653
- className: G("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
3672
+ className: W("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
3654
3673
  style: {
3655
3674
  width: v,
3656
3675
  minWidth: v
@@ -3659,7 +3678,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3659
3678
  className: "flex items-center justify-between px-4 py-3 border-b",
3660
3679
  children: [/* @__PURE__ */ Q("div", {
3661
3680
  className: "flex items-center gap-2",
3662
- children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
3681
+ children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
3663
3682
  className: "text-sm font-medium",
3664
3683
  children: S("detail.discussion")
3665
3684
  })]
@@ -3695,18 +3714,18 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3695
3714
  })
3696
3715
  })]
3697
3716
  }) : /* @__PURE__ */ Z("div", {
3698
- className: G("", g),
3717
+ className: W("", g),
3699
3718
  children: y && C ? /* @__PURE__ */ Q(x, {
3700
3719
  variant: "ghost",
3701
3720
  className: "w-full justify-start gap-2 text-muted-foreground",
3702
3721
  onClick: () => w(!1),
3703
3722
  "aria-label": S("detail.showDiscussion", { count: t.length }),
3704
- children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
3723
+ children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
3705
3724
  }) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
3706
3725
  className: "flex items-center justify-between mb-2",
3707
3726
  children: [/* @__PURE__ */ Q("div", {
3708
3727
  className: "flex items-center gap-2 text-sm font-medium",
3709
- children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), S("detail.discussion")]
3728
+ children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), S("detail.discussion")]
3710
3729
  }), /* @__PURE__ */ Z(x, {
3711
3730
  variant: "ghost",
3712
3731
  size: "icon",
@@ -3811,7 +3830,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3811
3830
  });
3812
3831
  let b = h.length - 1;
3813
3832
  return /* @__PURE__ */ Q("div", {
3814
- className: G("w-full", t),
3833
+ className: W("w-full", t),
3815
3834
  ...o,
3816
3835
  children: [/* @__PURE__ */ Q("div", {
3817
3836
  className: "hidden sm:flex w-full items-stretch gap-2",
@@ -3824,7 +3843,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3824
3843
  return /* @__PURE__ */ Z("div", {
3825
3844
  role: "listitem",
3826
3845
  "aria-current": r ? "step" : void 0,
3827
- className: G("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
3846
+ className: W("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
3828
3847
  children: /* @__PURE__ */ Q("span", {
3829
3848
  className: "inline-flex items-center justify-center gap-1.5 truncate",
3830
3849
  children: [
@@ -3851,7 +3870,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3851
3870
  return /* @__PURE__ */ Z("div", {
3852
3871
  role: "listitem",
3853
3872
  "aria-current": n ? "step" : void 0,
3854
- className: G("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
3873
+ className: W("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
3855
3874
  children: /* @__PURE__ */ Q("span", {
3856
3875
  className: "inline-flex items-center gap-1",
3857
3876
  children: [/* @__PURE__ */ Z("span", {
@@ -3872,7 +3891,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3872
3891
  return /* @__PURE__ */ Z("div", {
3873
3892
  role: "listitem",
3874
3893
  "aria-current": i ? "step" : void 0,
3875
- className: G("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
3894
+ className: W("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
3876
3895
  children: /* @__PURE__ */ Q("span", {
3877
3896
  className: "inline-flex items-center gap-1",
3878
3897
  children: [
@@ -3936,7 +3955,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3936
3955
  });
3937
3956
  let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
3938
3957
  return /* @__PURE__ */ Z("div", {
3939
- className: G("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
3958
+ className: W("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
3940
3959
  role: "toolbar",
3941
3960
  "aria-label": e.aria?.label || "Quick actions",
3942
3961
  ...i,
@@ -3966,7 +3985,7 @@ function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3966
3985
  c(!1);
3967
3986
  }
3968
3987
  },
3969
- children: [s && /* @__PURE__ */ Z(Le, { className: "mr-2 h-4 w-4 animate-spin" }), i]
3988
+ children: [s && /* @__PURE__ */ Z(Ie, { className: "mr-2 h-4 w-4 animate-spin" }), i]
3970
3989
  });
3971
3990
  }
3972
3991
  //#endregion
@@ -4000,7 +4019,8 @@ var ur = (e) => {
4000
4019
  $orderby: { timestamp: "desc" },
4001
4020
  $top: Math.max(1, l)
4002
4021
  })).then((t) => {
4003
- e || h((t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
4022
+ if (e) return;
4023
+ let n = (t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
4004
4024
  let t = e.timestamp;
4005
4025
  return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
4006
4026
  id: e.id,
@@ -4010,7 +4030,8 @@ var ur = (e) => {
4010
4030
  user_avatar: e.actor_avatar_url ?? null,
4011
4031
  summary: e.summary ?? null
4012
4032
  };
4013
- }));
4033
+ });
4034
+ h(n);
4014
4035
  }).catch(() => {
4015
4036
  e || h([]);
4016
4037
  }).finally(() => {
@@ -4130,7 +4151,7 @@ var ur = (e) => {
4130
4151
  }) : mr(e.objectName)));
4131
4152
  return /* @__PURE__ */ Q("div", {
4132
4153
  ref: m,
4133
- className: G("flex flex-col gap-3", e.className, t),
4154
+ className: W("flex flex-col gap-3", e.className, t),
4134
4155
  ...s,
4135
4156
  children: [k.map((e) => {
4136
4157
  let t = e.objectName, n = f[t] || {
@@ -4166,9 +4187,9 @@ var ur = (e) => {
4166
4187
  children: n.loading ? /* @__PURE__ */ Q("div", {
4167
4188
  className: "space-y-1.5 p-3",
4168
4189
  children: [
4169
- /* @__PURE__ */ Z(I, { className: "h-3.5 w-4/5" }),
4170
- /* @__PURE__ */ Z(I, { className: "h-3.5 w-3/5" }),
4171
- /* @__PURE__ */ Z(I, { className: "h-3.5 w-2/3" })
4190
+ /* @__PURE__ */ Z(F, { className: "h-3.5 w-4/5" }),
4191
+ /* @__PURE__ */ Z(F, { className: "h-3.5 w-3/5" }),
4192
+ /* @__PURE__ */ Z(F, { className: "h-3.5 w-2/3" })
4172
4193
  ]
4173
4194
  }) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
4174
4195
  className: "px-4 py-3 text-xs text-muted-foreground",
@@ -4273,7 +4294,7 @@ var yr = ({ schema: e = {}, className: t }) => {
4273
4294
  }
4274
4295
  });
4275
4296
  return _ || !a || Object.keys(a).length === 0 || p !== void 0 && !m ? null : /* @__PURE__ */ Q(o, {
4276
- className: G("relative pr-12", d.wrap, t),
4297
+ className: W("relative pr-12", d.wrap, t),
4277
4298
  role: u === "error" ? "alert" : "status",
4278
4299
  "aria-live": u === "error" ? "assertive" : "polite",
4279
4300
  children: [
@@ -4389,12 +4410,12 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4389
4410
  description: t.description
4390
4411
  };
4391
4412
  });
4392
- return /* @__PURE__ */ Z(re, {
4413
+ return /* @__PURE__ */ Z(ne, {
4393
4414
  open: e,
4394
4415
  onOpenChange: (e) => {
4395
4416
  e || t();
4396
4417
  },
4397
- children: /* @__PURE__ */ Q(ie, {
4418
+ children: /* @__PURE__ */ Q(re, {
4398
4419
  side: "right",
4399
4420
  className: "w-full overflow-y-auto p-0 sm:!max-w-none",
4400
4421
  style: x,
@@ -4407,9 +4428,9 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4407
4428
  onPointerDown: C,
4408
4429
  className: "hidden sm:block absolute left-0 top-0 h-full w-1.5 cursor-col-resize select-none bg-transparent hover:bg-primary/30 active:bg-primary/50 transition-colors z-10"
4409
4430
  }),
4410
- /* @__PURE__ */ Z(P, {
4431
+ /* @__PURE__ */ Z(ie, {
4411
4432
  className: "sr-only",
4412
- children: /* @__PURE__ */ Z(F, { children: n })
4433
+ children: /* @__PURE__ */ Z(ae, { children: n })
4413
4434
  }),
4414
4435
  /* @__PURE__ */ Z("div", {
4415
4436
  className: "px-6 pt-6 pb-6",
@@ -4472,7 +4493,8 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4472
4493
  if (g(e), o && e.trim().length >= 2) {
4473
4494
  D(!0);
4474
4495
  try {
4475
- v(await o(e));
4496
+ let t = await o(e);
4497
+ v(t);
4476
4498
  } finally {
4477
4499
  D(!1);
4478
4500
  }
@@ -4507,9 +4529,9 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4507
4529
  b(!1);
4508
4530
  }
4509
4531
  }
4510
- }, [a]), ee = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
4532
+ }, [a]), P = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
4511
4533
  return l ? /* @__PURE__ */ Q(S, {
4512
- className: G("", c),
4534
+ className: W("", c),
4513
4535
  children: [/* @__PURE__ */ Z(w, {
4514
4536
  className: "pb-3",
4515
4537
  children: /* @__PURE__ */ Q(T, {
@@ -4526,23 +4548,23 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4526
4548
  children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
4527
4549
  })]
4528
4550
  })
4529
- }), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(L, {
4551
+ }), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(I, {
4530
4552
  value: d,
4531
4553
  onValueChange: f,
4532
4554
  children: [
4533
- /* @__PURE__ */ Q(z, {
4555
+ /* @__PURE__ */ Q(R, {
4534
4556
  className: "mb-3 w-full",
4535
- children: [r && /* @__PURE__ */ Q(B, {
4557
+ children: [r && /* @__PURE__ */ Q(z, {
4536
4558
  value: "create",
4537
4559
  className: "flex-1 gap-1.5",
4538
4560
  children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), "Create New"]
4539
- }), a && /* @__PURE__ */ Q(B, {
4561
+ }), a && /* @__PURE__ */ Q(z, {
4540
4562
  value: "link",
4541
4563
  className: "flex-1 gap-1.5",
4542
- children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
4564
+ children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
4543
4565
  })]
4544
4566
  }),
4545
- r && /* @__PURE__ */ Q(R, {
4567
+ r && /* @__PURE__ */ Q(L, {
4546
4568
  value: "create",
4547
4569
  className: "space-y-3 mt-0",
4548
4570
  children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
@@ -4567,13 +4589,13 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4567
4589
  }), /* @__PURE__ */ Q(x, {
4568
4590
  size: "sm",
4569
4591
  onClick: M,
4570
- disabled: !ee || y,
4592
+ disabled: !P || y,
4571
4593
  className: "gap-1.5",
4572
- children: [y && /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
4594
+ children: [y && /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
4573
4595
  })]
4574
4596
  })]
4575
4597
  }),
4576
- a && /* @__PURE__ */ Q(R, {
4598
+ a && /* @__PURE__ */ Q(L, {
4577
4599
  value: "link",
4578
4600
  className: "space-y-3 mt-0",
4579
4601
  children: [/* @__PURE__ */ Q("div", {
@@ -4588,7 +4610,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4588
4610
  className: "max-h-48 overflow-y-auto space-y-1",
4589
4611
  children: E ? /* @__PURE__ */ Q("div", {
4590
4612
  className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
4591
- children: [/* @__PURE__ */ Z(Le, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
4613
+ children: [/* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
4592
4614
  }) : O.length === 0 ? /* @__PURE__ */ Z("p", {
4593
4615
  className: "text-sm text-muted-foreground text-center py-4",
4594
4616
  children: h ? "No records found" : "Type to search records"
@@ -4610,7 +4632,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4610
4632
  ]
4611
4633
  }) })]
4612
4634
  }) : /* @__PURE__ */ Q("div", {
4613
- className: G("flex gap-2", c),
4635
+ className: W("flex gap-2", c),
4614
4636
  children: [r && /* @__PURE__ */ Q(x, {
4615
4637
  variant: "outline",
4616
4638
  size: "sm",
@@ -4630,7 +4652,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4630
4652
  f("link"), u(!0);
4631
4653
  },
4632
4654
  className: "gap-1.5",
4633
- children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
4655
+ children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
4634
4656
  })]
4635
4657
  });
4636
4658
  };
@@ -4707,7 +4729,7 @@ var Or = {
4707
4729
  return e;
4708
4730
  }, [c, f]);
4709
4731
  return /* @__PURE__ */ Q(S, {
4710
- className: G("overflow-hidden", o),
4732
+ className: W("overflow-hidden", o),
4711
4733
  children: [/* @__PURE__ */ Z(w, {
4712
4734
  className: "pb-2",
4713
4735
  children: /* @__PURE__ */ Q(T, {
@@ -4739,7 +4761,7 @@ var Or = {
4739
4761
  children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
4740
4762
  className: "font-mono text-xs overflow-x-auto",
4741
4763
  children: f.map((e, t) => /* @__PURE__ */ Q("div", {
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"),
4764
+ className: W("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"),
4743
4765
  children: [/* @__PURE__ */ Z("span", {
4744
4766
  className: "select-none mr-2 inline-block w-3 text-center opacity-60",
4745
4767
  children: kr[e.type]
@@ -4759,10 +4781,10 @@ var Or = {
4759
4781
  children: s("detail.currentVersion")
4760
4782
  }),
4761
4783
  m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
4762
- className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
4784
+ className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
4763
4785
  children: e.left?.value ?? ""
4764
4786
  }), /* @__PURE__ */ Z("div", {
4765
- className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
4787
+ className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
4766
4788
  children: e.right?.value ?? ""
4767
4789
  })] }, t))
4768
4790
  ]
@@ -4841,7 +4863,7 @@ var Or = {
4841
4863
  r,
4842
4864
  a
4843
4865
  ]), /* @__PURE__ */ Q("div", {
4844
- className: G("flex items-center gap-1.5", o),
4866
+ className: W("flex items-center gap-1.5", o),
4845
4867
  children: [
4846
4868
  /* @__PURE__ */ Z(x, {
4847
4869
  variant: "outline",
@@ -5012,7 +5034,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5012
5034
  s
5013
5035
  ]);
5014
5036
  return /* @__PURE__ */ Q(S, {
5015
- className: G("overflow-hidden", a),
5037
+ className: W("overflow-hidden", a),
5016
5038
  children: [/* @__PURE__ */ Z(w, {
5017
5039
  className: "pb-2",
5018
5040
  children: /* @__PURE__ */ Q(T, {
@@ -5049,7 +5071,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5049
5071
  }, `edge-${t}`)), d.map((e) => {
5050
5072
  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;
5051
5073
  return /* @__PURE__ */ Q("g", {
5052
- className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
5074
+ className: W("cursor-pointer transition-transform", r && "hover:opacity-80"),
5053
5075
  onClick: () => r?.(e.id),
5054
5076
  onMouseEnter: () => u(e.id),
5055
5077
  onMouseLeave: () => u(null),
@@ -5068,7 +5090,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5068
5090
  y: e.y,
5069
5091
  textAnchor: "middle",
5070
5092
  dominantBaseline: "central",
5071
- className: G("text-[10px] font-medium pointer-events-none", i),
5093
+ className: W("text-[10px] font-medium pointer-events-none", i),
5072
5094
  children: Ir(e.label)
5073
5095
  }),
5074
5096
  e.type && /* @__PURE__ */ Z("text", {
@@ -5137,13 +5159,13 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5137
5159
  c(!1);
5138
5160
  }, []);
5139
5161
  return /* @__PURE__ */ Q(S, {
5140
- className: G("", r),
5162
+ className: W("", r),
5141
5163
  children: [/* @__PURE__ */ Z(w, {
5142
5164
  className: "pb-3",
5143
5165
  children: /* @__PURE__ */ Q(T, {
5144
5166
  className: "flex items-center gap-2 text-base",
5145
5167
  children: [
5146
- /* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
5168
+ /* @__PURE__ */ Z(je, { className: "h-4 w-4" }),
5147
5169
  "Revision History",
5148
5170
  /* @__PURE__ */ Q("span", {
5149
5171
  className: "text-sm font-normal text-muted-foreground",
@@ -5170,12 +5192,12 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5170
5192
  let t = e.id === a;
5171
5193
  return /* @__PURE__ */ Q("button", {
5172
5194
  type: "button",
5173
- className: G("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
5195
+ className: W("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
5174
5196
  onClick: () => {
5175
5197
  o(e.id), c(!1);
5176
5198
  },
5177
5199
  children: [/* @__PURE__ */ Z("div", {
5178
- className: G("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
5200
+ className: W("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
5179
5201
  children: t && /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-primary-foreground" })
5180
5202
  }), /* @__PURE__ */ Q("div", {
5181
5203
  className: "flex-1 min-w-0",
@@ -5208,7 +5230,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5208
5230
  children: [
5209
5231
  /* @__PURE__ */ Q("div", {
5210
5232
  className: "flex items-center gap-2 text-sm font-medium",
5211
- children: [/* @__PURE__ */ Z(Oe, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
5233
+ children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
5212
5234
  }),
5213
5235
  /* @__PURE__ */ Z("div", {
5214
5236
  className: "space-y-2",
@@ -5305,7 +5327,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5305
5327
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
5306
5328
  }, [l]);
5307
5329
  return /* @__PURE__ */ Q("div", {
5308
- className: G("flex gap-2", r),
5330
+ className: W("flex gap-2", r),
5309
5331
  children: [/* @__PURE__ */ Z("textarea", {
5310
5332
  className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
5311
5333
  placeholder: t,
@@ -5330,14 +5352,14 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5330
5352
  return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
5331
5353
  }, [e, t]);
5332
5354
  return !r || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
5333
- className: G("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
5355
+ className: W("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
5334
5356
  role: "listbox",
5335
5357
  "aria-label": "Mention suggestions",
5336
5358
  children: s.map((e, t) => /* @__PURE__ */ Q("button", {
5337
5359
  type: "button",
5338
5360
  role: "option",
5339
5361
  "aria-selected": t === a,
5340
- className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
5362
+ className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
5341
5363
  onMouseDown: (t) => {
5342
5364
  t.preventDefault(), n(e);
5343
5365
  },
@@ -5532,7 +5554,7 @@ function Zr(e) {
5532
5554
  ...t.reference_field ? { reference_field: t.reference_field } : {},
5533
5555
  ...t.currency ? { currency: t.currency } : {}
5534
5556
  };
5535
- };
5557
+ }, i = Lt(t.reduce((e, t) => e + t.fields.length, 0));
5536
5558
  return t.map((e) => ({
5537
5559
  ...e.key === void 0 ? {} : {
5538
5560
  name: e.key,
@@ -5540,6 +5562,7 @@ function Zr(e) {
5540
5562
  },
5541
5563
  ...e.collapse === "none" ? {} : { collapsible: !0 },
5542
5564
  ...e.collapse === "collapsed" ? { defaultCollapsed: !0 } : {},
5565
+ columns: i,
5543
5566
  fields: e.fields.map(r)
5544
5567
  }));
5545
5568
  }