@object-ui/plugin-detail 13.1.0 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import { ComponentRegistry as e, buildExpandFields as t, formatTitleTemplate as n, getRecordDisplayName as r } from "@object-ui/core";
2
2
  import * as i from "react";
3
3
  import a from "react";
4
- import { Alert as o, AlertDescription as s, AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, AlertTitle as g, Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Card as S, CardContent as C, CardHeader as w, CardTitle as T, Collapsible as E, CollapsibleContent as D, CollapsibleTrigger as O, DataEmptyState as k, Input as A, LazyIcon as j, Select as M, SelectContent as N, SelectItem as P, SelectTrigger as ee, SelectValue as te, Sheet as ne, SheetContent as re, SheetHeader as ie, SheetTitle as ae, Skeleton as F, Tabs as I, TabsContent as L, TabsList as R, TabsTrigger as z, Tooltip as B, TooltipContent as V, TooltipProvider as oe, TooltipTrigger as H, buttonVariants as U, cn as W, useIsMobile as se } from "@object-ui/components";
5
- import { Activity as G, AlertTriangle as ce, ArrowLeft as le, ArrowRight as ue, ArrowRightLeft as de, ArrowUpDown as fe, AtSign as K, Bell as pe, BellOff as q, Bold as me, Calendar as he, Check as ge, CheckSquare as _e, ChevronDown as ve, ChevronLeft as ye, ChevronRight as be, ChevronsLeft as xe, ChevronsRight as Se, Code as Ce, Columns2 as we, Copy as Te, Edit as Ee, ExternalLink as De, Eye as J, EyeOff as Oe, File as ke, FileArchive as Y, FileText as Ae, History as je, Image as Me, Inbox as X, Italic as Ne, Link as Pe, List as Fe, Loader2 as Ie, Lock as Le, Mail as Re, MessageSquare as ze, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Phone as We, Pin as Ge, Plus as Ke, PlusCircle as qe, RotateCcw as Je, Rows3 as Ye, Search as Xe, Send as Ze, SmilePlus as Qe, Star as $e, Trash2 as et, Upload as tt, X as nt, Zap as rt, icons as it } from "lucide-react";
6
- import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct, useDataInvalidation as lt, useDiscussionContext as ut, useHighlightFieldNames as dt, useMetadataItem as ft, useObjectTranslation as pt, useRecordContext as mt, useRegisterHighlightFields as ht, useRelatedRecordActions as gt, useSafeFieldLabel as _t } from "@object-ui/react";
7
- import { BooleanField as vt, LookupField as yt, RecordPickerDialog as bt, SelectField as xt, UserField as St, coerceToSafeValue as Ct, getCellRenderer as wt, humanizeLabel as Tt, resolveCellRendererType as Et } from "@object-ui/fields";
8
- import { Fragment as Dt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
9
- import { useFieldPermissions as Ot, usePermissions as kt } from "@object-ui/permissions";
10
- import { resolveFieldCurrency as At, useLocalization as jt } from "@object-ui/i18n";
11
- import { Link as Mt, useParams as Nt } from "react-router-dom";
12
- import { deriveFieldGroupLayout as Pt } from "@objectstack/spec/data";
4
+ import { Alert as o, AlertDescription as s, AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, AlertTitle as g, Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Card as S, CardContent as C, CardHeader as w, CardTitle as T, Collapsible as E, CollapsibleContent as D, CollapsibleTrigger as O, DataEmptyState as k, Input as A, LazyIcon as j, Select as M, SelectContent as N, SelectItem as P, SelectTrigger as F, SelectValue as ee, Sheet as te, SheetContent as ne, SheetHeader as re, SheetTitle as ie, Skeleton as I, Tabs as L, TabsContent as R, TabsList as z, TabsTrigger as B, Tooltip as V, TooltipContent as H, TooltipProvider as ae, TooltipTrigger as U, buttonVariants as W, cn as G, useIsMobile as oe } from "@object-ui/components";
5
+ import { Activity as se, AlertTriangle as K, ArrowLeft as ce, ArrowRight as q, ArrowRightLeft as le, ArrowUpDown as ue, AtSign as de, Bell as fe, BellOff as J, Bold as pe, Calendar as me, Check as he, CheckSquare as ge, ChevronDown as _e, ChevronLeft as ve, ChevronRight as ye, ChevronsLeft as be, ChevronsRight as xe, Code as Se, Columns2 as Ce, Copy as we, Edit as Te, ExternalLink as Ee, Eye as De, EyeOff as Oe, File as ke, FileArchive as Y, FileText as Ae, History as je, Image as Me, Inbox as X, Italic as Ne, Link as Pe, List as Fe, Loader2 as Ie, Lock as Le, Mail as Re, MessageSquare as ze, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Pencil as We, Phone as Ge, Pin as Ke, Plus as qe, PlusCircle as Je, RotateCcw as Ye, Rows3 as Xe, Search as Ze, Send as Qe, SmilePlus as $e, Star as et, Trash2 as tt, Upload as nt, X as rt, Zap as it, icons as at } from "lucide-react";
6
+ import { SchemaRenderer as ot, toPredicateInput as st, useActionEngine as ct, useCondition as lt, useDataInvalidation as ut, useDiscussionContext as dt, useHighlightFieldNames as ft, useMetadataItem as pt, useObjectTranslation as mt, useRecordContext as ht, useRegisterHighlightFields as gt, useRelatedRecordActions as _t, useSafeFieldLabel as vt } from "@object-ui/react";
7
+ import { BooleanField as yt, CapabilityMultiSelectField as bt, LookupField as xt, RecordPickerDialog as St, SelectField as Ct, UserField as wt, coerceToSafeValue as Tt, getCellRenderer as Et, humanizeLabel as Dt, parseCapabilityNames as Ot, resolveCellRendererType as kt } from "@object-ui/fields";
8
+ import { Link as At, useParams as jt } from "react-router-dom";
9
+ import { Fragment as Mt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
10
+ import { useFieldPermissions as Nt, usePermissions as Pt } from "@object-ui/permissions";
11
+ import { resolveFieldCurrency as Ft, useLocalization as It } from "@object-ui/i18n";
12
+ import { deriveFieldGroupLayout as Lt } from "@objectstack/spec/data";
13
13
  //#region src/autoLayout.ts
14
- var Ft = /* @__PURE__ */ new Set([
14
+ var Rt = /* @__PURE__ */ new Set([
15
15
  "textarea",
16
16
  "markdown",
17
17
  "html",
@@ -23,36 +23,36 @@ var Ft = /* @__PURE__ */ new Set([
23
23
  "field:grid",
24
24
  "field:rich-text"
25
25
  ]);
26
- function It(e) {
27
- return Ft.has(e);
26
+ function zt(e) {
27
+ return Rt.has(e);
28
28
  }
29
- function Lt(e, t) {
29
+ function Bt(e, t) {
30
30
  let n;
31
31
  return n = e <= 3 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
32
32
  }
33
- function Rt(e, t) {
34
- return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && It(e.type) ? {
33
+ function Vt(e, t) {
34
+ return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && zt(e.type) ? {
35
35
  ...e,
36
36
  span: t
37
37
  } : e);
38
38
  }
39
- function zt(e, t, n) {
39
+ function Ht(e, t, n) {
40
40
  if (t !== void 0) return {
41
- fields: Rt(e, t),
41
+ fields: Vt(e, t),
42
42
  columns: t
43
43
  };
44
- let r = Lt(e.length, n);
44
+ let r = Bt(e.length, n);
45
45
  return {
46
- fields: Rt(e, r),
46
+ fields: Vt(e, r),
47
47
  columns: r
48
48
  };
49
49
  }
50
50
  //#endregion
51
51
  //#region src/useDetailTranslation.ts
52
- function Bt(e, t) {
52
+ function Ut(e, t) {
53
53
  return function() {
54
54
  try {
55
- let n = pt();
55
+ let n = mt();
56
56
  return n.t(t) === t ? { t: (t, n) => {
57
57
  let r = e[t] || t;
58
58
  if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
@@ -67,13 +67,14 @@ function Bt(e, t) {
67
67
  }
68
68
  };
69
69
  }
70
- var Vt = {
70
+ var Wt = {
71
71
  "detail.back": "Back",
72
72
  "detail.edit": "Edit",
73
73
  "detail.editInline": "Edit",
74
74
  "detail.save": "Save",
75
75
  "detail.saveChanges": "Save changes",
76
76
  "detail.editFieldsInline": "Edit fields inline",
77
+ "detail.editInlineHint": "Double-click to edit",
77
78
  "detail.cancel": "Cancel",
78
79
  "detail.cancelEdit": "Discard changes",
79
80
  "detail.openInNewTab": "Open in new tab",
@@ -193,123 +194,216 @@ var Vt = {
193
194
  "detail.concurrentUpdateReload": "Reload latest",
194
195
  "detail.concurrentUpdateOverwrite": "Overwrite anyway",
195
196
  "detail.concurrentUpdateCancel": "Cancel"
196
- }, $ = Bt(Vt, "detail.back");
197
+ }, $ = Ut(Wt, "detail.back");
198
+ //#endregion
199
+ //#region src/renderers/PermissionFacetLink.tsx
200
+ function Gt(e) {
201
+ if (typeof e == "string") {
202
+ let t = e.trim();
203
+ if (!t) return null;
204
+ try {
205
+ return JSON.parse(t);
206
+ } catch {
207
+ return t;
208
+ }
209
+ }
210
+ return e ?? null;
211
+ }
212
+ function Kt(e) {
213
+ let t = Gt(e);
214
+ return t == null || t === "" ? 0 : Array.isArray(t) ? t.length : typeof t == "object" ? Object.keys(t).length : 1;
215
+ }
216
+ function qt({ value: e, field: t }) {
217
+ let { t: n } = $(), r = ht(), { appName: i } = jt(), a = t?.name || "", o = r?.data?.name, s = i && o ? `/apps/${i}/metadata/permission/${encodeURIComponent(String(o))}` : null, c = Kt(e), l = c === 0;
218
+ return /* @__PURE__ */ Q("span", {
219
+ className: "inline-flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",
220
+ children: [(() => {
221
+ if (l) return /* @__PURE__ */ Z("span", {
222
+ className: "text-muted-foreground",
223
+ children: n("perm.facet.none", { defaultValue: "None" })
224
+ });
225
+ if (a === "system_permissions") {
226
+ let t = Ot(e), r = t.slice(0, 6), i = t.length - r.length;
227
+ return /* @__PURE__ */ Q("span", {
228
+ className: "inline-flex flex-wrap items-center gap-1",
229
+ children: [r.map((e) => /* @__PURE__ */ Z(b, {
230
+ variant: "outline",
231
+ children: e
232
+ }, e)), i > 0 && /* @__PURE__ */ Z("span", {
233
+ className: "text-muted-foreground text-xs",
234
+ children: n("perm.facet.more", {
235
+ count: i,
236
+ defaultValue: `+${i} more`
237
+ })
238
+ })]
239
+ });
240
+ }
241
+ return /* @__PURE__ */ Z("span", {
242
+ className: "text-foreground",
243
+ children: (() => {
244
+ switch (a) {
245
+ case "object_permissions": return n("perm.facet.objects", {
246
+ count: c,
247
+ defaultValue: `${c} object${c === 1 ? "" : "s"}`
248
+ });
249
+ case "field_permissions": return n("perm.facet.fields", {
250
+ count: c,
251
+ defaultValue: `${c} field rule${c === 1 ? "" : "s"}`
252
+ });
253
+ case "row_level_security": return n("perm.facet.rls", {
254
+ count: c,
255
+ defaultValue: `${c} RLS polic${c === 1 ? "y" : "ies"}`
256
+ });
257
+ case "tab_permissions": return n("perm.facet.tabs", {
258
+ count: c,
259
+ defaultValue: `${c} tab rule${c === 1 ? "" : "s"}`
260
+ });
261
+ case "admin_scope": return n("perm.facet.adminScope", { defaultValue: "Delegated admin configured" });
262
+ default: return String(c);
263
+ }
264
+ })()
265
+ });
266
+ })(), s ? /* @__PURE__ */ Z(At, {
267
+ to: s,
268
+ className: "text-primary hover:underline whitespace-nowrap",
269
+ children: n("perm.facet.designInStudio", { defaultValue: "Design in Studio →" })
270
+ }) : /* @__PURE__ */ Z("span", {
271
+ className: "text-muted-foreground/60 whitespace-nowrap",
272
+ children: n("perm.facet.designInStudioHint", { defaultValue: "Design in Studio" })
273
+ })]
274
+ });
275
+ }
197
276
  //#endregion
198
277
  //#region src/DetailSection.tsx
199
- function Ht(e, t) {
278
+ function Jt(e, t) {
200
279
  return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : t === 3 ? e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "" : e === 2 ? "md:col-span-2" : e === 3 ? "md:col-span-2 lg:col-span-3" : e >= 4 ? "md:col-span-2 lg:col-span-3 xl:col-span-4" : "";
201
280
  }
202
- var Ut = /* @__PURE__ */ new Set([
281
+ var Yt = /* @__PURE__ */ new Set([
203
282
  "formula",
204
283
  "summary",
205
284
  "rollup",
206
285
  "auto_number"
207
286
  ]);
208
- function Wt(e) {
287
+ function Xt(e) {
209
288
  if (e == null) return e;
210
- if (Array.isArray(e)) return e.map(Wt);
289
+ if (Array.isArray(e)) return e.map(Xt);
211
290
  if (typeof e == "object") {
212
291
  let t = e;
213
292
  return t.id ?? t._id ?? t.value ?? "";
214
293
  }
215
294
  return e;
216
295
  }
217
- var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
218
- let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } = _t(), k = i.useCallback((e, t) => {
296
+ var Zt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, onEnterInlineEdit: c, autoFocusField: l, dataSource: u, virtualScroll: d }) => {
297
+ let [f, p] = i.useState(e.defaultCollapsed ?? !1), [m, h] = i.useState(null), [g, _] = i.useState(void 0), [v, y] = i.useState(!1), { t: b } = $(), { fieldLabel: k, translateOptions: A } = vt(), j = i.useCallback((e, t) => {
219
298
  let n = t == null ? "" : String(t);
220
299
  navigator.clipboard.writeText(n).then(() => {
221
- p(e), setTimeout(() => p(null), 2e3);
300
+ h(e), setTimeout(() => h(null), 2e3);
222
301
  });
223
- }, []), A = i.useCallback((e) => {
302
+ }, []), M = i.useCallback((e) => {
224
303
  let n = t?.[e.name] ?? e.value;
225
304
  return n == null || n === "";
226
- }, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = se(), N = M ? 3 : 4, P = M ? .2 : .25, ee = e.fields.length - j, te = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= P && ee > 0, ne = !g && (e.hideEmpty || te) ? e.fields.filter((e) => !A(e)) : e.fields, { fields: re, columns: ie } = zt(ne, e.columns), ae = Math.min(ie, Math.max(1, ne.length)), F = (e) => {
305
+ }, [t]), N = i.useMemo(() => e.fields.filter(M).length, [e.fields, M]), P = oe(), F = P ? 3 : 4, ee = P ? .2 : .25, te = e.fields.length - N, ne = !e.hideEmpty && !o && e.fields.length >= F && N / e.fields.length >= ee && te > 0, re = !v && (e.hideEmpty || ne) ? e.fields.filter((e) => !M(e)) : e.fields, { fields: ie, columns: I } = Ht(re, e.columns), L = Math.min(I, Math.max(1, re.length)), R = (e) => {
227
306
  let n = t?.[e.name] ?? e.value;
228
- if (e.render) return /* @__PURE__ */ Z(at, {
307
+ if (e.render) return /* @__PURE__ */ Z(ot, {
229
308
  schema: e.render,
230
309
  data: {
231
310
  ...t,
232
311
  value: n
233
312
  }
234
313
  });
235
- let i = Ht(e.span, ae), l = r?.fields?.[e.name], u = { ...e };
236
- if (l) {
237
- !e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.scale !== void 0 && u.scale === void 0 && (u.scale = l.scale), l.format && !u.format && (u.format = l.format);
238
- let t = l.reference_to || l.reference;
239
- t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field), l.dueLike !== void 0 && u.dueLike === void 0 && (u.dueLike = l.dueLike);
314
+ let i = Jt(e.span, L), d = r?.fields?.[e.name], f = { ...e };
315
+ if (d) {
316
+ !e.type && d.type && (f.type = d.type), d.options && !f.options && (f.options = d.options), d.currency && !f.currency && (f.currency = d.currency), d.precision !== void 0 && f.precision === void 0 && (f.precision = d.precision), d.scale !== void 0 && f.scale === void 0 && (f.scale = d.scale), d.format && !f.format && (f.format = d.format), d.widget && !f.widget && (f.widget = d.widget);
317
+ let t = d.reference_to || d.reference;
318
+ t && !f.reference_to && (f.reference_to = t), d.reference_field && !f.reference_field && (f.reference_field = d.reference_field), d.dueLike !== void 0 && f.dueLike === void 0 && (f.dueLike = d.dueLike);
240
319
  }
241
- a && Array.isArray(u.options) && u.options.length > 0 && (u.options = b(a, e.name, u.options));
242
- let d = (() => {
320
+ a && Array.isArray(f.options) && f.options.length > 0 && (f.options = A(a, e.name, f.options));
321
+ let p = f.type || e.type, h = Yt.has(p), g = !e.readonly && !h, _ = g && !!c, v = (() => {
322
+ if ((f.widget || e.widget) === "permission-facet-link") return /* @__PURE__ */ Z(qt, {
323
+ value: n,
324
+ field: f
325
+ });
243
326
  if (n == null || n === "") return /* @__PURE__ */ Z("span", {
244
327
  className: "text-muted-foreground/60 text-sm select-none",
245
- "aria-label": v("detail.noValue", { defaultValue: "No value" }),
246
- title: v("detail.noValue", { defaultValue: "No value" }),
328
+ "aria-label": b("detail.noValue", { defaultValue: "No value" }),
329
+ title: b("detail.noValue", { defaultValue: "No value" }),
247
330
  children: "—"
248
331
  });
249
- let t = Et(u) || e.type;
332
+ let t = kt(f) || e.type;
250
333
  if (t) {
251
- let e = wt(t);
334
+ let e = Et(t);
252
335
  if (e) return /* @__PURE__ */ Z(e, {
253
336
  value: n,
254
- field: u
337
+ field: f
255
338
  });
256
339
  }
257
340
  return String(n);
258
- })(), p = n != null && n !== "", m = f === e.name, h = y(a || "", e.name, e.label || e.name);
259
- return M && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
260
- className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
261
- onClick: p ? () => k(e.name, n) : void 0,
262
- onKeyDown: p ? (t) => {
263
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
341
+ })(), y = n != null && n !== "", S = y && !_, C = m === e.name, w = k(a || "", e.name, e.label || e.name);
342
+ return P && !(o && g) ? /* @__PURE__ */ Q("div", {
343
+ className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", y && "cursor-pointer active:bg-muted/40 transition-colors"),
344
+ onClick: y ? () => j(e.name, n) : void 0,
345
+ onKeyDown: y ? (t) => {
346
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(e.name, n));
264
347
  } : void 0,
265
- role: p ? "button" : void 0,
266
- tabIndex: p ? 0 : void 0,
348
+ role: y ? "button" : void 0,
349
+ tabIndex: y ? 0 : void 0,
267
350
  children: [/* @__PURE__ */ Z("span", {
268
351
  className: "text-[15px] text-muted-foreground shrink-0",
269
- children: h
352
+ children: w
270
353
  }), /* @__PURE__ */ Z("span", {
271
354
  className: "text-[15px] text-foreground text-right break-words min-w-0 leading-snug",
272
- children: d
355
+ children: v
273
356
  })]
274
357
  }, e.name) : /* @__PURE__ */ Q("div", {
275
- className: W("space-y-1.5 group min-w-0", i),
358
+ className: G("space-y-1.5 group min-w-0", i),
276
359
  children: [/* @__PURE__ */ Z("div", {
277
360
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
278
- children: y(a || "", e.name, e.label || e.name)
279
- }), o && !e.readonly ? /* @__PURE__ */ Z("div", {
361
+ children: k(a || "", e.name, e.label || e.name)
362
+ }), o && g ? /* @__PURE__ */ Z("div", {
280
363
  className: "min-h-[44px] sm:min-h-0",
281
364
  children: (() => {
282
- let t = u.type || e.type;
283
- if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(xt, {
284
- field: u,
365
+ let t = f.type || e.type, r = f.widget || e.widget;
366
+ if (r === "permission-facet-link") return /* @__PURE__ */ Z(qt, {
367
+ value: n,
368
+ field: f
369
+ });
370
+ if (r === "capability-multiselect") return /* @__PURE__ */ Z(bt, {
371
+ value: n,
372
+ onChange: (t) => s?.(e.name, t),
373
+ field: f,
374
+ dataSource: u
375
+ });
376
+ if (t === "select" && Array.isArray(f.options) && f.options.length > 0) return /* @__PURE__ */ Z(Ct, {
377
+ field: f,
285
378
  value: n == null ? "" : String(n),
286
379
  onChange: (t) => s?.(e.name, t)
287
380
  });
288
- if (t === "boolean") return /* @__PURE__ */ Z(vt, {
289
- field: u,
381
+ if (t === "boolean") return /* @__PURE__ */ Z(yt, {
382
+ field: f,
290
383
  value: !!n,
291
384
  onChange: (t) => s?.(e.name, t)
292
385
  });
293
- let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Ut.has(t);
294
- if (r || i) return /* @__PURE__ */ Z(r ? St : yt, {
295
- field: u,
296
- value: Wt(n),
386
+ let i = t === "user" || t === "owner", a = t === "lookup" || t === "master_detail" || t === "tree" || !!f.reference_to && !Yt.has(t);
387
+ if (i || a) return /* @__PURE__ */ Z(i ? wt : xt, {
388
+ field: f,
389
+ value: Xt(n),
297
390
  onChange: (t) => s?.(e.name, t),
298
- dataSource: c
391
+ dataSource: u
299
392
  });
300
- let a = t === "date" || t === "datetime";
393
+ let o = t === "date" || t === "datetime", c = t === "number" ? "number" : o ? "date" : "text", d = n == null ? "" : o ? (() => {
394
+ let e = String(n);
395
+ if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
396
+ let t = new Date(e);
397
+ return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
398
+ })() : String(typeof n == "object" ? Tt(n) ?? "" : n);
301
399
  return /* @__PURE__ */ Z("input", {
302
- type: t === "number" ? "number" : a ? "date" : "text",
400
+ type: c,
401
+ autoFocus: l === e.name,
303
402
  className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
304
- value: n == null ? "" : a ? (() => {
305
- let e = String(n);
306
- if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
307
- let t = new Date(e);
308
- return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
309
- })() : String(typeof n == "object" ? Ct(n) ?? "" : n),
403
+ value: d,
310
404
  onChange: (t) => {
311
405
  let n = t.target.value;
312
- if (a && n) {
406
+ if (o && n) {
313
407
  let t = (/* @__PURE__ */ new Date(n + "T00:00:00")).toISOString();
314
408
  s?.(e.name, t);
315
409
  } else s?.(e.name, n);
@@ -317,79 +411,93 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
317
411
  });
318
412
  })()
319
413
  }) : /* @__PURE__ */ Q("div", {
320
- className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
321
- onClick: p ? () => k(e.name, n) : void 0,
322
- onKeyDown: p ? (t) => {
323
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
414
+ className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", S && "cursor-pointer active:bg-muted/60 transition-colors", _ && "cursor-pointer hover:bg-muted/40 transition-colors -mx-1.5 px-1.5"),
415
+ onClick: S ? () => j(e.name, n) : void 0,
416
+ onDoubleClick: _ ? () => c?.(e.name) : void 0,
417
+ onKeyDown: S ? (t) => {
418
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(e.name, n));
324
419
  } : void 0,
325
- role: p ? "button" : void 0,
326
- tabIndex: p ? 0 : void 0,
420
+ role: S ? "button" : void 0,
421
+ tabIndex: S ? 0 : void 0,
422
+ title: _ ? b("detail.editInlineHint") : void 0,
327
423
  children: [/* @__PURE__ */ Z("div", {
328
424
  className: "text-sm flex-1 min-w-0 break-words py-1",
329
- children: d
330
- }), p && /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
425
+ children: v
426
+ }), _ ? /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
331
427
  asChild: !0,
332
428
  children: /* @__PURE__ */ Z(x, {
333
429
  variant: "ghost",
334
430
  size: "icon",
335
431
  className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
432
+ "aria-label": b("detail.editInlineHint"),
336
433
  onClick: (t) => {
337
- t.stopPropagation(), k(e.name, n);
434
+ t.stopPropagation(), c?.(e.name);
338
435
  },
339
- children: m ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
436
+ children: /* @__PURE__ */ Z(We, { className: "h-3 w-3" })
340
437
  })
341
- }), /* @__PURE__ */ Z(V, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
438
+ }), /* @__PURE__ */ Z(H, { children: b("detail.editInlineHint") })] }) }) : y ? /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
439
+ asChild: !0,
440
+ children: /* @__PURE__ */ Z(x, {
441
+ variant: "ghost",
442
+ size: "icon",
443
+ className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
444
+ onClick: (t) => {
445
+ t.stopPropagation(), j(e.name, n);
446
+ },
447
+ children: C ? /* @__PURE__ */ Z(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(we, { className: "h-3 w-3" })
448
+ })
449
+ }), /* @__PURE__ */ Z(H, { children: b(C ? "detail.copied" : "detail.copyToClipboard") })] }) }) : null]
342
450
  })]
343
451
  }, e.name);
344
- }, I = l?.enabled === !0, L = l?.batchSize ?? 20;
452
+ }, z = d?.enabled === !0, B = d?.batchSize ?? 20;
345
453
  if (i.useEffect(() => {
346
- if (!I) {
347
- h(void 0);
454
+ if (!z) {
455
+ _(void 0);
348
456
  return;
349
457
  }
350
- if (re.length <= L) {
351
- h(void 0);
458
+ if (ie.length <= B) {
459
+ _(void 0);
352
460
  return;
353
461
  }
354
- h(L);
355
- let e = setTimeout(() => h(void 0), 100);
462
+ _(B);
463
+ let e = setTimeout(() => _(void 0), 100);
356
464
  return () => clearTimeout(e);
357
465
  }, [
358
- I,
359
- re.length,
360
- L
361
- ]), ne.length === 0 && j === e.fields.length) return null;
362
- let R = m === void 0 ? re : re.slice(0, m), z = j > 0 && (e.hideEmpty || te), U = /* @__PURE__ */ Q(Dt, { children: [M ? /* @__PURE__ */ Z("div", {
466
+ z,
467
+ ie.length,
468
+ B
469
+ ]), re.length === 0 && N === e.fields.length) return null;
470
+ let W = g === void 0 ? ie : ie.slice(0, g), se = N > 0 && (e.hideEmpty || ne), K = /* @__PURE__ */ Q(Mt, { children: [P ? /* @__PURE__ */ Z("div", {
363
471
  className: "flex flex-col divide-y divide-border/60",
364
- children: R.map(F)
472
+ children: W.map(R)
365
473
  }) : /* @__PURE__ */ Z("div", {
366
- className: W("grid gap-3 sm:gap-4", ae === 1 ? "grid-cols-1" : ae === 2 ? "grid-cols-1 md:grid-cols-2" : ae === 3 ? "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),
367
- children: R.map(F)
368
- }), z && /* @__PURE__ */ Z("div", {
474
+ className: G("grid gap-3 sm:gap-4", L === 1 ? "grid-cols-1" : L === 2 ? "grid-cols-1 md:grid-cols-2" : L === 3 ? "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),
475
+ children: W.map(R)
476
+ }), se && /* @__PURE__ */ Z("div", {
369
477
  className: "mt-3 -ml-2",
370
478
  children: /* @__PURE__ */ Q(x, {
371
479
  type: "button",
372
480
  variant: "ghost",
373
481
  size: "sm",
374
- onClick: () => _((e) => !e),
482
+ onClick: () => y((e) => !e),
375
483
  className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
376
- children: [Z(g ? Oe : J, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
377
- count: j,
378
- defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
484
+ children: [Z(v ? Oe : De, { className: "h-3.5 w-3.5 mr-1.5" }), v ? b("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : b("detail.showEmptyFields", {
485
+ count: N,
486
+ defaultValue: `Show ${N} empty field${N === 1 ? "" : "s"}`
379
487
  })]
380
488
  })
381
489
  })] });
382
490
  return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
383
- className: W(n),
384
- children: U
491
+ className: G(n),
492
+ children: K
385
493
  }) : e.collapsible ? /* @__PURE__ */ Z(E, {
386
- open: !u,
387
- onOpenChange: (e) => d(!e),
494
+ open: !f,
495
+ onOpenChange: (e) => p(!e),
388
496
  className: n,
389
497
  children: /* @__PURE__ */ Q(S, { children: [/* @__PURE__ */ Z(O, {
390
498
  asChild: !0,
391
499
  children: /* @__PURE__ */ Q(w, {
392
- className: W("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
500
+ className: G("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
393
501
  children: [/* @__PURE__ */ Q(T, {
394
502
  className: "flex items-center justify-between text-base font-semibold tracking-tight",
395
503
  children: [/* @__PURE__ */ Q("div", {
@@ -400,21 +508,21 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
400
508
  }), /* @__PURE__ */ Z("span", { children: e.title })]
401
509
  }), /* @__PURE__ */ Z("div", {
402
510
  className: "flex items-center gap-2",
403
- children: Z(u ? be : ve, { className: "h-4 w-4 text-muted-foreground" })
511
+ children: Z(f ? ye : _e, { className: "h-4 w-4 text-muted-foreground" })
404
512
  })]
405
- }), e.description && !u && /* @__PURE__ */ Z("p", {
513
+ }), e.description && !f && /* @__PURE__ */ Z("p", {
406
514
  className: "text-xs text-muted-foreground mt-1",
407
515
  children: e.description
408
516
  })]
409
517
  })
410
518
  }), /* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(C, {
411
519
  className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
412
- children: U
520
+ children: K
413
521
  }) })] })
414
522
  }) : /* @__PURE__ */ Q(S, {
415
- className: W(e.showBorder === !1 ? "border-none shadow-none" : "", n),
523
+ className: G(e.showBorder === !1 ? "border-none shadow-none" : "", n),
416
524
  children: [e.title && /* @__PURE__ */ Q(w, {
417
- className: W("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
525
+ className: G("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
418
526
  children: [/* @__PURE__ */ Z(T, {
419
527
  className: "flex items-center justify-between text-base font-semibold tracking-tight",
420
528
  children: /* @__PURE__ */ Q("div", {
@@ -430,18 +538,18 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
430
538
  })]
431
539
  }), /* @__PURE__ */ Z(C, {
432
540
  className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
433
- children: U
541
+ children: K
434
542
  })]
435
543
  });
436
- }, Kt = ({ tabs: e, data: t, className: n }) => {
544
+ }, Qt = ({ tabs: e, data: t, className: n }) => {
437
545
  let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
438
- return /* @__PURE__ */ Q(I, {
546
+ return /* @__PURE__ */ Q(L, {
439
547
  value: r,
440
548
  onValueChange: a,
441
549
  className: n,
442
- children: [/* @__PURE__ */ Z(R, {
550
+ children: [/* @__PURE__ */ Z(z, {
443
551
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
444
- children: o.map((e) => /* @__PURE__ */ Z(z, {
552
+ children: o.map((e) => /* @__PURE__ */ Z(B, {
445
553
  value: e.key,
446
554
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
447
555
  children: /* @__PURE__ */ Q("div", {
@@ -457,18 +565,18 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
457
565
  ]
458
566
  })
459
567
  }, e.key))
460
- }), o.map((e) => /* @__PURE__ */ Z(L, {
568
+ }), o.map((e) => /* @__PURE__ */ Z(R, {
461
569
  value: e.key,
462
570
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
463
571
  children: /* @__PURE__ */ Z(i.Suspense, {
464
572
  fallback: null,
465
573
  children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
466
574
  className: "space-y-4",
467
- children: e.content.map((e, n) => /* @__PURE__ */ Z(at, {
575
+ children: e.content.map((e, n) => /* @__PURE__ */ Z(ot, {
468
576
  schema: e,
469
577
  data: t
470
578
  }, n))
471
- }) : /* @__PURE__ */ Z(at, {
579
+ }) : /* @__PURE__ */ Z(ot, {
472
580
  schema: e.content,
473
581
  data: t
474
582
  })
@@ -478,64 +586,78 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
478
586
  };
479
587
  //#endregion
480
588
  //#region src/RelatedList.tsx
481
- function qt(e) {
482
- return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
589
+ function $t(e) {
590
+ return e && at[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
483
591
  }
484
- var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, toolbarActions: M, onToolbarAction: N, add: P, maxColumns: ee = 6, pageSize: te, sortable: ne = !1, filterable: re = !1, collapsible: ie = !1, defaultCollapsed: ae = !1, referenceField: F, parentId: I, icon: L }) => {
485
- let R = r !== void 0, z = r ?? [], [B, V] = i.useState(z), [oe, H] = i.useState(() => !!n && !R), [U, G] = i.useState(0), [ce, le] = i.useState(null), [ue, de] = i.useState("asc"), [K, pe] = i.useState(""), [q, me] = i.useState(null), [he, ge] = i.useState(ae), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(!1), [we, Te] = i.useState(null), [Ee, J] = i.useState(0), [Oe, ke] = i.useState({}), { t: Y } = $(), { fieldLabel: Ae } = _t();
592
+ var en = ({ action: e, onToolbarAction: t }) => {
593
+ let n = e.visible, r = lt(st(n));
594
+ if (n && !r) return null;
595
+ let i = e.icon ? $t(e.icon) : null;
596
+ return /* @__PURE__ */ Q(x, {
597
+ variant: e.variant === "primary" ? "default" : "outline",
598
+ size: "sm",
599
+ onClick: (n) => {
600
+ n.stopPropagation(), t(e);
601
+ },
602
+ className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
603
+ "data-testid": `related-toolbar-action-${e.name}`,
604
+ children: [i && /* @__PURE__ */ Z(i, { className: "h-3.5 w-3.5" }), e.label || e.name]
605
+ });
606
+ }, tn = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, toolbarActions: M, onToolbarAction: N, add: P, maxColumns: F = 6, pageSize: ee, sortable: te = !1, filterable: ne = !1, collapsible: re = !1, defaultCollapsed: ie = !1, referenceField: I, parentId: L, icon: R }) => {
607
+ let z = r !== void 0, B = r ?? [], [V, H] = i.useState(B), [ae, U] = i.useState(() => !!n && !z), [W, se] = i.useState(0), [K, ce] = i.useState(null), [q, le] = i.useState("asc"), [de, fe] = i.useState(""), [J, pe] = i.useState(null), [me, he] = i.useState(ie), [ge, be] = i.useState(!1), [xe, Se] = i.useState(!1), [Ce, we] = i.useState(null), [Te, De] = i.useState(0), [Oe, ke] = i.useState({}), { t: Y } = $(), { fieldLabel: Ae } = vt();
486
608
  i.useEffect(() => {
487
- R && V(r ?? []);
488
- }, [r, R]), i.useEffect(() => {
489
- n && g?.getObjectSchema && g.getObjectSchema(n).then(me).catch((e) => {
609
+ z && H(r ?? []);
610
+ }, [r, z]), i.useEffect(() => {
611
+ n && g?.getObjectSchema && g.getObjectSchema(n).then(pe).catch((e) => {
490
612
  console.warn(`[RelatedList] Failed to fetch schema for ${n}:`, e);
491
613
  });
492
614
  }, [n, g]), i.useEffect(() => {
493
- if (n && !R) {
494
- if (!(F && I != null && I !== "")) {
495
- n && (I == null || I === "") && !F && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), H(!1);
615
+ if (n && !z) {
616
+ if (!(I && L != null && L !== "")) {
617
+ n && (L == null || L === "") && !I && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), H([]), U(!1);
496
618
  return;
497
619
  }
498
- H(!0);
499
- let e = { [F]: I };
620
+ U(!0);
621
+ let e = { [I]: L };
500
622
  if (g && typeof g.find == "function") g.find(n, { $filter: e }).then((e) => {
501
623
  let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [];
502
- V(t), H(!1);
624
+ H(t), U(!1);
503
625
  }).catch((e) => {
504
- console.error("Failed to fetch related data:", e), H(!1);
626
+ console.error("Failed to fetch related data:", e), U(!1);
505
627
  });
506
628
  else {
507
- let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
629
+ let e = new URLSearchParams({ [`filter[${I}]`]: String(L) }).toString();
508
630
  fetch(`${n}?${e}`).then((e) => e.json()).then((e) => {
509
631
  let t = Array.isArray(e) ? e : e?.data || [];
510
- V(t);
632
+ H(t);
511
633
  }).catch((e) => {
512
634
  console.error("Failed to fetch related data:", e);
513
- }).finally(() => H(!1));
635
+ }).finally(() => U(!1));
514
636
  }
515
637
  }
516
638
  }, [
517
639
  n,
518
- R,
640
+ z,
519
641
  g,
520
- F,
521
642
  I,
522
- Ee
643
+ L,
644
+ Te
523
645
  ]), i.useEffect(() => {
524
- if (!n || R) return;
646
+ if (!n || z) return;
525
647
  let e = (e) => {
526
648
  let t = e.detail || {};
527
- t.objectName && t.objectName !== n || J((e) => e + 1);
649
+ t.objectName && t.objectName !== n || De((e) => e + 1);
528
650
  };
529
651
  return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
530
- }, [n, R]), i.useEffect(() => {
531
- if (!g?.find || !q?.fields || !B.length) return;
532
- let e = q.fields, t = [];
652
+ }, [n, z]), i.useEffect(() => {
653
+ if (!g?.find || !J?.fields || !V.length) return;
654
+ let e = J.fields, t = [];
533
655
  for (let [n, r] of Object.entries(e)) {
534
656
  if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
535
657
  let e = r.reference_to || r.reference;
536
658
  if (!e) continue;
537
659
  let i = /* @__PURE__ */ new Set();
538
- for (let e of B) {
660
+ for (let e of V) {
539
661
  let t = e?.[n];
540
662
  t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
541
663
  }
@@ -578,78 +700,78 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
578
700
  };
579
701
  }, [
580
702
  g,
581
- q,
582
- B
703
+ J,
704
+ V
583
705
  ]);
584
706
  let je = i.useMemo(() => {
585
- if (!K) return B;
586
- let e = K.toLowerCase();
587
- return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
588
- }, [B, K]), Me = i.useMemo(() => ce ? [...je].sort((e, t) => {
589
- let n = e[ce], r = t[ce];
707
+ if (!de) return V;
708
+ let e = de.toLowerCase();
709
+ return V.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
710
+ }, [V, de]), Me = i.useMemo(() => K ? [...je].sort((e, t) => {
711
+ let n = e[K], r = t[K];
590
712
  if (n == null && r == null) return 0;
591
713
  if (n == null) return 1;
592
714
  if (r == null) return -1;
593
715
  let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
594
- return ue === "asc" ? i : -i;
716
+ return q === "asc" ? i : -i;
595
717
  }) : je, [
596
718
  je,
597
- ce,
598
- ue
599
- ]), X = te && te > 0 ? te : 0, Ne = X ? Math.max(1, Math.ceil(Me.length / X)) : 1, Pe = X ? Me.slice(U * X, (U + 1) * X) : Me;
719
+ K,
720
+ q
721
+ ]), X = ee && ee > 0 ? ee : 0, Ne = X ? Math.max(1, Math.ceil(Me.length / X)) : 1, Pe = X ? Me.slice(W * X, (W + 1) * X) : Me;
600
722
  i.useEffect(() => {
601
- G(0);
723
+ se(0);
602
724
  }, [
725
+ de,
603
726
  K,
604
- ce,
605
- ue
727
+ q
606
728
  ]);
607
729
  let Fe = i.useCallback((e) => {
608
- ce === e ? de((e) => e === "asc" ? "desc" : "asc") : (le(e), de("asc"));
609
- }, [ce]), [Ie, Le] = i.useState(null), Re = i.useCallback((e) => {
730
+ K === e ? le((e) => e === "asc" ? "desc" : "asc") : (ce(e), le("asc"));
731
+ }, [K]), [Ie, Le] = i.useState(null), Re = i.useCallback((e) => {
610
732
  Le(e);
611
733
  }, []), ze = i.useCallback(async () => {
612
734
  if (Ie) try {
613
- await D?.(Ie), J((e) => e + 1);
735
+ await D?.(Ie), De((e) => e + 1);
614
736
  } catch (e) {
615
737
  console.error("[RelatedList] remove failed", e);
616
738
  }
617
739
  Le(null);
618
740
  }, [Ie, D]), Be = i.useCallback(async (e) => {
619
- if (!P || !g || !n || F == null || I == null) return;
741
+ if (!P || !g || !n || I == null || L == null) return;
620
742
  let t = P.picker.valueField || "id";
621
- Ce(!0), Te(null);
743
+ Se(!0), we(null);
622
744
  try {
623
745
  for (let r of e || []) {
624
746
  let e = r?.[t] ?? r?.id;
625
747
  e != null && (P.linkField ? await g.create?.(n, {
626
- [F]: I,
748
+ [I]: L,
627
749
  [P.linkField]: e
628
- }) : await g.update?.(P.picker.object, String(e), { [F]: I }));
750
+ }) : await g.update?.(P.picker.object, String(e), { [I]: L }));
629
751
  }
630
- J((e) => e + 1);
752
+ De((e) => e + 1);
631
753
  } catch (e) {
632
754
  let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
633
- Te(typeof t == "string" ? t : "Failed to add");
755
+ we(typeof t == "string" ? t : "Failed to add");
634
756
  } finally {
635
- Ce(!1), xe(!1);
757
+ Se(!1), be(!1);
636
758
  }
637
759
  }, [
638
760
  P,
639
761
  g,
640
762
  n,
641
- F,
642
- I
643
- ]), Ve = kt(), He = i.useMemo(() => {
763
+ I,
764
+ L
765
+ ]), Ve = Pt(), He = i.useMemo(() => {
644
766
  let e = _ || n || "", t = (t) => !Ve?.isLoaded || !e ? t : t.filter((t) => {
645
767
  let n = t?.accessorKey || t?.field || t?.name;
646
768
  return n ? Ve.checkField(e, String(n), "read") : !0;
647
- }), r = (e) => F ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== F) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => B.length ? e.filter((e) => {
769
+ }), r = (e) => I ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== I) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => V.length ? e.filter((e) => {
648
770
  let t = e?.accessorKey || e?.field || e?.name;
649
- return t ? B.some((e) => !a(e?.[t])) : !0;
771
+ return t ? V.some((e) => !a(e?.[t])) : !0;
650
772
  }) : e, c = (e, t) => {
651
773
  if (!t?.type) return;
652
- let n = wt(Et({
774
+ let n = Et(kt({
653
775
  type: t.type,
654
776
  format: t.format
655
777
  }) || t.type);
@@ -677,7 +799,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
677
799
  if (typeof t != "string") {
678
800
  let e = t?.accessorKey || t?.field || t?.name;
679
801
  if (t && !t.cell && !t.render && e) {
680
- let n = q?.fields?.[e], r = n ? c(String(e), n) : void 0;
802
+ let n = J?.fields?.[e], r = n ? c(String(e), n) : void 0;
681
803
  if (r) return {
682
804
  ...t,
683
805
  cell: r
@@ -685,7 +807,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
685
807
  }
686
808
  return t;
687
809
  }
688
- let n = q?.fields?.[t], r = {
810
+ let n = J?.fields?.[t], r = {
689
811
  accessorKey: t,
690
812
  header: n?.label || Ae(e, t, n) || t,
691
813
  fieldDef: n,
@@ -694,11 +816,11 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
694
816
  return i && (r.cell = i), r;
695
817
  };
696
818
  if (o && o.length > 0) return s(t(r(o.map(l))));
697
- if (!q?.fields) return [];
698
- let u = Array.isArray(q.highlightFields) ? q.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
819
+ if (!J?.fields) return [];
820
+ let u = Array.isArray(J.highlightFields) ? J.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
699
821
  if (u.length > 0) {
700
822
  let e = s(t(r(u.map(l))));
701
- if (e.length > 0) return e.slice(0, Math.max(1, ee));
823
+ if (e.length > 0) return e.slice(0, Math.max(1, F));
702
824
  }
703
825
  let d = e, f = /* @__PURE__ */ new Set([
704
826
  "image",
@@ -716,7 +838,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
716
838
  "label",
717
839
  "code",
718
840
  "number"
719
- ], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && f.has(t.type) || Ve?.isLoaded && d && !Ve.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
841
+ ], m = Object.entries(J.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === I || t?.hidden || t?.type && f.has(t.type) || Ve?.isLoaded && d && !Ve.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
720
842
  "created_at",
721
843
  "updated_at",
722
844
  "created_by",
@@ -741,19 +863,19 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
741
863
  r && (n.cell = r);
742
864
  }
743
865
  return n;
744
- })).slice(0, Math.max(1, ee));
866
+ })).slice(0, Math.max(1, F));
745
867
  }, [
746
868
  o,
747
- q,
869
+ J,
748
870
  _,
749
871
  n,
750
872
  Ae,
873
+ I,
874
+ V,
751
875
  F,
752
- B,
753
- ee,
754
876
  Oe,
755
877
  Ve
756
- ]), Ue = Array.isArray(k) && k.length > 0, We = !!E || !!D || Ue, Ge = se(), qe = i.useMemo(() => {
878
+ ]), Ue = Array.isArray(k) && k.length > 0, We = !!E || !!D || Ue, Ge = oe(), Ke = i.useMemo(() => {
757
879
  if (a) return a;
758
880
  if (Ge && (t === "grid" || t === "table")) {
759
881
  let e = He[0]?.accessorKey || He[0]?.field || He[0]?.name, t = He.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
@@ -811,32 +933,32 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
811
933
  O,
812
934
  Ge,
813
935
  n
814
- ]), Je = ie ? "cursor-pointer select-none" : void 0, Ye = ie ? () => ge((e) => !e) : void 0, Xe = qt(L), Ze = !oe && B.length === 0, Qe = re;
936
+ ]), Je = re ? "cursor-pointer select-none" : void 0, Ye = re ? () => he((e) => !e) : void 0, Xe = $t(R), Ze = !ae && V.length === 0, Qe = ne;
815
937
  return /* @__PURE__ */ Q(S, {
816
- className: W("shadow-none border-border/60 bg-transparent", Ze && "bg-muted/10", s),
938
+ className: G("shadow-none border-border/60 bg-transparent", Ze && "bg-muted/10", s),
817
939
  children: [
818
940
  /* @__PURE__ */ Z(w, {
819
- className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Je),
941
+ className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Je),
820
942
  onClick: Ye,
821
943
  children: /* @__PURE__ */ Q(T, {
822
944
  className: "flex items-center justify-between gap-2 text-sm font-semibold",
823
945
  children: [/* @__PURE__ */ Q("div", {
824
946
  className: "flex items-center gap-2 min-w-0",
825
947
  children: [
826
- ie && Z(he ? be : ve, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
948
+ re && Z(me ? ye : _e, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
827
949
  /* @__PURE__ */ Z(Xe, {
828
950
  className: "h-4 w-4 text-muted-foreground shrink-0",
829
951
  "aria-hidden": !0
830
952
  }),
831
953
  /* @__PURE__ */ Z("span", {
832
- className: W("truncate", Ze && "text-muted-foreground font-medium"),
954
+ className: G("truncate", Ze && "text-muted-foreground font-medium"),
833
955
  children: e
834
956
  }),
835
957
  /* @__PURE__ */ Z(b, {
836
958
  variant: "secondary",
837
- className: W("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
838
- "aria-label": `${B.length} records`,
839
- children: B.length
959
+ className: G("text-xs font-normal h-5 px-1.5", V.length === 0 && "bg-muted text-muted-foreground"),
960
+ "aria-label": `${V.length} records`,
961
+ children: V.length
840
962
  }),
841
963
  Ze && /* @__PURE__ */ Z("span", {
842
964
  className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
@@ -846,27 +968,19 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
846
968
  }), /* @__PURE__ */ Q("div", {
847
969
  className: "flex items-center gap-1 shrink-0",
848
970
  children: [
849
- N && (M ?? []).map((e) => {
850
- let t = e.icon ? qt(e.icon) : null;
851
- return /* @__PURE__ */ Q(x, {
852
- variant: e.variant === "primary" ? "default" : "outline",
853
- size: "sm",
854
- onClick: (t) => {
855
- t.stopPropagation(), N(e);
856
- },
857
- className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
858
- children: [t && /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" }), e.label || e.name]
859
- }, e.name);
860
- }),
971
+ N && (M ?? []).map((e) => /* @__PURE__ */ Z(en, {
972
+ action: e,
973
+ onToolbarAction: N
974
+ }, e.name)),
861
975
  P && /* @__PURE__ */ Q(x, {
862
976
  variant: Ze ? "ghost" : "outline",
863
977
  size: "sm",
864
- disabled: Se,
978
+ disabled: xe,
865
979
  onClick: (e) => {
866
- e.stopPropagation(), Te(null), xe(!0);
980
+ e.stopPropagation(), we(null), be(!0);
867
981
  },
868
982
  className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
869
- children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), P.label || Y("detail.add", { defaultValue: "Add" })]
983
+ children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), P.label || Y("detail.add", { defaultValue: "Add" })]
870
984
  }),
871
985
  v && /* @__PURE__ */ Q(x, {
872
986
  variant: Ze ? "ghost" : "outline",
@@ -875,47 +989,47 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
875
989
  e.stopPropagation(), v();
876
990
  },
877
991
  className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
878
- children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), Y("detail.new")]
992
+ children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), Y("detail.new")]
879
993
  })
880
994
  ]
881
995
  })]
882
996
  })
883
997
  }),
884
- !he && !Ze && /* @__PURE__ */ Q(C, {
885
- className: W("pt-0 pb-4 px-4"),
998
+ !me && !Ze && /* @__PURE__ */ Q(C, {
999
+ className: G("pt-0 pb-4 px-4"),
886
1000
  children: [
887
1001
  Qe && /* @__PURE__ */ Z("div", {
888
1002
  className: "mb-3",
889
1003
  children: /* @__PURE__ */ Z(A, {
890
1004
  placeholder: Y("detail.filterPlaceholder"),
891
- value: K,
892
- onChange: (e) => pe(e.target.value),
1005
+ value: de,
1006
+ onChange: (e) => fe(e.target.value),
893
1007
  className: "h-8 text-sm"
894
1008
  })
895
1009
  }),
896
- ne && He && He.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
1010
+ te && He && He.length > 0 && V.length > 0 && /* @__PURE__ */ Z("div", {
897
1011
  className: "flex flex-wrap gap-1 mb-3",
898
1012
  children: He.map((e) => {
899
1013
  let t = e.accessorKey || e.field || e.name;
900
1014
  if (!t) return null;
901
- let n = e.header || e.label || t, r = ce === t;
1015
+ let n = e.header || e.label || t, r = K === t;
902
1016
  return /* @__PURE__ */ Q(x, {
903
1017
  variant: r ? "secondary" : "ghost",
904
1018
  size: "sm",
905
1019
  className: "gap-1 h-7 text-xs",
906
1020
  onClick: () => Fe(t),
907
1021
  children: [
908
- /* @__PURE__ */ Z(fe, { className: "h-3 w-3" }),
1022
+ /* @__PURE__ */ Z(ue, { className: "h-3 w-3" }),
909
1023
  n,
910
- r && (ue === "asc" ? " ↑" : " ↓")
1024
+ r && (q === "asc" ? " ↑" : " ↓")
911
1025
  ]
912
1026
  }, t);
913
1027
  })
914
1028
  }),
915
- oe ? /* @__PURE__ */ Z("div", {
1029
+ ae ? /* @__PURE__ */ Z("div", {
916
1030
  className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
917
1031
  children: Y("detail.loading")
918
- }) : /* @__PURE__ */ Z(at, { schema: qe }),
1032
+ }) : /* @__PURE__ */ Z(ot, { schema: Ke }),
919
1033
  X > 0 && Me.length > X && /* @__PURE__ */ Q("div", {
920
1034
  className: "flex items-center justify-between mt-3 pt-3 border-t",
921
1035
  children: [
@@ -923,14 +1037,14 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
923
1037
  variant: "outline",
924
1038
  size: "sm",
925
1039
  className: "h-7 text-xs gap-1",
926
- disabled: U === 0,
927
- onClick: () => G((e) => Math.max(0, e - 1)),
928
- children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }), Y("detail.previousPage")]
1040
+ disabled: W === 0,
1041
+ onClick: () => se((e) => Math.max(0, e - 1)),
1042
+ children: [/* @__PURE__ */ Z(ve, { className: "h-3 w-3" }), Y("detail.previousPage")]
929
1043
  }),
930
1044
  /* @__PURE__ */ Z("span", {
931
1045
  className: "text-xs text-muted-foreground",
932
1046
  children: Y("detail.pageOf", {
933
- current: U + 1,
1047
+ current: W + 1,
934
1048
  total: Ne
935
1049
  })
936
1050
  }),
@@ -938,9 +1052,9 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
938
1052
  variant: "outline",
939
1053
  size: "sm",
940
1054
  className: "h-7 text-xs gap-1",
941
- disabled: U >= Ne - 1,
942
- onClick: () => G((e) => Math.min(Ne - 1, e + 1)),
943
- children: [Y("detail.nextPage"), /* @__PURE__ */ Z(be, { className: "h-3 w-3" })]
1055
+ disabled: W >= Ne - 1,
1056
+ onClick: () => se((e) => Math.min(Ne - 1, e + 1)),
1057
+ children: [Y("detail.nextPage"), /* @__PURE__ */ Z(ye, { className: "h-3 w-3" })]
944
1058
  })
945
1059
  ]
946
1060
  }),
@@ -952,7 +1066,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
952
1066
  e.stopPropagation(), y();
953
1067
  },
954
1068
  className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
955
- children: [Y("detail.viewAll"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
1069
+ children: [Y("detail.viewAll"), /* @__PURE__ */ Z(Ee, { className: "h-3 w-3" })]
956
1070
  })
957
1071
  })
958
1072
  ]
@@ -968,14 +1082,14 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
968
1082
  children: Y("detail.delete", { defaultValue: "Delete" })
969
1083
  })] })] })
970
1084
  }),
971
- we && /* @__PURE__ */ Z("div", {
1085
+ Ce && /* @__PURE__ */ Z("div", {
972
1086
  className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
973
1087
  role: "alert",
974
- children: we
1088
+ children: Ce
975
1089
  }),
976
- P && g && /* @__PURE__ */ Z(bt, {
977
- open: _e,
978
- onOpenChange: (e) => xe(e),
1090
+ P && g && /* @__PURE__ */ Z(St, {
1091
+ open: ge,
1092
+ onOpenChange: (e) => be(e),
979
1093
  multiple: !0,
980
1094
  dataSource: g,
981
1095
  objectName: P.picker.object,
@@ -987,22 +1101,24 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
987
1101
  })
988
1102
  ]
989
1103
  });
990
- }, Yt = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
991
- let l = e.collapsible ?? !0, [u, d] = i.useState(e.defaultCollapsed ?? !1), f = /* @__PURE__ */ Z("div", {
1104
+ }, nn = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, onEnterInlineEdit: c, autoFocusField: l, dataSource: u }) => {
1105
+ let d = e.collapsible ?? !0, [f, p] = i.useState(e.defaultCollapsed ?? !1), m = /* @__PURE__ */ Z("div", {
992
1106
  className: "space-y-3 sm:space-y-4",
993
- children: e.sections.map((e, n) => /* @__PURE__ */ Z(Gt, {
1107
+ children: e.sections.map((e, n) => /* @__PURE__ */ Z(Zt, {
994
1108
  section: e,
995
1109
  data: t,
996
1110
  objectSchema: r,
997
1111
  objectName: a,
998
1112
  isEditing: o,
999
1113
  onFieldChange: s,
1000
- dataSource: c
1114
+ onEnterInlineEdit: c,
1115
+ autoFocusField: l,
1116
+ dataSource: u
1001
1117
  }, n))
1002
1118
  });
1003
- return l ? /* @__PURE__ */ Q(E, {
1004
- open: !u,
1005
- onOpenChange: (e) => d(!e),
1119
+ return d ? /* @__PURE__ */ Q(E, {
1120
+ open: !f,
1121
+ onOpenChange: (e) => p(!e),
1006
1122
  className: n,
1007
1123
  children: [
1008
1124
  /* @__PURE__ */ Z(O, {
@@ -1010,7 +1126,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1010
1126
  children: /* @__PURE__ */ Q("div", {
1011
1127
  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",
1012
1128
  children: [
1013
- Z(u ? be : ve, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
1129
+ Z(f ? ye : _e, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
1014
1130
  e.icon && /* @__PURE__ */ Z("span", {
1015
1131
  className: "text-muted-foreground",
1016
1132
  children: e.icon
@@ -1022,17 +1138,17 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1022
1138
  ]
1023
1139
  })
1024
1140
  }),
1025
- e.description && !u && /* @__PURE__ */ Z("p", {
1141
+ e.description && !f && /* @__PURE__ */ Z("p", {
1026
1142
  className: "text-sm text-muted-foreground mt-1",
1027
1143
  children: e.description
1028
1144
  }),
1029
1145
  /* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z("div", {
1030
1146
  className: "mt-3",
1031
- children: f
1147
+ children: m
1032
1148
  }) })
1033
1149
  ]
1034
1150
  }) : /* @__PURE__ */ Q("div", {
1035
- className: W("space-y-3", n),
1151
+ className: G("space-y-3", n),
1036
1152
  children: [
1037
1153
  /* @__PURE__ */ Q("div", {
1038
1154
  className: "flex items-center gap-2 pb-2 border-b",
@@ -1048,21 +1164,21 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1048
1164
  className: "text-sm text-muted-foreground",
1049
1165
  children: e.description
1050
1166
  }),
1051
- f
1167
+ m
1052
1168
  ]
1053
1169
  });
1054
- }, Xt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
1055
- let { fieldLabel: a } = _t();
1170
+ }, rn = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
1171
+ let { fieldLabel: a } = vt();
1056
1172
  if (!e.length || !t) return null;
1057
1173
  let o = e.filter((e) => {
1058
1174
  let n = t?.[e.name];
1059
1175
  return n != null && n !== "";
1060
1176
  });
1061
1177
  return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
1062
- className: W("@container border-b border-border/60 pb-4", n),
1178
+ className: G("@container border-b border-border/60 pb-4", n),
1063
1179
  "aria-label": "Record highlights",
1064
1180
  children: /* @__PURE__ */ Z("div", {
1065
- className: W("flex flex-wrap gap-y-4"),
1181
+ className: G("flex flex-wrap gap-y-4"),
1066
1182
  children: o.map((e) => {
1067
1183
  let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
1068
1184
  name: e.name,
@@ -1073,27 +1189,27 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1073
1189
  ...o?.precision !== void 0 && { precision: o.precision },
1074
1190
  ...o?.scale !== void 0 && { scale: o.scale },
1075
1191
  ...o?.format && { format: o.format }
1076
- }, l = wt(Et(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea" || s === "reference" || s === "lookup" || s === "master_detail", f = s === "boolean";
1192
+ }, l = Et(kt(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea" || s === "reference" || s === "lookup" || s === "master_detail", f = s === "boolean";
1077
1193
  return /* @__PURE__ */ Q("div", {
1078
- className: W("flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0", d ? "basis-[16rem] max-w-[24rem]" : "basis-[9rem] max-w-[16rem]"),
1194
+ className: G("flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0", d ? "basis-[16rem] max-w-[24rem]" : "basis-[9rem] max-w-[16rem]"),
1079
1195
  children: [/* @__PURE__ */ Z("span", {
1080
1196
  className: "text-xs font-medium text-muted-foreground",
1081
1197
  children: a(r || "", e.name, e.label)
1082
1198
  }), f ? n ? /* @__PURE__ */ Q("span", {
1083
1199
  className: "inline-flex items-center gap-1 self-start rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 ring-1 ring-inset ring-emerald-500/30 dark:text-emerald-400",
1084
- children: [/* @__PURE__ */ Z(ge, {
1200
+ children: [/* @__PURE__ */ Z(he, {
1085
1201
  className: "h-3 w-3",
1086
1202
  "aria-hidden": !0
1087
1203
  }), "Yes"]
1088
1204
  }) : /* @__PURE__ */ Q("span", {
1089
1205
  className: "inline-flex items-center gap-1 self-start rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-500/30 dark:text-amber-400",
1090
- children: [/* @__PURE__ */ Z(nt, {
1206
+ children: [/* @__PURE__ */ Z(rt, {
1091
1207
  className: "h-3 w-3",
1092
1208
  "aria-hidden": !0
1093
1209
  }), "No"]
1094
1210
  }) : /* @__PURE__ */ Z("span", {
1095
1211
  title: typeof n == "string" ? n : void 0,
1096
- className: W("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
1212
+ className: G("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
1097
1213
  children: /* @__PURE__ */ Z(l, {
1098
1214
  value: n,
1099
1215
  field: c
@@ -1106,7 +1222,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
1106
1222
  };
1107
1223
  //#endregion
1108
1224
  //#region src/RecordComments.tsx
1109
- function Zt(e) {
1225
+ function an(e) {
1110
1226
  try {
1111
1227
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
1112
1228
  if (r < 1) return "just now";
@@ -1119,7 +1235,7 @@ function Zt(e) {
1119
1235
  return e;
1120
1236
  }
1121
1237
  }
1122
- var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
1238
+ var on = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
1123
1239
  let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
1124
1240
  let e = s.trim();
1125
1241
  if (!(!e || !t)) {
@@ -1137,7 +1253,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1137
1253
  return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
1138
1254
  }) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
1139
1255
  return /* @__PURE__ */ Q(S, {
1140
- className: W("", a),
1256
+ className: G("", a),
1141
1257
  children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
1142
1258
  className: "flex items-center gap-2 text-base",
1143
1259
  children: [
@@ -1160,7 +1276,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1160
1276
  children: /* @__PURE__ */ Q("div", {
1161
1277
  className: "relative flex-1",
1162
1278
  children: [
1163
- /* @__PURE__ */ Z(Xe, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
1279
+ /* @__PURE__ */ Z(Ze, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
1164
1280
  /* @__PURE__ */ Z("input", {
1165
1281
  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",
1166
1282
  placeholder: o("detail.searchComments"),
@@ -1173,7 +1289,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1173
1289
  onClick: () => f(""),
1174
1290
  "aria-label": o("detail.clearSearch"),
1175
1291
  type: "button",
1176
- children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
1292
+ children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
1177
1293
  })
1178
1294
  ]
1179
1295
  })
@@ -1193,7 +1309,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1193
1309
  onClick: p,
1194
1310
  disabled: !s.trim() || l,
1195
1311
  className: "shrink-0 self-end",
1196
- children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
1312
+ children: /* @__PURE__ */ Z(Qe, { className: "h-4 w-4" })
1197
1313
  })]
1198
1314
  }),
1199
1315
  h.length === 0 ? /* @__PURE__ */ Z("p", {
@@ -1202,7 +1318,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1202
1318
  }) : /* @__PURE__ */ Z("div", {
1203
1319
  className: "space-y-3",
1204
1320
  children: h.map((e) => /* @__PURE__ */ Q("div", {
1205
- className: W("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1321
+ className: G("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1206
1322
  children: [/* @__PURE__ */ Z("div", {
1207
1323
  className: "shrink-0",
1208
1324
  children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
@@ -1225,11 +1341,11 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1225
1341
  }),
1226
1342
  /* @__PURE__ */ Z("span", {
1227
1343
  className: "text-xs text-muted-foreground",
1228
- children: Zt(e.createdAt)
1344
+ children: an(e.createdAt)
1229
1345
  }),
1230
1346
  e.pinned && /* @__PURE__ */ Q("span", {
1231
1347
  className: "text-xs text-amber-600 flex items-center gap-0.5",
1232
- children: [/* @__PURE__ */ Z(Ge, { className: "h-3 w-3" }), o("detail.pinned")]
1348
+ children: [/* @__PURE__ */ Z(Ke, { className: "h-3 w-3" }), o("detail.pinned")]
1233
1349
  })
1234
1350
  ]
1235
1351
  }),
@@ -1242,7 +1358,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1242
1358
  className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
1243
1359
  onClick: () => n(e.id),
1244
1360
  "aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
1245
- children: [/* @__PURE__ */ Z(Ge, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
1361
+ children: [/* @__PURE__ */ Z(Ke, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
1246
1362
  })
1247
1363
  ]
1248
1364
  })]
@@ -1251,20 +1367,20 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
1251
1367
  ]
1252
1368
  })]
1253
1369
  });
1254
- }, $t = {
1255
- field_change: Ee,
1256
- create: qe,
1257
- delete: et,
1370
+ }, sn = {
1371
+ field_change: Te,
1372
+ create: Je,
1373
+ delete: tt,
1258
1374
  comment: ze,
1259
- status_change: de
1260
- }, en = {
1375
+ status_change: le
1376
+ }, cn = {
1261
1377
  field_change: "bg-blue-100 text-blue-600",
1262
1378
  create: "bg-green-100 text-green-600",
1263
1379
  delete: "bg-red-100 text-red-600",
1264
1380
  comment: "bg-purple-100 text-purple-600",
1265
1381
  status_change: "bg-amber-100 text-amber-600"
1266
1382
  };
1267
- function tn(e) {
1383
+ function ln(e) {
1268
1384
  try {
1269
1385
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
1270
1386
  if (r < 1) return "just now";
@@ -1277,24 +1393,24 @@ function tn(e) {
1277
1393
  return e;
1278
1394
  }
1279
1395
  }
1280
- function nn(e) {
1396
+ function un(e) {
1281
1397
  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";
1282
1398
  }
1283
- var rn = {
1399
+ var dn = {
1284
1400
  all: "All",
1285
1401
  field_change: "Field Changes",
1286
1402
  create: "Creates",
1287
1403
  delete: "Deletes",
1288
1404
  comment: "Comments",
1289
1405
  status_change: "Status Changes"
1290
- }, an = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
1406
+ }, fn = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
1291
1407
  let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
1292
1408
  return /* @__PURE__ */ Q(S, {
1293
- className: W("", r),
1409
+ className: G("", r),
1294
1410
  children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
1295
1411
  className: "flex items-center gap-2 text-base",
1296
1412
  children: [
1297
- /* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
1413
+ /* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
1298
1414
  "Activity",
1299
1415
  /* @__PURE__ */ Q("span", {
1300
1416
  className: "text-sm font-normal text-muted-foreground",
@@ -1309,12 +1425,12 @@ var rn = {
1309
1425
  className: "flex flex-wrap gap-1.5 mb-4",
1310
1426
  role: "group",
1311
1427
  "aria-label": "Activity type filter",
1312
- children: Object.keys(rn).map((e) => /* @__PURE__ */ Q("button", {
1428
+ children: Object.keys(dn).map((e) => /* @__PURE__ */ Q("button", {
1313
1429
  type: "button",
1314
- className: W("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
1430
+ className: G("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
1315
1431
  onClick: () => o(e),
1316
1432
  "aria-pressed": a === e,
1317
- children: [e !== "all" && i.createElement($t[e] || Ee, { className: "h-3 w-3" }), rn[e]]
1433
+ children: [e !== "all" && i.createElement(sn[e] || Te, { className: "h-3 w-3" }), dn[e]]
1318
1434
  }, e))
1319
1435
  }), s.length === 0 ? /* @__PURE__ */ Z(k, {
1320
1436
  title: "No activity recorded",
@@ -1324,11 +1440,11 @@ var rn = {
1324
1440
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
1325
1441
  className: "space-y-4",
1326
1442
  children: s.map((e) => {
1327
- let t = $t[e.type] || Ee;
1443
+ let t = sn[e.type] || Te;
1328
1444
  return /* @__PURE__ */ Q("div", {
1329
1445
  className: "flex gap-3 relative",
1330
1446
  children: [/* @__PURE__ */ Z("div", {
1331
- className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", en[e.type] || "bg-gray-100 text-gray-600"),
1447
+ className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", cn[e.type] || "bg-gray-100 text-gray-600"),
1332
1448
  children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
1333
1449
  }), /* @__PURE__ */ Q("div", {
1334
1450
  className: "flex-1 min-w-0 pt-1",
@@ -1342,12 +1458,12 @@ var rn = {
1342
1458
  " ",
1343
1459
  /* @__PURE__ */ Z("span", {
1344
1460
  className: "text-muted-foreground",
1345
- children: nn(e)
1461
+ children: un(e)
1346
1462
  })
1347
1463
  ]
1348
1464
  }), /* @__PURE__ */ Z("p", {
1349
1465
  className: "text-xs text-muted-foreground mt-0.5",
1350
- children: tn(e.timestamp)
1466
+ children: ln(e.timestamp)
1351
1467
  })]
1352
1468
  })]
1353
1469
  }, e.id);
@@ -1355,7 +1471,7 @@ var rn = {
1355
1471
  })]
1356
1472
  })] })]
1357
1473
  });
1358
- }, on = {
1474
+ }, pn = {
1359
1475
  create: "default",
1360
1476
  update: "secondary",
1361
1477
  delete: "destructive",
@@ -1367,12 +1483,12 @@ var rn = {
1367
1483
  export: "outline",
1368
1484
  import: "outline"
1369
1485
  };
1370
- function sn(e) {
1486
+ function mn(e) {
1371
1487
  if (!e) return "";
1372
1488
  let t = e instanceof Date ? e : new Date(e);
1373
1489
  return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
1374
1490
  }
1375
- var cn = [
1491
+ var hn = [
1376
1492
  [60, "second"],
1377
1493
  [60, "minute"],
1378
1494
  [24, "hour"],
@@ -1381,27 +1497,27 @@ var cn = [
1381
1497
  [12, "month"],
1382
1498
  [Infinity, "year"]
1383
1499
  ];
1384
- function ln(e, t) {
1500
+ function gn(e, t) {
1385
1501
  if (!e) return "";
1386
1502
  let n = e instanceof Date ? e : new Date(e);
1387
1503
  if (Number.isNaN(n.getTime())) return String(e);
1388
1504
  let r = (n.getTime() - Date.now()) / 1e3;
1389
- for (let [n, i] of cn) {
1505
+ for (let [n, i] of hn) {
1390
1506
  if (Math.abs(r) < n) try {
1391
1507
  return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
1392
1508
  } catch {
1393
- return sn(e);
1509
+ return mn(e);
1394
1510
  }
1395
1511
  r /= n;
1396
1512
  }
1397
- return sn(e);
1513
+ return mn(e);
1398
1514
  }
1399
- function un(e) {
1515
+ function _n(e) {
1400
1516
  if (!e) return "?";
1401
1517
  let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
1402
1518
  return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
1403
1519
  }
1404
- function dn(e) {
1520
+ function vn(e) {
1405
1521
  if (e == null || e === "") return "—";
1406
1522
  if (typeof e == "string") return e;
1407
1523
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -1411,25 +1527,25 @@ function dn(e) {
1411
1527
  return String(e);
1412
1528
  }
1413
1529
  }
1414
- function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1530
+ function yn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1415
1531
  return t ? /* @__PURE__ */ Z("div", {
1416
- className: W("space-y-3", r),
1532
+ className: G("space-y-3", r),
1417
1533
  children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
1418
1534
  className: "flex items-start gap-3",
1419
- children: [/* @__PURE__ */ Z(F, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1535
+ children: [/* @__PURE__ */ Z(I, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
1420
1536
  className: "flex-1 space-y-2",
1421
- children: [/* @__PURE__ */ Z(F, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(F, { className: "h-3 w-1/2" })]
1537
+ children: [/* @__PURE__ */ Z(I, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(I, { className: "h-3 w-1/2" })]
1422
1538
  })]
1423
1539
  }, t))
1424
1540
  }) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
1425
- className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1541
+ className: G("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
1426
1542
  children: n ?? "No history yet"
1427
- }) : /* @__PURE__ */ Z(oe, {
1543
+ }) : /* @__PURE__ */ Z(ae, {
1428
1544
  delayDuration: 150,
1429
1545
  children: /* @__PURE__ */ Z("ol", {
1430
- className: W("space-y-4", r),
1546
+ className: G("space-y-4", r),
1431
1547
  children: e.map((e, t) => {
1432
- let n = (e.action ?? "").toLowerCase(), r = on[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = sn(e.created_at), s = ln(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1548
+ let n = (e.action ?? "").toLowerCase(), r = pn[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = mn(e.created_at), s = gn(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
1433
1549
  return /* @__PURE__ */ Q("li", {
1434
1550
  className: "flex items-start gap-3",
1435
1551
  children: [/* @__PURE__ */ Q(_, {
@@ -1439,7 +1555,7 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1439
1555
  alt: a
1440
1556
  }) : null, /* @__PURE__ */ Z(v, {
1441
1557
  className: "text-[10px] font-medium",
1442
- children: un(e.user_name)
1558
+ children: _n(e.user_name)
1443
1559
  })]
1444
1560
  }), /* @__PURE__ */ Q("div", {
1445
1561
  className: "min-w-0 flex-1",
@@ -1456,14 +1572,14 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1456
1572
  className: "text-[10px] uppercase tracking-wide",
1457
1573
  children: e.action
1458
1574
  }),
1459
- o && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
1575
+ o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1460
1576
  asChild: !0,
1461
1577
  children: /* @__PURE__ */ Z("span", {
1462
1578
  className: "text-xs text-muted-foreground cursor-help",
1463
1579
  "aria-label": o,
1464
1580
  children: s || o
1465
1581
  })
1466
- }), /* @__PURE__ */ Z(V, { children: o })] })
1582
+ }), /* @__PURE__ */ Z(H, { children: o })] })
1467
1583
  ]
1468
1584
  }),
1469
1585
  e.summary && /* @__PURE__ */ Z("p", {
@@ -1490,7 +1606,7 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1490
1606
  ": ",
1491
1607
  /* @__PURE__ */ Z("span", {
1492
1608
  className: "text-foreground",
1493
- children: dn(e.to)
1609
+ children: vn(e.to)
1494
1610
  })
1495
1611
  ]
1496
1612
  }, e.field))
@@ -1507,12 +1623,12 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1507
1623
  ": ",
1508
1624
  /* @__PURE__ */ Z("span", {
1509
1625
  className: "line-through opacity-70",
1510
- children: dn(e.from)
1626
+ children: vn(e.from)
1511
1627
  }),
1512
1628
  " → ",
1513
1629
  /* @__PURE__ */ Z("span", {
1514
1630
  className: "text-foreground",
1515
- children: dn(e.to)
1631
+ children: vn(e.to)
1516
1632
  })
1517
1633
  ]
1518
1634
  }, e.field))
@@ -1526,13 +1642,13 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
1526
1642
  }
1527
1643
  //#endregion
1528
1644
  //#region src/RecordMetaFooter.tsx
1529
- var pn = {
1645
+ var bn = {
1530
1646
  createdAt: "created_at",
1531
1647
  createdBy: "created_by",
1532
1648
  updatedAt: "updated_at",
1533
1649
  updatedBy: "updated_by"
1534
1650
  };
1535
- function mn(e) {
1651
+ function xn(e) {
1536
1652
  if (!e) return null;
1537
1653
  if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
1538
1654
  if (typeof e == "string" || typeof e == "number") {
@@ -1541,7 +1657,7 @@ function mn(e) {
1541
1657
  }
1542
1658
  return null;
1543
1659
  }
1544
- function hn(e, t) {
1660
+ function Sn(e, t) {
1545
1661
  let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
1546
1662
  if (r < 60) return t("detail.justNow");
1547
1663
  let i = Math.floor(r / 60);
@@ -1549,7 +1665,7 @@ function hn(e, t) {
1549
1665
  let a = Math.floor(i / 60);
1550
1666
  return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
1551
1667
  }
1552
- function gn(e) {
1668
+ function Cn(e) {
1553
1669
  try {
1554
1670
  return new Intl.DateTimeFormat(void 0, {
1555
1671
  dateStyle: "medium",
@@ -1559,16 +1675,16 @@ function gn(e) {
1559
1675
  return e.toISOString();
1560
1676
  }
1561
1677
  }
1562
- var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1678
+ var wn = ({ value: e, objectSchema: t, fieldName: n }) => {
1563
1679
  if (e == null || e === "") return null;
1564
1680
  let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
1565
1681
  name: n,
1566
1682
  type: r?.type || (i ? "lookup" : "text"),
1567
1683
  ...i && { reference_to: i },
1568
1684
  ...r?.reference_field && { reference_field: r.reference_field }
1569
- }, o = Et(a) || a.type;
1685
+ }, o = kt(a) || a.type;
1570
1686
  if (o) {
1571
- let t = wt(o);
1687
+ let t = Et(o);
1572
1688
  if (t) return /* @__PURE__ */ Z("span", {
1573
1689
  className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
1574
1690
  children: /* @__PURE__ */ Z(t, {
@@ -1578,20 +1694,20 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1578
1694
  });
1579
1695
  }
1580
1696
  return /* @__PURE__ */ Z("span", { children: String(e) });
1581
- }, vn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1697
+ }, Tn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
1582
1698
  if (!t && !n) return null;
1583
- let o = n ? /* @__PURE__ */ Z(oe, {
1699
+ let o = n ? /* @__PURE__ */ Z(ae, {
1584
1700
  delayDuration: 200,
1585
- children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
1701
+ children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1586
1702
  asChild: !0,
1587
1703
  children: /* @__PURE__ */ Z("time", {
1588
1704
  dateTime: n.toISOString(),
1589
1705
  className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
1590
- children: hn(n, a)
1706
+ children: Sn(n, a)
1591
1707
  })
1592
- }), /* @__PURE__ */ Z(V, {
1708
+ }), /* @__PURE__ */ Z(H, {
1593
1709
  side: "top",
1594
- children: gn(n)
1710
+ children: Cn(n)
1595
1711
  })] })
1596
1712
  }) : null;
1597
1713
  return /* @__PURE__ */ Q("span", {
@@ -1601,7 +1717,7 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1601
1717
  className: "text-muted-foreground/70",
1602
1718
  children: e
1603
1719
  }),
1604
- t ? /* @__PURE__ */ Z(_n, {
1720
+ t ? /* @__PURE__ */ Z(wn, {
1605
1721
  value: t,
1606
1722
  objectSchema: r,
1607
1723
  fieldName: i
@@ -1613,31 +1729,31 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
1613
1729
  o
1614
1730
  ]
1615
1731
  });
1616
- }, yn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1732
+ }, En = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
1617
1733
  let { t: i } = $();
1618
1734
  if (!e) return null;
1619
- let a = mn(e[pn.createdAt]), o = mn(e[pn.updatedAt]), s = e[pn.createdBy], c = e[pn.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
1735
+ let a = xn(e[bn.createdAt]), o = xn(e[bn.updatedAt]), s = e[bn.createdBy], c = e[bn.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));
1620
1736
  return !l && !d ? null : /* @__PURE__ */ Q("div", {
1621
- className: W("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
1737
+ className: G("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
1622
1738
  "data-testid": "record-meta-footer",
1623
- children: [l && /* @__PURE__ */ Z(vn, {
1739
+ children: [l && /* @__PURE__ */ Z(Tn, {
1624
1740
  label: i("detail.createdBy"),
1625
1741
  user: s,
1626
1742
  date: a,
1627
1743
  objectSchema: t,
1628
- userField: pn.createdBy,
1744
+ userField: bn.createdBy,
1629
1745
  t: i
1630
- }), d && /* @__PURE__ */ Z(vn, {
1746
+ }), d && /* @__PURE__ */ Z(Tn, {
1631
1747
  label: i("detail.updatedBy"),
1632
1748
  user: c,
1633
1749
  date: o,
1634
1750
  objectSchema: t,
1635
- userField: pn.updatedBy,
1751
+ userField: bn.updatedBy,
1636
1752
  t: i
1637
1753
  })]
1638
1754
  });
1639
- }, bn = 5;
1640
- function xn(e, t, i, a) {
1755
+ }, Dn = 5;
1756
+ function On(e, t, i, a) {
1641
1757
  if (e && typeof e == "object") {
1642
1758
  if (t.primaryField) {
1643
1759
  let n = e[t.primaryField];
@@ -1657,8 +1773,8 @@ function xn(e, t, i, a) {
1657
1773
  }
1658
1774
  return a;
1659
1775
  }
1660
- var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
1661
- let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, P] = i.useState(null), [ee, te] = i.useState(!1), [ne, re] = i.useState(0), ie = lt(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [ae, U] = i.useState(!1), { t: G } = $(), { currency: ce } = jt(), { fieldOptionLabel: ue } = _t(), de = se(), fe = kt(), K = i.useMemo(() => {
1776
+ var kn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
1777
+ let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, P] = i.useState(null), [F, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0), W = ut(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [se, K] = i.useState(!1), { t: q } = $(), { currency: le } = It(), { fieldOptionLabel: ue } = vt(), de = oe(), fe = Pt(), J = i.useMemo(() => {
1662
1778
  if (!fe?.isLoaded || !e.objectName) return e;
1663
1779
  let t = (t) => fe.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
1664
1780
  let n = typeof e == "string" ? e : e?.name;
@@ -1678,10 +1794,10 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1678
1794
  g && p && p(g);
1679
1795
  }, [g, p]);
1680
1796
  let pe = i.useMemo(() => {
1681
- if (K.summaryFields && K.summaryFields.length > 0) return [];
1682
- let e = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []], t = {};
1797
+ if (J.summaryFields && J.summaryFields.length > 0) return [];
1798
+ let e = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []], t = {};
1683
1799
  for (let n of e) t[n.name] || (t[n.name] = n);
1684
- if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
1800
+ if (F?.fields) for (let [e, n] of Object.entries(F.fields)) t[e] = {
1685
1801
  ...t[e] || {},
1686
1802
  ...n,
1687
1803
  name: e
@@ -1698,29 +1814,29 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1698
1814
  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));
1699
1815
  return o && !r.includes(o) && r.push(o), r;
1700
1816
  }, [
1701
- K.summaryFields,
1702
- K.sections,
1703
- K.fields,
1704
- N,
1817
+ J.summaryFields,
1818
+ J.sections,
1819
+ J.fields,
1820
+ F,
1705
1821
  g
1706
- ]), q = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : pe, me = i.useCallback(() => {
1707
- K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
1708
- te(!0), setTimeout(() => te(!1), 1500);
1822
+ ]), me = J.summaryFields && J.summaryFields.length > 0 ? J.summaryFields : pe, ge = i.useCallback(() => {
1823
+ J.resourceId && navigator.clipboard.writeText(String(J.resourceId)).then(() => {
1824
+ ne(!0), setTimeout(() => ne(!1), 1500);
1709
1825
  });
1710
- }, [K.resourceId]);
1826
+ }, [J.resourceId]);
1711
1827
  i.useEffect(() => {
1712
1828
  let e = !0;
1713
- if (K.data) return _(K.data), y(!1), n?.getObjectSchema && K.objectName && n.getObjectSchema(K.objectName).then((t) => {
1714
- e && P(t);
1829
+ if (J.data) return _(J.data), y(!1), n?.getObjectSchema && J.objectName && n.getObjectSchema(J.objectName).then((t) => {
1830
+ e && ee(t);
1715
1831
  }).catch(() => {}), () => {
1716
1832
  e = !1;
1717
1833
  };
1718
- if (n && K.objectName && K.resourceId) {
1719
- y(!0), P(null), _(null);
1720
- let r = K.objectName, i = K.resourceId, a = `${r}-`, o = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []];
1834
+ if (n && J.objectName && J.resourceId) {
1835
+ y(!0), ee(null), _(null);
1836
+ let r = J.objectName, i = J.resourceId, a = `${r}-`, o = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []];
1721
1837
  (n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
1722
1838
  if (!e) return;
1723
- P(s);
1839
+ ee(s);
1724
1840
  let c = t(s?.fields, o), l = c.length > 0 ? { $expand: c } : void 0, u = l ? n.findOne(r, i, l) : n.findOne(r, i), d = () => {
1725
1841
  let t = String(i), o = t.startsWith(a) ? t.slice(a.length) : `${a}${t}`;
1726
1842
  return (l ? n.findOne(r, o, l) : n.findOne(r, o)).then((t) => {
@@ -1741,7 +1857,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1741
1857
  }).catch((t) => {
1742
1858
  e && (console.error("Failed to fetch detail data:", t), y(!1));
1743
1859
  });
1744
- } else K.api && K.resourceId && (y(!0), fetch(`${K.api}/${K.resourceId}`).then((e) => e.json()).then((t) => {
1860
+ } else J.api && J.resourceId && (y(!0), fetch(`${J.api}/${J.resourceId}`).then((e) => e.json()).then((t) => {
1745
1861
  e && _(t?.data || t);
1746
1862
  }).catch((e) => {
1747
1863
  console.error("Failed to fetch detail data:", e);
@@ -1752,72 +1868,72 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1752
1868
  e = !1;
1753
1869
  };
1754
1870
  }, [
1755
- K.api,
1756
- K.resourceId,
1757
- K.objectName,
1871
+ J.api,
1872
+ J.resourceId,
1873
+ J.objectName,
1758
1874
  n,
1759
- K.sections,
1760
- K.fields,
1761
- ne,
1762
- ie
1875
+ J.sections,
1876
+ J.fields,
1877
+ re,
1878
+ W
1763
1879
  ]);
1764
- let he = i.useCallback(() => {
1880
+ let _e = i.useCallback(() => {
1765
1881
  if (s) s();
1766
- else if (K.onNavigate) {
1767
- let e = K.backUrl || (K.objectName ? `/${K.objectName}` : "/");
1768
- K.onNavigate(e, { replace: !0 });
1769
- } else K.backUrl ? window.location.href = K.backUrl : window.history.back();
1770
- }, [s, K]), _e = i.useCallback(() => {
1771
- a ? a() : K.onNavigate && K.editUrl ? K.onNavigate(K.editUrl) : K.onNavigate && K.objectName && K.resourceId ? K.onNavigate(`/${K.objectName}/${K.resourceId}/edit`) : K.editUrl && (window.location.href = K.editUrl);
1772
- }, [a, K]), ve = i.useCallback(async () => {
1773
- if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
1774
- M(G("detail.cancelApprovalUnavailable"));
1882
+ else if (J.onNavigate) {
1883
+ let e = J.backUrl || (J.objectName ? `/${J.objectName}` : "/");
1884
+ J.onNavigate(e, { replace: !0 });
1885
+ } else J.backUrl ? window.location.href = J.backUrl : window.history.back();
1886
+ }, [s, J]), be = i.useCallback(() => {
1887
+ a ? a() : J.onNavigate && J.editUrl ? J.onNavigate(J.editUrl) : J.onNavigate && J.objectName && J.resourceId ? J.onNavigate(`/${J.objectName}/${J.resourceId}/edit`) : J.editUrl && (window.location.href = J.editUrl);
1888
+ }, [a, J]), xe = i.useCallback(async () => {
1889
+ if (!n?.cancelPendingApproval || !J.objectName || !J.resourceId) {
1890
+ M(q("detail.cancelApprovalUnavailable"));
1775
1891
  return;
1776
1892
  }
1777
- U(!0), M(null);
1893
+ K(!0), M(null);
1778
1894
  try {
1779
- if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
1780
- let e = await n.findOne(String(K.objectName), String(K.resourceId));
1895
+ if (await n.cancelPendingApproval(String(J.objectName), String(J.resourceId)), n.findOne) try {
1896
+ let e = await n.findOne(String(J.objectName), String(J.resourceId));
1781
1897
  e && _(e);
1782
1898
  } catch {}
1783
- re((e) => e + 1);
1899
+ ie((e) => e + 1);
1784
1900
  try {
1785
1901
  window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
1786
- objectName: String(K.objectName),
1787
- recordId: String(K.resourceId),
1902
+ objectName: String(J.objectName),
1903
+ recordId: String(J.resourceId),
1788
1904
  reason: "approval-recalled"
1789
1905
  } }));
1790
1906
  } catch {}
1791
1907
  } catch (e) {
1792
1908
  let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
1793
- M(`${G("detail.cancelApprovalFailed")}: ${t}`);
1909
+ M(`${q("detail.cancelApprovalFailed")}: ${t}`);
1794
1910
  } finally {
1795
- U(!1);
1911
+ K(!1);
1796
1912
  }
1797
1913
  }, [
1798
1914
  n,
1799
- K.objectName,
1800
- K.resourceId,
1801
- G
1802
- ]), xe = i.useCallback(() => {
1803
- let e = K.deleteConfirmation || G("detail.deleteConfirmation");
1804
- window.confirm(e) && (o?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
1805
- }, [o, K]), Se = i.useCallback(() => {
1806
- navigator.share && K.objectName && K.resourceId ? navigator.share({
1807
- title: K.title || G("detail.details"),
1808
- text: `${K.objectName} #${K.resourceId}`,
1915
+ J.objectName,
1916
+ J.resourceId,
1917
+ q
1918
+ ]), Se = i.useCallback(() => {
1919
+ let e = J.deleteConfirmation || q("detail.deleteConfirmation");
1920
+ window.confirm(e) && (o?.(), J.onNavigate && J.objectName && J.onNavigate(`/${J.objectName}`, { replace: !0 }));
1921
+ }, [o, J]), Ce = i.useCallback(() => {
1922
+ navigator.share && J.objectName && J.resourceId ? navigator.share({
1923
+ title: J.title || q("detail.details"),
1924
+ text: `${J.objectName} #${J.resourceId}`,
1809
1925
  url: window.location.href
1810
1926
  }).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
1811
1927
  console.log("Link copied to clipboard");
1812
1928
  });
1813
- }, [K]), Ce = i.useCallback(() => {
1929
+ }, [J]), Ee = i.useCallback(() => {
1814
1930
  let e = !w;
1815
1931
  h && h(e), m === void 0 && C(e);
1816
1932
  }, [
1817
1933
  w,
1818
1934
  m,
1819
1935
  h
1820
- ]), we = i.useCallback(async () => {
1936
+ ]), De = i.useCallback(async () => {
1821
1937
  if (T) {
1822
1938
  let e = Object.entries(D);
1823
1939
  if (e.length > 0) {
@@ -1828,7 +1944,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1828
1944
  _(n), M(null), A(!0);
1829
1945
  try {
1830
1946
  if (l) for (let [t, r] of e) await l(t, r, n);
1831
- O({}), E(!1);
1947
+ O({}), E(!1), P(null);
1832
1948
  } catch (e) {
1833
1949
  _(t);
1834
1950
  let n = (e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
@@ -1846,79 +1962,71 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1846
1962
  D,
1847
1963
  g,
1848
1964
  l
1849
- ]), De = i.useCallback(() => {
1850
- O({}), E(!1), M(null);
1851
- }, []), J = i.useCallback((e, t) => {
1965
+ ]), Oe = i.useCallback(() => {
1966
+ O({}), E(!1), M(null), P(null);
1967
+ }, []), ke = i.useCallback((e, t) => {
1852
1968
  O((n) => ({
1853
1969
  ...n,
1854
1970
  [e]: t
1855
1971
  }));
1972
+ }, []), Y = i.useCallback((e) => {
1973
+ P(e), E(!0), M(null);
1856
1974
  }, []);
1857
1975
  i.useEffect(() => {
1858
- if (!K.recordNavigation) return;
1859
- let e = K.recordNavigation, t = (t) => {
1976
+ if (!J.recordNavigation) return;
1977
+ let e = J.recordNavigation, t = (t) => {
1860
1978
  let n = t.target?.tagName;
1861
1979
  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])));
1862
1980
  };
1863
1981
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1864
- }, [K.recordNavigation]), i.useEffect(() => {
1865
- if (!c || K.showHeader !== !1) return;
1982
+ }, [J.recordNavigation]), i.useEffect(() => {
1983
+ if (!c || J.showHeader !== !1) return;
1866
1984
  let e = "objectui:record:inline-edit-toggle", t = (e) => {
1867
1985
  let t = e.detail;
1868
- t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName || we();
1986
+ t?.recordId && J.recordId && t.recordId !== J.recordId || t?.objectName && J.objectName && t.objectName !== J.objectName || De();
1869
1987
  };
1870
1988
  return window.addEventListener(e, t), () => window.removeEventListener(e, t);
1871
1989
  }, [
1872
1990
  c,
1873
- K.showHeader,
1874
- K.recordId,
1875
- K.objectName,
1876
- we
1991
+ J.showHeader,
1992
+ J.recordId,
1993
+ J.objectName,
1994
+ De
1877
1995
  ]);
1878
- let Oe = i.useMemo(() => K.related ?? [], [K.related]), ke = i.useMemo(() => {
1996
+ let Ae = i.useMemo(() => J.related ?? [], [J.related]), je = i.useMemo(() => {
1879
1997
  let e = [];
1880
1998
  return e.push({
1881
1999
  name: "sys_share",
1882
- label: G("detail.share"),
2000
+ label: q("detail.share"),
1883
2001
  icon: "share-2",
1884
2002
  type: "script",
1885
- onClick: Se
1886
- }), K.showEdit && e.push({
2003
+ onClick: Ce
2004
+ }), J.showEdit && e.push({
1887
2005
  name: "sys_edit_mobile",
1888
- label: G("detail.edit"),
1889
- icon: "edit",
1890
- type: "script",
1891
- className: "sm:hidden",
1892
- onClick: _e
1893
- }), c && e.push({
1894
- name: "sys_toggle_inline_edit_mobile",
1895
- label: G(T ? "detail.save" : "detail.editInline"),
2006
+ label: q("detail.edit"),
1896
2007
  icon: "edit",
1897
2008
  type: "script",
1898
2009
  className: "sm:hidden",
1899
- onClick: we
1900
- }), K.showDelete && e.push({
2010
+ onClick: be
2011
+ }), J.showDelete && e.push({
1901
2012
  name: "sys_delete",
1902
- label: G("detail.delete"),
2013
+ label: q("detail.delete"),
1903
2014
  icon: "trash-2",
1904
2015
  type: "script",
1905
2016
  variant: "destructive",
1906
2017
  tags: ["separator-before"],
1907
- onClick: xe
2018
+ onClick: Se
1908
2019
  }), e;
1909
2020
  }, [
1910
- G,
1911
- K.showEdit,
1912
- K.showDelete,
1913
- c,
1914
- T,
1915
- Se,
1916
- _e,
1917
- we,
1918
- xe
1919
- ]), Y = i.useMemo(() => {
1920
- let e = K.actions ?? [];
1921
- if (ke.length === 0) return e;
2021
+ q,
2022
+ J.showEdit,
2023
+ J.showDelete,
2024
+ Ce,
2025
+ be,
2026
+ Se
2027
+ ]), Me = i.useMemo(() => {
2028
+ let e = J.actions ?? [];
2029
+ if (je.length === 0) return e;
1922
2030
  let t = !1, n = e.map((e) => {
1923
2031
  let n = e;
1924
2032
  if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
@@ -1926,7 +2034,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1926
2034
  let e = Array.isArray(n.systemActions) ? n.systemActions : [];
1927
2035
  return {
1928
2036
  ...n,
1929
- systemActions: [...e, ...ke]
2037
+ systemActions: [...e, ...je]
1930
2038
  };
1931
2039
  }
1932
2040
  return e;
@@ -1934,72 +2042,72 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
1934
2042
  return t || n.push({
1935
2043
  type: "action:bar",
1936
2044
  location: "record_header",
1937
- systemActions: ke
2045
+ systemActions: je
1938
2046
  }), n;
1939
- }, [K.actions, ke]);
1940
- return v || K.loading ? /* @__PURE__ */ Q("div", {
1941
- className: W("space-y-4", r),
2047
+ }, [J.actions, je]);
2048
+ return v || J.loading ? /* @__PURE__ */ Q("div", {
2049
+ className: G("space-y-4", r),
1942
2050
  children: [
1943
- /* @__PURE__ */ Z(F, { className: "h-10 w-full" }),
1944
- /* @__PURE__ */ Z(F, { className: "h-64 w-full" }),
1945
- /* @__PURE__ */ Z(F, { className: "h-48 w-full" })
2051
+ /* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
2052
+ /* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
2053
+ /* @__PURE__ */ Z(I, { className: "h-48 w-full" })
1946
2054
  ]
1947
- }) : !g && !K.data ? /* @__PURE__ */ Q("div", {
1948
- className: W("flex flex-col items-center justify-center py-16 text-center", r),
2055
+ }) : !g && !J.data ? /* @__PURE__ */ Q("div", {
2056
+ className: G("flex flex-col items-center justify-center py-16 text-center", r),
1949
2057
  children: [
1950
2058
  /* @__PURE__ */ Z("p", {
1951
2059
  className: "text-lg font-semibold",
1952
- children: G("detail.recordNotFound")
2060
+ children: q("detail.recordNotFound")
1953
2061
  }),
1954
2062
  /* @__PURE__ */ Z("p", {
1955
2063
  className: "text-sm text-muted-foreground mt-1",
1956
- children: G("detail.recordNotFoundDescription")
2064
+ children: q("detail.recordNotFoundDescription")
1957
2065
  }),
1958
- (K.showBack ?? !0) && /* @__PURE__ */ Q(x, {
2066
+ (J.showBack ?? !0) && /* @__PURE__ */ Q(x, {
1959
2067
  variant: "outline",
1960
2068
  size: "sm",
1961
- onClick: he,
2069
+ onClick: _e,
1962
2070
  className: "mt-4 gap-2",
1963
- children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }), G("detail.goBack")]
2071
+ children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), q("detail.goBack")]
1964
2072
  })
1965
2073
  ]
1966
- }) : /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q("div", {
1967
- className: W("space-y-6", r),
2074
+ }) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
2075
+ className: G("space-y-6", r),
1968
2076
  children: [
1969
- K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
2077
+ J.showHeader !== !1 && /* @__PURE__ */ Q("div", {
1970
2078
  className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
1971
2079
  children: [/* @__PURE__ */ Q("div", {
1972
2080
  className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
1973
- children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2081
+ children: [(J.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
1974
2082
  asChild: !0,
1975
2083
  children: /* @__PURE__ */ Z(x, {
1976
2084
  variant: "ghost",
1977
2085
  size: "icon",
1978
- onClick: he,
2086
+ onClick: _e,
1979
2087
  className: "shrink-0 mt-1",
1980
- children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
2088
+ children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
1981
2089
  })
1982
- }), /* @__PURE__ */ Z(V, { children: G("detail.back") })] }), /* @__PURE__ */ Q("div", {
2090
+ }), /* @__PURE__ */ Z(H, { children: q("detail.back") })] }), /* @__PURE__ */ Q("div", {
1983
2091
  className: "flex-1 min-w-0",
1984
2092
  children: [/* @__PURE__ */ Q("div", {
1985
2093
  className: "flex items-center gap-2 flex-wrap",
1986
2094
  children: [
1987
2095
  /* @__PURE__ */ Z("h1", {
1988
2096
  className: "text-xl sm:text-2xl font-bold truncate",
1989
- children: xn(g, K, N, G("detail.details"))
2097
+ children: On(g, J, F, q("detail.details"))
1990
2098
  }),
1991
- q.map((e) => {
2099
+ me.map((e) => {
1992
2100
  let t = g?.[e];
1993
2101
  if (t == null || t === "") return null;
1994
- let n = (K.sections || []).flatMap((e) => e.fields).concat(K.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
2102
+ let n = (J.sections || []).flatMap((e) => e.fields).concat(J.fields || []).find((t) => t.name === e), r = F?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
1995
2103
  try {
1996
2104
  if (i === "currency") {
1997
2105
  let e = Number(t);
1998
2106
  if (!Number.isNaN(e)) {
1999
- let t = At({
2107
+ let t = Ft({
2000
2108
  ...r,
2001
2109
  ...n
2002
- }, ce);
2110
+ }, le);
2003
2111
  a = t ? new Intl.NumberFormat(void 0, {
2004
2112
  style: "currency",
2005
2113
  currency: t,
@@ -2028,7 +2136,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2028
2136
  let e = i[String(t)];
2029
2137
  e?.label && (o = e.label);
2030
2138
  }
2031
- a = K.objectName ? ue(K.objectName, e, String(t), o) : o;
2139
+ a = J.objectName ? ue(J.objectName, e, String(t), o) : o;
2032
2140
  }
2033
2141
  } catch {}
2034
2142
  return o === null ? /* @__PURE__ */ Z(b, {
@@ -2050,173 +2158,173 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2050
2158
  }), a]
2051
2159
  }, e);
2052
2160
  }),
2053
- /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2161
+ /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2054
2162
  asChild: !0,
2055
2163
  children: /* @__PURE__ */ Z(x, {
2056
2164
  variant: "ghost",
2057
2165
  size: "icon",
2058
2166
  className: "h-6 w-6 shrink-0",
2059
- onClick: Ce,
2060
- "aria-label": G(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2061
- children: w ? /* @__PURE__ */ Z($e, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z($e, { className: "h-4 w-4 text-muted-foreground" })
2167
+ onClick: Ee,
2168
+ "aria-label": q(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
2169
+ children: w ? /* @__PURE__ */ Z(et, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(et, { className: "h-4 w-4 text-muted-foreground" })
2062
2170
  })
2063
- }), /* @__PURE__ */ Z(V, { children: G(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2171
+ }), /* @__PURE__ */ Z(H, { children: q(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
2064
2172
  ]
2065
- }), K.objectName && /* @__PURE__ */ Q("p", {
2173
+ }), J.objectName && /* @__PURE__ */ Q("p", {
2066
2174
  className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
2067
2175
  children: [/* @__PURE__ */ Z("span", {
2068
2176
  className: "font-medium",
2069
- children: f || K.objectName
2070
- }), K.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2177
+ children: f || J.objectName
2178
+ }), J.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2071
2179
  asChild: !0,
2072
2180
  children: /* @__PURE__ */ Z(x, {
2073
2181
  variant: "ghost",
2074
2182
  size: "icon",
2075
2183
  className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
2076
- onClick: me,
2077
- "aria-label": G("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2078
- children: ee ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
2184
+ onClick: ge,
2185
+ "aria-label": q("detail.copyRecordId", { defaultValue: "Copy record ID" }),
2186
+ children: te ? /* @__PURE__ */ Z(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(we, { className: "h-3 w-3" })
2079
2187
  })
2080
- }), /* @__PURE__ */ Z(V, { children: ee ? G("detail.copied", { defaultValue: "Copied" }) : G("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2188
+ }), /* @__PURE__ */ Z(H, { children: te ? q("detail.copied", { defaultValue: "Copied" }) : q("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
2081
2189
  })]
2082
2190
  })]
2083
2191
  }), /* @__PURE__ */ Q("div", {
2084
2192
  className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
2085
2193
  children: [
2086
- K.recordNavigation && /* @__PURE__ */ Q("div", {
2194
+ J.recordNavigation && /* @__PURE__ */ Q("div", {
2087
2195
  className: "flex items-center gap-1 mr-2",
2088
2196
  children: [
2089
- /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2197
+ /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2090
2198
  asChild: !0,
2091
2199
  children: /* @__PURE__ */ Z(x, {
2092
2200
  variant: "outline",
2093
2201
  size: "icon",
2094
2202
  className: "h-8 w-8",
2095
- disabled: K.recordNavigation.currentIndex <= 0,
2203
+ disabled: J.recordNavigation.currentIndex <= 0,
2096
2204
  onClick: () => {
2097
- let e = K.recordNavigation;
2205
+ let e = J.recordNavigation;
2098
2206
  e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
2099
2207
  },
2100
- children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
2208
+ children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
2101
2209
  })
2102
- }), /* @__PURE__ */ Z(V, { children: G("detail.previousRecord") })] }),
2210
+ }), /* @__PURE__ */ Z(H, { children: q("detail.previousRecord") })] }),
2103
2211
  /* @__PURE__ */ Z("span", {
2104
2212
  className: "text-xs text-muted-foreground whitespace-nowrap px-1",
2105
- children: G("detail.recordOf", {
2106
- current: K.recordNavigation.currentIndex + 1,
2107
- total: K.recordNavigation.recordIds.length
2213
+ children: q("detail.recordOf", {
2214
+ current: J.recordNavigation.currentIndex + 1,
2215
+ total: J.recordNavigation.recordIds.length
2108
2216
  })
2109
2217
  }),
2110
- /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2218
+ /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2111
2219
  asChild: !0,
2112
2220
  children: /* @__PURE__ */ Z(x, {
2113
2221
  variant: "outline",
2114
2222
  size: "icon",
2115
2223
  className: "h-8 w-8",
2116
- disabled: K.recordNavigation.currentIndex >= K.recordNavigation.recordIds.length - 1,
2224
+ disabled: J.recordNavigation.currentIndex >= J.recordNavigation.recordIds.length - 1,
2117
2225
  onClick: () => {
2118
- let e = K.recordNavigation;
2226
+ let e = J.recordNavigation;
2119
2227
  e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
2120
2228
  },
2121
- children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
2229
+ children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
2122
2230
  })
2123
- }), /* @__PURE__ */ Z(V, { children: G("detail.nextRecord") })] })
2231
+ }), /* @__PURE__ */ Z(H, { children: q("detail.nextRecord") })] })
2124
2232
  ]
2125
2233
  }),
2126
- c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2234
+ c && T && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2127
2235
  asChild: !0,
2128
2236
  children: /* @__PURE__ */ Q(x, {
2129
2237
  variant: "ghost",
2130
2238
  size: "sm",
2131
- onClick: De,
2239
+ onClick: Oe,
2132
2240
  className: "gap-2 hidden sm:inline-flex",
2133
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2241
+ children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2134
2242
  className: "hidden sm:inline",
2135
- children: G("detail.cancel")
2243
+ children: q("detail.cancel")
2136
2244
  })]
2137
2245
  })
2138
- }), /* @__PURE__ */ Z(V, { children: G("detail.cancelEdit") })] }), /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2246
+ }), /* @__PURE__ */ Z(H, { children: q("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2139
2247
  asChild: !0,
2140
2248
  children: /* @__PURE__ */ Z(x, {
2141
2249
  variant: T ? "default" : "outline",
2142
2250
  size: "sm",
2143
- onClick: we,
2251
+ onClick: De,
2144
2252
  className: "gap-2 hidden sm:inline-flex",
2145
- children: T ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2253
+ children: T ? /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2146
2254
  className: "hidden sm:inline",
2147
- children: G("detail.save")
2148
- })] }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2255
+ children: q("detail.save")
2256
+ })] }) : /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2149
2257
  className: "hidden sm:inline",
2150
- children: G("detail.editInline")
2258
+ children: q("detail.editInline")
2151
2259
  })] })
2152
2260
  })
2153
- }), /* @__PURE__ */ Z(V, { children: G(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2154
- K.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
2261
+ }), /* @__PURE__ */ Z(H, { children: q(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
2262
+ J.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
2155
2263
  asChild: !0,
2156
2264
  children: /* @__PURE__ */ Q(x, {
2157
2265
  variant: "default",
2158
- onClick: _e,
2266
+ onClick: be,
2159
2267
  className: "gap-2 hidden sm:inline-flex",
2160
- children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2268
+ children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
2161
2269
  className: "hidden sm:inline",
2162
- children: G("detail.edit")
2270
+ children: q("detail.edit")
2163
2271
  })]
2164
2272
  })
2165
- }), /* @__PURE__ */ Z(V, { children: G("detail.editRecord") })] }),
2166
- Y.map((e, t) => /* @__PURE__ */ Z(at, {
2273
+ }), /* @__PURE__ */ Z(H, { children: q("detail.editRecord") })] }),
2274
+ Me.map((e, t) => /* @__PURE__ */ Z(ot, {
2167
2275
  schema: e,
2168
2276
  data: g
2169
2277
  }, `header-action-${t}`))
2170
2278
  ]
2171
2279
  })]
2172
2280
  }),
2173
- K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2174
- schema: K.header,
2281
+ J.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(ot, {
2282
+ schema: J.header,
2175
2283
  data: g
2176
2284
  }) }),
2177
- K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
2178
- fields: K.highlightFields,
2285
+ J.highlightFields && J.highlightFields.length > 0 && /* @__PURE__ */ Z(rn, {
2286
+ fields: J.highlightFields,
2179
2287
  data: g,
2180
- objectName: K.objectName,
2181
- objectSchema: N
2288
+ objectName: J.objectName,
2289
+ objectSchema: F
2182
2290
  }),
2183
- c && K.showHeader === !1 && (() => {
2291
+ c && J.showHeader === !1 && (() => {
2184
2292
  let e = g?.approval_status, t = e === "pending" || e === "in_approval";
2185
2293
  return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
2186
2294
  className: "flex flex-col items-end gap-1",
2187
2295
  children: [/* @__PURE__ */ Q("div", {
2188
2296
  className: "flex items-center justify-end gap-2",
2189
2297
  children: [
2190
- t && !T && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("span", {
2298
+ t && !T && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q("span", {
2191
2299
  role: "status",
2192
2300
  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",
2193
- title: G("detail.lockedTooltip"),
2194
- children: [/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: G("detail.lockedByApproval") })]
2301
+ title: q("detail.lockedTooltip"),
2302
+ children: [/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: q("detail.lockedByApproval") })]
2195
2303
  }), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
2196
2304
  variant: "outline",
2197
2305
  size: "sm",
2198
- onClick: ve,
2199
- disabled: ae,
2306
+ onClick: xe,
2307
+ disabled: se,
2200
2308
  className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
2201
- title: G("detail.cancelApprovalTooltip"),
2202
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(ae ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2309
+ title: q("detail.cancelApprovalTooltip"),
2310
+ children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q(se ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
2203
2311
  })] }),
2204
2312
  T && /* @__PURE__ */ Q(x, {
2205
2313
  variant: "ghost",
2206
2314
  size: "sm",
2207
- onClick: De,
2315
+ onClick: Oe,
2208
2316
  className: "gap-2",
2209
2317
  disabled: k,
2210
- children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G("detail.cancel") })]
2318
+ children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q("detail.cancel") })]
2211
2319
  }),
2212
2320
  /* @__PURE__ */ Q(x, {
2213
2321
  variant: T ? "default" : "outline",
2214
2322
  size: "sm",
2215
- onClick: we,
2323
+ onClick: De,
2216
2324
  className: "gap-2",
2217
2325
  disabled: k || t && !T,
2218
- title: t && !T ? G("detail.lockedTooltip") : void 0,
2219
- children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2326
+ title: t && !T ? q("detail.lockedTooltip") : void 0,
2327
+ children: [Z(T ? he : Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
2220
2328
  })
2221
2329
  ]
2222
2330
  }), j && /* @__PURE__ */ Z("div", {
@@ -2226,131 +2334,137 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2226
2334
  })]
2227
2335
  });
2228
2336
  })(),
2229
- K.autoTabs && !K.tabs?.length ? (() => {
2230
- let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a = [
2337
+ J.autoTabs && !J.tabs?.length ? (() => {
2338
+ let e = Ae.length > 0, t = !!J.activities && J.activities.length > 0, r = !!u, i = !!J.history, a = [
2231
2339
  "details",
2232
2340
  ...e ? ["related"] : [],
2233
2341
  ...t ? ["activity"] : [],
2234
2342
  ...r ? ["discussion"] : [],
2235
2343
  ...i ? ["history"] : []
2236
- ], o = K.defaultTab, s = o && a.includes(o) ? o : "details", c = K.onTabChange, l = /* @__PURE__ */ Q("div", {
2344
+ ], o = J.defaultTab, s = o && a.includes(o) ? o : "details", l = J.onTabChange, d = /* @__PURE__ */ Q("div", {
2237
2345
  className: "space-y-3 sm:space-y-4",
2238
2346
  children: [
2239
- K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2347
+ J.sectionGroups && J.sectionGroups.length > 0 && J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(nn, {
2240
2348
  group: e,
2241
2349
  data: {
2242
2350
  ...g,
2243
2351
  ...D
2244
2352
  },
2245
- objectSchema: N,
2246
- objectName: K.objectName,
2353
+ objectSchema: F,
2354
+ objectName: J.objectName,
2247
2355
  isEditing: T,
2248
- onFieldChange: J,
2356
+ onFieldChange: ke,
2357
+ onEnterInlineEdit: c ? Y : void 0,
2358
+ autoFocusField: N,
2249
2359
  dataSource: n
2250
2360
  }, t)),
2251
- K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2361
+ J.sections && J.sections.length > 0 && J.sections.map((e, t) => /* @__PURE__ */ Z(Zt, {
2252
2362
  section: e,
2253
2363
  data: {
2254
2364
  ...g,
2255
2365
  ...D
2256
2366
  },
2257
- objectSchema: N,
2258
- objectName: K.objectName,
2367
+ objectSchema: F,
2368
+ objectName: J.objectName,
2259
2369
  isEditing: T,
2260
- onFieldChange: J,
2370
+ onFieldChange: ke,
2371
+ onEnterInlineEdit: c ? Y : void 0,
2372
+ autoFocusField: N,
2261
2373
  dataSource: n
2262
2374
  }, t)),
2263
- K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
2375
+ J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Zt, {
2264
2376
  section: {
2265
- fields: K.fields,
2266
- columns: K.columns
2377
+ fields: J.fields,
2378
+ columns: J.columns
2267
2379
  },
2268
2380
  data: {
2269
2381
  ...g,
2270
2382
  ...D
2271
2383
  },
2272
- objectSchema: N,
2273
- objectName: K.objectName,
2384
+ objectSchema: F,
2385
+ objectName: J.objectName,
2274
2386
  isEditing: T,
2275
- onFieldChange: J,
2387
+ onFieldChange: ke,
2388
+ onEnterInlineEdit: c ? Y : void 0,
2389
+ autoFocusField: N,
2276
2390
  dataSource: n
2277
2391
  }),
2278
- K.comments && /* @__PURE__ */ Z(Qt, {
2279
- comments: K.comments,
2280
- onAddComment: K.onAddComment
2392
+ J.comments && /* @__PURE__ */ Z(on, {
2393
+ comments: J.comments,
2394
+ onAddComment: J.onAddComment
2281
2395
  })
2282
2396
  ]
2283
2397
  });
2284
2398
  return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
2285
2399
  className: "mt-2",
2286
- children: l
2287
- }) : /* @__PURE__ */ Q(I, {
2400
+ children: d
2401
+ }) : /* @__PURE__ */ Q(L, {
2288
2402
  defaultValue: s,
2289
- onValueChange: c,
2403
+ onValueChange: l,
2290
2404
  className: "w-full",
2291
2405
  children: [
2292
- /* @__PURE__ */ Q(R, {
2406
+ /* @__PURE__ */ Q(z, {
2293
2407
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
2294
2408
  children: [
2295
- /* @__PURE__ */ Z(z, {
2409
+ /* @__PURE__ */ Z(B, {
2296
2410
  value: "details",
2297
2411
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2298
- children: G("detail.details")
2412
+ children: q("detail.details")
2299
2413
  }),
2300
- e && /* @__PURE__ */ Z(z, {
2414
+ e && /* @__PURE__ */ Z(B, {
2301
2415
  value: "related",
2302
2416
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2303
2417
  children: /* @__PURE__ */ Q("span", {
2304
2418
  className: "flex items-center gap-1.5",
2305
- children: [G("detail.related"), /* @__PURE__ */ Z(b, {
2419
+ children: [q("detail.related"), /* @__PURE__ */ Z(b, {
2306
2420
  variant: "secondary",
2307
2421
  className: "text-xs bg-primary/10 text-primary border-transparent",
2308
- children: Oe.length
2422
+ children: Ae.length
2309
2423
  })]
2310
2424
  })
2311
2425
  }),
2312
- t && /* @__PURE__ */ Z(z, {
2426
+ t && /* @__PURE__ */ Z(B, {
2313
2427
  value: "activity",
2314
2428
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2315
2429
  children: /* @__PURE__ */ Q("span", {
2316
2430
  className: "flex items-center gap-1.5",
2317
- children: [G("detail.activity"), /* @__PURE__ */ Z(b, {
2431
+ children: [q("detail.activity"), /* @__PURE__ */ Z(b, {
2318
2432
  variant: "secondary",
2319
2433
  className: "text-xs bg-primary/10 text-primary border-transparent",
2320
- children: K.activities.length
2434
+ children: J.activities.length
2321
2435
  })]
2322
2436
  })
2323
2437
  }),
2324
- r && /* @__PURE__ */ Z(z, {
2438
+ r && /* @__PURE__ */ Z(B, {
2325
2439
  value: "discussion",
2326
2440
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2327
- children: G("detail.discussion", { defaultValue: "Discussion" })
2441
+ children: q("detail.discussion", { defaultValue: "Discussion" })
2328
2442
  }),
2329
- i && /* @__PURE__ */ Z(z, {
2443
+ i && /* @__PURE__ */ Z(B, {
2330
2444
  value: "history",
2331
2445
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
2332
2446
  children: /* @__PURE__ */ Q("span", {
2333
2447
  className: "flex items-center gap-1.5",
2334
- children: [G("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2448
+ children: [q("detail.history", { defaultValue: "History" }), !J.history.loading && J.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
2335
2449
  variant: "secondary",
2336
2450
  className: "text-xs bg-primary/10 text-primary border-transparent",
2337
- children: K.history.entries.length
2451
+ children: J.history.entries.length
2338
2452
  })]
2339
2453
  })
2340
2454
  })
2341
2455
  ]
2342
2456
  }),
2343
- /* @__PURE__ */ Z(L, {
2457
+ /* @__PURE__ */ Z(R, {
2344
2458
  value: "details",
2345
2459
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2346
- children: l
2460
+ children: d
2347
2461
  }),
2348
- e && /* @__PURE__ */ Z(L, {
2462
+ e && /* @__PURE__ */ Z(R, {
2349
2463
  value: "related",
2350
2464
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2351
2465
  children: /* @__PURE__ */ Z("div", {
2352
2466
  className: "space-y-3",
2353
- children: Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
2467
+ children: Ae.map((e, t) => /* @__PURE__ */ Z(tn, {
2354
2468
  title: e.title,
2355
2469
  type: e.type,
2356
2470
  api: e.api,
@@ -2367,87 +2481,93 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2367
2481
  onRowDelete: e.onRowDelete,
2368
2482
  collapsible: !0,
2369
2483
  defaultCollapsed: de && t > 0,
2370
- pageSize: bn
2484
+ pageSize: Dn
2371
2485
  }, t))
2372
2486
  })
2373
2487
  }),
2374
- t && /* @__PURE__ */ Z(L, {
2488
+ t && /* @__PURE__ */ Z(R, {
2375
2489
  value: "activity",
2376
2490
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2377
- children: /* @__PURE__ */ Z(an, { activities: K.activities })
2491
+ children: /* @__PURE__ */ Z(fn, { activities: J.activities })
2378
2492
  }),
2379
- r && /* @__PURE__ */ Z(L, {
2493
+ r && /* @__PURE__ */ Z(R, {
2380
2494
  value: "discussion",
2381
2495
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2382
2496
  children: u
2383
2497
  }),
2384
- i && /* @__PURE__ */ Z(L, {
2498
+ i && /* @__PURE__ */ Z(R, {
2385
2499
  value: "history",
2386
2500
  className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
2387
- children: /* @__PURE__ */ Z(fn, {
2388
- entries: K.history.entries,
2389
- loading: K.history.loading,
2390
- emptyText: K.history.emptyText ?? G("detail.historyEmpty", { defaultValue: "No history yet" })
2501
+ children: /* @__PURE__ */ Z(yn, {
2502
+ entries: J.history.entries,
2503
+ loading: J.history.loading,
2504
+ emptyText: J.history.emptyText ?? q("detail.historyEmpty", { defaultValue: "No history yet" })
2391
2505
  })
2392
2506
  })
2393
2507
  ]
2394
2508
  });
2395
- })() : /* @__PURE__ */ Q(Dt, { children: [
2396
- K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2509
+ })() : /* @__PURE__ */ Q(Mt, { children: [
2510
+ J.sectionGroups && J.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
2397
2511
  className: "space-y-3 sm:space-y-4",
2398
- children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
2512
+ children: J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(nn, {
2399
2513
  group: e,
2400
2514
  data: {
2401
2515
  ...g,
2402
2516
  ...D
2403
2517
  },
2404
- objectSchema: N,
2405
- objectName: K.objectName,
2518
+ objectSchema: F,
2519
+ objectName: J.objectName,
2406
2520
  isEditing: T,
2407
- onFieldChange: J,
2521
+ onFieldChange: ke,
2522
+ onEnterInlineEdit: c ? Y : void 0,
2523
+ autoFocusField: N,
2408
2524
  dataSource: n
2409
2525
  }, t))
2410
2526
  }),
2411
- K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
2527
+ J.sections && J.sections.length > 0 && /* @__PURE__ */ Z("div", {
2412
2528
  className: "space-y-3 sm:space-y-4",
2413
- children: K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
2529
+ children: J.sections.map((e, t) => /* @__PURE__ */ Z(Zt, {
2414
2530
  section: e,
2415
2531
  data: {
2416
2532
  ...g,
2417
2533
  ...D
2418
2534
  },
2419
- objectSchema: N,
2420
- objectName: K.objectName,
2535
+ objectSchema: F,
2536
+ objectName: J.objectName,
2421
2537
  isEditing: T,
2422
- onFieldChange: J,
2538
+ onFieldChange: ke,
2539
+ onEnterInlineEdit: c ? Y : void 0,
2540
+ autoFocusField: N,
2423
2541
  dataSource: n
2424
2542
  }, t))
2425
2543
  }),
2426
- K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
2544
+ J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Zt, {
2427
2545
  section: {
2428
- fields: K.fields,
2429
- columns: K.columns
2546
+ fields: J.fields,
2547
+ columns: J.columns
2430
2548
  },
2431
2549
  data: {
2432
2550
  ...g,
2433
2551
  ...D
2434
2552
  },
2435
- objectSchema: N,
2436
- objectName: K.objectName,
2553
+ objectSchema: F,
2554
+ objectName: J.objectName,
2437
2555
  isEditing: T,
2438
- onFieldChange: J,
2556
+ onFieldChange: ke,
2557
+ onEnterInlineEdit: c ? Y : void 0,
2558
+ autoFocusField: N,
2439
2559
  dataSource: n
2440
2560
  }),
2441
- K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
2442
- tabs: K.tabs,
2561
+ J.tabs && J.tabs.length > 0 && /* @__PURE__ */ Z(Qt, {
2562
+ tabs: J.tabs,
2443
2563
  data: g
2444
2564
  }),
2445
- Oe.length > 0 && /* @__PURE__ */ Q("div", {
2565
+ Ae.length > 0 && /* @__PURE__ */ Q("div", {
2446
2566
  className: "space-y-3",
2447
2567
  children: [/* @__PURE__ */ Z("h2", {
2448
2568
  className: "text-lg font-semibold",
2449
- children: G("detail.related")
2450
- }), Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
2569
+ children: q("detail.related")
2570
+ }), Ae.map((e, t) => /* @__PURE__ */ Z(tn, {
2451
2571
  title: e.title,
2452
2572
  type: e.type,
2453
2573
  api: e.api,
@@ -2464,30 +2584,30 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2464
2584
  onRowDelete: e.onRowDelete,
2465
2585
  collapsible: !0,
2466
2586
  defaultCollapsed: de && t > 0,
2467
- pageSize: bn
2587
+ pageSize: Dn
2468
2588
  }, t))]
2469
2589
  }),
2470
- K.comments && /* @__PURE__ */ Z(Qt, {
2471
- comments: K.comments,
2472
- onAddComment: K.onAddComment
2590
+ J.comments && /* @__PURE__ */ Z(on, {
2591
+ comments: J.comments,
2592
+ onAddComment: J.onAddComment
2473
2593
  }),
2474
- K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: K.activities })
2594
+ J.activities && J.activities.length > 0 && /* @__PURE__ */ Z(fn, { activities: J.activities })
2475
2595
  ] }),
2476
- /* @__PURE__ */ Z(yn, {
2596
+ /* @__PURE__ */ Z(En, {
2477
2597
  data: {
2478
2598
  ...g,
2479
2599
  ...D
2480
2600
  },
2481
- objectSchema: N,
2482
- objectName: K.objectName
2601
+ objectSchema: F,
2602
+ objectName: J.objectName
2483
2603
  }),
2484
- K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
2485
- schema: K.footer,
2604
+ J.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(ot, {
2605
+ schema: J.footer,
2486
2606
  data: g
2487
2607
  }) })
2488
2608
  ]
2489
2609
  }) });
2490
- }, Cn = (e) => {
2610
+ }, An = (e) => {
2491
2611
  if (e == null) return "—";
2492
2612
  if (typeof e == "string") return e.length > 0 ? e : "\"\"";
2493
2613
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -2496,7 +2616,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2496
2616
  } catch {
2497
2617
  return String(e);
2498
2618
  }
2499
- }, wn = (e) => {
2619
+ }, jn = (e) => {
2500
2620
  if (typeof e != "string" || e.length === 0) return null;
2501
2621
  let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
2502
2622
  if (Number.isNaN(n.getTime())) return null;
@@ -2505,13 +2625,13 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2505
2625
  } catch {
2506
2626
  return n.toISOString();
2507
2627
  }
2508
- }, Tn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
2509
- let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Cn(t.pendingValue) : "", u = t ? Cn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
2628
+ }, Mn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
2629
+ let { t: o } = $(), s = t?.label || t?.field || "", l = t ? An(t.pendingValue) : "", u = t ? An(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
2510
2630
  let e = [g.updated_by_name, g.updated_by_label];
2511
2631
  for (let t of e) if (typeof t == "string" && t.length > 0) return t;
2512
2632
  let t = g.updated_by;
2513
2633
  return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
2514
- })(), v = wn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
2634
+ })(), v = jn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
2515
2635
  return /* @__PURE__ */ Z(c, {
2516
2636
  open: e,
2517
2637
  onOpenChange: (e) => {
@@ -2525,7 +2645,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2525
2645
  children: [/* @__PURE__ */ Z("span", {
2526
2646
  className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
2527
2647
  "aria-hidden": "true",
2528
- children: /* @__PURE__ */ Z(ce, { className: "h-5 w-5" })
2648
+ children: /* @__PURE__ */ Z(K, { className: "h-5 w-5" })
2529
2649
  }), /* @__PURE__ */ Q("div", {
2530
2650
  className: "flex-1",
2531
2651
  children: [/* @__PURE__ */ Z(h, { children: o("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(f, {
@@ -2580,14 +2700,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2580
2700
  type: "button",
2581
2701
  disabled: a,
2582
2702
  onClick: i,
2583
- className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
2703
+ className: G(W({ variant: "ghost" }), "mt-2 sm:mt-0"),
2584
2704
  children: o("detail.concurrentUpdateCancel")
2585
2705
  }),
2586
2706
  /* @__PURE__ */ Z("button", {
2587
2707
  type: "button",
2588
2708
  disabled: a,
2589
2709
  onClick: r,
2590
- className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
2710
+ className: G(W({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
2591
2711
  children: o("detail.concurrentUpdateOverwrite")
2592
2712
  }),
2593
2713
  /* @__PURE__ */ Z("button", {
@@ -2595,7 +2715,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2595
2715
  disabled: a,
2596
2716
  onClick: n,
2597
2717
  autoFocus: !0,
2598
- className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
2718
+ className: G(W({ variant: "default" }), "mt-2 sm:mt-0"),
2599
2719
  children: o("detail.concurrentUpdateReload")
2600
2720
  })
2601
2721
  ]
@@ -2604,14 +2724,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
2604
2724
  })
2605
2725
  });
2606
2726
  };
2607
- function En(e) {
2727
+ function Nn(e) {
2608
2728
  if (!e || typeof e != "object") return !1;
2609
2729
  let t = e;
2610
2730
  return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
2611
2731
  }
2612
2732
  //#endregion
2613
2733
  //#region src/renderers/record-details.tsx
2614
- var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, On = (e) => {
2734
+ var Pn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Fn = (e) => {
2615
2735
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2616
2736
  return {
2617
2737
  designer: {
@@ -2621,8 +2741,8 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2621
2741
  },
2622
2742
  rest: i
2623
2743
  };
2624
- }, kn = ({ schema: e = {}, className: t, ...n }) => {
2625
- let r = mt(), { designer: i } = On(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), { sectionLabel: l } = _t(), u = dt(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
2744
+ }, In = ({ schema: e = {}, className: t, ...n }) => {
2745
+ let r = ht(), { designer: i } = Fn(n), o = r?.objectName || "", s = Pt(), { readableFields: c } = Nt(o), { sectionLabel: l } = vt(), u = ft(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
2626
2746
  let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
2627
2747
  for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
2628
2748
  }, [e.fields, e.sections]), g = a.useCallback(async (e, t) => {
@@ -2639,7 +2759,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2639
2759
  }
2640
2760
  typeof r?.refresh == "function" && await r.refresh();
2641
2761
  } catch (n) {
2642
- if (En(n)) {
2762
+ if (Nn(n)) {
2643
2763
  let r = n.currentRecord ?? null;
2644
2764
  throw f({
2645
2765
  field: e,
@@ -2717,15 +2837,15 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2717
2837
  });
2718
2838
  let x = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", S = e.enforceFieldSecurity === !0, C = Array.isArray(e.redactFields) ? e.redactFields : [], w = (e) => {
2719
2839
  if (!e || !S && C.length === 0) return e;
2720
- let t = e.map(Dn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
2840
+ let t = e.map(Pn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
2721
2841
  return e.filter((e) => {
2722
- let t = Dn(e);
2842
+ let t = Pn(e);
2723
2843
  return t ? n.has(t) : !0;
2724
2844
  });
2725
2845
  }, T = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
2726
2846
  ...e,
2727
2847
  name: e.field
2728
- } : e, E = (e) => Array.isArray(e) ? e.map(T) : e, D = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Dn(e)).filter((e) => !!e));
2848
+ } : e, E = (e) => Array.isArray(e) ? e.map(T) : e, D = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Pn(e)).filter((e) => !!e));
2729
2849
  for (let e of u) D.add(e);
2730
2850
  let O = r.objectSchema, k = r.data ?? {}, A = [
2731
2851
  O?.primaryField,
@@ -2741,7 +2861,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2741
2861
  break;
2742
2862
  }
2743
2863
  let j = (e) => !e || D.size === 0 ? e : e.filter((e) => {
2744
- let t = Dn(e);
2864
+ let t = Pn(e);
2745
2865
  return t ? !D.has(t) : !0;
2746
2866
  }), M = j(E(w(e.fields))), N = Array.isArray(e.sections) ? e.sections.map((e) => {
2747
2867
  let t = e.title ?? e.label, n = e.name && o ? l(o, e.name, t ?? e.name) : t;
@@ -2752,7 +2872,11 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2752
2872
  hideEmpty: e.hideEmpty ?? !0,
2753
2873
  fields: j(E(w(e.fields)))
2754
2874
  };
2755
- }) : e.sections, P = e.inlineEdit ?? !0, ee = {
2875
+ }) : e.sections, P = /* @__PURE__ */ new Set([
2876
+ "system",
2877
+ "append-only",
2878
+ "better-auth"
2879
+ ]), F = O?.managedBy, ee = O?.userActions?.edit ?? !(F != null && P.has(F)), te = (e.inlineEdit ?? !0) && ee, ne = {
2756
2880
  type: "detail-view",
2757
2881
  objectName: r.objectName,
2758
2882
  resourceId: r.recordId,
@@ -2763,17 +2887,17 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2763
2887
  fields: M,
2764
2888
  showBack: !1,
2765
2889
  showHeader: e.showHeader ?? !1,
2766
- inlineEdit: P
2890
+ inlineEdit: te
2767
2891
  };
2768
2892
  return /* @__PURE__ */ Q("div", {
2769
2893
  className: t,
2770
2894
  ...i,
2771
- children: [/* @__PURE__ */ Z(Sn, {
2772
- schema: ee,
2895
+ children: [/* @__PURE__ */ Z(kn, {
2896
+ schema: ne,
2773
2897
  dataSource: r.dataSource,
2774
- inlineEdit: P,
2898
+ inlineEdit: te,
2775
2899
  onFieldSave: g
2776
- }), /* @__PURE__ */ Z(Tn, {
2900
+ }), /* @__PURE__ */ Z(Mn, {
2777
2901
  open: !!d,
2778
2902
  conflict: d,
2779
2903
  busy: p,
@@ -2782,7 +2906,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2782
2906
  onOverwrite: y
2783
2907
  })]
2784
2908
  });
2785
- }, An = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, jn = (e) => e?.id ?? e?._id ?? null, Mn = (e) => {
2909
+ }, Ln = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, Rn = (e) => e?.id ?? e?._id ?? null, zn = (e) => {
2786
2910
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2787
2911
  return {
2788
2912
  designer: {
@@ -2792,11 +2916,11 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2792
2916
  },
2793
2917
  rest: i
2794
2918
  };
2795
- }, Nn = ({ schema: e = {}, className: t, ...n }) => {
2796
- let r = mt(), { designer: i } = Mn(n), o = _t(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
2919
+ }, Bn = ({ schema: e = {}, className: t, ...n }) => {
2920
+ let r = ht(), { designer: i } = zn(n), o = vt(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
2797
2921
  name: s,
2798
- label: Tt(s)
2799
- }) : s ? Tt(s) : "", l = e.title || c || "Related";
2922
+ label: Dt(s)
2923
+ }) : s ? Dt(s) : "", l = e.title || c || "Related";
2800
2924
  if (!s) return /* @__PURE__ */ Z("div", {
2801
2925
  className: t,
2802
2926
  ...i,
@@ -2805,17 +2929,17 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2805
2929
  children: "record:related_list — missing objectName"
2806
2930
  })
2807
2931
  });
2808
- let u = kt(), { readableFields: d } = Ot(s), f = gt(), p = a.useMemo(() => f?.resolve({
2932
+ let u = Pt(), { readableFields: d } = Nt(s), f = e.relationshipValueField || "id", p = f === "id" ? r?.recordId ?? null : r?.data?.[f] ?? null, m = _t(), h = a.useMemo(() => m?.resolve({
2809
2933
  objectName: s,
2810
2934
  relationshipField: e.relationshipField,
2811
- parentId: r?.recordId ?? null
2935
+ parentId: p
2812
2936
  }) ?? null, [
2813
- f,
2937
+ m,
2814
2938
  s,
2815
2939
  e.relationshipField,
2816
- r?.recordId
2817
- ]), m = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2818
- if (m.length > 0 && !m.every((e) => u.can(s, e))) return /* @__PURE__ */ Z("div", {
2940
+ p
2941
+ ]), g = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2942
+ if (g.length > 0 && !g.every((e) => u.can(s, e))) return /* @__PURE__ */ Z("div", {
2819
2943
  className: t,
2820
2944
  ...i,
2821
2945
  role: "status",
@@ -2825,51 +2949,51 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2825
2949
  children: "Insufficient permissions to view related list."
2826
2950
  })
2827
2951
  });
2828
- let h = e.enforceFieldSecurity === !0, g = Array.isArray(e.redactFields) ? e.redactFields : [], _ = Array.isArray(e.columns) ? e.columns : [], v = _;
2829
- if (h || g.length > 0) {
2830
- let e = _.map(An).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
2831
- v = _.filter((e) => {
2832
- let n = An(e);
2952
+ let _ = e.enforceFieldSecurity === !0, v = Array.isArray(e.redactFields) ? e.redactFields : [], y = Array.isArray(e.columns) ? e.columns : [], b = y;
2953
+ if (_ || v.length > 0) {
2954
+ let e = y.map(Ln).filter((e) => !!e), t = new Set((_ ? d(e) : e).filter((e) => !v.includes(e)));
2955
+ b = y.filter((e) => {
2956
+ let n = Ln(e);
2833
2957
  return n ? t.has(n) : !0;
2834
2958
  });
2835
2959
  }
2836
2960
  return /* @__PURE__ */ Z("div", {
2837
2961
  className: t,
2838
2962
  ...i,
2839
- children: /* @__PURE__ */ Z(Jt, {
2963
+ children: /* @__PURE__ */ Z(tn, {
2840
2964
  title: l,
2841
2965
  type: "table",
2842
2966
  api: s,
2843
2967
  objectName: s,
2844
2968
  referenceField: e.relationshipField,
2845
- parentId: r?.recordId,
2846
- columns: v,
2969
+ parentId: p,
2970
+ columns: b,
2847
2971
  pageSize: e.limit,
2848
2972
  dataSource: r?.dataSource,
2849
2973
  add: e.add,
2850
- rowActions: p?.rowActions,
2851
- onRowAction: p?.onRowAction,
2852
- toolbarActions: p?.toolbarActions,
2853
- onToolbarAction: p?.onToolbarAction,
2854
- onNew: p?.onCreate,
2855
- onRowClick: p?.onView ? (e) => {
2856
- let t = jn(e);
2857
- t != null && p.onView(t, e);
2974
+ rowActions: h?.rowActions,
2975
+ onRowAction: h?.onRowAction,
2976
+ toolbarActions: h?.toolbarActions,
2977
+ onToolbarAction: h?.onToolbarAction,
2978
+ onNew: h?.onCreate,
2979
+ onRowClick: h?.onView ? (e) => {
2980
+ let t = Rn(e);
2981
+ t != null && h.onView(t, e);
2858
2982
  } : void 0,
2859
- onRowEdit: p?.onEdit ? (e) => {
2860
- let t = jn(e);
2861
- t != null && p.onEdit(t, e);
2983
+ onRowEdit: h?.onEdit ? (e) => {
2984
+ let t = Rn(e);
2985
+ t != null && h.onEdit(t, e);
2862
2986
  } : void 0,
2863
- onRowDelete: p?.onDelete ? (e) => {
2864
- let t = jn(e);
2865
- if (t != null) return p.onDelete(t, e);
2987
+ onRowDelete: h?.onDelete ? (e) => {
2988
+ let t = Rn(e);
2989
+ if (t != null) return h.onDelete(t, e);
2866
2990
  } : e.add && r?.dataSource ? async (e) => {
2867
2991
  let t = e?.id ?? e?._id;
2868
2992
  t != null && await r.dataSource.delete?.(s, String(t));
2869
2993
  } : void 0
2870
2994
  })
2871
2995
  });
2872
- }, Pn = (e) => {
2996
+ }, Vn = (e) => {
2873
2997
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
2874
2998
  return {
2875
2999
  designer: {
@@ -2879,8 +3003,8 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2879
3003
  },
2880
3004
  rest: i
2881
3005
  };
2882
- }, Fn = ({ schema: e = {}, className: t, ...n }) => {
2883
- let r = mt(), { designer: i } = Pn(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
3006
+ }, Hn = ({ schema: e = {}, className: t, ...n }) => {
3007
+ let r = ht(), { designer: i } = Vn(n), o = r?.objectName || "", s = Pt(), { readableFields: c } = Nt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
2884
3008
  if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
2885
3009
  className: t,
2886
3010
  ...i,
@@ -2897,20 +3021,20 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2897
3021
  icon: e?.icon,
2898
3022
  type: e?.type
2899
3023
  }).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)));
2900
- return ht(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
3024
+ return gt(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
2901
3025
  className: t,
2902
3026
  ...i,
2903
- children: /* @__PURE__ */ Z(Xt, {
3027
+ children: /* @__PURE__ */ Z(rn, {
2904
3028
  fields: m,
2905
3029
  data: r?.data,
2906
3030
  objectName: r?.objectName,
2907
3031
  objectSchema: r?.objectSchema
2908
3032
  })
2909
3033
  });
2910
- }, In = ({ change: e, className: t }) => {
3034
+ }, Un = ({ change: e, className: t }) => {
2911
3035
  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));
2912
3036
  return /* @__PURE__ */ Q("div", {
2913
- className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
3037
+ className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
2914
3038
  children: [
2915
3039
  /* @__PURE__ */ Z("span", {
2916
3040
  className: "font-medium text-foreground",
@@ -2920,29 +3044,29 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2920
3044
  className: "text-muted-foreground line-through",
2921
3045
  children: r
2922
3046
  }),
2923
- /* @__PURE__ */ Z(ue, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
3047
+ /* @__PURE__ */ Z(q, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2924
3048
  /* @__PURE__ */ Z("span", {
2925
3049
  className: "text-foreground",
2926
3050
  children: i
2927
3051
  })
2928
3052
  ]
2929
3053
  });
2930
- }, Ln = [
3054
+ }, Wn = [
2931
3055
  "👍",
2932
3056
  "❤️",
2933
3057
  "🎉",
2934
3058
  "😂",
2935
3059
  "😮",
2936
3060
  "😢"
2937
- ], Rn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Ln, className: r }) => {
3061
+ ], Gn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Wn, className: r }) => {
2938
3062
  let [a, o] = i.useState(!1), s = i.useCallback((e) => {
2939
3063
  t?.(e), o(!1);
2940
3064
  }, [t]);
2941
3065
  return /* @__PURE__ */ Q("div", {
2942
- className: W("flex items-center gap-1 flex-wrap", r),
3066
+ className: G("flex items-center gap-1 flex-wrap", r),
2943
3067
  children: [e.map((e) => /* @__PURE__ */ Q("button", {
2944
3068
  type: "button",
2945
- className: W("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
3069
+ className: G("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
2946
3070
  onClick: () => s(e.emoji),
2947
3071
  disabled: !t,
2948
3072
  "aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
@@ -2955,7 +3079,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2955
3079
  className: "h-6 w-6",
2956
3080
  onClick: () => o(!a),
2957
3081
  "aria-label": "Add reaction",
2958
- children: /* @__PURE__ */ Z(Qe, { className: "h-3.5 w-3.5" })
3082
+ children: /* @__PURE__ */ Z($e, { className: "h-3.5 w-3.5" })
2959
3083
  }), a && /* @__PURE__ */ Z("div", {
2960
3084
  className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
2961
3085
  role: "listbox",
@@ -2974,7 +3098,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
2974
3098
  };
2975
3099
  //#endregion
2976
3100
  //#region src/ThreadedReplies.tsx
2977
- function zn(e, t) {
3101
+ function Kn(e, t) {
2978
3102
  try {
2979
3103
  let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
2980
3104
  if (i < 1) return t("detail.justNow");
@@ -2987,7 +3111,7 @@ function zn(e, t) {
2987
3111
  return e;
2988
3112
  }
2989
3113
  }
2990
- var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
3114
+ var qn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
2991
3115
  let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
2992
3116
  let t = l.trim();
2993
3117
  if (!(!t || !n)) {
@@ -3006,7 +3130,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3006
3130
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
3007
3131
  }, [p]);
3008
3132
  return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
3009
- className: W("ml-10 mt-1", a),
3133
+ className: G("ml-10 mt-1", a),
3010
3134
  children: [
3011
3135
  t.length > 0 && /* @__PURE__ */ Q("button", {
3012
3136
  type: "button",
@@ -3014,7 +3138,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3014
3138
  onClick: () => c(!s),
3015
3139
  "aria-expanded": s,
3016
3140
  children: [
3017
- Z(s ? ve : be, { className: "h-3 w-3" }),
3141
+ Z(s ? _e : ye, { className: "h-3 w-3" }),
3018
3142
  /* @__PURE__ */ Z(ze, { className: "h-3 w-3" }),
3019
3143
  /* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
3020
3144
  ]
@@ -3042,7 +3166,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3042
3166
  children: e.actor
3043
3167
  }), /* @__PURE__ */ Z("span", {
3044
3168
  className: "text-[10px] text-muted-foreground",
3045
- children: zn(e.createdAt, o)
3169
+ children: Kn(e.createdAt, o)
3046
3170
  })]
3047
3171
  }), /* @__PURE__ */ Z("p", {
3048
3172
  className: "text-xs whitespace-pre-wrap break-words",
@@ -3067,12 +3191,12 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3067
3191
  onClick: p,
3068
3192
  disabled: !l.trim() || d,
3069
3193
  "aria-label": "Send reply",
3070
- children: /* @__PURE__ */ Z(Ze, { className: "h-3 w-3" })
3194
+ children: /* @__PURE__ */ Z(Qe, { className: "h-3 w-3" })
3071
3195
  })]
3072
3196
  })
3073
3197
  ]
3074
3198
  });
3075
- }, Vn = ({ subscription: e, onToggle: t, className: n }) => {
3199
+ }, Jn = ({ subscription: e, onToggle: t, className: n }) => {
3076
3200
  let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
3077
3201
  if (t) {
3078
3202
  o(!0);
@@ -3086,21 +3210,21 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
3086
3210
  return /* @__PURE__ */ Z(x, {
3087
3211
  variant: "ghost",
3088
3212
  size: "icon",
3089
- className: W("h-8 w-8", n),
3213
+ className: G("h-8 w-8", n),
3090
3214
  onClick: s,
3091
3215
  disabled: a || !t,
3092
3216
  "aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
3093
3217
  title: e.subscribed ? r("detail.subscribedTooltip") : r("detail.unsubscribedTooltip"),
3094
- children: e.subscribed ? /* @__PURE__ */ Z(pe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(q, { className: "h-4 w-4 text-muted-foreground" })
3218
+ children: e.subscribed ? /* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(J, { className: "h-4 w-4 text-muted-foreground" })
3095
3219
  });
3096
3220
  };
3097
3221
  //#endregion
3098
3222
  //#region src/RichTextCommentInput.tsx
3099
- function Hn(e) {
3223
+ function Yn(e) {
3100
3224
  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/>");
3101
3225
  return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
3102
3226
  }
3103
- var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
3227
+ var Xn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
3104
3228
  let { t: u } = $(), [d, f] = i.useState(!1), [p, m] = i.useState(!1), [h, g] = i.useState(""), [_, v] = i.useState(0), y = i.useRef(null), b = i.useMemo(() => {
3105
3229
  if (!h) return r;
3106
3230
  let e = h.toLowerCase();
@@ -3161,7 +3285,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3161
3285
  n
3162
3286
  ]);
3163
3287
  return /* @__PURE__ */ Q("div", {
3164
- className: W("border rounded-md", o),
3288
+ className: G("border rounded-md", o),
3165
3289
  children: [
3166
3290
  /* @__PURE__ */ Q("div", {
3167
3291
  className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
@@ -3173,7 +3297,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3173
3297
  onClick: C,
3174
3298
  disabled: s || d,
3175
3299
  title: u("detail.bold"),
3176
- children: /* @__PURE__ */ Z(me, { className: "h-3.5 w-3.5" })
3300
+ children: /* @__PURE__ */ Z(pe, { className: "h-3.5 w-3.5" })
3177
3301
  }),
3178
3302
  /* @__PURE__ */ Z(x, {
3179
3303
  variant: "ghost",
@@ -3200,7 +3324,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3200
3324
  onClick: E,
3201
3325
  disabled: s || d,
3202
3326
  title: u("detail.inlineCode"),
3203
- children: /* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" })
3327
+ children: /* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5" })
3204
3328
  }),
3205
3329
  /* @__PURE__ */ Z(x, {
3206
3330
  variant: "ghost",
@@ -3209,7 +3333,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3209
3333
  onClick: D,
3210
3334
  disabled: s || d,
3211
3335
  title: u("detail.mentionSomeone"),
3212
- children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
3336
+ children: /* @__PURE__ */ Z(de, { className: "h-3.5 w-3.5" })
3213
3337
  }),
3214
3338
  /* @__PURE__ */ Z("div", { className: "flex-1" }),
3215
3339
  /* @__PURE__ */ Z(x, {
@@ -3218,7 +3342,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3218
3342
  className: "h-7 w-7",
3219
3343
  onClick: () => f(!d),
3220
3344
  title: u(d ? "detail.edit" : "detail.preview"),
3221
- children: Z(d ? Ee : J, { className: "h-3.5 w-3.5" })
3345
+ children: Z(d ? Te : De, { className: "h-3.5 w-3.5" })
3222
3346
  }),
3223
3347
  n && /* @__PURE__ */ Z(x, {
3224
3348
  variant: "ghost",
@@ -3227,7 +3351,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3227
3351
  onClick: n,
3228
3352
  disabled: s || !l && !e.trim(),
3229
3353
  title: u("detail.submitComment"),
3230
- children: /* @__PURE__ */ Z(Ze, { className: "h-3.5 w-3.5" })
3354
+ children: /* @__PURE__ */ Z(Qe, { className: "h-3.5 w-3.5" })
3231
3355
  })
3232
3356
  ]
3233
3357
  }),
@@ -3235,8 +3359,8 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3235
3359
  className: "relative",
3236
3360
  children: d ? /* @__PURE__ */ Z("div", {
3237
3361
  className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
3238
- dangerouslySetInnerHTML: { __html: Hn(e) }
3239
- }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("textarea", {
3362
+ dangerouslySetInnerHTML: { __html: Yn(e) }
3363
+ }) : /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z("textarea", {
3240
3364
  ref: y,
3241
3365
  className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
3242
3366
  placeholder: a ?? u("detail.writeComment"),
@@ -3248,7 +3372,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3248
3372
  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",
3249
3373
  children: b.map((e, t) => /* @__PURE__ */ Q("button", {
3250
3374
  type: "button",
3251
- className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
3375
+ className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
3252
3376
  onMouseDown: (t) => {
3253
3377
  t.preventDefault(), O(e);
3254
3378
  },
@@ -3272,16 +3396,16 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
3272
3396
  };
3273
3397
  //#endregion
3274
3398
  //#region src/CommentAttachment.tsx
3275
- function Wn(e) {
3399
+ function Zn(e) {
3276
3400
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
3277
3401
  }
3278
- function Gn(e) {
3402
+ function Qn(e) {
3279
3403
  return e.startsWith("image/");
3280
3404
  }
3281
- function Kn(e) {
3282
- return Gn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? Ae : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : ke;
3405
+ function $n(e) {
3406
+ return Qn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? Ae : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : ke;
3283
3407
  }
3284
- var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
3408
+ var er = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
3285
3409
  let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
3286
3410
  e.preventDefault(), e.stopPropagation(), c(!0);
3287
3411
  }, []), d = i.useCallback((e) => {
@@ -3292,9 +3416,9 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3292
3416
  t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
3293
3417
  }, [t]);
3294
3418
  return /* @__PURE__ */ Q("div", {
3295
- className: W("space-y-2", r),
3419
+ className: G("space-y-2", r),
3296
3420
  children: [t && !a && /* @__PURE__ */ Q("div", {
3297
- className: W("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
3421
+ className: G("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
3298
3422
  onDragOver: u,
3299
3423
  onDragLeave: d,
3300
3424
  onDrop: f,
@@ -3305,7 +3429,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3305
3429
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
3306
3430
  },
3307
3431
  children: [
3308
- /* @__PURE__ */ Z(tt, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
3432
+ /* @__PURE__ */ Z(nt, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
3309
3433
  /* @__PURE__ */ Z("p", {
3310
3434
  className: "text-xs text-muted-foreground",
3311
3435
  children: o("detail.dropFilesToUpload")
@@ -3326,7 +3450,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3326
3450
  }), /* @__PURE__ */ Z("div", {
3327
3451
  className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
3328
3452
  children: e.map((e) => {
3329
- let t = Gn(e.type), r = Kn(e.type);
3453
+ let t = Qn(e.type), r = $n(e.type);
3330
3454
  return /* @__PURE__ */ Q("div", {
3331
3455
  className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
3332
3456
  children: [
@@ -3345,7 +3469,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3345
3469
  children: e.name
3346
3470
  }), /* @__PURE__ */ Z("p", {
3347
3471
  className: "text-[10px] text-muted-foreground",
3348
- children: Wn(e.size)
3472
+ children: Zn(e.size)
3349
3473
  })]
3350
3474
  }),
3351
3475
  n && !a && /* @__PURE__ */ Z(x, {
@@ -3354,7 +3478,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3354
3478
  className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
3355
3479
  onClick: () => n(e.id),
3356
3480
  title: o("detail.removeAttachment"),
3357
- children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
3481
+ children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
3358
3482
  })
3359
3483
  ]
3360
3484
  }, e.id);
@@ -3362,15 +3486,15 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3362
3486
  })]
3363
3487
  })]
3364
3488
  });
3365
- }, Jn = {
3489
+ }, tr = {
3366
3490
  comment: ze,
3367
- field_change: Ee,
3368
- task: _e,
3369
- event: he,
3370
- system: rt,
3491
+ field_change: Te,
3492
+ task: ge,
3493
+ event: me,
3494
+ system: it,
3371
3495
  email: Re,
3372
- call: We
3373
- }, Yn = {
3496
+ call: Ge
3497
+ }, nr = {
3374
3498
  comment: "bg-purple-100 text-purple-600",
3375
3499
  field_change: "bg-blue-100 text-blue-600",
3376
3500
  task: "bg-green-100 text-green-600",
@@ -3379,7 +3503,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
3379
3503
  email: "bg-indigo-100 text-indigo-600",
3380
3504
  call: "bg-teal-100 text-teal-600"
3381
3505
  };
3382
- function Xn(e) {
3506
+ function rr(e) {
3383
3507
  return [
3384
3508
  {
3385
3509
  value: "all",
@@ -3399,7 +3523,7 @@ function Xn(e) {
3399
3523
  }
3400
3524
  ];
3401
3525
  }
3402
- function Zn(e, t) {
3526
+ function ir(e, t) {
3403
3527
  try {
3404
3528
  let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
3405
3529
  if (i < 1) return t("detail.justNow");
@@ -3412,7 +3536,7 @@ function Zn(e, t) {
3412
3536
  return e;
3413
3537
  }
3414
3538
  }
3415
- function Qn(e, t) {
3539
+ function ar(e, t) {
3416
3540
  switch (t) {
3417
3541
  case "comments_only": return e.filter((e) => e.type === "comment");
3418
3542
  case "changes_only": return e.filter((e) => e.type === "field_change");
@@ -3420,18 +3544,18 @@ function Qn(e, t) {
3420
3544
  default: return e;
3421
3545
  }
3422
3546
  }
3423
- var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
3424
- let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [ne, re] = i.useState(!1), ie = n ?? b, ae = t?.showFilterToggle !== !1, F = t?.showCommentInput !== !1 && !!c, I = t?.enableReactions ?? !1, L = t?.enableThreading ?? !1, R = t?.showSubscriptionToggle ?? !1, z = i.useMemo(() => Qn(e, ie), [e, ie]), B = i.useMemo(() => L ? z.filter((e) => !e.parentId) : z, [z, L]), V = i.useMemo(() => {
3425
- if (!L) return /* @__PURE__ */ new Map();
3547
+ var or = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
3548
+ let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [te, ne] = i.useState(!1), re = n ?? b, ie = t?.showFilterToggle !== !1, I = t?.showCommentInput !== !1 && !!c, L = t?.enableReactions ?? !1, R = t?.enableThreading ?? !1, z = t?.showSubscriptionToggle ?? !1, B = i.useMemo(() => ar(e, re), [e, re]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
3549
+ if (!R) return /* @__PURE__ */ new Map();
3426
3550
  let e = /* @__PURE__ */ new Map();
3427
- for (let t of z) if (t.parentId) {
3551
+ for (let t of B) if (t.parentId) {
3428
3552
  let n = e.get(t.parentId) ?? [];
3429
3553
  n.push(t), e.set(t.parentId, n);
3430
3554
  }
3431
3555
  return e;
3432
- }, [z, L]), oe = i.useCallback((e) => {
3556
+ }, [B, R]), ae = i.useCallback((e) => {
3433
3557
  r ? r(e) : S(e);
3434
- }, [r]), H = i.useCallback(async () => {
3558
+ }, [r]), U = i.useCallback(async () => {
3435
3559
  let e = C.trim();
3436
3560
  if (c && !(!e && A.length === 0)) {
3437
3561
  E(!0);
@@ -3445,19 +3569,19 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3445
3569
  C,
3446
3570
  A,
3447
3571
  c
3448
- ]), U = i.useCallback(async (e) => {
3572
+ ]), W = i.useCallback(async (e) => {
3449
3573
  if (!(!h || e.length === 0)) {
3450
- re(!0);
3574
+ ne(!0);
3451
3575
  try {
3452
3576
  let t = await h(e);
3453
3577
  Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
3454
3578
  } finally {
3455
- re(!1);
3579
+ ne(!1);
3456
3580
  }
3457
3581
  }
3458
- }, [h]), se = i.useCallback((e) => {
3582
+ }, [h]), oe = i.useCallback((e) => {
3459
3583
  j((t) => t.filter((t) => t.id !== e));
3460
- }, []), ce = i.useCallback(async () => {
3584
+ }, []), K = i.useCallback(async () => {
3461
3585
  if (o) {
3462
3586
  O(!0);
3463
3587
  try {
@@ -3468,7 +3592,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3468
3592
  }
3469
3593
  }, [o]);
3470
3594
  return /* @__PURE__ */ Q("section", {
3471
- className: W("border-t border-border/60 pt-5", v),
3595
+ className: G("border-t border-border/60 pt-5", v),
3472
3596
  "aria-label": "Discussion",
3473
3597
  children: [/* @__PURE__ */ Z("header", {
3474
3598
  className: "mb-4",
@@ -3477,20 +3601,20 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3477
3601
  children: [/* @__PURE__ */ Q("h2", {
3478
3602
  className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
3479
3603
  children: [
3480
- /* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
3604
+ /* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
3481
3605
  g ?? y("detail.activity"),
3482
3606
  /* @__PURE__ */ Q("span", {
3483
3607
  className: "text-sm font-normal text-muted-foreground",
3484
3608
  children: [
3485
3609
  "(",
3486
- z.length,
3610
+ B.length,
3487
3611
  ")"
3488
3612
  ]
3489
3613
  })
3490
3614
  ]
3491
3615
  }), /* @__PURE__ */ Z("div", {
3492
3616
  className: "flex items-center gap-1",
3493
- children: R && d && /* @__PURE__ */ Z(Vn, {
3617
+ children: z && d && /* @__PURE__ */ Z(Jn, {
3494
3618
  subscription: d,
3495
3619
  onToggle: f
3496
3620
  })
@@ -3499,53 +3623,53 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3499
3623
  }), /* @__PURE__ */ Q("div", {
3500
3624
  className: "space-y-4",
3501
3625
  children: [
3502
- ae && /* @__PURE__ */ Z("div", {
3626
+ ie && /* @__PURE__ */ Z("div", {
3503
3627
  className: "flex items-center gap-2",
3504
3628
  children: /* @__PURE__ */ Q(M, {
3505
- value: ie,
3506
- onValueChange: (e) => oe(e),
3507
- children: [/* @__PURE__ */ Z(ee, {
3629
+ value: re,
3630
+ onValueChange: (e) => ae(e),
3631
+ children: [/* @__PURE__ */ Z(F, {
3508
3632
  "aria-label": y("detail.filterActivity"),
3509
3633
  className: "h-8 w-auto min-w-[140px] py-1 text-sm",
3510
- children: /* @__PURE__ */ Z(te, {})
3511
- }), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(P, {
3634
+ children: /* @__PURE__ */ Z(ee, {})
3635
+ }), /* @__PURE__ */ Z(N, { children: rr(y).map((e) => /* @__PURE__ */ Z(P, {
3512
3636
  value: e.value,
3513
3637
  children: e.label
3514
3638
  }, e.value)) })]
3515
3639
  })
3516
3640
  }),
3517
- F && /* @__PURE__ */ Z(Un, {
3641
+ I && /* @__PURE__ */ Z(Xn, {
3518
3642
  value: C,
3519
3643
  onChange: w,
3520
- onSubmit: H,
3644
+ onSubmit: U,
3521
3645
  mentionSuggestions: m,
3522
3646
  placeholder: y("detail.leaveCommentPlaceholder"),
3523
3647
  disabled: T,
3524
3648
  canSubmitEmpty: A.length > 0,
3525
- extraSlot: h ? /* @__PURE__ */ Z(qn, {
3649
+ extraSlot: h ? /* @__PURE__ */ Z(er, {
3526
3650
  attachments: A,
3527
- onUpload: U,
3528
- onRemove: se,
3529
- readOnly: T || ne
3530
- }) : A.length > 0 ? /* @__PURE__ */ Z(qn, {
3651
+ onUpload: W,
3652
+ onRemove: oe,
3653
+ readOnly: T || te
3654
+ }) : A.length > 0 ? /* @__PURE__ */ Z(er, {
3531
3655
  attachments: A,
3532
- onRemove: se,
3656
+ onRemove: oe,
3533
3657
  readOnly: T
3534
3658
  }) : void 0
3535
3659
  }),
3536
- z.length === 0 ? p ? null : /* @__PURE__ */ Z(k, {
3660
+ B.length === 0 ? p ? null : /* @__PURE__ */ Z(k, {
3537
3661
  title: _ ?? y("detail.noActivity"),
3538
3662
  className: "py-6"
3539
3663
  }) : /* @__PURE__ */ Q("div", {
3540
3664
  className: "relative",
3541
3665
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
3542
3666
  className: "space-y-4",
3543
- children: B.map((e) => {
3544
- let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = V.get(e.id) ?? [];
3667
+ children: V.map((e) => {
3668
+ let t = tr[e.type] || it, n = nr[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
3545
3669
  return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
3546
3670
  className: "flex gap-3 relative",
3547
3671
  children: [/* @__PURE__ */ Z("div", {
3548
- className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3672
+ className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3549
3673
  children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
3550
3674
  src: e.actorAvatarUrl,
3551
3675
  alt: e.actor,
@@ -3567,7 +3691,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3567
3691
  }),
3568
3692
  /* @__PURE__ */ Z("span", {
3569
3693
  className: "text-xs text-muted-foreground",
3570
- children: Zn(e.createdAt, y)
3694
+ children: ir(e.createdAt, y)
3571
3695
  }),
3572
3696
  e.edited && /* @__PURE__ */ Z("span", {
3573
3697
  className: "text-xs text-muted-foreground italic",
@@ -3594,25 +3718,25 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3594
3718
  }),
3595
3719
  e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
3596
3720
  className: "space-y-1 mt-1",
3597
- children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(In, { change: e }, t))
3721
+ children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Un, { change: e }, t))
3598
3722
  }),
3599
- I && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3723
+ L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3600
3724
  className: "mt-1.5",
3601
- children: /* @__PURE__ */ Z(Rn, {
3725
+ children: /* @__PURE__ */ Z(Gn, {
3602
3726
  reactions: e.reactions,
3603
3727
  onToggleReaction: u ? (t) => u(e.id, t) : void 0
3604
3728
  })
3605
3729
  }),
3606
- I && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3730
+ L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3607
3731
  className: "mt-1.5",
3608
- children: /* @__PURE__ */ Z(Rn, {
3732
+ children: /* @__PURE__ */ Z(Gn, {
3609
3733
  reactions: [],
3610
3734
  onToggleReaction: (t) => u(e.id, t)
3611
3735
  })
3612
3736
  })
3613
3737
  ]
3614
3738
  })]
3615
- }), L && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
3739
+ }), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(qn, {
3616
3740
  parentItem: e,
3617
3741
  replies: r,
3618
3742
  onAddReply: l,
@@ -3626,16 +3750,16 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3626
3750
  children: /* @__PURE__ */ Q(x, {
3627
3751
  variant: "ghost",
3628
3752
  size: "sm",
3629
- onClick: ce,
3753
+ onClick: K,
3630
3754
  disabled: D,
3631
3755
  "aria-label": y("detail.loadMore"),
3632
- children: [D ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ve, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
3756
+ children: [D ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(_e, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
3633
3757
  })
3634
3758
  })
3635
3759
  ]
3636
3760
  })]
3637
3761
  });
3638
- }, er = (e) => {
3762
+ }, sr = (e) => {
3639
3763
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3640
3764
  return {
3641
3765
  designer: {
@@ -3645,21 +3769,21 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3645
3769
  },
3646
3770
  rest: i
3647
3771
  };
3648
- }, tr = ({ schema: e = {}, className: t, ...n }) => {
3649
- mt();
3650
- let { designer: r } = er(n);
3772
+ }, cr = ({ schema: e = {}, className: t, ...n }) => {
3773
+ ht();
3774
+ let { designer: r } = sr(n);
3651
3775
  return /* @__PURE__ */ Z("div", {
3652
3776
  className: t,
3653
3777
  ...r,
3654
- children: /* @__PURE__ */ Z($n, {
3778
+ children: /* @__PURE__ */ Z(or, {
3655
3779
  items: [],
3656
3780
  config: e
3657
3781
  })
3658
3782
  });
3659
- }, nr = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
3783
+ }, lr = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
3660
3784
  let _ = e?.position ?? "right", v = e?.width ?? "360px", y = e?.collapsible ?? !0, b = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: S } = $(), [C, w] = i.useState(b);
3661
3785
  return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
3662
- className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
3786
+ className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
3663
3787
  children: /* @__PURE__ */ Z(x, {
3664
3788
  variant: "ghost",
3665
3789
  size: "icon",
@@ -3669,7 +3793,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3669
3793
  children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
3670
3794
  })
3671
3795
  }) : /* @__PURE__ */ Q("div", {
3672
- className: W("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
3796
+ className: G("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
3673
3797
  style: {
3674
3798
  width: v,
3675
3799
  minWidth: v
@@ -3688,11 +3812,11 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3688
3812
  className: "h-7 w-7",
3689
3813
  onClick: () => w(!0),
3690
3814
  "aria-label": S("detail.closeDiscussion"),
3691
- children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
3815
+ children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
3692
3816
  })]
3693
3817
  }), /* @__PURE__ */ Z("div", {
3694
3818
  className: "flex-1 overflow-y-auto",
3695
- children: /* @__PURE__ */ Z($n, {
3819
+ children: /* @__PURE__ */ Z(or, {
3696
3820
  items: t,
3697
3821
  config: e?.feed,
3698
3822
  hasMore: n,
@@ -3714,7 +3838,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3714
3838
  })
3715
3839
  })]
3716
3840
  }) : /* @__PURE__ */ Z("div", {
3717
- className: W("", g),
3841
+ className: G("", g),
3718
3842
  children: y && C ? /* @__PURE__ */ Q(x, {
3719
3843
  variant: "ghost",
3720
3844
  className: "w-full justify-start gap-2 text-muted-foreground",
@@ -3734,7 +3858,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3734
3858
  "aria-label": S("detail.hideDiscussion"),
3735
3859
  children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
3736
3860
  })]
3737
- }), /* @__PURE__ */ Z($n, {
3861
+ }), /* @__PURE__ */ Z(or, {
3738
3862
  items: t,
3739
3863
  config: e?.feed,
3740
3864
  hasMore: n,
@@ -3754,7 +3878,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3754
3878
  emptyLabel: S("detail.noCommentsYet")
3755
3879
  })] })
3756
3880
  });
3757
- }, rr = (e) => {
3881
+ }, ur = (e) => {
3758
3882
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3759
3883
  return {
3760
3884
  designer: {
@@ -3764,9 +3888,9 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3764
3888
  },
3765
3889
  rest: i
3766
3890
  };
3767
- }, ir = ({ schema: e = {}, className: t, ...n }) => {
3768
- mt();
3769
- let r = ut(), { designer: i } = rr(n), a = {
3891
+ }, dr = ({ schema: e = {}, className: t, ...n }) => {
3892
+ ht();
3893
+ let r = dt(), { designer: i } = ur(n), a = {
3770
3894
  position: "bottom",
3771
3895
  collapsible: !1,
3772
3896
  feed: {
@@ -3779,7 +3903,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3779
3903
  return /* @__PURE__ */ Z("div", {
3780
3904
  className: t,
3781
3905
  ...i,
3782
- children: /* @__PURE__ */ Z(nr, {
3906
+ children: /* @__PURE__ */ Z(lr, {
3783
3907
  items: r?.items || [],
3784
3908
  config: a,
3785
3909
  onAddComment: r?.onAddComment,
@@ -3789,7 +3913,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3789
3913
  onUploadAttachments: r?.onUploadAttachments
3790
3914
  })
3791
3915
  });
3792
- }, ar = (e) => {
3916
+ }, fr = (e) => {
3793
3917
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3794
3918
  return {
3795
3919
  designer: {
@@ -3799,8 +3923,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3799
3923
  },
3800
3924
  rest: i
3801
3925
  };
3802
- }, or = ({ schema: e = {}, className: t, ...n }) => {
3803
- let r = mt(), { translateOptions: i } = _t(), { designer: o } = ar(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
3926
+ }, pr = ({ schema: e = {}, className: t, ...n }) => {
3927
+ let r = ht(), { translateOptions: i } = vt(), { designer: o } = fr(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
3804
3928
  if (s.length === 0 || !c || !r?.objectName) return s;
3805
3929
  let e = i(r.objectName, c, s);
3806
3930
  return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
@@ -3830,7 +3954,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3830
3954
  });
3831
3955
  let b = h.length - 1;
3832
3956
  return /* @__PURE__ */ Q("div", {
3833
- className: W("w-full", t),
3957
+ className: G("w-full", t),
3834
3958
  ...o,
3835
3959
  children: [/* @__PURE__ */ Q("div", {
3836
3960
  className: "hidden sm:flex w-full items-stretch gap-2",
@@ -3843,7 +3967,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3843
3967
  return /* @__PURE__ */ Z("div", {
3844
3968
  role: "listitem",
3845
3969
  "aria-current": r ? "step" : void 0,
3846
- className: W("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
3970
+ className: G("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
3847
3971
  children: /* @__PURE__ */ Q("span", {
3848
3972
  className: "inline-flex items-center justify-center gap-1.5 truncate",
3849
3973
  children: [
@@ -3870,7 +3994,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3870
3994
  return /* @__PURE__ */ Z("div", {
3871
3995
  role: "listitem",
3872
3996
  "aria-current": n ? "step" : void 0,
3873
- className: W("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
3997
+ className: G("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
3874
3998
  children: /* @__PURE__ */ Q("span", {
3875
3999
  className: "inline-flex items-center gap-1",
3876
4000
  children: [/* @__PURE__ */ Z("span", {
@@ -3891,7 +4015,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3891
4015
  return /* @__PURE__ */ Z("div", {
3892
4016
  role: "listitem",
3893
4017
  "aria-current": i ? "step" : void 0,
3894
- className: W("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
4018
+ className: G("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
3895
4019
  children: /* @__PURE__ */ Q("span", {
3896
4020
  className: "inline-flex items-center gap-1",
3897
4021
  children: [
@@ -3912,7 +4036,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3912
4036
  })
3913
4037
  })]
3914
4038
  });
3915
- }, sr = (e) => {
4039
+ }, mr = (e) => {
3916
4040
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3917
4041
  return {
3918
4042
  designer: {
@@ -3922,8 +4046,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3922
4046
  },
3923
4047
  rest: i
3924
4048
  };
3925
- }, cr = ({ schema: e = {}, className: t, ...n }) => {
3926
- let r = mt(), { designer: i } = sr(n), a = kt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = ft("object", u ? c : null), f = u ? (() => {
4049
+ }, hr = ({ schema: e = {}, className: t, ...n }) => {
4050
+ let r = ht(), { designer: i } = mr(n), a = Pt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = pt("object", u ? c : null), f = u ? (() => {
3927
4051
  let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
3928
4052
  return l.map((e) => t.get(e)).filter((e) => !!e);
3929
4053
  })() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
@@ -3937,7 +4061,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3937
4061
  children: "Insufficient permissions to view quick actions."
3938
4062
  })
3939
4063
  });
3940
- let m = e.location || "record_header", { getActionsForLocation: h, executeAction: g } = st({
4064
+ let m = e.location || "record_header", { getActionsForLocation: h, executeAction: g } = ct({
3941
4065
  actions: f,
3942
4066
  context: {
3943
4067
  record: r?.data,
@@ -3955,11 +4079,11 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3955
4079
  });
3956
4080
  let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
3957
4081
  return /* @__PURE__ */ Z("div", {
3958
- className: W("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
4082
+ className: G("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
3959
4083
  role: "toolbar",
3960
4084
  "aria-label": e.aria?.label || "Quick actions",
3961
4085
  ...i,
3962
- children: _.map((t, n) => /* @__PURE__ */ Z(lr, {
4086
+ children: _.map((t, n) => /* @__PURE__ */ Z(gr, {
3963
4087
  action: t,
3964
4088
  record: r?.data,
3965
4089
  variant: t.variant || e.variant || "default",
@@ -3971,8 +4095,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
3971
4095
  }, t.name || `qa-${n}`))
3972
4096
  });
3973
4097
  };
3974
- function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3975
- let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = ot(e.disabled), d = ct(typeof u == "string" ? u : void 0, l);
4098
+ function gr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
4099
+ let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = st(e.disabled), d = lt(typeof u == "string" ? u : void 0, l);
3976
4100
  return /* @__PURE__ */ Q(x, {
3977
4101
  variant: n,
3978
4102
  size: r,
@@ -3990,7 +4114,7 @@ function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
3990
4114
  }
3991
4115
  //#endregion
3992
4116
  //#region src/renderers/record-history.tsx
3993
- var ur = (e) => {
4117
+ var _r = (e) => {
3994
4118
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
3995
4119
  return {
3996
4120
  designer: {
@@ -4000,14 +4124,14 @@ var ur = (e) => {
4000
4124
  },
4001
4125
  rest: i
4002
4126
  };
4003
- }, dr = /* @__PURE__ */ new Set([
4127
+ }, vr = /* @__PURE__ */ new Set([
4004
4128
  "created",
4005
4129
  "updated",
4006
4130
  "assigned",
4007
4131
  "shared",
4008
4132
  "deleted"
4009
- ]), fr = ({ schema: e = {}, className: t, ...n }) => {
4010
- let { designer: r } = ur(n), i = mt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
4133
+ ]), yr = ({ schema: e = {}, className: t, ...n }) => {
4134
+ let { designer: r } = _r(n), i = ht(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
4011
4135
  a.useEffect(() => {
4012
4136
  if (!p) return;
4013
4137
  let e = !1;
@@ -4020,7 +4144,7 @@ var ur = (e) => {
4020
4144
  $top: Math.max(1, l)
4021
4145
  })).then((t) => {
4022
4146
  if (e) return;
4023
- let n = (t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
4147
+ let n = (t?.data ?? t?.records ?? []).filter((e) => vr.has(e?.type)).map((e) => {
4024
4148
  let t = e.timestamp;
4025
4149
  return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
4026
4150
  id: e.id,
@@ -4050,13 +4174,13 @@ var ur = (e) => {
4050
4174
  return /* @__PURE__ */ Z("div", {
4051
4175
  className: t,
4052
4176
  ...r,
4053
- children: /* @__PURE__ */ Z(fn, {
4177
+ children: /* @__PURE__ */ Z(yn, {
4054
4178
  entries: v,
4055
4179
  loading: y,
4056
4180
  emptyText: c
4057
4181
  })
4058
4182
  });
4059
- }, pr = (e) => {
4183
+ }, br = (e) => {
4060
4184
  let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
4061
4185
  return {
4062
4186
  designer: {
@@ -4066,8 +4190,8 @@ var ur = (e) => {
4066
4190
  },
4067
4191
  rest: i
4068
4192
  };
4069
- }, mr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), hr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", gr = ({ schema: e = {}, className: t, ...n }) => {
4070
- let r = mt(), i = _t(), { t: o } = $(), { designer: s } = pr(n), c = Nt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
4193
+ }, xr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), Sr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", Cr = ({ schema: e = {}, className: t, ...n }) => {
4194
+ let r = ht(), i = vt(), { t: o } = $(), { designer: s } = br(n), c = jt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
4071
4195
  a.useEffect(() => (_.current = !0, () => {
4072
4196
  _.current = !1;
4073
4197
  }), []);
@@ -4147,11 +4271,11 @@ var ur = (e) => {
4147
4271
  return x && t && !t.loading && !t.error && t.total === 0;
4148
4272
  }).map((e) => e.objectName)), k = l.filter((e) => E || !O.has(e.objectName)), A = l.filter((e) => O.has(e.objectName)).map((e) => e.title || (i?.objectLabel ? i.objectLabel({
4149
4273
  name: e.objectName,
4150
- label: mr(e.objectName)
4151
- }) : mr(e.objectName)));
4274
+ label: xr(e.objectName)
4275
+ }) : xr(e.objectName)));
4152
4276
  return /* @__PURE__ */ Q("div", {
4153
4277
  ref: m,
4154
- className: W("flex flex-col gap-3", e.className, t),
4278
+ className: G("flex flex-col gap-3", e.className, t),
4155
4279
  ...s,
4156
4280
  children: [k.map((e) => {
4157
4281
  let t = e.objectName, n = f[t] || {
@@ -4167,15 +4291,15 @@ var ur = (e) => {
4167
4291
  className: "text-sm font-semibold tracking-tight truncate",
4168
4292
  children: e.title || (i?.objectLabel ? i.objectLabel({
4169
4293
  name: e.objectName,
4170
- label: mr(e.objectName)
4171
- }) : mr(e.objectName))
4294
+ label: xr(e.objectName)
4295
+ }) : xr(e.objectName))
4172
4296
  }), /* @__PURE__ */ Q("div", {
4173
4297
  className: "flex items-center gap-2 shrink-0",
4174
4298
  children: [!n.loading && /* @__PURE__ */ Z(b, {
4175
4299
  variant: "secondary",
4176
4300
  className: "tabular-nums",
4177
4301
  children: n.total
4178
- }), c && u && /* @__PURE__ */ Z(Mt, {
4302
+ }), c && u && /* @__PURE__ */ Z(At, {
4179
4303
  to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
4180
4304
  className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
4181
4305
  title: o("detail.viewAll", { defaultValue: "View all" }),
@@ -4187,9 +4311,9 @@ var ur = (e) => {
4187
4311
  children: n.loading ? /* @__PURE__ */ Q("div", {
4188
4312
  className: "space-y-1.5 p-3",
4189
4313
  children: [
4190
- /* @__PURE__ */ Z(F, { className: "h-3.5 w-4/5" }),
4191
- /* @__PURE__ */ Z(F, { className: "h-3.5 w-3/5" }),
4192
- /* @__PURE__ */ Z(F, { className: "h-3.5 w-2/3" })
4314
+ /* @__PURE__ */ Z(I, { className: "h-3.5 w-4/5" }),
4315
+ /* @__PURE__ */ Z(I, { className: "h-3.5 w-3/5" }),
4316
+ /* @__PURE__ */ Z(I, { className: "h-3.5 w-2/3" })
4193
4317
  ]
4194
4318
  }) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
4195
4319
  className: "px-4 py-3 text-xs text-muted-foreground",
@@ -4197,16 +4321,16 @@ var ur = (e) => {
4197
4321
  }) : /* @__PURE__ */ Z("ul", {
4198
4322
  className: "divide-y",
4199
4323
  children: n.items.map((t) => {
4200
- let n = t.id || t._id, r = hr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
4324
+ let n = t.id || t._id, r = Sr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
4201
4325
  return /* @__PURE__ */ Z("li", {
4202
4326
  className: "px-4 py-2",
4203
- children: i ? /* @__PURE__ */ Q(Mt, {
4327
+ children: i ? /* @__PURE__ */ Q(At, {
4204
4328
  to: i,
4205
4329
  className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
4206
4330
  children: [/* @__PURE__ */ Z("span", {
4207
4331
  className: "truncate",
4208
4332
  children: r
4209
- }), /* @__PURE__ */ Z(be, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
4333
+ }), /* @__PURE__ */ Z(ye, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
4210
4334
  }) : /* @__PURE__ */ Z("span", {
4211
4335
  className: "block truncate text-xs text-muted-foreground",
4212
4336
  children: r
@@ -4234,7 +4358,7 @@ var ur = (e) => {
4234
4358
  })]
4235
4359
  })]
4236
4360
  });
4237
- }, _r = {
4361
+ }, wr = {
4238
4362
  info: {
4239
4363
  wrap: "border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300",
4240
4364
  icon: "Info"
@@ -4252,20 +4376,20 @@ var ur = (e) => {
4252
4376
  icon: "CheckCircle2"
4253
4377
  }
4254
4378
  };
4255
- function vr(e) {
4379
+ function Tr(e) {
4256
4380
  let t = e?.properties ?? {};
4257
4381
  return {
4258
4382
  ...e,
4259
4383
  ...t
4260
4384
  };
4261
4385
  }
4262
- var yr = ({ schema: e = {}, className: t }) => {
4263
- let n = vr(e), r = mt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
4386
+ var Er = ({ schema: e = {}, className: t }) => {
4387
+ let n = Tr(e), r = ht(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
4264
4388
  "info",
4265
4389
  "warning",
4266
4390
  "error",
4267
4391
  "success"
4268
- ].includes(n.severity) ? n.severity : "info", d = _r[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
4392
+ ].includes(n.severity) ? n.severity : "info", d = wr[u], f = n.icon || d.icon, p = st(n.visible), m = lt(p, { record: a }), h = i.useMemo(() => {
4269
4393
  if (!n.dismissible) return null;
4270
4394
  let e = n.dismissKey || n.title || u;
4271
4395
  return `os.record-alert:${c}:${l ?? "_"}:${e}`;
@@ -4283,9 +4407,9 @@ var yr = ({ schema: e = {}, className: t }) => {
4283
4407
  } catch {
4284
4408
  return !1;
4285
4409
  }
4286
- }), y = n.action?.actionName, { item: b } = ft("object", y && c ? c : null), S = i.useMemo(() => {
4410
+ }), y = n.action?.actionName, { item: b } = pt("object", y && c ? c : null), S = i.useMemo(() => {
4287
4411
  if (!(!y || !b?.actions)) return b.actions.find((e) => e.name === y);
4288
- }, [y, b]), { executeAction: C } = st({
4412
+ }, [y, b]), { executeAction: C } = ct({
4289
4413
  actions: i.useMemo(() => S ? [S] : [], [S]),
4290
4414
  context: {
4291
4415
  record: a,
@@ -4294,7 +4418,7 @@ var yr = ({ schema: e = {}, className: t }) => {
4294
4418
  }
4295
4419
  });
4296
4420
  return _ || !a || Object.keys(a).length === 0 || p !== void 0 && !m ? null : /* @__PURE__ */ Q(o, {
4297
- className: W("relative pr-12", d.wrap, t),
4421
+ className: G("relative pr-12", d.wrap, t),
4298
4422
  role: u === "error" ? "alert" : "status",
4299
4423
  "aria-live": u === "error" ? "assertive" : "polite",
4300
4424
  children: [
@@ -4332,7 +4456,7 @@ var yr = ({ schema: e = {}, className: t }) => {
4332
4456
  }) : null
4333
4457
  ]
4334
4458
  });
4335
- }, br = /* @__PURE__ */ new Set([
4459
+ }, Dr = /* @__PURE__ */ new Set([
4336
4460
  "id",
4337
4461
  "_id",
4338
4462
  "__v",
@@ -4347,15 +4471,15 @@ var yr = ({ schema: e = {}, className: t }) => {
4347
4471
  "owner_id",
4348
4472
  "deleted_at",
4349
4473
  "is_deleted"
4350
- ]), xr = 480, Sr = 95;
4351
- function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = br, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
4474
+ ]), Or = 480, kr = 95;
4475
+ function Ar({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = Dr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
4352
4476
  let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
4353
4477
  if (typeof window > "u" || !m) return null;
4354
4478
  try {
4355
4479
  let e = window.localStorage.getItem(_);
4356
4480
  if (e) {
4357
4481
  let t = parseInt(e, 10);
4358
- if (Number.isFinite(t) && t >= xr) return t;
4482
+ if (Number.isFinite(t) && t >= Or) return t;
4359
4483
  }
4360
4484
  } catch {}
4361
4485
  return null;
@@ -4377,7 +4501,7 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4377
4501
  let n = (e) => {
4378
4502
  let t = S.current;
4379
4503
  if (!t) return;
4380
- let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * Sr / 100 : 1600, i = Math.min(r, Math.max(xr, t.startWidth + n));
4504
+ let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * kr / 100 : 1600, i = Math.min(r, Math.max(Or, t.startWidth + n));
4381
4505
  y(Math.round(i));
4382
4506
  }, r = () => {
4383
4507
  S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
@@ -4410,12 +4534,12 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4410
4534
  description: t.description
4411
4535
  };
4412
4536
  });
4413
- return /* @__PURE__ */ Z(ne, {
4537
+ return /* @__PURE__ */ Z(te, {
4414
4538
  open: e,
4415
4539
  onOpenChange: (e) => {
4416
4540
  e || t();
4417
4541
  },
4418
- children: /* @__PURE__ */ Q(re, {
4542
+ children: /* @__PURE__ */ Q(ne, {
4419
4543
  side: "right",
4420
4544
  className: "w-full overflow-y-auto p-0 sm:!max-w-none",
4421
4545
  style: x,
@@ -4428,13 +4552,13 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4428
4552
  onPointerDown: C,
4429
4553
  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"
4430
4554
  }),
4431
- /* @__PURE__ */ Z(ie, {
4555
+ /* @__PURE__ */ Z(re, {
4432
4556
  className: "sr-only",
4433
- children: /* @__PURE__ */ Z(ae, { children: n })
4557
+ children: /* @__PURE__ */ Z(ie, { children: n })
4434
4558
  }),
4435
4559
  /* @__PURE__ */ Z("div", {
4436
4560
  className: "px-6 pt-6 pb-6",
4437
- children: /* @__PURE__ */ Z(Sn, {
4561
+ children: /* @__PURE__ */ Z(kn, {
4438
4562
  dataSource: s,
4439
4563
  inlineEdit: !0,
4440
4564
  schema: {
@@ -4477,14 +4601,14 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
4477
4601
  })
4478
4602
  });
4479
4603
  }
4480
- function wr(e, t) {
4604
+ function jr(e, t) {
4481
4605
  if (typeof window > "u") return null;
4482
4606
  let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
4483
4607
  return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
4484
4608
  }
4485
4609
  //#endregion
4486
4610
  //#region src/InlineCreateRelated.tsx
4487
- var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
4611
+ var Mr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
4488
4612
  let [l, u] = i.useState(!1), [d, f] = i.useState("create"), [p, m] = i.useState({}), [h, g] = i.useState(""), [_, v] = i.useState(s), [y, b] = i.useState(!1), [E, D] = i.useState(!1), O = i.useMemo(() => {
4489
4613
  if (!h.trim()) return _;
4490
4614
  let e = h.toLowerCase();
@@ -4531,7 +4655,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4531
4655
  }
4532
4656
  }, [a]), P = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
4533
4657
  return l ? /* @__PURE__ */ Q(S, {
4534
- className: W("", c),
4658
+ className: G("", c),
4535
4659
  children: [/* @__PURE__ */ Z(w, {
4536
4660
  className: "pb-3",
4537
4661
  children: /* @__PURE__ */ Q(T, {
@@ -4545,26 +4669,26 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4545
4669
  size: "icon",
4546
4670
  className: "h-6 w-6",
4547
4671
  onClick: () => u(!1),
4548
- children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
4672
+ children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
4549
4673
  })]
4550
4674
  })
4551
- }), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(I, {
4675
+ }), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(L, {
4552
4676
  value: d,
4553
4677
  onValueChange: f,
4554
4678
  children: [
4555
- /* @__PURE__ */ Q(R, {
4679
+ /* @__PURE__ */ Q(z, {
4556
4680
  className: "mb-3 w-full",
4557
- children: [r && /* @__PURE__ */ Q(z, {
4681
+ children: [r && /* @__PURE__ */ Q(B, {
4558
4682
  value: "create",
4559
4683
  className: "flex-1 gap-1.5",
4560
- children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), "Create New"]
4561
- }), a && /* @__PURE__ */ Q(z, {
4684
+ children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), "Create New"]
4685
+ }), a && /* @__PURE__ */ Q(B, {
4562
4686
  value: "link",
4563
4687
  className: "flex-1 gap-1.5",
4564
4688
  children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
4565
4689
  })]
4566
4690
  }),
4567
- r && /* @__PURE__ */ Q(L, {
4691
+ r && /* @__PURE__ */ Q(R, {
4568
4692
  value: "create",
4569
4693
  className: "space-y-3 mt-0",
4570
4694
  children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
@@ -4595,12 +4719,12 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4595
4719
  })]
4596
4720
  })]
4597
4721
  }),
4598
- a && /* @__PURE__ */ Q(L, {
4722
+ a && /* @__PURE__ */ Q(R, {
4599
4723
  value: "link",
4600
4724
  className: "space-y-3 mt-0",
4601
4725
  children: [/* @__PURE__ */ Q("div", {
4602
4726
  className: "relative",
4603
- children: [/* @__PURE__ */ Z(Xe, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(A, {
4727
+ children: [/* @__PURE__ */ Z(Ze, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(A, {
4604
4728
  placeholder: `Search ${e}…`,
4605
4729
  value: h,
4606
4730
  onChange: (e) => k(e.target.value),
@@ -4632,7 +4756,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4632
4756
  ]
4633
4757
  }) })]
4634
4758
  }) : /* @__PURE__ */ Q("div", {
4635
- className: W("flex gap-2", c),
4759
+ className: G("flex gap-2", c),
4636
4760
  children: [r && /* @__PURE__ */ Q(x, {
4637
4761
  variant: "outline",
4638
4762
  size: "sm",
@@ -4641,7 +4765,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4641
4765
  },
4642
4766
  className: "gap-1.5",
4643
4767
  children: [
4644
- /* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }),
4768
+ /* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }),
4645
4769
  "New ",
4646
4770
  e
4647
4771
  ]
@@ -4658,7 +4782,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
4658
4782
  };
4659
4783
  //#endregion
4660
4784
  //#region src/DiffView.tsx
4661
- function Er(e, t) {
4785
+ function Nr(e, t) {
4662
4786
  if (e == null) return ["(empty)"];
4663
4787
  switch (t) {
4664
4788
  case "json": try {
@@ -4677,7 +4801,7 @@ function Er(e, t) {
4677
4801
  default: return String(e).split("\n");
4678
4802
  }
4679
4803
  }
4680
- function Dr(e, t) {
4804
+ function Pr(e, t) {
4681
4805
  let n = [], r = Math.max(e.length, t.length);
4682
4806
  for (let i = 0; i < r; i++) {
4683
4807
  let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
@@ -4694,16 +4818,16 @@ function Dr(e, t) {
4694
4818
  }
4695
4819
  return n;
4696
4820
  }
4697
- var Or = {
4821
+ var Fr = {
4698
4822
  added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
4699
4823
  removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
4700
4824
  unchanged: "text-muted-foreground"
4701
- }, kr = {
4825
+ }, Ir = {
4702
4826
  added: "+",
4703
4827
  removed: "-",
4704
4828
  unchanged: " "
4705
- }, Ar = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
4706
- let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Er(e, r), [e, r]), d = i.useMemo(() => Er(t, r), [t, r]), f = i.useMemo(() => Dr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
4829
+ }, Lr = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
4830
+ let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Nr(e, r), [e, r]), d = i.useMemo(() => Nr(t, r), [t, r]), f = i.useMemo(() => Pr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
4707
4831
  if (c !== "side-by-side") return [];
4708
4832
  let e = [], t = 0;
4709
4833
  for (; t < f.length;) {
@@ -4729,7 +4853,7 @@ var Or = {
4729
4853
  return e;
4730
4854
  }, [c, f]);
4731
4855
  return /* @__PURE__ */ Q(S, {
4732
- className: W("overflow-hidden", o),
4856
+ className: G("overflow-hidden", o),
4733
4857
  children: [/* @__PURE__ */ Z(w, {
4734
4858
  className: "pb-2",
4735
4859
  children: /* @__PURE__ */ Q(T, {
@@ -4745,14 +4869,14 @@ var Or = {
4745
4869
  className: "h-7 w-7",
4746
4870
  onClick: () => l("unified"),
4747
4871
  title: s("detail.unifiedDiff"),
4748
- children: /* @__PURE__ */ Z(Ye, { className: "h-3.5 w-3.5" })
4872
+ children: /* @__PURE__ */ Z(Xe, { className: "h-3.5 w-3.5" })
4749
4873
  }), /* @__PURE__ */ Z(x, {
4750
4874
  variant: c === "side-by-side" ? "secondary" : "ghost",
4751
4875
  size: "icon",
4752
4876
  className: "h-7 w-7",
4753
4877
  onClick: () => l("side-by-side"),
4754
4878
  title: s("detail.sideBySideDiff"),
4755
- children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
4879
+ children: /* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" })
4756
4880
  })]
4757
4881
  })]
4758
4882
  })
@@ -4761,10 +4885,10 @@ var Or = {
4761
4885
  children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
4762
4886
  className: "font-mono text-xs overflow-x-auto",
4763
4887
  children: f.map((e, t) => /* @__PURE__ */ Q("div", {
4764
- className: W("px-4 py-0.5 whitespace-pre-wrap border-l-2", Or[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
4888
+ className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Fr[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
4765
4889
  children: [/* @__PURE__ */ Z("span", {
4766
4890
  className: "select-none mr-2 inline-block w-3 text-center opacity-60",
4767
- children: kr[e.type]
4891
+ children: Ir[e.type]
4768
4892
  }), e.value]
4769
4893
  }, t))
4770
4894
  }) : /* @__PURE__ */ Z("div", {
@@ -4781,10 +4905,10 @@ var Or = {
4781
4905
  children: s("detail.currentVersion")
4782
4906
  }),
4783
4907
  m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
4784
- className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
4908
+ className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Fr[e.left.type] : "bg-muted/20"),
4785
4909
  children: e.left?.value ?? ""
4786
4910
  }), /* @__PURE__ */ Z("div", {
4787
- className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
4911
+ className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Fr[e.right.type] : "bg-muted/20"),
4788
4912
  children: e.right?.value ?? ""
4789
4913
  })] }, t))
4790
4914
  ]
@@ -4795,7 +4919,7 @@ var Or = {
4795
4919
  })
4796
4920
  })]
4797
4921
  });
4798
- }, jr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
4922
+ }, Rr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
4799
4923
  let { t: s } = $(), [c, l] = i.useState(""), [u, d] = i.useState(!1), f = i.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, g = e < t - 1, _ = i.useCallback(() => {
4800
4924
  p && r(n[0]);
4801
4925
  }, [
@@ -4863,7 +4987,7 @@ var Or = {
4863
4987
  r,
4864
4988
  a
4865
4989
  ]), /* @__PURE__ */ Q("div", {
4866
- className: W("flex items-center gap-1.5", o),
4990
+ className: G("flex items-center gap-1.5", o),
4867
4991
  children: [
4868
4992
  /* @__PURE__ */ Z(x, {
4869
4993
  variant: "outline",
@@ -4872,7 +4996,7 @@ var Or = {
4872
4996
  disabled: !p,
4873
4997
  onClick: _,
4874
4998
  title: s("detail.firstRecord"),
4875
- children: /* @__PURE__ */ Z(xe, { className: "h-4 w-4" })
4999
+ children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
4876
5000
  }),
4877
5001
  /* @__PURE__ */ Z(x, {
4878
5002
  variant: "outline",
@@ -4881,7 +5005,7 @@ var Or = {
4881
5005
  disabled: !m,
4882
5006
  onClick: v,
4883
5007
  title: s("detail.previousRecordKey"),
4884
- children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
5008
+ children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
4885
5009
  }),
4886
5010
  /* @__PURE__ */ Z("span", {
4887
5011
  className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
@@ -4897,7 +5021,7 @@ var Or = {
4897
5021
  disabled: !h,
4898
5022
  onClick: y,
4899
5023
  title: s("detail.nextRecordKey"),
4900
- children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
5024
+ children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
4901
5025
  }),
4902
5026
  /* @__PURE__ */ Z(x, {
4903
5027
  variant: "outline",
@@ -4906,15 +5030,15 @@ var Or = {
4906
5030
  disabled: !g,
4907
5031
  onClick: b,
4908
5032
  title: s("detail.lastRecord"),
4909
- children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
5033
+ children: /* @__PURE__ */ Z(xe, { className: "h-4 w-4" })
4910
5034
  }),
4911
- a && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(x, {
5035
+ a && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(x, {
4912
5036
  variant: u ? "secondary" : "ghost",
4913
5037
  size: "icon",
4914
5038
  className: "h-8 w-8",
4915
5039
  onClick: C,
4916
5040
  title: s("detail.searchWhileNavigating"),
4917
- children: /* @__PURE__ */ Z(Xe, { className: "h-4 w-4" })
5041
+ children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
4918
5042
  }), u && /* @__PURE__ */ Z("div", {
4919
5043
  className: "relative",
4920
5044
  children: /* @__PURE__ */ Z(A, {
@@ -4928,18 +5052,18 @@ var Or = {
4928
5052
  })] })
4929
5053
  ]
4930
5054
  });
4931
- }, Mr = 28, Nr = [
5055
+ }, zr = 28, Br = [
4932
5056
  "fill-primary stroke-primary",
4933
5057
  "fill-blue-500 stroke-blue-500",
4934
5058
  "fill-emerald-500 stroke-emerald-500",
4935
5059
  "fill-amber-500 stroke-amber-500"
4936
- ], Pr = [
5060
+ ], Vr = [
4937
5061
  "fill-primary-foreground",
4938
5062
  "fill-white",
4939
5063
  "fill-white",
4940
5064
  "fill-white"
4941
5065
  ];
4942
- function Fr(e, t, n, r, i) {
5066
+ function Hr(e, t, n, r, i) {
4943
5067
  let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
4944
5068
  a.push({
4945
5069
  id: e.id,
@@ -5003,10 +5127,10 @@ function Fr(e, t, n, r, i) {
5003
5127
  edges: o
5004
5128
  };
5005
5129
  }
5006
- function Ir(e, t = 6) {
5130
+ function Ur(e, t = 6) {
5007
5131
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
5008
5132
  }
5009
- var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
5133
+ var Wr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
5010
5134
  let o = i.useRef(null), [s, c] = i.useState({
5011
5135
  width: 500,
5012
5136
  height: 400
@@ -5027,14 +5151,14 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5027
5151
  });
5028
5152
  return n.observe(t), () => n.disconnect();
5029
5153
  }, []);
5030
- let { nodes: d, edges: f } = i.useMemo(() => Fr(e, t, n, s.width, s.height), [
5154
+ let { nodes: d, edges: f } = i.useMemo(() => Hr(e, t, n, s.width, s.height), [
5031
5155
  e,
5032
5156
  t,
5033
5157
  n,
5034
5158
  s
5035
5159
  ]);
5036
5160
  return /* @__PURE__ */ Q(S, {
5037
- className: W("overflow-hidden", a),
5161
+ className: G("overflow-hidden", a),
5038
5162
  children: [/* @__PURE__ */ Z(w, {
5039
5163
  className: "pb-2",
5040
5164
  children: /* @__PURE__ */ Q(T, {
@@ -5069,9 +5193,9 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5069
5193
  strokeWidth: 1.5,
5070
5194
  strokeOpacity: .5
5071
5195
  }, `edge-${t}`)), d.map((e) => {
5072
- let t = l === e.id, n = Nr[Math.min(e.level, Nr.length - 1)], i = Pr[Math.min(e.level, Pr.length - 1)], a = e.level === 0 ? 34 : Mr;
5196
+ let t = l === e.id, n = Br[Math.min(e.level, Br.length - 1)], i = Vr[Math.min(e.level, Vr.length - 1)], a = e.level === 0 ? 34 : zr;
5073
5197
  return /* @__PURE__ */ Q("g", {
5074
- className: W("cursor-pointer transition-transform", r && "hover:opacity-80"),
5198
+ className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
5075
5199
  onClick: () => r?.(e.id),
5076
5200
  onMouseEnter: () => u(e.id),
5077
5201
  onMouseLeave: () => u(null),
@@ -5090,8 +5214,8 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5090
5214
  y: e.y,
5091
5215
  textAnchor: "middle",
5092
5216
  dominantBaseline: "central",
5093
- className: W("text-[10px] font-medium pointer-events-none", i),
5094
- children: Ir(e.label)
5217
+ className: G("text-[10px] font-medium pointer-events-none", i),
5218
+ children: Ur(e.label)
5095
5219
  }),
5096
5220
  e.type && /* @__PURE__ */ Z("text", {
5097
5221
  x: e.x,
@@ -5100,7 +5224,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5100
5224
  className: "fill-muted-foreground text-[9px] pointer-events-none",
5101
5225
  children: e.type
5102
5226
  }),
5103
- t && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("rect", {
5227
+ t && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z("rect", {
5104
5228
  x: e.x - 50,
5105
5229
  y: e.y - a - 28,
5106
5230
  width: 100,
@@ -5125,7 +5249,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
5125
5249
  };
5126
5250
  //#endregion
5127
5251
  //#region src/PointInTimeRestore.tsx
5128
- function Rr(e) {
5252
+ function Gr(e) {
5129
5253
  try {
5130
5254
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
5131
5255
  if (r < 1) return "just now";
@@ -5136,7 +5260,7 @@ function Rr(e) {
5136
5260
  return e;
5137
5261
  }
5138
5262
  }
5139
- var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5263
+ var Kr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5140
5264
  let [a, o] = i.useState(null), [s, c] = i.useState(!1), [l, u] = i.useState(!1), d = i.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = i.useCallback(async () => {
5141
5265
  if (!(!d || !n)) {
5142
5266
  if (!s) {
@@ -5159,7 +5283,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5159
5283
  c(!1);
5160
5284
  }, []);
5161
5285
  return /* @__PURE__ */ Q(S, {
5162
- className: W("", r),
5286
+ className: G("", r),
5163
5287
  children: [/* @__PURE__ */ Z(w, {
5164
5288
  className: "pb-3",
5165
5289
  children: /* @__PURE__ */ Q(T, {
@@ -5192,13 +5316,13 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5192
5316
  let t = e.id === a;
5193
5317
  return /* @__PURE__ */ Q("button", {
5194
5318
  type: "button",
5195
- className: W("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
5319
+ className: G("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
5196
5320
  onClick: () => {
5197
5321
  o(e.id), c(!1);
5198
5322
  },
5199
5323
  children: [/* @__PURE__ */ Z("div", {
5200
- className: W("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
5201
- children: t && /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-primary-foreground" })
5324
+ className: G("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
5325
+ children: t && /* @__PURE__ */ Z(ye, { className: "h-3 w-3 text-primary-foreground" })
5202
5326
  }), /* @__PURE__ */ Q("div", {
5203
5327
  className: "flex-1 min-w-0",
5204
5328
  children: [/* @__PURE__ */ Q("div", {
@@ -5208,7 +5332,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5208
5332
  children: e.user
5209
5333
  }), /* @__PURE__ */ Z("span", {
5210
5334
  className: "text-xs text-muted-foreground",
5211
- children: Rr(e.timestamp)
5335
+ children: Gr(e.timestamp)
5212
5336
  })]
5213
5337
  }), /* @__PURE__ */ Q("p", {
5214
5338
  className: "text-xs text-muted-foreground mt-0.5",
@@ -5230,7 +5354,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5230
5354
  children: [
5231
5355
  /* @__PURE__ */ Q("div", {
5232
5356
  className: "flex items-center gap-2 text-sm font-medium",
5233
- children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
5357
+ children: [/* @__PURE__ */ Z(De, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
5234
5358
  }),
5235
5359
  /* @__PURE__ */ Z("div", {
5236
5360
  className: "space-y-2",
@@ -5246,7 +5370,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5246
5370
  className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
5247
5371
  children: e.oldValue == null ? "(empty)" : String(e.oldValue)
5248
5372
  }),
5249
- /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
5373
+ /* @__PURE__ */ Z(ye, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
5250
5374
  /* @__PURE__ */ Z("span", {
5251
5375
  className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
5252
5376
  children: e.newValue == null ? "(empty)" : String(e.newValue)
@@ -5276,12 +5400,12 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5276
5400
  }),
5277
5401
  n && /* @__PURE__ */ Z("div", {
5278
5402
  className: "pt-1 space-y-2",
5279
- children: s ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("p", {
5403
+ children: s ? /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q("p", {
5280
5404
  className: "text-xs text-amber-600 dark:text-amber-400",
5281
5405
  children: [
5282
5406
  "This will restore the record to its state at",
5283
5407
  " ",
5284
- Rr(d.timestamp),
5408
+ Gr(d.timestamp),
5285
5409
  ". Continue?"
5286
5410
  ]
5287
5411
  }), /* @__PURE__ */ Q("div", {
@@ -5292,7 +5416,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5292
5416
  className: "gap-1.5 flex-1",
5293
5417
  onClick: f,
5294
5418
  disabled: l,
5295
- children: [/* @__PURE__ */ Z(Je, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
5419
+ children: [/* @__PURE__ */ Z(Ye, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
5296
5420
  }), /* @__PURE__ */ Z(x, {
5297
5421
  variant: "ghost",
5298
5422
  size: "sm",
@@ -5305,14 +5429,14 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5305
5429
  size: "sm",
5306
5430
  className: "w-full gap-1.5",
5307
5431
  onClick: f,
5308
- children: [/* @__PURE__ */ Z(Je, { className: "h-3.5 w-3.5" }), "Restore to this point"]
5432
+ children: [/* @__PURE__ */ Z(Ye, { className: "h-3.5 w-3.5" }), "Restore to this point"]
5309
5433
  })
5310
5434
  })
5311
5435
  ]
5312
5436
  })]
5313
5437
  }) })]
5314
5438
  });
5315
- }, Br = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
5439
+ }, qr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
5316
5440
  let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
5317
5441
  let t = a.trim();
5318
5442
  if (t) {
@@ -5327,7 +5451,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5327
5451
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
5328
5452
  }, [l]);
5329
5453
  return /* @__PURE__ */ Q("div", {
5330
- className: W("flex gap-2", r),
5454
+ className: G("flex gap-2", r),
5331
5455
  children: [/* @__PURE__ */ Z("textarea", {
5332
5456
  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",
5333
5457
  placeholder: t,
@@ -5342,24 +5466,24 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5342
5466
  disabled: !a.trim() || s || n,
5343
5467
  className: "shrink-0 self-end",
5344
5468
  "aria-label": "Submit comment",
5345
- children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
5469
+ children: /* @__PURE__ */ Z(Qe, { className: "h-4 w-4" })
5346
5470
  })]
5347
5471
  });
5348
- }, Vr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
5472
+ }, Jr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
5349
5473
  let s = i.useMemo(() => {
5350
5474
  if (!e) return t;
5351
5475
  let n = e.toLowerCase();
5352
5476
  return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
5353
5477
  }, [e, t]);
5354
5478
  return !r || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
5355
- className: W("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
5479
+ className: G("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
5356
5480
  role: "listbox",
5357
5481
  "aria-label": "Mention suggestions",
5358
5482
  children: s.map((e, t) => /* @__PURE__ */ Q("button", {
5359
5483
  type: "button",
5360
5484
  role: "option",
5361
5485
  "aria-selected": t === a,
5362
- className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
5486
+ className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
5363
5487
  onMouseDown: (t) => {
5364
5488
  t.preventDefault(), n(e);
5365
5489
  },
@@ -5387,7 +5511,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
5387
5511
  }, e.id))
5388
5512
  });
5389
5513
  };
5390
- function Hr(e, t, n) {
5514
+ function Yr(e, t, n) {
5391
5515
  return {
5392
5516
  type: e.type,
5393
5517
  id: e.id,
@@ -5398,7 +5522,7 @@ function Hr(e, t, n) {
5398
5522
  }
5399
5523
  //#endregion
5400
5524
  //#region src/extractMentions.ts
5401
- function Ur(e, t) {
5525
+ function Xr(e, t) {
5402
5526
  if (!e || !t.length) return [];
5403
5527
  let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
5404
5528
  for (let e of n) {
@@ -5410,10 +5534,10 @@ function Ur(e, t) {
5410
5534
  }
5411
5535
  //#endregion
5412
5536
  //#region src/synth/buildDefaultPageSchema.ts
5413
- function Wr(e) {
5537
+ function Zr(e) {
5414
5538
  return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
5415
5539
  }
5416
- function Gr(e) {
5540
+ function Qr(e) {
5417
5541
  if (!e) return null;
5418
5542
  let t = e.stageField;
5419
5543
  if (t === !1) return null;
@@ -5431,7 +5555,7 @@ function Gr(e) {
5431
5555
  }
5432
5556
  return null;
5433
5557
  }
5434
- function Kr(e, t) {
5558
+ function $r(e, t) {
5435
5559
  if (!e || !t) return null;
5436
5560
  let n = e.fields?.[t]?.options;
5437
5561
  return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
@@ -5439,7 +5563,7 @@ function Kr(e, t) {
5439
5563
  label: e.label
5440
5564
  }));
5441
5565
  }
5442
- function qr(e, t, n = 4) {
5566
+ function ei(e, t, n = 4) {
5443
5567
  if (!e) return [];
5444
5568
  let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
5445
5569
  if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
@@ -5514,22 +5638,22 @@ function qr(e, t, n = 4) {
5514
5638
  }
5515
5639
  return s;
5516
5640
  }
5517
- function Jr(e, t = {}) {
5641
+ function ti(e, t = {}) {
5518
5642
  return {
5519
5643
  type: "page:header",
5520
5644
  recordChrome: t.recordChrome !== !1,
5521
5645
  ...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
5522
5646
  };
5523
5647
  }
5524
- function Yr(e, t) {
5648
+ function ni(e, t) {
5525
5649
  return !Array.isArray(t) || t.length === 0 ? null : {
5526
5650
  type: "record:quick_actions",
5527
5651
  actions: t,
5528
5652
  location: "record_header"
5529
5653
  };
5530
5654
  }
5531
- function Xr(e, t = {}) {
5532
- let n = t.statusField ?? Gr(e), r = t.stages ?? (n ? Kr(e, n) : null), i = t.highlightFields ?? qr(e, n), a = [];
5655
+ function ri(e, t = {}) {
5656
+ let n = t.statusField ?? Qr(e), r = t.stages ?? (n ? $r(e, n) : null), i = t.highlightFields ?? ei(e, n), a = [];
5533
5657
  return !t.hideHighlights && i.length > 0 && a.push({
5534
5658
  type: "record:highlights",
5535
5659
  fields: i
@@ -5539,9 +5663,9 @@ function Xr(e, t = {}) {
5539
5663
  stages: r
5540
5664
  }), a;
5541
5665
  }
5542
- function Zr(e) {
5666
+ function ii(e) {
5543
5667
  if (!e) return null;
5544
- let t = Pt(e);
5668
+ let t = Lt(e);
5545
5669
  if (!t) return null;
5546
5670
  let n = e.fields || {}, r = (e) => {
5547
5671
  let t = n[e] || {};
@@ -5554,7 +5678,7 @@ function Zr(e) {
5554
5678
  ...t.reference_field ? { reference_field: t.reference_field } : {},
5555
5679
  ...t.currency ? { currency: t.currency } : {}
5556
5680
  };
5557
- }, i = Lt(t.reduce((e, t) => e + t.fields.length, 0));
5681
+ }, i = Bt(t.reduce((e, t) => e + t.fields.length, 0));
5558
5682
  return t.map((e) => ({
5559
5683
  ...e.key === void 0 ? {} : {
5560
5684
  name: e.key,
@@ -5566,21 +5690,21 @@ function Zr(e) {
5566
5690
  fields: e.fields.map(r)
5567
5691
  }));
5568
5692
  }
5569
- function Qr(e, t) {
5570
- return Array.isArray(t) && t.length > 0 ? t : Zr(e) ?? void 0;
5693
+ function ai(e, t) {
5694
+ return Array.isArray(t) && t.length > 0 ? t : ii(e) ?? void 0;
5571
5695
  }
5572
- function $r(e, t, n) {
5696
+ function oi(e, t, n) {
5573
5697
  return {
5574
5698
  type: "record:details",
5575
- sections: Qr(e, t),
5699
+ sections: ai(e, t),
5576
5700
  ...n && n.length > 0 ? { hideFields: n } : {}
5577
5701
  };
5578
5702
  }
5579
- function ei(e, t = {}) {
5580
- let n = t.statusField ?? Gr(e), r = t.highlightFields ?? qr(e, n), i = [{
5703
+ function si(e, t = {}) {
5704
+ let n = t.statusField ?? Qr(e), r = t.highlightFields ?? ei(e, n), i = [{
5581
5705
  label: "Details",
5582
5706
  value: "details",
5583
- children: [$r(e, t.sections, r)]
5707
+ children: [oi(e, t.sections, r)]
5584
5708
  }];
5585
5709
  if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
5586
5710
  let e = (e) => ({
@@ -5631,15 +5755,15 @@ function ei(e, t = {}) {
5631
5755
  items: i
5632
5756
  };
5633
5757
  }
5634
- function ti() {
5758
+ function ci() {
5635
5759
  return { type: "record:discussion" };
5636
5760
  }
5637
- function ni(e, t = {}) {
5761
+ function li(e, t = {}) {
5638
5762
  let n = t.slots || {}, r = [];
5639
- "header" in n && n.header !== void 0 ? r.push(...Wr(n.header)) : r.push(Jr(e, {
5763
+ "header" in n && n.header !== void 0 ? r.push(...Zr(n.header)) : r.push(ti(e, {
5640
5764
  recordChrome: t.recordChrome,
5641
5765
  actions: t.headerActions
5642
- })), "actions" in n && n.actions !== void 0 && r.push(...Wr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Wr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Wr(n.highlights)) : r.push(...Xr(e, {
5766
+ })), "actions" in n && n.actions !== void 0 && r.push(...Zr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Zr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Zr(n.highlights)) : r.push(...ri(e, {
5643
5767
  highlightFields: t.highlightFields,
5644
5768
  statusField: t.statusField,
5645
5769
  stages: t.stages,
@@ -5647,9 +5771,9 @@ function ni(e, t = {}) {
5647
5771
  hidePath: t.hidePath
5648
5772
  }));
5649
5773
  let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
5650
- if ("tabs" in n && n.tabs !== void 0) r.push(...Wr(n.tabs));
5774
+ if ("tabs" in n && n.tabs !== void 0) r.push(...Zr(n.tabs));
5651
5775
  else if ("details" in n && n.details !== void 0) {
5652
- let i = Wr(n.details), o = ei(e, {
5776
+ let i = Zr(n.details), o = si(e, {
5653
5777
  sections: t.sections,
5654
5778
  related: t.related,
5655
5779
  showActivity: t.showActivity,
@@ -5663,7 +5787,7 @@ function ni(e, t = {}) {
5663
5787
  ...o.items[0],
5664
5788
  children: i
5665
5789
  }), r.push(o);
5666
- } else r.push(ei(e, {
5790
+ } else r.push(si(e, {
5667
5791
  sections: t.sections,
5668
5792
  related: t.related,
5669
5793
  showActivity: t.showActivity,
@@ -5673,12 +5797,12 @@ function ni(e, t = {}) {
5673
5797
  hideRelatedTab: a,
5674
5798
  relatedLayout: t.relatedLayout
5675
5799
  }));
5676
- "discussion" in n && n.discussion !== void 0 ? r.push(...Wr(n.discussion)) : t.hideDiscussion || r.push(ti());
5800
+ "discussion" in n && n.discussion !== void 0 ? r.push(...Zr(n.discussion)) : t.hideDiscussion || r.push(ci());
5677
5801
  let o = [{
5678
5802
  name: "main",
5679
5803
  width: "full",
5680
5804
  components: r
5681
- }], s = Wr(n.rightRail);
5805
+ }], s = Zr(n.rightRail);
5682
5806
  if (i || s.length > 0) {
5683
5807
  let e = [];
5684
5808
  i && e.push({
@@ -5706,7 +5830,7 @@ function ni(e, t = {}) {
5706
5830
  regions: o
5707
5831
  };
5708
5832
  }
5709
- e.register("detail-view", Sn, {
5833
+ e.register("detail-view", kn, {
5710
5834
  namespace: "plugin-detail",
5711
5835
  label: "Detail View",
5712
5836
  category: "Views",
@@ -5836,7 +5960,7 @@ e.register("detail-view", Sn, {
5836
5960
  tabs: [],
5837
5961
  related: []
5838
5962
  }
5839
- }), e.register("detail-section", Gt, {
5963
+ }), e.register("detail-section", Zt, {
5840
5964
  namespace: "plugin-detail",
5841
5965
  label: "Detail Section",
5842
5966
  category: "Detail Components",
@@ -5887,7 +6011,7 @@ e.register("detail-view", Sn, {
5887
6011
  label: "Header Color"
5888
6012
  }
5889
6013
  ]
5890
- }), e.register("related-list", Jt, {
6014
+ }), e.register("related-list", tn, {
5891
6015
  namespace: "plugin-detail",
5892
6016
  label: "Related List",
5893
6017
  category: "Detail Components",
@@ -5934,7 +6058,7 @@ e.register("detail-view", Sn, {
5934
6058
  label: "Columns"
5935
6059
  }
5936
6060
  ]
5937
- }), e.register("detail", Sn, {
6061
+ }), e.register("detail", kn, {
5938
6062
  namespace: "view",
5939
6063
  category: "view",
5940
6064
  label: "Detail",
@@ -5957,7 +6081,7 @@ e.register("detail-view", Sn, {
5957
6081
  label: "Fields"
5958
6082
  }
5959
6083
  ]
5960
- }), e.register("record:details", kn, {
6084
+ }), e.register("record:details", In, {
5961
6085
  namespace: "record",
5962
6086
  category: "record",
5963
6087
  label: "Record Details",
@@ -5997,7 +6121,7 @@ e.register("detail-view", Sn, {
5997
6121
  description: "Explicit field list (overrides highlightFields)"
5998
6122
  }
5999
6123
  ]
6000
- }), e.register("record:related_list", Nn, {
6124
+ }), e.register("record:related_list", Bn, {
6001
6125
  namespace: "record",
6002
6126
  category: "record",
6003
6127
  label: "Related List",
@@ -6060,7 +6184,7 @@ e.register("detail-view", Sn, {
6060
6184
  description: "Action IDs available for related records"
6061
6185
  }
6062
6186
  ]
6063
- }), e.register("record:highlights", Fn, {
6187
+ }), e.register("record:highlights", Hn, {
6064
6188
  namespace: "record",
6065
6189
  category: "record",
6066
6190
  label: "Highlights Panel",
@@ -6079,22 +6203,22 @@ e.register("detail-view", Sn, {
6079
6203
  defaultValue: "horizontal",
6080
6204
  description: "Layout orientation for highlight fields"
6081
6205
  }]
6082
- }), e.register("record:activity", tr, {
6206
+ }), e.register("record:activity", cr, {
6083
6207
  namespace: "record",
6084
6208
  category: "record",
6085
6209
  label: "Activity Timeline",
6086
6210
  icon: "Activity"
6087
- }), e.register("record:chatter", ir, {
6211
+ }), e.register("record:chatter", dr, {
6088
6212
  namespace: "record",
6089
6213
  category: "record",
6090
6214
  label: "Chatter Feed",
6091
6215
  icon: "MessageSquare"
6092
- }), e.register("record:discussion", ir, {
6216
+ }), e.register("record:discussion", dr, {
6093
6217
  namespace: "record",
6094
6218
  category: "record",
6095
6219
  label: "Discussion",
6096
6220
  icon: "MessageSquare"
6097
- }), e.register("record:path", or, {
6221
+ }), e.register("record:path", pr, {
6098
6222
  namespace: "record",
6099
6223
  category: "record",
6100
6224
  label: "Path / Stepper",
@@ -6111,26 +6235,29 @@ e.register("detail-view", Sn, {
6111
6235
  label: "Stages",
6112
6236
  description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
6113
6237
  }]
6114
- }), e.register("record:quick_actions", cr, {
6238
+ }), e.register("record:quick_actions", hr, {
6115
6239
  namespace: "record",
6116
6240
  category: "record",
6117
6241
  label: "Quick Actions",
6118
6242
  icon: "Zap"
6119
- }), e.register("record:history", fr, {
6243
+ }), e.register("record:history", yr, {
6120
6244
  namespace: "record",
6121
6245
  category: "record",
6122
6246
  label: "History Timeline",
6123
6247
  icon: "Clock"
6124
- }), e.register("record:reference_rail", gr, {
6248
+ }), e.register("record:reference_rail", Cr, {
6125
6249
  namespace: "record",
6126
6250
  category: "record",
6127
6251
  label: "Reference Rail",
6128
6252
  icon: "PanelRight"
6129
- }), e.register("record:alert", yr, {
6253
+ }), e.register("record:alert", Er, {
6130
6254
  namespace: "record",
6131
6255
  category: "record",
6132
6256
  label: "Alert Banner",
6133
6257
  icon: "AlertTriangle"
6258
+ }), e.register("permission-facet-link", qt, {
6259
+ namespace: "field",
6260
+ skipFallback: !0
6134
6261
  });
6135
6262
  //#endregion
6136
- export { an as ActivityTimeline, qn as CommentAttachment, Br as CommentInput, Tn as ConcurrentUpdateDialog, Vt as DETAIL_DEFAULT_TRANSLATIONS, Gt as DetailSection, Kt as DetailTabs, Sn as DetailView, Ar as DiffView, In as FieldChangeItem, Xt as HeaderHighlight, fn as HistoryTimeline, Tr as InlineCreateRelated, Vr as MentionAutocomplete, zr as PointInTimeRestore, Rn as ReactionPicker, tr as RecordActivityRenderer, $n as RecordActivityTimeline, yr as RecordAlertRenderer, nr as RecordChatterPanel, ir as RecordChatterRenderer, Qt as RecordComments, Cr as RecordDetailDrawer, kn as RecordDetailsRenderer, Fn as RecordHighlightsRenderer, fr as RecordHistoryRenderer, yn as RecordMetaFooter, jr as RecordNavigationEnhanced, or as RecordPathRenderer, cr as RecordQuickActionsRenderer, gr as RecordReferenceRailRenderer, Nn as RecordRelatedListRenderer, Jt as RelatedList, Lr as RelationshipGraph, Un as RichTextCommentInput, Yt as SectionGroup, Vn as SubscriptionToggle, Bn as ThreadedReplies, Rt as applyAutoSpan, zt as applyDetailAutoLayout, Yr as buildDefaultActions, $r as buildDefaultDetails, ti as buildDefaultDiscussion, Jr as buildDefaultHeader, Xr as buildDefaultHighlights, ni as buildDefaultPageSchema, ei as buildDefaultTabs, Hr as createMentionFromSuggestion, Bt as createSafeTranslationHook, Zr as deriveFieldGroupDetailSections, qr as deriveHighlightFields, wr as deriveRecordPageHref, Kr as deriveStages, Gr as detectStatusField, Ur as extractMentions, Lt as inferDetailColumns, En as isConcurrentUpdateError, It as isWideFieldType, Qr as resolveDetailSections, $ as useDetailTranslation };
6263
+ export { fn as ActivityTimeline, er as CommentAttachment, qr as CommentInput, Mn as ConcurrentUpdateDialog, Wt as DETAIL_DEFAULT_TRANSLATIONS, Zt as DetailSection, Qt as DetailTabs, kn as DetailView, Lr as DiffView, Un as FieldChangeItem, rn as HeaderHighlight, yn as HistoryTimeline, Mr as InlineCreateRelated, Jr as MentionAutocomplete, Kr as PointInTimeRestore, Gn as ReactionPicker, cr as RecordActivityRenderer, or as RecordActivityTimeline, Er as RecordAlertRenderer, lr as RecordChatterPanel, dr as RecordChatterRenderer, on as RecordComments, Ar as RecordDetailDrawer, In as RecordDetailsRenderer, Hn as RecordHighlightsRenderer, yr as RecordHistoryRenderer, En as RecordMetaFooter, Rr as RecordNavigationEnhanced, pr as RecordPathRenderer, hr as RecordQuickActionsRenderer, Cr as RecordReferenceRailRenderer, Bn as RecordRelatedListRenderer, tn as RelatedList, Wr as RelationshipGraph, Xn as RichTextCommentInput, nn as SectionGroup, Jn as SubscriptionToggle, qn as ThreadedReplies, Vt as applyAutoSpan, Ht as applyDetailAutoLayout, ni as buildDefaultActions, oi as buildDefaultDetails, ci as buildDefaultDiscussion, ti as buildDefaultHeader, ri as buildDefaultHighlights, li as buildDefaultPageSchema, si as buildDefaultTabs, Yr as createMentionFromSuggestion, Ut as createSafeTranslationHook, ii as deriveFieldGroupDetailSections, ei as deriveHighlightFields, jr as deriveRecordPageHref, $r as deriveStages, Qr as detectStatusField, Xr as extractMentions, Bt as inferDetailColumns, Nn as isConcurrentUpdateError, zt as isWideFieldType, ai as resolveDetailSections, $ as useDetailTranslation };