@object-ui/plugin-detail 5.0.0 → 5.0.2

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,14 +1,14 @@
1
1
  import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
2
2
  import * as n from "react";
3
3
  import r from "react";
4
- import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, Tabs as A, TabsContent as j, TabsList as ee, TabsTrigger as M, Tooltip as N, TooltipContent as P, TooltipProvider as F, TooltipTrigger as I, cn as L, useIsMobile as te } from "@object-ui/components";
5
- import { Activity as ne, ArrowLeft as R, ArrowRight as z, ArrowRightLeft as B, ArrowUpDown as re, AtSign as V, Bell as H, BellOff as ie, Bold as U, Calendar as ae, Check as W, CheckSquare as oe, ChevronDown as se, ChevronLeft as ce, ChevronRight as le, ChevronsLeft as ue, ChevronsRight as de, Code as fe, Columns2 as pe, Copy as me, Edit as he, ExternalLink as ge, Eye as G, EyeOff as _e, File as ve, FileArchive as ye, FileText as K, History as be, Image as xe, Inbox as Se, Italic as q, Link as Ce, List as we, Loader2 as Te, Mail as Ee, MessageSquare as J, Network as De, PanelRightClose as Oe, PanelRightOpen as ke, Paperclip as Y, Phone as Ae, Pin as je, Plus as Me, PlusCircle as Ne, RotateCcw as Pe, Rows3 as Fe, Search as Ie, Send as X, SmilePlus as Le, Star as Re, Trash2 as ze, Upload as Be, X as Ve, Zap as He, icons as Ue } from "lucide-react";
6
- import { SchemaRenderer as We, useActionEngine as Ge, useDiscussionContext as Ke, useHighlightFieldNames as qe, useObjectTranslation as Je, useRecordContext as Ye, useRegisterHighlightFields as Xe, useSafeFieldLabel as Ze } from "@object-ui/react";
7
- import { BooleanField as Qe, SelectField as $e, getCellRenderer as et, resolveCellRendererType as tt } from "@object-ui/fields";
8
- import { Fragment as nt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
9
- import { useFieldPermissions as rt, usePermissions as it } from "@object-ui/permissions";
4
+ import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k, Sheet as A, SheetContent as j, SheetHeader as M, SheetTitle as N, Skeleton as P, Tabs as ee, TabsContent as F, TabsList as I, TabsTrigger as L, Tooltip as R, TooltipContent as z, TooltipProvider as B, TooltipTrigger as V, cn as H, useIsMobile as te } from "@object-ui/components";
5
+ import { Activity as U, ArrowLeft as ne, ArrowRight as W, ArrowRightLeft as re, ArrowUpDown as ie, AtSign as G, Bell as ae, BellOff as oe, Bold as K, Calendar as se, Check as ce, CheckSquare as le, ChevronDown as ue, ChevronLeft as de, ChevronRight as fe, ChevronsLeft as q, ChevronsRight as pe, Code as me, Columns2 as he, Copy as ge, Edit as J, ExternalLink as _e, Eye as ve, EyeOff as ye, File as be, FileArchive as Y, FileText as xe, History as Se, Image as Ce, Inbox as X, Italic as we, Link as Te, List as Ee, Loader2 as De, Lock as Oe, Mail as ke, MessageSquare as Ae, Network as je, PanelRightClose as Me, PanelRightOpen as Ne, Paperclip as Pe, Phone as Fe, Pin as Ie, Plus as Le, PlusCircle as Re, RotateCcw as ze, Rows3 as Be, Search as Ve, Send as He, SmilePlus as Ue, Star as We, Trash2 as Ge, Upload as Ke, X as qe, Zap as Je, icons as Ye } from "lucide-react";
6
+ import { SchemaRenderer as Xe, useActionEngine as Ze, useDiscussionContext as Qe, useHighlightFieldNames as $e, useObjectTranslation as et, useRecordContext as tt, useRegisterHighlightFields as nt, useSafeFieldLabel as rt } from "@object-ui/react";
7
+ import { BooleanField as it, SelectField as at, getCellRenderer as ot, humanizeLabel as st, resolveCellRendererType as ct } from "@object-ui/fields";
8
+ import { Fragment as lt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
9
+ import { useFieldPermissions as ut, usePermissions as dt } from "@object-ui/permissions";
10
10
  //#region src/autoLayout.ts
11
- var at = new Set([
11
+ var ft = new Set([
12
12
  "textarea",
13
13
  "markdown",
14
14
  "html",
@@ -20,36 +20,36 @@ var at = new Set([
20
20
  "field:grid",
21
21
  "field:rich-text"
22
22
  ]);
23
- function ot(e) {
24
- return at.has(e);
23
+ function pt(e) {
24
+ return ft.has(e);
25
25
  }
26
- function st(e, t) {
26
+ function mt(e, t) {
27
27
  let n;
28
28
  return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
29
29
  }
30
- function ct(e, t) {
31
- return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && ot(e.type) ? {
30
+ function ht(e, t) {
31
+ return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && pt(e.type) ? {
32
32
  ...e,
33
33
  span: t
34
34
  } : e);
35
35
  }
36
- function lt(e, t, n) {
36
+ function gt(e, t, n) {
37
37
  if (t !== void 0) return {
38
- fields: ct(e, t),
38
+ fields: ht(e, t),
39
39
  columns: t
40
40
  };
41
- let r = st(e.length, n);
41
+ let r = mt(e.length, n);
42
42
  return {
43
- fields: ct(e, r),
43
+ fields: ht(e, r),
44
44
  columns: r
45
45
  };
46
46
  }
47
47
  //#endregion
48
48
  //#region src/useDetailTranslation.ts
49
- function ut(e, t) {
49
+ function _t(e, t) {
50
50
  return function() {
51
51
  try {
52
- let n = Je();
52
+ let n = et();
53
53
  return n.t(t) === t ? { t: (t, n) => {
54
54
  let r = e[t] || t;
55
55
  if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
@@ -64,7 +64,7 @@ function ut(e, t) {
64
64
  }
65
65
  };
66
66
  }
67
- var dt = {
67
+ var vt = {
68
68
  "detail.back": "Back",
69
69
  "detail.edit": "Edit",
70
70
  "detail.editInline": "Edit",
@@ -101,6 +101,7 @@ var dt = {
101
101
  "detail.viewAll": "View All",
102
102
  "detail.new": "New",
103
103
  "detail.emptyValue": "—",
104
+ "detail.noValue": "No value",
104
105
  "detail.activity": "Activity",
105
106
  "detail.copyRecordId": "Copy record ID",
106
107
  "detail.showEmptyFields": "Show {{count}} empty fields",
@@ -177,14 +178,14 @@ var dt = {
177
178
  "detail.subscribeAriaLabel": "Subscribe to notifications",
178
179
  "detail.unsubscribeAriaLabel": "Unsubscribe from notifications",
179
180
  "detail.clearSearch": "Clear search"
180
- }, $ = ut(dt, "detail.back");
181
+ }, $ = _t(vt, "detail.back");
181
182
  //#endregion
182
183
  //#region src/DetailSection.tsx
183
- function ft(e, t) {
184
+ function yt(e, t) {
184
185
  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" : "";
185
186
  }
186
- var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
187
- let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = Ze(), k = n.useCallback((e, t) => {
187
+ var bt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
188
+ let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = rt(), k = n.useCallback((e, t) => {
188
189
  let n = t == null ? "" : String(t);
189
190
  navigator.clipboard.writeText(n).then(() => {
190
191
  f(e), setTimeout(() => f(null), 2e3);
@@ -192,18 +193,18 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
192
193
  }, []), A = n.useCallback((e) => {
193
194
  let n = t?.[e.name] ?? e.value;
194
195
  return n == null || n === "";
195
- }, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee = te(), M = ee ? 3 : 4, ne = ee ? .2 : .25, R = e.fields.length - j, z = !e.hideEmpty && !o && e.fields.length >= M && j / e.fields.length >= ne && R > 0, B = !w && (e.hideEmpty || z) ? e.fields.filter((e) => !A(e)) : e.fields;
196
- if (B.length === 0 && j === e.fields.length) return null;
197
- let { fields: re, columns: V } = lt(B, e.columns), H = (e) => {
196
+ }, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = te(), N = M ? 3 : 4, P = M ? .2 : .25, ee = e.fields.length - j, F = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= P && ee > 0, I = !w && (e.hideEmpty || F) ? e.fields.filter((e) => !A(e)) : e.fields;
197
+ if (I.length === 0 && j === e.fields.length) return null;
198
+ let { fields: L, columns: U } = gt(I, e.columns), ne = (e) => {
198
199
  let n = t?.[e.name] ?? e.value;
199
- if (e.render) return /* @__PURE__ */ Z(We, {
200
+ if (e.render) return /* @__PURE__ */ Z(Xe, {
200
201
  schema: e.render,
201
202
  data: {
202
203
  ...t,
203
204
  value: n
204
205
  }
205
206
  });
206
- let r = ft(e.span, V), c = i?.fields?.[e.name], l = { ...e };
207
+ let r = yt(e.span, U), c = i?.fields?.[e.name], l = { ...e };
207
208
  if (c) {
208
209
  !e.type && c.type && (l.type = c.type), c.options && !l.options && (l.options = c.options), c.currency && !l.currency && (l.currency = c.currency), c.precision !== void 0 && l.precision === void 0 && (l.precision = c.precision), c.format && !l.format && (l.format = c.format);
209
210
  let t = c.reference_to || c.reference;
@@ -211,13 +212,15 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
211
212
  }
212
213
  a && Array.isArray(l.options) && l.options.length > 0 && (l.options = O(a, e.name, l.options));
213
214
  let u = (() => {
214
- if (n == null) return /* @__PURE__ */ Z("span", {
215
- className: "text-muted-foreground/50 text-xs italic",
215
+ if (n == null || n === "") return /* @__PURE__ */ Z("span", {
216
+ className: "text-muted-foreground/60 text-sm select-none",
217
+ "aria-label": E("detail.noValue", { defaultValue: "No value" }),
218
+ title: E("detail.noValue", { defaultValue: "No value" }),
216
219
  children: "—"
217
220
  });
218
- let t = tt(l) || e.type;
221
+ let t = ct(l) || e.type;
219
222
  if (t) {
220
- let e = et(t);
223
+ let e = ot(t);
221
224
  if (e) return /* @__PURE__ */ Z(e, {
222
225
  value: n,
223
226
  field: l
@@ -226,7 +229,7 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
226
229
  return String(n);
227
230
  })(), f = n != null && n !== "", p = d === e.name;
228
231
  return /* @__PURE__ */ Q("div", {
229
- className: L("space-y-1.5 group", r),
232
+ className: H("space-y-1.5 group", r),
230
233
  children: [/* @__PURE__ */ Z("div", {
231
234
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
232
235
  children: D(a || "", e.name, e.label || e.name)
@@ -234,12 +237,12 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
234
237
  className: "min-h-[44px] sm:min-h-0",
235
238
  children: (() => {
236
239
  let t = l.type || e.type;
237
- if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z($e, {
240
+ if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(at, {
238
241
  field: l,
239
242
  value: n == null ? "" : String(n),
240
243
  onChange: (t) => s?.(e.name, t)
241
244
  });
242
- if (t === "boolean") return /* @__PURE__ */ Z(Qe, {
245
+ if (t === "boolean") return /* @__PURE__ */ Z(it, {
243
246
  field: l,
244
247
  value: !!n,
245
248
  onChange: (t) => s?.(e.name, t)
@@ -264,7 +267,7 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
264
267
  });
265
268
  })()
266
269
  }) : /* @__PURE__ */ Q("div", {
267
- className: L("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", f && "cursor-pointer active:bg-muted/60 transition-colors"),
270
+ className: H("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", f && "cursor-pointer active:bg-muted/60 transition-colors"),
268
271
  onClick: f ? () => k(e.name, n) : void 0,
269
272
  onKeyDown: f ? (t) => {
270
273
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
@@ -274,7 +277,7 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
274
277
  children: [/* @__PURE__ */ Z("div", {
275
278
  className: "text-sm flex-1 break-words py-1",
276
279
  children: u
277
- }), f && /* @__PURE__ */ Z(F, { children: /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
280
+ }), f && /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
278
281
  asChild: !0,
279
282
  children: /* @__PURE__ */ Z(g, {
280
283
  variant: "ghost",
@@ -283,33 +286,33 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
283
286
  onClick: (t) => {
284
287
  t.stopPropagation(), k(e.name, n);
285
288
  },
286
- children: p ? /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(me, { className: "h-3 w-3" })
289
+ children: p ? /* @__PURE__ */ Z(ce, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(ge, { className: "h-3 w-3" })
287
290
  })
288
- }), /* @__PURE__ */ Z(P, { children: E(p ? "detail.copied" : "detail.copyToClipboard") })] }) })]
291
+ }), /* @__PURE__ */ Z(z, { children: E(p ? "detail.copied" : "detail.copyToClipboard") })] }) })]
289
292
  })]
290
293
  }, e.name);
291
- }, ie = c?.enabled === !0, U = c?.batchSize ?? 20;
294
+ }, W = c?.enabled === !0, re = c?.batchSize ?? 20;
292
295
  n.useEffect(() => {
293
- if (!ie) {
296
+ if (!W) {
294
297
  m(void 0);
295
298
  return;
296
299
  }
297
- if (re.length <= U) {
300
+ if (L.length <= re) {
298
301
  m(void 0);
299
302
  return;
300
303
  }
301
- m(U);
304
+ m(re);
302
305
  let e = setTimeout(() => m(void 0), 100);
303
306
  return () => clearTimeout(e);
304
307
  }, [
305
- ie,
306
- re.length,
307
- U
308
+ W,
309
+ L.length,
310
+ re
308
311
  ]);
309
- let ae = p === void 0 ? re : re.slice(0, p), oe = j > 0 && (e.hideEmpty || z), ce = /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("div", {
310
- className: L("grid gap-3 sm:gap-4", V === 1 ? "grid-cols-1" : V === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
311
- children: ae.map(H)
312
- }), oe && /* @__PURE__ */ Z("div", {
312
+ let ie = p === void 0 ? L : L.slice(0, p), G = j > 0 && (e.hideEmpty || F), ae = /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("div", {
313
+ className: H("grid gap-3 sm:gap-4", U === 1 ? "grid-cols-1" : U === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
314
+ children: ie.map(ne)
315
+ }), G && /* @__PURE__ */ Z("div", {
313
316
  className: "mt-3 -ml-2",
314
317
  children: /* @__PURE__ */ Q(g, {
315
318
  type: "button",
@@ -317,15 +320,15 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
317
320
  size: "sm",
318
321
  onClick: () => T((e) => !e),
319
322
  className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
320
- children: [Z(w ? _e : G, { className: "h-3.5 w-3.5 mr-1.5" }), w ? E("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : E("detail.showEmptyFields", {
323
+ children: [Z(w ? ye : ve, { className: "h-3.5 w-3.5 mr-1.5" }), w ? E("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : E("detail.showEmptyFields", {
321
324
  count: j,
322
325
  defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
323
326
  })]
324
327
  })
325
328
  })] });
326
329
  return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
327
- className: L(r),
328
- children: ce
330
+ className: H(r),
331
+ children: ae
329
332
  }) : e.collapsible ? /* @__PURE__ */ Z(x, {
330
333
  open: !l,
331
334
  onOpenChange: (e) => u(!e),
@@ -333,7 +336,7 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
333
336
  children: /* @__PURE__ */ Q(_, { children: [/* @__PURE__ */ Z(C, {
334
337
  asChild: !0,
335
338
  children: /* @__PURE__ */ Q(y, {
336
- className: L("cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
339
+ className: H("cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
337
340
  children: [/* @__PURE__ */ Q(b, {
338
341
  className: "flex items-center justify-between",
339
342
  children: [/* @__PURE__ */ Q("div", {
@@ -352,7 +355,7 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
352
355
  ]
353
356
  }), /* @__PURE__ */ Z("div", {
354
357
  className: "flex items-center gap-2",
355
- children: Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground" })
358
+ children: Z(l ? fe : ue, { className: "h-4 w-4 text-muted-foreground" })
356
359
  })]
357
360
  }), e.description && !l && /* @__PURE__ */ Z("p", {
358
361
  className: "text-sm text-muted-foreground mt-1.5",
@@ -361,12 +364,12 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
361
364
  })
362
365
  }), /* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Z(v, {
363
366
  className: "pt-4 sm:pt-6 px-3 sm:px-6",
364
- children: ce
367
+ children: ae
365
368
  }) })] })
366
369
  }) : /* @__PURE__ */ Q(_, {
367
- className: L(e.showBorder === !1 ? "border-none shadow-none" : "", r),
370
+ className: H(e.showBorder === !1 ? "border-none shadow-none" : "", r),
368
371
  children: [e.title && /* @__PURE__ */ Q(y, {
369
- className: L(e.headerColor && `bg-${e.headerColor}`),
372
+ className: H(e.headerColor && `bg-${e.headerColor}`),
370
373
  children: [/* @__PURE__ */ Z(b, {
371
374
  className: "flex items-center justify-between",
372
375
  children: /* @__PURE__ */ Q("div", {
@@ -382,18 +385,18 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
382
385
  })]
383
386
  }), /* @__PURE__ */ Z(v, {
384
387
  className: "pt-4 sm:pt-6 px-3 sm:px-6",
385
- children: ce
388
+ children: ae
386
389
  })]
387
390
  });
388
- }, mt = ({ tabs: e, data: t, className: r }) => {
391
+ }, xt = ({ tabs: e, data: t, className: r }) => {
389
392
  let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
390
- return /* @__PURE__ */ Q(A, {
393
+ return /* @__PURE__ */ Q(ee, {
391
394
  value: i,
392
395
  onValueChange: a,
393
396
  className: r,
394
- children: [/* @__PURE__ */ Z(ee, {
397
+ children: [/* @__PURE__ */ Z(I, {
395
398
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
396
- children: o.map((e) => /* @__PURE__ */ Z(M, {
399
+ children: o.map((e) => /* @__PURE__ */ Z(L, {
397
400
  value: e.key,
398
401
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
399
402
  children: /* @__PURE__ */ Q("div", {
@@ -409,18 +412,18 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
409
412
  ]
410
413
  })
411
414
  }, e.key))
412
- }), o.map((e) => /* @__PURE__ */ Z(j, {
415
+ }), o.map((e) => /* @__PURE__ */ Z(F, {
413
416
  value: e.key,
414
417
  className: "mt-4",
415
418
  children: /* @__PURE__ */ Z(n.Suspense, {
416
419
  fallback: null,
417
420
  children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
418
421
  className: "space-y-4",
419
- children: e.content.map((e, n) => /* @__PURE__ */ Z(We, {
422
+ children: e.content.map((e, n) => /* @__PURE__ */ Z(Xe, {
420
423
  schema: e,
421
424
  data: t
422
425
  }, n))
423
- }) : /* @__PURE__ */ Z(We, {
426
+ }) : /* @__PURE__ */ Z(Xe, {
424
427
  schema: e.content,
425
428
  data: t
426
429
  })
@@ -430,15 +433,15 @@ var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
430
433
  };
431
434
  //#endregion
432
435
  //#region src/RelatedList.tsx
433
- function ht(e) {
434
- return e && Ue[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Se;
436
+ function St(e) {
437
+ return e && Ye[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
435
438
  }
436
- var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className: x, dataSource: S, objectName: C, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: ee = !1, filterable: M = !1, collapsible: N = !1, defaultCollapsed: P = !1, referenceField: F, parentId: I, icon: ne }) => {
437
- let R = f !== void 0, z = f ?? [], [B, V] = n.useState(z), [H, ie] = n.useState(() => !!r && !R), [U, ae] = n.useState(0), [W, oe] = n.useState(null), [ue, de] = n.useState("asc"), [fe, pe] = n.useState(""), [me, he] = n.useState(null), [G, _e] = n.useState(P), [ve, ye] = n.useState({}), { t: K } = $(), { fieldLabel: be } = Ze();
439
+ var Ct = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className: x, dataSource: S, objectName: C, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: M = !1, filterable: N = !1, collapsible: P = !1, defaultCollapsed: ee = !1, referenceField: F, parentId: I, icon: L }) => {
440
+ let R = f !== void 0, z = f ?? [], [B, V] = n.useState(z), [U, ne] = n.useState(() => !!r && !R), [W, re] = n.useState(0), [G, ae] = n.useState(null), [oe, K] = n.useState("asc"), [se, ce] = n.useState(""), [le, q] = n.useState(null), [pe, me] = n.useState(ee), [he, ge] = n.useState({}), { t: J } = $(), { fieldLabel: ve } = rt();
438
441
  n.useEffect(() => {
439
442
  R && V(f ?? []);
440
443
  }, [f, R]), n.useEffect(() => {
441
- r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(he).catch((e) => {
444
+ r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(q).catch((e) => {
442
445
  console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
443
446
  });
444
447
  }, [
@@ -448,15 +451,15 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
448
451
  ]), n.useEffect(() => {
449
452
  if (r && !R) {
450
453
  if (!(F && I != null && I !== "")) {
451
- r && (I == null || I === "") && !F && console.warn(`[RelatedList] "${r}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), ie(!1);
454
+ r && (I == null || I === "") && !F && console.warn(`[RelatedList] "${r}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), ne(!1);
452
455
  return;
453
456
  }
454
- ie(!0);
457
+ ne(!0);
455
458
  let e = { [F]: I };
456
459
  if (S && typeof S.find == "function") S.find(r, { $filter: e }).then((e) => {
457
- V(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), ie(!1);
460
+ V(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), ne(!1);
458
461
  }).catch((e) => {
459
- console.error("Failed to fetch related data:", e), ie(!1);
462
+ console.error("Failed to fetch related data:", e), ne(!1);
460
463
  });
461
464
  else {
462
465
  let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
@@ -464,7 +467,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
464
467
  V(Array.isArray(e) ? e : e?.data || []);
465
468
  }).catch((e) => {
466
469
  console.error("Failed to fetch related data:", e);
467
- }).finally(() => ie(!1));
470
+ }).finally(() => ne(!1));
468
471
  }
469
472
  }
470
473
  }, [
@@ -474,8 +477,8 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
474
477
  F,
475
478
  I
476
479
  ]), n.useEffect(() => {
477
- if (!S?.find || !me?.fields || !B.length) return;
478
- let e = me.fields, t = [];
480
+ if (!S?.find || !le?.fields || !B.length) return;
481
+ let e = le.fields, t = [];
479
482
  for (let [n, r] of Object.entries(e)) {
480
483
  if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
481
484
  let e = r.reference_to || r.reference;
@@ -485,7 +488,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
485
488
  let t = e?.[n];
486
489
  t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
487
490
  }
488
- let a = ve[n] || {}, o = Array.from(i).filter((e) => !(e in a));
491
+ let a = he[n] || {}, o = Array.from(i).filter((e) => !(e in a));
489
492
  o.length > 0 && t.push({
490
493
  fieldName: n,
491
494
  target: e,
@@ -511,7 +514,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
511
514
  fieldName: e,
512
515
  map: {}
513
516
  })))).then((e) => {
514
- n || ye((t) => {
517
+ n || ge((t) => {
515
518
  let n = { ...t };
516
519
  for (let { fieldName: t, map: r } of e) n[t] = {
517
520
  ...n[t] || {},
@@ -524,48 +527,48 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
524
527
  };
525
528
  }, [
526
529
  S,
527
- me,
530
+ le,
528
531
  B
529
532
  ]);
530
- let xe = n.useMemo(() => {
531
- if (!fe) return B;
532
- let e = fe.toLowerCase();
533
+ let ye = n.useMemo(() => {
534
+ if (!se) return B;
535
+ let e = se.toLowerCase();
533
536
  return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
534
- }, [B, fe]), Se = n.useMemo(() => W ? [...xe].sort((e, t) => {
535
- let n = e[W], r = t[W];
537
+ }, [B, se]), be = n.useMemo(() => G ? [...ye].sort((e, t) => {
538
+ let n = e[G], r = t[G];
536
539
  if (n == null && r == null) return 0;
537
540
  if (n == null) return 1;
538
541
  if (r == null) return -1;
539
542
  let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
540
- return ue === "asc" ? i : -i;
541
- }) : xe, [
542
- xe,
543
- W,
544
- ue
545
- ]), q = j && j > 0 ? j : 0, Ce = q ? Math.max(1, Math.ceil(Se.length / q)) : 1, we = q ? Se.slice(U * q, (U + 1) * q) : Se;
543
+ return oe === "asc" ? i : -i;
544
+ }) : ye, [
545
+ ye,
546
+ G,
547
+ oe
548
+ ]), Y = j && j > 0 ? j : 0, xe = Y ? Math.max(1, Math.ceil(be.length / Y)) : 1, Se = Y ? be.slice(W * Y, (W + 1) * Y) : be;
546
549
  n.useEffect(() => {
547
- ae(0);
550
+ re(0);
548
551
  }, [
549
- fe,
550
- W,
551
- ue
552
+ se,
553
+ G,
554
+ oe
552
555
  ]);
553
- let Te = n.useCallback((e) => {
554
- W === e ? de((e) => e === "asc" ? "desc" : "asc") : (oe(e), de("asc"));
555
- }, [W]), [Ee, J] = n.useState(null), De = n.useCallback((e) => {
556
- J(e);
557
- }, []), Oe = n.useCallback(() => {
558
- Ee && O?.(Ee), J(null);
559
- }, [Ee, O]), ke = it(), Y = n.useMemo(() => {
560
- let e = C || r || "", t = (t) => !ke?.isLoaded || !e ? t : t.filter((t) => {
556
+ let Ce = n.useCallback((e) => {
557
+ G === e ? K((e) => e === "asc" ? "desc" : "asc") : (ae(e), K("asc"));
558
+ }, [G]), [X, we] = n.useState(null), Te = n.useCallback((e) => {
559
+ we(e);
560
+ }, []), Ee = n.useCallback(() => {
561
+ X && O?.(X), we(null);
562
+ }, [X, O]), De = dt(), Oe = n.useMemo(() => {
563
+ let e = C || r || "", t = (t) => !De?.isLoaded || !e ? t : t.filter((t) => {
561
564
  let n = t?.accessorKey || t?.field || t?.name;
562
- return n ? ke.checkField(e, String(n), "read") : !0;
565
+ return n ? De.checkField(e, String(n), "read") : !0;
563
566
  }), i = (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, o = (e) => B.length ? e.filter((e) => {
564
567
  let t = e?.accessorKey || e?.field || e?.name;
565
568
  return t ? B.some((e) => !a(e?.[t])) : !0;
566
569
  }) : e;
567
570
  if (m && m.length > 0) return o(t(i(m)));
568
- if (!me?.fields) return [];
571
+ if (!le?.fields) return [];
569
572
  let s = e, c = new Set([
570
573
  "image",
571
574
  "file",
@@ -582,7 +585,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
582
585
  "label",
583
586
  "code",
584
587
  "number"
585
- ], u = Object.entries(me.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && c.has(t.type) || ke?.isLoaded && s && !ke.checkField(s, e, "read")));
588
+ ], u = Object.entries(le.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && c.has(t.type) || De?.isLoaded && s && !De.checkField(s, e, "read")));
586
589
  return u.sort(([e, t], [n, r]) => {
587
590
  let i = l.indexOf(e), a = l.indexOf(n), o = i >= 0 ? i : 100, s = a >= 0 ? a : 100;
588
591
  if (o !== s) return o - s;
@@ -591,15 +594,15 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
591
594
  }), o(u.map(([e, t]) => {
592
595
  let r = {
593
596
  accessorKey: e,
594
- header: be(s, e, t.label || e)
597
+ header: ve(s, e, t.label || e)
595
598
  };
596
599
  if (t.type) {
597
- let i = et(tt({
600
+ let i = ot(ct({
598
601
  type: t.type,
599
602
  format: t.format
600
603
  }) || t.type);
601
604
  if (i) {
602
- let a = t.type === "lookup" || t.type === "master_detail" ? ve[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
605
+ let a = t.type === "lookup" || t.type === "master_detail" ? he[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
603
606
  value: e,
604
607
  label: t
605
608
  })) : void 0, s = {
@@ -623,22 +626,22 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
623
626
  })).slice(0, Math.max(1, A));
624
627
  }, [
625
628
  m,
626
- me,
629
+ le,
627
630
  C,
628
631
  r,
629
- be,
632
+ ve,
630
633
  F,
631
634
  B,
632
635
  A,
633
- ve,
634
- ke
635
- ]), Ae = !!D || !!O, je = te(), Ne = n.useMemo(() => {
636
+ he,
637
+ De
638
+ ]), ke = !!D || !!O, Ae = te(), je = n.useMemo(() => {
636
639
  if (p) return p;
637
- if (je && (t === "grid" || t === "table")) {
638
- let e = Y[0]?.accessorKey || Y[0]?.field || Y[0]?.name, t = Y.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
640
+ if (Ae && (t === "grid" || t === "table")) {
641
+ let e = Oe[0]?.accessorKey || Oe[0]?.field || Oe[0]?.name, t = Oe.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
639
642
  return {
640
643
  type: "object-gallery",
641
- data: we,
644
+ data: Se,
642
645
  objectName: r,
643
646
  gallery: {
644
647
  titleField: e || "name",
@@ -652,20 +655,20 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
652
655
  case "grid":
653
656
  case "table": return {
654
657
  type: "data-table",
655
- data: we,
656
- columns: Y,
658
+ data: Se,
659
+ columns: Oe,
657
660
  pagination: !1,
658
- pageSize: q || 10,
661
+ pageSize: Y || 10,
659
662
  searchable: !1,
660
663
  exportable: !1,
661
- rowActions: Ae,
664
+ rowActions: ke,
662
665
  onRowEdit: D,
663
- onRowDelete: O ? De : void 0,
666
+ onRowDelete: O ? Te : void 0,
664
667
  onRowClick: k
665
668
  };
666
669
  case "list": return {
667
670
  type: "data-list",
668
- data: we
671
+ data: Se
669
672
  };
670
673
  default: return {
671
674
  type: "div",
@@ -674,127 +677,127 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
674
677
  }
675
678
  }, [
676
679
  t,
677
- we,
678
- Y,
680
+ Se,
681
+ Oe,
679
682
  p,
680
- q,
681
- Ae,
683
+ Y,
684
+ ke,
682
685
  D,
683
686
  O,
684
- De,
687
+ Te,
685
688
  k,
686
- je,
689
+ Ae,
687
690
  r
688
- ]), Pe = N ? "cursor-pointer select-none" : void 0, Fe = N ? () => _e((e) => !e) : void 0, Ie = ht(ne), X = !H && B.length === 0, Le = M;
691
+ ]), Me = P ? "cursor-pointer select-none" : void 0, Ne = P ? () => me((e) => !e) : void 0, Pe = St(L), Fe = !U && B.length === 0, Ie = N;
689
692
  return /* @__PURE__ */ Q(_, {
690
- className: L("shadow-none border-border/60 bg-transparent", X && "bg-muted/10", x),
693
+ className: H("shadow-none border-border/60 bg-transparent", Fe && "bg-muted/10", x),
691
694
  children: [
692
695
  /* @__PURE__ */ Z(y, {
693
- className: L("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Pe),
694
- onClick: Fe,
696
+ className: H("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Me),
697
+ onClick: Ne,
695
698
  children: /* @__PURE__ */ Q(b, {
696
699
  className: "flex items-center justify-between gap-2 text-sm font-semibold",
697
700
  children: [/* @__PURE__ */ Q("div", {
698
701
  className: "flex items-center gap-2 min-w-0",
699
702
  children: [
700
- N && Z(G ? le : se, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
701
- /* @__PURE__ */ Z(Ie, {
703
+ P && Z(pe ? fe : ue, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
704
+ /* @__PURE__ */ Z(Pe, {
702
705
  className: "h-4 w-4 text-muted-foreground shrink-0",
703
706
  "aria-hidden": !0
704
707
  }),
705
708
  /* @__PURE__ */ Z("span", {
706
- className: L("truncate", X && "text-muted-foreground font-medium"),
709
+ className: H("truncate", Fe && "text-muted-foreground font-medium"),
707
710
  children: e
708
711
  }),
709
712
  /* @__PURE__ */ Z(h, {
710
713
  variant: "secondary",
711
- className: L("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
714
+ className: H("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
712
715
  "aria-label": `${B.length} records`,
713
716
  children: B.length
714
717
  }),
715
- X && /* @__PURE__ */ Z("span", {
718
+ Fe && /* @__PURE__ */ Z("span", {
716
719
  className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
717
- children: K("detail.noRelatedRecords")
720
+ children: J("detail.noRelatedRecords")
718
721
  })
719
722
  ]
720
723
  }), /* @__PURE__ */ Z("div", {
721
724
  className: "flex items-center gap-1 shrink-0",
722
725
  children: T && /* @__PURE__ */ Q(g, {
723
- variant: X ? "ghost" : "outline",
726
+ variant: Fe ? "ghost" : "outline",
724
727
  size: "sm",
725
728
  onClick: (e) => {
726
729
  e.stopPropagation(), T();
727
730
  },
728
731
  className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
729
- children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), K("detail.new")]
732
+ children: [/* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" }), J("detail.new")]
730
733
  })
731
734
  })]
732
735
  })
733
736
  }),
734
- !G && !X && /* @__PURE__ */ Q(v, {
735
- className: L("pt-0 pb-4 px-4"),
737
+ !pe && !Fe && /* @__PURE__ */ Q(v, {
738
+ className: H("pt-0 pb-4 px-4"),
736
739
  children: [
737
- Le && /* @__PURE__ */ Z("div", {
740
+ Ie && /* @__PURE__ */ Z("div", {
738
741
  className: "mb-3",
739
742
  children: /* @__PURE__ */ Z(w, {
740
- placeholder: K("detail.filterPlaceholder"),
741
- value: fe,
742
- onChange: (e) => pe(e.target.value),
743
+ placeholder: J("detail.filterPlaceholder"),
744
+ value: se,
745
+ onChange: (e) => ce(e.target.value),
743
746
  className: "h-8 text-sm"
744
747
  })
745
748
  }),
746
- ee && Y && Y.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
749
+ M && Oe && Oe.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
747
750
  className: "flex flex-wrap gap-1 mb-3",
748
- children: Y.map((e) => {
751
+ children: Oe.map((e) => {
749
752
  let t = e.accessorKey || e.field || e.name;
750
753
  if (!t) return null;
751
- let n = e.header || e.label || t, r = W === t;
754
+ let n = e.header || e.label || t, r = G === t;
752
755
  return /* @__PURE__ */ Q(g, {
753
756
  variant: r ? "secondary" : "ghost",
754
757
  size: "sm",
755
758
  className: "gap-1 h-7 text-xs",
756
- onClick: () => Te(t),
759
+ onClick: () => Ce(t),
757
760
  children: [
758
- /* @__PURE__ */ Z(re, { className: "h-3 w-3" }),
761
+ /* @__PURE__ */ Z(ie, { className: "h-3 w-3" }),
759
762
  n,
760
- r && (ue === "asc" ? " ↑" : " ↓")
763
+ r && (oe === "asc" ? " ↑" : " ↓")
761
764
  ]
762
765
  }, t);
763
766
  })
764
767
  }),
765
- H ? /* @__PURE__ */ Z("div", {
768
+ U ? /* @__PURE__ */ Z("div", {
766
769
  className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
767
- children: K("detail.loading")
768
- }) : /* @__PURE__ */ Z(We, { schema: Ne }),
769
- q > 0 && Se.length > q && /* @__PURE__ */ Q("div", {
770
+ children: J("detail.loading")
771
+ }) : /* @__PURE__ */ Z(Xe, { schema: je }),
772
+ Y > 0 && be.length > Y && /* @__PURE__ */ Q("div", {
770
773
  className: "flex items-center justify-between mt-3 pt-3 border-t",
771
774
  children: [
772
775
  /* @__PURE__ */ Q(g, {
773
776
  variant: "outline",
774
777
  size: "sm",
775
778
  className: "h-7 text-xs gap-1",
776
- disabled: U === 0,
777
- onClick: () => ae((e) => Math.max(0, e - 1)),
778
- children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }), K("detail.previousPage")]
779
+ disabled: W === 0,
780
+ onClick: () => re((e) => Math.max(0, e - 1)),
781
+ children: [/* @__PURE__ */ Z(de, { className: "h-3 w-3" }), J("detail.previousPage")]
779
782
  }),
780
783
  /* @__PURE__ */ Z("span", {
781
784
  className: "text-xs text-muted-foreground",
782
- children: K("detail.pageOf", {
783
- current: U + 1,
784
- total: Ce
785
+ children: J("detail.pageOf", {
786
+ current: W + 1,
787
+ total: xe
785
788
  })
786
789
  }),
787
790
  /* @__PURE__ */ Q(g, {
788
791
  variant: "outline",
789
792
  size: "sm",
790
793
  className: "h-7 text-xs gap-1",
791
- disabled: U >= Ce - 1,
792
- onClick: () => ae((e) => Math.min(Ce - 1, e + 1)),
793
- children: [K("detail.nextPage"), /* @__PURE__ */ Z(le, { className: "h-3 w-3" })]
794
+ disabled: W >= xe - 1,
795
+ onClick: () => re((e) => Math.min(xe - 1, e + 1)),
796
+ children: [J("detail.nextPage"), /* @__PURE__ */ Z(fe, { className: "h-3 w-3" })]
794
797
  })
795
798
  ]
796
799
  }),
797
- E && !X && q > 0 && Se.length > q && /* @__PURE__ */ Z("div", {
800
+ E && !Fe && Y > 0 && be.length > Y && /* @__PURE__ */ Z("div", {
798
801
  className: "mt-3 pt-3 border-t flex justify-center",
799
802
  children: /* @__PURE__ */ Q("button", {
800
803
  type: "button",
@@ -802,28 +805,28 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
802
805
  e.stopPropagation(), E();
803
806
  },
804
807
  className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
805
- children: [K("detail.viewAll"), /* @__PURE__ */ Z(ge, { className: "h-3 w-3" })]
808
+ children: [J("detail.viewAll"), /* @__PURE__ */ Z(_e, { className: "h-3 w-3" })]
806
809
  })
807
810
  })
808
811
  ]
809
812
  }),
810
813
  /* @__PURE__ */ Z(i, {
811
- open: Ee !== null,
814
+ open: X !== null,
812
815
  onOpenChange: (e) => {
813
- e || J(null);
816
+ e || we(null);
814
817
  },
815
- children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: K("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: K("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: K("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
816
- onClick: Oe,
818
+ children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: J("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: J("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: J("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
819
+ onClick: Ee,
817
820
  className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
818
- children: K("detail.delete", { defaultValue: "Delete" })
821
+ children: J("detail.delete", { defaultValue: "Delete" })
819
822
  })] })] })
820
823
  })
821
824
  ]
822
825
  });
823
- }, _t = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
826
+ }, wt = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
824
827
  let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
825
828
  className: "space-y-3 sm:space-y-4",
826
- children: e.sections.map((e, n) => /* @__PURE__ */ Z(pt, {
829
+ children: e.sections.map((e, n) => /* @__PURE__ */ Z(bt, {
827
830
  section: e,
828
831
  data: t,
829
832
  objectSchema: i,
@@ -842,7 +845,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
842
845
  children: /* @__PURE__ */ Q("div", {
843
846
  className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
844
847
  children: [
845
- Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
848
+ Z(l ? fe : ue, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
846
849
  e.icon && /* @__PURE__ */ Z("span", {
847
850
  className: "text-muted-foreground",
848
851
  children: e.icon
@@ -864,7 +867,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
864
867
  }) })
865
868
  ]
866
869
  }) : /* @__PURE__ */ Q("div", {
867
- className: L("space-y-3", r),
870
+ className: H("space-y-3", r),
868
871
  children: [
869
872
  /* @__PURE__ */ Q("div", {
870
873
  className: "flex items-center gap-2 pb-2 border-b",
@@ -883,18 +886,18 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
883
886
  d
884
887
  ]
885
888
  });
886
- }, vt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
887
- let { fieldLabel: a } = Ze();
889
+ }, Tt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
890
+ let { fieldLabel: a } = rt();
888
891
  if (!e.length || !t) return null;
889
892
  let o = e.filter((e) => {
890
893
  let n = t?.[e.name];
891
894
  return n != null && n !== "";
892
895
  });
893
896
  return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
894
- className: L("@container border-b border-border/60 pb-4", n),
897
+ className: H("@container border-b border-border/60 pb-4", n),
895
898
  "aria-label": "Record highlights",
896
899
  children: /* @__PURE__ */ Z("div", {
897
- className: L("flex flex-wrap gap-x-8 gap-y-3"),
900
+ className: H("flex flex-wrap gap-x-8 gap-y-3"),
898
901
  children: o.map((e) => {
899
902
  let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
900
903
  name: e.name,
@@ -904,7 +907,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
904
907
  ...o?.currency && { currency: o.currency },
905
908
  ...o?.precision !== void 0 && { precision: o.precision },
906
909
  ...o?.format && { format: o.format }
907
- }, l = et(tt(c) || s || "text");
910
+ }, l = ot(ct(c) || s || "text");
908
911
  return /* @__PURE__ */ Q("div", {
909
912
  className: "flex min-w-[8rem] max-w-[16rem] basis-[10rem] flex-col gap-0.5",
910
913
  children: [/* @__PURE__ */ Q("span", {
@@ -927,7 +930,7 @@ var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
927
930
  };
928
931
  //#endregion
929
932
  //#region src/RecordComments.tsx
930
- function yt(e) {
933
+ function Et(e) {
931
934
  try {
932
935
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
933
936
  if (r < 1) return "just now";
@@ -940,7 +943,7 @@ function yt(e) {
940
943
  return e;
941
944
  }
942
945
  }
943
- var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
946
+ var Dt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
944
947
  let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
945
948
  let e = s.trim();
946
949
  if (!(!e || !t)) {
@@ -958,11 +961,11 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
958
961
  return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
959
962
  }) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
960
963
  return /* @__PURE__ */ Q(_, {
961
- className: L("", a),
964
+ className: H("", a),
962
965
  children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
963
966
  className: "flex items-center gap-2 text-base",
964
967
  children: [
965
- /* @__PURE__ */ Z(J, { className: "h-4 w-4" }),
968
+ /* @__PURE__ */ Z(Ae, { className: "h-4 w-4" }),
966
969
  o("detail.comments"),
967
970
  /* @__PURE__ */ Q("span", {
968
971
  className: "text-sm font-normal text-muted-foreground",
@@ -981,7 +984,7 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
981
984
  children: /* @__PURE__ */ Q("div", {
982
985
  className: "relative flex-1",
983
986
  children: [
984
- /* @__PURE__ */ Z(Ie, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
987
+ /* @__PURE__ */ Z(Ve, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
985
988
  /* @__PURE__ */ Z("input", {
986
989
  className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
987
990
  placeholder: o("detail.searchComments"),
@@ -994,7 +997,7 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
994
997
  onClick: () => f(""),
995
998
  "aria-label": o("detail.clearSearch"),
996
999
  type: "button",
997
- children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
1000
+ children: /* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" })
998
1001
  })
999
1002
  ]
1000
1003
  })
@@ -1014,7 +1017,7 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
1014
1017
  onClick: p,
1015
1018
  disabled: !s.trim() || l,
1016
1019
  className: "shrink-0 self-end",
1017
- children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
1020
+ children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
1018
1021
  })]
1019
1022
  }),
1020
1023
  h.length === 0 ? /* @__PURE__ */ Z("p", {
@@ -1023,7 +1026,7 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
1023
1026
  }) : /* @__PURE__ */ Z("div", {
1024
1027
  className: "space-y-3",
1025
1028
  children: h.map((e) => /* @__PURE__ */ Q("div", {
1026
- className: L("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1029
+ className: H("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1027
1030
  children: [/* @__PURE__ */ Z("div", {
1028
1031
  className: "shrink-0",
1029
1032
  children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
@@ -1046,11 +1049,11 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
1046
1049
  }),
1047
1050
  /* @__PURE__ */ Z("span", {
1048
1051
  className: "text-xs text-muted-foreground",
1049
- children: yt(e.createdAt)
1052
+ children: Et(e.createdAt)
1050
1053
  }),
1051
1054
  e.pinned && /* @__PURE__ */ Q("span", {
1052
1055
  className: "text-xs text-amber-600 flex items-center gap-0.5",
1053
- children: [/* @__PURE__ */ Z(je, { className: "h-3 w-3" }), o("detail.pinned")]
1056
+ children: [/* @__PURE__ */ Z(Ie, { className: "h-3 w-3" }), o("detail.pinned")]
1054
1057
  })
1055
1058
  ]
1056
1059
  }),
@@ -1063,7 +1066,7 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
1063
1066
  className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
1064
1067
  onClick: () => r(e.id),
1065
1068
  "aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
1066
- children: [/* @__PURE__ */ Z(je, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
1069
+ children: [/* @__PURE__ */ Z(Ie, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
1067
1070
  })
1068
1071
  ]
1069
1072
  })]
@@ -1072,20 +1075,20 @@ var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
1072
1075
  ]
1073
1076
  })]
1074
1077
  });
1075
- }, xt = {
1076
- field_change: he,
1077
- create: Ne,
1078
- delete: ze,
1079
- comment: J,
1080
- status_change: B
1081
- }, St = {
1078
+ }, Ot = {
1079
+ field_change: J,
1080
+ create: Re,
1081
+ delete: Ge,
1082
+ comment: Ae,
1083
+ status_change: re
1084
+ }, kt = {
1082
1085
  field_change: "bg-blue-100 text-blue-600",
1083
1086
  create: "bg-green-100 text-green-600",
1084
1087
  delete: "bg-red-100 text-red-600",
1085
1088
  comment: "bg-purple-100 text-purple-600",
1086
1089
  status_change: "bg-amber-100 text-amber-600"
1087
1090
  };
1088
- function Ct(e) {
1091
+ function At(e) {
1089
1092
  try {
1090
1093
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
1091
1094
  if (r < 1) return "just now";
@@ -1098,24 +1101,24 @@ function Ct(e) {
1098
1101
  return e;
1099
1102
  }
1100
1103
  }
1101
- function wt(e) {
1104
+ function jt(e) {
1102
1105
  return e.description ? e.description : e.type === "field_change" && e.field ? `Changed ${e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " ")} from "${e.oldValue == null ? "(empty)" : String(e.oldValue)}" to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : e.type === "create" ? "Created this record" : e.type === "delete" ? "Deleted this record" : e.type === "status_change" && e.field ? `Changed status to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : "Updated record";
1103
1106
  }
1104
- var Tt = {
1107
+ var Mt = {
1105
1108
  all: "All",
1106
1109
  field_change: "Field Changes",
1107
1110
  create: "Creates",
1108
1111
  delete: "Deletes",
1109
1112
  comment: "Comments",
1110
1113
  status_change: "Status Changes"
1111
- }, Et = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
1114
+ }, Nt = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
1112
1115
  let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
1113
1116
  return /* @__PURE__ */ Q(_, {
1114
- className: L("", i),
1117
+ className: H("", i),
1115
1118
  children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
1116
1119
  className: "flex items-center gap-2 text-base",
1117
1120
  children: [
1118
- /* @__PURE__ */ Z(ne, { className: "h-4 w-4" }),
1121
+ /* @__PURE__ */ Z(U, { className: "h-4 w-4" }),
1119
1122
  "Activity",
1120
1123
  /* @__PURE__ */ Q("span", {
1121
1124
  className: "text-sm font-normal text-muted-foreground",
@@ -1130,12 +1133,12 @@ var Tt = {
1130
1133
  className: "flex flex-wrap gap-1.5 mb-4",
1131
1134
  role: "group",
1132
1135
  "aria-label": "Activity type filter",
1133
- children: Object.keys(Tt).map((e) => /* @__PURE__ */ Q("button", {
1136
+ children: Object.keys(Mt).map((e) => /* @__PURE__ */ Q("button", {
1134
1137
  type: "button",
1135
- className: L("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"),
1138
+ className: H("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"),
1136
1139
  onClick: () => o(e),
1137
1140
  "aria-pressed": a === e,
1138
- children: [e !== "all" && n.createElement(xt[e] || he, { className: "h-3 w-3" }), Tt[e]]
1141
+ children: [e !== "all" && n.createElement(Ot[e] || J, { className: "h-3 w-3" }), Mt[e]]
1139
1142
  }, e))
1140
1143
  }), s.length === 0 ? /* @__PURE__ */ Z("p", {
1141
1144
  className: "text-sm text-muted-foreground text-center py-4",
@@ -1145,11 +1148,11 @@ var Tt = {
1145
1148
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
1146
1149
  className: "space-y-4",
1147
1150
  children: s.map((e) => {
1148
- let t = xt[e.type] || he;
1151
+ let t = Ot[e.type] || J;
1149
1152
  return /* @__PURE__ */ Q("div", {
1150
1153
  className: "flex gap-3 relative",
1151
1154
  children: [/* @__PURE__ */ Z("div", {
1152
- className: L("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", St[e.type] || "bg-gray-100 text-gray-600"),
1155
+ className: H("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", kt[e.type] || "bg-gray-100 text-gray-600"),
1153
1156
  children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
1154
1157
  }), /* @__PURE__ */ Q("div", {
1155
1158
  className: "flex-1 min-w-0 pt-1",
@@ -1163,12 +1166,12 @@ var Tt = {
1163
1166
  " ",
1164
1167
  /* @__PURE__ */ Z("span", {
1165
1168
  className: "text-muted-foreground",
1166
- children: wt(e)
1169
+ children: jt(e)
1167
1170
  })
1168
1171
  ]
1169
1172
  }), /* @__PURE__ */ Z("p", {
1170
1173
  className: "text-xs text-muted-foreground mt-0.5",
1171
- children: Ct(e.timestamp)
1174
+ children: At(e.timestamp)
1172
1175
  })]
1173
1176
  })]
1174
1177
  }, e.id);
@@ -1176,7 +1179,7 @@ var Tt = {
1176
1179
  })]
1177
1180
  })] })]
1178
1181
  });
1179
- }, Dt = {
1182
+ }, Pt = {
1180
1183
  create: "default",
1181
1184
  update: "secondary",
1182
1185
  delete: "destructive",
@@ -1188,12 +1191,12 @@ var Tt = {
1188
1191
  export: "outline",
1189
1192
  import: "outline"
1190
1193
  };
1191
- function Ot(e) {
1194
+ function Ft(e) {
1192
1195
  if (!e) return "";
1193
1196
  let t = e instanceof Date ? e : new Date(e);
1194
1197
  return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
1195
1198
  }
1196
- var kt = [
1199
+ var It = [
1197
1200
  [60, "second"],
1198
1201
  [60, "minute"],
1199
1202
  [24, "hour"],
@@ -1202,27 +1205,27 @@ var kt = [
1202
1205
  [12, "month"],
1203
1206
  [Infinity, "year"]
1204
1207
  ];
1205
- function At(e, t) {
1208
+ function Lt(e, t) {
1206
1209
  if (!e) return "";
1207
1210
  let n = e instanceof Date ? e : new Date(e);
1208
1211
  if (Number.isNaN(n.getTime())) return String(e);
1209
1212
  let r = (n.getTime() - Date.now()) / 1e3;
1210
- for (let [n, i] of kt) {
1213
+ for (let [n, i] of It) {
1211
1214
  if (Math.abs(r) < n) try {
1212
1215
  return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
1213
1216
  } catch {
1214
- return Ot(e);
1217
+ return Ft(e);
1215
1218
  }
1216
1219
  r /= n;
1217
1220
  }
1218
- return Ot(e);
1221
+ return Ft(e);
1219
1222
  }
1220
- function jt(e) {
1223
+ function Rt(e) {
1221
1224
  if (!e) return "?";
1222
1225
  let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
1223
1226
  return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
1224
1227
  }
1225
- function Mt(e) {
1228
+ function zt(e) {
1226
1229
  if (e == null || e === "") return "—";
1227
1230
  if (typeof e == "string") return e;
1228
1231
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -1232,25 +1235,25 @@ function Mt(e) {
1232
1235
  return String(e);
1233
1236
  }
1234
1237
  }
1235
- function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1238
+ function Bt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1236
1239
  return t ? /* @__PURE__ */ Z("div", {
1237
- className: L("space-y-3", r),
1240
+ className: H("space-y-3", r),
1238
1241
  children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
1239
1242
  className: "flex items-start gap-3",
1240
- children: [/* @__PURE__ */ Z(k, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1243
+ children: [/* @__PURE__ */ Z(P, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1241
1244
  className: "flex-1 space-y-2",
1242
- children: [/* @__PURE__ */ Z(k, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(k, { className: "h-3 w-1/2" })]
1245
+ children: [/* @__PURE__ */ Z(P, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(P, { className: "h-3 w-1/2" })]
1243
1246
  })]
1244
1247
  }, t))
1245
1248
  }) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
1246
- className: L("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1249
+ className: H("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1247
1250
  children: n ?? "No history yet"
1248
- }) : /* @__PURE__ */ Z(F, {
1251
+ }) : /* @__PURE__ */ Z(B, {
1249
1252
  delayDuration: 150,
1250
1253
  children: /* @__PURE__ */ Z("ol", {
1251
- className: L("space-y-4", r),
1254
+ className: H("space-y-4", r),
1252
1255
  children: e.map((e, t) => {
1253
- let n = (e.action ?? "").toLowerCase(), r = Dt[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = Ot(e.created_at), s = At(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1256
+ let n = (e.action ?? "").toLowerCase(), r = Pt[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = Ft(e.created_at), s = Lt(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1254
1257
  return /* @__PURE__ */ Q("li", {
1255
1258
  className: "flex items-start gap-3",
1256
1259
  children: [/* @__PURE__ */ Q(f, {
@@ -1260,7 +1263,7 @@ function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1260
1263
  alt: a
1261
1264
  }) : null, /* @__PURE__ */ Z(p, {
1262
1265
  className: "text-[10px] font-medium",
1263
- children: jt(e.user_name)
1266
+ children: Rt(e.user_name)
1264
1267
  })]
1265
1268
  }), /* @__PURE__ */ Q("div", {
1266
1269
  className: "min-w-0 flex-1",
@@ -1277,14 +1280,14 @@ function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1277
1280
  className: "text-[10px] uppercase tracking-wide",
1278
1281
  children: e.action
1279
1282
  }),
1280
- o && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1283
+ o && /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1281
1284
  asChild: !0,
1282
1285
  children: /* @__PURE__ */ Z("span", {
1283
1286
  className: "text-xs text-muted-foreground cursor-help",
1284
1287
  "aria-label": o,
1285
1288
  children: s || o
1286
1289
  })
1287
- }), /* @__PURE__ */ Z(P, { children: o })] })
1290
+ }), /* @__PURE__ */ Z(z, { children: o })] })
1288
1291
  ]
1289
1292
  }),
1290
1293
  e.summary && /* @__PURE__ */ Z("p", {
@@ -1311,7 +1314,7 @@ function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1311
1314
  ": ",
1312
1315
  /* @__PURE__ */ Z("span", {
1313
1316
  className: "text-foreground",
1314
- children: Mt(e.to)
1317
+ children: zt(e.to)
1315
1318
  })
1316
1319
  ]
1317
1320
  }, e.field))
@@ -1328,12 +1331,12 @@ function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1328
1331
  ": ",
1329
1332
  /* @__PURE__ */ Z("span", {
1330
1333
  className: "line-through opacity-70",
1331
- children: Mt(e.from)
1334
+ children: zt(e.from)
1332
1335
  }),
1333
1336
  " → ",
1334
1337
  /* @__PURE__ */ Z("span", {
1335
1338
  className: "text-foreground",
1336
- children: Mt(e.to)
1339
+ children: zt(e.to)
1337
1340
  })
1338
1341
  ]
1339
1342
  }, e.field))
@@ -1347,13 +1350,13 @@ function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1347
1350
  }
1348
1351
  //#endregion
1349
1352
  //#region src/RecordMetaFooter.tsx
1350
- var Pt = {
1353
+ var Vt = {
1351
1354
  createdAt: "created_at",
1352
1355
  createdBy: "created_by",
1353
1356
  updatedAt: "updated_at",
1354
1357
  updatedBy: "updated_by"
1355
1358
  };
1356
- function Ft(e) {
1359
+ function Ht(e) {
1357
1360
  if (!e) return null;
1358
1361
  if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
1359
1362
  if (typeof e == "string" || typeof e == "number") {
@@ -1362,7 +1365,7 @@ function Ft(e) {
1362
1365
  }
1363
1366
  return null;
1364
1367
  }
1365
- function It(e, t) {
1368
+ function Ut(e, t) {
1366
1369
  let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
1367
1370
  if (r < 60) return t("detail.justNow");
1368
1371
  let i = Math.floor(r / 60);
@@ -1370,7 +1373,7 @@ function It(e, t) {
1370
1373
  let a = Math.floor(i / 60);
1371
1374
  return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
1372
1375
  }
1373
- function Lt(e) {
1376
+ function Wt(e) {
1374
1377
  try {
1375
1378
  return new Intl.DateTimeFormat(void 0, {
1376
1379
  dateStyle: "medium",
@@ -1380,16 +1383,16 @@ function Lt(e) {
1380
1383
  return e.toISOString();
1381
1384
  }
1382
1385
  }
1383
- var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
1386
+ var Gt = ({ value: e, objectSchema: t, fieldName: n }) => {
1384
1387
  if (e == null || e === "") return null;
1385
1388
  let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
1386
1389
  name: n,
1387
1390
  type: r?.type || (i ? "lookup" : "text"),
1388
1391
  ...i && { reference_to: i },
1389
1392
  ...r?.reference_field && { reference_field: r.reference_field }
1390
- }, o = tt(a) || a.type;
1393
+ }, o = ct(a) || a.type;
1391
1394
  if (o) {
1392
- let t = et(o);
1395
+ let t = ot(o);
1393
1396
  if (t) return /* @__PURE__ */ Z("span", {
1394
1397
  className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
1395
1398
  children: /* @__PURE__ */ Z(t, {
@@ -1399,20 +1402,20 @@ var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
1399
1402
  });
1400
1403
  }
1401
1404
  return /* @__PURE__ */ Z("span", { children: String(e) });
1402
- }, zt = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1405
+ }, Kt = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1403
1406
  if (!t && !n) return null;
1404
- let o = n ? /* @__PURE__ */ Z(F, {
1407
+ let o = n ? /* @__PURE__ */ Z(B, {
1405
1408
  delayDuration: 200,
1406
- children: /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1409
+ children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1407
1410
  asChild: !0,
1408
1411
  children: /* @__PURE__ */ Z("time", {
1409
1412
  dateTime: n.toISOString(),
1410
1413
  className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
1411
- children: It(n, a)
1414
+ children: Ut(n, a)
1412
1415
  })
1413
- }), /* @__PURE__ */ Z(P, {
1416
+ }), /* @__PURE__ */ Z(z, {
1414
1417
  side: "top",
1415
- children: Lt(n)
1418
+ children: Wt(n)
1416
1419
  })] })
1417
1420
  }) : null;
1418
1421
  return /* @__PURE__ */ Q("span", {
@@ -1422,7 +1425,7 @@ var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
1422
1425
  className: "text-muted-foreground/70",
1423
1426
  children: e
1424
1427
  }),
1425
- t ? /* @__PURE__ */ Z(Rt, {
1428
+ t ? /* @__PURE__ */ Z(Gt, {
1426
1429
  value: t,
1427
1430
  objectSchema: r,
1428
1431
  fieldName: i
@@ -1434,31 +1437,31 @@ var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
1434
1437
  o
1435
1438
  ]
1436
1439
  });
1437
- }, Bt = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1440
+ }, qt = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1438
1441
  let { t: i } = $();
1439
1442
  if (!e) return null;
1440
- let a = Ft(e[Pt.createdAt]), o = Ft(e[Pt.updatedAt]), s = e[Pt.createdBy], c = e[Pt.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));
1443
+ let a = Ht(e[Vt.createdAt]), o = Ht(e[Vt.updatedAt]), s = e[Vt.createdBy], c = e[Vt.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));
1441
1444
  return !l && !d ? null : /* @__PURE__ */ Q("div", {
1442
- className: L("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),
1445
+ className: H("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),
1443
1446
  "data-testid": "record-meta-footer",
1444
- children: [l && /* @__PURE__ */ Z(zt, {
1447
+ children: [l && /* @__PURE__ */ Z(Kt, {
1445
1448
  label: i("detail.createdBy"),
1446
1449
  user: s,
1447
1450
  date: a,
1448
1451
  objectSchema: t,
1449
- userField: Pt.createdBy,
1452
+ userField: Vt.createdBy,
1450
1453
  t: i
1451
- }), d && /* @__PURE__ */ Z(zt, {
1454
+ }), d && /* @__PURE__ */ Z(Kt, {
1452
1455
  label: i("detail.updatedBy"),
1453
1456
  user: c,
1454
1457
  date: o,
1455
1458
  objectSchema: t,
1456
- userField: Pt.updatedBy,
1459
+ userField: Vt.updatedBy,
1457
1460
  t: i
1458
1461
  })]
1459
1462
  });
1460
- }, Vt = 5;
1461
- function Ht(e, t, n, r) {
1463
+ }, Jt = 5;
1464
+ function Yt(e, t, n, r) {
1462
1465
  if (e && typeof e == "object") {
1463
1466
  if (t.primaryField) {
1464
1467
  let n = e[t.primaryField];
@@ -1505,10 +1508,10 @@ function Ht(e, t, n, r) {
1505
1508
  }
1506
1509
  return r;
1507
1510
  }
1508
- var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p }) => {
1509
- let [m, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [E, D] = n.useState(null), [O, ne] = n.useState(!1), { t: z } = $(), { fieldOptionLabel: B } = Ze(), re = te(), V = it(), H = n.useMemo(() => {
1510
- if (!V?.isLoaded || !e.objectName) return e;
1511
- let t = (t) => V.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1511
+ var Xt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: _ }) => {
1512
+ let [v, y] = n.useState(e.data), [b, x] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [S, C] = n.useState(!1), w = m ?? S, [T, E] = n.useState(!1), [D, O] = n.useState({}), [k, A] = n.useState(!1), [j, M] = n.useState(null), [N, U] = n.useState(null), [W, re] = n.useState(!1), [ie, G] = n.useState(0), [ae, oe] = n.useState(!1), { t: K } = $(), { fieldOptionLabel: se } = rt(), le = te(), ue = dt(), q = n.useMemo(() => {
1513
+ if (!ue?.isLoaded || !e.objectName) return e;
1514
+ let t = (t) => ue.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1512
1515
  let n = typeof e == "string" ? e : e?.name;
1513
1516
  return !n || t(n);
1514
1517
  });
@@ -1521,20 +1524,20 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1521
1524
  })),
1522
1525
  summaryFields: n(e.summaryFields)
1523
1526
  };
1524
- }, [e, V]);
1527
+ }, [e, ue]);
1525
1528
  n.useEffect(() => {
1526
- m && p && p(m);
1527
- }, [m, p]);
1528
- let ie = n.useMemo(() => {
1529
- if (H.summaryFields && H.summaryFields.length > 0) return [];
1530
- let e = [...H.sections?.flatMap((e) => e.fields) || [], ...H.fields || []], t = {};
1529
+ v && p && p(v);
1530
+ }, [v, p]);
1531
+ let pe = n.useMemo(() => {
1532
+ if (q.summaryFields && q.summaryFields.length > 0) return [];
1533
+ let e = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []], t = {};
1531
1534
  for (let n of e) t[n.name] || (t[n.name] = n);
1532
- if (E?.fields) for (let [e, n] of Object.entries(E.fields)) t[e] = {
1535
+ if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
1533
1536
  ...t[e] || {},
1534
1537
  ...n,
1535
1538
  name: e
1536
1539
  };
1537
- let n = (e) => m?.[e] !== void 0 && m?.[e] !== null && m?.[e] !== "", r = [], i = [
1540
+ let n = (e) => v?.[e] !== void 0 && v?.[e] !== null && v?.[e] !== "", r = [], i = [
1538
1541
  "status",
1539
1542
  "stage",
1540
1543
  "state",
@@ -1546,167 +1549,211 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1546
1549
  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));
1547
1550
  return o && !r.includes(o) && r.push(o), r;
1548
1551
  }, [
1549
- H.summaryFields,
1550
- H.sections,
1551
- H.fields,
1552
- E,
1553
- m
1554
- ]), U = H.summaryFields && H.summaryFields.length > 0 ? H.summaryFields : ie, ae = n.useCallback(() => {
1555
- H.resourceId && navigator.clipboard.writeText(String(H.resourceId)).then(() => {
1556
- ne(!0), setTimeout(() => ne(!1), 1500);
1552
+ q.summaryFields,
1553
+ q.sections,
1554
+ q.fields,
1555
+ N,
1556
+ v
1557
+ ]), me = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : pe, he = n.useCallback(() => {
1558
+ q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
1559
+ re(!0), setTimeout(() => re(!1), 1500);
1557
1560
  });
1558
- }, [H.resourceId]);
1561
+ }, [q.resourceId]);
1559
1562
  n.useEffect(() => {
1560
1563
  let e = !0;
1561
- if (H.data) {
1562
- _(H.data), y(!1);
1563
- return;
1564
- }
1565
- if (r && H.objectName && H.resourceId) {
1566
- y(!0), D(null), _(null);
1567
- let n = H.objectName, i = H.resourceId, a = `${n}-`, o = [...H.sections?.flatMap((e) => e.fields) || [], ...H.fields || []];
1564
+ if (q.data) return y(q.data), x(!1), r?.getObjectSchema && q.objectName && r.getObjectSchema(q.objectName).then((t) => {
1565
+ e && U(t);
1566
+ }).catch(() => {}), () => {
1567
+ e = !1;
1568
+ };
1569
+ if (r && q.objectName && q.resourceId) {
1570
+ x(!0), U(null), y(null);
1571
+ let n = q.objectName, i = q.resourceId, a = `${n}-`, o = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []];
1568
1572
  (r.getObjectSchema ? r.getObjectSchema(n).catch(() => null) : Promise.resolve(null)).then((s) => {
1569
1573
  if (!e) return;
1570
- D(s);
1574
+ U(s);
1571
1575
  let c = t(s?.fields, o), l = c.length > 0 ? { $expand: c } : void 0, u = l ? r.findOne(n, i, l) : r.findOne(n, i), d = () => {
1572
1576
  let t = String(i), o = t.startsWith(a) ? t.slice(a.length) : `${a}${t}`;
1573
1577
  return (l ? r.findOne(n, o, l) : r.findOne(n, o)).then((t) => {
1574
- e && (_(t), y(!1));
1578
+ e && (y(t), x(!1));
1575
1579
  }).catch(() => {
1576
- e && (_(null), y(!1));
1580
+ e && (y(null), x(!1));
1577
1581
  });
1578
1582
  };
1579
1583
  return u.catch(() => null).then((t) => {
1580
1584
  if (e) {
1581
1585
  if (t) {
1582
- _(t), y(!1);
1586
+ y(t), x(!1);
1583
1587
  return;
1584
1588
  }
1585
1589
  return d();
1586
1590
  }
1587
1591
  });
1588
1592
  }).catch((t) => {
1589
- e && (console.error("Failed to fetch detail data:", t), y(!1));
1593
+ e && (console.error("Failed to fetch detail data:", t), x(!1));
1590
1594
  });
1591
- } else H.api && H.resourceId && (y(!0), fetch(`${H.api}/${H.resourceId}`).then((e) => e.json()).then((t) => {
1592
- e && _(t?.data || t);
1595
+ } else q.api && q.resourceId && (x(!0), fetch(`${q.api}/${q.resourceId}`).then((e) => e.json()).then((t) => {
1596
+ e && y(t?.data || t);
1593
1597
  }).catch((e) => {
1594
1598
  console.error("Failed to fetch detail data:", e);
1595
1599
  }).finally(() => {
1596
- e && y(!1);
1600
+ e && x(!1);
1597
1601
  }));
1598
1602
  return () => {
1599
1603
  e = !1;
1600
1604
  };
1601
1605
  }, [
1602
- H.api,
1603
- H.resourceId,
1604
- H.objectName,
1606
+ q.api,
1607
+ q.resourceId,
1608
+ q.objectName,
1605
1609
  r,
1606
- H.sections,
1607
- H.fields
1610
+ q.sections,
1611
+ q.fields,
1612
+ ie
1608
1613
  ]);
1609
- let oe = n.useCallback(() => {
1614
+ let _e = n.useCallback(() => {
1610
1615
  if (s) s();
1611
- else if (H.onNavigate) {
1612
- let e = H.backUrl || (H.objectName ? `/${H.objectName}` : "/");
1613
- H.onNavigate(e, { replace: !0 });
1614
- } else H.backUrl ? window.location.href = H.backUrl : window.history.back();
1615
- }, [s, H]), se = n.useCallback(() => {
1616
- a ? a() : H.onNavigate && H.editUrl ? H.onNavigate(H.editUrl) : H.onNavigate && H.objectName && H.resourceId ? H.onNavigate(`/${H.objectName}/${H.resourceId}/edit`) : H.editUrl && (window.location.href = H.editUrl);
1617
- }, [a, H]), ue = n.useCallback(() => {
1618
- let e = H.deleteConfirmation || z("detail.deleteConfirmation");
1619
- window.confirm(e) && (o?.(), H.onNavigate && H.objectName && H.onNavigate(`/${H.objectName}`, { replace: !0 }));
1620
- }, [o, H]), de = n.useCallback(() => {
1621
- navigator.share && H.objectName && H.resourceId ? navigator.share({
1622
- title: H.title || z("detail.details"),
1623
- text: `${H.objectName} #${H.resourceId}`,
1616
+ else if (q.onNavigate) {
1617
+ let e = q.backUrl || (q.objectName ? `/${q.objectName}` : "/");
1618
+ q.onNavigate(e, { replace: !0 });
1619
+ } else q.backUrl ? window.location.href = q.backUrl : window.history.back();
1620
+ }, [s, q]), ve = n.useCallback(() => {
1621
+ 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);
1622
+ }, [a, q]), ye = n.useCallback(async () => {
1623
+ if (!r?.cancelPendingApproval || !q.objectName || !q.resourceId) {
1624
+ M(K("detail.cancelApprovalUnavailable"));
1625
+ return;
1626
+ }
1627
+ oe(!0), M(null);
1628
+ try {
1629
+ if (await r.cancelPendingApproval(String(q.objectName), String(q.resourceId)), r.findOne) try {
1630
+ let e = await r.findOne(String(q.objectName), String(q.resourceId));
1631
+ e && y(e);
1632
+ } catch {}
1633
+ G((e) => e + 1);
1634
+ try {
1635
+ window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
1636
+ objectName: String(q.objectName),
1637
+ recordId: String(q.resourceId),
1638
+ reason: "approval-recalled"
1639
+ } }));
1640
+ } catch {}
1641
+ } catch (e) {
1642
+ let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
1643
+ M(`${K("detail.cancelApprovalFailed")}: ${t}`);
1644
+ } finally {
1645
+ oe(!1);
1646
+ }
1647
+ }, [
1648
+ r,
1649
+ q.objectName,
1650
+ q.resourceId,
1651
+ K
1652
+ ]), be = n.useCallback(() => {
1653
+ let e = q.deleteConfirmation || K("detail.deleteConfirmation");
1654
+ window.confirm(e) && (o?.(), q.onNavigate && q.objectName && q.onNavigate(`/${q.objectName}`, { replace: !0 }));
1655
+ }, [o, q]), Y = n.useCallback(() => {
1656
+ navigator.share && q.objectName && q.resourceId ? navigator.share({
1657
+ title: q.title || K("detail.details"),
1658
+ text: `${q.objectName} #${q.resourceId}`,
1624
1659
  url: window.location.href
1625
1660
  }).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
1626
1661
  console.log("Link copied to clipboard");
1627
1662
  });
1628
- }, [H]), fe = n.useCallback(() => {
1629
- x(!b);
1630
- }, [b]), pe = n.useCallback(() => {
1631
- if (S) {
1632
- let e = Object.entries(w);
1663
+ }, [q]), xe = n.useCallback(() => {
1664
+ let e = !w;
1665
+ _ && _(e), m === void 0 && C(e);
1666
+ }, [
1667
+ w,
1668
+ m,
1669
+ _
1670
+ ]), Se = n.useCallback(async () => {
1671
+ if (T) {
1672
+ let e = Object.entries(D);
1633
1673
  if (e.length > 0) {
1634
- let t = {
1635
- ...m,
1636
- ...w
1674
+ let t = v, n = {
1675
+ ...v,
1676
+ ...D
1637
1677
  };
1638
- _(t), e.forEach(([e, n]) => {
1639
- l?.(e, n, t);
1640
- });
1678
+ y(n), M(null), A(!0);
1679
+ try {
1680
+ if (l) for (let [t, r] of e) await l(t, r, n);
1681
+ O({}), E(!1);
1682
+ } catch (e) {
1683
+ y(t), M((e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, ""));
1684
+ } finally {
1685
+ A(!1);
1686
+ }
1687
+ return;
1641
1688
  }
1642
- T({});
1689
+ O({});
1643
1690
  }
1644
- C(!S);
1691
+ E(!T), M(null);
1645
1692
  }, [
1646
- S,
1647
- w,
1648
- m,
1693
+ T,
1694
+ D,
1695
+ v,
1649
1696
  l
1650
- ]), ge = n.useCallback(() => {
1651
- T({}), C(!1);
1652
- }, []), G = n.useCallback((e, t) => {
1653
- T((n) => ({
1697
+ ]), Ce = n.useCallback(() => {
1698
+ O({}), E(!1), M(null);
1699
+ }, []), X = n.useCallback((e, t) => {
1700
+ O((n) => ({
1654
1701
  ...n,
1655
1702
  [e]: t
1656
1703
  }));
1657
1704
  }, []);
1658
1705
  n.useEffect(() => {
1659
- if (!H.recordNavigation) return;
1660
- let e = H.recordNavigation, t = (t) => {
1706
+ if (!q.recordNavigation) return;
1707
+ let e = q.recordNavigation, t = (t) => {
1661
1708
  let n = t.target?.tagName;
1662
1709
  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])));
1663
1710
  };
1664
1711
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1665
- }, [H.recordNavigation]);
1666
- let _e = n.useMemo(() => H.related ?? [], [H.related]), ve = n.useMemo(() => {
1712
+ }, [q.recordNavigation]);
1713
+ let we = n.useMemo(() => q.related ?? [], [q.related]), Te = n.useMemo(() => {
1667
1714
  let e = [];
1668
1715
  return e.push({
1669
1716
  name: "sys_share",
1670
- label: z("detail.share"),
1717
+ label: K("detail.share"),
1671
1718
  icon: "share-2",
1672
1719
  type: "script",
1673
- onClick: de
1674
- }), H.showEdit && e.push({
1720
+ onClick: Y
1721
+ }), q.showEdit && e.push({
1675
1722
  name: "sys_edit_mobile",
1676
- label: z("detail.edit"),
1723
+ label: K("detail.edit"),
1677
1724
  icon: "edit",
1678
1725
  type: "script",
1679
1726
  className: "sm:hidden",
1680
- onClick: se
1727
+ onClick: ve
1681
1728
  }), c && e.push({
1682
1729
  name: "sys_toggle_inline_edit_mobile",
1683
- label: z(S ? "detail.save" : "detail.editInline"),
1730
+ label: K(T ? "detail.save" : "detail.editInline"),
1684
1731
  icon: "edit",
1685
1732
  type: "script",
1686
1733
  className: "sm:hidden",
1687
- onClick: pe
1688
- }), H.showDelete && e.push({
1734
+ onClick: Se
1735
+ }), q.showDelete && e.push({
1689
1736
  name: "sys_delete",
1690
- label: z("detail.delete"),
1737
+ label: K("detail.delete"),
1691
1738
  icon: "trash-2",
1692
1739
  type: "script",
1693
1740
  variant: "destructive",
1694
1741
  tags: ["separator-before"],
1695
- onClick: ue
1742
+ onClick: be
1696
1743
  }), e;
1697
1744
  }, [
1698
- z,
1699
- H.showEdit,
1700
- H.showDelete,
1745
+ K,
1746
+ q.showEdit,
1747
+ q.showDelete,
1701
1748
  c,
1702
- S,
1703
- de,
1704
- se,
1705
- pe,
1706
- ue
1707
- ]), ye = n.useMemo(() => {
1708
- let e = H.actions ?? [];
1709
- if (ve.length === 0) return e;
1749
+ T,
1750
+ Y,
1751
+ ve,
1752
+ Se,
1753
+ be
1754
+ ]), Ee = n.useMemo(() => {
1755
+ let e = q.actions ?? [];
1756
+ if (Te.length === 0) return e;
1710
1757
  let t = !1, n = e.map((e) => {
1711
1758
  let n = e;
1712
1759
  if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
@@ -1714,7 +1761,7 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1714
1761
  let e = Array.isArray(n.systemActions) ? n.systemActions : [];
1715
1762
  return {
1716
1763
  ...n,
1717
- systemActions: [...e, ...ve]
1764
+ systemActions: [...e, ...Te]
1718
1765
  };
1719
1766
  }
1720
1767
  return e;
@@ -1722,64 +1769,64 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1722
1769
  return t || n.push({
1723
1770
  type: "action:bar",
1724
1771
  location: "record_header",
1725
- systemActions: ve
1772
+ systemActions: Te
1726
1773
  }), n;
1727
- }, [H.actions, ve]);
1728
- return v || H.loading ? /* @__PURE__ */ Q("div", {
1729
- className: L("space-y-4", i),
1774
+ }, [q.actions, Te]);
1775
+ return b || q.loading ? /* @__PURE__ */ Q("div", {
1776
+ className: H("space-y-4", i),
1730
1777
  children: [
1731
- /* @__PURE__ */ Z(k, { className: "h-10 w-full" }),
1732
- /* @__PURE__ */ Z(k, { className: "h-64 w-full" }),
1733
- /* @__PURE__ */ Z(k, { className: "h-48 w-full" })
1778
+ /* @__PURE__ */ Z(P, { className: "h-10 w-full" }),
1779
+ /* @__PURE__ */ Z(P, { className: "h-64 w-full" }),
1780
+ /* @__PURE__ */ Z(P, { className: "h-48 w-full" })
1734
1781
  ]
1735
- }) : !m && !H.data ? /* @__PURE__ */ Q("div", {
1736
- className: L("flex flex-col items-center justify-center py-16 text-center", i),
1782
+ }) : !v && !q.data ? /* @__PURE__ */ Q("div", {
1783
+ className: H("flex flex-col items-center justify-center py-16 text-center", i),
1737
1784
  children: [
1738
1785
  /* @__PURE__ */ Z("p", {
1739
1786
  className: "text-lg font-semibold",
1740
- children: z("detail.recordNotFound")
1787
+ children: K("detail.recordNotFound")
1741
1788
  }),
1742
1789
  /* @__PURE__ */ Z("p", {
1743
1790
  className: "text-sm text-muted-foreground mt-1",
1744
- children: z("detail.recordNotFoundDescription")
1791
+ children: K("detail.recordNotFoundDescription")
1745
1792
  }),
1746
- (H.showBack ?? !0) && /* @__PURE__ */ Q(g, {
1793
+ (q.showBack ?? !0) && /* @__PURE__ */ Q(g, {
1747
1794
  variant: "outline",
1748
1795
  size: "sm",
1749
- onClick: oe,
1796
+ onClick: _e,
1750
1797
  className: "mt-4 gap-2",
1751
- children: [/* @__PURE__ */ Z(R, { className: "h-4 w-4" }), z("detail.goBack")]
1798
+ children: [/* @__PURE__ */ Z(ne, { className: "h-4 w-4" }), K("detail.goBack")]
1752
1799
  })
1753
1800
  ]
1754
- }) : /* @__PURE__ */ Z(F, { children: /* @__PURE__ */ Q("div", {
1755
- className: L("space-y-6", i),
1801
+ }) : /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Q("div", {
1802
+ className: H("space-y-6", i),
1756
1803
  children: [
1757
- H.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1804
+ q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1758
1805
  className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
1759
1806
  children: [/* @__PURE__ */ Q("div", {
1760
1807
  className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
1761
- children: [(H.showBack ?? !0) && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1808
+ children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1762
1809
  asChild: !0,
1763
1810
  children: /* @__PURE__ */ Z(g, {
1764
1811
  variant: "ghost",
1765
1812
  size: "icon",
1766
- onClick: oe,
1813
+ onClick: _e,
1767
1814
  className: "shrink-0 mt-1",
1768
- children: /* @__PURE__ */ Z(R, { className: "h-4 w-4" })
1815
+ children: /* @__PURE__ */ Z(ne, { className: "h-4 w-4" })
1769
1816
  })
1770
- }), /* @__PURE__ */ Z(P, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
1817
+ }), /* @__PURE__ */ Z(z, { children: K("detail.back") })] }), /* @__PURE__ */ Q("div", {
1771
1818
  className: "flex-1 min-w-0",
1772
1819
  children: [/* @__PURE__ */ Q("div", {
1773
1820
  className: "flex items-center gap-2 flex-wrap",
1774
1821
  children: [
1775
1822
  /* @__PURE__ */ Z("h1", {
1776
1823
  className: "text-xl sm:text-2xl font-bold truncate",
1777
- children: Ht(m, H, E, z("detail.details"))
1824
+ children: Yt(v, q, N, K("detail.details"))
1778
1825
  }),
1779
- U.map((e) => {
1780
- let t = m?.[e];
1826
+ me.map((e) => {
1827
+ let t = v?.[e];
1781
1828
  if (t == null || t === "") return null;
1782
- let n = (H.sections || []).flatMap((e) => e.fields).concat(H.fields || []).find((t) => t.name === e), r = E?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
1829
+ 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;
1783
1830
  try {
1784
1831
  if (i === "currency") {
1785
1832
  let e = Number(t);
@@ -1810,7 +1857,7 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1810
1857
  let e = i[String(t)];
1811
1858
  e?.label && (o = e.label);
1812
1859
  }
1813
- a = H.objectName ? B(H.objectName, e, String(t), o) : o;
1860
+ a = q.objectName ? se(q.objectName, e, String(t), o) : o;
1814
1861
  }
1815
1862
  } catch {}
1816
1863
  return o === null ? /* @__PURE__ */ Z(h, {
@@ -1832,251 +1879,297 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
1832
1879
  }), a]
1833
1880
  }, e);
1834
1881
  }),
1835
- /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1882
+ /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1836
1883
  asChild: !0,
1837
1884
  children: /* @__PURE__ */ Z(g, {
1838
1885
  variant: "ghost",
1839
1886
  size: "icon",
1840
1887
  className: "h-6 w-6 shrink-0",
1841
- onClick: fe,
1842
- "aria-label": z(b ? "detail.removeFromFavorites" : "detail.addToFavorites"),
1843
- children: b ? /* @__PURE__ */ Z(Re, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Re, { className: "h-4 w-4 text-muted-foreground" })
1888
+ onClick: xe,
1889
+ "aria-label": K(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
1890
+ children: w ? /* @__PURE__ */ Z(We, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(We, { className: "h-4 w-4 text-muted-foreground" })
1844
1891
  })
1845
- }), /* @__PURE__ */ Z(P, { children: z(b ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
1892
+ }), /* @__PURE__ */ Z(z, { children: K(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
1846
1893
  ]
1847
- }), H.objectName && /* @__PURE__ */ Q("p", {
1894
+ }), q.objectName && /* @__PURE__ */ Q("p", {
1848
1895
  className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
1849
1896
  children: [/* @__PURE__ */ Z("span", {
1850
1897
  className: "font-medium",
1851
- children: f || H.objectName
1852
- }), H.resourceId && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1898
+ children: f || q.objectName
1899
+ }), q.resourceId && /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1853
1900
  asChild: !0,
1854
1901
  children: /* @__PURE__ */ Z(g, {
1855
1902
  variant: "ghost",
1856
1903
  size: "icon",
1857
1904
  className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
1858
- onClick: ae,
1859
- "aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
1860
- children: O ? /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(me, { className: "h-3 w-3" })
1905
+ onClick: he,
1906
+ "aria-label": K("detail.copyRecordId", { defaultValue: "Copy record ID" }),
1907
+ children: W ? /* @__PURE__ */ Z(ce, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(ge, { className: "h-3 w-3" })
1861
1908
  })
1862
- }), /* @__PURE__ */ Z(P, { children: O ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
1909
+ }), /* @__PURE__ */ Z(z, { children: W ? K("detail.copied", { defaultValue: "Copied" }) : K("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
1863
1910
  })]
1864
1911
  })]
1865
1912
  }), /* @__PURE__ */ Q("div", {
1866
1913
  className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
1867
1914
  children: [
1868
- H.recordNavigation && /* @__PURE__ */ Q("div", {
1915
+ q.recordNavigation && /* @__PURE__ */ Q("div", {
1869
1916
  className: "flex items-center gap-1 mr-2",
1870
1917
  children: [
1871
- /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1918
+ /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1872
1919
  asChild: !0,
1873
1920
  children: /* @__PURE__ */ Z(g, {
1874
1921
  variant: "outline",
1875
1922
  size: "icon",
1876
1923
  className: "h-8 w-8",
1877
- disabled: H.recordNavigation.currentIndex <= 0,
1924
+ disabled: q.recordNavigation.currentIndex <= 0,
1878
1925
  onClick: () => {
1879
- let e = H.recordNavigation;
1926
+ let e = q.recordNavigation;
1880
1927
  e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
1881
1928
  },
1882
- children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
1929
+ children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
1883
1930
  })
1884
- }), /* @__PURE__ */ Z(P, { children: z("detail.previousRecord") })] }),
1931
+ }), /* @__PURE__ */ Z(z, { children: K("detail.previousRecord") })] }),
1885
1932
  /* @__PURE__ */ Z("span", {
1886
1933
  className: "text-xs text-muted-foreground whitespace-nowrap px-1",
1887
- children: z("detail.recordOf", {
1888
- current: H.recordNavigation.currentIndex + 1,
1889
- total: H.recordNavigation.recordIds.length
1934
+ children: K("detail.recordOf", {
1935
+ current: q.recordNavigation.currentIndex + 1,
1936
+ total: q.recordNavigation.recordIds.length
1890
1937
  })
1891
1938
  }),
1892
- /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1939
+ /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1893
1940
  asChild: !0,
1894
1941
  children: /* @__PURE__ */ Z(g, {
1895
1942
  variant: "outline",
1896
1943
  size: "icon",
1897
1944
  className: "h-8 w-8",
1898
- disabled: H.recordNavigation.currentIndex >= H.recordNavigation.recordIds.length - 1,
1945
+ disabled: q.recordNavigation.currentIndex >= q.recordNavigation.recordIds.length - 1,
1899
1946
  onClick: () => {
1900
- let e = H.recordNavigation;
1947
+ let e = q.recordNavigation;
1901
1948
  e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
1902
1949
  },
1903
- children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
1950
+ children: /* @__PURE__ */ Z(fe, { className: "h-4 w-4" })
1904
1951
  })
1905
- }), /* @__PURE__ */ Z(P, { children: z("detail.nextRecord") })] })
1952
+ }), /* @__PURE__ */ Z(z, { children: K("detail.nextRecord") })] })
1906
1953
  ]
1907
1954
  }),
1908
- c && /* @__PURE__ */ Q(nt, { children: [S && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1955
+ c && /* @__PURE__ */ Q(lt, { children: [T && /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1909
1956
  asChild: !0,
1910
1957
  children: /* @__PURE__ */ Q(g, {
1911
1958
  variant: "ghost",
1912
1959
  size: "sm",
1913
- onClick: ge,
1960
+ onClick: Ce,
1914
1961
  className: "gap-2 hidden sm:inline-flex",
1915
- children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1962
+ children: [/* @__PURE__ */ Z(qe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1916
1963
  className: "hidden sm:inline",
1917
- children: z("detail.cancel")
1964
+ children: K("detail.cancel")
1918
1965
  })]
1919
1966
  })
1920
- }), /* @__PURE__ */ Z(P, { children: z("detail.cancelEdit") })] }), /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1967
+ }), /* @__PURE__ */ Z(z, { children: K("detail.cancelEdit") })] }), /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1921
1968
  asChild: !0,
1922
1969
  children: /* @__PURE__ */ Z(g, {
1923
- variant: S ? "default" : "outline",
1970
+ variant: T ? "default" : "outline",
1924
1971
  size: "sm",
1925
- onClick: pe,
1972
+ onClick: Se,
1926
1973
  className: "gap-2 hidden sm:inline-flex",
1927
- children: S ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(W, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1974
+ children: T ? /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1928
1975
  className: "hidden sm:inline",
1929
- children: z("detail.save")
1930
- })] }) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1976
+ children: K("detail.save")
1977
+ })] }) : /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1931
1978
  className: "hidden sm:inline",
1932
- children: z("detail.editInline")
1979
+ children: K("detail.editInline")
1933
1980
  })] })
1934
1981
  })
1935
- }), /* @__PURE__ */ Z(P, { children: z(S ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
1936
- H.showEdit && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
1982
+ }), /* @__PURE__ */ Z(z, { children: K(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
1983
+ q.showEdit && /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Z(V, {
1937
1984
  asChild: !0,
1938
1985
  children: /* @__PURE__ */ Q(g, {
1939
1986
  variant: "default",
1940
- onClick: se,
1987
+ onClick: ve,
1941
1988
  className: "gap-2 hidden sm:inline-flex",
1942
- children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1989
+ children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1943
1990
  className: "hidden sm:inline",
1944
- children: z("detail.edit")
1991
+ children: K("detail.edit")
1945
1992
  })]
1946
1993
  })
1947
- }), /* @__PURE__ */ Z(P, { children: z("detail.editRecord") })] }),
1948
- ye.map((e, t) => /* @__PURE__ */ Z(We, {
1994
+ }), /* @__PURE__ */ Z(z, { children: K("detail.editRecord") })] }),
1995
+ Ee.map((e, t) => /* @__PURE__ */ Z(Xe, {
1949
1996
  schema: e,
1950
- data: m
1997
+ data: v
1951
1998
  }, `header-action-${t}`))
1952
1999
  ]
1953
2000
  })]
1954
2001
  }),
1955
- H.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
1956
- schema: H.header,
1957
- data: m
2002
+ q.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(Xe, {
2003
+ schema: q.header,
2004
+ data: v
1958
2005
  }) }),
1959
- H.highlightFields && H.highlightFields.length > 0 && /* @__PURE__ */ Z(vt, {
1960
- fields: H.highlightFields,
1961
- data: m,
1962
- objectName: H.objectName,
1963
- objectSchema: E
2006
+ q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Tt, {
2007
+ fields: q.highlightFields,
2008
+ data: v,
2009
+ objectName: q.objectName,
2010
+ objectSchema: N
1964
2011
  }),
1965
- H.autoTabs && !H.tabs?.length ? (() => {
1966
- let e = _e.length > 0, t = !!H.activities && H.activities.length > 0, n = !!u, i = !!H.history, a = /* @__PURE__ */ Q("div", {
2012
+ c && q.showHeader === !1 && (() => {
2013
+ let e = v?.approval_status, t = e === "pending" || e === "in_approval";
2014
+ return /* @__PURE__ */ Q("div", {
2015
+ className: "flex flex-col items-end gap-1",
2016
+ children: [/* @__PURE__ */ Q("div", {
2017
+ className: "flex items-center justify-end gap-2",
2018
+ children: [
2019
+ t && !T && /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Q("span", {
2020
+ role: "status",
2021
+ 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",
2022
+ title: K("detail.lockedTooltip"),
2023
+ children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: K("detail.lockedByApproval") })]
2024
+ }), r?.cancelPendingApproval && /* @__PURE__ */ Q(g, {
2025
+ variant: "outline",
2026
+ size: "sm",
2027
+ onClick: ye,
2028
+ disabled: ae,
2029
+ className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
2030
+ title: K("detail.cancelApprovalTooltip"),
2031
+ children: [/* @__PURE__ */ Z(qe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(ae ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2032
+ })] }),
2033
+ T && /* @__PURE__ */ Q(g, {
2034
+ variant: "ghost",
2035
+ size: "sm",
2036
+ onClick: Ce,
2037
+ className: "gap-2",
2038
+ disabled: k,
2039
+ children: [/* @__PURE__ */ Z(qe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K("detail.cancel") })]
2040
+ }),
2041
+ /* @__PURE__ */ Q(g, {
2042
+ variant: T ? "default" : "outline",
2043
+ size: "sm",
2044
+ onClick: Se,
2045
+ className: "gap-2",
2046
+ disabled: k || t && !T,
2047
+ title: t && !T ? K("detail.lockedTooltip") : void 0,
2048
+ children: [Z(T ? ce : J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2049
+ })
2050
+ ]
2051
+ }), j && /* @__PURE__ */ Z("div", {
2052
+ role: "alert",
2053
+ className: "text-xs text-destructive bg-destructive/10 border border-destructive/20 rounded-md px-2 py-1 max-w-md text-right",
2054
+ children: j
2055
+ })]
2056
+ });
2057
+ })(),
2058
+ q.autoTabs && !q.tabs?.length ? (() => {
2059
+ let e = we.length > 0, t = !!q.activities && q.activities.length > 0, n = !!u, i = !!q.history, a = /* @__PURE__ */ Q("div", {
1967
2060
  className: "space-y-3 sm:space-y-4",
1968
2061
  children: [
1969
- H.sectionGroups && H.sectionGroups.length > 0 && H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(_t, {
2062
+ q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(wt, {
1970
2063
  group: e,
1971
2064
  data: {
1972
- ...m,
1973
- ...w
2065
+ ...v,
2066
+ ...D
1974
2067
  },
1975
- objectSchema: E,
1976
- objectName: H.objectName,
1977
- isEditing: S,
1978
- onFieldChange: G
2068
+ objectSchema: N,
2069
+ objectName: q.objectName,
2070
+ isEditing: T,
2071
+ onFieldChange: X
1979
2072
  }, t)),
1980
- H.sections && H.sections.length > 0 && H.sections.map((e, t) => /* @__PURE__ */ Z(pt, {
2073
+ q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(bt, {
1981
2074
  section: e,
1982
2075
  data: {
1983
- ...m,
1984
- ...w
2076
+ ...v,
2077
+ ...D
1985
2078
  },
1986
- objectSchema: E,
1987
- objectName: H.objectName,
1988
- isEditing: S,
1989
- onFieldChange: G
2079
+ objectSchema: N,
2080
+ objectName: q.objectName,
2081
+ isEditing: T,
2082
+ onFieldChange: X
1990
2083
  }, t)),
1991
- H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
2084
+ q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(bt, {
1992
2085
  section: {
1993
- fields: H.fields,
1994
- columns: H.columns
2086
+ fields: q.fields,
2087
+ columns: q.columns
1995
2088
  },
1996
2089
  data: {
1997
- ...m,
1998
- ...w
2090
+ ...v,
2091
+ ...D
1999
2092
  },
2000
- objectSchema: E,
2001
- objectName: H.objectName,
2002
- isEditing: S,
2003
- onFieldChange: G
2093
+ objectSchema: N,
2094
+ objectName: q.objectName,
2095
+ isEditing: T,
2096
+ onFieldChange: X
2004
2097
  }),
2005
- H.comments && /* @__PURE__ */ Z(bt, {
2006
- comments: H.comments,
2007
- onAddComment: H.onAddComment
2098
+ q.comments && /* @__PURE__ */ Z(Dt, {
2099
+ comments: q.comments,
2100
+ onAddComment: q.onAddComment
2008
2101
  })
2009
2102
  ]
2010
2103
  });
2011
2104
  return !e && !t && !n && !i ? /* @__PURE__ */ Z("div", {
2012
2105
  className: "mt-2",
2013
2106
  children: a
2014
- }) : /* @__PURE__ */ Q(A, {
2107
+ }) : /* @__PURE__ */ Q(ee, {
2015
2108
  defaultValue: "details",
2016
2109
  className: "w-full",
2017
2110
  children: [
2018
- /* @__PURE__ */ Q(ee, {
2111
+ /* @__PURE__ */ Q(I, {
2019
2112
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
2020
2113
  children: [
2021
- /* @__PURE__ */ Z(M, {
2114
+ /* @__PURE__ */ Z(L, {
2022
2115
  value: "details",
2023
2116
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2024
- children: z("detail.details")
2117
+ children: K("detail.details")
2025
2118
  }),
2026
- e && /* @__PURE__ */ Z(M, {
2119
+ e && /* @__PURE__ */ Z(L, {
2027
2120
  value: "related",
2028
2121
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2029
2122
  children: /* @__PURE__ */ Q("span", {
2030
2123
  className: "flex items-center gap-1.5",
2031
- children: [z("detail.related"), /* @__PURE__ */ Z(h, {
2124
+ children: [K("detail.related"), /* @__PURE__ */ Z(h, {
2032
2125
  variant: "secondary",
2033
2126
  className: "text-xs bg-primary/10 text-primary border-transparent",
2034
- children: _e.length
2127
+ children: we.length
2035
2128
  })]
2036
2129
  })
2037
2130
  }),
2038
- t && /* @__PURE__ */ Z(M, {
2131
+ t && /* @__PURE__ */ Z(L, {
2039
2132
  value: "activity",
2040
2133
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2041
2134
  children: /* @__PURE__ */ Q("span", {
2042
2135
  className: "flex items-center gap-1.5",
2043
- children: [z("detail.activity"), /* @__PURE__ */ Z(h, {
2136
+ children: [K("detail.activity"), /* @__PURE__ */ Z(h, {
2044
2137
  variant: "secondary",
2045
2138
  className: "text-xs bg-primary/10 text-primary border-transparent",
2046
- children: H.activities.length
2139
+ children: q.activities.length
2047
2140
  })]
2048
2141
  })
2049
2142
  }),
2050
- n && /* @__PURE__ */ Z(M, {
2143
+ n && /* @__PURE__ */ Z(L, {
2051
2144
  value: "discussion",
2052
2145
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2053
- children: z("detail.discussion", { defaultValue: "Discussion" })
2146
+ children: K("detail.discussion", { defaultValue: "Discussion" })
2054
2147
  }),
2055
- i && /* @__PURE__ */ Z(M, {
2148
+ i && /* @__PURE__ */ Z(L, {
2056
2149
  value: "history",
2057
2150
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2058
2151
  children: /* @__PURE__ */ Q("span", {
2059
2152
  className: "flex items-center gap-1.5",
2060
- children: [z("detail.history", { defaultValue: "History" }), !H.history.loading && H.history.entries.length > 0 && /* @__PURE__ */ Z(h, {
2153
+ children: [K("detail.history", { defaultValue: "History" }), !q.history.loading && q.history.entries.length > 0 && /* @__PURE__ */ Z(h, {
2061
2154
  variant: "secondary",
2062
2155
  className: "text-xs bg-primary/10 text-primary border-transparent",
2063
- children: H.history.entries.length
2156
+ children: q.history.entries.length
2064
2157
  })]
2065
2158
  })
2066
2159
  })
2067
2160
  ]
2068
2161
  }),
2069
- /* @__PURE__ */ Z(j, {
2162
+ /* @__PURE__ */ Z(F, {
2070
2163
  value: "details",
2071
2164
  className: "mt-4",
2072
2165
  children: a
2073
2166
  }),
2074
- e && /* @__PURE__ */ Z(j, {
2167
+ e && /* @__PURE__ */ Z(F, {
2075
2168
  value: "related",
2076
2169
  className: "mt-4",
2077
2170
  children: /* @__PURE__ */ Z("div", {
2078
2171
  className: "space-y-3",
2079
- children: _e.map((e, t) => /* @__PURE__ */ Z(gt, {
2172
+ children: we.map((e, t) => /* @__PURE__ */ Z(Ct, {
2080
2173
  title: e.title,
2081
2174
  type: e.type,
2082
2175
  api: e.api,
@@ -2092,85 +2185,85 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2092
2185
  onRowEdit: e.onRowEdit,
2093
2186
  onRowDelete: e.onRowDelete,
2094
2187
  collapsible: !0,
2095
- defaultCollapsed: re && t > 0,
2096
- pageSize: Vt
2188
+ defaultCollapsed: le && t > 0,
2189
+ pageSize: Jt
2097
2190
  }, t))
2098
2191
  })
2099
2192
  }),
2100
- t && /* @__PURE__ */ Z(j, {
2193
+ t && /* @__PURE__ */ Z(F, {
2101
2194
  value: "activity",
2102
2195
  className: "mt-4",
2103
- children: /* @__PURE__ */ Z(Et, { activities: H.activities })
2196
+ children: /* @__PURE__ */ Z(Nt, { activities: q.activities })
2104
2197
  }),
2105
- n && /* @__PURE__ */ Z(j, {
2198
+ n && /* @__PURE__ */ Z(F, {
2106
2199
  value: "discussion",
2107
2200
  className: "mt-4",
2108
2201
  children: u
2109
2202
  }),
2110
- i && /* @__PURE__ */ Z(j, {
2203
+ i && /* @__PURE__ */ Z(F, {
2111
2204
  value: "history",
2112
2205
  className: "mt-4",
2113
- children: /* @__PURE__ */ Z(Nt, {
2114
- entries: H.history.entries,
2115
- loading: H.history.loading,
2116
- emptyText: H.history.emptyText ?? z("detail.historyEmpty", { defaultValue: "No history yet" })
2206
+ children: /* @__PURE__ */ Z(Bt, {
2207
+ entries: q.history.entries,
2208
+ loading: q.history.loading,
2209
+ emptyText: q.history.emptyText ?? K("detail.historyEmpty", { defaultValue: "No history yet" })
2117
2210
  })
2118
2211
  })
2119
2212
  ]
2120
2213
  });
2121
- })() : /* @__PURE__ */ Q(nt, { children: [
2122
- H.sectionGroups && H.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2214
+ })() : /* @__PURE__ */ Q(lt, { children: [
2215
+ q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2123
2216
  className: "space-y-3 sm:space-y-4",
2124
- children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(_t, {
2217
+ children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(wt, {
2125
2218
  group: e,
2126
2219
  data: {
2127
- ...m,
2128
- ...w
2220
+ ...v,
2221
+ ...D
2129
2222
  },
2130
- objectSchema: E,
2131
- objectName: H.objectName,
2132
- isEditing: S,
2133
- onFieldChange: G
2223
+ objectSchema: N,
2224
+ objectName: q.objectName,
2225
+ isEditing: T,
2226
+ onFieldChange: X
2134
2227
  }, t))
2135
2228
  }),
2136
- H.sections && H.sections.length > 0 && /* @__PURE__ */ Z("div", {
2229
+ q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
2137
2230
  className: "space-y-3 sm:space-y-4",
2138
- children: H.sections.map((e, t) => /* @__PURE__ */ Z(pt, {
2231
+ children: q.sections.map((e, t) => /* @__PURE__ */ Z(bt, {
2139
2232
  section: e,
2140
2233
  data: {
2141
- ...m,
2142
- ...w
2234
+ ...v,
2235
+ ...D
2143
2236
  },
2144
- objectSchema: E,
2145
- objectName: H.objectName,
2146
- isEditing: S,
2147
- onFieldChange: G
2237
+ objectSchema: N,
2238
+ objectName: q.objectName,
2239
+ isEditing: T,
2240
+ onFieldChange: X
2148
2241
  }, t))
2149
2242
  }),
2150
- H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
2243
+ q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(bt, {
2151
2244
  section: {
2152
- fields: H.fields,
2153
- columns: H.columns
2245
+ fields: q.fields,
2246
+ columns: q.columns
2154
2247
  },
2155
2248
  data: {
2156
- ...m,
2157
- ...w
2249
+ ...v,
2250
+ ...D
2158
2251
  },
2159
- objectSchema: E,
2160
- objectName: H.objectName,
2161
- isEditing: S,
2162
- onFieldChange: G
2252
+ objectSchema: N,
2253
+ objectName: q.objectName,
2254
+ isEditing: T,
2255
+ onFieldChange: X
2163
2256
  }),
2164
- H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(mt, {
2165
- tabs: H.tabs,
2166
- data: m
2257
+ q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(xt, {
2258
+ tabs: q.tabs,
2259
+ data: v
2167
2260
  }),
2168
- _e.length > 0 && /* @__PURE__ */ Q("div", {
2261
+ we.length > 0 && /* @__PURE__ */ Q("div", {
2169
2262
  className: "space-y-3",
2170
2263
  children: [/* @__PURE__ */ Z("h2", {
2171
2264
  className: "text-lg font-semibold",
2172
- children: z("detail.related")
2173
- }), _e.map((e, t) => /* @__PURE__ */ Z(gt, {
2265
+ children: K("detail.related")
2266
+ }), we.map((e, t) => /* @__PURE__ */ Z(Ct, {
2174
2267
  title: e.title,
2175
2268
  type: e.type,
2176
2269
  api: e.api,
@@ -2186,31 +2279,31 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2186
2279
  onRowEdit: e.onRowEdit,
2187
2280
  onRowDelete: e.onRowDelete,
2188
2281
  collapsible: !0,
2189
- defaultCollapsed: re && t > 0,
2190
- pageSize: Vt
2282
+ defaultCollapsed: le && t > 0,
2283
+ pageSize: Jt
2191
2284
  }, t))]
2192
2285
  }),
2193
- H.comments && /* @__PURE__ */ Z(bt, {
2194
- comments: H.comments,
2195
- onAddComment: H.onAddComment
2286
+ q.comments && /* @__PURE__ */ Z(Dt, {
2287
+ comments: q.comments,
2288
+ onAddComment: q.onAddComment
2196
2289
  }),
2197
- H.activities && H.activities.length > 0 && /* @__PURE__ */ Z(Et, { activities: H.activities })
2290
+ q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(Nt, { activities: q.activities })
2198
2291
  ] }),
2199
- /* @__PURE__ */ Z(Bt, {
2292
+ /* @__PURE__ */ Z(qt, {
2200
2293
  data: {
2201
- ...m,
2202
- ...w
2294
+ ...v,
2295
+ ...D
2203
2296
  },
2204
- objectSchema: E,
2205
- objectName: H.objectName
2297
+ objectSchema: N,
2298
+ objectName: q.objectName
2206
2299
  }),
2207
- H.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
2208
- schema: H.footer,
2209
- data: m
2300
+ q.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(Xe, {
2301
+ schema: q.footer,
2302
+ data: v
2210
2303
  }) })
2211
2304
  ]
2212
2305
  }) });
2213
- }, Wt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Gt = (e) => {
2306
+ }, Zt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Qt = (e) => {
2214
2307
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2215
2308
  return {
2216
2309
  designer: {
@@ -2220,21 +2313,21 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2220
2313
  },
2221
2314
  rest: i
2222
2315
  };
2223
- }, Kt = ({ schema: e = {}, className: t, ...n }) => {
2224
- let r = Ye(), { designer: i } = Gt(n);
2225
- if (!r) return /* @__PURE__ */ Z("div", {
2316
+ }, $t = ({ schema: e = {}, className: t, ...n }) => {
2317
+ let i = tt(), { designer: a } = Qt(n);
2318
+ if (!i) return /* @__PURE__ */ Z("div", {
2226
2319
  className: t,
2227
2320
  "data-record-details-placeholder": !0,
2228
- ...i,
2321
+ ...a,
2229
2322
  children: /* @__PURE__ */ Z("div", {
2230
2323
  className: "text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded",
2231
2324
  children: "record:details — bind a record to preview"
2232
2325
  })
2233
2326
  });
2234
- let a = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", o = r.objectName || "", s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2235
- if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2327
+ let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = i.objectName || "", c = dt(), { readableFields: l } = ut(s), u = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2328
+ if (u.length > 0 && s && !u.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
2236
2329
  className: t,
2237
- ...i,
2330
+ ...a,
2238
2331
  role: "status",
2239
2332
  "aria-live": "polite",
2240
2333
  children: /* @__PURE__ */ Z("p", {
@@ -2242,20 +2335,20 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2242
2335
  children: "Insufficient permissions to view details."
2243
2336
  })
2244
2337
  });
2245
- let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = (e) => {
2246
- if (!e || !u && d.length === 0) return e;
2247
- let t = e.map(Wt).filter((e) => !!e), n = new Set((u && o ? c(t) : t).filter((e) => !d.includes(e)));
2338
+ let d = e.enforceFieldSecurity === !0, f = Array.isArray(e.redactFields) ? e.redactFields : [], p = (e) => {
2339
+ if (!e || !d && f.length === 0) return e;
2340
+ let t = e.map(Zt).filter((e) => !!e), n = new Set((d && s ? l(t) : t).filter((e) => !f.includes(e)));
2248
2341
  return e.filter((e) => {
2249
- let t = Wt(e);
2342
+ let t = Zt(e);
2250
2343
  return t ? n.has(t) : !0;
2251
2344
  });
2252
- }, p = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
2345
+ }, m = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
2253
2346
  ...e,
2254
2347
  name: e.field
2255
- } : e, m = (e) => Array.isArray(e) ? e.map(p) : e, h = qe(), g = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Wt(e)).filter((e) => !!e));
2256
- for (let e of h) g.add(e);
2257
- let _ = r.objectSchema, v = r.data ?? {}, y = [
2258
- _?.primaryField,
2348
+ } : e, h = (e) => Array.isArray(e) ? e.map(m) : e, g = $e(), _ = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Zt(e)).filter((e) => !!e));
2349
+ for (let e of g) _.add(e);
2350
+ let v = i.objectSchema, y = i.data ?? {}, b = [
2351
+ v?.primaryField,
2259
2352
  "name",
2260
2353
  "full_name",
2261
2354
  "title",
@@ -2263,42 +2356,62 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2263
2356
  "display_name",
2264
2357
  "label"
2265
2358
  ].filter((e) => typeof e == "string" && e.length > 0);
2266
- for (let e of y) if (v[e] !== void 0 && v[e] !== null && v[e] !== "") {
2267
- g.add(e);
2359
+ for (let e of b) if (y[e] !== void 0 && y[e] !== null && y[e] !== "") {
2360
+ _.add(e);
2268
2361
  break;
2269
2362
  }
2270
- let b = (e) => !e || g.size === 0 ? e : e.filter((e) => {
2271
- let t = Wt(e);
2272
- return t ? !g.has(t) : !0;
2273
- }), x = b(m(f(e.fields))), S = Array.isArray(e.sections) ? e.sections.map((e) => ({
2363
+ let x = (e) => !e || _.size === 0 ? e : e.filter((e) => {
2364
+ let t = Zt(e);
2365
+ return t ? !_.has(t) : !0;
2366
+ }), S = x(h(p(e.fields))), C = Array.isArray(e.sections) ? e.sections.map((e) => ({
2274
2367
  ...e,
2275
2368
  title: e.title ?? e.label,
2276
2369
  showBorder: e.showBorder ?? !1,
2277
2370
  hideEmpty: e.hideEmpty ?? !0,
2278
- fields: b(m(f(e.fields)))
2279
- })) : e.sections, C = e.inlineEdit ?? !0, w = {
2371
+ fields: x(h(p(e.fields)))
2372
+ })) : e.sections, w = e.inlineEdit ?? !0, T = r.useCallback(async (e, t) => {
2373
+ let n = i.dataSource, r = i.recordId, a = i.objectName;
2374
+ if (!(!n || !r || !a)) try {
2375
+ if (typeof n.update == "function") await n.update(a, r, { [e]: t });
2376
+ else if (typeof n.updateOne == "function") await n.updateOne(a, r, { [e]: t });
2377
+ else if (typeof n.patch == "function") await n.patch(a, r, { [e]: t });
2378
+ else {
2379
+ console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
2380
+ return;
2381
+ }
2382
+ typeof i.refresh == "function" && await i.refresh();
2383
+ } catch (e) {
2384
+ throw console.error("[record:details] Inline-edit save failed", e), e;
2385
+ }
2386
+ }, [
2387
+ i.dataSource,
2388
+ i.recordId,
2389
+ i.objectName,
2390
+ i.refresh
2391
+ ]), E = {
2280
2392
  type: "detail-view",
2281
- objectName: r.objectName,
2282
- resourceId: r.recordId,
2283
- data: r.data,
2284
- layout: a,
2393
+ objectName: i.objectName,
2394
+ resourceId: i.recordId,
2395
+ data: i.data,
2396
+ layout: o,
2285
2397
  columns: e.columns,
2286
- sections: S,
2287
- fields: x,
2398
+ sections: C,
2399
+ fields: S,
2288
2400
  showBack: !1,
2289
2401
  showHeader: e.showHeader ?? !1,
2290
- inlineEdit: C
2402
+ inlineEdit: w
2291
2403
  };
2292
2404
  return /* @__PURE__ */ Z("div", {
2293
2405
  className: t,
2294
- ...i,
2295
- children: /* @__PURE__ */ Z(Ut, {
2296
- schema: w,
2297
- dataSource: r.dataSource,
2298
- inlineEdit: C
2406
+ ...a,
2407
+ children: /* @__PURE__ */ Z(Xt, {
2408
+ schema: E,
2409
+ dataSource: i.dataSource,
2410
+ inlineEdit: w,
2411
+ onFieldSave: T
2299
2412
  })
2300
2413
  });
2301
- }, qt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, Jt = (e) => {
2414
+ }, en = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, tn = (e) => {
2302
2415
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2303
2416
  return {
2304
2417
  designer: {
@@ -2308,8 +2421,11 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2308
2421
  },
2309
2422
  rest: i
2310
2423
  };
2311
- }, Yt = ({ schema: e = {}, className: t, ...n }) => {
2312
- let r = Ye(), { designer: i } = Jt(n), a = e.title || e.objectName || "Related", o = e.objectName;
2424
+ }, nn = ({ schema: e = {}, className: t, ...n }) => {
2425
+ let r = tt(), { designer: i } = tn(n), a = rt(), o = e.objectName, s = o && a.objectLabel ? a.objectLabel({
2426
+ name: o,
2427
+ label: st(o)
2428
+ }) : o ? st(o) : "", c = e.title || s || "Related";
2313
2429
  if (!o) return /* @__PURE__ */ Z("div", {
2314
2430
  className: t,
2315
2431
  ...i,
@@ -2318,8 +2434,8 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2318
2434
  children: "record:related_list — missing objectName"
2319
2435
  })
2320
2436
  });
2321
- let s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2322
- if (l.length > 0 && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2437
+ let l = dt(), { readableFields: u } = ut(o), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2438
+ if (d.length > 0 && !d.every((e) => l.can(o, e))) return /* @__PURE__ */ Z("div", {
2323
2439
  className: t,
2324
2440
  ...i,
2325
2441
  role: "status",
@@ -2329,30 +2445,30 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2329
2445
  children: "Insufficient permissions to view related list."
2330
2446
  })
2331
2447
  });
2332
- let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = Array.isArray(e.columns) ? e.columns : [], p = f;
2333
- if (u || d.length > 0) {
2334
- let e = f.map(qt).filter((e) => !!e), t = new Set((u ? c(e) : e).filter((e) => !d.includes(e)));
2335
- p = f.filter((e) => {
2336
- let n = qt(e);
2448
+ let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = Array.isArray(e.columns) ? e.columns : [], h = m;
2449
+ if (f || p.length > 0) {
2450
+ let e = m.map(en).filter((e) => !!e), t = new Set((f ? u(e) : e).filter((e) => !p.includes(e)));
2451
+ h = m.filter((e) => {
2452
+ let n = en(e);
2337
2453
  return n ? t.has(n) : !0;
2338
2454
  });
2339
2455
  }
2340
2456
  return /* @__PURE__ */ Z("div", {
2341
2457
  className: t,
2342
2458
  ...i,
2343
- children: /* @__PURE__ */ Z(gt, {
2344
- title: a,
2459
+ children: /* @__PURE__ */ Z(Ct, {
2460
+ title: c,
2345
2461
  type: "table",
2346
2462
  api: o,
2347
2463
  objectName: o,
2348
2464
  referenceField: e.relationshipField,
2349
2465
  parentId: r?.recordId,
2350
- columns: p,
2466
+ columns: h,
2351
2467
  pageSize: e.limit,
2352
2468
  dataSource: r?.dataSource
2353
2469
  })
2354
2470
  });
2355
- }, Xt = (e) => {
2471
+ }, rn = (e) => {
2356
2472
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2357
2473
  return {
2358
2474
  designer: {
@@ -2362,8 +2478,8 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2362
2478
  },
2363
2479
  rest: i
2364
2480
  };
2365
- }, Zt = ({ schema: e = {}, className: t, ...n }) => {
2366
- let i = Ye(), { designer: a } = Xt(n), o = i?.objectName || "", s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2481
+ }, an = ({ schema: e = {}, className: t, ...n }) => {
2482
+ let i = tt(), { designer: a } = rn(n), o = i?.objectName || "", s = dt(), { readableFields: c } = ut(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2367
2483
  if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2368
2484
  className: t,
2369
2485
  ...a,
@@ -2380,20 +2496,20 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2380
2496
  icon: e?.icon,
2381
2497
  type: e?.type
2382
2498
  }).filter((e) => typeof e.name == "string" && e.name.length > 0), d = e.enforceFieldSecurity === !0, f = Array.isArray(e.redactFields) ? e.redactFields : [], p = d && o ? new Set(c(u.map((e) => e.name))) : null, m = u.filter((e) => !(f.includes(e.name) || p && !p.has(e.name)));
2383
- return Xe(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
2499
+ return nt(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
2384
2500
  className: t,
2385
2501
  ...a,
2386
- children: /* @__PURE__ */ Z(vt, {
2502
+ children: /* @__PURE__ */ Z(Tt, {
2387
2503
  fields: m,
2388
2504
  data: i?.data,
2389
2505
  objectName: i?.objectName,
2390
2506
  objectSchema: i?.objectSchema
2391
2507
  })
2392
2508
  });
2393
- }, Qt = ({ change: e, className: t }) => {
2509
+ }, on = ({ change: e, className: t }) => {
2394
2510
  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));
2395
2511
  return /* @__PURE__ */ Q("div", {
2396
- className: L("flex items-center gap-1.5 text-sm flex-wrap", t),
2512
+ className: H("flex items-center gap-1.5 text-sm flex-wrap", t),
2397
2513
  children: [
2398
2514
  /* @__PURE__ */ Z("span", {
2399
2515
  className: "font-medium text-foreground",
@@ -2403,29 +2519,29 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2403
2519
  className: "text-muted-foreground line-through",
2404
2520
  children: r
2405
2521
  }),
2406
- /* @__PURE__ */ Z(z, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2522
+ /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2407
2523
  /* @__PURE__ */ Z("span", {
2408
2524
  className: "text-foreground",
2409
2525
  children: i
2410
2526
  })
2411
2527
  ]
2412
2528
  });
2413
- }, $t = [
2529
+ }, sn = [
2414
2530
  "👍",
2415
2531
  "❤️",
2416
2532
  "🎉",
2417
2533
  "😂",
2418
2534
  "😮",
2419
2535
  "😢"
2420
- ], en = ({ reactions: e, onToggleReaction: t, emojiOptions: r = $t, className: i }) => {
2536
+ ], cn = ({ reactions: e, onToggleReaction: t, emojiOptions: r = sn, className: i }) => {
2421
2537
  let [a, o] = n.useState(!1), s = n.useCallback((e) => {
2422
2538
  t?.(e), o(!1);
2423
2539
  }, [t]);
2424
2540
  return /* @__PURE__ */ Q("div", {
2425
- className: L("flex items-center gap-1 flex-wrap", i),
2541
+ className: H("flex items-center gap-1 flex-wrap", i),
2426
2542
  children: [e.map((e) => /* @__PURE__ */ Q("button", {
2427
2543
  type: "button",
2428
- className: L("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"),
2544
+ className: H("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"),
2429
2545
  onClick: () => s(e.emoji),
2430
2546
  disabled: !t,
2431
2547
  "aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
@@ -2438,7 +2554,7 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2438
2554
  className: "h-6 w-6",
2439
2555
  onClick: () => o(!a),
2440
2556
  "aria-label": "Add reaction",
2441
- children: /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" })
2557
+ children: /* @__PURE__ */ Z(Ue, { className: "h-3.5 w-3.5" })
2442
2558
  }), a && /* @__PURE__ */ Z("div", {
2443
2559
  className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
2444
2560
  role: "listbox",
@@ -2457,7 +2573,7 @@ var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
2457
2573
  };
2458
2574
  //#endregion
2459
2575
  //#region src/ThreadedReplies.tsx
2460
- function tn(e) {
2576
+ function ln(e) {
2461
2577
  try {
2462
2578
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
2463
2579
  if (r < 1) return "just now";
@@ -2470,7 +2586,7 @@ function tn(e) {
2470
2586
  return e;
2471
2587
  }
2472
2588
  }
2473
- var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
2589
+ var un = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
2474
2590
  let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
2475
2591
  let t = l.trim();
2476
2592
  if (!(!t || !r)) {
@@ -2489,7 +2605,7 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2489
2605
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
2490
2606
  }, [p]);
2491
2607
  return t.length === 0 && !i ? null : /* @__PURE__ */ Q("div", {
2492
- className: L("ml-10 mt-1", a),
2608
+ className: H("ml-10 mt-1", a),
2493
2609
  children: [
2494
2610
  t.length > 0 && /* @__PURE__ */ Q("button", {
2495
2611
  type: "button",
@@ -2497,8 +2613,8 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2497
2613
  onClick: () => c(!s),
2498
2614
  "aria-expanded": s,
2499
2615
  children: [
2500
- Z(s ? se : le, { className: "h-3 w-3" }),
2501
- /* @__PURE__ */ Z(J, { className: "h-3 w-3" }),
2616
+ Z(s ? ue : fe, { className: "h-3 w-3" }),
2617
+ /* @__PURE__ */ Z(Ae, { className: "h-3 w-3" }),
2502
2618
  /* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
2503
2619
  ]
2504
2620
  }),
@@ -2525,7 +2641,7 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2525
2641
  children: e.actor
2526
2642
  }), /* @__PURE__ */ Z("span", {
2527
2643
  className: "text-[10px] text-muted-foreground",
2528
- children: tn(e.createdAt)
2644
+ children: ln(e.createdAt)
2529
2645
  })]
2530
2646
  }), /* @__PURE__ */ Z("p", {
2531
2647
  className: "text-xs whitespace-pre-wrap break-words",
@@ -2550,12 +2666,12 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2550
2666
  onClick: p,
2551
2667
  disabled: !l.trim() || d,
2552
2668
  "aria-label": "Send reply",
2553
- children: /* @__PURE__ */ Z(X, { className: "h-3 w-3" })
2669
+ children: /* @__PURE__ */ Z(He, { className: "h-3 w-3" })
2554
2670
  })]
2555
2671
  })
2556
2672
  ]
2557
2673
  });
2558
- }, rn = ({ subscription: e, onToggle: t, className: r }) => {
2674
+ }, dn = ({ subscription: e, onToggle: t, className: r }) => {
2559
2675
  let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
2560
2676
  if (t) {
2561
2677
  o(!0);
@@ -2569,22 +2685,22 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2569
2685
  return /* @__PURE__ */ Z(g, {
2570
2686
  variant: "ghost",
2571
2687
  size: "icon",
2572
- className: L("h-8 w-8", r),
2688
+ className: H("h-8 w-8", r),
2573
2689
  onClick: s,
2574
2690
  disabled: a || !t,
2575
2691
  "aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
2576
2692
  title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
2577
- children: e.subscribed ? /* @__PURE__ */ Z(H, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(ie, { className: "h-4 w-4 text-muted-foreground" })
2693
+ children: e.subscribed ? /* @__PURE__ */ Z(ae, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(oe, { className: "h-4 w-4 text-muted-foreground" })
2578
2694
  });
2579
- }, an = {
2580
- comment: J,
2581
- field_change: he,
2582
- task: oe,
2583
- event: ae,
2584
- system: He,
2585
- email: Ee,
2586
- call: Ae
2587
- }, on = {
2695
+ }, fn = {
2696
+ comment: Ae,
2697
+ field_change: J,
2698
+ task: le,
2699
+ event: se,
2700
+ system: Je,
2701
+ email: ke,
2702
+ call: Fe
2703
+ }, pn = {
2588
2704
  comment: "bg-purple-100 text-purple-600",
2589
2705
  field_change: "bg-blue-100 text-blue-600",
2590
2706
  task: "bg-green-100 text-green-600",
@@ -2593,7 +2709,7 @@ var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
2593
2709
  email: "bg-indigo-100 text-indigo-600",
2594
2710
  call: "bg-teal-100 text-teal-600"
2595
2711
  };
2596
- function sn(e) {
2712
+ function mn(e) {
2597
2713
  return [
2598
2714
  {
2599
2715
  value: "all",
@@ -2613,7 +2729,7 @@ function sn(e) {
2613
2729
  }
2614
2730
  ];
2615
2731
  }
2616
- function cn(e) {
2732
+ function hn(e) {
2617
2733
  try {
2618
2734
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
2619
2735
  if (r < 1) return "just now";
@@ -2626,7 +2742,7 @@ function cn(e) {
2626
2742
  return e;
2627
2743
  }
2628
2744
  }
2629
- function ln(e, t) {
2745
+ function gn(e, t) {
2630
2746
  switch (t) {
2631
2747
  case "comments_only": return e.filter((e) => e.type === "comment");
2632
2748
  case "changes_only": return e.filter((e) => e.type === "field_change");
@@ -2634,18 +2750,18 @@ function ln(e, t) {
2634
2750
  default: return e;
2635
2751
  }
2636
2752
  }
2637
- var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, titleLabel: m, emptyLabel: h, className: _ }) => {
2638
- let { t: v } = $(), [y, b] = n.useState("all"), [x, S] = n.useState(""), [C, w] = n.useState(!1), [T, E] = n.useState(!1), D = r ?? y, O = t?.showFilterToggle !== !1, k = t?.showCommentInput !== !1 && !!c, A = t?.enableReactions ?? !1, j = t?.enableThreading ?? !1, ee = t?.showSubscriptionToggle ?? !1, M = n.useMemo(() => ln(e, D), [e, D]), N = n.useMemo(() => j ? M.filter((e) => !e.parentId) : M, [M, j]), P = n.useMemo(() => {
2639
- if (!j) return /* @__PURE__ */ new Map();
2753
+ var _n = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, titleLabel: m, emptyLabel: h, className: _ }) => {
2754
+ let { t: v } = $(), [y, b] = n.useState("all"), [x, S] = n.useState(""), [C, w] = n.useState(!1), [A, j] = n.useState(!1), M = r ?? y, N = t?.showFilterToggle !== !1, P = t?.showCommentInput !== !1 && !!c, ee = t?.enableReactions ?? !1, F = t?.enableThreading ?? !1, I = t?.showSubscriptionToggle ?? !1, L = n.useMemo(() => gn(e, M), [e, M]), R = n.useMemo(() => F ? L.filter((e) => !e.parentId) : L, [L, F]), z = n.useMemo(() => {
2755
+ if (!F) return /* @__PURE__ */ new Map();
2640
2756
  let e = /* @__PURE__ */ new Map();
2641
- for (let t of M) if (t.parentId) {
2757
+ for (let t of L) if (t.parentId) {
2642
2758
  let n = e.get(t.parentId) ?? [];
2643
2759
  n.push(t), e.set(t.parentId, n);
2644
2760
  }
2645
2761
  return e;
2646
- }, [M, j]), F = n.useCallback((e) => {
2762
+ }, [L, F]), B = n.useCallback((e) => {
2647
2763
  i ? i(e) : b(e);
2648
- }, [i]), I = n.useCallback(async () => {
2764
+ }, [i]), V = n.useCallback(async () => {
2649
2765
  let e = x.trim();
2650
2766
  if (!(!e || !c)) {
2651
2767
  w(!0);
@@ -2656,19 +2772,19 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2656
2772
  }
2657
2773
  }
2658
2774
  }, [x, c]), te = n.useCallback((e) => {
2659
- e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), I());
2660
- }, [I]), R = n.useCallback(async () => {
2775
+ e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), V());
2776
+ }, [V]), ne = n.useCallback(async () => {
2661
2777
  if (o) {
2662
- E(!0);
2778
+ j(!0);
2663
2779
  try {
2664
2780
  await o();
2665
2781
  } finally {
2666
- E(!1);
2782
+ j(!1);
2667
2783
  }
2668
2784
  }
2669
2785
  }, [o]);
2670
2786
  return /* @__PURE__ */ Q("section", {
2671
- className: L("border-t border-border/60 pt-5", _),
2787
+ className: H("border-t border-border/60 pt-5", _),
2672
2788
  "aria-label": "Discussion",
2673
2789
  children: [/* @__PURE__ */ Z("header", {
2674
2790
  className: "mb-4",
@@ -2677,20 +2793,20 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2677
2793
  children: [/* @__PURE__ */ Q("h2", {
2678
2794
  className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
2679
2795
  children: [
2680
- /* @__PURE__ */ Z(ne, { className: "h-4 w-4" }),
2796
+ /* @__PURE__ */ Z(U, { className: "h-4 w-4" }),
2681
2797
  m ?? v("detail.activity"),
2682
2798
  /* @__PURE__ */ Q("span", {
2683
2799
  className: "text-sm font-normal text-muted-foreground",
2684
2800
  children: [
2685
2801
  "(",
2686
- M.length,
2802
+ L.length,
2687
2803
  ")"
2688
2804
  ]
2689
2805
  })
2690
2806
  ]
2691
2807
  }), /* @__PURE__ */ Z("div", {
2692
2808
  className: "flex items-center gap-1",
2693
- children: ee && d && /* @__PURE__ */ Z(rn, {
2809
+ children: I && d && /* @__PURE__ */ Z(dn, {
2694
2810
  subscription: d,
2695
2811
  onToggle: f
2696
2812
  })
@@ -2699,20 +2815,22 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2699
2815
  }), /* @__PURE__ */ Q("div", {
2700
2816
  className: "space-y-4",
2701
2817
  children: [
2702
- O && /* @__PURE__ */ Z("div", {
2818
+ N && /* @__PURE__ */ Z("div", {
2703
2819
  className: "flex items-center gap-2",
2704
- children: /* @__PURE__ */ Z("select", {
2705
- className: "rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
2706
- value: D,
2707
- onChange: (e) => F(e.target.value),
2708
- "aria-label": v("detail.filterActivity"),
2709
- children: sn(v).map((e) => /* @__PURE__ */ Z("option", {
2820
+ children: /* @__PURE__ */ Q(T, {
2821
+ value: M,
2822
+ onValueChange: (e) => B(e),
2823
+ children: [/* @__PURE__ */ Z(O, {
2824
+ "aria-label": v("detail.filterActivity"),
2825
+ className: "h-8 w-auto min-w-[140px] py-1 text-sm",
2826
+ children: /* @__PURE__ */ Z(k, {})
2827
+ }), /* @__PURE__ */ Z(E, { children: mn(v).map((e) => /* @__PURE__ */ Z(D, {
2710
2828
  value: e.value,
2711
2829
  children: e.label
2712
- }, e.value))
2830
+ }, e.value)) })]
2713
2831
  })
2714
2832
  }),
2715
- k && /* @__PURE__ */ Q("div", {
2833
+ P && /* @__PURE__ */ Q("div", {
2716
2834
  className: "flex gap-2",
2717
2835
  children: [/* @__PURE__ */ Z("textarea", {
2718
2836
  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",
@@ -2723,27 +2841,27 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2723
2841
  disabled: C
2724
2842
  }), /* @__PURE__ */ Q(g, {
2725
2843
  variant: "default",
2726
- onClick: I,
2844
+ onClick: V,
2727
2845
  disabled: !x.trim() || C,
2728
2846
  className: "shrink-0 self-end gap-1.5",
2729
2847
  "aria-label": v("detail.submitComment"),
2730
2848
  title: v("detail.submitComment"),
2731
- children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: v("detail.sendComment") })]
2849
+ children: [/* @__PURE__ */ Z(He, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: v("detail.sendComment") })]
2732
2850
  })]
2733
2851
  }),
2734
- M.length === 0 ? p ? null : /* @__PURE__ */ Z("p", {
2852
+ L.length === 0 ? p ? null : /* @__PURE__ */ Z("p", {
2735
2853
  className: "text-sm text-muted-foreground text-center py-4",
2736
2854
  children: h ?? v("detail.noActivity")
2737
2855
  }) : /* @__PURE__ */ Q("div", {
2738
2856
  className: "relative",
2739
2857
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
2740
2858
  className: "space-y-4",
2741
- children: N.map((e) => {
2742
- let t = an[e.type] || He, n = on[e.type] || "bg-gray-100 text-gray-600", r = P.get(e.id) ?? [];
2859
+ children: R.map((e) => {
2860
+ let t = fn[e.type] || Je, n = pn[e.type] || "bg-gray-100 text-gray-600", r = z.get(e.id) ?? [];
2743
2861
  return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
2744
2862
  className: "flex gap-3 relative",
2745
2863
  children: [/* @__PURE__ */ Z("div", {
2746
- className: L("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
2864
+ className: H("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
2747
2865
  children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
2748
2866
  src: e.actorAvatarUrl,
2749
2867
  alt: e.actor,
@@ -2765,7 +2883,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2765
2883
  }),
2766
2884
  /* @__PURE__ */ Z("span", {
2767
2885
  className: "text-xs text-muted-foreground",
2768
- children: cn(e.createdAt)
2886
+ children: hn(e.createdAt)
2769
2887
  }),
2770
2888
  e.edited && /* @__PURE__ */ Z("span", {
2771
2889
  className: "text-xs text-muted-foreground italic",
@@ -2783,25 +2901,25 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2783
2901
  }),
2784
2902
  e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
2785
2903
  className: "space-y-1 mt-1",
2786
- children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Qt, { change: e }, t))
2904
+ children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(on, { change: e }, t))
2787
2905
  }),
2788
- A && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
2906
+ ee && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
2789
2907
  className: "mt-1.5",
2790
- children: /* @__PURE__ */ Z(en, {
2908
+ children: /* @__PURE__ */ Z(cn, {
2791
2909
  reactions: e.reactions,
2792
2910
  onToggleReaction: u ? (t) => u(e.id, t) : void 0
2793
2911
  })
2794
2912
  }),
2795
- A && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
2913
+ ee && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
2796
2914
  className: "mt-1.5",
2797
- children: /* @__PURE__ */ Z(en, {
2915
+ children: /* @__PURE__ */ Z(cn, {
2798
2916
  reactions: [],
2799
2917
  onToggleReaction: (t) => u(e.id, t)
2800
2918
  })
2801
2919
  })
2802
2920
  ]
2803
2921
  })]
2804
- }), j && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(nn, {
2922
+ }), F && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(un, {
2805
2923
  parentItem: e,
2806
2924
  replies: r,
2807
2925
  onAddReply: l,
@@ -2815,16 +2933,16 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2815
2933
  children: /* @__PURE__ */ Q(g, {
2816
2934
  variant: "ghost",
2817
2935
  size: "sm",
2818
- onClick: R,
2819
- disabled: T,
2936
+ onClick: ne,
2937
+ disabled: A,
2820
2938
  "aria-label": v("detail.loadMore"),
2821
- children: [T ? /* @__PURE__ */ Z(Te, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-1" }), v("detail.loadMore")]
2939
+ children: [A ? /* @__PURE__ */ Z(De, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ue, { className: "h-4 w-4 mr-1" }), v("detail.loadMore")]
2822
2940
  })
2823
2941
  })
2824
2942
  ]
2825
2943
  })]
2826
2944
  });
2827
- }, dn = (e) => {
2945
+ }, vn = (e) => {
2828
2946
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2829
2947
  return {
2830
2948
  designer: {
@@ -2834,31 +2952,31 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2834
2952
  },
2835
2953
  rest: i
2836
2954
  };
2837
- }, fn = ({ schema: e = {}, className: t, ...n }) => {
2838
- Ye();
2839
- let { designer: r } = dn(n);
2955
+ }, yn = ({ schema: e = {}, className: t, ...n }) => {
2956
+ tt();
2957
+ let { designer: r } = vn(n);
2840
2958
  return /* @__PURE__ */ Z("div", {
2841
2959
  className: t,
2842
2960
  ...r,
2843
- children: /* @__PURE__ */ Z(un, {
2961
+ children: /* @__PURE__ */ Z(_n, {
2844
2962
  items: [],
2845
2963
  config: e
2846
2964
  })
2847
2965
  });
2848
- }, pn = ({ config: e, items: t, hasMore: r, onLoadMore: i, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, className: m }) => {
2966
+ }, bn = ({ config: e, items: t, hasMore: r, onLoadMore: i, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, className: m }) => {
2849
2967
  let h = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x, S] = n.useState(y);
2850
2968
  return h === "right" || h === "left" ? x && v ? /* @__PURE__ */ Z("div", {
2851
- className: L("flex items-start pt-4", h === "right" ? "border-l" : "border-r", m),
2969
+ className: H("flex items-start pt-4", h === "right" ? "border-l" : "border-r", m),
2852
2970
  children: /* @__PURE__ */ Z(g, {
2853
2971
  variant: "ghost",
2854
2972
  size: "icon",
2855
2973
  className: "h-8 w-8 mx-1",
2856
2974
  onClick: () => S(!1),
2857
2975
  "aria-label": b("detail.openDiscussion"),
2858
- children: /* @__PURE__ */ Z(ke, { className: "h-4 w-4" })
2976
+ children: /* @__PURE__ */ Z(Ne, { className: "h-4 w-4" })
2859
2977
  })
2860
2978
  }) : /* @__PURE__ */ Q("div", {
2861
- className: L("flex flex-col overflow-hidden", h === "right" ? "border-l" : "border-r", m),
2979
+ className: H("flex flex-col overflow-hidden", h === "right" ? "border-l" : "border-r", m),
2862
2980
  style: {
2863
2981
  width: _,
2864
2982
  minWidth: _
@@ -2867,7 +2985,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2867
2985
  className: "flex items-center justify-between px-4 py-3 border-b",
2868
2986
  children: [/* @__PURE__ */ Q("div", {
2869
2987
  className: "flex items-center gap-2",
2870
- children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2988
+ children: [/* @__PURE__ */ Z(Ae, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2871
2989
  className: "text-sm font-medium",
2872
2990
  children: b("detail.discussion")
2873
2991
  })]
@@ -2877,11 +2995,11 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2877
2995
  className: "h-7 w-7",
2878
2996
  onClick: () => S(!0),
2879
2997
  "aria-label": b("detail.closeDiscussion"),
2880
- children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
2998
+ children: /* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" })
2881
2999
  })]
2882
3000
  }), /* @__PURE__ */ Z("div", {
2883
3001
  className: "flex-1 overflow-y-auto",
2884
- children: /* @__PURE__ */ Z(un, {
3002
+ children: /* @__PURE__ */ Z(_n, {
2885
3003
  items: t,
2886
3004
  config: e?.feed,
2887
3005
  hasMore: r,
@@ -2901,27 +3019,27 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2901
3019
  })
2902
3020
  })]
2903
3021
  }) : /* @__PURE__ */ Z("div", {
2904
- className: L("", m),
3022
+ className: H("", m),
2905
3023
  children: v && x ? /* @__PURE__ */ Q(g, {
2906
3024
  variant: "ghost",
2907
3025
  className: "w-full justify-start gap-2 text-muted-foreground",
2908
3026
  onClick: () => S(!1),
2909
3027
  "aria-label": b("detail.showDiscussion", { count: t.length }),
2910
- children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
3028
+ children: [/* @__PURE__ */ Z(Ae, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
2911
3029
  }) : /* @__PURE__ */ Q("div", { children: [v && /* @__PURE__ */ Q("div", {
2912
3030
  className: "flex items-center justify-between mb-2",
2913
3031
  children: [/* @__PURE__ */ Q("div", {
2914
3032
  className: "flex items-center gap-2 text-sm font-medium",
2915
- children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), b("detail.discussion")]
3033
+ children: [/* @__PURE__ */ Z(Ae, { className: "h-4 w-4" }), b("detail.discussion")]
2916
3034
  }), /* @__PURE__ */ Z(g, {
2917
3035
  variant: "ghost",
2918
3036
  size: "icon",
2919
3037
  className: "h-7 w-7",
2920
3038
  onClick: () => S(!0),
2921
3039
  "aria-label": b("detail.hideDiscussion"),
2922
- children: /* @__PURE__ */ Z(Oe, { className: "h-3.5 w-3.5" })
3040
+ children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
2923
3041
  })]
2924
- }), /* @__PURE__ */ Z(un, {
3042
+ }), /* @__PURE__ */ Z(_n, {
2925
3043
  items: t,
2926
3044
  config: e?.feed,
2927
3045
  hasMore: r,
@@ -2939,7 +3057,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2939
3057
  emptyLabel: b("detail.noCommentsYet")
2940
3058
  })] })
2941
3059
  });
2942
- }, mn = (e) => {
3060
+ }, xn = (e) => {
2943
3061
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2944
3062
  return {
2945
3063
  designer: {
@@ -2949,9 +3067,9 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2949
3067
  },
2950
3068
  rest: i
2951
3069
  };
2952
- }, hn = ({ schema: e = {}, className: t, ...n }) => {
2953
- Ye();
2954
- let r = Ke(), { designer: i } = mn(n), a = {
3070
+ }, Sn = ({ schema: e = {}, className: t, ...n }) => {
3071
+ tt();
3072
+ let r = Qe(), { designer: i } = xn(n), a = {
2955
3073
  position: "bottom",
2956
3074
  collapsible: !1,
2957
3075
  feed: {
@@ -2964,7 +3082,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2964
3082
  return /* @__PURE__ */ Z("div", {
2965
3083
  className: t,
2966
3084
  ...i,
2967
- children: /* @__PURE__ */ Z(pn, {
3085
+ children: /* @__PURE__ */ Z(bn, {
2968
3086
  items: r?.items || [],
2969
3087
  config: a,
2970
3088
  onAddComment: r?.onAddComment,
@@ -2972,7 +3090,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2972
3090
  onToggleReaction: r?.onToggleReaction
2973
3091
  })
2974
3092
  });
2975
- }, gn = (e) => {
3093
+ }, Cn = (e) => {
2976
3094
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2977
3095
  return {
2978
3096
  designer: {
@@ -2982,8 +3100,8 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
2982
3100
  },
2983
3101
  rest: i
2984
3102
  };
2985
- }, _n = ({ schema: e = {}, className: t, ...n }) => {
2986
- let i = Ye(), { translateOptions: a } = Ze(), { designer: o } = gn(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = r.useMemo(() => {
3103
+ }, wn = ({ schema: e = {}, className: t, ...n }) => {
3104
+ let i = tt(), { translateOptions: a } = rt(), { designer: o } = Cn(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = r.useMemo(() => {
2987
3105
  if (s.length === 0 || !c || !i?.objectName) return s;
2988
3106
  let e = a(i.objectName, c, s);
2989
3107
  return Array.isArray(e) && e.length === s.length ? e : s;
@@ -3005,7 +3123,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3005
3123
  if (l.length !== 1) return e === 0 ? "polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%)" : e === t ? "polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%)" : "polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%)";
3006
3124
  }, p = l.length - 1;
3007
3125
  return /* @__PURE__ */ Q("div", {
3008
- className: L("w-full", t),
3126
+ className: H("w-full", t),
3009
3127
  ...o,
3010
3128
  children: [/* @__PURE__ */ Z("div", {
3011
3129
  className: "hidden sm:flex w-full items-stretch",
@@ -3020,7 +3138,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3020
3138
  clipPath: i,
3021
3139
  WebkitClipPath: i
3022
3140
  } : void 0,
3023
- className: L("relative flex-1 min-w-0 px-5 py-2 text-xs font-medium text-center", t > 0 && "-ml-2", l.length === 1 && "rounded-md border", r && "bg-primary text-primary-foreground shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground", !r && !n && "bg-background text-foreground/70 border border-border/60"),
3141
+ className: H("relative flex-1 min-w-0 px-5 py-2 text-xs font-medium text-center", t > 0 && "-ml-2", l.length === 1 && "rounded-md border", r && "bg-primary text-primary-foreground shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground", !r && !n && "bg-background text-foreground/70 border border-border/60"),
3024
3142
  children: /* @__PURE__ */ Q("span", {
3025
3143
  className: "inline-flex items-center gap-1.5 truncate",
3026
3144
  style: {
@@ -3043,7 +3161,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3043
3161
  return /* @__PURE__ */ Z("div", {
3044
3162
  role: "listitem",
3045
3163
  "aria-current": r ? "step" : void 0,
3046
- className: L("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", r && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground border-transparent", !r && !n && "bg-background text-foreground/70 border-border/60"),
3164
+ className: H("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", r && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground border-transparent", !r && !n && "bg-background text-foreground/70 border-border/60"),
3047
3165
  children: /* @__PURE__ */ Q("span", {
3048
3166
  className: "inline-flex items-center gap-1",
3049
3167
  children: [n && /* @__PURE__ */ Z("span", {
@@ -3055,7 +3173,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3055
3173
  })
3056
3174
  })]
3057
3175
  });
3058
- }, vn = (e) => {
3176
+ }, Tn = (e) => {
3059
3177
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3060
3178
  return {
3061
3179
  designer: {
@@ -3065,8 +3183,8 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3065
3183
  },
3066
3184
  rest: i
3067
3185
  };
3068
- }, yn = ({ schema: e = {}, className: t, ...n }) => {
3069
- let r = Ye(), { designer: i } = vn(n), a = it(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = r?.objectName || "", c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
3186
+ }, En = ({ schema: e = {}, className: t, ...n }) => {
3187
+ let r = tt(), { designer: i } = Tn(n), a = dt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = r?.objectName || "", c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
3070
3188
  if (c.length > 0 && s && !c.every((e) => a.can(s, e))) return /* @__PURE__ */ Z("div", {
3071
3189
  className: t,
3072
3190
  ...i,
@@ -3077,7 +3195,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3077
3195
  children: "Insufficient permissions to view quick actions."
3078
3196
  })
3079
3197
  });
3080
- let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } = Ge({
3198
+ let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } = Ze({
3081
3199
  actions: o,
3082
3200
  context: {
3083
3201
  record: r?.data,
@@ -3095,7 +3213,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3095
3213
  });
3096
3214
  let p = e.align || "end", m = p === "start" ? "justify-start" : p === "center" ? "justify-center" : "justify-end";
3097
3215
  return /* @__PURE__ */ Z("div", {
3098
- className: L("flex flex-wrap items-center gap-2", l === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", m, t),
3216
+ className: H("flex flex-wrap items-center gap-2", l === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", m, t),
3099
3217
  role: "toolbar",
3100
3218
  "aria-label": e.aria?.label || "Quick actions",
3101
3219
  ...i,
@@ -3116,7 +3234,7 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3116
3234
  }, t.name || `qa-${n}`);
3117
3235
  })
3118
3236
  });
3119
- }, bn = (e) => {
3237
+ }, Dn = (e) => {
3120
3238
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3121
3239
  return {
3122
3240
  designer: {
@@ -3126,18 +3244,18 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3126
3244
  },
3127
3245
  rest: i
3128
3246
  };
3129
- }, xn = ({ schema: e = {}, className: t, ...n }) => {
3130
- let { designer: r } = bn(n), i = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], a = e.loading ?? e.properties?.loading ?? !1, o = e.emptyText ?? e.properties?.emptyText;
3247
+ }, On = ({ schema: e = {}, className: t, ...n }) => {
3248
+ let { designer: r } = Dn(n), i = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], a = e.loading ?? e.properties?.loading ?? !1, o = e.emptyText ?? e.properties?.emptyText;
3131
3249
  return /* @__PURE__ */ Z("div", {
3132
3250
  className: t,
3133
3251
  ...r,
3134
- children: /* @__PURE__ */ Z(Nt, {
3252
+ children: /* @__PURE__ */ Z(Bt, {
3135
3253
  entries: i,
3136
3254
  loading: a,
3137
3255
  emptyText: o
3138
3256
  })
3139
3257
  });
3140
- }, Sn = new Set([
3258
+ }, kn = new Set([
3141
3259
  "id",
3142
3260
  "_id",
3143
3261
  "__v",
@@ -3152,15 +3270,15 @@ var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
3152
3270
  "owner_id",
3153
3271
  "deleted_at",
3154
3272
  "is_deleted"
3155
- ]), Cn = 480, wn = 95;
3156
- function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = Sn, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
3273
+ ]), An = 480, jn = 95;
3274
+ function Mn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = kn, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
3157
3275
  let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
3158
3276
  if (typeof window > "u" || !m) return null;
3159
3277
  try {
3160
3278
  let e = window.localStorage.getItem(_);
3161
3279
  if (e) {
3162
3280
  let t = parseInt(e, 10);
3163
- if (Number.isFinite(t) && t >= Cn) return t;
3281
+ if (Number.isFinite(t) && t >= An) return t;
3164
3282
  }
3165
3283
  } catch {}
3166
3284
  return null;
@@ -3182,7 +3300,7 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3182
3300
  let n = (e) => {
3183
3301
  let t = S.current;
3184
3302
  if (!t) return;
3185
- let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * wn / 100 : 1600, i = Math.min(r, Math.max(Cn, t.startWidth + n));
3303
+ let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * jn / 100 : 1600, i = Math.min(r, Math.max(An, t.startWidth + n));
3186
3304
  y(Math.round(i));
3187
3305
  }, r = () => {
3188
3306
  S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
@@ -3195,7 +3313,7 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3195
3313
  m,
3196
3314
  v,
3197
3315
  _
3198
- ]), w = c?.fields ?? {}, k = (Object.keys(w).length ? Object.keys(w) : Object.keys(i)).filter((e) => !d.has(e) && !e.startsWith("__")).filter((e) => e in i).filter((e) => !w[e]?.hidden).map((e) => {
3316
+ ]), w = c?.fields ?? {}, T = (Object.keys(w).length ? Object.keys(w) : Object.keys(i)).filter((e) => !d.has(e) && !e.startsWith("__")).filter((e) => e in i).filter((e) => !w[e]?.hidden).map((e) => {
3199
3317
  let t = w[e] || {}, n = t.type === "lookup" || t.type === "master_detail" || t.type === "reference";
3200
3318
  return {
3201
3319
  name: e,
@@ -3214,12 +3332,12 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3214
3332
  description: t.description
3215
3333
  };
3216
3334
  });
3217
- return /* @__PURE__ */ Z(T, {
3335
+ return /* @__PURE__ */ Z(A, {
3218
3336
  open: e,
3219
3337
  onOpenChange: (e) => {
3220
3338
  e || t();
3221
3339
  },
3222
- children: /* @__PURE__ */ Q(E, {
3340
+ children: /* @__PURE__ */ Q(j, {
3223
3341
  side: "right",
3224
3342
  className: "w-full overflow-y-auto p-0 sm:!max-w-none",
3225
3343
  style: x,
@@ -3232,13 +3350,13 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3232
3350
  onPointerDown: C,
3233
3351
  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"
3234
3352
  }),
3235
- /* @__PURE__ */ Z(D, {
3353
+ /* @__PURE__ */ Z(M, {
3236
3354
  className: "sr-only",
3237
- children: /* @__PURE__ */ Z(O, { children: n })
3355
+ children: /* @__PURE__ */ Z(N, { children: n })
3238
3356
  }),
3239
3357
  /* @__PURE__ */ Z("div", {
3240
3358
  className: "px-6 pt-6 pb-6",
3241
- children: /* @__PURE__ */ Z(Ut, {
3359
+ children: /* @__PURE__ */ Z(Xt, {
3242
3360
  dataSource: s,
3243
3361
  inlineEdit: !0,
3244
3362
  schema: {
@@ -3248,7 +3366,7 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3248
3366
  data: i,
3249
3367
  showDelete: !0,
3250
3368
  columns: u,
3251
- fields: k,
3369
+ fields: T,
3252
3370
  actions: h ? [{
3253
3371
  type: "action:bar",
3254
3372
  location: "record_header",
@@ -3281,19 +3399,19 @@ function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
3281
3399
  })
3282
3400
  });
3283
3401
  }
3284
- function En(e, t) {
3402
+ function Nn(e, t) {
3285
3403
  if (typeof window > "u") return null;
3286
3404
  let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
3287
3405
  return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
3288
3406
  }
3289
3407
  //#endregion
3290
3408
  //#region src/InlineCreateRelated.tsx
3291
- var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
3409
+ var Pn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
3292
3410
  let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [p, m] = n.useState({}), [h, x] = n.useState(""), [S, C] = n.useState(s), [T, E] = n.useState(!1), [D, O] = n.useState(!1), k = n.useMemo(() => {
3293
3411
  if (!h.trim()) return S;
3294
3412
  let e = h.toLowerCase();
3295
3413
  return S.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
3296
- }, [h, S]), N = n.useCallback(async (e) => {
3414
+ }, [h, S]), A = n.useCallback(async (e) => {
3297
3415
  if (x(e), o && e.trim().length >= 2) {
3298
3416
  O(!0);
3299
3417
  try {
@@ -3302,12 +3420,12 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3302
3420
  O(!1);
3303
3421
  }
3304
3422
  }
3305
- }, [o]), P = n.useCallback((e, t) => {
3423
+ }, [o]), j = n.useCallback((e, t) => {
3306
3424
  m((n) => ({
3307
3425
  ...n,
3308
3426
  [e]: t
3309
3427
  }));
3310
- }, []), F = n.useCallback(async () => {
3428
+ }, []), M = n.useCallback(async () => {
3311
3429
  if (i) {
3312
3430
  E(!0);
3313
3431
  try {
@@ -3323,7 +3441,7 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3323
3441
  i,
3324
3442
  p,
3325
3443
  t
3326
- ]), I = n.useCallback(async (e) => {
3444
+ ]), N = n.useCallback(async (e) => {
3327
3445
  if (a) {
3328
3446
  E(!0);
3329
3447
  try {
@@ -3332,9 +3450,9 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3332
3450
  E(!1);
3333
3451
  }
3334
3452
  }
3335
- }, [a]), te = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
3453
+ }, [a]), P = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
3336
3454
  return l ? /* @__PURE__ */ Q(_, {
3337
- className: L("", c),
3455
+ className: H("", c),
3338
3456
  children: [/* @__PURE__ */ Z(y, {
3339
3457
  className: "pb-3",
3340
3458
  children: /* @__PURE__ */ Q(b, {
@@ -3348,26 +3466,26 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3348
3466
  size: "icon",
3349
3467
  className: "h-6 w-6",
3350
3468
  onClick: () => u(!1),
3351
- children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
3469
+ children: /* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" })
3352
3470
  })]
3353
3471
  })
3354
- }), /* @__PURE__ */ Z(v, { children: /* @__PURE__ */ Q(A, {
3472
+ }), /* @__PURE__ */ Z(v, { children: /* @__PURE__ */ Q(ee, {
3355
3473
  value: d,
3356
3474
  onValueChange: f,
3357
3475
  children: [
3358
- /* @__PURE__ */ Q(ee, {
3476
+ /* @__PURE__ */ Q(I, {
3359
3477
  className: "mb-3 w-full",
3360
- children: [i && /* @__PURE__ */ Q(M, {
3478
+ children: [i && /* @__PURE__ */ Q(L, {
3361
3479
  value: "create",
3362
3480
  className: "flex-1 gap-1.5",
3363
- children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), "Create New"]
3364
- }), a && /* @__PURE__ */ Q(M, {
3481
+ children: [/* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" }), "Create New"]
3482
+ }), a && /* @__PURE__ */ Q(L, {
3365
3483
  value: "link",
3366
3484
  className: "flex-1 gap-1.5",
3367
- children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
3485
+ children: [/* @__PURE__ */ Z(Te, { className: "h-3.5 w-3.5" }), "Link Existing"]
3368
3486
  })]
3369
3487
  }),
3370
- i && /* @__PURE__ */ Q(j, {
3488
+ i && /* @__PURE__ */ Q(F, {
3371
3489
  value: "create",
3372
3490
  className: "space-y-3 mt-0",
3373
3491
  children: [r.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
@@ -3380,7 +3498,7 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3380
3498
  type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
3381
3499
  placeholder: e.placeholder || `Enter ${e.label.toLowerCase()}`,
3382
3500
  value: p[e.name] || "",
3383
- onChange: (t) => P(e.name, t.target.value),
3501
+ onChange: (t) => j(e.name, t.target.value),
3384
3502
  className: "h-8 text-sm"
3385
3503
  })] }, e.name)), /* @__PURE__ */ Q("div", {
3386
3504
  className: "flex justify-end gap-2 pt-1",
@@ -3391,36 +3509,36 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3391
3509
  children: "Cancel"
3392
3510
  }), /* @__PURE__ */ Q(g, {
3393
3511
  size: "sm",
3394
- onClick: F,
3395
- disabled: !te || T,
3512
+ onClick: M,
3513
+ disabled: !P || T,
3396
3514
  className: "gap-1.5",
3397
- children: [T && /* @__PURE__ */ Z(Te, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
3515
+ children: [T && /* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
3398
3516
  })]
3399
3517
  })]
3400
3518
  }),
3401
- a && /* @__PURE__ */ Q(j, {
3519
+ a && /* @__PURE__ */ Q(F, {
3402
3520
  value: "link",
3403
3521
  className: "space-y-3 mt-0",
3404
3522
  children: [/* @__PURE__ */ Q("div", {
3405
3523
  className: "relative",
3406
- children: [/* @__PURE__ */ Z(Ie, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(w, {
3524
+ children: [/* @__PURE__ */ Z(Ve, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(w, {
3407
3525
  placeholder: `Search ${e}…`,
3408
3526
  value: h,
3409
- onChange: (e) => N(e.target.value),
3527
+ onChange: (e) => A(e.target.value),
3410
3528
  className: "h-8 text-sm pl-8"
3411
3529
  })]
3412
3530
  }), /* @__PURE__ */ Z("div", {
3413
3531
  className: "max-h-48 overflow-y-auto space-y-1",
3414
3532
  children: D ? /* @__PURE__ */ Q("div", {
3415
3533
  className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
3416
- children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
3534
+ children: [/* @__PURE__ */ Z(De, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
3417
3535
  }) : k.length === 0 ? /* @__PURE__ */ Z("p", {
3418
3536
  className: "text-sm text-muted-foreground text-center py-4",
3419
3537
  children: h ? "No records found" : "Type to search records"
3420
3538
  }) : k.map((e) => /* @__PURE__ */ Q("button", {
3421
3539
  type: "button",
3422
3540
  className: "w-full text-left px-3 py-2 rounded-md hover:bg-accent text-sm transition-colors",
3423
- onClick: () => I(e.id),
3541
+ onClick: () => N(e.id),
3424
3542
  disabled: T,
3425
3543
  children: [/* @__PURE__ */ Z("span", {
3426
3544
  className: "font-medium",
@@ -3435,7 +3553,7 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3435
3553
  ]
3436
3554
  }) })]
3437
3555
  }) : /* @__PURE__ */ Q("div", {
3438
- className: L("flex gap-2", c),
3556
+ className: H("flex gap-2", c),
3439
3557
  children: [i && /* @__PURE__ */ Q(g, {
3440
3558
  variant: "outline",
3441
3559
  size: "sm",
@@ -3444,7 +3562,7 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3444
3562
  },
3445
3563
  className: "gap-1.5",
3446
3564
  children: [
3447
- /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }),
3565
+ /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" }),
3448
3566
  "New ",
3449
3567
  e
3450
3568
  ]
@@ -3455,17 +3573,17 @@ var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
3455
3573
  f("link"), u(!0);
3456
3574
  },
3457
3575
  className: "gap-1.5",
3458
- children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
3576
+ children: [/* @__PURE__ */ Z(Te, { className: "h-3.5 w-3.5" }), "Link Existing"]
3459
3577
  })]
3460
3578
  });
3461
3579
  };
3462
3580
  //#endregion
3463
3581
  //#region src/RichTextCommentInput.tsx
3464
- function On(e) {
3582
+ function Fn(e) {
3465
3583
  let t = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/```([\s\S]*?)```/g, "<pre class=\"bg-muted rounded p-2 text-xs font-mono my-1 overflow-x-auto\">$1</pre>").replace(/`([^`]+)`/g, "<code class=\"bg-muted rounded px-1 py-0.5 text-xs font-mono\">$1</code>").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/@(\w+)/g, "<span class=\"text-primary font-medium\">@$1</span>").replace(/^- (.+)$/gm, "<li class=\"ml-4 list-disc\">$1</li>").replace(/\n/g, "<br/>");
3466
3584
  return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
3467
3585
  }
3468
- var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
3586
+ var In = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
3469
3587
  let { t: c } = $(), [l, u] = n.useState(!1), [d, f] = n.useState(!1), [p, m] = n.useState(""), [h, _] = n.useState(0), v = n.useRef(null), y = n.useMemo(() => {
3470
3588
  if (!p) return i;
3471
3589
  let e = p.toLowerCase();
@@ -3526,7 +3644,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3526
3644
  r
3527
3645
  ]);
3528
3646
  return /* @__PURE__ */ Q("div", {
3529
- className: L("border rounded-md", o),
3647
+ className: H("border rounded-md", o),
3530
3648
  children: [/* @__PURE__ */ Q("div", {
3531
3649
  className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
3532
3650
  children: [
@@ -3537,7 +3655,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3537
3655
  onClick: x,
3538
3656
  disabled: s || l,
3539
3657
  title: c("detail.bold"),
3540
- children: /* @__PURE__ */ Z(U, { className: "h-3.5 w-3.5" })
3658
+ children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
3541
3659
  }),
3542
3660
  /* @__PURE__ */ Z(g, {
3543
3661
  variant: "ghost",
@@ -3546,7 +3664,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3546
3664
  onClick: S,
3547
3665
  disabled: s || l,
3548
3666
  title: c("detail.italic"),
3549
- children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
3667
+ children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
3550
3668
  }),
3551
3669
  /* @__PURE__ */ Z(g, {
3552
3670
  variant: "ghost",
@@ -3555,7 +3673,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3555
3673
  onClick: C,
3556
3674
  disabled: s || l,
3557
3675
  title: c("detail.listFormat"),
3558
- children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
3676
+ children: /* @__PURE__ */ Z(Ee, { className: "h-3.5 w-3.5" })
3559
3677
  }),
3560
3678
  /* @__PURE__ */ Z(g, {
3561
3679
  variant: "ghost",
@@ -3564,7 +3682,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3564
3682
  onClick: w,
3565
3683
  disabled: s || l,
3566
3684
  title: c("detail.inlineCode"),
3567
- children: /* @__PURE__ */ Z(fe, { className: "h-3.5 w-3.5" })
3685
+ children: /* @__PURE__ */ Z(me, { className: "h-3.5 w-3.5" })
3568
3686
  }),
3569
3687
  /* @__PURE__ */ Z(g, {
3570
3688
  variant: "ghost",
@@ -3573,7 +3691,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3573
3691
  onClick: T,
3574
3692
  disabled: s || l,
3575
3693
  title: c("detail.mentionSomeone"),
3576
- children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
3694
+ children: /* @__PURE__ */ Z(G, { className: "h-3.5 w-3.5" })
3577
3695
  }),
3578
3696
  /* @__PURE__ */ Z("div", { className: "flex-1" }),
3579
3697
  /* @__PURE__ */ Z(g, {
@@ -3582,7 +3700,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3582
3700
  className: "h-7 w-7",
3583
3701
  onClick: () => u(!l),
3584
3702
  title: c(l ? "detail.edit" : "detail.preview"),
3585
- children: Z(l ? he : G, { className: "h-3.5 w-3.5" })
3703
+ children: Z(l ? J : ve, { className: "h-3.5 w-3.5" })
3586
3704
  }),
3587
3705
  r && /* @__PURE__ */ Z(g, {
3588
3706
  variant: "ghost",
@@ -3591,15 +3709,15 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3591
3709
  onClick: r,
3592
3710
  disabled: s || !e.trim(),
3593
3711
  title: c("detail.submitComment"),
3594
- children: /* @__PURE__ */ Z(X, { className: "h-3.5 w-3.5" })
3712
+ children: /* @__PURE__ */ Z(He, { className: "h-3.5 w-3.5" })
3595
3713
  })
3596
3714
  ]
3597
3715
  }), /* @__PURE__ */ Z("div", {
3598
3716
  className: "relative",
3599
3717
  children: l ? /* @__PURE__ */ Z("div", {
3600
3718
  className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
3601
- dangerouslySetInnerHTML: { __html: On(e) }
3602
- }) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("textarea", {
3719
+ dangerouslySetInnerHTML: { __html: Fn(e) }
3720
+ }) : /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("textarea", {
3603
3721
  ref: v,
3604
3722
  className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
3605
3723
  placeholder: a ?? c("detail.writeComment"),
@@ -3611,7 +3729,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3611
3729
  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",
3612
3730
  children: y.map((e, t) => /* @__PURE__ */ Q("button", {
3613
3731
  type: "button",
3614
- className: L("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === h && "bg-accent"),
3732
+ className: H("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === h && "bg-accent"),
3615
3733
  onMouseDown: (t) => {
3616
3734
  t.preventDefault(), E(e);
3617
3735
  },
@@ -3630,7 +3748,7 @@ var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
3630
3748
  };
3631
3749
  //#endregion
3632
3750
  //#region src/DiffView.tsx
3633
- function An(e, t) {
3751
+ function Ln(e, t) {
3634
3752
  if (e == null) return ["(empty)"];
3635
3753
  switch (t) {
3636
3754
  case "json": try {
@@ -3649,7 +3767,7 @@ function An(e, t) {
3649
3767
  default: return String(e).split("\n");
3650
3768
  }
3651
3769
  }
3652
- function jn(e, t) {
3770
+ function Rn(e, t) {
3653
3771
  let n = [], r = Math.max(e.length, t.length);
3654
3772
  for (let i = 0; i < r; i++) {
3655
3773
  let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
@@ -3666,16 +3784,16 @@ function jn(e, t) {
3666
3784
  }
3667
3785
  return n;
3668
3786
  }
3669
- var Mn = {
3787
+ var zn = {
3670
3788
  added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
3671
3789
  removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
3672
3790
  unchanged: "text-muted-foreground"
3673
- }, Nn = {
3791
+ }, Bn = {
3674
3792
  added: "+",
3675
3793
  removed: "-",
3676
3794
  unchanged: " "
3677
- }, Pn = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
3678
- let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => An(e, i), [e, i]), d = n.useMemo(() => An(t, i), [t, i]), f = n.useMemo(() => jn(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = n.useMemo(() => {
3795
+ }, Vn = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
3796
+ let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => Ln(e, i), [e, i]), d = n.useMemo(() => Ln(t, i), [t, i]), f = n.useMemo(() => Rn(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = n.useMemo(() => {
3679
3797
  if (c !== "side-by-side") return [];
3680
3798
  let e = [], t = 0;
3681
3799
  for (; t < f.length;) {
@@ -3701,7 +3819,7 @@ var Mn = {
3701
3819
  return e;
3702
3820
  }, [c, f]);
3703
3821
  return /* @__PURE__ */ Q(_, {
3704
- className: L("overflow-hidden", o),
3822
+ className: H("overflow-hidden", o),
3705
3823
  children: [/* @__PURE__ */ Z(y, {
3706
3824
  className: "pb-2",
3707
3825
  children: /* @__PURE__ */ Q(b, {
@@ -3717,14 +3835,14 @@ var Mn = {
3717
3835
  className: "h-7 w-7",
3718
3836
  onClick: () => l("unified"),
3719
3837
  title: s("detail.unifiedDiff"),
3720
- children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
3838
+ children: /* @__PURE__ */ Z(Be, { className: "h-3.5 w-3.5" })
3721
3839
  }), /* @__PURE__ */ Z(g, {
3722
3840
  variant: c === "side-by-side" ? "secondary" : "ghost",
3723
3841
  size: "icon",
3724
3842
  className: "h-7 w-7",
3725
3843
  onClick: () => l("side-by-side"),
3726
3844
  title: s("detail.sideBySideDiff"),
3727
- children: /* @__PURE__ */ Z(pe, { className: "h-3.5 w-3.5" })
3845
+ children: /* @__PURE__ */ Z(he, { className: "h-3.5 w-3.5" })
3728
3846
  })]
3729
3847
  })]
3730
3848
  })
@@ -3733,10 +3851,10 @@ var Mn = {
3733
3851
  children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
3734
3852
  className: "font-mono text-xs overflow-x-auto",
3735
3853
  children: f.map((e, t) => /* @__PURE__ */ Q("div", {
3736
- className: L("px-4 py-0.5 whitespace-pre-wrap border-l-2", Mn[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
3854
+ className: H("px-4 py-0.5 whitespace-pre-wrap border-l-2", zn[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
3737
3855
  children: [/* @__PURE__ */ Z("span", {
3738
3856
  className: "select-none mr-2 inline-block w-3 text-center opacity-60",
3739
- children: Nn[e.type]
3857
+ children: Bn[e.type]
3740
3858
  }), e.value]
3741
3859
  }, t))
3742
3860
  }) : /* @__PURE__ */ Z("div", {
@@ -3753,10 +3871,10 @@ var Mn = {
3753
3871
  children: s("detail.currentVersion")
3754
3872
  }),
3755
3873
  m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
3756
- className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Mn[e.left.type] : "bg-muted/20"),
3874
+ className: H("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? zn[e.left.type] : "bg-muted/20"),
3757
3875
  children: e.left?.value ?? ""
3758
3876
  }), /* @__PURE__ */ Z("div", {
3759
- className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Mn[e.right.type] : "bg-muted/20"),
3877
+ className: H("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? zn[e.right.type] : "bg-muted/20"),
3760
3878
  children: e.right?.value ?? ""
3761
3879
  })] }, t))
3762
3880
  ]
@@ -3767,7 +3885,7 @@ var Mn = {
3767
3885
  })
3768
3886
  })]
3769
3887
  });
3770
- }, Fn = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
3888
+ }, Hn = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
3771
3889
  let { t: s } = $(), [c, l] = n.useState(""), [u, d] = n.useState(!1), f = n.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, _ = e < t - 1, v = n.useCallback(() => {
3772
3890
  p && i(r[0]);
3773
3891
  }, [
@@ -3835,7 +3953,7 @@ var Mn = {
3835
3953
  i,
3836
3954
  a
3837
3955
  ]), /* @__PURE__ */ Q("div", {
3838
- className: L("flex items-center gap-1.5", o),
3956
+ className: H("flex items-center gap-1.5", o),
3839
3957
  children: [
3840
3958
  /* @__PURE__ */ Z(g, {
3841
3959
  variant: "outline",
@@ -3844,7 +3962,7 @@ var Mn = {
3844
3962
  disabled: !p,
3845
3963
  onClick: v,
3846
3964
  title: s("detail.firstRecord"),
3847
- children: /* @__PURE__ */ Z(ue, { className: "h-4 w-4" })
3965
+ children: /* @__PURE__ */ Z(q, { className: "h-4 w-4" })
3848
3966
  }),
3849
3967
  /* @__PURE__ */ Z(g, {
3850
3968
  variant: "outline",
@@ -3853,7 +3971,7 @@ var Mn = {
3853
3971
  disabled: !m,
3854
3972
  onClick: y,
3855
3973
  title: s("detail.previousRecordKey"),
3856
- children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
3974
+ children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
3857
3975
  }),
3858
3976
  /* @__PURE__ */ Z("span", {
3859
3977
  className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
@@ -3869,7 +3987,7 @@ var Mn = {
3869
3987
  disabled: !h,
3870
3988
  onClick: b,
3871
3989
  title: s("detail.nextRecordKey"),
3872
- children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
3990
+ children: /* @__PURE__ */ Z(fe, { className: "h-4 w-4" })
3873
3991
  }),
3874
3992
  /* @__PURE__ */ Z(g, {
3875
3993
  variant: "outline",
@@ -3878,15 +3996,15 @@ var Mn = {
3878
3996
  disabled: !_,
3879
3997
  onClick: x,
3880
3998
  title: s("detail.lastRecord"),
3881
- children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
3999
+ children: /* @__PURE__ */ Z(pe, { className: "h-4 w-4" })
3882
4000
  }),
3883
- a && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(g, {
4001
+ a && /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z(g, {
3884
4002
  variant: u ? "secondary" : "ghost",
3885
4003
  size: "icon",
3886
4004
  className: "h-8 w-8",
3887
4005
  onClick: C,
3888
4006
  title: s("detail.searchWhileNavigating"),
3889
- children: /* @__PURE__ */ Z(Ie, { className: "h-4 w-4" })
4007
+ children: /* @__PURE__ */ Z(Ve, { className: "h-4 w-4" })
3890
4008
  }), u && /* @__PURE__ */ Z("div", {
3891
4009
  className: "relative",
3892
4010
  children: /* @__PURE__ */ Z(w, {
@@ -3900,18 +4018,18 @@ var Mn = {
3900
4018
  })] })
3901
4019
  ]
3902
4020
  });
3903
- }, In = 28, Ln = [
4021
+ }, Un = 28, Wn = [
3904
4022
  "fill-primary stroke-primary",
3905
4023
  "fill-blue-500 stroke-blue-500",
3906
4024
  "fill-emerald-500 stroke-emerald-500",
3907
4025
  "fill-amber-500 stroke-amber-500"
3908
- ], Rn = [
4026
+ ], Gn = [
3909
4027
  "fill-primary-foreground",
3910
4028
  "fill-white",
3911
4029
  "fill-white",
3912
4030
  "fill-white"
3913
4031
  ];
3914
- function zn(e, t, n, r, i) {
4032
+ function Kn(e, t, n, r, i) {
3915
4033
  let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
3916
4034
  a.push({
3917
4035
  id: e.id,
@@ -3975,10 +4093,10 @@ function zn(e, t, n, r, i) {
3975
4093
  edges: o
3976
4094
  };
3977
4095
  }
3978
- function Bn(e, t = 6) {
4096
+ function qn(e, t = 6) {
3979
4097
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
3980
4098
  }
3981
- var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
4099
+ var Jn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
3982
4100
  let o = n.useRef(null), [s, c] = n.useState({
3983
4101
  width: 500,
3984
4102
  height: 400
@@ -3999,20 +4117,20 @@ var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
3999
4117
  });
4000
4118
  return n.observe(t), () => n.disconnect();
4001
4119
  }, []);
4002
- let { nodes: d, edges: f } = n.useMemo(() => zn(e, t, r, s.width, s.height), [
4120
+ let { nodes: d, edges: f } = n.useMemo(() => Kn(e, t, r, s.width, s.height), [
4003
4121
  e,
4004
4122
  t,
4005
4123
  r,
4006
4124
  s
4007
4125
  ]);
4008
4126
  return /* @__PURE__ */ Q(_, {
4009
- className: L("overflow-hidden", a),
4127
+ className: H("overflow-hidden", a),
4010
4128
  children: [/* @__PURE__ */ Z(y, {
4011
4129
  className: "pb-2",
4012
4130
  children: /* @__PURE__ */ Q(b, {
4013
4131
  className: "flex items-center gap-2 text-base",
4014
4132
  children: [
4015
- /* @__PURE__ */ Z(De, { className: "h-4 w-4" }),
4133
+ /* @__PURE__ */ Z(je, { className: "h-4 w-4" }),
4016
4134
  "Relationships",
4017
4135
  /* @__PURE__ */ Q("span", {
4018
4136
  className: "text-sm font-normal text-muted-foreground",
@@ -4041,9 +4159,9 @@ var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
4041
4159
  strokeWidth: 1.5,
4042
4160
  strokeOpacity: .5
4043
4161
  }, `edge-${t}`)), d.map((e) => {
4044
- let t = l === e.id, n = Ln[Math.min(e.level, Ln.length - 1)], r = Rn[Math.min(e.level, Rn.length - 1)], a = e.level === 0 ? In + 6 : In;
4162
+ let t = l === e.id, n = Wn[Math.min(e.level, Wn.length - 1)], r = Gn[Math.min(e.level, Gn.length - 1)], a = e.level === 0 ? Un + 6 : Un;
4045
4163
  return /* @__PURE__ */ Q("g", {
4046
- className: L("cursor-pointer transition-transform", i && "hover:opacity-80"),
4164
+ className: H("cursor-pointer transition-transform", i && "hover:opacity-80"),
4047
4165
  onClick: () => i?.(e.id),
4048
4166
  onMouseEnter: () => u(e.id),
4049
4167
  onMouseLeave: () => u(null),
@@ -4062,8 +4180,8 @@ var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
4062
4180
  y: e.y,
4063
4181
  textAnchor: "middle",
4064
4182
  dominantBaseline: "central",
4065
- className: L("text-[10px] font-medium pointer-events-none", r),
4066
- children: Bn(e.label)
4183
+ className: H("text-[10px] font-medium pointer-events-none", r),
4184
+ children: qn(e.label)
4067
4185
  }),
4068
4186
  e.type && /* @__PURE__ */ Z("text", {
4069
4187
  x: e.x,
@@ -4072,7 +4190,7 @@ var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
4072
4190
  className: "fill-muted-foreground text-[9px] pointer-events-none",
4073
4191
  children: e.type
4074
4192
  }),
4075
- t && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("rect", {
4193
+ t && /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("rect", {
4076
4194
  x: e.x - 50,
4077
4195
  y: e.y - a - 28,
4078
4196
  width: 100,
@@ -4097,16 +4215,16 @@ var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
4097
4215
  };
4098
4216
  //#endregion
4099
4217
  //#region src/CommentAttachment.tsx
4100
- function Hn(e) {
4218
+ function Yn(e) {
4101
4219
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
4102
4220
  }
4103
- function Un(e) {
4221
+ function Xn(e) {
4104
4222
  return e.startsWith("image/");
4105
4223
  }
4106
- function Wn(e) {
4107
- return Un(e) ? xe : e.includes("pdf") || e.includes("document") || e.includes("text") ? K : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? ye : ve;
4224
+ function Zn(e) {
4225
+ return Xn(e) ? Ce : e.includes("pdf") || e.includes("document") || e.includes("text") ? xe : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : be;
4108
4226
  }
4109
- var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
4227
+ var Qn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
4110
4228
  let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
4111
4229
  e.preventDefault(), e.stopPropagation(), c(!0);
4112
4230
  }, []), d = n.useCallback((e) => {
@@ -4117,9 +4235,9 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4117
4235
  t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
4118
4236
  }, [t]);
4119
4237
  return /* @__PURE__ */ Q("div", {
4120
- className: L("space-y-2", i),
4238
+ className: H("space-y-2", i),
4121
4239
  children: [t && !a && /* @__PURE__ */ Q("div", {
4122
- className: L("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"),
4240
+ className: H("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"),
4123
4241
  onDragOver: u,
4124
4242
  onDragLeave: d,
4125
4243
  onDrop: f,
@@ -4130,7 +4248,7 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4130
4248
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
4131
4249
  },
4132
4250
  children: [
4133
- /* @__PURE__ */ Z(Be, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
4251
+ /* @__PURE__ */ Z(Ke, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
4134
4252
  /* @__PURE__ */ Z("p", {
4135
4253
  className: "text-xs text-muted-foreground",
4136
4254
  children: o("detail.dropFilesToUpload")
@@ -4147,11 +4265,11 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4147
4265
  className: "space-y-1.5",
4148
4266
  children: [/* @__PURE__ */ Q("div", {
4149
4267
  className: "flex items-center gap-1.5 text-xs text-muted-foreground",
4150
- children: [/* @__PURE__ */ Z(Y, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
4268
+ children: [/* @__PURE__ */ Z(Pe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
4151
4269
  }), /* @__PURE__ */ Z("div", {
4152
4270
  className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
4153
4271
  children: e.map((e) => {
4154
- let t = Un(e.type), n = Wn(e.type);
4272
+ let t = Xn(e.type), n = Zn(e.type);
4155
4273
  return /* @__PURE__ */ Q("div", {
4156
4274
  className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
4157
4275
  children: [
@@ -4170,7 +4288,7 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4170
4288
  children: e.name
4171
4289
  }), /* @__PURE__ */ Z("p", {
4172
4290
  className: "text-[10px] text-muted-foreground",
4173
- children: Hn(e.size)
4291
+ children: Yn(e.size)
4174
4292
  })]
4175
4293
  }),
4176
4294
  r && !a && /* @__PURE__ */ Z(g, {
@@ -4179,7 +4297,7 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4179
4297
  className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
4180
4298
  onClick: () => r(e.id),
4181
4299
  title: o("detail.removeAttachment"),
4182
- children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
4300
+ children: /* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" })
4183
4301
  })
4184
4302
  ]
4185
4303
  }, e.id);
@@ -4190,7 +4308,7 @@ var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
4190
4308
  };
4191
4309
  //#endregion
4192
4310
  //#region src/PointInTimeRestore.tsx
4193
- function Kn(e) {
4311
+ function $n(e) {
4194
4312
  try {
4195
4313
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
4196
4314
  if (r < 1) return "just now";
@@ -4201,7 +4319,7 @@ function Kn(e) {
4201
4319
  return e;
4202
4320
  }
4203
4321
  }
4204
- var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4322
+ var er = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4205
4323
  let [a, o] = n.useState(null), [s, c] = n.useState(!1), [l, u] = n.useState(!1), d = n.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = n.useCallback(async () => {
4206
4324
  if (!(!d || !r)) {
4207
4325
  if (!s) {
@@ -4224,13 +4342,13 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4224
4342
  c(!1);
4225
4343
  }, []);
4226
4344
  return /* @__PURE__ */ Q(_, {
4227
- className: L("", i),
4345
+ className: H("", i),
4228
4346
  children: [/* @__PURE__ */ Z(y, {
4229
4347
  className: "pb-3",
4230
4348
  children: /* @__PURE__ */ Q(b, {
4231
4349
  className: "flex items-center gap-2 text-base",
4232
4350
  children: [
4233
- /* @__PURE__ */ Z(be, { className: "h-4 w-4" }),
4351
+ /* @__PURE__ */ Z(Se, { className: "h-4 w-4" }),
4234
4352
  "Revision History",
4235
4353
  /* @__PURE__ */ Q("span", {
4236
4354
  className: "text-sm font-normal text-muted-foreground",
@@ -4257,13 +4375,13 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4257
4375
  let t = e.id === a;
4258
4376
  return /* @__PURE__ */ Q("button", {
4259
4377
  type: "button",
4260
- className: L("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"),
4378
+ className: H("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"),
4261
4379
  onClick: () => {
4262
4380
  o(e.id), c(!1);
4263
4381
  },
4264
4382
  children: [/* @__PURE__ */ Z("div", {
4265
- className: L("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"),
4266
- children: t && /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-primary-foreground" })
4383
+ className: H("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"),
4384
+ children: t && /* @__PURE__ */ Z(fe, { className: "h-3 w-3 text-primary-foreground" })
4267
4385
  }), /* @__PURE__ */ Q("div", {
4268
4386
  className: "flex-1 min-w-0",
4269
4387
  children: [/* @__PURE__ */ Q("div", {
@@ -4273,7 +4391,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4273
4391
  children: e.user
4274
4392
  }), /* @__PURE__ */ Z("span", {
4275
4393
  className: "text-xs text-muted-foreground",
4276
- children: Kn(e.timestamp)
4394
+ children: $n(e.timestamp)
4277
4395
  })]
4278
4396
  }), /* @__PURE__ */ Q("p", {
4279
4397
  className: "text-xs text-muted-foreground mt-0.5",
@@ -4295,7 +4413,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4295
4413
  children: [
4296
4414
  /* @__PURE__ */ Q("div", {
4297
4415
  className: "flex items-center gap-2 text-sm font-medium",
4298
- children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
4416
+ children: [/* @__PURE__ */ Z(ve, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
4299
4417
  }),
4300
4418
  /* @__PURE__ */ Z("div", {
4301
4419
  className: "space-y-2",
@@ -4311,7 +4429,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4311
4429
  className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
4312
4430
  children: e.oldValue == null ? "(empty)" : String(e.oldValue)
4313
4431
  }),
4314
- /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
4432
+ /* @__PURE__ */ Z(fe, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
4315
4433
  /* @__PURE__ */ Z("span", {
4316
4434
  className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
4317
4435
  children: e.newValue == null ? "(empty)" : String(e.newValue)
@@ -4341,12 +4459,12 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4341
4459
  }),
4342
4460
  r && /* @__PURE__ */ Z("div", {
4343
4461
  className: "pt-1 space-y-2",
4344
- children: s ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Q("p", {
4462
+ children: s ? /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Q("p", {
4345
4463
  className: "text-xs text-amber-600 dark:text-amber-400",
4346
4464
  children: [
4347
4465
  "This will restore the record to its state at",
4348
4466
  " ",
4349
- Kn(d.timestamp),
4467
+ $n(d.timestamp),
4350
4468
  ". Continue?"
4351
4469
  ]
4352
4470
  }), /* @__PURE__ */ Q("div", {
@@ -4357,7 +4475,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4357
4475
  className: "gap-1.5 flex-1",
4358
4476
  onClick: f,
4359
4477
  disabled: l,
4360
- children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
4478
+ children: [/* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
4361
4479
  }), /* @__PURE__ */ Z(g, {
4362
4480
  variant: "ghost",
4363
4481
  size: "sm",
@@ -4370,14 +4488,14 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4370
4488
  size: "sm",
4371
4489
  className: "w-full gap-1.5",
4372
4490
  onClick: f,
4373
- children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Restore to this point"]
4491
+ children: [/* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" }), "Restore to this point"]
4374
4492
  })
4375
4493
  })
4376
4494
  ]
4377
4495
  })]
4378
4496
  }) })]
4379
4497
  });
4380
- }, Jn = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
4498
+ }, tr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
4381
4499
  let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
4382
4500
  let t = a.trim();
4383
4501
  if (t) {
@@ -4392,7 +4510,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4392
4510
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
4393
4511
  }, [l]);
4394
4512
  return /* @__PURE__ */ Q("div", {
4395
- className: L("flex gap-2", i),
4513
+ className: H("flex gap-2", i),
4396
4514
  children: [/* @__PURE__ */ Z("textarea", {
4397
4515
  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",
4398
4516
  placeholder: t,
@@ -4407,24 +4525,24 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4407
4525
  disabled: !a.trim() || s || r,
4408
4526
  className: "shrink-0 self-end",
4409
4527
  "aria-label": "Submit comment",
4410
- children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
4528
+ children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
4411
4529
  })]
4412
4530
  });
4413
- }, Yn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
4531
+ }, nr = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
4414
4532
  let s = n.useMemo(() => {
4415
4533
  if (!e) return t;
4416
4534
  let n = e.toLowerCase();
4417
4535
  return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
4418
4536
  }, [e, t]);
4419
4537
  return !i || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
4420
- className: L("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
4538
+ className: H("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
4421
4539
  role: "listbox",
4422
4540
  "aria-label": "Mention suggestions",
4423
4541
  children: s.map((e, t) => /* @__PURE__ */ Q("button", {
4424
4542
  type: "button",
4425
4543
  role: "option",
4426
4544
  "aria-selected": t === a,
4427
- className: L("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"),
4545
+ className: H("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"),
4428
4546
  onMouseDown: (t) => {
4429
4547
  t.preventDefault(), r(e);
4430
4548
  },
@@ -4452,7 +4570,7 @@ var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
4452
4570
  }, e.id))
4453
4571
  });
4454
4572
  };
4455
- function Xn(e, t, n) {
4573
+ function rr(e, t, n) {
4456
4574
  return {
4457
4575
  type: e.type,
4458
4576
  id: e.id,
@@ -4463,10 +4581,10 @@ function Xn(e, t, n) {
4463
4581
  }
4464
4582
  //#endregion
4465
4583
  //#region src/synth/buildDefaultPageSchema.ts
4466
- function Zn(e) {
4584
+ function ir(e) {
4467
4585
  return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
4468
4586
  }
4469
- function Qn(e) {
4587
+ function ar(e) {
4470
4588
  if (!e) return null;
4471
4589
  if (e.stageField) return e.stageField;
4472
4590
  let t = e.fields || {};
@@ -4482,7 +4600,7 @@ function Qn(e) {
4482
4600
  }
4483
4601
  return null;
4484
4602
  }
4485
- function $n(e, t) {
4603
+ function or(e, t) {
4486
4604
  if (!e || !t) return null;
4487
4605
  let n = e.fields?.[t]?.options;
4488
4606
  return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
@@ -4490,7 +4608,7 @@ function $n(e, t) {
4490
4608
  label: e.label
4491
4609
  }));
4492
4610
  }
4493
- function er(e, t, n = 4) {
4611
+ function sr(e, t, n = 4) {
4494
4612
  if (!e) return [];
4495
4613
  if (Array.isArray(e.highlightFields) && e.highlightFields.length > 0) return e.highlightFields.slice(0, n);
4496
4614
  let r = new Set([
@@ -4530,22 +4648,22 @@ function er(e, t, n = 4) {
4530
4648
  for (let e of Object.keys(o)) if (!(a.includes(e) || r.has(e)) && (a.push(e), a.length >= n)) break;
4531
4649
  return a;
4532
4650
  }
4533
- function tr(e, t = {}) {
4651
+ function cr(e, t = {}) {
4534
4652
  return {
4535
4653
  type: "page:header",
4536
4654
  recordChrome: t.recordChrome !== !1,
4537
4655
  ...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
4538
4656
  };
4539
4657
  }
4540
- function nr(e, t) {
4658
+ function lr(e, t) {
4541
4659
  return !Array.isArray(t) || t.length === 0 ? null : {
4542
4660
  type: "record:quick_actions",
4543
4661
  actions: t,
4544
4662
  location: "record_header"
4545
4663
  };
4546
4664
  }
4547
- function rr(e, t = {}) {
4548
- let n = t.statusField ?? Qn(e), r = t.stages ?? (n ? $n(e, n) : null), i = t.highlightFields ?? er(e, n), a = [];
4665
+ function ur(e, t = {}) {
4666
+ let n = t.statusField ?? ar(e), r = t.stages ?? (n ? or(e, n) : null), i = t.highlightFields ?? sr(e, n), a = [];
4549
4667
  return !t.hideHighlights && i.length > 0 && a.push({
4550
4668
  type: "record:highlights",
4551
4669
  fields: i
@@ -4555,17 +4673,17 @@ function rr(e, t = {}) {
4555
4673
  stages: r
4556
4674
  }), a;
4557
4675
  }
4558
- function ir(e, t, n) {
4676
+ function dr(e, t, n) {
4559
4677
  return {
4560
4678
  type: "record:details",
4561
4679
  sections: t,
4562
4680
  ...n && n.length > 0 ? { hideFields: n } : {}
4563
4681
  };
4564
4682
  }
4565
- function ar(e, t = {}) {
4566
- let n = t.statusField ?? Qn(e), r = t.highlightFields ?? er(e, n), i = [{
4683
+ function fr(e, t = {}) {
4684
+ let n = t.statusField ?? ar(e), r = t.highlightFields ?? sr(e, n), i = [{
4567
4685
  label: "Details",
4568
- children: [ir(e, t.sections, r)]
4686
+ children: [dr(e, t.sections, r)]
4569
4687
  }];
4570
4688
  return Array.isArray(t.related) && t.related.length > 0 && i.push({
4571
4689
  label: "Related",
@@ -4594,23 +4712,23 @@ function ar(e, t = {}) {
4594
4712
  items: i
4595
4713
  };
4596
4714
  }
4597
- function or() {
4715
+ function pr() {
4598
4716
  return { type: "record:discussion" };
4599
4717
  }
4600
- function sr(e, t = {}) {
4718
+ function mr(e, t = {}) {
4601
4719
  let n = t.slots || {}, r = [];
4602
- if ("header" in n && n.header !== void 0 ? r.push(...Zn(n.header)) : r.push(tr(e, {
4720
+ if ("header" in n && n.header !== void 0 ? r.push(...ir(n.header)) : r.push(cr(e, {
4603
4721
  recordChrome: t.recordChrome,
4604
4722
  actions: t.headerActions
4605
- })), "actions" in n && n.actions !== void 0 && r.push(...Zn(n.actions)), "highlights" in n && n.highlights !== void 0 ? r.push(...Zn(n.highlights)) : r.push(...rr(e, {
4723
+ })), "actions" in n && n.actions !== void 0 && r.push(...ir(n.actions)), "highlights" in n && n.highlights !== void 0 ? r.push(...ir(n.highlights)) : r.push(...ur(e, {
4606
4724
  highlightFields: t.highlightFields,
4607
4725
  statusField: t.statusField,
4608
4726
  stages: t.stages,
4609
4727
  hideHighlights: t.hideHighlights,
4610
4728
  hidePath: t.hidePath
4611
- })), "tabs" in n && n.tabs !== void 0) r.push(...Zn(n.tabs));
4729
+ })), "tabs" in n && n.tabs !== void 0) r.push(...ir(n.tabs));
4612
4730
  else if ("details" in n && n.details !== void 0) {
4613
- let i = Zn(n.details), a = ar(e, {
4731
+ let i = ir(n.details), a = fr(e, {
4614
4732
  sections: t.sections,
4615
4733
  related: t.related,
4616
4734
  showActivity: t.showActivity,
@@ -4622,7 +4740,7 @@ function sr(e, t = {}) {
4622
4740
  ...a.items[0],
4623
4741
  children: i
4624
4742
  }), r.push(a);
4625
- } else r.push(ar(e, {
4743
+ } else r.push(fr(e, {
4626
4744
  sections: t.sections,
4627
4745
  related: t.related,
4628
4746
  showActivity: t.showActivity,
@@ -4630,7 +4748,7 @@ function sr(e, t = {}) {
4630
4748
  highlightFields: t.highlightFields,
4631
4749
  statusField: t.statusField
4632
4750
  }));
4633
- return "discussion" in n && n.discussion !== void 0 ? r.push(...Zn(n.discussion)) : t.hideDiscussion || r.push(or()), {
4751
+ return "discussion" in n && n.discussion !== void 0 ? r.push(...ir(n.discussion)) : t.hideDiscussion || r.push(pr()), {
4634
4752
  type: "record",
4635
4753
  pageType: "record",
4636
4754
  object: e?.name,
@@ -4642,7 +4760,7 @@ function sr(e, t = {}) {
4642
4760
  }]
4643
4761
  };
4644
4762
  }
4645
- e.register("detail-view", Ut, {
4763
+ e.register("detail-view", Xt, {
4646
4764
  namespace: "plugin-detail",
4647
4765
  label: "Detail View",
4648
4766
  category: "Views",
@@ -4772,7 +4890,7 @@ e.register("detail-view", Ut, {
4772
4890
  tabs: [],
4773
4891
  related: []
4774
4892
  }
4775
- }), e.register("detail-section", pt, {
4893
+ }), e.register("detail-section", bt, {
4776
4894
  namespace: "plugin-detail",
4777
4895
  label: "Detail Section",
4778
4896
  category: "Detail Components",
@@ -4823,7 +4941,7 @@ e.register("detail-view", Ut, {
4823
4941
  label: "Header Color"
4824
4942
  }
4825
4943
  ]
4826
- }), e.register("related-list", gt, {
4944
+ }), e.register("related-list", Ct, {
4827
4945
  namespace: "plugin-detail",
4828
4946
  label: "Related List",
4829
4947
  category: "Detail Components",
@@ -4870,7 +4988,7 @@ e.register("detail-view", Ut, {
4870
4988
  label: "Columns"
4871
4989
  }
4872
4990
  ]
4873
- }), e.register("detail", Ut, {
4991
+ }), e.register("detail", Xt, {
4874
4992
  namespace: "view",
4875
4993
  category: "view",
4876
4994
  label: "Detail",
@@ -4893,51 +5011,51 @@ e.register("detail-view", Ut, {
4893
5011
  label: "Fields"
4894
5012
  }
4895
5013
  ]
4896
- }), e.register("record:details", Kt, {
5014
+ }), e.register("record:details", $t, {
4897
5015
  namespace: "record",
4898
5016
  category: "record",
4899
5017
  label: "Record Details",
4900
5018
  icon: "FileText"
4901
- }), e.register("record:related_list", Yt, {
5019
+ }), e.register("record:related_list", nn, {
4902
5020
  namespace: "record",
4903
5021
  category: "record",
4904
5022
  label: "Related List",
4905
5023
  icon: "List"
4906
- }), e.register("record:highlights", Zt, {
5024
+ }), e.register("record:highlights", an, {
4907
5025
  namespace: "record",
4908
5026
  category: "record",
4909
5027
  label: "Highlights Panel",
4910
5028
  icon: "Star"
4911
- }), e.register("record:activity", fn, {
5029
+ }), e.register("record:activity", yn, {
4912
5030
  namespace: "record",
4913
5031
  category: "record",
4914
5032
  label: "Activity Timeline",
4915
5033
  icon: "Activity"
4916
- }), e.register("record:chatter", hn, {
5034
+ }), e.register("record:chatter", Sn, {
4917
5035
  namespace: "record",
4918
5036
  category: "record",
4919
5037
  label: "Chatter Feed",
4920
5038
  icon: "MessageSquare"
4921
- }), e.register("record:discussion", hn, {
5039
+ }), e.register("record:discussion", Sn, {
4922
5040
  namespace: "record",
4923
5041
  category: "record",
4924
5042
  label: "Discussion",
4925
5043
  icon: "MessageSquare"
4926
- }), e.register("record:path", _n, {
5044
+ }), e.register("record:path", wn, {
4927
5045
  namespace: "record",
4928
5046
  category: "record",
4929
5047
  label: "Path / Stepper",
4930
5048
  icon: "GitBranch"
4931
- }), e.register("record:quick_actions", yn, {
5049
+ }), e.register("record:quick_actions", En, {
4932
5050
  namespace: "record",
4933
5051
  category: "record",
4934
5052
  label: "Quick Actions",
4935
5053
  icon: "Zap"
4936
- }), e.register("record:history", xn, {
5054
+ }), e.register("record:history", On, {
4937
5055
  namespace: "record",
4938
5056
  category: "record",
4939
5057
  label: "History Timeline",
4940
5058
  icon: "Clock"
4941
5059
  });
4942
5060
  //#endregion
4943
- export { Et as ActivityTimeline, Gn as CommentAttachment, Jn as CommentInput, dt as DETAIL_DEFAULT_TRANSLATIONS, pt as DetailSection, mt as DetailTabs, Ut as DetailView, Pn as DiffView, Qt as FieldChangeItem, vt as HeaderHighlight, Nt as HistoryTimeline, Dn as InlineCreateRelated, Yn as MentionAutocomplete, qn as PointInTimeRestore, en as ReactionPicker, fn as RecordActivityRenderer, un as RecordActivityTimeline, pn as RecordChatterPanel, hn as RecordChatterRenderer, bt as RecordComments, Tn as RecordDetailDrawer, Kt as RecordDetailsRenderer, Zt as RecordHighlightsRenderer, xn as RecordHistoryRenderer, Bt as RecordMetaFooter, Fn as RecordNavigationEnhanced, _n as RecordPathRenderer, yn as RecordQuickActionsRenderer, Yt as RecordRelatedListRenderer, gt as RelatedList, Vn as RelationshipGraph, kn as RichTextCommentInput, _t as SectionGroup, rn as SubscriptionToggle, nn as ThreadedReplies, ct as applyAutoSpan, lt as applyDetailAutoLayout, nr as buildDefaultActions, ir as buildDefaultDetails, or as buildDefaultDiscussion, tr as buildDefaultHeader, rr as buildDefaultHighlights, sr as buildDefaultPageSchema, ar as buildDefaultTabs, Xn as createMentionFromSuggestion, ut as createSafeTranslationHook, er as deriveHighlightFields, En as deriveRecordPageHref, $n as deriveStages, Qn as detectStatusField, st as inferDetailColumns, ot as isWideFieldType, $ as useDetailTranslation };
5061
+ export { Nt as ActivityTimeline, Qn as CommentAttachment, tr as CommentInput, vt as DETAIL_DEFAULT_TRANSLATIONS, bt as DetailSection, xt as DetailTabs, Xt as DetailView, Vn as DiffView, on as FieldChangeItem, Tt as HeaderHighlight, Bt as HistoryTimeline, Pn as InlineCreateRelated, nr as MentionAutocomplete, er as PointInTimeRestore, cn as ReactionPicker, yn as RecordActivityRenderer, _n as RecordActivityTimeline, bn as RecordChatterPanel, Sn as RecordChatterRenderer, Dt as RecordComments, Mn as RecordDetailDrawer, $t as RecordDetailsRenderer, an as RecordHighlightsRenderer, On as RecordHistoryRenderer, qt as RecordMetaFooter, Hn as RecordNavigationEnhanced, wn as RecordPathRenderer, En as RecordQuickActionsRenderer, nn as RecordRelatedListRenderer, Ct as RelatedList, Jn as RelationshipGraph, In as RichTextCommentInput, wt as SectionGroup, dn as SubscriptionToggle, un as ThreadedReplies, ht as applyAutoSpan, gt as applyDetailAutoLayout, lr as buildDefaultActions, dr as buildDefaultDetails, pr as buildDefaultDiscussion, cr as buildDefaultHeader, ur as buildDefaultHighlights, mr as buildDefaultPageSchema, fr as buildDefaultTabs, rr as createMentionFromSuggestion, _t as createSafeTranslationHook, sr as deriveHighlightFields, Nn as deriveRecordPageHref, or as deriveStages, ar as detectStatusField, mt as inferDetailColumns, pt as isWideFieldType, $ as useDetailTranslation };