@declarion/react 0.43.0 → 0.45.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.
@@ -1,20 +1,20 @@
1
1
  import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { $ as n, A as r, At as i, C as a, Cn as o, Ct as s, D as c, En as l, F as u, Fn as d, In as f, L as p, N as m, On as h, Pn as g, Q as _, Sn as v, Xn as y, _ as b, bn as x, bt as S, cr as ee, dt as te, gt as C, i as w, it as ne, j as T, jt as re, lr as E, nr as ie, pt as ae, sr as oe, un as se, wn as D, wt as O, xn as ce, yn as le } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { E as ue, L as k, R as A, V as j, _ as M, b as de, c as fe, d as pe, f as me, m as he, n as ge, o as _e, r as ve, t as ye, w as be } from "./RefreshControl-DFh0-gCb.js";
4
- import { E as xe, F as Se, G as Ce, I as we, J as Te, K as Ee, M as De, O as Oe, U as ke, W as Ae, Y as je, _ as Me, a as Ne, i as Pe, it as Fe, j as Ie, k as Le, mt as Re, q as ze, s as Be, ut as Ve, w as He } from "./registry-r4hiflwC.js";
5
- import { n as Ue, r as We, t as Ge } from "./dataTableStyles-vwD1mVOP.js";
6
- import { n as Ke, t as qe } from "./LayoutRenderer-DX8pFS5A.js";
7
- import { Fragment as N, useCallback as P, useEffect as F, useMemo as I, useRef as Je, useState as L } from "react";
8
- import { useLocation as Ye, useParams as Xe, useSearchParams as Ze } from "react-router";
9
- import { useQuery as R, useQueryClient as z } from "@tanstack/react-query";
10
- import { Fragment as Qe, jsx as B, jsxs as V } from "react/jsx-runtime";
2
+ import { $ as n, A as r, At as i, C as a, Cn as o, Ct as s, D as c, Dn as l, F as u, Fn as d, In as f, L as p, Ln as m, N as h, Q as g, Sn as _, Tn as v, Zn as y, _ as b, bn as x, bt as S, cr as C, dt as ee, gt as w, i as T, it as te, j as ne, jt as re, kn as ie, lr as ae, pt as oe, rr as se, un as ce, ur as E, wn as le, wt as D, xn as ue, yn as de } from "./useCurrentScreen-A3xZDs7U.js";
3
+ import { E as fe, L as O, R as k, V as A, _ as j, b as pe, c as me, d as he, f as ge, m as _e, n as ve, o as ye, r as be, t as xe, w as Se } from "./RefreshControl-KddgOhUG.js";
4
+ import { E as Ce, F as we, G as Te, I as Ee, J as De, K as Oe, M as ke, O as Ae, U as je, W as Me, Y as Ne, _ as Pe, a as Fe, i as Ie, it as Le, j as Re, k as ze, mt as Be, q as Ve, s as He, ut as Ue, w as We } from "./registry-DJKp0yaV.js";
5
+ import { n as Ge, r as Ke, t as qe } from "./dataTableStyles-vwD1mVOP.js";
6
+ import { n as Je, t as Ye } from "./LayoutRenderer-BReuhVdX.js";
7
+ import { Fragment as Xe, useCallback as M, useEffect as N, useMemo as P, useRef as Ze, useState as F } from "react";
8
+ import { useLocation as Qe, useParams as $e, useSearchParams as et } from "react-router";
9
+ import { useQuery as I, useQueryClient as L } from "@tanstack/react-query";
10
+ import { Fragment as tt, jsx as R, jsxs as z } from "react/jsx-runtime";
11
11
  //#region src/components/shared/AssociationTabs.tsx
