@declarion/react 0.52.0 → 0.54.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.
Files changed (65) hide show
  1. package/dist-lib/{DraggableChildrenTable-CJCjc_cd.js → DraggableChildrenTable-CPoUY99R.js} +35 -35
  2. package/dist-lib/{Grid-DUjbQg3r.js → Grid--QAEby8k.js} +28 -28
  3. package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-BxZ7Nd9b.js} +920 -922
  4. package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-BPV4GPrv.js} +14 -14
  5. package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-CIKuh_0i.js} +10 -10
  6. package/dist-lib/{record-documents-key-8fdm7C10.js → RecordIdBadge-CGxPR-8q.js} +1 -4
  7. package/dist-lib/{RefreshControl-C-8UCyau.js → RefreshControl-DMLkZP3R.js} +120 -122
  8. package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-SnNu6Ug-.js} +376 -377
  9. package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-C73pR7Iw.js} +1098 -1099
  10. package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-rJjQZe1V.js} +183 -183
  11. package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-DQ_KrkWk.js} +1 -1
  12. package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DsuUS7ae.js} +382 -382
  13. package/dist-lib/api/agents.d.ts +0 -1
  14. package/dist-lib/api/events.d.ts +27 -5
  15. package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-BadzqyeQ.js} +146 -204
  16. package/dist-lib/components/actions/ObjectActionBar.d.ts +1 -1
  17. package/dist-lib/components/chrome/Breadcrumbs.d.ts +1 -1
  18. package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -1
  19. package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -1
  20. package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +1 -1
  21. package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +1 -1
  22. package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +1 -1
  23. package/dist-lib/components/file-widgets/host.d.ts +1 -1
  24. package/dist-lib/components/layout/Layout.d.ts +1 -1
  25. package/dist-lib/components/layout/TopBar.d.ts +1 -1
  26. package/dist-lib/components/list/InlineEditCell.d.ts +1 -1
  27. package/dist-lib/components/list/PeekFieldCell.d.ts +1 -1
  28. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  29. package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
  30. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +2 -2
  31. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  32. package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -1
  33. package/dist-lib/components/pages/list/ListCardsBody.d.ts +1 -1
  34. package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
  35. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  36. package/dist-lib/components/pages/list/columns.d.ts +1 -1
  37. package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
  38. package/dist-lib/components/pages/list/use-filter-value-labels.d.ts +1 -1
  39. package/dist-lib/components/pages/list/useListQuery.d.ts +6 -1
  40. package/dist-lib/components/pages/list/useListRowInteraction.d.ts +1 -1
  41. package/dist-lib/components/pages/list/useListViews.d.ts +1 -1
  42. package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
  43. package/dist-lib/components/shared/RefreshControl.d.ts +7 -1
  44. package/dist-lib/components/shared/useOwnRefresh.d.ts +9 -0
  45. package/dist-lib/{field-classification-CeYJlsNq.js → field-classification-sMkkAEg9.js} +301 -320
  46. package/dist-lib/{format-count-C3N-WxEy.js → format-count-B5SLlNOb.js} +245 -245
  47. package/dist-lib/hooks/useMutations.d.ts +1 -1
  48. package/dist-lib/hooks/useSSE.d.ts +24 -4
  49. package/dist-lib/index.js +1586 -1858
  50. package/dist-lib/lib/action-dispatch.d.ts +1 -1
  51. package/dist-lib/lib/document-templates.d.ts +1 -1
  52. package/dist-lib/lib/realtime-reconcile.d.ts +43 -0
  53. package/dist-lib/{peekDraftStore-D3sowXga.js → peekDraftStore-CbHFwz_F.js} +36 -36
  54. package/dist-lib/{registry-p6CejATt.js → registry-D0RhCnEL.js} +507 -507
  55. package/dist-lib/stores/realtime.d.ts +20 -0
  56. package/dist-lib/testing.js +35 -35
  57. package/dist-lib/types/api.d.ts +8 -4
  58. package/dist-lib/types/schema.d.ts +6 -0
  59. package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-DVTXCj_K.js} +2508 -1557
  60. package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-C2nq58YV.js} +13 -10
  61. package/dist-lib/{useProperties-C5fZp12D.js → useProperties-BcIz-MyO.js} +25 -25
  62. package/dist-lib/useTabSearchMirror-UYCsopxP.js +177 -0
  63. package/dist-lib/{value-DKekzcjz.js → value-CQzGOI0F.js} +25 -25
  64. package/package.json +14 -14
  65. package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
@@ -1,14 +1,14 @@
1
1
  import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
2
- import { $ as n, $n as r, A as i, At as a, C as o, Cn as s, Ct as c, D as l, Dn as u, En as d, F as f, L as p, Ln as ee, N as m, Q as h, Rn as g, Sn as _, Tn as v, _ as y, bt as b, dr as x, dt as S, fr as C, gt as w, i as T, it as te, j as E, jn as D, jt as ne, kn as re, pt as ie, rr as ae, un as oe, ur as O, wn as se, wt as ce, xn as le, zn as k } from "./useCurrentScreen-74x5yJNb.js";
3
- import { _ as A, m as j, r as ue, s as M, t as de } from "./RefreshControl-C-8UCyau.js";
4
- import { a as fe, f as N, i as pe } from "./registry-p6CejATt.js";
5
- import { n as me, t as he } from "./record-documents-key-8fdm7C10.js";
6
- import { A as ge, C as _e, F as ve, O as ye, c as be, d as xe, f as Se, j as Ce, l as we, m as Te, p as Ee, y as De } from "./field-classification-CeYJlsNq.js";
7
- import { c as Oe, f as ke, h as Ae, m as je, o as Me, p as Ne, r as Pe, t as Fe, u as Ie } from "./action-dispatch-C28UhXXA.js";
8
- import { d as Le, m as Re, p as ze, t as Be } from "./cardProjection-Bp_ZPLUE.js";
9
- import { n as Ve, r as He, t as Ue } from "./dataTableStyles-vwD1mVOP.js";
10
- import { a as We, i as Ge, o as Ke, r as qe, s as P } from "./peekDraftStore-D3sowXga.js";
11
- import { n as Je, t as Ye } from "./LayoutRenderer-DbdxC-Bq.js";
2
+ import { $ as n, $n as r, $t as i, Bt as a, Cr as o, Dr as s, Fn as c, Fr as l, Gn as u, Gt as d, Ht as f, Ir as p, Jn as m, Kn as h, Nt as g, Pr as _, Qt as v, Tt as y, U as b, Xn as x, Y as S, Yn as C, Yt as w, Zn as T, an as ee, at as E, c as te, cr as ne, g as D, i as re, lr as O, lt as ie, nt as ae, on as oe, qn as se, rt as k, s as ce, sr as le, st as ue, tr as A, wt as j } from "./useCurrentScreen-DVTXCj_K.js";
3
+ import { _ as M, m as N, r as de, s as fe, t as pe } from "./RefreshControl-DMLkZP3R.js";
4
+ import { a as me, f as P, i as he } from "./registry-D0RhCnEL.js";
5
+ import { t as ge } from "./RecordIdBadge-CGxPR-8q.js";
6
+ import { D as _e, M as ve, O as ye, T as be, b as xe, f as Se, g as Ce, l as we, p as Te, u as Ee } from "./field-classification-sMkkAEg9.js";
7
+ import { c as De, f as Oe, h as ke, m as Ae, o as je, p as Me, r as Ne, t as Pe, u as Fe } from "./action-dispatch-DsuUS7ae.js";
8
+ import { a as Ie, c as Le, s as Re, t as ze } from "./cardProjection-BadzqyeQ.js";
9
+ import { n as Be, r as Ve, t as He } from "./dataTableStyles-vwD1mVOP.js";
10
+ import { a as Ue, i as We, o as Ge, r as Ke, s as qe } from "./peekDraftStore-CbHFwz_F.js";
11
+ import { n as Je, t as Ye } from "./LayoutRenderer-BxZ7Nd9b.js";
12
12
  import { Fragment as Xe, useCallback as F, useEffect as I, useMemo as L, useRef as Ze, useState as R } from "react";
13
13
  import { useLocation as Qe, useParams as $e, useSearchParams as et } from "react-router";
14
14
  import { useQuery as z, useQueryClient as tt } from "@tanstack/react-query";
@@ -18,7 +18,7 @@ function rt({ entityCode: e, recordId: n, associations: r, schema: i }) {
18
18
  let a = L(() => Object.entries(r), [r]), [o, s] = R(0);
19
19
  if (a.length === 0) return null;
20
20
  let [c, l] = a[o];
21
- return /* @__PURE__ */ B(N, {
21
+ return /* @__PURE__ */ B(P, {
22
22
  title: /* @__PURE__ */ B("div", {
23
23
  style: {
24
24
  display: "flex",
@@ -51,7 +51,7 @@ function rt({ entityCode: e, recordId: n, associations: r, schema: i }) {
51
51
  children: [n.display?.icon && /* @__PURE__ */ B(t, {
52
52
  name: n.display.icon,
53
53
  size: 13
54
- }), u(n.display?.name) || e]
54
+ }), T(n.display?.name) || e]
55
55
  }, e);
56
56
  })
57
57
  }),
@@ -66,41 +66,41 @@ function rt({ entityCode: e, recordId: n, associations: r, schema: i }) {
66
66
  })
67
67
  });
68
68
  }