12
- function $e({ entityCode: e, recordId: n, associations: r, schema: i }) {
13
- let a = I(() => Object.entries(r), [r]), [o, s] = L(0);
12
+ function nt({ entityCode: e, recordId: n, associations: r, schema: i }) {
13
+ let a = P(() => Object.entries(r), [r]), [o, s] = F(0);
14
14
  if (a.length === 0) return null;
15
15
  let [c, l] = a[o];
16
- return /* @__PURE__ */ B(Re, {
17
- title: /* @__PURE__ */ B("div", {
16
+ return /* @__PURE__ */ R(Be, {
17
+ title: /* @__PURE__ */ R("div", {
18
18
  style: {
19
19
  display: "flex",
20
20
  alignItems: "center",
@@ -25,7 +25,7 @@ function $e({ entityCode: e, recordId: n, associations: r, schema: i }) {
25
25
  },
26
26
  children: a.map(([e, n], r) => {
27
27
  let i = r === o;
28
- return /* @__PURE__ */ V("button", {
28
+ return /* @__PURE__ */ z("button", {
29
29
  onClick: (e) => {
30
30
  e.stopPropagation(), s(r);
31
31
  },
@@ -43,16 +43,16 @@ function $e({ entityCode: e, recordId: n, associations: r, schema: i }) {
43
43
  cursor: "pointer",
44
44
  fontWeight: i ? 600 : 500
45
45
  },
46
- children: [n.display?.icon && /* @__PURE__ */ B(t, {
46
+ children: [n.display?.icon && /* @__PURE__ */ R(t, {
47
47
  name: n.display.icon,
48
48
  size: 13
49
- }), D(n.display?.name) || e]
49
+ }), v(n.display?.name) || e]
50
50
  }, e);
51
51
  })
52
52
  }),
53
53
  collapsible: !1,
54
54
  padding: "0",
55
- children: /* @__PURE__ */ B(et, {
55
+ children: /* @__PURE__ */ R(rt, {
56
56
  entityCode: e,
57
57
  recordId: n,
58
58
  assocKey: c,
@@ -61,38 +61,38 @@ function $e({ entityCode: e, recordId: n, associations: r, schema: i }) {
61
61
  })
62
62
  });
63
63
  }
64
- function et({ entityCode: t, recordId: n, assocKey: i, association: o, schema: c }) {
65
- let l = Fe(), u = r(), d = `${t}.${i}`, { data: f, isLoading: p } = R({
64
+ function rt({ entityCode: t, recordId: n, assocKey: i, association: o, schema: c }) {
65
+ let l = Le(), u = r(), d = `${t}.${i}`, { data: f, isLoading: p } = I({
66
66
  queryKey: [
67
67
  "association",
68
68
  d,
69
69
  n
70
70
  ],
71
- queryFn: () => O(d, [n])
72
- }), m = f?.target_entity ?? o.target, h = c.entities[m], g = I(() => f?.ids ?? [], [f?.ids]), _ = I(() => h?.fields.names().find((e) => h.fields.get(e)?.primary) ?? "id", [h]), v = I(() => g.slice(0, 50), [g]), { data: y, isLoading: b } = R({
71
+ queryFn: () => D(d, [n])
72
+ }), m = f?.target_entity ?? o.target, h = c.entities[m], g = P(() => f?.ids ?? [], [f?.ids]), y = P(() => h?.fields.names().find((e) => h.fields.get(e)?.primary) ?? "id", [h]), b = P(() => g.slice(0, 50), [g]), { data: x, isLoading: S } = I({
73
73
  queryKey: [
74
74
  "association-records",
75
75
  m,
76
- v
76
+ b
77
77
  ],
78
78
  queryFn: () => s(m, {
79
79
  per_page: 50,
80
80
  filters: [{
81
- field: _,
81
+ field: y,
82
82
  op: "in",
83
- value: v
83
+ value: b
84
84
  }]
85
85
  }),
86
- enabled: v.length > 0 && !!h
87
- }), x = y?.data ?? [], S = y?.$refs, ee = I(() => h ? h.fields.names().filter((e) => {
86
+ enabled: b.length > 0 && !!h
87
+ }), C = x?.data ?? [], ee = x?.$refs, w = P(() => h ? h.fields.names().filter((e) => {
88
88
  let t = h.fields.get(e);
89
89
  return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
90
- }).slice(0, 6) : [], [h]), te = () => {
90
+ }).slice(0, 6) : [], [h]), T = () => {
91
91
  let e = a(c, m);
92
92
  if (!e) return;
93
- let t = D(o.display?.name) || i, n = new URLSearchParams();
93
+ let t = v(o.display?.name) || i, n = new URLSearchParams();
94
94
  n.set("filters", JSON.stringify([{
95
- field: _,
95
+ field: y,
96
96
  op: "in",
97
97
  value: g
98
98
  }])), l(e.route, {
@@ -100,56 +100,56 @@ function et({ entityCode: t, recordId: n, assocKey: i, association: o, schema: c
100
100
  icon: o.display?.icon || e.icon,
101
101
  search: n.toString()
102
102
  });
103
- }, C = {
103
+ }, te = {
104
104
  fontSize: 12.5,
105
105
  color: "var(--text-3)",
106
106
  padding: "14px 16px"
107
107
  };
108
- if (p || b) return /* @__PURE__ */ B("div", {
109
- style: C,
108
+ if (p || S) return /* @__PURE__ */ R("div", {
109
+ style: te,
110
110
  children: "Loading…"
111
111
  });
112
- if (!h) return /* @__PURE__ */ B("div", {
113
- style: C,
112
+ if (!h) return /* @__PURE__ */ R("div", {
113
+ style: te,
114
114
  children: "Entity not found."
115
115
  });
116
- if (g.length === 0) return /* @__PURE__ */ B("div", {
117
- style: C,
116
+ if (g.length === 0) return /* @__PURE__ */ R("div", {
117
+ style: te,
118
118
  children: "No related records."
119
119
  });
120
- let w = a(c, m);
121
- return /* @__PURE__ */ V("div", {
120
+ let re = a(c, m);
121
+ return /* @__PURE__ */ z("div", {
122
122
  style: { padding: "8px 0" },
123
123
  children: [
124
- /* @__PURE__ */ V("table", {
125
- style: We,
126
- children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ B("tr", { children: ee.map((e) => /* @__PURE__ */ B("th", {
127
- style: Ue,
128
- children: ce(h.fields.get(e), e, c.entities)
129
- }, e)) }) }), /* @__PURE__ */ B("tbody", { children: x.map((e, t) => /* @__PURE__ */ B("tr", { children: ee.map((t) => {
124
+ /* @__PURE__ */ z("table", {
125
+ style: Ke,
126
+ children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ R("tr", { children: w.map((e) => /* @__PURE__ */ R("th", {
127
+ style: Ge,
128
+ children: _(h.fields.get(e), e, c.entities)
129
+ }, e)) }) }), /* @__PURE__ */ R("tbody", { children: C.map((e, t) => /* @__PURE__ */ R("tr", { children: w.map((t) => {
130
130
  let n = h.fields.get(t);
131
- return n ? /* @__PURE__ */ B("td", {
132
- style: Ge,
133
- children: T({
131
+ return n ? /* @__PURE__ */ R("td", {
132
+ style: qe,
133
+ children: ne({
134
134
  field: n,
135
135
  fieldName: t,
136
136
  value: e[t],
137
137
  mode: "display",
138
138
  record: e,
139
- refs: S,
139
+ refs: ee,
140
140
  locale: u
141
141
  })
142
- }, t) : /* @__PURE__ */ B("td", {}, t);
142
+ }, t) : /* @__PURE__ */ R("td", {}, t);
143
143
  }) }, t)) })]
144
144
  }),
145
- w && f && f.count > x.length && /* @__PURE__ */ B("div", {
145
+ re && f && f.count > C.length && /* @__PURE__ */ R("div", {
146
146
  style: {
147
147
  padding: "10px 16px",
148
148
  textAlign: "center"
149
149
  },
150
- children: /* @__PURE__ */ V(E, {
151
- icon: /* @__PURE__ */ B(e.external, { size: 12 }),
152
- onClick: te,
150
+ children: /* @__PURE__ */ z(E, {
151
+ icon: /* @__PURE__ */ R(e.external, { size: 12 }),
152
+ onClick: T,
153
153
  children: [
154
154
  "View all ",
155
155
  f.count,
@@ -157,15 +157,15 @@ function et({ entityCode: t, recordId: n, assocKey: i, association: o, schema: c
157
157
  ]
158
158
  })
159
159
  }),
160
- w && x.length > 0 && f && f.count <= x.length && /* @__PURE__ */ B("div", {
160
+ re && C.length > 0 && f && f.count <= C.length && /* @__PURE__ */ R("div", {
161
161
  style: {
162
162
  padding: "10px 16px",
163
163
  textAlign: "center"
164
164
  },
165
- children: /* @__PURE__ */ B(E, {
165
+ children: /* @__PURE__ */ R(E, {
166
166
  kind: "ghost",
167
- icon: /* @__PURE__ */ B(e.external, { size: 12 }),
168
- onClick: te,
167
+ icon: /* @__PURE__ */ R(e.external, { size: 12 }),
168
+ onClick: T,
169
169
  children: "Open in list view"
170
170
  })
171
171
  })
@@ -174,14 +174,14 @@ function et({ entityCode: t, recordId: n, assocKey: i, association: o, schema: c
174
174
  }
175
175
  //#endregion
176
176
  //#region src/components/pages/RecordDocumentsPanel.tsx
177
- var H = 4e3;
178
- function U(e) {
179
- return e?.some((e) => e.status === "pending") ? H : !1;
177
+ var B = 4e3;
178
+ function V(e) {
179
+ return e?.some((e) => e.status === "pending") ? B : !1;
180
180
  }
181
- function tt({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates: i }) {
182
- let { data: a, isLoading: o, error: s } = R({
181
+ function it({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates: i }) {
182
+ let { data: a, isLoading: o, error: s } = I({
183
183
  queryKey: [
184
- M,
184
+ j,
185
185
  t,
186
186
  n
187
187
  ],
@@ -190,31 +190,31 @@ function tt({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates:
190
190
  object_id: n
191
191
  })).result?.documents ?? [],
192
192
  enabled: !!(t && n) && (!!r || !!i),
193
- refetchInterval: (e) => U(e.state.data)
193
+ refetchInterval: (e) => V(e.state.data)
194
194
  }), c = (a?.length ?? 0) > 0;
195
- return !r && !c ? null : /* @__PURE__ */ V(Re, {
196
- title: /* @__PURE__ */ B(W, {}),
195
+ return !r && !c ? null : /* @__PURE__ */ z(Be, {
196
+ title: /* @__PURE__ */ R(H, {}),
197
197
  collapsible: !1,
198
198
  padding: "0",
199
199
  children: [
200
- o && /* @__PURE__ */ B(G, {
201
- icon: /* @__PURE__ */ B(e.loader, { size: 14 }),
200
+ o && /* @__PURE__ */ R(U, {
201
+ icon: /* @__PURE__ */ R(e.loader, { size: 14 }),
202
202
  text: "Loading documents..."
203
203
  }),
204
- s && /* @__PURE__ */ B(G, {
205
- icon: /* @__PURE__ */ B(e.warning, { size: 14 }),
204
+ s && /* @__PURE__ */ R(U, {
205
+ icon: /* @__PURE__ */ R(e.warning, { size: 14 }),
206
206
  text: s instanceof Error ? s.message : String(s)
207
207
  }),
208
- !o && !s && (a?.length ?? 0) === 0 && /* @__PURE__ */ B(G, {
209
- icon: /* @__PURE__ */ B(e.file, { size: 14 }),
208
+ !o && !s && (a?.length ?? 0) === 0 && /* @__PURE__ */ R(U, {
209
+ icon: /* @__PURE__ */ R(e.file, { size: 14 }),
210
210
  text: "No generated documents"
211
211
  }),
212
- !o && !s && a && a.length > 0 && /* @__PURE__ */ B("div", {
212
+ !o && !s && a && a.length > 0 && /* @__PURE__ */ R("div", {
213
213
  style: {
214
214
  display: "flex",
215
215
  flexDirection: "column"
216
216
  },
217
- children: a.map((e) => /* @__PURE__ */ B(nt, {
217
+ children: a.map((e) => /* @__PURE__ */ R(at, {
218
218
  entityCode: t,
219
219
  objectId: n,
220
220
  doc: e
@@ -223,8 +223,8 @@ function tt({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates:
223
223
  ]
224
224
  });
225
225
  }
226
- function W() {
227
- return /* @__PURE__ */ V("div", {
226
+ function H() {
227
+ return /* @__PURE__ */ z("div", {
228
228
  style: {
229
229
  display: "flex",
230
230
  alignItems: "center",
@@ -235,30 +235,30 @@ function W() {
235
235
  fontWeight: 600,
236
236
  color: "var(--text)"
237
237
  },
238
- children: [/* @__PURE__ */ B(e.file, { size: 13 }), "Documents"]
238
+ children: [/* @__PURE__ */ R(e.file, { size: 13 }), "Documents"]
239
239
  });
240
240
  }
241
- function nt({ entityCode: t, objectId: r, doc: i }) {
242
- let a = z(), [o, s] = L(!1), [c, l] = L(!1), [u, d] = L(!1), [f, p] = L(!1), [m, h] = L(null), g = D(i.title) || i.filename || i.template_code, v = i.status === "ready" && i.download_url && !f;
243
- async function y() {
241
+ function at({ entityCode: t, objectId: r, doc: i }) {
242
+ let a = L(), [o, s] = F(!1), [c, l] = F(!1), [u, d] = F(!1), [f, p] = F(!1), [m, h] = F(null), _ = v(i.title) || i.filename || i.template_code, y = i.status === "ready" && i.download_url && !f;
243
+ async function b() {
244
244
  s(!0), h(null);
245
245
  try {
246
246
  let e = (await S("document.download_format", {
247
247
  generated_document_id: i.generated_document_id,
248
248
  format: "pdf"
249
249
  })).result;
250
- e?.download_url && await _(e.download_url, e.filename);
250
+ e?.download_url && await g(e.download_url, e.filename);
251
251
  } catch (e) {
252
252
  n(e) ? (p(!0), h("Artifact unavailable")) : h(e instanceof Error ? e.message : String(e));
253
253
  } finally {
254
254
  s(!1);
255
255
  }
256
256
  }
257
- async function b() {
257
+ async function x() {
258
258
  if (i.download_url) {
259
259
  l(!0), h(null);
260
260
  try {
261
- await _(i.download_url, i.filename);
261
+ await g(i.download_url, i.filename);
262
262
  } catch (e) {
263
263
  n(e) ? (p(!0), h("Artifact unavailable")) : h(e instanceof Error ? e.message : String(e));
264
264
  } finally {
@@ -266,7 +266,7 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
266
266
  }
267
267
  }
268
268
  }
269
- async function x() {
269
+ async function C() {
270
270
  d(!0), h(null);
271
271
  try {
272
272
  await S("document.generate", {
@@ -275,7 +275,7 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
275
275
  template_source: i.template_source,
276
276
  output_format: i.output_format
277
277
  }), await a.invalidateQueries({ queryKey: [
278
- M,
278
+ j,
279
279
  t,
280
280
  r
281
281
  ] });
@@ -285,7 +285,7 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
285
285
  d(!1);
286
286
  }
287
287
  }
288
- return /* @__PURE__ */ V("div", {
288
+ return /* @__PURE__ */ z("div", {
289
289
  style: {
290
290
  display: "grid",
291
291
  gridTemplateColumns: "minmax(0, 1fr) auto",
@@ -294,10 +294,10 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
294
294
  padding: "11px 14px",
295
295
  borderTop: "1px solid var(--divider)"
296
296
  },
297
- children: [/* @__PURE__ */ V("div", {
297
+ children: [/* @__PURE__ */ z("div", {
298
298
  style: { minWidth: 0 },
299
299
  children: [
300
- /* @__PURE__ */ B("div", {
300
+ /* @__PURE__ */ R("div", {
301
301
  style: {
302
302
  fontSize: 13,
303
303
  fontWeight: 600,
@@ -306,9 +306,9 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
306
306
  textOverflow: "ellipsis",
307
307
  whiteSpace: "nowrap"
308
308
  },
309
- children: g
309
+ children: _
310
310
  }),
311
- /* @__PURE__ */ V("div", {
311
+ /* @__PURE__ */ z("div", {
312
312
  style: {
313
313
  marginTop: 3,
314
314
  display: "flex",
@@ -318,12 +318,12 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
318
318
  fontSize: 11.5
319
319
  },
320
320
  children: [
321
- /* @__PURE__ */ B("span", { children: i.output_format.toUpperCase() }),
322
- /* @__PURE__ */ B("span", { children: f ? "artifact unavailable" : i.status }),
323
- /* @__PURE__ */ B("span", { children: i.ready_at || i.created_at })
321
+ /* @__PURE__ */ R("span", { children: i.output_format.toUpperCase() }),
322
+ /* @__PURE__ */ R("span", { children: f ? "artifact unavailable" : i.status }),
323
+ /* @__PURE__ */ R("span", { children: i.ready_at || i.created_at })
324
324
  ]
325
325
  }),
326
- i.status === "failed" && i.error_text && /* @__PURE__ */ B("div", {
326
+ i.status === "failed" && i.error_text && /* @__PURE__ */ R("div", {
327
327
  style: {
328
328
  marginTop: 5,
329
329
  color: "var(--danger)",
@@ -331,7 +331,7 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
331
331
  },
332
332
  children: i.error_text
333
333
  }),
334
- m && /* @__PURE__ */ B("div", {
334
+ m && /* @__PURE__ */ R("div", {
335
335
  style: {
336
336
  marginTop: 5,
337
337
  color: "var(--danger)",
@@ -340,34 +340,34 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
340
340
  children: m
341
341
  })
342
342
  ]
343
- }), v ? /* @__PURE__ */ V("div", {
343
+ }), y ? /* @__PURE__ */ z("div", {
344
344
  style: {
345
345
  display: "flex",
346
346
  gap: 6
347
347
  },
348
- children: [/* @__PURE__ */ B(E, {
348
+ children: [/* @__PURE__ */ R(E, {
349
349
  kind: "ghost",
350
350
  size: "sm",
351
- icon: B(o ? e.loader : e.file, { size: 12 }),
352
- onClick: y,
351
+ icon: R(o ? e.loader : e.file, { size: 12 }),
352
+ onClick: b,
353
353
  disabled: o,
354
354
  children: "PDF"
355
- }), /* @__PURE__ */ B(E, {
355
+ }), /* @__PURE__ */ R(E, {
356
356
  kind: "default",
357
357
  size: "sm",
358
- icon: B(c ? e.loader : e.download, { size: 12 }),
359
- onClick: b,
358
+ icon: R(c ? e.loader : e.download, { size: 12 }),
359
+ onClick: x,
360
360
  disabled: c,
361
361
  children: "Download"
362
362
  })]
363
- }) : f ? /* @__PURE__ */ B(E, {
363
+ }) : f ? /* @__PURE__ */ R(E, {
364
364
  kind: "ghost",
365
365
  size: "sm",
366
- icon: B(u ? e.loader : e.file, { size: 12 }),
367
- onClick: x,
366
+ icon: R(u ? e.loader : e.file, { size: 12 }),
367
+ onClick: C,
368
368
  disabled: u,
369
369
  children: "Regenerate"
370
- }) : /* @__PURE__ */ B(E, {
370
+ }) : /* @__PURE__ */ R(E, {
371
371
  kind: "ghost",
372
372
  size: "sm",
373
373
  disabled: !0,
@@ -375,8 +375,8 @@ function nt({ entityCode: t, objectId: r, doc: i }) {
375
375
  })]
376
376
  });
377
377
  }
378
- function G({ icon: e, text: t }) {
379
- return /* @__PURE__ */ V("div", {
378
+ function U({ icon: e, text: t }) {
379
+ return /* @__PURE__ */ z("div", {
380
380
  style: {
381
381
  display: "flex",
382
382
  alignItems: "center",
@@ -390,10 +390,10 @@ function G({ icon: e, text: t }) {
390
390
  }
391
391
  //#endregion
392
392
  //#region src/components/detail-layout/ErrorSummary.tsx
393
- function rt({ errors: t, onJump: n }) {
393
+ function ot({ errors: t, onJump: n }) {
394
394
  if (t.length === 0) return null;
395
395
  let r = t.length !== 1;
396
- return /* @__PURE__ */ V("div", {
396
+ return /* @__PURE__ */ z("div", {
397
397
  role: "alert",
398
398
  style: {
399
399
  display: "flex",
@@ -405,19 +405,19 @@ function rt({ errors: t, onJump: n }) {
405
405
  border: "1px solid var(--danger-border)",
406
406
  color: "var(--text)"
407
407
  },
408
- children: [/* @__PURE__ */ B("span", {
408
+ children: [/* @__PURE__ */ R("span", {
409
409
  style: {
410
410
  color: "var(--danger)",
411
411
  marginTop: 1,
412
412
  display: "flex"
413
413
  },
414
- children: /* @__PURE__ */ B(e.warning, { size: 14 })
415
- }), /* @__PURE__ */ V("div", {
414
+ children: /* @__PURE__ */ R(e.warning, { size: 14 })
415
+ }), /* @__PURE__ */ z("div", {
416
416
  style: {
417
417
  flex: 1,
418
418
  minWidth: 0
419
419
  },
420
- children: [/* @__PURE__ */ V("div", {
420
+ children: [/* @__PURE__ */ z("div", {
421
421
  style: {
422
422
  fontSize: 12.5,
423
423
  fontWeight: 600,
@@ -429,7 +429,7 @@ function rt({ errors: t, onJump: n }) {
429
429
  r ? "fields need" : "field needs",
430
430
  " attention"
431
431
  ]
432
- }), /* @__PURE__ */ B("ul", {
432
+ }), /* @__PURE__ */ R("ul", {
433
433
  style: {
434
434
  margin: 0,
435
435
  padding: 0,
@@ -438,7 +438,7 @@ function rt({ errors: t, onJump: n }) {
438
438
  flexDirection: "column",
439
439
  gap: 2
440
440
  },
441
- children: t.map((e) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("button", {
441
+ children: t.map((e) => /* @__PURE__ */ R("li", { children: /* @__PURE__ */ z("button", {
442
442
  type: "button",
443
443
  onClick: n ? () => n(e.name) : void 0,
444
444
  style: {
@@ -451,21 +451,21 @@ function rt({ errors: t, onJump: n }) {
451
451
  fontFamily: "inherit"
452
452
  },
453
453
  children: [
454
- /* @__PURE__ */ B("span", {
454
+ /* @__PURE__ */ R("span", {
455
455
  style: {
456
456
  color: "var(--danger)",
457
457
  marginRight: 6
458
458
  },
459
459
  children: "•"
460
460
  }),
461
- /* @__PURE__ */ B("span", {
461
+ /* @__PURE__ */ R("span", {
462
462
  style: {
463
463
  fontWeight: 500,
464
464
  color: "var(--text-2)"
465
465
  },
466
466
  children: e.label
467
467
  }),
468
- /* @__PURE__ */ V("span", {
468
+ /* @__PURE__ */ z("span", {
469
469
  style: { color: "var(--text-3)" },
470
470
  children: [" - ", e.message]
471
471
  })
@@ -477,8 +477,8 @@ function rt({ errors: t, onJump: n }) {
477
477
  }
478
478
  //#endregion
479
479
  //#region src/components/shared/HighlightsStrip.tsx
480
- function K({ items: e }) {
481
- return e.length === 0 ? null : /* @__PURE__ */ B("div", {
480
+ function W({ items: e }) {
481
+ return e.length === 0 ? null : /* @__PURE__ */ R("div", {
482
482
  style: {
483
483
  display: "flex",
484
484
  alignItems: "center",
@@ -486,25 +486,25 @@ function K({ items: e }) {
486
486
  gap: "6px 0",
487
487
  fontSize: 12
488
488
  },
489
- children: e.map((e, t) => /* @__PURE__ */ V(N, { children: [t > 0 && /* @__PURE__ */ B("span", { style: {
489
+ children: e.map((e, t) => /* @__PURE__ */ z(Xe, { children: [t > 0 && /* @__PURE__ */ R("span", { style: {
490
490
  width: 1,
491
491
  height: 12,
492
492
  background: "var(--divider)",
493
493
  marginInline: 12
494
- } }), /* @__PURE__ */ V("span", {
494
+ } }), /* @__PURE__ */ z("span", {
495
495
  style: {
496
496
  display: "inline-flex",
497
497
  alignItems: "center",
498
498
  gap: 6,
499
499
  lineHeight: 1.3
500
500
  },
501
- children: [/* @__PURE__ */ B("span", {
501
+ children: [/* @__PURE__ */ R("span", {
502
502
  style: {
503
503
  color: "var(--text-3)",
504
504
  fontSize: 11.5
505
505
  },
506
506
  children: e.label
507
- }), /* @__PURE__ */ B("span", {
507
+ }), /* @__PURE__ */ R("span", {
508
508
  style: { color: "var(--text)" },
509
509
  children: e.value
510
510
  })]
@@ -513,7 +513,7 @@ function K({ items: e }) {
513
513
  }
514
514
  //#endregion
515
515
  //#region src/components/detail-layout/DetailHighlights.tsx
516
- function it({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectStatuses: a, schema: o, locale: s }) {
516
+ function st({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectStatuses: a, schema: o, locale: s }) {
517
517
  let c = e.highlights;
518
518
  if (!c || c.length === 0) return null;
519
519
  let l = [];
@@ -522,12 +522,12 @@ function it({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
522
522
  if (c) {
523
523
  let t = a?.find((t) => t.group_code === e), n = t ? c.statuses.find((e) => e.code === t.status_code) : void 0;
524
524
  l.push({
525
- label: D(c.name),
526
- value: n ? /* @__PURE__ */ B(oe, {
525
+ label: v(c.name),
526
+ value: n ? /* @__PURE__ */ R(C, {
527
527
  tone: n.color ?? "slate",
528
528
  size: "xs",
529
- children: D(n.name)
530
- }) : /* @__PURE__ */ B("span", {
529
+ children: v(n.name)
530
+ }) : /* @__PURE__ */ R("span", {
531
531
  style: { color: "var(--text-4)" },
532
532
  children: "—"
533
533
  })
@@ -535,7 +535,7 @@ function it({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
535
535
  continue;
536
536
  }
537
537
  if (t.fields.get(e) || t.files?.get(e)) {
538
- let a = ze({
538
+ let a = Ve({
539
539
  entity: t,
540
540
  entityCode: n,
541
541
  fieldName: e,
@@ -548,22 +548,22 @@ function it({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
548
548
  locale: s
549
549
  });
550
550
  l.push({
551
- label: Te(t, e, o.entities),
551
+ label: De(t, e, o.entities),
552
552
  value: a
553
553
  });
554
554
  continue;
555
555
  }
556
556
  }
557
- return l.length === 0 ? null : /* @__PURE__ */ B(K, { items: l });
557
+ return l.length === 0 ? null : /* @__PURE__ */ R(W, { items: l });
558
558
  }
559
559
  //#endregion
560
560
  //#region src/components/shared/AuditMetaStrip.tsx
561
- function at(e) {
561
+ function ct(e) {
562
562
  return e.by != null || e.at != null;
563
563
  }
564
- function ot({ lines: e }) {
565
- let t = e.filter(at);
566
- return t.length === 0 ? null : /* @__PURE__ */ B("div", {
564
+ function lt({ lines: e }) {
565
+ let t = e.filter(ct);
566
+ return t.length === 0 ? null : /* @__PURE__ */ R("div", {
567
567
  style: {
568
568
  display: "flex",
569
569
  flexWrap: "wrap",
@@ -575,18 +575,18 @@ function ot({ lines: e }) {
575
575
  fontSize: 11.5,
576
576
  color: "var(--text-3)"
577
577
  },
578
- children: t.map((e, t) => /* @__PURE__ */ B(st, { line: e }, t))
578
+ children: t.map((e, t) => /* @__PURE__ */ R(ut, { line: e }, t))
579
579
  });
580
580
  }
581
- function st({ line: e }) {
582
- return /* @__PURE__ */ V("div", {
581
+ function ut({ line: e }) {
582
+ return /* @__PURE__ */ z("div", {
583
583
  style: {
584
584
  display: "flex",
585
585
  alignItems: "center",
586
586
  gap: 8,
587
587
  minWidth: 0
588
588
  },
589
- children: [/* @__PURE__ */ B("span", {
589
+ children: [/* @__PURE__ */ R("span", {
590
590
  style: {
591
591
  fontSize: 11,
592
592
  fontWeight: 600,
@@ -594,7 +594,7 @@ function st({ line: e }) {
594
594
  flexShrink: 0
595
595
  },
596
596
  children: e.label
597
- }), /* @__PURE__ */ V("span", {
597
+ }), /* @__PURE__ */ z("span", {
598
598
  style: {
599
599
  display: "inline-flex",
600
600
  alignItems: "center",
@@ -602,15 +602,15 @@ function st({ line: e }) {
602
602
  minWidth: 0
603
603
  },
604
604
  children: [
605
- e.by != null && /* @__PURE__ */ B("span", {
605
+ e.by != null && /* @__PURE__ */ R("span", {
606
606
  style: { color: "var(--text-2)" },
607
607
  children: e.by
608
608
  }),
609
- e.by != null && e.at != null && /* @__PURE__ */ B("span", {
609
+ e.by != null && e.at != null && /* @__PURE__ */ R("span", {
610
610
  style: { color: "var(--text-4)" },
611
611
  children: "·"
612
612
  }),
613
- e.at != null && /* @__PURE__ */ B("span", {
613
+ e.at != null && /* @__PURE__ */ R("span", {
614
614
  className: "num",
615
615
  children: e.at
616
616
  })
@@ -620,13 +620,13 @@ function st({ line: e }) {
620
620
  }
621
621
  //#endregion
622
622
  //#region src/components/detail-layout/DetailAuditStrip.tsx
623
- function ct({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a, locale: o }) {
623
+ function dt({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a, locale: o }) {
624
624
  let s = e.audit;
625
625
  if (s?.enabled === !1) return null;
626
626
  let c = (e) => {
627
627
  if (!e || !t.fields.get(e)) return;
628
628
  let s = r[e];
629
- if (!(s == null || s === "")) return ze({
629
+ if (!(s == null || s === "")) return Ve({
630
630
  entity: t,
631
631
  entityCode: n,
632
632
  fieldName: e,
@@ -639,8 +639,8 @@ function ct({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
639
639
  locale: o
640
640
  });
641
641
  };
642
- return /* @__PURE__ */ B(ot, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
643
- label: D(e.label),
642
+ return /* @__PURE__ */ R(lt, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
643
+ label: v(e.label),
644
644
  at: c(e.at),
645
645
  by: c(e.by)
646
646
  })) : [{
@@ -655,20 +655,20 @@ function ct({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
655
655
  }
656
656
  //#endregion
657
657
  //#region src/components/detail-layout/EvidenceBlock.tsx
658
- function q(e) {
658
+ function G(e) {
659
659
  if (!e) return;
660
660
  let t = new Date(e);
661
661
  if (!Number.isNaN(t.getTime())) return t.toLocaleString();
662
662
  }
663
- function lt({ evidence: e }) {
664
- let t = e?.verdict ?? "unverified", n = q(e?.verified_at), r = [];
665
- return n && r.push(`Verified ${n}`), e?.seq && r.push(`chain #${e.seq}`), e?.checkpoint_number && r.push(`checkpoint ${e.checkpoint_number}`), e?.generation && r.push(`generation ${e.generation}`), /* @__PURE__ */ V("div", {
663
+ function ft({ evidence: e }) {
664
+ let t = e?.verdict ?? "unverified", n = G(e?.verified_at), r = [];
665
+ return n && r.push(`Verified ${n}`), e?.seq && r.push(`chain #${e.seq}`), e?.checkpoint_number && r.push(`checkpoint ${e.checkpoint_number}`), e?.generation && r.push(`generation ${e.generation}`), /* @__PURE__ */ z("div", {
666
666
  style: {
667
667
  display: "flex",
668
668
  flexDirection: "column",
669
669
  gap: 6
670
670
  },
671
- children: [/* @__PURE__ */ V("div", {
671
+ children: [/* @__PURE__ */ z("div", {
672
672
  style: {
673
673
  display: "flex",
674
674
  alignItems: "center",
@@ -676,7 +676,7 @@ function lt({ evidence: e }) {
676
676
  flexWrap: "wrap"
677
677
  },
678
678
  children: [
679
- /* @__PURE__ */ B("span", {
679
+ /* @__PURE__ */ R("span", {
680
680
  style: {
681
681
  fontSize: 12,
682
682
  fontWeight: 600,
@@ -684,13 +684,13 @@ function lt({ evidence: e }) {
684
684
  },
685
685
  children: "Evidence"
686
686
  }),
687
- /* @__PURE__ */ B(oe, {
688
- tone: ve(t),
687
+ /* @__PURE__ */ R(C, {
688
+ tone: be(t),
689
689
  size: "sm",
690
690
  dot: !0,
691
- children: ge(t)
691
+ children: ve(t)
692
692
  }),
693
- r.length > 0 && /* @__PURE__ */ B("span", {
693
+ r.length > 0 && /* @__PURE__ */ R("span", {
694
694
  style: {
695
695
  fontSize: 12,
696
696
  color: "var(--muted-foreground)"
@@ -698,7 +698,7 @@ function lt({ evidence: e }) {
698
698
  children: r.join(" · ")
699
699
  })
700
700
  ]
701
- }), e?.reason && /* @__PURE__ */ B("span", {
701
+ }), e?.reason && /* @__PURE__ */ R("span", {
702
702
  style: {
703
703
  fontSize: 12,
704
704
  color: "var(--destructive)"
@@ -709,9 +709,9 @@ function lt({ evidence: e }) {
709
709
  }
710
710
  //#endregion
711
711
  //#region src/components/shared/RecordHeader.tsx
712
- function ut({ 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 }) {
713
- let m = ie(), h = m.category === "phone" || m.width <= 520;
714
- return /* @__PURE__ */ V("div", {
712
+ function pt({ 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 }) {
713
+ let m = se(), h = m.category === "phone" || m.width <= 520;
714
+ return /* @__PURE__ */ z("div", {
715
715
  style: {
716
716
  display: "flex",
717
717
  alignItems: "flex-start",
@@ -720,27 +720,27 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
720
720
  minWidth: 0
721
721
  },
722
722
  children: [
723
- p && l && /* @__PURE__ */ B("div", {
723
+ p && l && /* @__PURE__ */ R("div", {
724
724
  style: {
725
725
  paddingTop: 4,
726
726
  flexShrink: 0
727
727
  },
728
- children: /* @__PURE__ */ B(ee, {
728
+ children: /* @__PURE__ */ R(ae, {
729
729
  size: 26,
730
- icon: /* @__PURE__ */ B(e.back, { size: 14 }),
730
+ icon: /* @__PURE__ */ R(e.back, { size: 14 }),
731
731
  title: "Back",
732
732
  onClick: u
733
733
  })
734
734
  }),
735
- p && (n || t) && /* @__PURE__ */ B("div", {
735
+ p && (n || t) && /* @__PURE__ */ R("div", {
736
736
  style: {
737
737
  flexShrink: 0,
738
738
  paddingTop: 2
739
739
  },
740
- children: n ? /* @__PURE__ */ B(j, {
740
+ children: n ? /* @__PURE__ */ R(A, {
741
741
  name: n,
742
742
  size: 32
743
- }) : /* @__PURE__ */ B("span", {
743
+ }) : /* @__PURE__ */ R("span", {
744
744
  style: {
745
745
  width: 32,
746
746
  height: 32,
@@ -754,12 +754,12 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
754
754
  children: t
755
755
  })
756
756
  }),
757
- p && /* @__PURE__ */ V("div", {
757
+ p && /* @__PURE__ */ z("div", {
758
758
  style: {
759
759
  flex: "1 1 0",
760
760
  minWidth: 0
761
761
  },
762
- children: [/* @__PURE__ */ V("div", {
762
+ children: [/* @__PURE__ */ z("div", {
763
763
  style: {
764
764
  display: "flex",
765
765
  alignItems: "center",
@@ -767,7 +767,7 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
767
767
  flexWrap: "wrap"
768
768
  },
769
769
  children: [
770
- /* @__PURE__ */ B("h1", {
770
+ /* @__PURE__ */ R("h1", {
771
771
  style: {
772
772
  margin: 0,
773
773
  fontSize: "var(--page-title-size, var(--page-title-size-detail))",
@@ -784,13 +784,13 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
784
784
  },
785
785
  children: r
786
786
  }),
787
- i && /* @__PURE__ */ B(k, { value: i }),
788
- a && /* @__PURE__ */ B(A, {
787
+ i && /* @__PURE__ */ R(O, { value: i }),
788
+ a && /* @__PURE__ */ R(k, {
789
789
  label: a,
790
790
  "data-testid": "detail-description-info"
791
791
  }),
792
792
  f,
793
- s === "edit" && c && /* @__PURE__ */ V("span", {
793
+ s === "edit" && c && /* @__PURE__ */ z("span", {
794
794
  style: {
795
795
  display: "inline-flex",
796
796
  alignItems: "center",
@@ -798,26 +798,26 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
798
798
  fontSize: 11,
799
799
  color: "var(--warn)"
800
800
  },
801
- children: [/* @__PURE__ */ B("span", { style: {
801
+ children: [/* @__PURE__ */ R("span", { style: {
802
802
  width: 6,
803
803
  height: 6,
804
804
  borderRadius: 999,
805
805
  background: "var(--warn)"
806
806
  } }), "Unsaved"]
807
807
  }),
808
- s === "create" && /* @__PURE__ */ B(oe, {
808
+ s === "create" && /* @__PURE__ */ R(C, {
809
809
  tone: "violet",
810
810
  size: "xs",
811
811
  dot: !0,
812
812
  children: "New record"
813
813
  })
814
814
  ]
815
- }), o && s === "display" && /* @__PURE__ */ B("div", {
815
+ }), o && s === "display" && /* @__PURE__ */ R("div", {
816
816
  style: { marginTop: 8 },
817
817
  children: o
818
818
  })]
819
819
  }),
820
- d && /* @__PURE__ */ B("div", {
820
+ d && /* @__PURE__ */ R("div", {
821
821
  role: "toolbar",
822
822
  "aria-label": "Page actions",
823
823
  style: {
@@ -836,7 +836,7 @@ function ut({ icon: t, avatarName: n, title: r, recordId: i, description: a, hig
836
836
  }
837
837
  //#endregion
838
838
  //#region src/lib/children-validation.ts
839
- function dt(e, t, n) {
839
+ function mt(e, t, n) {
840
840
  let r = [];
841
841
  for (let [i, a] of e.fields) {
842
842
  if (!a.required || a.auto || n && a.primary || e.tenant_key && i === e.tenant_key || a.default !== void 0 && a.default !== null) continue;
@@ -845,17 +845,17 @@ function dt(e, t, n) {
845
845
  }
846
846
  return r;
847
847
  }
848
- var ft = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
849
- function pt(e, t) {
848
+ var ht = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
849
+ function gt(e, t) {
850
850
  let n = [];
851
851
  for (let [r, i] of e.fields) {
852
852
  if (i.type !== "email") continue;
853
853
  let e = t[r];
854
- typeof e == "string" && e !== "" && !ft.test(e) && n.push(r);
854
+ typeof e == "string" && e !== "" && !ht.test(e) && n.push(r);
855
855
  }
856
856
  return n;
857
857
  }
858
- function mt(e, t) {
858
+ function _t(e, t) {
859
859
  let n = /* @__PURE__ */ new Set();
860
860
  for (let r of Object.values(t.entities)) if (r.children) {
861
861
  for (let t of r.children) if (t.entity === e && t.foreign_key) {
@@ -865,13 +865,13 @@ function mt(e, t) {
865
865
  }
866
866
  return n;
867
867
  }
868
- function ht(e, t) {
868
+ function vt(e, t) {
869
869
  if (!e || !t) return {};
870
870
  let n = {};
871
871
  for (let [r, i] of Object.entries(e)) {
872
872
  let e = t.entities[r];
873
873
  if (!e) continue;
874
- let a = mt(r, t), o = [];
874
+ let a = _t(r, t), o = [];
875
875
  for (let [t, n] of e.fields) e.tenant_key && t === e.tenant_key || n.required && !n.auto && !n.primary && !a.has(t) && o.push(t);
876
876
  if (o.length !== 0) for (let e of i) {
877
877
  if (e._deleted) continue;
@@ -887,163 +887,163 @@ function ht(e, t) {
887
887
  }
888
888
  //#endregion
889
889
  //#region src/components/pages/SmartDetailPage.impl.tsx
890
- var gt = () => {};
891
- function _t(e, t) {
890
+ var yt = () => {};
891
+ function bt(e, t) {
892
892
  return e.length === t.length && JSON.stringify(e) === JSON.stringify(t);
893
893
  }
894
- function vt(e, t) {
894
+ function xt(e, t) {
895
895
  if (e) {
896
- let n = h(x(e, t));
896
+ let n = ie(ue(e, t));
897
897
  if (n.replace(/^\|+|\|+$/g, "")) return n;
898
898
  }
899
- return t.id == null ? crypto.randomUUID() : f(t.id);
899
+ return t.id == null ? crypto.randomUUID() : m(t.id);
900
900
  }
901
- function J({ screenCode: e }) {
902
- return /* @__PURE__ */ B(m, { children: /* @__PURE__ */ B(yt, { screenCode: e }) });
901
+ function K({ screenCode: e }) {
902
+ return /* @__PURE__ */ R(h, { children: /* @__PURE__ */ R(q, { screenCode: e }) });
903
903
  }
904
- function yt({ screenCode: t }) {
905
- let { id: n } = Xe(), a = ne(), [s, c] = Ze(), { data: f } = i(), m = re((e) => e.user), _ = u(), y = ie(), b = f?.screens[t], S = b?.entity ? f?.entities[b.entity] : void 0, C = b?.entity, w = le(S, "create"), T = le(S, "update"), E = le(S, "restore"), oe = (() => {
904
+ function q({ screenCode: t }) {
905
+ let { id: n } = $e(), a = te(), [s, c] = et(), { data: m } = i(), h = re((e) => e.user), g = u(), y = se(), b = m?.screens[t], S = b?.entity ? m?.entities[b.entity] : void 0, C = b?.entity, w = x(S, "create"), T = x(S, "update"), ne = x(S, "restore"), E = (() => {
906
906
  if (!S || !S.singleton || !S.prefilter) return;
907
- let e = o(S);
907
+ let e = le(S);
908
908
  if (e.length !== 1) return;
909
909
  let t = S.prefilter[e[0]];
910
- if (t === "$caller.user_id") return m?.id;
911
- if (t === "$caller.tenant_id") return m?.tenant?.id;
912
- })(), O = oe !== void 0, k = O ? oe : n, A = !O && k === "new", j = I(() => {
913
- if (!k || A) return;
914
- if (!S) return k;
915
- let e = o(S);
916
- if (e.length === 1) return { [e[0]]: k };
917
- let t = l(k, e.length);
910
+ if (t === "$caller.user_id") return h?.id;
911
+ if (t === "$caller.tenant_id") return h?.tenant?.id;
912
+ })(), D = E !== void 0, O = D ? E : n, k = !D && O === "new", A = P(() => {
913
+ if (!O || k) return;
914
+ if (!S) return O;
915
+ let e = le(S);
916
+ if (e.length === 1) return { [e[0]]: O };
917
+ let t = l(O, e.length);
918
918
  if (!t) return;
919
919
  let n = {};
920
920
  for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
921
921
  return n;
922
922
  }, [
923
+ O,
923
924
  k,
924
- A,
925
925
  S
926
- ]), M = I(() => {
927
- if (j) return typeof j == "string" ? j : h(j);
928
- }, [j]), me = Ne(C, j), { data: he, isLoading: ge, error: ve } = me, ye = we((e) => e.degradedEntities), Te = C ? Se(S?.realtime, ye, C) : !1;
929
- de(Pe(C, j), !A);
930
- let De = xe(C ?? ""), Fe = Le(C ?? ""), Ie = Oe(C ?? ""), Re = Object.keys(S?.status_groups ?? {}).length > 0, ze = he?.data, Ue = ze?.$statuses, We = ze?.$properties, Ge = s.get("edit") === "true", [N, R] = L(A || Ge), [z, et] = L({}), [H, U] = L({}), [W, nt] = L({}), [G, K] = L(void 0), [at, ot] = L(!1), [st, q] = L(void 0), [ut, ft] = L(!1), mt = A ? w : T, J = N && mt, yt = ae();
931
- te(J && !A, yt.enabled);
932
- let [xt, St] = L(() => {
926
+ ]), j = P(() => {
927
+ if (A) return typeof A == "string" ? A : ie(A);
928
+ }, [A]), ge = Fe(C, A), { data: _e, isLoading: ve, error: be } = ge, xe = Ee((e) => e.degradedEntities), De = C ? we(S?.realtime, xe, C) : !1;
929
+ pe(Ie(C, A), !k);
930
+ let ke = Ce(C ?? ""), Le = ze(C ?? ""), Re = Ae(C ?? ""), Be = Object.keys(S?.status_groups ?? {}).length > 0, Ve = _e?.data, Ge = Ve?.$statuses, Ke = Ve?.$properties, qe = s.get("edit") === "true", [Xe, I] = F(k || qe), [L, rt] = F({}), [B, V] = F({}), [H, at] = F({}), [U, W] = F(void 0), [ct, lt] = F(!1), [ut, G] = F(void 0), [pt, ht] = F(!1), _t = k ? w : T, K = Xe && _t, q = oe();
931
+ ee(K && !k, q.enabled);
932
+ let [Ct, wt] = F(() => {
933
933
  let e = parseInt(b?.sidebar_width || "380", 10);
934
934
  return isNaN(e) ? 380 : e;
935
- }), wt = Je(null), Y = Je(null), Tt = P((e) => {
935
+ }), Et = Ze(null), J = Ze(null), Dt = M((e) => {
936
936
  e.preventDefault();
937
- let t = wt.current;
937
+ let t = Et.current;
938
938
  if (!t) return;
939
939
  let n = t.offsetWidth;
940
- Y.current = {
940
+ J.current = {
941
941
  startX: e.clientX,
942
942
  startW: n
943
943
  };
944
944
  let r = (e) => {
945
- if (!Y.current) return;
946
- let n = Y.current.startX - e.clientX, r = Math.max(280, Math.min(800, Y.current.startW + n));
945
+ if (!J.current) return;
946
+ let n = J.current.startX - e.clientX, r = Math.max(280, Math.min(800, J.current.startW + n));
947
947
  t.style.width = `${r}px`;
948
948
  }, i = () => {
949
- Y.current && t && St(parseInt(t.style.width, 10) || Y.current.startW), Y.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
949
+ J.current && t && wt(parseInt(t.style.width, 10) || J.current.startW), J.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
950
950
  };
951
951
  document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
952
- }, []), X = he?.data, Z = typeof X?.$row_version == "string" ? X.$row_version : void 0, Et = X?.$refs, Dt = Je(Z);
953
- F(() => {
954
- if (!Z) return;
955
- let e = Dt.current;
956
- Dt.current = Z, e && e !== Z && N && ot(!0);
957
- }, [N, Z]);
958
- let Ot = !!S?.soft_delete && X != null && X[S.soft_delete] != null, kt = Ye(), At = Je(null);
959
- fe({ scrollElementRef: At });
960
- let jt = !A && ve instanceof se && ve.status === 404, Mt = Je(null);
961
- F(() => {
962
- if (!jt) return;
963
- let e = be(kt);
964
- Mt.current !== e && (Mt.current = e, ue.getState().kill(e));
965
- }, [jt, kt]);
966
- let { openTab: Nt, updateTabTitle: Pt, findTabByPathname: Ft } = Ve();
967
- F(() => {
968
- if (!S || O || yt.enabled) return;
969
- let e = kt.pathname, t = D(b?.display?.name) || D(S.display.name), n = b?.display?.icon || S.display.icon;
970
- Ft(e) || Nt({
952
+ }, []), Y = _e?.data, X = typeof Y?.$row_version == "string" ? Y.$row_version : void 0, Ot = Y?.$refs, kt = Ze(X);
953
+ N(() => {
954
+ if (!X) return;
955
+ let e = kt.current;
956
+ kt.current = X, e && e !== X && Xe && lt(!0);
957
+ }, [Xe, X]);
958
+ let At = !!S?.soft_delete && Y != null && Y[S.soft_delete] != null, Z = Qe(), jt = Ze(null);
959
+ me({ scrollElementRef: jt });
960
+ let Mt = !k && be instanceof ce && be.status === 404, Nt = k && !de(S), Pt = Ze(null);
961
+ N(() => {
962
+ if (!Mt) return;
963
+ let e = Se(Z);
964
+ Pt.current !== e && (Pt.current = e, fe.getState().kill(e));
965
+ }, [Mt, Z]);
966
+ let { openTab: Ft, updateTabTitle: It, findTabByPathname: Lt } = Ue();
967
+ N(() => {
968
+ if (!S || D || q.enabled) return;
969
+ let e = Z.pathname, t = v(b?.display?.name) || v(S.display.name), n = b?.display?.icon || S.display.icon;
970
+ Lt(e) || Ft({
971
971
  pathname: e,
972
972
  search: "",
973
- title: A ? `New ${t}` : t,
973
+ title: k ? `New ${t}` : t,
974
974
  icon: n,
975
975
  closable: !0
976
976
  });
977
977
  }, [
978
- kt.pathname,
978
+ Z.pathname,
979
979
  b?.display?.name?.en,
980
980
  S?.display.name?.en,
981
981
  b?.display?.icon,
982
982
  S?.display.icon,
983
- A,
984
- O,
985
- yt.enabled
986
- ]), F(() => {
987
- if (!X || !S || O || yt.enabled) return;
988
- let e = Ft(kt.pathname);
983
+ k,
984
+ D,
985
+ q.enabled
986
+ ]), N(() => {
987
+ if (!Y || !S || D || q.enabled) return;
988
+ let e = Lt(Z.pathname);
989
989
  if (e) {
990
- let t = D(b?.display?.name) || D(S.display.name), n = v(X, S), r = n && !String(n).startsWith("/") ? String(n) : t;
991
- Pt(e.id, r);
990
+ let t = v(b?.display?.name) || v(S.display.name), n = o(Y, S), r = n && !String(n).startsWith("/") ? String(n) : t;
991
+ It(e.id, r);
992
992
  }
993
993
  }, [
994
- X,
994
+ Y,
995
995
  S?.display.name?.en,
996
996
  S?.display.display_field,
997
- kt.pathname,
998
- O,
999
- yt.enabled
997
+ Z.pathname,
998
+ D,
999
+ q.enabled
1000
1000
  ]);
1001
- let It = I(() => {
1002
- if (!S || !mt) return /* @__PURE__ */ new Set();
1001
+ let Rt = P(() => {
1002
+ if (!S || !_t) return /* @__PURE__ */ new Set();
1003
1003
  let e = /* @__PURE__ */ new Set();
1004
1004
  for (let [t, n] of S.fields) !n.auto && !n.primary && e.add(t);
1005
1005
  for (let [t] of S.files ?? []) e.add(t);
1006
1006
  return e;
1007
- }, [S, mt]);
1008
- F(() => {
1009
- if (!(!Ge || !X || !S || !T)) {
1010
- if (N || R(!0), Object.keys(z).length === 0) {
1011
- let e = k ? _e(k) : null;
1012
- e && Ae(ke({
1007
+ }, [S, _t]);
1008
+ N(() => {
1009
+ if (!(!qe || !Y || !S || !T)) {
1010
+ if (Xe || I(!0), Object.keys(L).length === 0) {
1011
+ let e = O ? ye(O) : null;
1012
+ e && Me(je({
1013
1013
  entity: S,
1014
1014
  formData: e,
1015
1015
  record: void 0,
1016
1016
  isNew: !0
1017
1017
  })).forEach((e) => {
1018
- _.registerDraft({
1018
+ g.registerDraft({
1019
1019
  fileId: e,
1020
1020
  discard: () => p(e)
1021
1021
  });
1022
1022
  });
1023
1023
  let t = {};
1024
- It.forEach((n) => {
1024
+ Rt.forEach((n) => {
1025
1025
  let r = e ? e[n] : void 0;
1026
1026
  if (r !== void 0) {
1027
1027
  t[n] = r;
1028
1028
  return;
1029
1029
  }
1030
- let i = Ee(S, X, n);
1031
- t[n] = Ce(S, n) ? i ?? null : i ?? "";
1032
- }), et(t);
1030
+ let i = Oe(S, Y, n);
1031
+ t[n] = Te(S, n) ? i ?? null : i ?? "";
1032
+ }), rt(t);
1033
1033
  }
1034
- if (S.children !== void 0 && S.children.length > 0 && G === void 0) {
1035
- let e = X.$children;
1034
+ if (S.children !== void 0 && S.children.length > 0 && U === void 0) {
1035
+ let e = Y.$children;
1036
1036
  if (e && Object.keys(e).length > 0) {
1037
1037
  let t = {};
1038
1038
  for (let [n, r] of Object.entries(e)) {
1039
- let e = f?.entities[n];
1039
+ let e = m?.entities[n];
1040
1040
  t[n] = r.map((t) => ({
1041
1041
  ...t,
1042
- _key: vt(e, t)
1042
+ _key: xt(e, t)
1043
1043
  }));
1044
1044
  }
1045
- K(t), q(e);
1046
- } else K({}), q({});
1045
+ W(t), G(e);
1046
+ } else W({}), G({});
1047
1047
  }
1048
1048
  c((e) => {
1049
1049
  let t = new URLSearchParams(e);
@@ -1051,171 +1051,198 @@ function yt({ screenCode: t }) {
1051
1051
  }, { replace: !0 });
1052
1052
  }
1053
1053
  }, [
1054
- Ge,
1055
- X,
1056
- It,
1054
+ qe,
1055
+ Y,
1056
+ Rt,
1057
1057
  T,
1058
1058
  S,
1059
- G,
1060
- f
1061
- ]), F(() => {
1062
- !A || !w || !S?.children || S.children.length === 0 || G === void 0 && (K({}), q({}));
1059
+ U,
1060
+ m
1061
+ ]), N(() => {
1062
+ !k || !w || !S?.children || S.children.length === 0 || U === void 0 && (W({}), G({}));
1063
1063
  }, [
1064
- A,
1064
+ k,
1065
1065
  w,
1066
1066
  S?.children
1067
1067
  ]);
1068
- let Lt = P(async () => {
1069
- if (await _.flushAllDrafts(), A) {
1068
+ let zt = M(async () => {
1069
+ if (await g.flushAllDrafts(), k) {
1070
1070
  let e = b?.route?.replace("/:id", "") ?? "/";
1071
1071
  a(e);
1072
- } else R(!1), et({}), U({}), nt({}), K(void 0), q(void 0), ft(!1);
1072
+ } else I(!1), rt({}), V({}), at({}), W(void 0), G(void 0), ht(!1);
1073
1073
  }, [
1074
- _,
1075
- A,
1074
+ g,
1075
+ k,
1076
1076
  b,
1077
1077
  a
1078
- ]), Rt = P((e, t) => {
1079
- et((n) => ({
1078
+ ]), Bt = M((e, t) => {
1079
+ rt((n) => ({
1080
1080
  ...n,
1081
1081
  [e]: t
1082
1082
  }));
1083
- }, []), Q = I(() => {
1083
+ }, []), Q = P(() => {
1084
1084
  if (!b?.route) return "/";
1085
1085
  let e = b.route.split("/");
1086
1086
  return e.pop(), e.join("/") || "/";
1087
- }, [b]), zt = I(() => !f?.screens || !Q || Q === "/" ? !1 : Object.values(f.screens).some((e) => e.route === Q), [f, Q]), Bt = Me({ fallback: P(() => {
1088
- if (!zt) {
1087
+ }, [b]), Vt = P(() => !m?.screens || !Q || Q === "/" ? !1 : Object.values(m.screens).some((e) => e.route === Q), [m, Q]), Ht = Pe({ fallback: M(() => {
1088
+ if (!Vt) {
1089
1089
  a("/");
1090
1090
  return;
1091
1091
  }
1092
- let e = Ft(Q)?.search ?? "";
1092
+ let e = Lt(Q)?.search ?? "";
1093
1093
  a(e ? `${Q}?${e}` : Q);
1094
1094
  }, [
1095
- zt,
1095
+ Vt,
1096
1096
  Q,
1097
- Ft,
1097
+ Lt,
1098
1098
  a
1099
- ]) }), Vt = !O && (Bt.hasOriginBack || Bt.allowFallbackBack && !!zt), Ht = r(), Ut = I(() => {
1099
+ ]) }), Ut = !D && (Ht.hasOriginBack || Ht.allowFallbackBack && !!Vt), Wt = r(), Gt = P(() => {
1100
1100
  if (!S) return {};
1101
1101
  let e = {};
1102
- for (let t of dt(S, z, A)) It.has(t) && (e[t] = "Required");
1103
- for (let t of pt(S, z)) It.has(t) && (e[t] = "Invalid email address");
1102
+ for (let t of mt(S, L, k)) Rt.has(t) && (e[t] = "Required");
1103
+ for (let t of gt(S, L)) Rt.has(t) && (e[t] = "Invalid email address");
1104
1104
  return e;
1105
1105
  }, [
1106
1106
  S,
1107
- z,
1108
- A,
1109
- It
1110
- ]), Wt = Object.keys(Ut).length > 0, Gt = P(() => {
1111
- if (!C || !S || A && !w || !A && !T || (ft(!0), Wt)) return;
1112
- let e = {}, t = ke({
1107
+ L,
1108
+ k,
1109
+ Rt
1110
+ ]), Kt = Object.keys(Gt).length > 0, qt = M(() => {
1111
+ if (!C || !S || k && !w || !k && !T || (ht(!0), Kt)) return;
1112
+ let e = {}, t = je({
1113
1113
  entity: S,
1114
- formData: z,
1115
- record: X,
1116
- isNew: A
1117
- }), n = Ae(t);
1118
- if (A) for (let [t, n] of Object.entries(z)) {
1114
+ formData: L,
1115
+ record: Y,
1116
+ isNew: k
1117
+ }), n = Me(t);
1118
+ if (k) for (let [t, n] of Object.entries(L)) {
1119
1119
  if (S.files?.has(t)) continue;
1120
- let r = je(S, t, n);
1120
+ let r = Ne(S, t, n);
1121
1121
  r !== "" && r != null && (e[t] = r);
1122
1122
  }
1123
1123
  else {
1124
- for (let [t, n] of Object.entries(z)) {
1124
+ for (let [t, n] of Object.entries(L)) {
1125
1125
  if (S.files?.has(t)) continue;
1126
- let r = X ? Ee(S, X, t) : void 0, i = je(S, t, n), a = je(S, t, r);
1126
+ let r = Y ? Oe(S, Y, t) : void 0, i = Ne(S, t, n), a = Ne(S, t, r);
1127
1127
  (i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
1128
1128
  }
1129
- Z && (e.$row_version = Z);
1129
+ X && (e.$row_version = X);
1130
1130
  }
1131
- if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(H).length > 0 && (e.$statuses = Object.entries(H).map(([e, t]) => ({
1131
+ if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(B).length > 0 && (e.$statuses = Object.entries(B).map(([e, t]) => ({
1132
1132
  status_group_code: e,
1133
1133
  status_code: t
1134
- }))), Object.keys(W).length > 0 && (e.$properties = Object.entries(W).map(([e, t]) => ({
1134
+ }))), Object.keys(H).length > 0 && (e.$properties = Object.entries(H).map(([e, t]) => ({
1135
1135
  property_code: e,
1136
1136
  value: t
1137
- }))), G) {
1137
+ }))), U) {
1138
1138
  let t = {};
1139
- for (let [e, n] of Object.entries(G)) {
1139
+ for (let [e, n] of Object.entries(U)) {
1140
1140
  let r = n.filter((e) => !e._deleted).map((e) => {
1141
1141
  let { _key: t, _deleted: n, _dirty: r, ...i } = e;
1142
1142
  return i;
1143
- }), i = st?.[e] ?? [];
1144
- (A || !_t(r, i)) && (t[e] = r);
1143
+ }), i = ut?.[e] ?? [];
1144
+ (k || !bt(r, i)) && (t[e] = r);
1145
1145
  }
1146
1146
  Object.keys(t).length > 0 && (e.$children = t);
1147
1147
  }
1148
- if (!A && Object.keys(e).length === 0) {
1149
- R(!1), U({}), nt({}), K(void 0), q(void 0), ft(!1);
1148
+ if (!k && Object.keys(e).length === 0) {
1149
+ I(!1), V({}), at({}), W(void 0), G(void 0), ht(!1);
1150
1150
  return;
1151
1151
  }
1152
1152
  let r = () => {
1153
- R(!1), ot(!1), ft(!1), U({}), nt({}), K(void 0), q(void 0);
1153
+ I(!1), lt(!1), ht(!1), V({}), at({}), W(void 0), G(void 0);
1154
1154
  };
1155
- A ? De.mutate(e, { onSuccess: (e) => {
1156
- n.forEach((e) => _.markCommitted(e));
1157
- let t = e.data, i = h(S ? x(S, t) : {});
1155
+ k ? ke.mutate(e, { onSuccess: (e) => {
1156
+ n.forEach((e) => g.markCommitted(e));
1157
+ let t = e.data, i = ie(S ? ue(S, t) : {});
1158
1158
  a(i ? `${Q}/${encodeURIComponent(i)}` : Q, { replace: !0 }), r();
1159
- } }) : j && Fe.mutate({
1160
- pkValues: j,
1159
+ } }) : A && Le.mutate({
1160
+ pkValues: A,
1161
1161
  data: e
1162
1162
  }, {
1163
1163
  onSuccess: () => {
1164
- n.forEach((e) => _.markCommitted(e)), r();
1164
+ n.forEach((e) => g.markCommitted(e)), r();
1165
1165
  },
1166
1166
  onError: (e) => {
1167
- e instanceof se && e.code === "STALE_OBJECT" && ot(!0);
1167
+ e instanceof ce && e.code === "STALE_OBJECT" && lt(!0);
1168
1168
  }
1169
1169
  });
1170
1170
  }, [
1171
- _,
1172
- A,
1171
+ g,
1172
+ k,
1173
1173
  w,
1174
1174
  T,
1175
1175
  C,
1176
- z,
1177
- Wt,
1176
+ L,
1177
+ Kt,
1178
+ B,
1178
1179
  H,
1179
- W,
1180
- G,
1181
- st,
1182
- De,
1183
- Fe,
1180
+ U,
1181
+ ut,
1182
+ ke,
1183
+ Le,
1184
1184
  S,
1185
1185
  a,
1186
1186
  Q,
1187
+ Y,
1187
1188
  X,
1188
- Z,
1189
- j
1190
- ]), Kt = P((e, t) => {
1191
- K((n) => ({
1189
+ A
1190
+ ]), Jt = M((e, t) => {
1191
+ W((n) => ({
1192
1192
  ...n ?? {},
1193
1193
  [e]: t
1194
1194
  }));
1195
- }, []), qt = P(() => {
1196
- !j || A || !E || Ie.mutate(j);
1195
+ }, []), Yt = M(() => {
1196
+ !A || k || !ne || Re.mutate(A);
1197
1197
  }, [
1198
- j,
1199
1198
  A,
1200
- E,
1201
- Ie
1202
- ]), Jt = I(() => ht(G, f), [G, f]), Yt = Object.keys(Jt).length > 0;
1199
+ k,
1200
+ ne,
1201
+ Re
1202
+ ]), Xt = P(() => vt(U, m), [U, m]), Zt = Object.keys(Xt).length > 0;
1203
1203
  if (!b || !S) return null;
1204
- if (!A && ge) return /* @__PURE__ */ B(He, {});
1205
- if (!A && !X || jt) return /* @__PURE__ */ V("div", {
1204
+ if (!k && ve) return /* @__PURE__ */ R(We, {});
1205
+ if (Nt) return /* @__PURE__ */ z("div", {
1206
+ style: { padding: 24 },
1207
+ children: [/* @__PURE__ */ z("div", {
1208
+ style: {
1209
+ display: "flex",
1210
+ alignItems: "center",
1211
+ gap: 8,
1212
+ marginBottom: 8
1213
+ },
1214
+ children: [Ut && /* @__PURE__ */ R(ae, {
1215
+ icon: /* @__PURE__ */ R(e.back, { size: 14 }),
1216
+ onClick: Ht.goBack,
1217
+ title: "Back"
1218
+ }), /* @__PURE__ */ R("h1", {
1219
+ style: {
1220
+ margin: 0,
1221
+ fontSize: 18,
1222
+ fontWeight: 600,
1223
+ color: "var(--text)"
1224
+ },
1225
+ children: "Not Available"
1226
+ })]
1227
+ }), /* @__PURE__ */ R("p", {
1228
+ style: { color: "var(--text-3)" },
1229
+ children: "This record type is not created from a form."
1230
+ })]
1231
+ });
1232
+ if (!k && !Y || Mt) return /* @__PURE__ */ z("div", {
1206
1233
  style: { padding: 24 },
1207
- children: [/* @__PURE__ */ V("div", {
1234
+ children: [/* @__PURE__ */ z("div", {
1208
1235
  style: {
1209
1236
  display: "flex",
1210
1237
  alignItems: "center",
1211
1238
  gap: 8,
1212
1239
  marginBottom: 8
1213
1240
  },
1214
- children: [Vt && /* @__PURE__ */ B(ee, {
1215
- icon: /* @__PURE__ */ B(e.back, { size: 14 }),
1216
- onClick: Bt.goBack,
1241
+ children: [Ut && /* @__PURE__ */ R(ae, {
1242
+ icon: /* @__PURE__ */ R(e.back, { size: 14 }),
1243
+ onClick: Ht.goBack,
1217
1244
  title: "Back"
1218
- }), /* @__PURE__ */ B("h1", {
1245
+ }), /* @__PURE__ */ R("h1", {
1219
1246
  style: {
1220
1247
  margin: 0,
1221
1248
  fontSize: 18,
@@ -1224,35 +1251,35 @@ function yt({ screenCode: t }) {
1224
1251
  },
1225
1252
  children: "Not Found"
1226
1253
  })]
1227
- }), /* @__PURE__ */ B("p", {
1254
+ }), /* @__PURE__ */ R("p", {
1228
1255
  style: { color: "var(--text-3)" },
1229
1256
  children: "Record not found."
1230
1257
  })]
1231
1258
  });
1232
- let Xt = S.display, Zt = D(b.display?.name) || D(Xt.name), Qt = v(X, S), $t = A ? `New ${Zt}` : Qt ? String(Qt) : Zt, en = De.isPending || Fe.isPending, tn = b.responsive?.[y.category]?.layout, nn = tn?.tabs ?? (y.isPhone ? "sections" : void 0), rn = tn?.header_card === !0 ? Be({
1259
+ let Qt = S.display, $t = v(b.display?.name) || v(Qt.name), en = o(Y, S), tn = k ? `New ${$t}` : en ? String(en) : $t, nn = ke.isPending || Le.isPending, rn = b.responsive?.[y.category]?.layout, an = rn?.tabs ?? (y.isPhone ? "sections" : void 0), on = rn?.header_card === !0 ? He({
1233
1260
  entity: S,
1234
1261
  screen: b
1235
1262
  }) : void 0, $ = {
1236
- schema: f,
1263
+ schema: m,
1237
1264
  entity: S,
1238
1265
  entityCode: C,
1239
- recordId: M ?? k ?? "",
1240
- record: J ? {
1241
- ...X ?? {},
1242
- ...z
1243
- } : X ?? {},
1244
- isNew: A,
1245
- mode: J ? "edit" : "display",
1246
- onFieldChange: J ? Rt : void 0,
1247
- refs: Et,
1266
+ recordId: j ?? O ?? "",
1267
+ record: K ? {
1268
+ ...Y ?? {},
1269
+ ...L
1270
+ } : Y ?? {},
1271
+ isNew: k,
1272
+ mode: K ? "edit" : "display",
1273
+ onFieldChange: K ? Bt : void 0,
1274
+ refs: Ot,
1248
1275
  objectProperties: (() => {
1249
- let e = We ?? [];
1250
- if (!J || Object.keys(W).length === 0) return e.length > 0 ? e : void 0;
1251
- let t = e.map((e) => W[e.property_code] === void 0 ? e : {
1276
+ let e = Ke ?? [];
1277
+ if (!K || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
1278
+ let t = e.map((e) => H[e.property_code] === void 0 ? e : {
1252
1279
  ...e,
1253
- value: W[e.property_code]
1280
+ value: H[e.property_code]
1254
1281
  });
1255
- for (let [n, r] of Object.entries(W)) e.some((e) => e.property_code === n) || t.push({
1282
+ for (let [n, r] of Object.entries(H)) e.some((e) => e.property_code === n) || t.push({
1256
1283
  property_code: n,
1257
1284
  name: {},
1258
1285
  type: "string",
@@ -1260,81 +1287,81 @@ function yt({ screenCode: t }) {
1260
1287
  });
1261
1288
  return t;
1262
1289
  })(),
1263
- onSetProperty: A || !T ? void 0 : J ? (e, t) => nt((n) => ({
1290
+ onSetProperty: k || !T ? void 0 : K ? (e, t) => at((n) => ({
1264
1291
  ...n,
1265
1292
  [e]: t
1266
1293
  })) : void 0,
1267
1294
  isPropertyPending: !1,
1268
1295
  objectStatuses: (() => {
1269
- let e = Ue ?? [];
1270
- if (!J || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
1271
- let t = e.map((e) => H[e.group_code] === void 0 ? e : {
1296
+ let e = Ge ?? [];
1297
+ if (!K || Object.keys(B).length === 0) return e.length > 0 ? e : void 0;
1298
+ let t = e.map((e) => B[e.group_code] === void 0 ? e : {
1272
1299
  ...e,
1273
- status_code: H[e.group_code]
1300
+ status_code: B[e.group_code]
1274
1301
  });
1275
- for (let [n, r] of Object.entries(H)) e.some((e) => e.group_code === n) || t.push({
1302
+ for (let [n, r] of Object.entries(B)) e.some((e) => e.group_code === n) || t.push({
1276
1303
  group_code: n,
1277
1304
  status_code: r,
1278
1305
  status_name: {},
1279
- set_at: d()
1306
+ set_at: f()
1280
1307
  });
1281
1308
  return t;
1282
1309
  })(),
1283
- onSetStatus: A || !T ? void 0 : J ? (e, t) => U((n) => ({
1310
+ onSetStatus: k || !T ? void 0 : K ? (e, t) => V((n) => ({
1284
1311
  ...n,
1285
1312
  [e]: t
1286
1313
  })) : void 0,
1287
1314
  isStatusPending: !1,
1288
- pendingChildren: J ? G : void 0,
1289
- onChildrenChange: J ? Kt : void 0,
1290
- childValidationErrors: J ? Jt : void 0,
1291
- fieldErrors: J && ut ? Ut : void 0,
1292
- detailTabsPresentation: nn,
1293
- relatedRecordsPresentation: tn?.related_records
1294
- }, an = !!b.sidebar && b.sidebar.length > 0, on = tn?.sidebar === "hidden", sn = an && !on && !y.isDesktop, cn = an && !on && y.isDesktop, ln = !A && X ? /* @__PURE__ */ B(it, {
1315
+ pendingChildren: K ? U : void 0,
1316
+ onChildrenChange: K ? Jt : void 0,
1317
+ childValidationErrors: K ? Xt : void 0,
1318
+ fieldErrors: K && pt ? Gt : void 0,
1319
+ detailTabsPresentation: an,
1320
+ relatedRecordsPresentation: rn?.related_records
1321
+ }, sn = !!b.sidebar && b.sidebar.length > 0, cn = rn?.sidebar === "hidden", ln = sn && !cn && !y.isDesktop, un = sn && !cn && y.isDesktop, dn = !k && Y ? /* @__PURE__ */ R(st, {
1295
1322
  screen: b,
1296
1323
  entity: S,
1297
1324
  entityCode: C,
1298
- record: X,
1299
- refs: Et,
1300
- objectStatuses: Ue,
1301
- schema: f,
1302
- locale: Ht
1303
- }) : void 0, un = /* @__PURE__ */ B(Ct, {
1304
- title: $t,
1305
- recordId: k,
1306
- editing: J,
1307
- isNew: A,
1308
- isRecordDeleted: Ot,
1309
- dirty: N,
1310
- isSaving: en,
1311
- hasChildErrors: Yt,
1312
- hasFieldErrors: ut && Wt,
1313
- canRestore: E,
1325
+ record: Y,
1326
+ refs: Ot,
1327
+ objectStatuses: Ge,
1328
+ schema: m,
1329
+ locale: Wt
1330
+ }) : void 0, fn = /* @__PURE__ */ R(Tt, {
1331
+ title: tn,
1332
+ recordId: O,
1333
+ editing: K,
1334
+ isNew: k,
1335
+ isRecordDeleted: At,
1336
+ dirty: Xe,
1337
+ isSaving: nn,
1338
+ hasChildErrors: Zt,
1339
+ hasFieldErrors: pt && Kt,
1340
+ canRestore: ne,
1314
1341
  entity: S,
1315
1342
  screen: b,
1316
- globalActions: f?.actions,
1343
+ globalActions: m?.actions,
1317
1344
  entityCode: C,
1318
- record: X,
1319
- id: k,
1345
+ record: Y,
1346
+ id: O,
1320
1347
  listRoute: Q,
1321
- listRouteExists: !!zt,
1322
- highlights: ln,
1323
- showBack: Vt,
1324
- onBack: Bt.goBack,
1325
- onCancelEdit: Lt,
1326
- onSave: Gt,
1327
- onRestore: qt,
1328
- isRestoring: Ie.isPending,
1348
+ listRouteExists: !!Vt,
1349
+ highlights: dn,
1350
+ showBack: Ut,
1351
+ onBack: Ht.goBack,
1352
+ onCancelEdit: zt,
1353
+ onSave: qt,
1354
+ onRestore: Yt,
1355
+ isRestoring: Re.isPending,
1329
1356
  refreshControl: {
1330
- refetch: me.refetch,
1331
- isFetching: me.isFetching,
1332
- isLoading: me.isLoading,
1333
- isLive: Te
1357
+ refetch: ge.refetch,
1358
+ isFetching: ge.isFetching,
1359
+ isLoading: ge.isLoading,
1360
+ isLive: De
1334
1361
  },
1335
1362
  isRealtimeEntity: S?.realtime === !0,
1336
- canManageTemplates: pe(f)
1337
- }), dn = Ot && /* @__PURE__ */ V("div", {
1363
+ canManageTemplates: he(m)
1364
+ }), pn = At && /* @__PURE__ */ z("div", {
1338
1365
  style: {
1339
1366
  display: "flex",
1340
1367
  alignItems: "center",
@@ -1347,8 +1374,8 @@ function yt({ screenCode: t }) {
1347
1374
  color: "var(--danger)",
1348
1375
  fontSize: 12.5
1349
1376
  },
1350
- children: [/* @__PURE__ */ B(e.warning, { size: 14 }), /* @__PURE__ */ V("span", { children: ["This record was deleted on ", g(String(X[S.soft_delete]))] })]
1351
- }), fn = at && /* @__PURE__ */ V("div", {
1377
+ children: [/* @__PURE__ */ R(e.warning, { size: 14 }), /* @__PURE__ */ z("span", { children: ["This record was deleted on ", d(String(Y[S.soft_delete]))] })]
1378
+ }), mn = ct && /* @__PURE__ */ z("div", {
1352
1379
  style: {
1353
1380
  display: "flex",
1354
1381
  alignItems: "center",
@@ -1361,13 +1388,13 @@ function yt({ screenCode: t }) {
1361
1388
  color: "var(--warn)",
1362
1389
  fontSize: 12.5
1363
1390
  },
1364
- children: [/* @__PURE__ */ B(e.warning, { size: 14 }), /* @__PURE__ */ B("span", { children: "This record changed on the server while you were viewing or editing it." })]
1365
- }), pn = J && ut && Wt && /* @__PURE__ */ B(rt, {
1366
- errors: Object.entries(Ut).map(([e, t]) => {
1391
+ children: [/* @__PURE__ */ R(e.warning, { size: 14 }), /* @__PURE__ */ R("span", { children: "This record changed on the server while you were viewing or editing it." })]
1392
+ }), hn = K && pt && Kt && /* @__PURE__ */ R(ot, {
1393
+ errors: Object.entries(Gt).map(([e, t]) => {
1367
1394
  let n = S.fields.get(e);
1368
1395
  return {
1369
1396
  name: e,
1370
- label: n ? ce(n, e, f?.entities) : e,
1397
+ label: n ? _(n, e, m?.entities) : e,
1371
1398
  message: t
1372
1399
  };
1373
1400
  }),
@@ -1378,56 +1405,56 @@ function yt({ screenCode: t }) {
1378
1405
  behavior: "smooth"
1379
1406
  }), t.focus?.());
1380
1407
  }
1381
- }), mn = Re && !A && !(b.items && b.items.length > 0) && /* @__PURE__ */ B("div", {
1408
+ }), gn = Be && !k && !(b.items && b.items.length > 0) && /* @__PURE__ */ R("div", {
1382
1409
  className: "mb-4",
1383
- children: /* @__PURE__ */ B(Ke, {
1410
+ children: /* @__PURE__ */ R(Je, {
1384
1411
  statusGroups: S.status_groups ?? {},
1385
1412
  objectStatuses: $.objectStatuses,
1386
- onSetStatus: T && J ? (e, t) => U((n) => ({
1413
+ onSetStatus: T && K ? (e, t) => V((n) => ({
1387
1414
  ...n,
1388
1415
  [e]: t
1389
- })) : gt,
1416
+ })) : yt,
1390
1417
  isPending: !1,
1391
- mode: J ? "edit" : "display"
1418
+ mode: K ? "edit" : "display"
1392
1419
  })
1393
- }), hn = S.evidence_covered && !A && X && /* @__PURE__ */ B("div", {
1420
+ }), _n = S.evidence_covered && !k && Y && /* @__PURE__ */ R("div", {
1394
1421
  className: "mb-4",
1395
- children: /* @__PURE__ */ B(lt, { evidence: X.$evidence })
1396
- }), gn = /* @__PURE__ */ V(Qe, { children: [
1397
- rn && (X || A) && /* @__PURE__ */ B(bt, {
1398
- card: rn,
1422
+ children: /* @__PURE__ */ R(ft, { evidence: Y.$evidence })
1423
+ }), vn = /* @__PURE__ */ z(tt, { children: [
1424
+ on && (Y || k) && /* @__PURE__ */ R(St, {
1425
+ card: on,
1399
1426
  entity: S,
1400
1427
  record: $.record,
1401
1428
  objectStatuses: $.objectStatuses,
1402
1429
  objectProperties: $.objectProperties
1403
1430
  }),
1404
- b.items && b.items.length > 0 && (X || A) && f && /* @__PURE__ */ B(qe, {
1431
+ b.items && b.items.length > 0 && (Y || k) && m && /* @__PURE__ */ R(Ye, {
1405
1432
  nodes: b.items,
1406
1433
  ctx: $
1407
1434
  }),
1408
- !A && k && C && S.associations && Object.keys(S.associations).length > 0 && f && /* @__PURE__ */ B($e, {
1435
+ !k && O && C && S.associations && Object.keys(S.associations).length > 0 && m && /* @__PURE__ */ R(nt, {
1409
1436
  entityCode: C,
1410
- recordId: M ?? k ?? "",
1437
+ recordId: j ?? O ?? "",
1411
1438
  associations: S.associations,
1412
- schema: f
1439
+ schema: m
1413
1440
  }),
1414
- !A && k && C && /* @__PURE__ */ B(tt, {
1441
+ !k && O && C && /* @__PURE__ */ R(it, {
1415
1442
  entityCode: C,
1416
- objectId: M ?? k,
1443
+ objectId: j ?? O,
1417
1444
  canGenerateOne: !!S?.documents?.generate_one,
1418
- canManageTemplates: pe(f)
1445
+ canManageTemplates: he(m)
1419
1446
  }),
1420
- !A && X && f && /* @__PURE__ */ B(ct, {
1447
+ !k && Y && m && /* @__PURE__ */ R(dt, {
1421
1448
  screen: b,
1422
1449
  entity: S,
1423
1450
  entityCode: C,
1424
- record: X,
1425
- refs: Et,
1426
- schema: f,
1427
- locale: Ht
1451
+ record: Y,
1452
+ refs: Ot,
1453
+ schema: m,
1454
+ locale: Wt
1428
1455
  })
1429
1456
  ] });
1430
- if (cn) return /* @__PURE__ */ V("div", {
1457
+ if (un) return /* @__PURE__ */ z("div", {
1431
1458
  style: {
1432
1459
  height: "100%",
1433
1460
  display: "flex",
@@ -1435,7 +1462,7 @@ function yt({ screenCode: t }) {
1435
1462
  background: "var(--background)"
1436
1463
  },
1437
1464
  children: [
1438
- /* @__PURE__ */ V("div", {
1465
+ /* @__PURE__ */ z("div", {
1439
1466
  style: {
1440
1467
  flex: 1,
1441
1468
  minWidth: 0,
@@ -1443,21 +1470,21 @@ function yt({ screenCode: t }) {
1443
1470
  flexDirection: "column",
1444
1471
  height: "100%"
1445
1472
  },
1446
- children: [/* @__PURE__ */ V("div", {
1473
+ children: [/* @__PURE__ */ z("div", {
1447
1474
  style: {
1448
1475
  flexShrink: 0,
1449
1476
  padding: "14px 20px 8px"
1450
1477
  },
1451
1478
  children: [
1452
- un,
1453
1479
  fn,
1454
- dn,
1455
- pn,
1456
1480
  mn,
1457
- hn
1481
+ pn,
1482
+ hn,
1483
+ gn,
1484
+ _n
1458
1485
  ]
1459
- }), /* @__PURE__ */ B("div", {
1460
- ref: At,
1486
+ }), /* @__PURE__ */ R("div", {
1487
+ ref: jt,
1461
1488
  style: {
1462
1489
  flex: 1,
1463
1490
  minHeight: 0,
@@ -1467,14 +1494,14 @@ function yt({ screenCode: t }) {
1467
1494
  flexDirection: "column",
1468
1495
  gap: 16
1469
1496
  },
1470
- children: gn
1497
+ children: vn
1471
1498
  })]
1472
1499
  }),
1473
- /* @__PURE__ */ B("div", {
1500
+ /* @__PURE__ */ R("div", {
1474
1501
  className: "detail-resize-handle",
1475
- onMouseDown: Tt,
1502
+ onMouseDown: Dt,
1476
1503
  title: "Drag to resize",
1477
- children: /* @__PURE__ */ B("div", { style: {
1504
+ children: /* @__PURE__ */ R("div", { style: {
1478
1505
  position: "absolute",
1479
1506
  top: 0,
1480
1507
  bottom: 0,
@@ -1484,22 +1511,22 @@ function yt({ screenCode: t }) {
1484
1511
  background: "var(--border)"
1485
1512
  } })
1486
1513
  }),
1487
- /* @__PURE__ */ B("div", {
1488
- ref: wt,
1514
+ /* @__PURE__ */ R("div", {
1515
+ ref: Et,
1489
1516
  style: {
1490
1517
  flexShrink: 0,
1491
1518
  height: "100%",
1492
- width: `${xt}px`
1519
+ width: `${Ct}px`
1493
1520
  },
1494
- children: (X || A) && f && /* @__PURE__ */ B(qe, {
1521
+ children: (Y || k) && m && /* @__PURE__ */ R(Ye, {
1495
1522
  nodes: b.sidebar,
1496
1523
  ctx: $
1497
1524
  })
1498
1525
  })
1499
1526
  ]
1500
1527
  });
1501
- let _n = y.isPhone ? 12 : 24;
1502
- return /* @__PURE__ */ V("div", {
1528
+ let yn = y.isPhone ? 12 : 24;
1529
+ return /* @__PURE__ */ z("div", {
1503
1530
  style: {
1504
1531
  height: "100%",
1505
1532
  display: "flex",
@@ -1507,33 +1534,33 @@ function yt({ screenCode: t }) {
1507
1534
  overflow: "hidden",
1508
1535
  background: "var(--background)"
1509
1536
  },
1510
- children: [/* @__PURE__ */ V("div", {
1537
+ children: [/* @__PURE__ */ z("div", {
1511
1538
  style: {
1512
1539
  flexShrink: 0,
1513
1540
  padding: y.isPhone ? "14px 12px 8px" : "24px 24px 8px"
1514
1541
  },
1515
1542
  children: [
1516
- un,
1517
1543
  fn,
1518
- dn,
1519
- pn,
1520
1544
  mn,
1521
- hn
1545
+ pn,
1546
+ hn,
1547
+ gn,
1548
+ _n
1522
1549
  ]
1523
- }), /* @__PURE__ */ V("div", {
1524
- ref: At,
1550
+ }), /* @__PURE__ */ z("div", {
1551
+ ref: jt,
1525
1552
  style: {
1526
1553
  flex: 1,
1527
1554
  minHeight: 0,
1528
1555
  overflowY: "auto",
1529
- padding: `4px ${_n}px calc(24px + var(--safe-area-bottom, 0px))`,
1556
+ padding: `4px ${yn}px calc(24px + var(--safe-area-bottom, 0px))`,
1530
1557
  display: "flex",
1531
1558
  flexDirection: "column",
1532
1559
  gap: 16,
1533
1560
  minWidth: 0,
1534
1561
  WebkitOverflowScrolling: "touch"
1535
1562
  },
1536
- children: [gn, sn && (X || A) && f && /* @__PURE__ */ B("div", {
1563
+ children: [vn, ln && (Y || k) && m && /* @__PURE__ */ R("div", {
1537
1564
  "data-testid": "detail-sidebar-inline",
1538
1565
  style: {
1539
1566
  display: "flex",
@@ -1541,7 +1568,7 @@ function yt({ screenCode: t }) {
1541
1568
  gap: 16,
1542
1569
  minWidth: 0
1543
1570
  },
1544
- children: /* @__PURE__ */ B(qe, {
1571
+ children: /* @__PURE__ */ R(Ye, {
1545
1572
  nodes: b.sidebar,
1546
1573
  ctx: $
1547
1574
  })
@@ -1549,15 +1576,15 @@ function yt({ screenCode: t }) {
1549
1576
  })]
1550
1577
  });
1551
1578
  }
1552
- function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
1579
+ function St({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
1553
1580
  let a = (e) => {
1554
- let a = xt(t, e, n, r, i);
1555
- return a != null && f(a) !== "";
1556
- }, o = (e) => f(xt(t, e, n, r, i)) || /* @__PURE__ */ B("span", {
1581
+ let a = Ct(t, e, n, r, i);
1582
+ return a != null && m(a) !== "";
1583
+ }, s = (e) => m(Ct(t, e, n, r, i)) || /* @__PURE__ */ R("span", {
1557
1584
  style: { color: "var(--text-3)" },
1558
1585
  children: "-"
1559
- }), s = f(e.titleUsesDisplay ? v(n, t) : e.titleField ? xt(t, e.titleField, n, r, i) : void 0) || D(t.display?.name) || "Record", c = e.badgeFields.filter((t) => !e.hideEmptyFields || a(t)), l = e.bodyFields.filter((t) => !e.hideEmptyFields || a(t)), u = e.metaFields.filter((t) => !e.hideEmptyFields || a(t));
1560
- return /* @__PURE__ */ V("section", {
1586
+ }), c = m(e.titleUsesDisplay ? o(n, t) : e.titleField ? Ct(t, e.titleField, n, r, i) : void 0) || v(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));
1587
+ return /* @__PURE__ */ z("section", {
1561
1588
  "data-testid": "detail-header-card",
1562
1589
  style: {
1563
1590
  width: "100%",
@@ -1570,9 +1597,9 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1570
1597
  boxSizing: "border-box"
1571
1598
  },
1572
1599
  children: [
1573
- /* @__PURE__ */ V("div", {
1600
+ /* @__PURE__ */ z("div", {
1574
1601
  style: { minWidth: 0 },
1575
- children: [/* @__PURE__ */ B("div", {
1602
+ children: [/* @__PURE__ */ R("div", {
1576
1603
  style: {
1577
1604
  fontSize: 15,
1578
1605
  lineHeight: 1.25,
@@ -1580,8 +1607,8 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1580
1607
  color: "var(--text)",
1581
1608
  overflowWrap: "anywhere"
1582
1609
  },
1583
- children: s
1584
- }), e.subtitleField && /* @__PURE__ */ B("div", {
1610
+ children: c
1611
+ }), e.subtitleField && /* @__PURE__ */ R("div", {
1585
1612
  style: {
1586
1613
  marginTop: 4,
1587
1614
  fontSize: 12.5,
@@ -1589,17 +1616,17 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1589
1616
  color: "var(--text-3)",
1590
1617
  overflowWrap: "anywhere"
1591
1618
  },
1592
- children: o(e.subtitleField)
1619
+ children: s(e.subtitleField)
1593
1620
  })]
1594
1621
  }),
1595
- c.length > 0 && /* @__PURE__ */ B("div", {
1622
+ l.length > 0 && /* @__PURE__ */ R("div", {
1596
1623
  style: {
1597
1624
  display: "flex",
1598
1625
  flexWrap: "wrap",
1599
1626
  gap: 6,
1600
1627
  marginTop: 10
1601
1628
  },
1602
- children: c.map((e) => /* @__PURE__ */ B("span", {
1629
+ children: l.map((e) => /* @__PURE__ */ R("span", {
1603
1630
  style: {
1604
1631
  minWidth: 0,
1605
1632
  maxWidth: "100%",
@@ -1611,10 +1638,10 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1611
1638
  lineHeight: 1.4,
1612
1639
  overflowWrap: "anywhere"
1613
1640
  },
1614
- children: o(e)
1641
+ children: s(e)
1615
1642
  }, e))
1616
1643
  }),
1617
- l.length > 0 && /* @__PURE__ */ B("dl", {
1644
+ u.length > 0 && /* @__PURE__ */ R("dl", {
1618
1645
  style: {
1619
1646
  display: "grid",
1620
1647
  gridTemplateColumns: "minmax(84px, max-content) minmax(0, 1fr)",
@@ -1623,23 +1650,23 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1623
1650
  fontSize: 12.5,
1624
1651
  lineHeight: 1.35
1625
1652
  },
1626
- children: l.map((e) => /* @__PURE__ */ V("div", {
1653
+ children: u.map((e) => /* @__PURE__ */ z("div", {
1627
1654
  style: { display: "contents" },
1628
- children: [/* @__PURE__ */ B("dt", {
1655
+ children: [/* @__PURE__ */ R("dt", {
1629
1656
  style: { color: "var(--text-3)" },
1630
- children: St(t, e)
1631
- }), /* @__PURE__ */ B("dd", {
1657
+ children: wt(t, e)
1658
+ }), /* @__PURE__ */ R("dd", {
1632
1659
  style: {
1633
1660
  margin: 0,
1634
1661
  color: "var(--text-2)",
1635
1662
  minWidth: 0,
1636
1663
  overflowWrap: "anywhere"
1637
1664
  },
1638
- children: o(e)
1665
+ children: s(e)
1639
1666
  })]
1640
1667
  }, e))
1641
1668
  }),
1642
- u.length > 0 && /* @__PURE__ */ B("div", {
1669
+ d.length > 0 && /* @__PURE__ */ R("div", {
1643
1670
  style: {
1644
1671
  display: "flex",
1645
1672
  flexWrap: "wrap",
@@ -1648,51 +1675,51 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1648
1675
  color: "var(--text-3)",
1649
1676
  fontSize: 11.5
1650
1677
  },
1651
- children: u.map((e) => /* @__PURE__ */ V("span", {
1678
+ children: d.map((e) => /* @__PURE__ */ z("span", {
1652
1679
  style: {
1653
1680
  minWidth: 0,
1654
1681
  overflowWrap: "anywhere"
1655
1682
  },
1656
1683
  children: [
1657
- St(t, e),
1684
+ wt(t, e),
1658
1685
  ": ",
1659
- o(e)
1686
+ s(e)
1660
1687
  ]
1661
1688
  }, e))
1662
1689
  })
1663
1690
  ]
1664
1691
  });
1665
1692
  }
1666
- function xt(e, t, n, r, i) {
1693
+ function Ct(e, t, n, r, i) {
1667
1694
  if (t.startsWith("$status.")) {
1668
1695
  let e = t.slice(8), n = r?.find((t) => t.group_code === e);
1669
- return D(n?.status_name) || n?.status_code;
1696
+ return v(n?.status_name) || n?.status_code;
1670
1697
  }
1671
1698
  if (t.startsWith("$property.")) {
1672
1699
  let e = t.slice(10);
1673
1700
  return i?.find((t) => t.property_code === e)?.value;
1674
1701
  }
1675
- return Ee(e, n, t);
1702
+ return Oe(e, n, t);
1676
1703
  }
1677
- function St(e, t) {
1704
+ function wt(e, t) {
1678
1705
  if (t.startsWith("$status.")) return t.slice(8);
1679
1706
  if (t.startsWith("$property.")) return t.slice(10);
1680
1707
  let n = e.fields.get(t);
1681
- return n ? ce(n, t) : t;
1708
+ return n ? _(n, t) : t;
1682
1709
  }
1683
- function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, dirty: l, isSaving: u, hasChildErrors: d, hasFieldErrors: f, canRestore: p, entity: m, screen: h, globalActions: g, entityCode: _, record: v, id: x, listRoute: ee, listRouteExists: te, highlights: T, showBack: re, onBack: ie, onCancelEdit: ae, onSave: oe, onRestore: se, isRestoring: O, refreshControl: ce, isRealtimeEntity: le, canManageTemplates: k }) {
1684
- let { run: A } = w(), j = he("detail"), M = Fe(), de = ne(), fe = r(), pe = c(h?.action_layout, m?.action_layout, m?.actions, g, "detail_toolbar"), ge = b(c(h?.action_layout, m?.action_layout, m?.actions, g, "detail"), m?.actions, g, v ?? {}, []), _e = b(pe, m?.actions, g, v ?? {}, []), ve = I(() => {
1710
+ function Tt({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, dirty: l, isSaving: u, hasChildErrors: d, hasFieldErrors: f, canRestore: p, entity: m, screen: h, globalActions: g, entityCode: _, record: x, id: C, listRoute: ee, listRouteExists: ne, highlights: re, showBack: ie, onBack: ae, onCancelEdit: oe, onSave: se, onRestore: ce, isRestoring: le, refreshControl: D, isRealtimeEntity: ue, canManageTemplates: de }) {
1711
+ let { run: O } = T(), k = _e("detail"), A = Le(), j = te(), pe = r(), me = c(h?.action_layout, m?.action_layout, m?.actions, g, "detail_toolbar"), he = b(c(h?.action_layout, m?.action_layout, m?.actions, g, "detail"), m?.actions, g, x ?? {}, []), ve = b(me, m?.actions, g, x ?? {}, []), ye = P(() => {
1685
1712
  if (!m) return;
1686
- let e = x ? [x] : [];
1713
+ let e = C ? [C] : [];
1687
1714
  return {
1688
1715
  entity: m,
1689
1716
  entityCode: _ ?? "",
1690
1717
  screen: h,
1691
1718
  screenRoute: h?.route ?? "",
1692
- selectedRows: v ? [v] : [],
1719
+ selectedRows: x ? [x] : [],
1693
1720
  selectedIds: e,
1694
- locale: fe,
1695
- tabNavigate: (e, t) => M(e, {
1721
+ locale: pe,
1722
+ tabNavigate: (e, t) => A(e, {
1696
1723
  title: t?.title,
1697
1724
  icon: t?.icon,
1698
1725
  search: t?.search
@@ -1703,37 +1730,37 @@ function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, d
1703
1730
  m,
1704
1731
  _,
1705
1732
  h,
1733
+ C,
1706
1734
  x,
1707
- v,
1708
- fe,
1709
- M
1710
- ]), xe = (e, t) => {
1711
- let n = Ie(e, t, { row: v ?? void 0 });
1735
+ pe,
1736
+ A
1737
+ ]), be = (e, t) => {
1738
+ let n = Re(e, t, { row: x ?? void 0 });
1712
1739
  if (n === null) return;
1713
- let r = x ? [x] : [], i = e === "__delete" && te ? ee : null;
1714
- return A({
1740
+ let r = C ? [C] : [], i = e === "__delete" && ne ? ee : null;
1741
+ return O({
1715
1742
  action: t,
1716
- title: D(t.display?.name) || e,
1717
- row: v ?? void 0,
1718
- execute: (e) => S(n, C(e, r)),
1743
+ title: v(t.display?.name) || e,
1744
+ row: x ?? void 0,
1745
+ execute: (e) => S(n, w(e, r)),
1719
1746
  onSuccess: i ? () => {
1720
- ue.getState().kill(be(location)), de(i, { replace: !0 });
1747
+ fe.getState().kill(Se(location)), j(i, { replace: !0 });
1721
1748
  } : void 0
1722
1749
  });
1723
- }, Se = j.isVisible("show_actions") && !o && x && ge.length > 0 ? /* @__PURE__ */ B(De, {
1724
- layout: ge,
1725
- row: v,
1726
- onRun: xe,
1750
+ }, Ce = k.isVisible("show_actions") && !o && C && he.length > 0 ? /* @__PURE__ */ R(ke, {
1751
+ layout: he,
1752
+ row: x,
1753
+ onRun: be,
1727
1754
  kind: "detail",
1728
1755
  entityActions: m?.actions,
1729
1756
  globalActions: g,
1730
1757
  reservedRightWidth: 0,
1731
- widgetContext: ve,
1758
+ widgetContext: ye,
1732
1759
  constrain: !1
1733
- }) : null, Ce = !o && x ? /* @__PURE__ */ B(ye, {
1734
- liveObject: ce,
1735
- realtime: le
1736
- }) : null, we = j.isVisible("show_actions") && !o && x && _e.length > 0 ? /* @__PURE__ */ V("div", {
1760
+ }) : null, we = !o && C ? /* @__PURE__ */ R(xe, {
1761
+ liveObject: D,
1762
+ realtime: ue
1763
+ }) : null, Te = k.isVisible("show_actions") && !o && C && ve.length > 0 ? /* @__PURE__ */ z("div", {
1737
1764
  style: {
1738
1765
  display: "flex",
1739
1766
  justifyContent: "flex-end",
@@ -1741,62 +1768,62 @@ function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, d
1741
1768
  gap: 8,
1742
1769
  marginTop: 10
1743
1770
  },
1744
- children: [Se ? null : Ce, /* @__PURE__ */ B(De, {
1745
- layout: _e,
1746
- row: v,
1747
- onRun: xe,
1771
+ children: [Ce ? null : we, /* @__PURE__ */ R(ke, {
1772
+ layout: ve,
1773
+ row: x,
1774
+ onRun: be,
1748
1775
  kind: "detail",
1749
1776
  entityActions: m?.actions,
1750
1777
  globalActions: g,
1751
1778
  reservedRightWidth: 0,
1752
- widgetContext: ve,
1753
- ariaLabel: Se ? "Detail toolbar actions" : "Page actions"
1779
+ widgetContext: ye,
1780
+ ariaLabel: Ce ? "Detail toolbar actions" : "Page actions"
1754
1781
  })]
1755
- }) : null, Te = j.isVisible("show_actions") && !o && x && _ ? /* @__PURE__ */ B(me, {
1782
+ }) : null, Ee = k.isVisible("show_actions") && !o && C && _ ? /* @__PURE__ */ R(ge, {
1756
1783
  entityCode: _,
1757
1784
  scope: "detail",
1758
- objectIds: [x],
1785
+ objectIds: [C],
1759
1786
  capability: m?.documents,
1760
- canManageTemplates: k
1761
- }) : null, Ee = s ? p ? /* @__PURE__ */ B(E, {
1787
+ canManageTemplates: de
1788
+ }) : null, De = s ? p ? /* @__PURE__ */ R(E, {
1762
1789
  kind: "primary",
1763
- icon: B(O ? y : e.refresh, { size: 13 }),
1764
- onClick: se,
1765
- disabled: O,
1766
- children: O ? "Restoring…" : "Restore"
1767
- }) : null : a ? /* @__PURE__ */ V(Qe, { children: [/* @__PURE__ */ B(E, {
1768
- icon: /* @__PURE__ */ B(e.x, { size: 13 }),
1769
- onClick: ae,
1790
+ icon: R(le ? y : e.refresh, { size: 13 }),
1791
+ onClick: ce,
1792
+ disabled: le,
1793
+ children: le ? "Restoring…" : "Restore"
1794
+ }) : null : a ? /* @__PURE__ */ z(tt, { children: [/* @__PURE__ */ R(E, {
1795
+ icon: /* @__PURE__ */ R(e.x, { size: 13 }),
1796
+ onClick: oe,
1770
1797
  disabled: u,
1771
1798
  children: "Cancel"
1772
- }), /* @__PURE__ */ B(E, {
1799
+ }), /* @__PURE__ */ R(E, {
1773
1800
  kind: "primary",
1774
- icon: B(u ? y : e.save, { size: 13 }),
1775
- onClick: oe,
1801
+ icon: R(u ? y : e.save, { size: 13 }),
1802
+ onClick: se,
1776
1803
  disabled: u || d || f,
1777
1804
  title: d ? "Fix errors in child rows" : f ? "Fix the highlighted fields" : void 0,
1778
1805
  children: u ? "Saving…" : "Save"
1779
- })] }) : !o && x ? Se ? /* @__PURE__ */ V("span", {
1806
+ })] }) : !o && C ? Ce ? /* @__PURE__ */ z("span", {
1780
1807
  style: { display: "contents" },
1781
- children: [Te, Se]
1782
- }) : Te : null;
1783
- return /* @__PURE__ */ V(Qe, { children: [/* @__PURE__ */ B(ut, {
1784
- icon: m?.display.icon ? /* @__PURE__ */ B(t, {
1808
+ children: [Ee, Ce]
1809
+ }) : Ee : null;
1810
+ return /* @__PURE__ */ z(tt, { children: [/* @__PURE__ */ R(pt, {
1811
+ icon: m?.display.icon ? /* @__PURE__ */ R(t, {
1785
1812
  name: m.display.icon,
1786
1813
  size: 16
1787
1814
  }) : void 0,
1788
1815
  title: n,
1789
- description: D(h?.display?.description) || D(m?.display?.description),
1816
+ description: v(h?.display?.description) || v(m?.display?.description),
1790
1817
  recordId: i,
1791
- highlights: T,
1792
- identityControls: !s && !a && !o ? Ce : null,
1818
+ highlights: re,
1819
+ identityControls: !s && !a && !o ? we : null,
1793
1820
  mode: o ? "create" : a ? "edit" : "display",
1794
1821
  dirty: l,
1795
- showBack: re,
1796
- onBack: ie,
1797
- right: Ee,
1798
- showTitle: j.isVisible("show_title")
1799
- }), we] });
1822
+ showBack: ie,
1823
+ onBack: ae,
1824
+ right: De,
1825
+ showTitle: k.isVisible("show_title")
1826
+ }), Te] });
1800
1827
  }
1801
1828
  //#endregion
1802
- export { J as SmartDetailPage };
1829
+ export { K as SmartDetailPage };