69
- function H({ entityCode: t, recordId: n, assocKey: r, association: a, schema: s }) {
70
- let l = Ce(), d = i(), f = `${t}.${r}`, { data: p, isLoading: ee } = z({
69
+ function H({ entityCode: t, recordId: n, assocKey: r, association: a, schema: o }) {
70
+ let s = ye(), c = ae(), l = `${t}.${r}`, { data: u, isLoading: d } = z({
71
71
  queryKey: [
72
72
  "association",
73
- f,
73
+ l,
74
74
  n
75
75
  ],
76
- queryFn: () => ce(f, [n])
77
- }), m = p?.target_entity ?? a.target, h = s.entities[m], g = L(() => p?.ids ?? [], [p?.ids]), _ = L(() => h?.fields.names().find((e) => h.fields.get(e)?.primary) ?? "id", [h]), v = L(() => g.slice(0, 50), [g]), { data: y, isLoading: b } = z({
76
+ queryFn: () => i(l, [n])
77
+ }), f = u?.target_entity ?? a.target, h = o.entities[f], g = L(() => u?.ids ?? [], [u?.ids]), _ = L(() => h?.fields.names().find((e) => h.fields.get(e)?.primary) ?? "id", [h]), y = L(() => g.slice(0, 50), [g]), { data: b, isLoading: x } = z({
78
78
  queryKey: [
79
79
  "association-records",
80
- m,
81
- v
80
+ f,
81
+ y
82
82
  ],
83
- queryFn: () => c(m, {
83
+ queryFn: () => v(f, {
84
84
  per_page: 50,
85
85
  filters: [{
86
86
  field: _,
87
87
  op: "in",
88
- value: v
88
+ value: y
89
89
  }]
90
90
  }),
91
- enabled: v.length > 0 && !!h
92
- }), x = y?.data ?? [], S = y?.$refs, w = L(() => h ? h.fields.names().filter((e) => {
91
+ enabled: y.length > 0 && !!h
92
+ }), C = b?.data ?? [], w = b?.$refs, ee = L(() => h ? h.fields.names().filter((e) => {
93
93
  let t = h.fields.get(e);
94
94
  return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
95
- }).slice(0, 6) : [], [h]), T = () => {
96
- let e = o(s, m);
95
+ }).slice(0, 6) : [], [h]), E = () => {
96
+ let e = S(o, f);
97
97
  if (!e) return;
98
- let t = u(a.display?.name) || r, n = new URLSearchParams();
98
+ let t = T(a.display?.name) || r, n = new URLSearchParams();
99
99
  n.set("filters", JSON.stringify([{
100
100
  field: _,
101
101
  op: "in",
102
102
  value: g
103
- }])), l(e.route, {
103
+ }])), s(e.route, {
104
104
  title: t,
105
105
  icon: a.display?.icon || e.icon,
106
106
  search: n.toString()
@@ -110,7 +110,7 @@ function H({ entityCode: t, recordId: n, assocKey: r, association: a, schema: s
110
110
  color: "var(--text-3)",
111
111
  padding: "14px 16px"
112
112
  };
113
- if (ee || b) return /* @__PURE__ */ B("div", {
113
+ if (d || x) return /* @__PURE__ */ B("div", {
114
114
  style: te,
115
115
  children: "Loading…"
116
116
  });
@@ -122,55 +122,55 @@ function H({ entityCode: t, recordId: n, assocKey: r, association: a, schema: s
122
122
  style: te,
123
123
  children: "No related records."
124
124
  });
125
- let D = o(s, m);
125
+ let ne = S(o, f);
126
126
  return /* @__PURE__ */ V("div", {
127
127
  style: { padding: "8px 0" },
128
128
  children: [
129
129
  /* @__PURE__ */ V("table", {
130
- style: He,
131
- children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ B("tr", { children: w.map((e) => /* @__PURE__ */ B("th", {
132
- style: Ve,
133
- children: se(h.fields.get(e), e, s.entities)
134
- }, e)) }) }), /* @__PURE__ */ B("tbody", { children: x.map((e, t) => /* @__PURE__ */ B("tr", { children: w.map((t) => {
130
+ style: Ve,
131
+ children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ B("tr", { children: ee.map((e) => /* @__PURE__ */ B("th", {
132
+ style: Be,
133
+ children: m(h.fields.get(e), e, o.entities)
134
+ }, e)) }) }), /* @__PURE__ */ B("tbody", { children: C.map((e, t) => /* @__PURE__ */ B("tr", { children: ee.map((t) => {
135
135
  let n = h.fields.get(t);
136
136
  return n ? /* @__PURE__ */ B("td", {
137
- style: Ue,
138
- children: E({
137
+ style: He,
138
+ children: k({
139
139
  field: n,
140
140
  fieldName: t,
141
141
  value: e[t],
142
142
  mode: "display",
143
143
  record: e,
144
- refs: S,
145
- locale: d
144
+ refs: w,
145
+ locale: c
146
146
  })
147
147
  }, t) : /* @__PURE__ */ B("td", {}, t);
148
148
  }) }, t)) })]
149
149
  }),
150
- D && p && p.count > x.length && /* @__PURE__ */ B("div", {
150
+ ne && u && u.count > C.length && /* @__PURE__ */ B("div", {
151
151
  style: {
152
152
  padding: "10px 16px",
153
153
  textAlign: "center"
154
154
  },
155
- children: /* @__PURE__ */ V(C, {
155
+ children: /* @__PURE__ */ V(p, {
156
156
  icon: /* @__PURE__ */ B(e.external, { size: 12 }),
157
- onClick: T,
157
+ onClick: E,
158
158
  children: [
159
159
  "View all ",
160
- p.count,
160
+ u.count,
161
161
  " records"
162
162
  ]
163
163
  })
164
164
  }),
165
- D && x.length > 0 && p && p.count <= x.length && /* @__PURE__ */ B("div", {
165
+ ne && C.length > 0 && u && u.count <= C.length && /* @__PURE__ */ B("div", {
166
166
  style: {
167
167
  padding: "10px 16px",
168
168
  textAlign: "center"
169
169
  },
170
- children: /* @__PURE__ */ B(C, {
170
+ children: /* @__PURE__ */ B(p, {
171
171
  kind: "ghost",
172
172
  icon: /* @__PURE__ */ B(e.external, { size: 12 }),
173
- onClick: T,
173
+ onClick: E,
174
174
  children: "Open in list view"
175
175
  })
176
176
  })
@@ -186,18 +186,18 @@ function U(e) {
186
186
  function at({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates: i }) {
187
187
  let { data: a, isLoading: o, error: s } = z({
188
188
  queryKey: [
189
- he,
189
+ D,
190
190
  t,
191
191
  n
192
192
  ],
193
- queryFn: async () => (await b("document.object_links", {
193
+ queryFn: async () => (await w("document.object_links", {
194
194
  entity: t,
195
195
  object_id: n
196
196
  })).result?.documents ?? [],
197
197
  enabled: !!(t && n) && (!!r || !!i),
198
198
  refetchInterval: (e) => U(e.state.data)
199
199
  }), c = (a?.length ?? 0) > 0;
200
- return !r && !c ? null : /* @__PURE__ */ V(N, {
200
+ return !r && !c ? null : /* @__PURE__ */ V(P, {
201
201
  title: /* @__PURE__ */ B(ot, {}),
202
202
  collapsible: !1,
203
203
  padding: "0",
@@ -243,51 +243,51 @@ function ot() {
243
243
  children: [/* @__PURE__ */ B(e.file, { size: 13 }), "Documents"]
244
244
  });
245
245
  }
246
- function W({ entityCode: t, objectId: r, doc: i }) {
247
- let a = tt(), [o, s] = R(!1), [c, l] = R(!1), [d, f] = R(!1), [p, ee] = R(!1), [m, g] = R(null), _ = u(i.title) || i.filename || i.template_code, v = i.status === "ready" && i.download_url && !p;
248
- async function y() {
249
- s(!0), g(null);
246
+ function W({ entityCode: t, objectId: n, doc: r }) {
247
+ let i = tt(), [a, o] = R(!1), [s, c] = R(!1), [l, u] = R(!1), [d, f] = R(!1), [m, h] = R(null), g = T(r.title) || r.filename || r.template_code, _ = r.status === "ready" && r.download_url && !d;
248
+ async function v() {
249
+ o(!0), h(null);
250
250
  try {
251
- let e = (await b("document.download_format", {
252
- generated_document_id: i.generated_document_id,
251
+ let e = (await w("document.download_format", {
252
+ generated_document_id: r.generated_document_id,
253
253
  format: "pdf"
254
254
  })).result;
255
- e?.download_url && await h(e.download_url, e.filename);
255
+ e?.download_url && await j(e.download_url, e.filename);
256
256
  } catch (e) {
257
- n(e) ? (ee(!0), g("Artifact unavailable")) : g(e instanceof Error ? e.message : String(e));
257
+ y(e) ? (f(!0), h("Artifact unavailable")) : h(e instanceof Error ? e.message : String(e));
258
258
  } finally {
259
- s(!1);
259
+ o(!1);
260
260
  }
261
261
  }
262
- async function x() {
263
- if (i.download_url) {
264
- l(!0), g(null);
262
+ async function b() {
263
+ if (r.download_url) {
264
+ c(!0), h(null);
265
265
  try {
266
- await h(i.download_url, i.filename);
266
+ await j(r.download_url, r.filename);
267
267
  } catch (e) {
268
- n(e) ? (ee(!0), g("Artifact unavailable")) : g(e instanceof Error ? e.message : String(e));
268
+ y(e) ? (f(!0), h("Artifact unavailable")) : h(e instanceof Error ? e.message : String(e));
269
269
  } finally {
270
- l(!1);
270
+ c(!1);
271
271
  }
272
272
  }
273
273
  }
274
- async function S() {
275
- f(!0), g(null);
274
+ async function x() {
275
+ u(!0), h(null);
276
276
  try {
277
- await b("document.generate", {
278
- ...i.input ?? {},
279
- template_code: i.template_code,
280
- template_source: i.template_source,
281
- output_format: i.output_format
282
- }), await a.invalidateQueries({ queryKey: [
283
- he,
277
+ await w("document.generate", {
278
+ ...r.input ?? {},
279
+ template_code: r.template_code,
280
+ template_source: r.template_source,
281
+ output_format: r.output_format
282
+ }), await i.invalidateQueries({ queryKey: [
283
+ D,
284
284
  t,
285
- r
285
+ n
286
286
  ] });
287
287
  } catch (e) {
288
- g(e instanceof Error ? e.message : String(e));
288
+ h(e instanceof Error ? e.message : String(e));
289
289
  } finally {
290
- f(!1);
290
+ u(!1);
291
291
  }
292
292
  }
293
293
  return /* @__PURE__ */ V("div", {
@@ -311,7 +311,7 @@ function W({ entityCode: t, objectId: r, doc: i }) {
311
311
  textOverflow: "ellipsis",
312
312
  whiteSpace: "nowrap"
313
313
  },
314
- children: _
314
+ children: g
315
315
  }),
316
316
  /* @__PURE__ */ V("div", {
317
317
  style: {
@@ -323,18 +323,18 @@ function W({ entityCode: t, objectId: r, doc: i }) {
323
323
  fontSize: 11.5
324
324
  },
325
325
  children: [
326
- /* @__PURE__ */ B("span", { children: i.output_format.toUpperCase() }),
327
- /* @__PURE__ */ B("span", { children: p ? "artifact unavailable" : i.status }),
328
- /* @__PURE__ */ B("span", { children: i.ready_at || i.created_at })
326
+ /* @__PURE__ */ B("span", { children: r.output_format.toUpperCase() }),
327
+ /* @__PURE__ */ B("span", { children: d ? "artifact unavailable" : r.status }),
328
+ /* @__PURE__ */ B("span", { children: r.ready_at || r.created_at })
329
329
  ]
330
330
  }),
331
- i.status === "failed" && i.error_text && /* @__PURE__ */ B("div", {
331
+ r.status === "failed" && r.error_text && /* @__PURE__ */ B("div", {
332
332
  style: {
333
333
  marginTop: 5,
334
334
  color: "var(--danger)",
335
335
  fontSize: 12
336
336
  },
337
- children: i.error_text
337
+ children: r.error_text
338
338
  }),
339
339
  m && /* @__PURE__ */ B("div", {
340
340
  style: {
@@ -345,38 +345,38 @@ function W({ entityCode: t, objectId: r, doc: i }) {
345
345
  children: m
346
346
  })
347
347
  ]
348
- }), v ? /* @__PURE__ */ V("div", {
348
+ }), _ ? /* @__PURE__ */ V("div", {
349
349
  style: {
350
350
  display: "flex",
351
351
  gap: 6
352
352
  },
353
- children: [/* @__PURE__ */ B(C, {
353
+ children: [/* @__PURE__ */ B(p, {
354
354
  kind: "ghost",
355
355
  size: "sm",
356
- icon: B(o ? e.loader : e.file, { size: 12 }),
357
- onClick: y,
358
- disabled: o,
356
+ icon: B(a ? e.loader : e.file, { size: 12 }),
357
+ onClick: v,
358
+ disabled: a,
359
359
  children: "PDF"
360
- }), /* @__PURE__ */ B(C, {
360
+ }), /* @__PURE__ */ B(p, {
361
361
  kind: "default",
362
362
  size: "sm",
363
- icon: B(c ? e.loader : e.download, { size: 12 }),
364
- onClick: x,
365
- disabled: c,
363
+ icon: B(s ? e.loader : e.download, { size: 12 }),
364
+ onClick: b,
365
+ disabled: s,
366
366
  children: "Download"
367
367
  })]
368
- }) : p ? /* @__PURE__ */ B(C, {
368
+ }) : d ? /* @__PURE__ */ B(p, {
369
369
  kind: "ghost",
370
370
  size: "sm",
371
- icon: B(d ? e.loader : e.file, { size: 12 }),
372
- onClick: S,
373
- disabled: d,
371
+ icon: B(l ? e.loader : e.file, { size: 12 }),
372
+ onClick: x,
373
+ disabled: l,
374
374
  children: "Regenerate"
375
- }) : /* @__PURE__ */ B(C, {
375
+ }) : /* @__PURE__ */ B(p, {
376
376
  kind: "ghost",
377
377
  size: "sm",
378
378
  disabled: !0,
379
- children: i.status === "pending" ? "Pending" : "Unavailable"
379
+ children: r.status === "pending" ? "Pending" : "Unavailable"
380
380
  })]
381
381
  });
382
382
  }
@@ -527,11 +527,11 @@ function lt({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
527
527
  if (c) {
528
528
  let t = a?.find((t) => t.group_code === e), n = t ? c.statuses.find((e) => e.code === t.status_code) : void 0;
529
529
  l.push({
530
- label: u(c.name),
531
- value: n ? /* @__PURE__ */ B(O, {
530
+ label: T(c.name),
531
+ value: n ? /* @__PURE__ */ B(_, {
532
532
  tone: n.color ?? "slate",
533
533
  size: "xs",
534
- children: u(n.name)
534
+ children: T(n.name)
535
535
  }) : /* @__PURE__ */ B("span", {
536
536
  style: { color: "var(--text-4)" },
537
537
  children: "—"
@@ -540,7 +540,7 @@ function lt({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
540
540
  continue;
541
541
  }
542
542
  if (t.fields.get(e) || t.files?.get(e)) {
543
- let a = Ne({
543
+ let a = Me({
544
544
  entity: t,
545
545
  entityCode: n,
546
546
  fieldName: e,
@@ -553,7 +553,7 @@ function lt({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
553
553
  locale: s
554
554
  });
555
555
  l.push({
556
- label: je(t, e, o.entities),
556
+ label: Ae(t, e, o.entities),
557
557
  value: a
558
558
  });
559
559
  continue;
@@ -631,7 +631,7 @@ function ft({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
631
631
  let c = (e) => {
632
632
  if (!e || !t.fields.get(e)) return;
633
633
  let s = r[e];
634
- if (s != null && s !== "") return Ne({
634
+ if (s != null && s !== "") return Me({
635
635
  entity: t,
636
636
  entityCode: n,
637
637
  fieldName: e,
@@ -644,7 +644,7 @@ function ft({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
644
644
  locale: o
645
645
  });
646
646
  }, l = s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
647
- label: u(e.label),
647
+ label: T(e.label),
648
648
  at: c(e.at),
649
649
  by: c(e.by)
650
650
  })) : [{
@@ -689,11 +689,11 @@ function mt({ evidence: e }) {
689
689
  },
690
690
  children: "Evidence"
691
691
  }),
692
- /* @__PURE__ */ B(O, {
693
- tone: We(t),
692
+ /* @__PURE__ */ B(_, {
693
+ tone: Ue(t),
694
694
  size: "sm",
695
695
  dot: !0,
696
- children: Ge(t)
696
+ children: We(t)
697
697
  }),
698
698
  r.length > 0 && /* @__PURE__ */ B("span", {
699
699
  style: {
@@ -715,7 +715,7 @@ function mt({ evidence: e }) {
715
715
  //#endregion
716
716
  //#region src/components/chrome/RecordHeader.tsx
717
717
  var ht = 180, gt = 160;
718
- function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, highlights: o, mode: s, dirty: c = !1, showBack: l = !1, onBack: u, right: d, identityControls: f, showTitle: p = !0 }) {
718
+ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, highlights: o, mode: s, dirty: c = !1, showBack: u = !1, onBack: d, right: f, identityControls: p, showTitle: m = !0 }) {
719
719
  return /* @__PURE__ */ V("div", {
720
720
  style: {
721
721
  display: "flex",
@@ -725,24 +725,24 @@ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
725
725
  minWidth: 0
726
726
  },
727
727
  children: [
728
- p && l && /* @__PURE__ */ B("div", {
728
+ m && u && /* @__PURE__ */ B("div", {
729
729
  style: {
730
730
  paddingTop: 4,
731
731
  flexShrink: 0
732
732
  },
733
- children: /* @__PURE__ */ B(x, {
733
+ children: /* @__PURE__ */ B(l, {
734
734
  size: 26,
735
735
  icon: /* @__PURE__ */ B(e.back, { size: 14 }),
736
736
  title: "Back",
737
- onClick: u
737
+ onClick: d
738
738
  })
739
739
  }),
740
- p && (n || t) && /* @__PURE__ */ B("div", {
740
+ m && (n || t) && /* @__PURE__ */ B("div", {
741
741
  style: {
742
742
  flexShrink: 0,
743
743
  paddingTop: 2
744
744
  },
745
- children: n ? /* @__PURE__ */ B(A, {
745
+ children: n ? /* @__PURE__ */ B(M, {
746
746
  name: n,
747
747
  size: 32
748
748
  }) : /* @__PURE__ */ B("span", {
@@ -759,7 +759,7 @@ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
759
759
  children: t
760
760
  })
761
761
  }),
762
- p && /* @__PURE__ */ V(nt, { children: [
762
+ m && /* @__PURE__ */ V(nt, { children: [
763
763
  /* @__PURE__ */ B("h1", {
764
764
  style: {
765
765
  margin: 0,
@@ -780,12 +780,12 @@ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
780
780
  },
781
781
  children: r
782
782
  }),
783
- i && /* @__PURE__ */ B(me, { value: i }),
784
- a && /* @__PURE__ */ B(j, {
783
+ i && /* @__PURE__ */ B(ge, { value: i }),
784
+ a && /* @__PURE__ */ B(N, {
785
785
  label: a,
786
786
  "data-testid": "detail-description-info"
787
787
  }),
788
- f,
788
+ p,
789
789
  s === "edit" && c && /* @__PURE__ */ V("span", {
790
790
  style: {
791
791
  display: "inline-flex",
@@ -801,14 +801,14 @@ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
801
801
  background: "var(--warn)"
802
802
  } }), "Unsaved"]
803
803
  }),
804
- s === "create" && /* @__PURE__ */ B(O, {
804
+ s === "create" && /* @__PURE__ */ B(_, {
805
805
  tone: "violet",
806
806
  size: "xs",
807
807
  dot: !0,
808
808
  children: "New record"
809
809
  })
810
810
  ] }),
811
- d && /* @__PURE__ */ B("div", {
811
+ f && /* @__PURE__ */ B("div", {
812
812
  role: "toolbar",
813
813
  "aria-label": "Page actions",
814
814
  style: {
@@ -823,7 +823,7 @@ function q({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
823
823
  flexWrap: "wrap",
824
824
  justifyContent: "flex-end"
825
825
  },
826
- children: d
826
+ children: f
827
827
  }),
828
828
  o && s === "display" && /* @__PURE__ */ B("div", {
829
829
  style: {
@@ -894,42 +894,42 @@ function Ct(e, t) {
894
894
  }
895
895
  function wt(e, t) {
896
896
  if (e) {
897
- let n = s(e, t), r = D(n);
897
+ let n = se(e, t), r = A(n);
898
898
  if (r.replace(/^\|+|\|+$/g, "")) return r;
899
899
  }
900
- return t.id == null ? crypto.randomUUID() : k(t.id);
900
+ return t.id == null ? crypto.randomUUID() : O(t.id);
901
901
  }
902
902
  function Tt({ screenCode: e }) {
903
- return /* @__PURE__ */ B(m, { children: /* @__PURE__ */ B(Et, { screenCode: e }) });
903
+ return /* @__PURE__ */ B(E, { children: /* @__PURE__ */ B(Et, { screenCode: e }) });
904
904
  }
905
905
  function Et({ screenCode: t }) {
906
- let { id: n } = $e(), r = te(), [o, c] = et(), { data: l } = a(), m = ne((e) => e.user), h = f(), y = ae(), b = l?.screens[t], C = b?.entity ? l?.entities[b.entity] : void 0, w = b?.entity, T = _(C, "create"), E = _(C, "update"), O = _(C, "restore"), ce = (() => {
907
- if (!C || !C.singleton || !C.prefilter) return;
908
- let e = d(C);
906
+ let { id: n } = $e(), i = g(), [o, d] = et(), { data: p } = ee(), _ = oe((e) => e.user), v = ue(), y = s(), b = p?.screens[t], S = b?.entity ? p?.entities[b.entity] : void 0, w = b?.entity, E = h(S, "create"), D = h(S, "update"), re = h(S, "restore"), O = (() => {
907
+ if (!S || !S.singleton || !S.prefilter) return;
908
+ let e = x(S);
909
909
  if (e.length !== 1) return;
910
- let t = C.prefilter[e[0]];
911
- if (t === "$caller.user_id") return m?.id;
912
- if (t === "$caller.tenant_id") return m?.tenant?.id;
913
- })(), k = ce !== void 0, A = k ? ce : n, j = !k && A === "new", M = L(() => {
914
- if (!A || j) return;
915
- if (!C) return A;
916
- let e = d(C);
917
- if (e.length === 1) return { [e[0]]: A };
918
- let t = re(A, e.length);
910
+ let t = S.prefilter[e[0]];
911
+ if (t === "$caller.user_id") return _?.id;
912
+ if (t === "$caller.tenant_id") return _?.tenant?.id;
913
+ })(), k = O !== void 0, j = k ? O : n, M = !k && j === "new", N = L(() => {
914
+ if (!j || M) return;
915
+ if (!S) return j;
916
+ let e = x(S);
917
+ if (e.length === 1) return { [e[0]]: j };
918
+ let t = r(j, e.length);
919
919
  if (!t) return;
920
920
  let n = {};
921
921
  for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
922
922
  return n;
923
923
  }, [
924
- A,
925
924
  j,
926
- C
927
- ]), de = L(() => {
928
- if (M) return typeof M == "string" ? M : D(M);
929
- }, [M]), N = fe(w, M), { data: me, isLoading: he, error: Ce } = N, Oe = Te((e) => e.degradedEntities), je = w ? Ee(C?.realtime, Oe, w) : !1;
930
- De(pe(w, M), !j);
931
- let Me = we(w ?? ""), Ne = Se(w ?? ""), Fe = xe(w ?? ""), Ve = Object.keys(C?.status_groups ?? {}).length > 0, He = me?.data, Ue = He?.$statuses, We = He?.$properties, Ge = o.get("edit") === "true", [P, Xe] = R(j || Ge), [z, tt] = R({}), [H, it] = R({}), [U, ot] = R({}), [W, G] = R(void 0), [ct, ut] = R(!1), [dt, K] = R(void 0), [pt, ht] = R(!1), gt = j ? T : E, q = P && gt, vt = ie();
932
- S(q && !j, vt.enabled);
925
+ M,
926
+ S
927
+ ]), fe = L(() => {
928
+ if (N) return typeof N == "string" ? N : A(N);
929
+ }, [N]), pe = me(w, N), { data: P, isLoading: ge, error: ye } = pe, De = te((e) => e.degradedEntities), Ae = w ? ce(S?.realtime, De, w) : !1;
930
+ Ce(he(w, N), !M);
931
+ let je = Ee(w ?? ""), Me = Te(w ?? ""), Pe = Se(w ?? ""), Be = Object.keys(S?.status_groups ?? {}).length > 0, Ve = P?.data, He = Ve?.$statuses, Ue = Ve?.$properties, We = o.get("edit") === "true", [qe, Xe] = R(M || We), [z, tt] = R({}), [H, it] = R({}), [U, ot] = R({}), [W, G] = R(void 0), [ct, ut] = R(!1), [dt, K] = R(void 0), [pt, ht] = R(!1), gt = M ? E : D, q = qe && gt, vt = f();
932
+ a(q && !M, vt.enabled);
933
933
  let [bt, Tt] = R(() => {
934
934
  let e = parseInt(b?.sidebar_width || "380", 10);
935
935
  return isNaN(e) ? 380 : e;
@@ -950,7 +950,7 @@ function Et({ screenCode: t }) {
950
950
  J.current && t && Tt(parseInt(t.style.width, 10) || J.current.startW), J.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
951
951
  };
952
952
  document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
953
- }, []), Y = me?.data, X = Pe(C, b, Y ?? {});
953
+ }, []), Y = P?.data, X = Ne(S, b, Y ?? {});
954
954
  I(() => {
955
955
  let e = parseInt(X?.sidebar_width || "380", 10);
956
956
  Tt(Number.isNaN(e) ? 380 : e);
@@ -959,73 +959,73 @@ function Et({ screenCode: t }) {
959
959
  I(() => {
960
960
  if (!Z) return;
961
961
  let e = jt.current;
962
- jt.current = Z, e && e !== Z && P && ut(!0);
963
- }, [P, Z]);
964
- let Mt = !!C?.soft_delete && Y != null && Y[C.soft_delete] != null, Nt = Qe(), Pt = Ze(null);
965
- ue({ scrollElementRef: Pt });
966
- let Ft = !j && Ce instanceof oe && Ce.status === 404, It = j && !le(C), Lt = Ze(null);
962
+ jt.current = Z, e && e !== Z && qe && ut(!0);
963
+ }, [qe, Z]);
964
+ let Mt = !!S?.soft_delete && Y != null && Y[S.soft_delete] != null, Nt = Qe(), Pt = Ze(null);
965
+ de({ scrollElementRef: Pt });
966
+ let Ft = !M && ye instanceof c && ye.status === 404, It = M && !u(S), Lt = Ze(null);
967
967
  I(() => {
968
968
  if (!Ft) return;
969
- let e = _e(Nt);
970
- Lt.current !== e && (Lt.current = e, ge.getState().kill(e));
969
+ let e = xe(Nt);
970
+ Lt.current !== e && (Lt.current = e, _e.getState().kill(e));
971
971
  }, [Ft, Nt]);
972
972
  let { openTab: Rt, updateTabTitle: zt, findTabByPathname: Bt } = ve();
973
973
  I(() => {
974
- if (!C || k || vt.enabled) return;
975
- let e = Nt.pathname, t = u(X?.display?.name) || u(C.display.name), n = X?.display?.icon || C.display.icon;
974
+ if (!S || k || vt.enabled) return;
975
+ let e = Nt.pathname, t = T(X?.display?.name) || T(S.display.name), n = X?.display?.icon || S.display.icon;
976
976
  Bt(e) || Rt({
977
977
  pathname: e,
978
978
  search: "",
979
- title: j ? `New ${t}` : t,
979
+ title: M ? `New ${t}` : t,
980
980
  icon: n,
981
981
  closable: !0
982
982
  });
983
983
  }, [
984
984
  Nt.pathname,
985
985
  X?.display?.name?.en,
986
- C?.display.name?.en,
986
+ S?.display.name?.en,
987
987
  X?.display?.icon,
988
- C?.display.icon,
989
- j,
988
+ S?.display.icon,
989
+ M,
990
990
  k,
991
991
  vt.enabled
992
992
  ]), I(() => {
993
- if (!Y || !C || k || vt.enabled) return;
993
+ if (!Y || !S || k || vt.enabled) return;
994
994
  let e = Bt(Nt.pathname);
995
995
  if (e) {
996
- let t = u(X?.display?.name) || u(C.display.name), n = v(Y, C), r = n && !String(n).startsWith("/") ? String(n) : t;
996
+ let t = T(X?.display?.name) || T(S.display.name), n = C(Y, S), r = n && !String(n).startsWith("/") ? String(n) : t;
997
997
  zt(e.id, r);
998
998
  }
999
999
  }, [
1000
1000
  Y,
1001
- C?.display.name?.en,
1002
- C?.display.display_field,
1001
+ S?.display.name?.en,
1002
+ S?.display.display_field,
1003
1003
  Nt.pathname,
1004
1004
  k,
1005
1005
  vt.enabled
1006
1006
  ]);
1007
1007
  let Vt = L(() => {
1008
- if (!C || !gt) return /* @__PURE__ */ new Set();
1008
+ if (!S || !gt) return /* @__PURE__ */ new Set();
1009
1009
  let e = /* @__PURE__ */ new Set();
1010
- for (let [t, n] of C.fields) !n.auto && !n.primary && e.add(t);
1011
- for (let [t] of C.files ?? []) e.add(t);
1010
+ for (let [t, n] of S.fields) !n.auto && !n.primary && e.add(t);
1011
+ for (let [t] of S.files ?? []) e.add(t);
1012
1012
  return e;
1013
- }, [C, gt]);
1013
+ }, [S, gt]);
1014
1014
  I(() => {
1015
- if (!(!Ge || !Y || !C || !E)) {
1016
- if (P || Xe(!0), Object.keys(z).length === 0) {
1017
- let e = A ? qe(A) : null;
1015
+ if (!(!We || !Y || !S || !D)) {
1016
+ if (qe || Xe(!0), Object.keys(z).length === 0) {
1017
+ let e = j ? Ke(j) : null;
1018
1018
  if (e) {
1019
- let t = ze({
1020
- entity: C,
1019
+ let t = Re({
1020
+ entity: S,
1021
1021
  formData: e,
1022
1022
  record: void 0,
1023
1023
  isNew: !0
1024
1024
  });
1025
- Re(t).forEach((e) => {
1026
- h.registerDraft({
1025
+ Le(t).forEach((e) => {
1026
+ v.registerDraft({
1027
1027
  fileId: e,
1028
- discard: () => p(e)
1028
+ discard: () => ie(e)
1029
1029
  });
1030
1030
  });
1031
1031
  }
@@ -1036,16 +1036,16 @@ function Et({ screenCode: t }) {
1036
1036
  t[n] = r;
1037
1037
  return;
1038
1038
  }
1039
- let i = ke(C, Y, n);
1040
- t[n] = Ie(C, n) ? i ?? null : i ?? "";
1039
+ let i = Oe(S, Y, n);
1040
+ t[n] = Fe(S, n) ? i ?? null : i ?? "";
1041
1041
  }), tt(t);
1042
1042
  }
1043
- if (C.children !== void 0 && C.children.length > 0 && W === void 0) {
1043
+ if (S.children !== void 0 && S.children.length > 0 && W === void 0) {
1044
1044
  let e = Y.$children;
1045
1045
  if (e && Object.keys(e).length > 0) {
1046
1046
  let t = {};
1047
1047
  for (let [n, r] of Object.entries(e)) {
1048
- let e = l?.entities[n];
1048
+ let e = p?.entities[n];
1049
1049
  t[n] = r.map((t) => ({
1050
1050
  ...t,
1051
1051
  _key: wt(e, t)
@@ -1054,36 +1054,36 @@ function Et({ screenCode: t }) {
1054
1054
  G(t), K(e);
1055
1055
  } else G({}), K({});
1056
1056
  }
1057
- c((e) => {
1057
+ d((e) => {
1058
1058
  let t = new URLSearchParams(e);
1059
1059
  return t.delete("edit"), t;
1060
1060
  }, { replace: !0 });
1061
1061
  }
1062
1062
  }, [
1063
- Ge,
1063
+ We,
1064
1064
  Y,
1065
1065
  Vt,
1066
- E,
1067
- C,
1066
+ D,
1067
+ S,
1068
1068
  W,
1069
- l
1069
+ p
1070
1070
  ]), I(() => {
1071
- !j || !T || !C?.children || C.children.length === 0 || W === void 0 && (G({}), K({}));
1071
+ !M || !E || !S?.children || S.children.length === 0 || W === void 0 && (G({}), K({}));
1072
1072
  }, [
1073
- j,
1074
- T,
1075
- C?.children
1073
+ M,
1074
+ E,
1075
+ S?.children
1076
1076
  ]);
1077
1077
  let Ht = F(async () => {
1078
- if (await h.flushAllDrafts(), j) {
1078
+ if (await v.flushAllDrafts(), M) {
1079
1079
  let e = X?.route?.replace("/:id", "") ?? "/";
1080
- r(e);
1080
+ i(e);
1081
1081
  } else Xe(!1), tt({}), it({}), ot({}), G(void 0), K(void 0), ht(!1);
1082
1082
  }, [
1083
- h,
1084
- j,
1083
+ v,
1084
+ M,
1085
1085
  X,
1086
- r
1086
+ i
1087
1087
  ]), Ut = F((e, t) => {
1088
1088
  tt((n) => ({
1089
1089
  ...n,
@@ -1093,46 +1093,46 @@ function Et({ screenCode: t }) {
1093
1093
  if (!X?.route) return "/";
1094
1094
  let e = X.route.split("/");
1095
1095
  return e.pop(), e.join("/") || "/";
1096
- }, [X]), Wt = L(() => !l?.screens || !Q || Q === "/" ? !1 : Object.values(l.screens).some((e) => e.route === Q), [l, Q]), Gt = F(() => {
1096
+ }, [X]), Wt = L(() => !p?.screens || !Q || Q === "/" ? !1 : Object.values(p.screens).some((e) => e.route === Q), [p, Q]), Gt = F(() => {
1097
1097
  if (!Wt) {
1098
- r("/");
1098
+ i("/");
1099
1099
  return;
1100
1100
  }
1101
1101
  let e = Bt(Q)?.search ?? "";
1102
- r(e ? `${Q}?${e}` : Q);
1102
+ i(e ? `${Q}?${e}` : Q);
1103
1103
  }, [
1104
1104
  Wt,
1105
1105
  Q,
1106
1106
  Bt,
1107
- r
1108
- ]), Kt = be({ fallback: Gt }), qt = !k && (Kt.hasOriginBack || Kt.allowFallbackBack && !!Wt), Jt = i(), Yt = L(() => {
1109
- if (!C) return {};
1107
+ i
1108
+ ]), Kt = we({ fallback: Gt }), qt = !k && (Kt.hasOriginBack || Kt.allowFallbackBack && !!Wt), Jt = ae(), Yt = L(() => {
1109
+ if (!S) return {};
1110
1110
  let e = {};
1111
- for (let t of _t(C, z, j)) Vt.has(t) && (e[t] = "Required");
1112
- for (let t of yt(C, z)) Vt.has(t) && (e[t] = "Invalid email address");
1111
+ for (let t of _t(S, z, M)) Vt.has(t) && (e[t] = "Required");
1112
+ for (let t of yt(S, z)) Vt.has(t) && (e[t] = "Invalid email address");
1113
1113
  return e;
1114
1114
  }, [
1115
- C,
1115
+ S,
1116
1116
  z,
1117
- j,
1117
+ M,
1118
1118
  Vt
1119
1119
  ]), Xt = Object.keys(Yt).length > 0, Zt = F(() => {
1120
- if (!w || !C || j && !T || !j && !E || (ht(!0), Xt)) return;
1121
- let e = {}, t = ze({
1122
- entity: C,
1120
+ if (!w || !S || M && !E || !M && !D || (ht(!0), Xt)) return;
1121
+ let e = {}, t = Re({
1122
+ entity: S,
1123
1123
  formData: z,
1124
1124
  record: Y,
1125
- isNew: j
1126
- }), n = Re(t);
1127
- if (j) for (let [t, n] of Object.entries(z)) {
1128
- if (C.files?.has(t)) continue;
1129
- let r = Ae(C, t, n);
1125
+ isNew: M
1126
+ }), n = Le(t);
1127
+ if (M) for (let [t, n] of Object.entries(z)) {
1128
+ if (S.files?.has(t)) continue;
1129
+ let r = ke(S, t, n);
1130
1130
  r !== "" && r != null && (e[t] = r);
1131
1131
  }
1132
1132
  else {
1133
1133
  for (let [t, n] of Object.entries(z)) {
1134
- if (C.files?.has(t)) continue;
1135
- let r = Y ? ke(C, Y, t) : void 0, i = Ae(C, t, n), a = Ae(C, t, r);
1134
+ if (S.files?.has(t)) continue;
1135
+ let r = Y ? Oe(S, Y, t) : void 0, i = ke(S, t, n), a = ke(S, t, r);
1136
1136
  (i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
1137
1137
  }
1138
1138
  Z && (e.$row_version = Z);
@@ -1150,37 +1150,37 @@ function Et({ screenCode: t }) {
1150
1150
  let { _key: t, _deleted: n, _dirty: r, ...i } = e;
1151
1151
  return i;
1152
1152
  }), i = dt?.[e] ?? [];
1153
- (j || !Ct(r, i)) && (t[e] = r);
1153
+ (M || !Ct(r, i)) && (t[e] = r);
1154
1154
  }
1155
1155
  Object.keys(t).length > 0 && (e.$children = t);
1156
1156
  }
1157
- if (!j && Object.keys(e).length === 0) {
1157
+ if (!M && Object.keys(e).length === 0) {
1158
1158
  Xe(!1), it({}), ot({}), G(void 0), K(void 0), ht(!1);
1159
1159
  return;
1160
1160
  }
1161
- let i = () => {
1161
+ let r = () => {
1162
1162
  Xe(!1), ut(!1), ht(!1), it({}), ot({}), G(void 0), K(void 0);
1163
1163
  };
1164
- j ? Me.mutate(e, { onSuccess: (e) => {
1165
- n.forEach((e) => h.markCommitted(e));
1166
- let t = e.data, a = C ? s(C, t) : {}, o = D(a);
1167
- r(o ? `${Q}/${encodeURIComponent(o)}` : Q, { replace: !0 }), i();
1168
- } }) : M && Ne.mutate({
1169
- pkValues: M,
1164
+ M ? je.mutate(e, { onSuccess: (e) => {
1165
+ n.forEach((e) => v.markCommitted(e));
1166
+ let t = e.data, a = S ? se(S, t) : {}, o = A(a);
1167
+ i(o ? `${Q}/${encodeURIComponent(o)}` : Q, { replace: !0 }), r();
1168
+ } }) : N && Me.mutate({
1169
+ pkValues: N,
1170
1170
  data: e
1171
1171
  }, {
1172
1172
  onSuccess: () => {
1173
- n.forEach((e) => h.markCommitted(e)), i();
1173
+ n.forEach((e) => v.markCommitted(e)), r();
1174
1174
  },
1175
1175
  onError: (e) => {
1176
- e instanceof oe && e.code === "entity.stale_object" && ut(!0);
1176
+ e instanceof c && e.code === "entity.stale_object" && ut(!0);
1177
1177
  }
1178
1178
  });
1179
1179
  }, [
1180
- h,
1181
- j,
1182
- T,
1180
+ v,
1181
+ M,
1183
1182
  E,
1183
+ D,
1184
1184
  w,
1185
1185
  z,
1186
1186
  Xt,
@@ -1188,29 +1188,29 @@ function Et({ screenCode: t }) {
1188
1188
  U,
1189
1189
  W,
1190
1190
  dt,
1191
+ je,
1191
1192
  Me,
1192
- Ne,
1193
- C,
1194
- r,
1193
+ S,
1194
+ i,
1195
1195
  Q,
1196
1196
  Y,
1197
1197
  Z,
1198
- M
1198
+ N
1199
1199
  ]), Qt = F((e, t) => {
1200
1200
  G((n) => ({
1201
1201
  ...n ?? {},
1202
1202
  [e]: t
1203
1203
  }));
1204
1204
  }, []), $t = F(() => {
1205
- !M || j || !O || Fe.mutate(M);
1205
+ !N || M || !re || Pe.mutate(N);
1206
1206
  }, [
1207
+ N,
1207
1208
  M,
1208
- j,
1209
- O,
1210
- Fe
1211
- ]), en = L(() => xt(W, l), [W, l]), tn = Object.keys(en).length > 0;
1212
- if (!X || !C) return null;
1213
- if (!j && he) return /* @__PURE__ */ B(Le, {});
1209
+ re,
1210
+ Pe
1211
+ ]), en = L(() => xt(W, p), [W, p]), tn = Object.keys(en).length > 0;
1212
+ if (!X || !S) return null;
1213
+ if (!M && ge) return /* @__PURE__ */ B(Ie, {});
1214
1214
  if (It) return /* @__PURE__ */ V("div", {
1215
1215
  style: { padding: 24 },
1216
1216
  children: [/* @__PURE__ */ V("div", {
@@ -1220,7 +1220,7 @@ function Et({ screenCode: t }) {
1220
1220
  gap: 8,
1221
1221
  marginBottom: 8
1222
1222
  },
1223
- children: [qt && /* @__PURE__ */ B(x, {
1223
+ children: [qt && /* @__PURE__ */ B(l, {
1224
1224
  icon: /* @__PURE__ */ B(e.back, { size: 14 }),
1225
1225
  onClick: Kt.goBack,
1226
1226
  title: "Back"
@@ -1238,7 +1238,7 @@ function Et({ screenCode: t }) {
1238
1238
  children: "This record type is not created from a form."
1239
1239
  })]
1240
1240
  });
1241
- if (!j && !Y || Ft) return /* @__PURE__ */ V("div", {
1241
+ if (!M && !Y || Ft) return /* @__PURE__ */ V("div", {
1242
1242
  style: { padding: 24 },
1243
1243
  children: [/* @__PURE__ */ V("div", {
1244
1244
  style: {
@@ -1247,7 +1247,7 @@ function Et({ screenCode: t }) {
1247
1247
  gap: 8,
1248
1248
  marginBottom: 8
1249
1249
  },
1250
- children: [qt && /* @__PURE__ */ B(x, {
1250
+ children: [qt && /* @__PURE__ */ B(l, {
1251
1251
  icon: /* @__PURE__ */ B(e.back, { size: 14 }),
1252
1252
  onClick: Kt.goBack,
1253
1253
  title: "Back"
@@ -1265,24 +1265,24 @@ function Et({ screenCode: t }) {
1265
1265
  children: "Record not found."
1266
1266
  })]
1267
1267
  });
1268
- let nn = C.display, rn = u(X.display?.name) || u(nn.name), an = v(Y, C), on = j ? `New ${rn}` : an ? String(an) : rn, sn = Me.isPending || Ne.isPending, cn = X.responsive?.[y.category]?.layout, ln = cn?.tabs ?? (y.isPhone ? "sections" : void 0), un = cn?.header_card === !0 ? Be({
1269
- entity: C,
1268
+ let nn = S.display, rn = T(X.display?.name) || T(nn.name), an = C(Y, S), on = M ? `New ${rn}` : an ? String(an) : rn, sn = je.isPending || Me.isPending, cn = X.responsive?.[y.category]?.layout, ln = cn?.tabs ?? (y.isPhone ? "sections" : void 0), un = cn?.header_card === !0 ? ze({
1269
+ entity: S,
1270
1270
  screen: X
1271
1271
  }) : void 0, $ = {
1272
- schema: l,
1273
- entity: C,
1272
+ schema: p,
1273
+ entity: S,
1274
1274
  entityCode: w,
1275
- recordId: de ?? A ?? "",
1275
+ recordId: fe ?? j ?? "",
1276
1276
  record: q ? {
1277
1277
  ...Y ?? {},
1278
1278
  ...z
1279
1279
  } : Y ?? {},
1280
- isNew: j,
1280
+ isNew: M,
1281
1281
  mode: q ? "edit" : "display",
1282
1282
  onFieldChange: q ? Ut : void 0,
1283
1283
  refs: At,
1284
1284
  objectProperties: (() => {
1285
- let e = We ?? [];
1285
+ let e = Ue ?? [];
1286
1286
  if (!q || Object.keys(U).length === 0) return e.length > 0 ? e : void 0;
1287
1287
  let t = e.map((e) => U[e.property_code] === void 0 ? e : {
1288
1288
  ...e,
@@ -1296,13 +1296,13 @@ function Et({ screenCode: t }) {
1296
1296
  });
1297
1297
  return t;
1298
1298
  })(),
1299
- onSetProperty: j || !E ? void 0 : q ? (e, t) => ot((n) => ({
1299
+ onSetProperty: M || !D ? void 0 : q ? (e, t) => ot((n) => ({
1300
1300
  ...n,
1301
1301
  [e]: t
1302
1302
  })) : void 0,
1303
1303
  isPropertyPending: !1,
1304
1304
  objectStatuses: (() => {
1305
- let e = Ue ?? [];
1305
+ let e = He ?? [];
1306
1306
  if (!q || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
1307
1307
  let t = e.map((e) => H[e.group_code] === void 0 ? e : {
1308
1308
  ...e,
@@ -1312,11 +1312,11 @@ function Et({ screenCode: t }) {
1312
1312
  group_code: n,
1313
1313
  status_code: r,
1314
1314
  status_name: {},
1315
- set_at: g()
1315
+ set_at: ne()
1316
1316
  });
1317
1317
  return t;
1318
1318
  })(),
1319
- onSetStatus: j || !E ? void 0 : q ? (e, t) => it((n) => ({
1319
+ onSetStatus: M || !D ? void 0 : q ? (e, t) => it((n) => ({
1320
1320
  ...n,
1321
1321
  [e]: t
1322
1322
  })) : void 0,
@@ -1327,32 +1327,32 @@ function Et({ screenCode: t }) {
1327
1327
  fieldErrors: q && pt ? Yt : void 0,
1328
1328
  detailTabsPresentation: ln,
1329
1329
  relatedRecordsPresentation: cn?.related_records
1330
- }, dn = !!X.sidebar && X.sidebar.length > 0, fn = cn?.sidebar === "hidden", pn = dn && !fn && !y.isDesktop, mn = dn && !fn && y.isDesktop, hn = !j && Y ? /* @__PURE__ */ B(lt, {
1330
+ }, dn = !!X.sidebar && X.sidebar.length > 0, fn = cn?.sidebar === "hidden", pn = dn && !fn && !y.isDesktop, mn = dn && !fn && y.isDesktop, hn = !M && Y ? /* @__PURE__ */ B(lt, {
1331
1331
  screen: X,
1332
- entity: C,
1332
+ entity: S,
1333
1333
  entityCode: w,
1334
1334
  record: Y,
1335
1335
  refs: At,
1336
- objectStatuses: Ue,
1337
- schema: l,
1336
+ objectStatuses: He,
1337
+ schema: p,
1338
1338
  locale: Jt
1339
1339
  }) : void 0, gn = /* @__PURE__ */ B(kt, {
1340
1340
  title: on,
1341
- recordId: A,
1341
+ recordId: j,
1342
1342
  editing: q,
1343
- isNew: j,
1343
+ isNew: M,
1344
1344
  isRecordDeleted: Mt,
1345
- dirty: P,
1345
+ dirty: qe,
1346
1346
  isSaving: sn,
1347
1347
  hasChildErrors: tn,
1348
1348
  hasFieldErrors: pt && Xt,
1349
- canRestore: O,
1350
- entity: C,
1349
+ canRestore: re,
1350
+ entity: S,
1351
1351
  screen: X,
1352
- globalActions: l?.actions,
1352
+ globalActions: p?.actions,
1353
1353
  entityCode: w,
1354
1354
  record: Y,
1355
- id: A,
1355
+ id: j,
1356
1356
  listRoute: Q,
1357
1357
  listRouteExists: !!Wt,
1358
1358
  highlights: hn,
@@ -1361,15 +1361,14 @@ function Et({ screenCode: t }) {
1361
1361
  onCancelEdit: Ht,
1362
1362
  onSave: Zt,
1363
1363
  onRestore: $t,
1364
- isRestoring: Fe.isPending,
1364
+ isRestoring: Pe.isPending,
1365
1365
  refreshControl: {
1366
- refetch: N.refetch,
1367
- isFetching: N.isFetching,
1368
- isLoading: N.isLoading,
1369
- isLive: je
1366
+ refetch: pe.refetch,
1367
+ isLoading: pe.isLoading,
1368
+ isLive: Ae
1370
1369
  },
1371
- isRealtimeEntity: C?.realtime === !0,
1372
- canManageTemplates: Ke(l)
1370
+ isRealtimeEntity: S?.realtime === !0,
1371
+ canManageTemplates: Ge(p)
1373
1372
  }), _n = Mt && /* @__PURE__ */ V("div", {
1374
1373
  style: {
1375
1374
  display: "flex",
@@ -1383,7 +1382,7 @@ function Et({ screenCode: t }) {
1383
1382
  color: "var(--danger)",
1384
1383
  fontSize: 12.5
1385
1384
  },
1386
- children: [/* @__PURE__ */ B(e.warning, { size: 14 }), /* @__PURE__ */ V("span", { children: ["This record was deleted on ", ee(String(Y[C.soft_delete]))] })]
1385
+ children: [/* @__PURE__ */ B(e.warning, { size: 14 }), /* @__PURE__ */ V("span", { children: ["This record was deleted on ", le(String(Y[S.soft_delete]))] })]
1387
1386
  }), vn = ct && /* @__PURE__ */ V("div", {
1388
1387
  style: {
1389
1388
  display: "flex",
@@ -1400,10 +1399,10 @@ function Et({ screenCode: t }) {
1400
1399
  children: [/* @__PURE__ */ B(e.warning, { size: 14 }), /* @__PURE__ */ B("span", { children: "This record changed on the server while you were viewing or editing it." })]
1401
1400
  }), yn = q && pt && Xt && /* @__PURE__ */ B(st, {
1402
1401
  errors: Object.entries(Yt).map(([e, t]) => {
1403
- let n = C.fields.get(e);
1402
+ let n = S.fields.get(e);
1404
1403
  return {
1405
1404
  name: e,
1406
- label: n ? se(n, e, l?.entities) : e,
1405
+ label: n ? m(n, e, p?.entities) : e,
1407
1406
  message: t
1408
1407
  };
1409
1408
  }),
@@ -1414,52 +1413,52 @@ function Et({ screenCode: t }) {
1414
1413
  behavior: "smooth"
1415
1414
  }), t.focus?.());
1416
1415
  }
1417
- }), bn = Ve && !j && !(X.items && X.items.length > 0) && /* @__PURE__ */ B("div", {
1416
+ }), bn = Be && !M && !(X.items && X.items.length > 0) && /* @__PURE__ */ B("div", {
1418
1417
  className: "mb-4",
1419
1418
  children: /* @__PURE__ */ B(Je, {
1420
- statusGroups: C.status_groups ?? {},
1419
+ statusGroups: S.status_groups ?? {},
1421
1420
  objectStatuses: $.objectStatuses,
1422
- onSetStatus: E && q ? (e, t) => it((n) => ({
1421
+ onSetStatus: D && q ? (e, t) => it((n) => ({
1423
1422
  ...n,
1424
1423
  [e]: t
1425
1424
  })) : St,
1426
1425
  isPending: !1,
1427
1426
  mode: q ? "edit" : "display"
1428
1427
  })
1429
- }), xn = C.evidence_covered && !j && Y && /* @__PURE__ */ B("div", {
1428
+ }), xn = S.evidence_covered && !M && Y && /* @__PURE__ */ B("div", {
1430
1429
  className: "mb-4",
1431
1430
  children: /* @__PURE__ */ B(mt, { evidence: Y.$evidence })
1432
1431
  }), Sn = /* @__PURE__ */ V(nt, { children: [
1433
- un && (Y || j) && /* @__PURE__ */ B(Dt, {
1432
+ un && (Y || M) && /* @__PURE__ */ B(Dt, {
1434
1433
  card: un,
1435
- entity: C,
1434
+ entity: S,
1436
1435
  record: $.record,
1437
1436
  objectStatuses: $.objectStatuses,
1438
1437
  objectProperties: $.objectProperties
1439
1438
  }),
1440
- X.items && X.items.length > 0 && (Y || j) && l && /* @__PURE__ */ B(Ye, {
1439
+ X.items && X.items.length > 0 && (Y || M) && p && /* @__PURE__ */ B(Ye, {
1441
1440
  nodes: X.items,
1442
1441
  ctx: $
1443
1442
  }),
1444
- !j && A && w && C.associations && Object.keys(C.associations).length > 0 && l && /* @__PURE__ */ B(rt, {
1443
+ !M && j && w && S.associations && Object.keys(S.associations).length > 0 && p && /* @__PURE__ */ B(rt, {
1445
1444
  entityCode: w,
1446
- recordId: de ?? A ?? "",
1447
- associations: C.associations,
1448
- schema: l
1445
+ recordId: fe ?? j ?? "",
1446
+ associations: S.associations,
1447
+ schema: p
1449
1448
  }),
1450
- !j && A && w && /* @__PURE__ */ B(at, {
1449
+ !M && j && w && /* @__PURE__ */ B(at, {
1451
1450
  entityCode: w,
1452
- objectId: de ?? A,
1453
- canGenerateOne: !!C?.documents?.generate_one,
1454
- canManageTemplates: Ke(l)
1451
+ objectId: fe ?? j,
1452
+ canGenerateOne: !!S?.documents?.generate_one,
1453
+ canManageTemplates: Ge(p)
1455
1454
  }),
1456
- !j && Y && l && /* @__PURE__ */ B(ft, {
1455
+ !M && Y && p && /* @__PURE__ */ B(ft, {
1457
1456
  screen: X,
1458
- entity: C,
1457
+ entity: S,
1459
1458
  entityCode: w,
1460
1459
  record: Y,
1461
1460
  refs: At,
1462
- schema: l,
1461
+ schema: p,
1463
1462
  locale: Jt
1464
1463
  })
1465
1464
  ] });
@@ -1527,14 +1526,14 @@ function Et({ screenCode: t }) {
1527
1526
  height: "100%",
1528
1527
  width: `${bt}px`
1529
1528
  },
1530
- children: (Y || j) && l && /* @__PURE__ */ B(Ye, {
1529
+ children: (Y || M) && p && /* @__PURE__ */ B(Ye, {
1531
1530
  nodes: X.sidebar,
1532
1531
  ctx: $
1533
1532
  })
1534
1533
  })
1535
1534
  ]
1536
1535
  });
1537
- let Cn = y.isPhone ? ye(12) : {
1536
+ let Cn = y.isPhone ? be(12) : {
1538
1537
  paddingLeft: "24px",
1539
1538
  paddingRight: "24px"
1540
1539
  };
@@ -1576,7 +1575,7 @@ function Et({ screenCode: t }) {
1576
1575
  minWidth: 0,
1577
1576
  WebkitOverflowScrolling: "touch"
1578
1577
  },
1579
- children: [Sn, pn && (Y || j) && l && /* @__PURE__ */ B("div", {
1578
+ children: [Sn, pn && (Y || M) && p && /* @__PURE__ */ B("div", {
1580
1579
  "data-testid": "detail-sidebar-inline",
1581
1580
  style: {
1582
1581
  display: "flex",
@@ -1595,14 +1594,14 @@ function Et({ screenCode: t }) {
1595
1594
  function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
1596
1595
  let a = (e) => {
1597
1596
  let a = J(t, e, n, r, i);
1598
- return a != null && k(a) !== "";
1597
+ return a != null && O(a) !== "";
1599
1598
  }, o = (e) => {
1600
1599
  let a = J(t, e, n, r, i);
1601
- return k(a) || /* @__PURE__ */ B("span", {
1600
+ return O(a) || /* @__PURE__ */ B("span", {
1602
1601
  style: { color: "var(--text-3)" },
1603
1602
  children: "-"
1604
1603
  });
1605
- }, s = e.titleUsesDisplay ? v(n, t) : e.titleField ? J(t, e.titleField, n, r, i) : void 0, c = k(s) || u(t.display?.name) || "Record", l = e.badgeFields.filter((t) => !e.hideEmptyFields || a(t)), d = e.bodyFields.filter((t) => !e.hideEmptyFields || a(t)), f = e.metaFields.filter((t) => !e.hideEmptyFields || a(t));
1604
+ }, s = e.titleUsesDisplay ? C(n, t) : e.titleField ? J(t, e.titleField, n, r, i) : void 0, c = O(s) || T(t.display?.name) || "Record", l = e.badgeFields.filter((t) => !e.hideEmptyFields || a(t)), u = e.bodyFields.filter((t) => !e.hideEmptyFields || a(t)), d = e.metaFields.filter((t) => !e.hideEmptyFields || a(t));
1606
1605
  return /* @__PURE__ */ V("section", {
1607
1606
  "data-testid": "detail-header-card",
1608
1607
  style: {
@@ -1660,7 +1659,7 @@ function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1660
1659
  children: o(e)
1661
1660
  }, e))
1662
1661
  }),
1663
- d.length > 0 && /* @__PURE__ */ B("dl", {
1662
+ u.length > 0 && /* @__PURE__ */ B("dl", {
1664
1663
  style: {
1665
1664
  display: "grid",
1666
1665
  gridTemplateColumns: "minmax(84px, max-content) minmax(0, 1fr)",
@@ -1669,7 +1668,7 @@ function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1669
1668
  fontSize: 12.5,
1670
1669
  lineHeight: 1.35
1671
1670
  },
1672
- children: d.map((e) => /* @__PURE__ */ V("div", {
1671
+ children: u.map((e) => /* @__PURE__ */ V("div", {
1673
1672
  style: { display: "contents" },
1674
1673
  children: [/* @__PURE__ */ B("dt", {
1675
1674
  style: { color: "var(--text-3)" },
@@ -1685,7 +1684,7 @@ function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1685
1684
  })]
1686
1685
  }, e))
1687
1686
  }),
1688
- f.length > 0 && /* @__PURE__ */ B("div", {
1687
+ d.length > 0 && /* @__PURE__ */ B("div", {
1689
1688
  style: {
1690
1689
  display: "flex",
1691
1690
  flexWrap: "wrap",
@@ -1694,7 +1693,7 @@ function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1694
1693
  color: "var(--text-3)",
1695
1694
  fontSize: 11.5
1696
1695
  },
1697
- children: f.map((e) => /* @__PURE__ */ V("span", {
1696
+ children: d.map((e) => /* @__PURE__ */ V("span", {
1698
1697
  style: {
1699
1698
  minWidth: 0,
1700
1699
  overflowWrap: "anywhere"
@@ -1712,73 +1711,73 @@ function Dt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1712
1711
  function J(e, t, n, r, i) {
1713
1712
  if (t.startsWith("$status.")) {
1714
1713
  let e = t.slice(8), n = r?.find((t) => t.group_code === e);
1715
- return u(n?.status_name) || n?.status_code;
1714
+ return T(n?.status_name) || n?.status_code;
1716
1715
  }
1717
1716
  if (t.startsWith("$property.")) {
1718
1717
  let e = t.slice(10);
1719
1718
  return i?.find((t) => t.property_code === e)?.value;
1720
1719
  }
1721
- return ke(e, n, t);
1720
+ return Oe(e, n, t);
1722
1721
  }
1723
1722
  function Ot(e, t) {
1724
1723
  if (t.startsWith("$status.")) return t.slice(8);
1725
1724
  if (t.startsWith("$property.")) return t.slice(10);
1726
1725
  let n = e.fields.get(t);
1727
- return n ? se(n, t) : t;
1726
+ return n ? m(n, t) : t;
1728
1727
  }
1729
- function kt({ title: n, recordId: a, editing: o, isNew: s, isRecordDeleted: c, dirty: d, isSaving: f, hasChildErrors: p, hasFieldErrors: ee, canRestore: m, entity: h, screen: g, globalActions: _, entityCode: v, record: x, id: S, listRoute: E, listRouteExists: D, highlights: ne, showBack: re, onBack: ie, onCancelEdit: ae, onSave: oe, onRestore: O, isRestoring: se, refreshControl: ce, isRealtimeEntity: le, canManageTemplates: k }) {
1730
- let { run: A } = T(), j = M("detail"), ue = Ce(), fe = te(), N = i(), pe = l(g?.action_layout, h?.action_layout, h?.actions, _, "detail_toolbar"), me = l(g?.action_layout, h?.action_layout, h?.actions, _, "detail"), he = y(me, h?.actions, _, x ?? {}, [], Me(h, x ?? {})), ve = y(pe, h?.actions, _, x ?? {}, [], Me(h, x ?? {})), ye = L(() => {
1731
- if (!h) return;
1732
- let e = S ? [S] : [];
1728
+ function kt({ title: r, recordId: i, editing: a, isNew: s, isRecordDeleted: c, dirty: l, isSaving: u, hasChildErrors: f, hasFieldErrors: m, canRestore: h, entity: _, screen: v, globalActions: y, entityCode: x, record: S, id: C, listRoute: ee, listRouteExists: E, highlights: te, showBack: ne, onBack: D, onCancelEdit: O, onSave: ie, onRestore: oe, isRestoring: se, refreshControl: k, isRealtimeEntity: ce, canManageTemplates: le }) {
1729
+ let { run: ue } = re(), A = fe("detail"), j = ye(), M = g(), N = ae(), de = n(v?.action_layout, _?.action_layout, _?.actions, y, "detail_toolbar"), me = n(v?.action_layout, _?.action_layout, _?.actions, y, "detail"), P = b(me, _?.actions, y, S ?? {}, [], je(_, S ?? {})), he = b(de, _?.actions, y, S ?? {}, [], je(_, S ?? {})), ge = L(() => {
1730
+ if (!_) return;
1731
+ let e = C ? [C] : [];
1733
1732
  return {
1734
- entity: h,
1735
- entityCode: v ?? "",
1736
- screen: g,
1737
- screenRoute: g?.route ?? "",
1738
- selectedRows: x ? [x] : [],
1733
+ entity: _,
1734
+ entityCode: x ?? "",
1735
+ screen: v,
1736
+ screenRoute: v?.route ?? "",
1737
+ selectedRows: S ? [S] : [],
1739
1738
  selectedIds: e,
1740
1739
  locale: N,
1741
- tabNavigate: (e, t) => ue(e, {
1740
+ tabNavigate: (e, t) => j(e, {
1742
1741
  title: t?.title,
1743
1742
  icon: t?.icon,
1744
1743
  search: t?.search
1745
1744
  }),
1746
- runActionApi: (e, t) => b(e, t)
1745
+ runActionApi: (e, t) => w(e, t)
1747
1746
  };
1748
1747
  }, [
1749
- h,
1748
+ _,
1749
+ x,
1750
1750
  v,
1751
- g,
1751
+ C,
1752
1752
  S,
1753
- x,
1754
1753
  N,
1755
- ue
1756
- ]), be = (e, t) => {
1757
- let n = Fe(e, t, { row: x ?? void 0 });
1754
+ j
1755
+ ]), ve = (e, t) => {
1756
+ let n = Pe(e, t, { row: S ?? void 0 });
1758
1757
  if (n === null) return;
1759
- let r = S ? [S] : [], i = e === "__delete" && D ? E : null;
1760
- return A({
1758
+ let r = C ? [C] : [], i = e === "__delete" && E ? ee : null;
1759
+ return ue({
1761
1760
  action: t,
1762
- title: u(t.display?.name) || e,
1763
- row: x ?? void 0,
1764
- execute: (e) => b(n, w(e, r)),
1761
+ title: T(t.display?.name) || e,
1762
+ row: S ?? void 0,
1763
+ execute: (e) => w(n, d(e, r)),
1765
1764
  onSuccess: i ? () => {
1766
- ge.getState().kill(_e(location)), fe(i, { replace: !0 });
1765
+ _e.getState().kill(xe(location)), M(i, { replace: !0 });
1767
1766
  } : void 0
1768
1767
  });
1769
- }, xe = j.isVisible("show_actions") && !s && S && he.length > 0 ? /* @__PURE__ */ B(Oe, {
1770
- layout: he,
1771
- row: x,
1772
- onRun: be,
1768
+ }, be = A.isVisible("show_actions") && !s && C && P.length > 0 ? /* @__PURE__ */ B(De, {
1769
+ layout: P,
1770
+ row: S,
1771
+ onRun: ve,
1773
1772
  kind: "detail",
1774
- entityActions: h?.actions,
1775
- globalActions: _,
1773
+ entityActions: _?.actions,
1774
+ globalActions: y,
1776
1775
  reservedRightWidth: 0,
1777
- widgetContext: ye
1778
- }) : null, Se = !s && S ? /* @__PURE__ */ B(de, {
1779
- liveObject: ce,
1780
- realtime: le
1781
- }) : null, we = j.isVisible("show_actions") && !s && S && ve.length > 0 ? /* @__PURE__ */ V("div", {
1776
+ widgetContext: ge
1777
+ }) : null, Se = !s && C ? /* @__PURE__ */ B(pe, {
1778
+ liveObject: k,
1779
+ realtime: ce
1780
+ }) : null, Ce = A.isVisible("show_actions") && !s && C && he.length > 0 ? /* @__PURE__ */ V("div", {
1782
1781
  style: {
1783
1782
  display: "flex",
1784
1783
  justifyContent: "flex-end",
@@ -1786,62 +1785,62 @@ function kt({ title: n, recordId: a, editing: o, isNew: s, isRecordDeleted: c, d
1786
1785
  gap: 8,
1787
1786
  marginTop: 10
1788
1787
  },
1789
- children: [xe ? null : Se, /* @__PURE__ */ B(Oe, {
1790
- layout: ve,
1791
- row: x,
1792
- onRun: be,
1788
+ children: [be ? null : Se, /* @__PURE__ */ B(De, {
1789
+ layout: he,
1790
+ row: S,
1791
+ onRun: ve,
1793
1792
  kind: "detail",
1794
- entityActions: h?.actions,
1795
- globalActions: _,
1793
+ entityActions: _?.actions,
1794
+ globalActions: y,
1796
1795
  reservedRightWidth: 0,
1797
- widgetContext: ye,
1798
- ariaLabel: xe ? "Detail toolbar actions" : "Page actions"
1796
+ widgetContext: ge,
1797
+ ariaLabel: be ? "Detail toolbar actions" : "Page actions"
1799
1798
  })]
1800
- }) : null, Te = j.isVisible("show_actions") && !s && S && v ? /* @__PURE__ */ B(P, {
1801
- entityCode: v,
1799
+ }) : null, we = A.isVisible("show_actions") && !s && C && x ? /* @__PURE__ */ B(qe, {
1800
+ entityCode: x,
1802
1801
  scope: "detail",
1803
- objectIds: [S],
1804
- capability: h?.documents,
1805
- canManageTemplates: k
1806
- }) : null, Ee = c ? m ? /* @__PURE__ */ B(C, {
1802
+ objectIds: [C],
1803
+ capability: _?.documents,
1804
+ canManageTemplates: le
1805
+ }) : null, Te = c ? h ? /* @__PURE__ */ B(p, {
1807
1806
  kind: "primary",
1808
- icon: B(se ? r : e.refresh, { size: 13 }),
1809
- onClick: O,
1807
+ icon: B(se ? o : e.refresh, { size: 13 }),
1808
+ onClick: oe,
1810
1809
  disabled: se,
1811
1810
  children: se ? "Restoring…" : "Restore"
1812
- }) : null : o ? /* @__PURE__ */ V(nt, { children: [/* @__PURE__ */ B(C, {
1811
+ }) : null : a ? /* @__PURE__ */ V(nt, { children: [/* @__PURE__ */ B(p, {
1813
1812
  icon: /* @__PURE__ */ B(e.x, { size: 13 }),
1814
- onClick: ae,
1815
- disabled: f,
1813
+ onClick: O,
1814
+ disabled: u,
1816
1815
  children: "Cancel"
1817
- }), /* @__PURE__ */ B(C, {
1816
+ }), /* @__PURE__ */ B(p, {
1818
1817
  kind: "primary",
1819
- icon: B(f ? r : e.save, { size: 13 }),
1820
- onClick: oe,
1821
- disabled: f || p || ee,
1822
- title: p ? "Fix errors in child rows" : ee ? "Fix the highlighted fields" : void 0,
1823
- children: f ? "Saving…" : "Save"
1824
- })] }) : !s && S ? xe ? /* @__PURE__ */ V("span", {
1818
+ icon: B(u ? o : e.save, { size: 13 }),
1819
+ onClick: ie,
1820
+ disabled: u || f || m,
1821
+ title: f ? "Fix errors in child rows" : m ? "Fix the highlighted fields" : void 0,
1822
+ children: u ? "Saving…" : "Save"
1823
+ })] }) : !s && C ? be ? /* @__PURE__ */ V("span", {
1825
1824
  style: { display: "contents" },
1826
- children: [Te, xe]
1827
- }) : Te : null;
1825
+ children: [we, be]
1826
+ }) : we : null;
1828
1827
  return /* @__PURE__ */ V(nt, { children: [/* @__PURE__ */ B(q, {
1829
- icon: h?.display.icon ? /* @__PURE__ */ B(t, {
1830
- name: h.display.icon,
1828
+ icon: _?.display.icon ? /* @__PURE__ */ B(t, {
1829
+ name: _.display.icon,
1831
1830
  size: 16
1832
1831
  }) : void 0,
1833
- title: n,
1834
- description: u(g?.display?.description) || u(h?.display?.description),
1835
- recordId: a,
1836
- highlights: ne,
1837
- identityControls: !c && !o && !s ? Se : null,
1838
- mode: s ? "create" : o ? "edit" : "display",
1839
- dirty: d,
1840
- showBack: re,
1841
- onBack: ie,
1842
- right: Ee,
1843
- showTitle: j.isVisible("show_title")
1844
- }), we] });
1832
+ title: r,
1833
+ description: T(v?.display?.description) || T(_?.display?.description),
1834
+ recordId: i,
1835
+ highlights: te,
1836
+ identityControls: !c && !a && !s ? Se : null,
1837
+ mode: s ? "create" : a ? "edit" : "display",
1838
+ dirty: l,
1839
+ showBack: ne,
1840
+ onBack: D,
1841
+ right: Te,
1842
+ showTitle: A.isVisible("show_title")
1843
+ }), Ce] });
1845
1844
  }
1846
1845
  //#endregion
1847
1846
  export { Tt as SmartDetailPage };