@declarion/react 0.32.0 → 0.34.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 (33) hide show
  1. package/dist-lib/{ActionRunner-CaSrGpBi.js → ActionRunner-UGGvGypS.js} +676 -543
  2. package/dist-lib/{DraggableChildrenTable-CAHg7paQ.js → DraggableChildrenTable-CljdYXd_.js} +30 -30
  3. package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
  4. package/dist-lib/{Grid-DDbBhqcl.js → Grid-5Y_iPqNW.js} +2 -2
  5. package/dist-lib/{LayoutRenderer-CelsqsZ6.js → LayoutRenderer-CoTMmvNW.js} +712 -712
  6. package/dist-lib/{MarkdownRenderer-DThy2ixe.js → MarkdownRenderer-unbncYEV.js} +1 -1
  7. package/dist-lib/RefreshControl-oeKhCjEC.js +837 -0
  8. package/dist-lib/SmartDetailPage.impl-Caxd97q6.js +1771 -0
  9. package/dist-lib/{SmartRecordListPage.impl-BKIpTNK7.js → SmartRecordListPage.impl-BF_ieDc2.js} +258 -258
  10. package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
  11. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
  12. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
  13. package/dist-lib/components/primitives/Icons.d.ts +1 -0
  14. package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
  15. package/dist-lib/components/primitives/index.d.ts +2 -0
  16. package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
  17. package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
  18. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
  19. package/dist-lib/icons.js +1 -1
  20. package/dist-lib/index.js +2288 -2334
  21. package/dist-lib/lib/document-templates.d.ts +12 -0
  22. package/dist-lib/lib/download.d.ts +20 -0
  23. package/dist-lib/lib/record-documents-key.d.ts +1 -0
  24. package/dist-lib/{registry-KQyyL5Gt.js → registry-DnPK3Msj.js} +826 -826
  25. package/dist-lib/testing.js +25 -25
  26. package/dist-lib/types/api.d.ts +1 -9
  27. package/dist-lib/types/schema.d.ts +17 -1
  28. package/dist-lib/{useProperties-D74hyWIa.js → useProperties-CgRhBh0k.js} +52 -52
  29. package/dist-lib/{value-BfXXl5EE.js → value-GmL5BVFm.js} +29 -29
  30. package/package.json +1 -1
  31. package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
  32. package/dist-lib/RefreshControl-CorluL6r.js +0 -582
  33. package/dist-lib/SmartDetailPage.impl-USIxbl-8.js +0 -1532
@@ -1,6 +1,6 @@
1
- import { s as e, t } from "./DynamicIcon-DCRdxxZ7.js";
2
- import { $ as n, An as r, Bn as i, C as a, D as o, Dn as s, E as c, Fn as l, H as u, Hn as d, J as f, M as p, N as m, Ot as h, R as g, Rn as _, S as v, V as y, Vn as b, Xt as x, Z as S, _ as C, _n as w, an as T, at as E, b as D, cn as O, ct as k, d as A, et as j, fn as M, ft as N, gn as P, i as ee, in as te, kn as F, ln as I, m as L, mn as ne, n as R, nn as z, nt as B, on as V, p as H, pt as U, r as re, rn as ie, rt as W, st as ae, tn as oe, tt as se, u as ce, w as le, wn as ue, x as de, y as fe } from "./ActionRunner-CaSrGpBi.js";
3
- import { a as pe, c as me, d as he, f as ge, i as _e, l as ve, n as ye, o as be, p as xe, r as Se, s as Ce, t as we, u as Te } from "./value-BfXXl5EE.js";
1
+ import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
+ import { $t as n, An as r, C as i, D as a, Dn as o, E as s, G as c, Gn as l, Mn as u, N as d, Nn as f, Rn as p, S as m, Un as h, V as g, Vn as _, W as v, Wn as y, Z as b, _ as x, _n as S, an as C, at as w, b as T, bn as E, cn as D, ct as O, d as k, dn as A, dt as j, et as M, fn as N, gt as P, hn as ee, ht as te, i as ne, in as F, it as re, jt as I, k as L, ln as R, m as z, n as B, nt as V, on as H, ot as U, p as ie, r as ae, rt as oe, sn as se, u as ce, ut as le, w as ue, x as de, y as fe, yn as W } from "./ActionRunner-UGGvGypS.js";
3
+ import { a as pe, c as me, d as he, f as ge, i as _e, l as ve, n as ye, o as be, p as xe, r as Se, s as Ce, t as we, u as Te } from "./value-GmL5BVFm.js";
4
4
  import { n as Ee, r as De, t as Oe } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Component as ke, Suspense as Ae, lazy as je, useCallback as G, useEffect as K, useId as Me, useLayoutEffect as Ne, useMemo as q, useRef as J, useState as Y } from "react";
6
6
  import { parsePath as Pe, useNavigate as Fe } from "react-router-dom";
@@ -20,10 +20,10 @@ var Ue = {
20
20
  shadow: "none"
21
21
  }
22
22
  };
23
- function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s, footer: c, collapsible: l = !0, defaultOpen: u = !0, icon: d, emphasis: f = "primary", headingLevel: p = 2, padding: m = "16px" }) {
24
- let [h, g] = Y(u), _ = Ue[f] ?? Ue.primary;
23
+ function We({ title: t, subtitle: n, right: r, badge: i, count: a, children: o, footer: s, collapsible: c = !0, defaultOpen: l = !0, icon: u, emphasis: d = "primary", headingLevel: f = 2, padding: p = "16px" }) {
24
+ let [m, g] = Y(l), _ = Ue[d] ?? Ue.primary;
25
25
  return /* @__PURE__ */ Q("div", {
26
- "data-emphasis": f,
26
+ "data-emphasis": d,
27
27
  style: {
28
28
  background: _.surface,
29
29
  border: "1px solid var(--border)",
@@ -39,24 +39,24 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
39
39
  alignItems: "center",
40
40
  gap: 10,
41
41
  padding: "10px 14px",
42
- borderBottom: h ? "1px solid var(--divider)" : "none",
42
+ borderBottom: m ? "1px solid var(--divider)" : "none",
43
43
  minHeight: 40
44
44
  },
45
45
  children: [
46
46
  /* @__PURE__ */ Z("div", {
47
47
  role: "heading",
48
- "aria-level": p,
48
+ "aria-level": f,
49
49
  style: {
50
50
  display: "flex",
51
51
  flex: 1,
52
52
  minWidth: 0
53
53
  },
54
54
  children: /* @__PURE__ */ Q("div", {
55
- role: l ? "button" : void 0,
56
- tabIndex: l ? 0 : void 0,
57
- "aria-expanded": l ? h : void 0,
58
- onClick: l ? () => g((e) => !e) : void 0,
59
- onKeyDown: l ? (e) => {
55
+ role: c ? "button" : void 0,
56
+ tabIndex: c ? 0 : void 0,
57
+ "aria-expanded": c ? m : void 0,
58
+ onClick: c ? () => g((e) => !e) : void 0,
59
+ onKeyDown: c ? (e) => {
60
60
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), g((e) => !e));
61
61
  } : void 0,
62
62
  style: {
@@ -65,17 +65,17 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
65
65
  gap: 8,
66
66
  flex: 1,
67
67
  minWidth: 0,
68
- cursor: l ? "pointer" : "default",
68
+ cursor: c ? "pointer" : "default",
69
69
  userSelect: "none"
70
70
  },
71
71
  children: [
72
- d && /* @__PURE__ */ Z("span", {
72
+ u && /* @__PURE__ */ Z("span", {
73
73
  style: {
74
74
  color: "var(--text-3)",
75
75
  display: "flex",
76
76
  flexShrink: 0
77
77
  },
78
- children: d
78
+ children: u
79
79
  }),
80
80
  /* @__PURE__ */ Z("div", {
81
81
  style: {
@@ -90,7 +90,7 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
90
90
  },
91
91
  children: t
92
92
  }),
93
- o !== void 0 && /* @__PURE__ */ Z("span", {
93
+ a !== void 0 && /* @__PURE__ */ Z("span", {
94
94
  className: "num",
95
95
  style: {
96
96
  fontSize: 11,
@@ -103,7 +103,7 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
103
103
  textAlign: "center",
104
104
  flexShrink: 0
105
105
  },
106
- children: o
106
+ children: a
107
107
  }),
108
108
  n && /* @__PURE__ */ Z("div", {
109
109
  style: {
@@ -119,26 +119,26 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
119
119
  ]
120
120
  })
121
121
  }),
122
- a && /* @__PURE__ */ Z(i, {
123
- tone: a.tone ?? "violet",
122
+ i && /* @__PURE__ */ Z(h, {
123
+ tone: i.tone ?? "violet",
124
124
  size: "xs",
125
- dot: a.dot,
126
- children: a.text
125
+ dot: i.dot,
126
+ children: i.text
127
127
  }),
128
128
  r,
129
- l && /* @__PURE__ */ Z(b, {
129
+ c && /* @__PURE__ */ Z(y, {
130
130
  size: 24,
131
- icon: Z(h ? e.up : e.down, { size: 14 }),
131
+ icon: Z(m ? e.up : e.down, { size: 14 }),
132
132
  onClick: () => g((e) => !e),
133
- title: h ? "Collapse" : "Expand"
133
+ title: m ? "Collapse" : "Expand"
134
134
  })
135
135
  ]
136
136
  }),
137
- h && /* @__PURE__ */ Z("div", {
138
- style: { padding: m },
139
- children: s
137
+ m && /* @__PURE__ */ Z("div", {
138
+ style: { padding: p },
139
+ children: o
140
140
  }),
141
- c && h && /* @__PURE__ */ Z("div", {
141
+ s && m && /* @__PURE__ */ Z("div", {
142
142
  style: {
143
143
  padding: "8px 14px",
144
144
  borderTop: "1px solid var(--divider)",
@@ -146,7 +146,7 @@ function We({ title: t, subtitle: n, right: r, badge: a, count: o, children: s,
146
146
  fontSize: 11.5,
147
147
  color: "var(--text-3)"
148
148
  },
149
- children: c
149
+ children: s
150
150
  })
151
151
  ]
152
152
  });
@@ -256,7 +256,7 @@ function at(e, t) {
256
256
  }
257
257
  function ot(e, t) {
258
258
  if (typeof window > "u") return;
259
- let n = S.getState().tabsPersist, r = rt();
259
+ let n = M.getState().tabsPersist, r = rt();
260
260
  if (r) {
261
261
  if (!n) {
262
262
  try {
@@ -273,7 +273,7 @@ function ot(e, t) {
273
273
  }
274
274
  }
275
275
  function st() {
276
- if (typeof window > "u" || !S.getState().tabsPersist) return null;
276
+ if (typeof window > "u" || !M.getState().tabsPersist) return null;
277
277
  let e = rt();
278
278
  if (!e) return null;
279
279
  let t = localStorage.getItem(e);
@@ -289,7 +289,7 @@ var ct = Be((e, t) => ({
289
289
  let a = crypto.randomUUID(), o = {
290
290
  ...n,
291
291
  id: a
292
- }, s = [...r.tabs, o], c = S.getState().tabsMaxOpen;
292
+ }, s = [...r.tabs, o], c = M.getState().tabsMaxOpen;
293
293
  if (c > 0 && s.length > c) {
294
294
  let e = s.findIndex((e) => e.id !== a && e.closable !== !1 && !e.dirty);
295
295
  e !== -1 && (s = s.filter((t, n) => n !== e));
@@ -489,7 +489,7 @@ function ft({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
489
489
  children: i
490
490
  })]
491
491
  }),
492
- /* @__PURE__ */ Z(b, {
492
+ /* @__PURE__ */ Z(y, {
493
493
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
494
494
  onClick: () => n(!1)
495
495
  })
@@ -508,11 +508,11 @@ function ft({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
508
508
  },
509
509
  children: [
510
510
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
511
- /* @__PURE__ */ Z(d, {
511
+ /* @__PURE__ */ Z(l, {
512
512
  onClick: () => n(!1),
513
513
  children: "Cancel"
514
514
  }),
515
- /* @__PURE__ */ Z(d, {
515
+ /* @__PURE__ */ Z(l, {
516
516
  kind: "primary",
517
517
  danger: s,
518
518
  onClick: () => {
@@ -580,7 +580,7 @@ function yt(e) {
580
580
  if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
581
581
  }
582
582
  function bt() {
583
- let e = Fe(), { data: t } = U(), n = f(), r = u();
583
+ let e = Fe(), { data: t } = P(), n = b(), r = c();
584
584
  return G((i, a) => {
585
585
  let { pathname: o, search: s, hash: c } = vt(i, a?.search);
586
586
  if (n.enabled) {
@@ -606,7 +606,7 @@ function bt() {
606
606
  }, { replace: a?.replace });
607
607
  return;
608
608
  }
609
- let m = a?.title ? void 0 : ne(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
609
+ let m = a?.title ? void 0 : S(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
610
610
  l.openTab({
611
611
  pathname: o,
612
612
  search: d,
@@ -649,9 +649,9 @@ function Et(e) {
649
649
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
650
650
  }
651
651
  function Dt(e) {
652
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, f = ye(r), [p, m] = Y("idle"), [h, g] = Y(null), [_, y] = Y(null), [b, x] = Y(null), [S, w] = Y(!1), T = J(null), E = J(!1), O = J(null), { register: k, unregister: A, isDraft: j } = C();
652
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, f = ye(r), [p, h] = Y("idle"), [g, _] = Y(null), [v, y] = Y(null), [b, S] = Y(null), [C, w] = Y(!1), E = J(null), D = J(!1), O = J(null), { register: k, unregister: A, isDraft: j } = x();
653
653
  K(() => () => {
654
- T.current && T.current.abort();
654
+ E.current && E.current.abort();
655
655
  }, []);
656
656
  let M = q(() => ge(f, s, t.display?.placeholder || n), [
657
657
  s,
@@ -659,9 +659,9 @@ function Dt(e) {
659
659
  n,
660
660
  f
661
661
  ]), N = (t.accepts ?? ["image/*"]).join(","), P = G(async (r) => {
662
- let o = a(r, t.accepts, t.max_size_bytes);
662
+ let o = i(r, t.accepts, t.max_size_bytes);
663
663
  if (o) {
664
- y(o), m("error");
664
+ y(o), h("error");
665
665
  return;
666
666
  }
667
667
  let s = r;
@@ -675,31 +675,31 @@ function Dt(e) {
675
675
  y({
676
676
  code: "CROP_FAILED",
677
677
  message: e instanceof Error ? e.message : "Crop failed"
678
- }), m("error");
678
+ }), h("error");
679
679
  return;
680
680
  }
681
- y(null), E.current = !1, m("uploading"), g({
681
+ y(null), D.current = !1, h("uploading"), _({
682
682
  loaded: 0,
683
683
  total: s.size,
684
684
  pct: 0
685
685
  });
686
686
  let c = new AbortController();
687
- T.current = c;
687
+ E.current = c;
688
688
  try {
689
- let r = await v({
689
+ let r = await m({
690
690
  file: s,
691
691
  entityCode: e.entityCode,
692
692
  fieldCode: u ?? n,
693
693
  slotCode: d,
694
694
  signal: c.signal,
695
- onProgress: g
695
+ onProgress: _
696
696
  });
697
- if (E.current) {
698
- D(r.id).catch(() => {}), A(r.id);
697
+ if (D.current) {
698
+ T(r.id).catch(() => {}), A(r.id);
699
699
  return;
700
700
  }
701
- f && j(f.id) && (D(f.id).catch(() => {}), A(f.id)), k(r.id, () => D(r.id)), x(r.id), m("idle"), g(null);
702
- let a = {
701
+ f && j(f.id) && (T(f.id).catch(() => {}), A(f.id)), k(r.id, () => T(r.id)), S(r.id), h("idle"), _(null);
702
+ let i = {
703
703
  id: r.id,
704
704
  filename: r.filename,
705
705
  content_type: r.content_type,
@@ -710,7 +710,7 @@ function Dt(e) {
710
710
  url: r.url,
711
711
  metadata: r.metadata
712
712
  };
713
- i?.(t.mode === "array" ? [a] : a);
713
+ a?.(t.mode === "array" ? [i] : i);
714
714
  } catch (e) {
715
715
  if (e instanceof fe && e.code === "ABORTED") return;
716
716
  y(e instanceof fe ? {
@@ -719,7 +719,7 @@ function Dt(e) {
719
719
  } : {
720
720
  code: "UNKNOWN",
721
721
  message: e instanceof Error ? e.message : "Upload failed"
722
- }), m("error"), g(null);
722
+ }), h("error"), _(null);
723
723
  }
724
724
  }, [
725
725
  t.accepts,
@@ -728,7 +728,7 @@ function Dt(e) {
728
728
  t.display?.aspect_ratio,
729
729
  t.mode,
730
730
  n,
731
- i,
731
+ a,
732
732
  e.entityCode,
733
733
  k,
734
734
  j,
@@ -737,62 +737,62 @@ function Dt(e) {
737
737
  u,
738
738
  d
739
739
  ]), ee = G(() => {
740
- p === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, m("idle"), g(null)), b && (D(b).catch(() => {}), A(b), x(null));
740
+ p === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), _(null)), b && (T(b).catch(() => {}), A(b), S(null));
741
741
  }, [
742
742
  p,
743
743
  b,
744
744
  A
745
745
  ]), te = G(() => {
746
- f && j(f.id) && (D(f.id).catch(() => {}), A(f.id), x(null)), i?.(t.mode === "array" ? [] : null);
746
+ f && j(f.id) && (T(f.id).catch(() => {}), A(f.id), S(null)), a?.(t.mode === "array" ? [] : null);
747
747
  }, [
748
748
  f,
749
749
  t.mode,
750
750
  j,
751
- i,
751
+ a,
752
752
  A
753
- ]), F = G(() => {
754
- y(null), m("idle"), O.current?.click();
755
- }, []), I = G(() => {
753
+ ]), ne = G(() => {
754
+ y(null), h("idle"), O.current?.click();
755
+ }, []), F = G(() => {
756
756
  c || O.current?.click();
757
- }, [c]), L = G((e) => {
758
- c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), I());
759
- }, [c, I]), ne = G((e) => {
757
+ }, [c]), re = G((e) => {
758
+ c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), F());
759
+ }, [c, F]), I = G((e) => {
760
760
  c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
761
- }, [c]), R = G((e) => {
761
+ }, [c]), L = G((e) => {
762
762
  if (c) return;
763
763
  e.preventDefault();
764
764
  let t = e.dataTransfer.files?.[0];
765
765
  t && P(t);
766
- }, [c, P]), z = G((e) => {
766
+ }, [c, P]), R = G((e) => {
767
767
  let t = e.target.files?.[0];
768
768
  e.target.value = "", t && P(t);
769
- }, [P]), B = l.aspectRatio ?? At(l.shape, t.display?.aspect_ratio), V = he(f), H = {
770
- aspectRatio: B,
769
+ }, [P]), z = l.aspectRatio ?? At(l.shape, t.display?.aspect_ratio), B = he(f), V = {
770
+ aspectRatio: z,
771
771
  width: l.width ?? (l.shape === "wide" ? "100%" : "120px")
772
- }, U = !!f, re = Tt(f, t.display?.listable_thumbnail), ie = ve(f, t.display?.listable_thumbnail), W = _e(f?.id, ie, re), ae = o === "display", oe = G((e) => {
772
+ }, H = !!f, U = Tt(f, t.display?.listable_thumbnail), ie = ve(f, t.display?.listable_thumbnail), ae = _e(f?.id, ie, U), oe = o === "display", se = G((e) => {
773
773
  e.stopPropagation(), w((e) => !e);
774
- }, []), se = G((e) => {
775
- if (!f || !S) return;
776
- let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, a = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = xe(f, {
774
+ }, []), ce = G((e) => {
775
+ if (!f || !C) return;
776
+ let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, i = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = xe(f, {
777
777
  x: Math.max(0, Math.min(1, r)),
778
- y: Math.max(0, Math.min(1, a))
778
+ y: Math.max(0, Math.min(1, i))
779
779
  });
780
- i?.(t.mode === "array" ? [o] : o), w(!1);
780
+ a?.(t.mode === "array" ? [o] : o), w(!1);
781
781
  }, [
782
782
  t.mode,
783
783
  f,
784
- S,
785
- i
784
+ C,
785
+ a
786
786
  ]);
787
- return ae ? /* @__PURE__ */ Z("div", {
787
+ return oe ? /* @__PURE__ */ Z("div", {
788
788
  className: Ot(l.shape, !1),
789
- style: H,
789
+ style: V,
790
790
  "aria-label": M,
791
- children: U && W ? /* @__PURE__ */ Z("img", {
792
- src: W,
791
+ children: H && ae ? /* @__PURE__ */ Z("img", {
792
+ src: ae,
793
793
  alt: M,
794
794
  className: kt(l.shape),
795
- style: { objectPosition: Ce(V) },
795
+ style: { objectPosition: Ce(B) },
796
796
  loading: "lazy"
797
797
  }) : /* @__PURE__ */ Z(Mt, {
798
798
  shape: l.shape,
@@ -801,60 +801,60 @@ function Dt(e) {
801
801
  })
802
802
  }) : /* @__PURE__ */ Q("div", {
803
803
  className: Ot(l.shape, !c),
804
- style: H,
804
+ style: V,
805
805
  tabIndex: c ? -1 : 0,
806
806
  role: "button",
807
807
  "aria-label": M,
808
808
  "aria-disabled": c || void 0,
809
809
  "aria-busy": p === "uploading" || void 0,
810
810
  "aria-invalid": p === "error" || void 0,
811
- onClick: p === "idle" && !U ? I : void 0,
812
- onMouseDown: S ? se : void 0,
813
- onKeyDown: L,
814
- onDragOver: ne,
815
- onDrop: R,
816
- "data-testid": S ? "focal-point-target" : `file-widget-${n}`,
811
+ onClick: p === "idle" && !H ? F : void 0,
812
+ onMouseDown: C ? ce : void 0,
813
+ onKeyDown: re,
814
+ onDragOver: I,
815
+ onDrop: L,
816
+ "data-testid": C ? "focal-point-target" : `file-widget-${n}`,
817
817
  children: [
818
818
  /* @__PURE__ */ Z("input", {
819
819
  ref: O,
820
820
  type: "file",
821
821
  accept: N,
822
- onChange: z,
822
+ onChange: R,
823
823
  style: { display: "none" },
824
824
  "data-testid": `file-input-${n}`
825
825
  }),
826
- U && W ? /* @__PURE__ */ Z("img", {
827
- src: W,
826
+ H && ae ? /* @__PURE__ */ Z("img", {
827
+ src: ae,
828
828
  alt: M,
829
829
  className: kt(l.shape),
830
- style: { objectPosition: Ce(V) },
830
+ style: { objectPosition: Ce(B) },
831
831
  loading: "lazy"
832
832
  }) : p === "uploading" ? null : /* @__PURE__ */ Z(Mt, {
833
833
  shape: l.shape,
834
834
  label: M,
835
835
  placeholder: t.display?.placeholder
836
836
  }),
837
- p === "uploading" && /* @__PURE__ */ Z(Nt, { pct: h?.pct ?? 0 }),
837
+ p === "uploading" && /* @__PURE__ */ Z(Nt, { pct: g?.pct ?? 0 }),
838
838
  b && /* @__PURE__ */ Z("span", {
839
839
  className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
840
840
  "aria-hidden": "true",
841
841
  "data-testid": "draft-indicator"
842
842
  }),
843
- U && p === "idle" && !c && /* @__PURE__ */ Q("div", {
843
+ H && p === "idle" && !c && /* @__PURE__ */ Q("div", {
844
844
  className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
845
845
  children: [
846
846
  t.display?.focal_point && /* @__PURE__ */ Z("button", {
847
847
  type: "button",
848
848
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
849
- onClick: oe,
849
+ onClick: se,
850
850
  "data-testid": "focal-point-toggle",
851
- children: S ? "Cancel focus" : "Set focus"
851
+ children: C ? "Cancel focus" : "Set focus"
852
852
  }),
853
853
  /* @__PURE__ */ Z("button", {
854
854
  type: "button",
855
855
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
856
856
  onClick: (e) => {
857
- e.stopPropagation(), I();
857
+ e.stopPropagation(), F();
858
858
  },
859
859
  children: "Change"
860
860
  }),
@@ -868,11 +868,11 @@ function Dt(e) {
868
868
  })
869
869
  ]
870
870
  }),
871
- V && U && /* @__PURE__ */ Z("span", {
871
+ B && H && /* @__PURE__ */ Z("span", {
872
872
  className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
873
873
  style: {
874
- left: `${V.x * 100}%`,
875
- top: `${V.y * 100}%`
874
+ left: `${B.x * 100}%`,
875
+ top: `${B.y * 100}%`
876
876
  },
877
877
  "data-testid": "focal-point-marker"
878
878
  }),
@@ -885,18 +885,18 @@ function Dt(e) {
885
885
  "data-testid": "cancel-upload",
886
886
  children: "Cancel"
887
887
  }),
888
- p === "error" && _ && /* @__PURE__ */ Q("div", {
888
+ p === "error" && v && /* @__PURE__ */ Q("div", {
889
889
  className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
890
890
  role: "alert",
891
891
  children: [/* @__PURE__ */ Z("span", {
892
892
  className: "truncate",
893
- title: _.message,
894
- children: _.message
893
+ title: v.message,
894
+ children: v.message
895
895
  }), /* @__PURE__ */ Z("button", {
896
896
  type: "button",
897
897
  className: "underline",
898
898
  onClick: (e) => {
899
- e.stopPropagation(), F();
899
+ e.stopPropagation(), ne();
900
900
  },
901
901
  "data-testid": "retry-upload",
902
902
  children: "Retry"
@@ -1020,7 +1020,7 @@ function Bt(e) {
1020
1020
  }
1021
1021
  //#endregion
1022
1022
  //#region src/components/file-widgets/GridLazy.tsx
1023
- var Vt = je(() => import("./Grid-DDbBhqcl.js").then((e) => ({ default: e.Grid })));
1023
+ var Vt = je(() => import("./Grid-5Y_iPqNW.js").then((e) => ({ default: e.Grid })));
1024
1024
  function Ht() {
1025
1025
  return /* @__PURE__ */ Z("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
1026
1026
  }
@@ -1039,60 +1039,60 @@ function Wt({ contentType: e }) {
1039
1039
  });
1040
1040
  }
1041
1041
  function Gt(e) {
1042
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ye(r), [d, f] = Y("idle"), [p, m] = Y(null), [h, g] = Y(null), [_, y] = Y(!1), [b, x] = Y(u?.filename ?? ""), S = J(null), w = J(!1), T = J(null), { register: E, unregister: O, isDraft: k } = C(), { open: A } = Se();
1042
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ye(r), [d, f] = Y("idle"), [p, h] = Y(null), [g, _] = Y(null), [v, y] = Y(!1), [b, S] = Y(u?.filename ?? ""), C = J(null), w = J(!1), E = J(null), { register: D, unregister: O, isDraft: k } = x(), { open: A } = Se();
1043
1043
  K(() => () => {
1044
- S.current && S.current.abort();
1044
+ C.current && C.current.abort();
1045
1045
  }, []), K(() => {
1046
- x(u?.filename ?? "");
1046
+ S(u?.filename ?? "");
1047
1047
  }, [u?.filename]);
1048
1048
  let j = (t.accepts ?? []).join(","), M = G(async (r) => {
1049
- let o = a(r, t.accepts, t.max_size_bytes);
1049
+ let o = i(r, t.accepts, t.max_size_bytes);
1050
1050
  if (o) {
1051
- g(o), f("error");
1051
+ _(o), f("error");
1052
1052
  return;
1053
1053
  }
1054
- g(null), w.current = !1, f("uploading"), m({
1054
+ _(null), w.current = !1, f("uploading"), h({
1055
1055
  loaded: 0,
1056
1056
  total: r.size,
1057
1057
  pct: 0
1058
1058
  });
1059
1059
  let s = new AbortController();
1060
- S.current = s;
1060
+ C.current = s;
1061
1061
  try {
1062
- let a = await v({
1062
+ let i = await m({
1063
1063
  file: r,
1064
1064
  entityCode: e.entityCode,
1065
1065
  fieldCode: c ?? n,
1066
1066
  slotCode: l,
1067
1067
  signal: s.signal,
1068
- onProgress: m
1068
+ onProgress: h
1069
1069
  });
1070
1070
  if (w.current) {
1071
- D(a.id).catch(() => {}), O(a.id);
1071
+ T(i.id).catch(() => {}), O(i.id);
1072
1072
  return;
1073
1073
  }
1074
- u && k(u.id) && (D(u.id).catch(() => {}), O(u.id)), E(a.id, () => D(a.id)), f("idle"), m(null);
1074
+ u && k(u.id) && (T(u.id).catch(() => {}), O(u.id)), D(i.id, () => T(i.id)), f("idle"), h(null);
1075
1075
  let o = {
1076
- id: a.id,
1077
- filename: a.filename,
1078
- content_type: a.content_type,
1079
- size_bytes: a.size_bytes,
1080
- sha256: a.sha256,
1081
- width: a.width,
1082
- height: a.height,
1083
- url: a.url,
1084
- metadata: a.metadata
1076
+ id: i.id,
1077
+ filename: i.filename,
1078
+ content_type: i.content_type,
1079
+ size_bytes: i.size_bytes,
1080
+ sha256: i.sha256,
1081
+ width: i.width,
1082
+ height: i.height,
1083
+ url: i.url,
1084
+ metadata: i.metadata
1085
1085
  };
1086
- i?.(t.mode === "array" ? [o] : o);
1086
+ a?.(t.mode === "array" ? [o] : o);
1087
1087
  } catch (e) {
1088
1088
  if (e instanceof fe && e.code === "ABORTED") return;
1089
- g(e instanceof fe ? {
1089
+ _(e instanceof fe ? {
1090
1090
  code: e.code,
1091
1091
  message: e.message
1092
1092
  } : {
1093
1093
  code: "UNKNOWN",
1094
1094
  message: e instanceof Error ? e.message : "Upload failed"
1095
- }), f("error"), m(null);
1095
+ }), f("error"), h(null);
1096
1096
  }
1097
1097
  }, [
1098
1098
  t.accepts,
@@ -1101,52 +1101,52 @@ function Gt(e) {
1101
1101
  n,
1102
1102
  u,
1103
1103
  k,
1104
- i,
1104
+ a,
1105
1105
  e.entityCode,
1106
- E,
1106
+ D,
1107
1107
  O,
1108
1108
  c,
1109
1109
  l
1110
1110
  ]), N = G(() => {
1111
- s || T.current?.click();
1111
+ s || E.current?.click();
1112
1112
  }, [s]), P = G((e) => {
1113
1113
  let t = e.target.files?.[0];
1114
1114
  e.target.value = "", t && M(t);
1115
1115
  }, [M]), ee = G(() => {
1116
- u && k(u.id) && (D(u.id).catch(() => {}), O(u.id)), i?.(t.mode === "array" ? [] : null);
1116
+ u && k(u.id) && (T(u.id).catch(() => {}), O(u.id)), a?.(t.mode === "array" ? [] : null);
1117
1117
  }, [
1118
1118
  u,
1119
1119
  t.mode,
1120
1120
  k,
1121
- i,
1121
+ a,
1122
1122
  O
1123
1123
  ]), te = G(() => {
1124
- d === "uploading" && S.current && (w.current = !0, S.current.abort(), S.current = null, f("idle"), m(null));
1125
- }, [d]), F = G(() => {
1124
+ d === "uploading" && C.current && (w.current = !0, C.current.abort(), C.current = null, f("idle"), h(null));
1125
+ }, [d]), ne = G(() => {
1126
1126
  u && A(u.id, "download", be(u));
1127
- }, [u, A]), I = u ? pe(u) : !1, L = G(() => {
1127
+ }, [u, A]), F = u ? pe(u) : !1, re = G(() => {
1128
1128
  !u || !pe(u) || A(u.id, "preview", Te(u));
1129
- }, [u, A]), ne = G(() => {
1129
+ }, [u, A]), I = G(() => {
1130
1130
  if (!u) {
1131
1131
  y(!1);
1132
1132
  return;
1133
1133
  }
1134
1134
  let e = b.trim();
1135
1135
  if (y(!1), !e || e === u.filename) {
1136
- x(u.filename);
1136
+ S(u.filename);
1137
1137
  return;
1138
1138
  }
1139
1139
  let n = {
1140
1140
  ...u,
1141
1141
  filename: e
1142
1142
  };
1143
- i?.(t.mode === "array" ? [n] : n);
1143
+ a?.(t.mode === "array" ? [n] : n);
1144
1144
  }, [
1145
1145
  b,
1146
1146
  u,
1147
- i,
1147
+ a,
1148
1148
  t.mode
1149
- ]), R = o === "display";
1149
+ ]), L = o === "display";
1150
1150
  return !u && d !== "uploading" ? /* @__PURE__ */ Q("div", {
1151
1151
  "data-testid": `file-widget-${n}`,
1152
1152
  className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
@@ -1157,7 +1157,7 @@ function Gt(e) {
1157
1157
  children: [/* @__PURE__ */ Z("span", {
1158
1158
  className: "text-sm text-foreground",
1159
1159
  children: t.display?.placeholder || "No document attached"
1160
- }), !R && /* @__PURE__ */ Z("button", {
1160
+ }), !L && /* @__PURE__ */ Z("button", {
1161
1161
  type: "button",
1162
1162
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1163
1163
  onClick: N,
@@ -1166,18 +1166,18 @@ function Gt(e) {
1166
1166
  children: "Upload"
1167
1167
  })]
1168
1168
  }),
1169
- !R && /* @__PURE__ */ Z("input", {
1170
- ref: T,
1169
+ !L && /* @__PURE__ */ Z("input", {
1170
+ ref: E,
1171
1171
  type: "file",
1172
1172
  accept: j || void 0,
1173
1173
  onChange: P,
1174
1174
  style: { display: "none" },
1175
1175
  "data-testid": `file-input-${n}`
1176
1176
  }),
1177
- d === "error" && h && /* @__PURE__ */ Z("div", {
1177
+ d === "error" && g && /* @__PURE__ */ Z("div", {
1178
1178
  className: "ml-auto text-xs text-destructive",
1179
1179
  role: "alert",
1180
- children: h.message
1180
+ children: g.message
1181
1181
  })
1182
1182
  ]
1183
1183
  }) : /* @__PURE__ */ Q("div", {
@@ -1190,22 +1190,22 @@ function Gt(e) {
1190
1190
  /* @__PURE__ */ Q("div", {
1191
1191
  className: "flex min-w-0 flex-1 flex-col gap-1",
1192
1192
  children: [
1193
- _ && u ? /* @__PURE__ */ Z("input", {
1193
+ v && u ? /* @__PURE__ */ Z("input", {
1194
1194
  type: "text",
1195
1195
  className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
1196
1196
  value: b,
1197
1197
  autoFocus: !0,
1198
- onChange: (e) => x(e.target.value),
1199
- onBlur: ne,
1198
+ onChange: (e) => S(e.target.value),
1199
+ onBlur: I,
1200
1200
  onKeyDown: (e) => {
1201
- e.key === "Enter" ? ne() : e.key === "Escape" && (y(!1), x(u.filename));
1201
+ e.key === "Enter" ? I() : e.key === "Escape" && (y(!1), S(u.filename));
1202
1202
  },
1203
1203
  "data-testid": "filename-input"
1204
1204
  }) : /* @__PURE__ */ Z("button", {
1205
1205
  type: "button",
1206
1206
  className: "truncate text-left text-sm font-medium text-foreground hover:underline",
1207
- onClick: () => !R && u && y(!0),
1208
- disabled: R || s || !u,
1207
+ onClick: () => !L && u && y(!0),
1208
+ disabled: L || s || !u,
1209
1209
  title: u?.filename,
1210
1210
  "data-testid": "filename",
1211
1211
  children: u?.filename ?? "Uploading…"
@@ -1236,10 +1236,10 @@ function Gt(e) {
1236
1236
  "%"
1237
1237
  ]
1238
1238
  }),
1239
- d === "error" && h && /* @__PURE__ */ Z("div", {
1239
+ d === "error" && g && /* @__PURE__ */ Z("div", {
1240
1240
  className: "text-xs text-destructive",
1241
1241
  role: "alert",
1242
- children: h.message
1242
+ children: g.message
1243
1243
  })
1244
1244
  ]
1245
1245
  }),
@@ -1249,20 +1249,20 @@ function Gt(e) {
1249
1249
  /* @__PURE__ */ Z("button", {
1250
1250
  type: "button",
1251
1251
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1252
- onClick: F,
1252
+ onClick: ne,
1253
1253
  "data-testid": "download",
1254
1254
  children: "Download"
1255
1255
  }),
1256
1256
  /* @__PURE__ */ Z("button", {
1257
1257
  type: "button",
1258
1258
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
1259
- onClick: L,
1260
- disabled: !I,
1261
- title: I ? void 0 : "Preview is available only for images and PDFs",
1259
+ onClick: re,
1260
+ disabled: !F,
1261
+ title: F ? void 0 : "Preview is available only for images and PDFs",
1262
1262
  "data-testid": "preview",
1263
1263
  children: "Preview"
1264
1264
  }),
1265
- !R && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1265
+ !L && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1266
1266
  type: "button",
1267
1267
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1268
1268
  onClick: N,
@@ -1285,8 +1285,8 @@ function Gt(e) {
1285
1285
  children: "Cancel"
1286
1286
  })]
1287
1287
  }),
1288
- !R && /* @__PURE__ */ Z("input", {
1289
- ref: T,
1288
+ !L && /* @__PURE__ */ Z("input", {
1289
+ ref: E,
1290
1290
  type: "file",
1291
1291
  accept: j || void 0,
1292
1292
  onChange: P,
@@ -1306,16 +1306,16 @@ function qt(e) {
1306
1306
  return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
1307
1307
  }
1308
1308
  function Jt(e) {
1309
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s } = e, c = we(r), [l, u] = Y([]), { register: d, unregister: f, isDraft: p } = C(), m = J(c);
1310
- m.current = c;
1311
- let h = J(null), g = J(/* @__PURE__ */ new Set()), _ = J([]);
1312
- _.current = l;
1309
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s } = e, c = we(r), [l, u] = Y([]), { register: d, unregister: f, isDraft: p } = x(), h = J(c);
1310
+ h.current = c;
1311
+ let g = J(null), _ = J(/* @__PURE__ */ new Set()), v = J([]);
1312
+ v.current = l;
1313
1313
  let { open: y } = Se();
1314
1314
  K(() => () => {
1315
- _.current.forEach((e) => e.abort());
1315
+ v.current.forEach((e) => e.abort());
1316
1316
  }, []);
1317
- let b = (t.accepts ?? []).join(","), x = o === "display", S = G(async (r) => {
1318
- let o = a(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1317
+ let b = (t.accepts ?? []).join(","), S = o === "display", C = G(async (r) => {
1318
+ let o = i(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1319
1319
  if (o) {
1320
1320
  u((e) => [...e, {
1321
1321
  localId: s,
@@ -1338,7 +1338,7 @@ function Jt(e) {
1338
1338
  abort: () => c.abort()
1339
1339
  }]);
1340
1340
  try {
1341
- let t = await v({
1341
+ let t = await m({
1342
1342
  file: r,
1343
1343
  entityCode: e.entityCode,
1344
1344
  fieldCode: n,
@@ -1348,12 +1348,12 @@ function Jt(e) {
1348
1348
  progress: e
1349
1349
  } : t))
1350
1350
  });
1351
- if (g.current.delete(s)) {
1352
- D(t.id).catch(() => {}), f(t.id);
1351
+ if (_.current.delete(s)) {
1352
+ T(t.id).catch(() => {}), f(t.id);
1353
1353
  return;
1354
1354
  }
1355
- d(t.id, () => D(t.id));
1356
- let a = {
1355
+ d(t.id, () => T(t.id));
1356
+ let i = {
1357
1357
  id: t.id,
1358
1358
  filename: t.filename,
1359
1359
  content_type: t.content_type,
@@ -1363,8 +1363,8 @@ function Jt(e) {
1363
1363
  height: t.height,
1364
1364
  url: t.url,
1365
1365
  metadata: t.metadata
1366
- }, o = [...m.current, a];
1367
- m.current = o, i?.(o), u((e) => e.filter((e) => e.localId !== s));
1366
+ }, o = [...h.current, i];
1367
+ h.current = o, a?.(o), u((e) => e.filter((e) => e.localId !== s));
1368
1368
  } catch (e) {
1369
1369
  if (e instanceof fe && e.code === "ABORTED") {
1370
1370
  u((e) => e.filter((e) => e.localId !== s));
@@ -1388,23 +1388,23 @@ function Jt(e) {
1388
1388
  t.accepts,
1389
1389
  t.max_size_bytes,
1390
1390
  n,
1391
- i,
1391
+ a,
1392
1392
  e.entityCode,
1393
1393
  d,
1394
1394
  f
1395
1395
  ]), w = G((e) => {
1396
- Array.from(e).forEach((e) => void S(e));
1397
- }, [S]), T = G(() => {
1398
- s || h.current?.click();
1399
- }, [s]), E = G((e) => {
1396
+ Array.from(e).forEach((e) => void C(e));
1397
+ }, [C]), E = G(() => {
1398
+ s || g.current?.click();
1399
+ }, [s]), D = G((e) => {
1400
1400
  let t = e.target.files;
1401
1401
  e.target.value = "", t && t.length > 0 && w(t);
1402
1402
  }, [w]), O = G((e) => {
1403
- p(e) && (D(e).catch(() => {}), f(e)), i?.(c.filter((t) => t.id !== e));
1403
+ p(e) && (T(e).catch(() => {}), f(e)), a?.(c.filter((t) => t.id !== e));
1404
1404
  }, [
1405
1405
  p,
1406
1406
  c,
1407
- i,
1407
+ a,
1408
1408
  f
1409
1409
  ]), k = G((e) => {
1410
1410
  y(e.id, "download", be(e));
@@ -1445,7 +1445,7 @@ function Jt(e) {
1445
1445
  "data-testid": `download-${e.id}`,
1446
1446
  children: "Download"
1447
1447
  }),
1448
- !x && /* @__PURE__ */ Z("button", {
1448
+ !S && /* @__PURE__ */ Z("button", {
1449
1449
  type: "button",
1450
1450
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive hover:bg-surface-2",
1451
1451
  onClick: () => O(e.id),
@@ -1483,26 +1483,26 @@ function Jt(e) {
1483
1483
  type: "button",
1484
1484
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
1485
1485
  onClick: () => {
1486
- e.abort(), g.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1486
+ e.abort(), _.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1487
1487
  },
1488
1488
  children: e.error ? "Dismiss" : "Cancel"
1489
1489
  })
1490
1490
  ]
1491
1491
  }, e.localId))
1492
1492
  ]
1493
- }), !x && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1493
+ }), !S && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
1494
1494
  type: "button",
1495
1495
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1496
- onClick: T,
1496
+ onClick: E,
1497
1497
  disabled: s,
1498
1498
  "data-testid": "add-files",
1499
1499
  children: "Add files"
1500
1500
  }), /* @__PURE__ */ Z("input", {
1501
- ref: h,
1501
+ ref: g,
1502
1502
  type: "file",
1503
1503
  accept: b || void 0,
1504
1504
  multiple: !0,
1505
- onChange: E,
1505
+ onChange: D,
1506
1506
  style: { display: "none" },
1507
1507
  "data-testid": `file-input-${n}`
1508
1508
  })] })]
@@ -1613,17 +1613,17 @@ function rn(e, t) {
1613
1613
  function an(e, t, n) {
1614
1614
  if (nn(e, n)) return rn(t, n);
1615
1615
  let r = e.fields.get(n);
1616
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? le(t[n], rn(t, n)) : t[n];
1616
+ return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? ue(t[n], rn(t, n)) : t[n];
1617
1617
  }
1618
1618
  function on(e, t, n) {
1619
1619
  let r = e.fields.get(t);
1620
- return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? o(n) : n;
1620
+ return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? a(n) : n;
1621
1621
  }
1622
1622
  function sn(e, t, n) {
1623
1623
  let r = nn(e, t);
1624
1624
  if (r) return r.name || t;
1625
1625
  let i = e.fields.get(t);
1626
- return i ? ie(i, t, n) : t;
1626
+ return i ? H(i, t, n) : t;
1627
1627
  }
1628
1628
  function cn(e) {
1629
1629
  let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m } = e, h = nn(t, r);
@@ -1644,7 +1644,7 @@ function cn(e) {
1644
1644
  });
1645
1645
  }
1646
1646
  let g = t.fields.get(r);
1647
- return g ? L({
1647
+ return g ? z({
1648
1648
  field: g,
1649
1649
  entityCode: n,
1650
1650
  fieldName: r,
@@ -1739,7 +1739,7 @@ function _n(e) {
1739
1739
  }
1740
1740
  function vn(e, t) {
1741
1741
  if (e.mode !== "rich_text_inline") return { clear: !0 };
1742
- let n = c(o(t));
1742
+ let n = s(a(t));
1743
1743
  return n.length === 0 ? { clear: !0 } : { set: n.map((e, t) => ({
1744
1744
  file_id: e,
1745
1745
  position: t
@@ -1749,7 +1749,7 @@ function vn(e, t) {
1749
1749
  //#region src/hooks/useChildrenData.ts
1750
1750
  var yn = "entity-children";
1751
1751
  function bn(e, t, n, r, i, a) {
1752
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? O(t, o.length) : [t];
1752
+ let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? A(t, o.length) : [t];
1753
1753
  return Re({
1754
1754
  queryKey: [
1755
1755
  yn,
@@ -1767,7 +1767,7 @@ function bn(e, t, n, r, i, a) {
1767
1767
  op: "eq",
1768
1768
  value: s[t]
1769
1769
  }));
1770
- return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)), h(`/api/data/${n}?${e.toString()}`);
1770
+ return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)), I(`/api/data/${n}?${e.toString()}`);
1771
1771
  },
1772
1772
  enabled: !!e && !!t && !!n && !!r && s !== null
1773
1773
  });
@@ -1810,7 +1810,7 @@ function Cn(e, t, n, r, i, a, o, s) {
1810
1810
  op: "eq",
1811
1811
  value: t
1812
1812
  });
1813
- return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), h(`/api/data/${n}?${c.toString()}`);
1813
+ return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), I(`/api/data/${n}?${c.toString()}`);
1814
1814
  },
1815
1815
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1816
1816
  initialPageParam: void 0,
@@ -1904,7 +1904,7 @@ function wn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
1904
1904
  children: i
1905
1905
  })]
1906
1906
  }),
1907
- /* @__PURE__ */ Z(b, {
1907
+ /* @__PURE__ */ Z(y, {
1908
1908
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
1909
1909
  onClick: () => !o && n(!1)
1910
1910
  })
@@ -1923,14 +1923,14 @@ function wn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
1923
1923
  },
1924
1924
  children: [
1925
1925
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
1926
- /* @__PURE__ */ Z(d, {
1926
+ /* @__PURE__ */ Z(l, {
1927
1927
  onClick: () => n(!1),
1928
1928
  disabled: o,
1929
1929
  children: "Cancel"
1930
1930
  }),
1931
- /* @__PURE__ */ Z(d, {
1931
+ /* @__PURE__ */ Z(l, {
1932
1932
  kind: "primary",
1933
- icon: Z(o ? F : e.bolt, { size: 13 }),
1933
+ icon: Z(o ? u : e.bolt, { size: 13 }),
1934
1934
  onClick: a,
1935
1935
  disabled: o,
1936
1936
  children: o ? "Executing…" : "Confirm"
@@ -1950,7 +1950,7 @@ function En(e, t, n = {}) {
1950
1950
  function Dn(e) {
1951
1951
  let t = ze();
1952
1952
  return Le({
1953
- mutationFn: (t) => j(e, t),
1953
+ mutationFn: (t) => oe(e, t),
1954
1954
  onSuccess: () => {
1955
1955
  En(t, e), g.success("Record created");
1956
1956
  },
@@ -1960,7 +1960,7 @@ function Dn(e) {
1960
1960
  function On(e) {
1961
1961
  let t = ze();
1962
1962
  return Le({
1963
- mutationFn: ({ pkValues: t, data: n }) => N(e, t, n),
1963
+ mutationFn: ({ pkValues: t, data: n }) => te(e, t, n),
1964
1964
  onSuccess: () => {
1965
1965
  En(t, e, {
1966
1966
  item: !0,
@@ -1974,7 +1974,7 @@ function On(e) {
1974
1974
  function kn(e) {
1975
1975
  let t = ze();
1976
1976
  return Le({
1977
- mutationFn: (t) => se(e, t),
1977
+ mutationFn: (t) => re(e, t),
1978
1978
  onSuccess: () => {
1979
1979
  En(t, e, { item: !0 }), g.success("Record deleted");
1980
1980
  },
@@ -1984,7 +1984,7 @@ function kn(e) {
1984
1984
  function An(e) {
1985
1985
  let t = ze();
1986
1986
  return Le({
1987
- mutationFn: (t) => k(e, t),
1987
+ mutationFn: (t) => j(e, t),
1988
1988
  onSuccess: () => {
1989
1989
  En(t, e, {
1990
1990
  item: !0,
@@ -1998,7 +1998,7 @@ function jn(e) {
1998
1998
  let t = ze();
1999
1999
  return Le({
2000
2000
  mutationFn: async ({ actionCode: e, body: t }) => {
2001
- let n = await W(e, t);
2001
+ let n = await U(e, t);
2002
2002
  if (n.status === "error") throw Error("Action failed for all items");
2003
2003
  return n;
2004
2004
  },
@@ -2023,10 +2023,10 @@ var Mn = {
2023
2023
  function Nn(e, t) {
2024
2024
  if (!e) return "";
2025
2025
  if (t) try {
2026
- return I(t, z(t, e));
2026
+ return N(t, C(t, e));
2027
2027
  } catch {}
2028
2028
  let n = e.id;
2029
- return typeof n == "string" ? n : n == null ? "" : P(n);
2029
+ return typeof n == "string" ? n : n == null ? "" : W(n);
2030
2030
  }
2031
2031
  function Pn(e, t) {
2032
2032
  if (!e || e.length === 0) return !0;
@@ -2042,10 +2042,10 @@ function Pn(e, t) {
2042
2042
  function Fn(e, t) {
2043
2043
  let n = In(t, e.field), r = e.op || "eq";
2044
2044
  if (r === "in" || r === "not_in") {
2045
- let t = Array.isArray(e.value) ? e.value : [e.value], i = P(n), a = t.some((e) => P(e) === i);
2045
+ let t = Array.isArray(e.value) ? e.value : [e.value], i = W(n), a = t.some((e) => W(e) === i);
2046
2046
  return r === "in" ? a : !a;
2047
2047
  }
2048
- return typeof e.value == "boolean" && r === "eq" ? Rn(n) === e.value : typeof n == "number" && typeof e.value == "number" ? zn(n, e.value, r) : zn(P(n), P(e.value), r);
2048
+ return typeof e.value == "boolean" && r === "eq" ? Rn(n) === e.value : typeof n == "number" && typeof e.value == "number" ? zn(n, e.value, r) : zn(W(n), W(e.value), r);
2049
2049
  }
2050
2050
  function In(e, t) {
2051
2051
  if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
@@ -2109,7 +2109,7 @@ function Vn(e, t, n, r) {
2109
2109
  function Hn(e, t) {
2110
2110
  return e.filter(({ code: e }) => {
2111
2111
  let n = Mn[e];
2112
- return !n || oe(t, n);
2112
+ return !n || F(t, n);
2113
2113
  });
2114
2114
  }
2115
2115
  function Un(e) {
@@ -2118,7 +2118,7 @@ function Un(e) {
2118
2118
  }
2119
2119
  function Wn(e, t, n, r) {
2120
2120
  if (n && r) return r;
2121
- let i = V(e?.display?.description);
2121
+ let i = R(e?.display?.description);
2122
2122
  return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
2123
2123
  }
2124
2124
  function Gn(e) {
@@ -2282,227 +2282,227 @@ function sr(e, t) {
2282
2282
  }
2283
2283
  //#endregion
2284
2284
  //#region src/components/shared/ActionButton.tsx
2285
- function cr({ actionCode: r, action: i, entityCode: a, objectIds: o = [], row: s, variant: c = "outline", size: l = "default", onSuccess: u, onBatchStart: f, onBatchError: p, onBatchPartial: m }) {
2286
- let [h, _] = Y(!1), [v, y] = Y(!1), [x, S] = Y(!1), [C, w] = Y(null), T = jn(a), { data: E } = U(), D = bt(), O = Gn(i), k = Un(i), j = !!i.confirmation && Object.keys(i.confirmation).length > 0, M = s ? Pn(i.conditions, s) : !0, N = G(async () => {
2287
- if (!(!i.association || o.length === 0)) {
2288
- S(!0);
2285
+ function cr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: o, variant: s = "outline", size: c = "default", onSuccess: u, onBatchStart: d, onBatchError: f, onBatchPartial: p }) {
2286
+ let [m, h] = Y(!1), [_, v] = Y(!1), [b, x] = Y(!1), [S, C] = Y(null), w = jn(i), { data: T } = P(), E = bt(), D = Gn(r), O = Un(r), A = !!r.confirmation && Object.keys(r.confirmation).length > 0, j = o ? Pn(r.conditions, o) : !0, M = G(async () => {
2287
+ if (!(!r.association || a.length === 0)) {
2288
+ x(!0);
2289
2289
  try {
2290
- let e = await ae(a ? `${a}.${i.association}` : i.association, o), t = Kn(E, e.target_entity);
2290
+ let e = await le(i ? `${i}.${r.association}` : r.association, a), t = Kn(T, e.target_entity);
2291
2291
  if (!t) {
2292
2292
  g.error(`No list screen found for ${e.target_entity}`);
2293
2293
  return;
2294
2294
  }
2295
- let n = E?.entities[e.target_entity], r = V(i.display?.name) || e.target_entity;
2295
+ let n = T?.entities[e.target_entity], o = R(r.display?.name) || e.target_entity;
2296
2296
  if (e.ids.length === 0) {
2297
- g.info(`No related ${r} found`);
2297
+ g.info(`No related ${o} found`);
2298
2298
  return;
2299
2299
  }
2300
2300
  let s = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", c = new URLSearchParams();
2301
- c.set(`filter_${s}`, e.ids.join(",")), D(t.route, {
2302
- title: r,
2303
- icon: i.display?.icon || t.icon,
2301
+ c.set(`filter_${s}`, e.ids.join(",")), E(t.route, {
2302
+ title: o,
2303
+ icon: r.display?.icon || t.icon,
2304
2304
  search: c.toString()
2305
2305
  }), u?.();
2306
2306
  } catch (e) {
2307
2307
  g.error(e instanceof Error ? e.message : "Failed to resolve association");
2308
2308
  } finally {
2309
- S(!1);
2309
+ x(!1);
2310
2310
  }
2311
2311
  }
2312
2312
  }, [
2313
+ r,
2313
2314
  i,
2314
2315
  a,
2315
- o,
2316
+ T,
2316
2317
  E,
2317
- D,
2318
2318
  u
2319
- ]), P = i.entity ? `${i.entity}.${r}` : r, te = o.length > 0 ? o : void 0, F = i.resolved_hidden_defaults && Object.keys(i.resolved_hidden_defaults).length > 0 ? i.resolved_hidden_defaults : void 0, I = G((e, t) => {
2319
+ ]), N = r.entity ? `${r.entity}.${n}` : n, ee = a.length > 0 ? a : void 0, te = r.resolved_hidden_defaults && Object.keys(r.resolved_hidden_defaults).length > 0 ? r.resolved_hidden_defaults : void 0, F = G((e, t) => {
2320
2320
  if (t?.(), e.status === "accepted") {
2321
2321
  u?.();
2322
2322
  return;
2323
2323
  }
2324
2324
  let n = e.result?.$display;
2325
2325
  if (n) {
2326
- w(n);
2326
+ C(n);
2327
2327
  return;
2328
2328
  }
2329
- e.status === "partial" ? m?.(o.length, e.success) : u?.();
2329
+ e.status === "partial" ? p?.(a.length, e.success) : u?.();
2330
2330
  }, [
2331
- o.length,
2331
+ a.length,
2332
2332
  u,
2333
- m
2334
- ]), L = G(() => {
2335
- if (A(i)) {
2336
- ce(i.ui_steps, { row: s }).then(() => u?.());
2333
+ p
2334
+ ]), re = G(() => {
2335
+ if (k(r)) {
2336
+ ce(r.ui_steps, { row: o }).then(() => u?.());
2337
2337
  return;
2338
2338
  }
2339
- if (O) {
2340
- N();
2339
+ if (D) {
2340
+ M();
2341
2341
  return;
2342
2342
  }
2343
- if (i.href && !i.handler && !i.association) {
2344
- let e = Nn(s, a ? E?.entities[a] : void 0), t = i.href;
2345
- a && (t = t.replaceAll("${entity}", a)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), D(t, {
2346
- title: V(i.display?.name) || r,
2347
- icon: i.display?.icon
2343
+ if (r.href && !r.handler && !r.association) {
2344
+ let e = Nn(o, i ? T?.entities[i] : void 0), t = r.href;
2345
+ i && (t = t.replaceAll("${entity}", i)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), E(t, {
2346
+ title: R(r.display?.name) || n,
2347
+ icon: r.display?.icon
2348
2348
  }), u?.();
2349
2349
  return;
2350
2350
  }
2351
- k ? _(!0) : j ? y(!0) : (f?.(o.length), T.mutate({
2352
- actionCode: P,
2353
- body: n(F, te)
2351
+ O ? h(!0) : A ? v(!0) : (d?.(a.length), w.mutate({
2352
+ actionCode: N,
2353
+ body: V(te, ee)
2354
2354
  }, {
2355
- onSuccess: (e) => I(e),
2356
- onError: () => p?.(o.length)
2355
+ onSuccess: (e) => F(e),
2356
+ onError: () => f?.(a.length)
2357
2357
  }));
2358
2358
  }, [
2359
- i,
2360
- s,
2361
- a,
2362
- E?.entities,
2363
2359
  r,
2360
+ o,
2361
+ i,
2362
+ T?.entities,
2363
+ n,
2364
+ E,
2364
2365
  D,
2365
2366
  O,
2366
- k,
2367
- j,
2368
- P,
2367
+ A,
2368
+ N,
2369
+ ee,
2370
+ a,
2369
2371
  te,
2370
- o,
2372
+ w,
2371
2373
  F,
2372
- T,
2373
- I,
2374
- N,
2374
+ M,
2375
+ d,
2375
2376
  f,
2376
- p,
2377
2377
  u
2378
- ]), ne = G(() => {
2379
- f?.(o.length), T.mutate({
2380
- actionCode: P,
2381
- body: n(F, te)
2378
+ ]), I = G(() => {
2379
+ d?.(a.length), w.mutate({
2380
+ actionCode: N,
2381
+ body: V(te, ee)
2382
2382
  }, {
2383
- onSuccess: (e) => I(e, () => y(!1)),
2384
- onError: () => p?.(o.length)
2383
+ onSuccess: (e) => F(e, () => v(!1)),
2384
+ onError: () => f?.(a.length)
2385
2385
  });
2386
2386
  }, [
2387
- P,
2387
+ N,
2388
+ ee,
2389
+ a,
2388
2390
  te,
2389
- o,
2391
+ w,
2390
2392
  F,
2391
- T,
2392
- I,
2393
- f,
2394
- p
2395
- ]), R = G((e) => {
2396
- f?.(o.length), T.mutate({
2397
- actionCode: P,
2398
- body: n(e, te)
2393
+ d,
2394
+ f
2395
+ ]), L = G((e) => {
2396
+ d?.(a.length), w.mutate({
2397
+ actionCode: N,
2398
+ body: V(e, ee)
2399
2399
  }, {
2400
- onSuccess: (e) => I(e, () => _(!1)),
2401
- onError: () => p?.(o.length)
2400
+ onSuccess: (e) => F(e, () => h(!1)),
2401
+ onError: () => f?.(a.length)
2402
2402
  });
2403
2403
  }, [
2404
- P,
2405
- te,
2406
- o,
2407
- T,
2408
- I,
2409
- f,
2410
- p
2411
- ]), z = V(i.display?.name), B = i.display?.icon, H = B && e[B], ie = H ? /* @__PURE__ */ Z(H, { size: 13 }) : B ? /* @__PURE__ */ Z(t, {
2404
+ N,
2405
+ ee,
2406
+ a,
2407
+ w,
2408
+ F,
2409
+ d,
2410
+ f
2411
+ ]), z = R(r.display?.name), B = r.display?.icon, H = B && e[B], U = H ? /* @__PURE__ */ Z(H, { size: 13 }) : B ? /* @__PURE__ */ Z(t, {
2412
2412
  name: B,
2413
2413
  size: 13
2414
- }) : null, W = !M || T.isPending || x;
2414
+ }) : null, ie = !j || w.isPending || b;
2415
2415
  return /* @__PURE__ */ Q(X, { children: [
2416
- l === "icon" ? /* @__PURE__ */ Z(b, {
2417
- icon: ie ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
2418
- onClick: L,
2416
+ c === "icon" ? /* @__PURE__ */ Z(y, {
2417
+ icon: U ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
2418
+ onClick: re,
2419
2419
  title: z
2420
- }) : /* @__PURE__ */ Z(d, {
2421
- kind: c === "default" ? "primary" : c === "ghost" ? "ghost" : "default",
2420
+ }) : /* @__PURE__ */ Z(l, {
2421
+ kind: s === "default" ? "primary" : s === "ghost" ? "ghost" : "default",
2422
2422
  size: "sm",
2423
- icon: ie,
2424
- danger: i.destructive,
2425
- onClick: L,
2426
- disabled: W,
2423
+ icon: U,
2424
+ danger: r.destructive,
2425
+ onClick: re,
2426
+ disabled: ie,
2427
2427
  title: z,
2428
2428
  "aria-label": z,
2429
2429
  children: z
2430
2430
  }),
2431
- k && /* @__PURE__ */ Z(ee, {
2432
- open: h,
2433
- onOpenChange: _,
2434
- action: i,
2431
+ O && /* @__PURE__ */ Z(ne, {
2432
+ open: m,
2433
+ onOpenChange: h,
2434
+ action: r,
2435
2435
  actionName: z,
2436
- onSubmit: R,
2437
- isPending: T.isPending,
2438
- row: s
2436
+ onSubmit: L,
2437
+ isPending: w.isPending,
2438
+ row: o
2439
2439
  }),
2440
- j && /* @__PURE__ */ Z(wn, {
2441
- open: v,
2442
- onOpenChange: y,
2440
+ A && /* @__PURE__ */ Z(wn, {
2441
+ open: _,
2442
+ onOpenChange: v,
2443
2443
  actionName: z,
2444
- message: V(i.confirmation),
2445
- onConfirm: ne,
2446
- isPending: T.isPending
2444
+ message: R(r.confirmation),
2445
+ onConfirm: I,
2446
+ isPending: w.isPending
2447
2447
  }),
2448
- C && /* @__PURE__ */ Z(re, {
2449
- open: !!C,
2448
+ S && /* @__PURE__ */ Z(ae, {
2449
+ open: !!S,
2450
2450
  onClose: () => {
2451
- w(null), u?.();
2451
+ C(null), u?.();
2452
2452
  },
2453
- display: C
2453
+ display: S
2454
2454
  })
2455
2455
  ] });
2456
2456
  }
2457
2457
  //#endregion
2458
2458
  //#region src/components/shared/RowActionsKebab.tsx
2459
- function lr({ actions: t, objectIds: i, row: a, onSuccess: o, preMenu: s, divider: c, size: l = 22, align: u = "end" }) {
2460
- let d = J(null), [f, p] = Y(!1), { run: m } = R();
2461
- if (!s && t.length === 0) return null;
2462
- let h = (e) => () => {
2463
- p(!1), e();
2459
+ function lr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: o, size: s = 22, align: c = "end" }) {
2460
+ let l = J(null), [u, d] = Y(!1), { run: p } = B();
2461
+ if (!a && t.length === 0) return null;
2462
+ let m = (e) => () => {
2463
+ d(!1), e();
2464
2464
  };
2465
2465
  return /* @__PURE__ */ Q("div", {
2466
2466
  className: "sl-row-actions",
2467
- "data-open": f ? "true" : void 0,
2467
+ "data-open": u ? "true" : void 0,
2468
2468
  style: {
2469
2469
  display: "flex",
2470
2470
  alignItems: "center",
2471
2471
  justifyContent: "flex-end"
2472
2472
  },
2473
- children: [/* @__PURE__ */ Z(b, {
2474
- ref: d,
2475
- size: l,
2476
- icon: /* @__PURE__ */ Z(e.more, { size: Math.round(l * .55) }),
2477
- onClick: () => p((e) => !e),
2473
+ children: [/* @__PURE__ */ Z(y, {
2474
+ ref: l,
2475
+ size: s,
2476
+ icon: /* @__PURE__ */ Z(e.more, { size: Math.round(s * .55) }),
2477
+ onClick: () => d((e) => !e),
2478
2478
  title: "Actions"
2479
2479
  }), /* @__PURE__ */ Q(_, {
2480
- open: f,
2481
- anchor: d.current,
2482
- onClose: () => p(!1),
2480
+ open: u,
2481
+ anchor: l.current,
2482
+ onClose: () => d(!1),
2483
2483
  width: 200,
2484
- align: u,
2484
+ align: c,
2485
2485
  children: [
2486
- s,
2487
- s && c && t.length > 0 && /* @__PURE__ */ Z(r, { divider: !0 }),
2488
- t.map(({ code: t, action: s }) => {
2489
- let c = a ? Pn(s.conditions, a) : !0, l = V(s.display?.name) || t, u = s.display?.icon, d = u && e[u] ? e[u] : void 0;
2490
- return /* @__PURE__ */ Z(r, {
2491
- icon: d ? /* @__PURE__ */ Z(d, { size: 12 }) : null,
2492
- danger: s.destructive,
2493
- onClick: h(() => {
2494
- if (!c) return;
2495
- let e = s.entity ? `${s.entity}.${t}` : t;
2496
- m({
2497
- action: s,
2498
- title: l,
2486
+ a,
2487
+ a && o && t.length > 0 && /* @__PURE__ */ Z(f, { divider: !0 }),
2488
+ t.map(({ code: t, action: a }) => {
2489
+ let o = r ? Pn(a.conditions, r) : !0, s = R(a.display?.name) || t, c = a.display?.icon, l = c && e[c] ? e[c] : void 0;
2490
+ return /* @__PURE__ */ Z(f, {
2491
+ icon: l ? /* @__PURE__ */ Z(l, { size: 12 }) : null,
2492
+ danger: a.destructive,
2493
+ onClick: m(() => {
2494
+ if (!o) return;
2495
+ let e = a.entity ? `${a.entity}.${t}` : t;
2496
+ p({
2497
+ action: a,
2498
+ title: s,
2499
2499
  execute: async (t) => {
2500
- let r = await W(e, n(t, i));
2501
- return o?.(), r;
2500
+ let r = await U(e, V(t, n));
2501
+ return i?.(), r;
2502
2502
  }
2503
2503
  });
2504
2504
  }),
2505
- children: l
2505
+ children: s
2506
2506
  }, t);
2507
2507
  })
2508
2508
  ]
@@ -2511,80 +2511,80 @@ function lr({ actions: t, objectIds: i, row: a, onSuccess: o, preMenu: s, divide
2511
2511
  }
2512
2512
  //#endregion
2513
2513
  //#region src/components/detail-layout/AssociatedToolbar.tsx
2514
- function ur({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: c, allEntities: l }) {
2515
- let u = n === !0, d = r && r.length > 0;
2516
- return !u && !d ? null : /* @__PURE__ */ Q("div", {
2514
+ function ur({ entity: t, searchable: n, filterFields: i, searchValue: a, onSearchChange: s, filters: c, onFilterChange: l, allEntities: u }) {
2515
+ let d = n === !0, f = i && i.length > 0;
2516
+ return !d && !f ? null : /* @__PURE__ */ Q("div", {
2517
2517
  style: {
2518
2518
  display: "flex",
2519
2519
  alignItems: "center",
2520
2520
  gap: 6,
2521
2521
  marginBottom: 8
2522
2522
  },
2523
- children: [u && /* @__PURE__ */ Z("div", {
2523
+ children: [d && /* @__PURE__ */ Z("div", {
2524
2524
  style: {
2525
2525
  flex: 1,
2526
2526
  maxWidth: 220
2527
2527
  },
2528
- children: /* @__PURE__ */ Z(s, {
2529
- value: i,
2530
- onChange: a,
2528
+ children: /* @__PURE__ */ Z(r, {
2529
+ value: a,
2530
+ onChange: s,
2531
2531
  placeholder: "Search…",
2532
2532
  prefix: /* @__PURE__ */ Z(e.search, { size: 12 })
2533
2533
  })
2534
- }), d && r.map((e) => {
2534
+ }), f && i.map((e) => {
2535
2535
  let n = t.fields.get(e);
2536
2536
  if (!n) return null;
2537
- let r = o[e] ?? "__all__", i = ie(n, e, l);
2537
+ let r = c[e] ?? "__all__", i = H(n, e, u);
2538
2538
  return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ Z(dr, {
2539
2539
  field: n,
2540
2540
  label: i,
2541
2541
  value: r,
2542
- onChange: (t) => c(e, t)
2542
+ onChange: (t) => l(e, t)
2543
2543
  }, e) : n.values ? /* @__PURE__ */ Z("div", {
2544
2544
  style: { width: 160 },
2545
- children: /* @__PURE__ */ Z(ue, {
2545
+ children: /* @__PURE__ */ Z(o, {
2546
2546
  value: r,
2547
2547
  options: [{
2548
2548
  value: "__all__",
2549
2549
  label: `All ${i}`
2550
2550
  }, ...n.values.map((e) => ({
2551
2551
  value: e.code,
2552
- label: V(e.name) || e.code
2552
+ label: R(e.name) || e.code
2553
2553
  }))],
2554
- onChange: (t) => c(e, t),
2554
+ onChange: (t) => l(e, t),
2555
2555
  placeholder: i
2556
2556
  })
2557
2557
  }, e) : null;
2558
2558
  })]
2559
2559
  });
2560
2560
  }
2561
- function dr({ field: e, label: t, value: n, onChange: r }) {
2562
- let i = m(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = p(e.ref?.entity, {
2561
+ function dr({ field: e, label: t, value: r, onChange: i }) {
2562
+ let a = L(e.ref?.entity), s = e.display?.ref_display_field ?? a?.display?.display_field, c = q(() => a ? [...a.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [a]), { data: l } = d(e.ref?.entity, {
2563
2563
  per_page: 200,
2564
- sort: a ? `${a}:asc` : void 0
2565
- }), c = s?.data ?? [], l = (e) => {
2564
+ sort: s ? `${s}:asc` : void 0
2565
+ }), u = l?.data ?? [], f = (e) => {
2566
2566
  if (e == null) return "—";
2567
2567
  if (typeof e == "object" && !Array.isArray(e)) {
2568
2568
  let t = Object.values(e)[0];
2569
- return t == null ? "—" : P(t);
2569
+ return t == null ? "—" : W(t);
2570
2570
  }
2571
- return P(e);
2571
+ return W(e);
2572
2572
  };
2573
2573
  return /* @__PURE__ */ Z("div", {
2574
2574
  style: { width: 160 },
2575
- children: /* @__PURE__ */ Z(ue, {
2576
- value: n,
2575
+ children: /* @__PURE__ */ Z(o, {
2576
+ value: r,
2577
2577
  options: [{
2578
2578
  value: "__all__",
2579
2579
  label: `All ${t}`
2580
- }, ...c.map((e) => {
2581
- let t = String(e[o]), n = e[x];
2580
+ }, ...u.map((e) => {
2581
+ let t = String(e[c]), r = e[n];
2582
2582
  return {
2583
2583
  value: t,
2584
- label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
2584
+ label: typeof r == "string" && r !== "" ? r : s ? f(e[s] ?? t) : t
2585
2585
  };
2586
2586
  })],
2587
- onChange: r,
2587
+ onChange: i,
2588
2588
  placeholder: t
2589
2589
  })
2590
2590
  });
@@ -2660,7 +2660,7 @@ function vr(e, t, n) {
2660
2660
  if (n && e in n) return n[e];
2661
2661
  }
2662
2662
  function yr(e, t, n) {
2663
- return V(vr(e, t, n)?.display?.name) || e;
2663
+ return R(vr(e, t, n)?.display?.name) || e;
2664
2664
  }
2665
2665
  function br(e, t, n) {
2666
2666
  return vr(e, t, n)?.display?.icon || void 0;
@@ -2668,32 +2668,32 @@ function br(e, t, n) {
2668
2668
  function xr(e) {
2669
2669
  return `action-tooltip-${e}`;
2670
2670
  }
2671
- function Sr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: l, widgetContext: u, onActionClick: f }) {
2672
- let p = vr(e.code, n, r), m = yr(e.code, n, r), h = br(e.code, n, r), g = p?.destructive ?? !1, _ = !g && p?.display?.primary === !0, v = !e.enabled, y = v ? xr(e.code) : void 0, b = G(async () => {
2673
- if (!(!p || v || a)) {
2671
+ function Sr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: d, widgetContext: f, onActionClick: p }) {
2672
+ let m = vr(e.code, n, r), h = yr(e.code, n, r), g = br(e.code, n, r), _ = m?.destructive ?? !1, v = !_ && m?.display?.primary === !0, y = !e.enabled, b = y ? xr(e.code) : void 0, x = G(async () => {
2673
+ if (!(!m || y || a)) {
2674
2674
  o(!0);
2675
2675
  try {
2676
- mr(e.code, p, l, u, f) || await Promise.resolve(i(e.code, p));
2676
+ mr(e.code, m, d, f, p) || await Promise.resolve(i(e.code, m));
2677
2677
  } finally {
2678
2678
  o(!1);
2679
2679
  }
2680
2680
  }
2681
2681
  }, [
2682
- p,
2683
- v,
2682
+ m,
2683
+ y,
2684
2684
  a,
2685
2685
  i,
2686
2686
  e.code,
2687
2687
  o,
2688
- l,
2689
- u,
2690
- f
2691
- ]), x = a ? /* @__PURE__ */ Z(F, { size: 12 }) : h ? /* @__PURE__ */ Z(t, {
2692
- name: h,
2688
+ d,
2689
+ f,
2690
+ p
2691
+ ]), S = a ? /* @__PURE__ */ Z(u, { size: 12 }) : g ? /* @__PURE__ */ Z(t, {
2692
+ name: g,
2693
2693
  size: 12
2694
2694
  }) : null;
2695
- return /* @__PURE__ */ Q(X, { children: [y && e.reason && /* @__PURE__ */ Z("span", {
2696
- id: y,
2695
+ return /* @__PURE__ */ Q(X, { children: [b && e.reason && /* @__PURE__ */ Z("span", {
2696
+ id: b,
2697
2697
  role: "tooltip",
2698
2698
  style: {
2699
2699
  position: "absolute",
@@ -2703,59 +2703,59 @@ function Sr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2703
2703
  clip: "rect(0,0,0,0)"
2704
2704
  },
2705
2705
  children: e.reason
2706
- }), /* @__PURE__ */ Z(d, {
2706
+ }), /* @__PURE__ */ Z(l, {
2707
2707
  ref: s,
2708
- kind: _ ? "primary" : "default",
2709
- danger: g,
2710
- icon: x,
2711
- disabled: v || a,
2712
- "aria-disabled": v ? "true" : void 0,
2713
- "aria-describedby": y,
2714
- title: Wn(p, m, v, e.reason),
2715
- onClick: b,
2708
+ kind: v ? "primary" : "default",
2709
+ danger: _,
2710
+ icon: S,
2711
+ disabled: y || a,
2712
+ "aria-disabled": y ? "true" : void 0,
2713
+ "aria-describedby": b,
2714
+ title: Wn(m, h, y, e.reason),
2715
+ onClick: x,
2716
2716
  style: c,
2717
- children: m
2717
+ children: h
2718
2718
  })] });
2719
2719
  }
2720
- function Cr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: l }) {
2721
- let u = J(null), [f, p] = Y(!1), m = n.name ? V(n.name) : "Actions", h = G((e) => {
2722
- u.current = e, c?.(e);
2723
- }, [c]), g = G((e, t) => (p(!1), a(e, t)), [a]);
2724
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(d, {
2725
- ref: h,
2720
+ function Cr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: d }) {
2721
+ let f = J(null), [p, m] = Y(!1), h = n.name ? R(n.name) : "Actions", g = G((e) => {
2722
+ f.current = e, c?.(e);
2723
+ }, [c]), v = G((e, t) => (m(!1), a(e, t)), [a]);
2724
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
2725
+ ref: g,
2726
2726
  kind: "default",
2727
2727
  icon: o == null ? n.icon ? /* @__PURE__ */ Z(t, {
2728
2728
  name: n.icon,
2729
2729
  size: 12
2730
- }) : void 0 : /* @__PURE__ */ Z(F, { size: 12 }),
2730
+ }) : void 0 : /* @__PURE__ */ Z(u, { size: 12 }),
2731
2731
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
2732
2732
  "aria-haspopup": "menu",
2733
- "aria-expanded": f ? "true" : "false",
2734
- title: m,
2735
- onClick: () => p((e) => !e),
2736
- style: l,
2737
- children: m
2733
+ "aria-expanded": p ? "true" : "false",
2734
+ title: h,
2735
+ onClick: () => m((e) => !e),
2736
+ style: d,
2737
+ children: h
2738
2738
  }), /* @__PURE__ */ Z(_, {
2739
- open: f,
2740
- anchor: u.current,
2741
- onClose: () => p(!1),
2739
+ open: p,
2740
+ anchor: f.current,
2741
+ onClose: () => m(!1),
2742
2742
  align: "start",
2743
2743
  width: 200,
2744
2744
  children: /* @__PURE__ */ Z("div", {
2745
2745
  role: "menu",
2746
- "aria-label": m,
2746
+ "aria-label": h,
2747
2747
  children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(wr, {
2748
2748
  leaf: e,
2749
2749
  entityActions: r,
2750
2750
  globalActions: i,
2751
- onRun: g,
2751
+ onRun: v,
2752
2752
  loading: o === e.code,
2753
2753
  onLoadingChange: (t) => s(t ? e.code : null)
2754
2754
  }, e.code) : /* @__PURE__ */ Z(Tr, {
2755
2755
  group: e,
2756
2756
  entityActions: r,
2757
2757
  globalActions: i,
2758
- onRun: g,
2758
+ onRun: v,
2759
2759
  loading: o,
2760
2760
  onLoadingChange: s
2761
2761
  }, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
@@ -2763,12 +2763,12 @@ function Cr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
2763
2763
  })] });
2764
2764
  }
2765
2765
  function wr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
2766
- let u = vr(e.code, n, r), d = yr(e.code, n, r), f = br(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? xr(e.code) : void 0, g = a ? /* @__PURE__ */ Z(F, { size: 12 }) : f ? /* @__PURE__ */ Z(t, {
2767
- name: f,
2766
+ let d = vr(e.code, n, r), f = yr(e.code, n, r), p = br(e.code, n, r), m = d?.destructive ?? !1, h = !e.enabled, g = h ? xr(e.code) : void 0, _ = a ? /* @__PURE__ */ Z(u, { size: 12 }) : p ? /* @__PURE__ */ Z(t, {
2767
+ name: p,
2768
2768
  size: 12
2769
2769
  }) : null;
2770
- return /* @__PURE__ */ Q(X, { children: [h && e.reason && /* @__PURE__ */ Z("span", {
2771
- id: h,
2770
+ return /* @__PURE__ */ Q(X, { children: [g && e.reason && /* @__PURE__ */ Z("span", {
2771
+ id: g,
2772
2772
  role: "tooltip",
2773
2773
  style: {
2774
2774
  position: "absolute",
@@ -2780,14 +2780,14 @@ function wr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2780
2780
  children: e.reason
2781
2781
  }), /* @__PURE__ */ Q("div", {
2782
2782
  role: "menuitem",
2783
- "aria-disabled": m ? "true" : void 0,
2784
- "aria-describedby": h,
2785
- title: Wn(u, d, m, e.reason),
2783
+ "aria-disabled": h ? "true" : void 0,
2784
+ "aria-describedby": g,
2785
+ title: Wn(d, f, h, e.reason),
2786
2786
  onClick: async () => {
2787
- if (!(!u || m || a)) {
2787
+ if (!(!d || h || a)) {
2788
2788
  o(!0);
2789
2789
  try {
2790
- mr(e.code, u, s, c, l) || await Promise.resolve(i(e.code, u));
2790
+ mr(e.code, d, s, c, l) || await Promise.resolve(i(e.code, d));
2791
2791
  } finally {
2792
2792
  o(!1);
2793
2793
  }
@@ -2800,30 +2800,30 @@ function wr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2800
2800
  padding: "6px 10px",
2801
2801
  borderRadius: 5,
2802
2802
  fontSize: 12.5,
2803
- color: p ? "var(--danger)" : m ? "var(--text-3)" : "var(--text-2)",
2804
- cursor: m ? "not-allowed" : "pointer",
2805
- opacity: m ? .6 : 1
2803
+ color: m ? "var(--danger)" : h ? "var(--text-3)" : "var(--text-2)",
2804
+ cursor: h ? "not-allowed" : "pointer",
2805
+ opacity: h ? .6 : 1
2806
2806
  },
2807
2807
  onMouseEnter: (e) => {
2808
- m || (e.currentTarget.style.background = "var(--surface-3)");
2808
+ h || (e.currentTarget.style.background = "var(--surface-3)");
2809
2809
  },
2810
2810
  onMouseLeave: (e) => {
2811
2811
  e.currentTarget.style.background = "transparent";
2812
2812
  },
2813
- children: [g && /* @__PURE__ */ Z("span", {
2813
+ children: [_ && /* @__PURE__ */ Z("span", {
2814
2814
  style: {
2815
- color: p ? "var(--danger)" : "var(--text-3)",
2815
+ color: m ? "var(--danger)" : "var(--text-3)",
2816
2816
  display: "flex"
2817
2817
  },
2818
- children: g
2818
+ children: _
2819
2819
  }), /* @__PURE__ */ Z("span", {
2820
2820
  style: { flex: 1 },
2821
- children: d
2821
+ children: f
2822
2822
  })]
2823
2823
  })] });
2824
2824
  }
2825
2825
  function Tr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
2826
- let l = e.name ? V(e.name) : void 0;
2826
+ let l = e.name ? R(e.name) : void 0;
2827
2827
  return /* @__PURE__ */ Q(X, { children: [l && /* @__PURE__ */ Z("div", {
2828
2828
  style: {
2829
2829
  padding: "4px 10px 2px",
@@ -2856,66 +2856,66 @@ function Tr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
2856
2856
  onActionClick: c
2857
2857
  }, e.icon ?? "nested"))] });
2858
2858
  }
2859
- function Er({ layout: t, entityActions: n, globalActions: i, onRun: a, trailingNormalItems: o, trailingDestructiveItems: s, row: c, widgetContext: l, onActionClick: u }) {
2860
- let d = J(null), [f, p] = Y(!1), [m, h] = Y(null), g = G((e, t) => (p(!1), a(e, t)), [a]), v = o != null && o !== !1, y = s != null && s !== !1;
2861
- if (hr(t) === 0 && !v && !y) return null;
2862
- let { normal: x, destructive: S } = gr(t, n, i), C = S.length > 0 || y;
2859
+ function Er({ layout: t, entityActions: n, globalActions: r, onRun: i, trailingNormalItems: a, trailingDestructiveItems: o, row: s, widgetContext: c, onActionClick: l }) {
2860
+ let d = J(null), [p, m] = Y(!1), [h, g] = Y(null), v = G((e, t) => (m(!1), i(e, t)), [i]), b = a != null && a !== !1, x = o != null && o !== !1;
2861
+ if (hr(t) === 0 && !b && !x) return null;
2862
+ let { normal: S, destructive: C } = gr(t, n, r), w = C.length > 0 || x;
2863
2863
  return /* @__PURE__ */ Q("div", {
2864
2864
  style: {
2865
2865
  display: "inline-flex",
2866
2866
  alignItems: "center"
2867
2867
  },
2868
- children: [/* @__PURE__ */ Z(b, {
2868
+ children: [/* @__PURE__ */ Z(y, {
2869
2869
  ref: d,
2870
- icon: Z(m == null ? e.more : F, { size: 14 }),
2870
+ icon: Z(h == null ? e.more : u, { size: 14 }),
2871
2871
  title: "Actions",
2872
2872
  size: 28,
2873
- onClick: () => p((e) => !e)
2873
+ onClick: () => m((e) => !e)
2874
2874
  }), /* @__PURE__ */ Z(_, {
2875
- open: f,
2875
+ open: p,
2876
2876
  anchor: d.current,
2877
- onClose: () => p(!1),
2877
+ onClose: () => m(!1),
2878
2878
  align: "end",
2879
2879
  width: 220,
2880
2880
  children: /* @__PURE__ */ Q("div", {
2881
2881
  role: "menu",
2882
2882
  "aria-label": "Row actions",
2883
2883
  children: [
2884
- x.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(wr, {
2884
+ S.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(wr, {
2885
2885
  leaf: e,
2886
2886
  entityActions: n,
2887
- globalActions: i,
2888
- onRun: g,
2889
- loading: m === e.code,
2890
- onLoadingChange: (t) => h(t ? e.code : null),
2891
- row: c,
2892
- widgetContext: l,
2893
- onActionClick: u
2887
+ globalActions: r,
2888
+ onRun: v,
2889
+ loading: h === e.code,
2890
+ onLoadingChange: (t) => g(t ? e.code : null),
2891
+ row: s,
2892
+ widgetContext: c,
2893
+ onActionClick: l
2894
2894
  }, e.code) : /* @__PURE__ */ Z(Tr, {
2895
2895
  group: e,
2896
2896
  entityActions: n,
2897
- globalActions: i,
2898
- onRun: g,
2899
- loading: m,
2900
- onLoadingChange: h,
2901
- row: c,
2902
- widgetContext: l,
2903
- onActionClick: u
2897
+ globalActions: r,
2898
+ onRun: v,
2899
+ loading: h,
2900
+ onLoadingChange: g,
2901
+ row: s,
2902
+ widgetContext: c,
2903
+ onActionClick: l
2904
2904
  }, e.icon ?? "group")),
2905
- v && o,
2906
- C && /* @__PURE__ */ Z(r, { divider: !0 }),
2907
- S.map((e) => /* @__PURE__ */ Z(wr, {
2905
+ b && a,
2906
+ w && /* @__PURE__ */ Z(f, { divider: !0 }),
2907
+ C.map((e) => /* @__PURE__ */ Z(wr, {
2908
2908
  leaf: e,
2909
2909
  entityActions: n,
2910
- globalActions: i,
2911
- onRun: g,
2912
- loading: m === e.code,
2913
- onLoadingChange: (t) => h(t ? e.code : null),
2914
- row: c,
2915
- widgetContext: l,
2916
- onActionClick: u
2910
+ globalActions: r,
2911
+ onRun: v,
2912
+ loading: h === e.code,
2913
+ onLoadingChange: (t) => g(t ? e.code : null),
2914
+ row: s,
2915
+ widgetContext: c,
2916
+ onActionClick: l
2917
2917
  }, e.code)),
2918
- y && s
2918
+ x && o
2919
2919
  ]
2920
2920
  })
2921
2921
  })]
@@ -2941,9 +2941,9 @@ function kr(e, t, n, r, i, a, o) {
2941
2941
  };
2942
2942
  }
2943
2943
  function Ar(e) {
2944
- return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? V(e.name) : ""}`;
2944
+ return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? R(e.name) : ""}`;
2945
2945
  }
2946
- function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", fillContainer: l = !1, row: u, widgetContext: f, onActionClick: p }) {
2946
+ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", fillContainer: u = !1, row: d, widgetContext: f, onActionClick: p }) {
2947
2947
  let m = J(null), h = J(null), [g, v] = Y(0), [y, b] = Y(/* @__PURE__ */ new Map()), [x, S] = Y(!1), [C, w] = Y(null), [T, E] = Y(() => typeof document < "u" && document.documentElement.dir === "rtl");
2948
2948
  K(() => {
2949
2949
  if (typeof MutationObserver > "u") return;
@@ -3030,7 +3030,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3030
3030
  gap: 4,
3031
3031
  visibility: x || M ? "visible" : "hidden",
3032
3032
  position: "relative",
3033
- width: l ? "100%" : void 0,
3033
+ width: u ? "100%" : void 0,
3034
3034
  minWidth: 0,
3035
3035
  boxSizing: "border-box"
3036
3036
  },
@@ -3051,7 +3051,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3051
3051
  let a = Ar(n);
3052
3052
  if (n.kind === "action") {
3053
3053
  let e = vr(n.code, r, i), o = yr(n.code, r, i), s = br(n.code, r, i);
3054
- return /* @__PURE__ */ Z(d, {
3054
+ return /* @__PURE__ */ Z(l, {
3055
3055
  "data-node-key": a,
3056
3056
  icon: s ? /* @__PURE__ */ Z(t, {
3057
3057
  name: s,
@@ -3062,8 +3062,8 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3062
3062
  children: o
3063
3063
  }, a);
3064
3064
  } else {
3065
- let t = n.name ? V(n.name) : "Actions";
3066
- return /* @__PURE__ */ Z(d, {
3065
+ let t = n.name ? R(n.name) : "Actions";
3066
+ return /* @__PURE__ */ Z(l, {
3067
3067
  "data-node-key": a,
3068
3068
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
3069
3069
  tabIndex: -1,
@@ -3079,7 +3079,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3079
3079
  onRun: a,
3080
3080
  loading: C === e.code,
3081
3081
  onLoadingChange: (t) => w(t ? e.code : null),
3082
- row: u,
3082
+ row: d,
3083
3083
  widgetContext: f,
3084
3084
  onActionClick: p
3085
3085
  }, Ar(e))),
@@ -3092,7 +3092,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3092
3092
  onRun: a,
3093
3093
  loading: C === e.code,
3094
3094
  onLoadingChange: (t) => w(t ? e.code : null),
3095
- row: u,
3095
+ row: d,
3096
3096
  widgetContext: f,
3097
3097
  onActionClick: p
3098
3098
  }, t) : /* @__PURE__ */ Z(Cr, {
@@ -3104,7 +3104,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3104
3104
  onLoadingChange: w
3105
3105
  }, t);
3106
3106
  }),
3107
- ee && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(d, {
3107
+ ee && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
3108
3108
  ref: D,
3109
3109
  kind: "default",
3110
3110
  iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
@@ -3128,7 +3128,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3128
3128
  onRun: A,
3129
3129
  loading: C === e.code,
3130
3130
  onLoadingChange: (t) => w(t ? e.code : null),
3131
- row: u,
3131
+ row: d,
3132
3132
  widgetContext: f,
3133
3133
  onActionClick: p
3134
3134
  }, e.code) : /* @__PURE__ */ Z(Tr, {
@@ -3148,7 +3148,7 @@ function jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
3148
3148
  onRun: a,
3149
3149
  loading: C === e.code,
3150
3150
  onLoadingChange: (t) => w(t ? e.code : null),
3151
- row: u,
3151
+ row: d,
3152
3152
  widgetContext: f,
3153
3153
  onActionClick: p
3154
3154
  }, Ar(e)))
@@ -3178,49 +3178,49 @@ function Mr({ layout: e, rowSelection: t = [], ...n }) {
3178
3178
  })]
3179
3179
  });
3180
3180
  }
3181
- function Nr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth: i = 0, kind: a = "toolbar", measurementOverride: o, entityActions: s, globalActions: c, ariaLabel: l = "Actions", trailingNormalItems: u, trailingDestructiveItems: d, widgetContext: f, onActionClick: p }) {
3182
- let m = hr(e);
3181
+ function Nr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth: i = 0, kind: a = "toolbar", fillContainer: o = !0, measurementOverride: s, entityActions: c, globalActions: l, ariaLabel: u = "Actions", trailingNormalItems: d, trailingDestructiveItems: f, widgetContext: p, onActionClick: m }) {
3182
+ let h = hr(e);
3183
3183
  return a === "row" ? /* @__PURE__ */ Z(Er, {
3184
3184
  layout: e,
3185
- entityActions: s,
3186
- globalActions: c,
3185
+ entityActions: c,
3186
+ globalActions: l,
3187
3187
  onRun: r,
3188
- trailingNormalItems: u,
3189
- trailingDestructiveItems: d,
3188
+ trailingNormalItems: d,
3189
+ trailingDestructiveItems: f,
3190
3190
  row: t,
3191
- widgetContext: f,
3192
- onActionClick: p
3193
- }) : m === 0 ? null : a === "toolbar" ? /* @__PURE__ */ Z(Mr, {
3191
+ widgetContext: p,
3192
+ onActionClick: m
3193
+ }) : h === 0 ? null : a === "toolbar" ? /* @__PURE__ */ Z(Mr, {
3194
3194
  layout: e,
3195
3195
  row: t,
3196
3196
  rowSelection: n,
3197
3197
  onRun: r,
3198
3198
  reservedRightWidth: i,
3199
- measurementOverride: o,
3200
- entityActions: s,
3201
- globalActions: c,
3202
- ariaLabel: l,
3203
- widgetContext: f,
3204
- onActionClick: p
3199
+ measurementOverride: s,
3200
+ entityActions: c,
3201
+ globalActions: l,
3202
+ ariaLabel: u,
3203
+ widgetContext: p,
3204
+ onActionClick: m
3205
3205
  }) : /* @__PURE__ */ Z(jr, {
3206
3206
  layout: e,
3207
3207
  row: t,
3208
3208
  rowSelection: n,
3209
3209
  onRun: r,
3210
3210
  reservedRightWidth: i,
3211
- measurementOverride: o,
3212
- entityActions: s,
3213
- globalActions: c,
3214
- ariaLabel: l,
3215
- fillContainer: !0,
3216
- widgetContext: f,
3217
- onActionClick: p
3211
+ measurementOverride: s,
3212
+ entityActions: c,
3213
+ globalActions: l,
3214
+ ariaLabel: u,
3215
+ fillContainer: o,
3216
+ widgetContext: p,
3217
+ onActionClick: m
3218
3218
  });
3219
3219
  }
3220
3220
  //#endregion
3221
3221
  //#region src/lib/action-dispatch.ts
3222
3222
  function Pr(e, t, n, r) {
3223
- return A(t) ? (ce(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
3223
+ return k(t) ? (ce(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
3224
3224
  }
3225
3225
  //#endregion
3226
3226
  //#region src/components/detail-layout/AssociatedBlock.tsx
@@ -3249,7 +3249,7 @@ function Ir(e, t, n) {
3249
3249
  let n = a.resolved_params.items().filter((e) => e.name !== t);
3250
3250
  e = {
3251
3251
  ...e,
3252
- resolved_params: new w(n)
3252
+ resolved_params: new E(n)
3253
3253
  };
3254
3254
  }
3255
3255
  r.push({
@@ -3282,7 +3282,7 @@ function Lr(e, t, n) {
3282
3282
  return null;
3283
3283
  }
3284
3284
  function Rr(e, t, n) {
3285
- let r = new Set(T(e));
3285
+ let r = new Set(D(e));
3286
3286
  return new Set(t.filter((t) => {
3287
3287
  if (t === n || r.has(t)) return !1;
3288
3288
  let i = e.fields.get(t);
@@ -3339,125 +3339,125 @@ function Vr({ node: e, ctx: t }) {
3339
3339
  ]
3340
3340
  });
3341
3341
  }
3342
- function Hr({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3343
- let c = r.columns && r.columns.length > 0 ? r.columns.filter((e) => e === s ? !1 : !!o.fields.get(e)) : o.fields.names().filter((e) => {
3344
- if (e === s) return !1;
3345
- let t = o.fields.get(e);
3342
+ function Hr({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3343
+ let s = n.columns && n.columns.length > 0 ? n.columns.filter((e) => e === o ? !1 : !!a.fields.get(e)) : a.fields.names().filter((e) => {
3344
+ if (e === o) return !1;
3345
+ let t = a.fields.get(e);
3346
3346
  return !(!t || t.primary || t.display?.is_listable === !1);
3347
- }), l = oe(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), f = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, p = V(o.display?.name_plural) || V(o.display?.name) || a, m = r.searchable === !0 || r.filters && r.filters.length > 0, h = q(() => Ir(o.actions, s, i.recordId), [
3348
- o.actions,
3349
- s,
3350
- i.recordId
3351
- ]), g = q(() => {
3347
+ }), c = F(a, "update"), u = n.interaction ?? (c ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && c && n.editable !== !1, f = R(a.display?.name_plural) || R(a.display?.name) || i, p = n.searchable === !0 || n.filters && n.filters.length > 0, m = q(() => Ir(a.actions, o, r.recordId), [
3348
+ a.actions,
3349
+ o,
3350
+ r.recordId
3351
+ ]), h = q(() => {
3352
3352
  let e = {};
3353
- for (let { code: t, action: n } of h) e[t] = n;
3353
+ for (let { code: t, action: n } of m) e[t] = n;
3354
3354
  return e;
3355
- }, [h]), _ = q(() => qn(o.action_layout ?? null ?? sr(g, "list_toolbar"), g, void 0, {}, []), [o.action_layout, g]), { run: v } = R(), y = bt(), b = H(), x = q(() => ({
3356
- entity: o,
3357
- entityCode: a,
3355
+ }, [m]), g = q(() => qn(a.action_layout ?? null ?? sr(h, "list_toolbar"), h, void 0, {}, []), [a.action_layout, h]), { run: _ } = B(), v = bt(), y = ie(), b = q(() => ({
3356
+ entity: a,
3357
+ entityCode: i,
3358
3358
  screenRoute: typeof window < "u" ? window.location.pathname : "",
3359
3359
  selectedRows: [],
3360
3360
  selectedIds: [],
3361
- locale: b,
3362
- tabNavigate: (e, t) => y(e, {
3361
+ locale: y,
3362
+ tabNavigate: (e, t) => v(e, {
3363
3363
  title: t?.title,
3364
3364
  icon: t?.icon,
3365
3365
  search: t?.search
3366
3366
  }),
3367
- runActionApi: (e, t) => W(e, t)
3367
+ runActionApi: (e, t) => U(e, t)
3368
3368
  }), [
3369
- o,
3370
3369
  a,
3371
- b,
3372
- y
3373
- ]), S = ze(), C = G(() => {
3374
- S.invalidateQueries({ predicate: (e) => {
3370
+ i,
3371
+ y,
3372
+ v
3373
+ ]), x = ze(), S = G(() => {
3374
+ x.invalidateQueries({ predicate: (e) => {
3375
3375
  let t = e.queryKey;
3376
- return t[0] === "entity-children" && t[3] === a;
3376
+ return t[0] === "entity-children" && t[3] === i;
3377
3377
  } });
3378
- }, [S, a]), w = G((e, t) => {
3379
- let r = Pr(e, t, {}, a);
3380
- if (r !== null) return v({
3378
+ }, [x, i]), C = G((e, t) => {
3379
+ let n = Pr(e, t, {}, i);
3380
+ if (n !== null) return _({
3381
3381
  action: t,
3382
- title: V(t.display?.name) || e,
3382
+ title: R(t.display?.name) || e,
3383
3383
  execute: async (e) => {
3384
- let t = await W(r, n(e, void 0));
3385
- return C(), t;
3384
+ let t = await U(n, V(e, void 0));
3385
+ return S(), t;
3386
3386
  }
3387
3387
  });
3388
3388
  }, [
3389
- v,
3390
- a,
3391
- C
3392
- ]), [T, E] = Y(0), D = /* @__PURE__ */ Q("div", {
3389
+ _,
3390
+ i,
3391
+ S
3392
+ ]), [w, T] = Y(0), E = /* @__PURE__ */ Q("div", {
3393
3393
  style: {
3394
3394
  display: "flex",
3395
3395
  alignItems: "center",
3396
3396
  gap: 6
3397
3397
  },
3398
- children: [o.action_layout ? _.length > 0 && /* @__PURE__ */ Z(Nr, {
3398
+ children: [a.action_layout ? g.length > 0 && /* @__PURE__ */ Z(Nr, {
3399
3399
  kind: "toolbar",
3400
- layout: _,
3401
- entityActions: g,
3402
- onRun: w,
3403
- widgetContext: x,
3404
- ariaLabel: `${p} toolbar actions`
3405
- }) : h.map(({ code: e, action: t }) => /* @__PURE__ */ Z(cr, {
3400
+ layout: g,
3401
+ entityActions: h,
3402
+ onRun: C,
3403
+ widgetContext: b,
3404
+ ariaLabel: `${f} toolbar actions`
3405
+ }) : m.map(({ code: e, action: t }) => /* @__PURE__ */ Z(cr, {
3406
3406
  actionCode: e,
3407
3407
  action: t,
3408
- entityCode: a,
3408
+ entityCode: i,
3409
3409
  variant: "ghost",
3410
3410
  size: "sm",
3411
- onSuccess: C
3412
- }, e)), f && /* @__PURE__ */ Z(d, {
3411
+ onSuccess: S
3412
+ }, e)), d && /* @__PURE__ */ Z(l, {
3413
3413
  kind: "ghost",
3414
3414
  size: "xs",
3415
3415
  icon: /* @__PURE__ */ Z(e.plus, { size: 12 }),
3416
- onClick: () => E((e) => e + 1),
3416
+ onClick: () => T((e) => e + 1),
3417
3417
  children: "Add row"
3418
3418
  })]
3419
- }), O = m ? /* @__PURE__ */ Z(Wr, {
3420
- entityCode: a,
3421
- entity: o,
3422
- parentEntity: i.entityCode,
3423
- parentId: i.recordId,
3424
- foreignKey: s,
3425
- columns: c,
3426
- editable: f,
3419
+ }), D = p ? /* @__PURE__ */ Z(Wr, {
3420
+ entityCode: i,
3421
+ entity: a,
3422
+ parentEntity: r.entityCode,
3423
+ parentId: r.recordId,
3424
+ foreignKey: o,
3425
+ columns: s,
3426
+ editable: d,
3427
3427
  interaction: u,
3428
- ctx: i,
3429
- searchable: r.searchable,
3430
- filterFields: r.filters,
3431
- sort: r.sort,
3432
- startDraftSignal: T
3428
+ ctx: r,
3429
+ searchable: n.searchable,
3430
+ filterFields: n.filters,
3431
+ sort: n.sort,
3432
+ startDraftSignal: w
3433
3433
  }) : /* @__PURE__ */ Z(Ur, {
3434
- entityCode: a,
3435
- entity: o,
3436
- parentEntity: i.entityCode,
3437
- parentId: i.recordId,
3438
- foreignKey: s,
3439
- columns: c,
3440
- editable: f,
3434
+ entityCode: i,
3435
+ entity: a,
3436
+ parentEntity: r.entityCode,
3437
+ parentId: r.recordId,
3438
+ foreignKey: o,
3439
+ columns: s,
3440
+ editable: d,
3441
3441
  interaction: u,
3442
- ctx: i,
3443
- sort: r.sort,
3444
- startDraftSignal: T
3442
+ ctx: r,
3443
+ sort: n.sort,
3444
+ startDraftSignal: w
3445
3445
  });
3446
- return i.withinCard ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z("div", {
3446
+ return r.withinCard ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z("div", {
3447
3447
  style: {
3448
3448
  display: "flex",
3449
3449
  justifyContent: "flex-end",
3450
3450
  marginBottom: 8
3451
3451
  },
3452
- children: D
3453
- }), O] }) : /* @__PURE__ */ Z(We, {
3454
- title: p,
3455
- icon: o.display?.icon ? /* @__PURE__ */ Z(t, {
3456
- name: o.display.icon,
3452
+ children: E
3453
+ }), D] }) : /* @__PURE__ */ Z(We, {
3454
+ title: f,
3455
+ icon: a.display?.icon ? /* @__PURE__ */ Z(t, {
3456
+ name: a.display.icon,
3457
3457
  size: 14
3458
3458
  }) : void 0,
3459
- right: D,
3460
- children: O
3459
+ right: E,
3460
+ children: D
3461
3461
  });
3462
3462
  }
3463
3463
  function Ur({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
@@ -3491,15 +3491,15 @@ function Ur({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3491
3491
  startDraftSignal: u
3492
3492
  });
3493
3493
  }
3494
- function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: f, startDraftSignal: p }) {
3495
- let m = ze(), [h, g] = Y(""), [_, v] = Y(""), [y, b] = Y({}), x = J(void 0);
3496
- K(() => (x.current && clearTimeout(x.current), x.current = setTimeout(() => {
3497
- v(h);
3494
+ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: d, filterFields: f, sort: p, startDraftSignal: m }) {
3495
+ let h = ze(), [g, _] = Y(""), [v, y] = Y(""), [b, x] = Y({}), S = J(void 0);
3496
+ K(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
3497
+ y(g);
3498
3498
  }, 300), () => {
3499
- x.current && clearTimeout(x.current);
3500
- }), [h]);
3501
- let S = G((e, t) => {
3502
- b((n) => {
3499
+ S.current && clearTimeout(S.current);
3500
+ }), [g]);
3501
+ let C = G((e, t) => {
3502
+ x((n) => {
3503
3503
  if (t === "__all__") {
3504
3504
  let { [e]: t, ...r } = n;
3505
3505
  return r;
@@ -3509,13 +3509,13 @@ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3509
3509
  [e]: t
3510
3510
  };
3511
3511
  });
3512
- }, []), C = q(() => Object.keys(y).length > 0 ? y : void 0, [y]), { data: w, isLoading: T, isError: E, hasNextPage: D, fetchNextPage: O, isFetchingNextPage: k } = Cn(n, r, e, i, f, void 0, _ || void 0, C), { rows: A, refs: j } = q(() => {
3513
- if (!w?.pages) return {
3512
+ }, []), w = q(() => Object.keys(b).length > 0 ? b : void 0, [b]), { data: T, isLoading: E, isError: D, hasNextPage: O, fetchNextPage: k, isFetchingNextPage: A } = Cn(n, r, e, i, p, void 0, v || void 0, w), { rows: j, refs: M } = q(() => {
3513
+ if (!T?.pages) return {
3514
3514
  rows: [],
3515
3515
  refs: void 0
3516
3516
  };
3517
3517
  let e = [], t;
3518
- for (let n of w.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
3518
+ for (let n of T.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
3519
3519
  else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
3520
3520
  ...t[e],
3521
3521
  ...r
@@ -3524,21 +3524,21 @@ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3524
3524
  rows: e,
3525
3525
  refs: t
3526
3526
  };
3527
- }, [w]), M = G(() => {
3528
- m.invalidateQueries({ predicate: (t) => {
3527
+ }, [T]), N = G(() => {
3528
+ h.invalidateQueries({ predicate: (t) => {
3529
3529
  let n = t.queryKey;
3530
3530
  return n[0] === "entity-children" && n[3] === e;
3531
3531
  } });
3532
- }, [m, e]);
3532
+ }, [h, e]);
3533
3533
  return /* @__PURE__ */ Q("div", { children: [
3534
3534
  /* @__PURE__ */ Z(ur, {
3535
3535
  entity: t,
3536
- searchable: l,
3537
- filterFields: u,
3538
- searchValue: h,
3539
- onSearchChange: g,
3540
- filters: y,
3541
- onFilterChange: S,
3536
+ searchable: d,
3537
+ filterFields: f,
3538
+ searchValue: g,
3539
+ onSearchChange: _,
3540
+ filters: b,
3541
+ onFilterChange: C,
3542
3542
  allEntities: c.schema.entities
3543
3543
  }),
3544
3544
  /* @__PURE__ */ Z(Gr, {
@@ -3550,28 +3550,28 @@ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3550
3550
  editable: o,
3551
3551
  interaction: s,
3552
3552
  ctx: c,
3553
- rows: A,
3554
- refs: j,
3555
- isLoading: T,
3556
- isError: E,
3557
- invalidateQuery: M,
3558
- startDraftSignal: p
3553
+ rows: j,
3554
+ refs: M,
3555
+ isLoading: E,
3556
+ isError: D,
3557
+ invalidateQuery: N,
3558
+ startDraftSignal: m
3559
3559
  }),
3560
- D && /* @__PURE__ */ Z("div", {
3560
+ O && /* @__PURE__ */ Z("div", {
3561
3561
  style: { marginTop: 4 },
3562
- children: /* @__PURE__ */ Z(d, {
3562
+ children: /* @__PURE__ */ Z(l, {
3563
3563
  kind: "ghost",
3564
3564
  size: "xs",
3565
- icon: k ? /* @__PURE__ */ Z(F, { size: 12 }) : void 0,
3566
- onClick: () => O(),
3567
- disabled: k,
3565
+ icon: A ? /* @__PURE__ */ Z(u, { size: 12 }) : void 0,
3566
+ onClick: () => k(),
3567
+ disabled: A,
3568
3568
  children: "Load more"
3569
3569
  })
3570
3570
  })
3571
3571
  ] });
3572
3572
  }
3573
- function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
3574
- let h = l(), g = h.isPhone && s.relatedRecordsPresentation === "table", _ = i.find((e) => e !== r), v = q(() => o === "navigate" ? M(void 0, t, s.schema.screens) : null, [
3573
+ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: m }) {
3574
+ let h = p(), g = h.isPhone && s.relatedRecordsPresentation === "table", _ = i.find((e) => e !== r), v = q(() => o === "navigate" ? ee(void 0, t, s.schema.screens) : null, [
3575
3575
  o,
3576
3576
  t,
3577
3577
  s.schema.screens
@@ -3587,28 +3587,28 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3587
3587
  ]), x = q(() => {
3588
3588
  let e = /* @__PURE__ */ new Map();
3589
3589
  for (let n of c) {
3590
- let r = z(t, n);
3591
- e.set(B(r), r);
3590
+ let r = C(t, n);
3591
+ e.set(w(r), r);
3592
3592
  }
3593
3593
  return e;
3594
3594
  }, [c, t]), S = q(() => {
3595
3595
  let e = /* @__PURE__ */ new Map();
3596
3596
  for (let n of c) {
3597
3597
  let r = n.$row_version;
3598
- typeof r == "string" && r !== "" && e.set(B(z(t, n)), r);
3598
+ typeof r == "string" && r !== "" && e.set(w(C(t, n)), r);
3599
3599
  }
3600
3600
  return e;
3601
- }, [c, t]), C = q(() => Fr(t.actions), [t.actions]), [w, T] = Y(null), [E, D] = Y(null), [O, k] = Y([]), [A, P] = Y({}), ee = J(A);
3602
- ee.current = A;
3603
- let F = J({});
3601
+ }, [c, t]), T = q(() => Fr(t.actions), [t.actions]), [E, D] = Y(null), [O, k] = Y(null), [A, j] = Y([]), [M, N] = Y({}), P = J(M);
3602
+ P.current = M;
3603
+ let ne = J({});
3604
3604
  K(() => {
3605
- let e = F.current;
3605
+ let e = ne.current;
3606
3606
  return () => {
3607
3607
  for (let t of Object.values(e)) clearTimeout(t);
3608
3608
  };
3609
3609
  }, []);
3610
- let [I, L] = Y(null), [ne, R] = Y([]), [V, H] = Y(!1), [U, re] = Y(null), [W, ae] = Y(/* @__PURE__ */ new Set()), oe = G(async (t, n, r) => {
3611
- P((e) => ({
3610
+ let [F, I] = Y(null), [L, R] = Y([]), [z, B] = Y(!1), [V, U] = Y(null), [ie, ae] = Y(/* @__PURE__ */ new Set()), ce = G(async (t, n, r) => {
3611
+ N((e) => ({
3612
3612
  ...e,
3613
3613
  [t]: {
3614
3614
  ...e[t],
@@ -3621,7 +3621,7 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3621
3621
  ...n,
3622
3622
  $row_version: i
3623
3623
  } : n;
3624
- return await N(e, x.get(t) ?? t, a), P((e) => {
3624
+ return await te(e, x.get(t) ?? t, a), N((e) => {
3625
3625
  let n = e[t];
3626
3626
  if (!n) return e;
3627
3627
  if (n.ver > r) return {
@@ -3633,10 +3633,10 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3633
3633
  };
3634
3634
  let { [t]: i, ...a } = e;
3635
3635
  return a;
3636
- }), p(), !0;
3636
+ }), f(), !0;
3637
3637
  } catch (e) {
3638
3638
  let n = e instanceof Error ? e.message : "Save failed";
3639
- return P((e) => ({
3639
+ return N((e) => ({
3640
3640
  ...e,
3641
3641
  [t]: {
3642
3642
  ...e[t],
@@ -3647,11 +3647,11 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3647
3647
  }
3648
3648
  }, [
3649
3649
  e,
3650
- p,
3650
+ f,
3651
3651
  x,
3652
3652
  S
3653
- ]), ce = G((e, t, n) => {
3654
- P((r) => {
3653
+ ]), le = G((e, t, n) => {
3654
+ N((r) => {
3655
3655
  let i = r[e] ?? {
3656
3656
  buffer: {},
3657
3657
  ver: 0,
@@ -3668,86 +3668,86 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3668
3668
  ver: a
3669
3669
  }
3670
3670
  };
3671
- }), o === "inline_edit" && (F.current[e] && clearTimeout(F.current[e]), F.current[e] = setTimeout(() => {
3672
- let t = ee.current[e];
3673
- t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
3671
+ }), o === "inline_edit" && (ne.current[e] && clearTimeout(ne.current[e]), ne.current[e] = setTimeout(() => {
3672
+ let t = P.current[e];
3673
+ t && Object.keys(t.buffer).length > 0 && ce(e, { ...t.buffer }, t.ver);
3674
3674
  }, 500));
3675
- }, [oe, o]), le = G(() => {
3675
+ }, [ce, o]), ue = G(() => {
3676
3676
  let e = {};
3677
3677
  e[r] = n;
3678
3678
  for (let n of i) {
3679
3679
  let r = t.fields.get(n);
3680
3680
  r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
3681
3681
  }
3682
- L(e), R([]);
3682
+ I(e), R([]);
3683
3683
  }, [
3684
3684
  r,
3685
3685
  n,
3686
3686
  i,
3687
3687
  t.fields
3688
- ]), ue = J(m);
3688
+ ]), de = J(m);
3689
3689
  K(() => {
3690
- m !== void 0 && m !== ue.current && (ue.current = m, !I && le());
3690
+ m !== void 0 && m !== de.current && (de.current = m, !F && ue());
3691
3691
  }, [
3692
3692
  m,
3693
- I,
3694
- le
3693
+ F,
3694
+ ue
3695
3695
  ]);
3696
- let de = G(async () => {
3697
- if (!I) return;
3698
- let n = Br(I, i, t, r);
3696
+ let fe = G(async () => {
3697
+ if (!F) return;
3698
+ let n = Br(F, i, t, r);
3699
3699
  if (n.length > 0) {
3700
3700
  R(n);
3701
3701
  return;
3702
3702
  }
3703
- H(!0);
3703
+ B(!0);
3704
3704
  try {
3705
- await j(e, I), L(null), R([]), p();
3705
+ await oe(e, F), I(null), R([]), f();
3706
3706
  } catch (e) {
3707
3707
  R([`_error:${e instanceof Error ? e.message : "Create failed"}`]);
3708
3708
  } finally {
3709
- H(!1);
3709
+ B(!1);
3710
3710
  }
3711
3711
  }, [
3712
- I,
3712
+ F,
3713
3713
  i,
3714
3714
  t,
3715
3715
  r,
3716
3716
  e,
3717
- p
3718
- ]), fe = G((e) => {
3719
- P({}), k([]), D(e);
3717
+ f
3718
+ ]), W = G((e) => {
3719
+ N({}), j([]), k(e);
3720
3720
  }, []), pe = G(async (e) => {
3721
- let n = ee.current[e], a = n?.buffer ?? {};
3721
+ let n = P.current[e], a = n?.buffer ?? {};
3722
3722
  if (Object.keys(a).length === 0) {
3723
- D(null), k([]);
3723
+ k(null), j([]);
3724
3724
  return;
3725
3725
  }
3726
3726
  let o = Br({
3727
- ...c.find((n) => B(z(t, n)) === e) ?? {},
3727
+ ...c.find((n) => w(C(t, n)) === e) ?? {},
3728
3728
  ...a
3729
3729
  }, i, t, r);
3730
3730
  if (o.length > 0) {
3731
- k(o);
3731
+ j(o);
3732
3732
  return;
3733
3733
  }
3734
- await oe(e, { ...a }, n?.ver ?? 0) && (D(null), k([]));
3734
+ await ce(e, { ...a }, n?.ver ?? 0) && (k(null), j([]));
3735
3735
  }, [
3736
3736
  c,
3737
3737
  t,
3738
3738
  i,
3739
3739
  r,
3740
- oe
3740
+ ce
3741
3741
  ]), me = G((e) => {
3742
- P((t) => {
3742
+ N((t) => {
3743
3743
  if (!t[e]) return t;
3744
3744
  let { [e]: n, ...r } = t;
3745
3745
  return r;
3746
- }), k([]), D(null);
3746
+ }), j([]), k(null);
3747
3747
  }, []), he = G(async (t) => {
3748
- re(null), ae((e) => new Set(e).add(t));
3748
+ U(null), ae((e) => new Set(e).add(t));
3749
3749
  try {
3750
- await se(e, x.get(t) ?? t), p();
3750
+ await re(e, x.get(t) ?? t), f();
3751
3751
  } catch {} finally {
3752
3752
  ae((e) => {
3753
3753
  let n = new Set(e);
@@ -3756,10 +3756,10 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3756
3756
  }
3757
3757
  }, [
3758
3758
  e,
3759
- p,
3759
+ f,
3760
3760
  x
3761
3761
  ]);
3762
- if (f) return /* @__PURE__ */ Z("div", {
3762
+ if (d) return /* @__PURE__ */ Z("div", {
3763
3763
  style: {
3764
3764
  fontSize: 12.5,
3765
3765
  color: "var(--danger)",
@@ -3767,7 +3767,7 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3767
3767
  },
3768
3768
  children: "Failed to load."
3769
3769
  });
3770
- if (d) return /* @__PURE__ */ Q("div", {
3770
+ if (u) return /* @__PURE__ */ Q("div", {
3771
3771
  style: {
3772
3772
  display: "flex",
3773
3773
  flexDirection: "column",
@@ -3784,7 +3784,7 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3784
3784
  borderRadius: 6
3785
3785
  } })]
3786
3786
  });
3787
- let ge = c.length === 0 && !I;
3787
+ let ge = c.length === 0 && !F;
3788
3788
  return h.isPhone && !g ? /* @__PURE__ */ Q("div", { children: [
3789
3789
  ge && !a && /* @__PURE__ */ Z("div", {
3790
3790
  style: {
@@ -3801,7 +3801,7 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3801
3801
  gap: 10
3802
3802
  },
3803
3803
  children: [c.map((n) => {
3804
- let r = B(z(t, n)), c = W.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3804
+ let r = w(C(t, n)), c = ie.has(r), u = M[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3805
3805
  return /* @__PURE__ */ Z(Kr, {
3806
3806
  rowId: r,
3807
3807
  row: n,
@@ -3812,56 +3812,56 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3812
3812
  editableColumns: y,
3813
3813
  editable: a,
3814
3814
  interaction: o,
3815
- isEditing: E === r,
3816
- editErrors: O,
3815
+ isEditing: O === r,
3816
+ editErrors: A,
3817
3817
  isDeleting: c,
3818
- activeCell: w,
3819
- setActiveCell: T,
3820
- rowState: l,
3821
- onCellChange: ce,
3818
+ activeCell: E,
3819
+ setActiveCell: D,
3820
+ rowState: u,
3821
+ onCellChange: le,
3822
3822
  onDeleteClick: (e) => {
3823
- re({
3823
+ U({
3824
3824
  show: !0,
3825
3825
  rowId: e,
3826
- label: te(n, t) ?? ""
3826
+ label: se(n, t) ?? ""
3827
3827
  });
3828
3828
  },
3829
- onStartEdit: fe,
3829
+ onStartEdit: W,
3830
3830
  onConfirmEdit: pe,
3831
3831
  onCancelEdit: me,
3832
- refs: u,
3832
+ refs: l,
3833
3833
  identityCol: _,
3834
3834
  href: d,
3835
- rowActions: C,
3835
+ rowActions: T,
3836
3836
  entityCode: e,
3837
- onRowActionSuccess: p
3837
+ onRowActionSuccess: f
3838
3838
  }, r);
3839
- }), I && /* @__PURE__ */ Z(Zr, {
3840
- draftRow: I,
3839
+ }), F && /* @__PURE__ */ Z(Zr, {
3840
+ draftRow: F,
3841
3841
  entity: t,
3842
3842
  columns: i,
3843
3843
  editableColumns: b,
3844
3844
  foreignKey: r,
3845
- draftErrors: ne,
3846
- draftSaving: V,
3847
- onChange: (e, t) => L((n) => n && {
3845
+ draftErrors: L,
3846
+ draftSaving: z,
3847
+ onChange: (e, t) => I((n) => n && {
3848
3848
  ...n,
3849
3849
  [e]: t
3850
3850
  }),
3851
- onConfirm: de,
3851
+ onConfirm: fe,
3852
3852
  onCancel: () => {
3853
- L(null), R([]);
3853
+ I(null), R([]);
3854
3854
  },
3855
- refs: u
3855
+ refs: l
3856
3856
  })]
3857
3857
  }),
3858
- U && /* @__PURE__ */ Z(ft, {
3859
- open: U.show,
3860
- onOpenChange: (e) => !e && re(null),
3858
+ V && /* @__PURE__ */ Z(ft, {
3859
+ open: V.show,
3860
+ onOpenChange: (e) => !e && U(null),
3861
3861
  title: "Delete record",
3862
- description: U.label ? `Are you sure you want to delete "${U.label}"?` : "Are you sure you want to delete this record?",
3862
+ description: V.label ? `Are you sure you want to delete "${V.label}"?` : "Are you sure you want to delete this record?",
3863
3863
  confirmLabel: "Delete",
3864
- onConfirm: () => he(U.rowId),
3864
+ onConfirm: () => he(V.rowId),
3865
3865
  destructive: !0
3866
3866
  })
3867
3867
  ] }) : /* @__PURE__ */ Q("div", { children: [
@@ -3882,19 +3882,19 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3882
3882
  let n = t.fields.get(e);
3883
3883
  return /* @__PURE__ */ Z("th", {
3884
3884
  style: Ee,
3885
- children: n ? ie(n, e, s.schema.entities) : e
3885
+ children: n ? H(n, e, s.schema.entities) : e
3886
3886
  }, e);
3887
3887
  }),
3888
3888
  a && /* @__PURE__ */ Z("th", { style: {
3889
3889
  height: 30,
3890
3890
  width: 72
3891
3891
  } }),
3892
- !a && C.length > 0 && /* @__PURE__ */ Z("th", { style: {
3892
+ !a && T.length > 0 && /* @__PURE__ */ Z("th", { style: {
3893
3893
  height: 30,
3894
3894
  width: 40
3895
3895
  } })
3896
3896
  ] }) }), /* @__PURE__ */ Q("tbody", { children: [c.map((n) => {
3897
- let r = B(z(t, n)), c = W.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3897
+ let r = w(C(t, n)), c = ie.has(r), u = M[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3898
3898
  return /* @__PURE__ */ Z(qr, {
3899
3899
  rowId: r,
3900
3900
  row: n,
@@ -3905,83 +3905,83 @@ function Gr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
3905
3905
  editableColumns: y,
3906
3906
  editable: a,
3907
3907
  interaction: o,
3908
- isEditing: E === r,
3909
- editErrors: O,
3908
+ isEditing: O === r,
3909
+ editErrors: A,
3910
3910
  isDeleting: c,
3911
- activeCell: w,
3912
- setActiveCell: T,
3913
- rowState: l,
3914
- onCellChange: ce,
3911
+ activeCell: E,
3912
+ setActiveCell: D,
3913
+ rowState: u,
3914
+ onCellChange: le,
3915
3915
  onDeleteClick: (e) => {
3916
- re({
3916
+ U({
3917
3917
  show: !0,
3918
3918
  rowId: e,
3919
- label: te(n, t) ?? ""
3919
+ label: se(n, t) ?? ""
3920
3920
  });
3921
3921
  },
3922
- onStartEdit: fe,
3922
+ onStartEdit: W,
3923
3923
  onConfirmEdit: pe,
3924
3924
  onCancelEdit: me,
3925
- refs: u,
3925
+ refs: l,
3926
3926
  identityCol: _,
3927
3927
  href: d,
3928
- rowActions: C,
3928
+ rowActions: T,
3929
3929
  entityCode: e,
3930
- onRowActionSuccess: p
3930
+ onRowActionSuccess: f
3931
3931
  }, r);
3932
- }), I && /* @__PURE__ */ Z(Xr, {
3933
- draftRow: I,
3932
+ }), F && /* @__PURE__ */ Z(Xr, {
3933
+ draftRow: F,
3934
3934
  entity: t,
3935
3935
  columns: i,
3936
3936
  editableColumns: b,
3937
3937
  foreignKey: r,
3938
- draftErrors: ne,
3939
- draftSaving: V,
3940
- onChange: (e, t) => L((n) => n && {
3938
+ draftErrors: L,
3939
+ draftSaving: z,
3940
+ onChange: (e, t) => I((n) => n && {
3941
3941
  ...n,
3942
3942
  [e]: t
3943
3943
  }),
3944
- onConfirm: de,
3944
+ onConfirm: fe,
3945
3945
  onCancel: () => {
3946
- L(null), R([]);
3946
+ I(null), R([]);
3947
3947
  },
3948
- refs: u
3948
+ refs: l
3949
3949
  })] })]
3950
3950
  })
3951
3951
  }),
3952
- U && /* @__PURE__ */ Z(ft, {
3953
- open: U.show,
3954
- onOpenChange: (e) => !e && re(null),
3952
+ V && /* @__PURE__ */ Z(ft, {
3953
+ open: V.show,
3954
+ onOpenChange: (e) => !e && U(null),
3955
3955
  title: "Delete record",
3956
- description: U.label ? `Are you sure you want to delete "${U.label}"?` : "Are you sure you want to delete this record?",
3956
+ description: V.label ? `Are you sure you want to delete "${V.label}"?` : "Are you sure you want to delete this record?",
3957
3957
  confirmLabel: "Delete",
3958
- onConfirm: () => he(U.rowId),
3958
+ onConfirm: () => he(V.rowId),
3959
3959
  destructive: !0
3960
3960
  })
3961
3961
  ] });
3962
3962
  }
3963
- function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: u, editErrors: d, isDeleting: f, rowState: p, onCellChange: m, onDeleteClick: h, onStartEdit: g, onConfirmEdit: _, onCancelEdit: v, refs: y, identityCol: x, href: S, rowActions: C, onRowActionSuccess: w }) {
3964
- let T = H(), E = Me(), D = q(() => !p || Object.keys(p.buffer).length === 0 ? n : {
3963
+ function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: d, editErrors: f, isDeleting: p, rowState: m, onCellChange: h, onDeleteClick: g, onStartEdit: _, onConfirmEdit: v, onCancelEdit: b, refs: x, identityCol: S, href: C, rowActions: w, onRowActionSuccess: T }) {
3964
+ let E = ie(), D = Me(), O = q(() => !m || Object.keys(m.buffer).length === 0 ? n : {
3965
3965
  ...n,
3966
- ...p.buffer
3967
- }, [n, p]);
3968
- return l === "row_edit" && u ? /* @__PURE__ */ Z(Yr, {
3969
- values: D,
3966
+ ...m.buffer
3967
+ }, [n, m]);
3968
+ return l === "row_edit" && d ? /* @__PURE__ */ Z(Yr, {
3969
+ values: O,
3970
3970
  entity: r,
3971
3971
  columns: o,
3972
3972
  editableColumns: s,
3973
- errors: p?.error ? [...d, `_error:${p.error}`] : d,
3974
- saving: p?.saving ?? !1,
3975
- onChange: (e, n) => m(t, e, n),
3976
- onConfirm: () => _(t),
3977
- onCancel: () => v(t),
3978
- refs: y
3973
+ errors: m?.error ? [...f, `_error:${m.error}`] : f,
3974
+ saving: m?.saving ?? !1,
3975
+ onChange: (e, n) => h(t, e, n),
3976
+ onConfirm: () => v(t),
3977
+ onCancel: () => b(t),
3978
+ refs: x
3979
3979
  }) : /* @__PURE__ */ Q("div", {
3980
3980
  style: {
3981
3981
  border: "1px solid var(--border)",
3982
3982
  borderRadius: 8,
3983
3983
  background: "var(--surface)",
3984
- opacity: f ? .58 : 1,
3984
+ opacity: p ? .58 : 1,
3985
3985
  overflow: "hidden"
3986
3986
  },
3987
3987
  children: [/* @__PURE__ */ Z("div", {
@@ -3992,26 +3992,26 @@ function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
3992
3992
  gap: 12
3993
3993
  },
3994
3994
  children: o.map((e) => {
3995
- let n = r.fields.get(e), o = c && l === "inline_edit" && s.has(e), u = S && e === x, d = n ? ie(n, e, i) : e, f = `${E}-${t}-${e}`, p = `${f}-label`, h = {
3995
+ let n = r.fields.get(e), o = c && l === "inline_edit" && s.has(e), u = C && e === S, d = n ? H(n, e, i) : e, f = `${D}-${t}-${e}`, p = `${f}-label`, m = {
3996
3996
  fontSize: 11.5,
3997
3997
  fontWeight: 600,
3998
3998
  color: "var(--text-3)"
3999
- }, g = n ? L({
3999
+ }, g = n ? z({
4000
4000
  field: n,
4001
4001
  fieldName: e,
4002
- value: D[e],
4002
+ value: O[e],
4003
4003
  mode: o ? "edit" : "display",
4004
- onChange: o ? (n) => m(t, e, n) : void 0,
4005
- record: D,
4006
- refs: y,
4004
+ onChange: o ? (n) => h(t, e, n) : void 0,
4005
+ record: O,
4006
+ refs: x,
4007
4007
  compact: o,
4008
4008
  entity: r,
4009
4009
  entities: i,
4010
4010
  screens: u ? void 0 : a,
4011
4011
  fieldId: f,
4012
4012
  labelId: p,
4013
- locale: T
4014
- }) : P(D[e]);
4013
+ locale: E
4014
+ }) : W(O[e]);
4015
4015
  return /* @__PURE__ */ Q("div", {
4016
4016
  style: {
4017
4017
  display: "flex",
@@ -4022,16 +4022,16 @@ function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4022
4022
  children: [o && n ? /* @__PURE__ */ Z("label", {
4023
4023
  id: p,
4024
4024
  htmlFor: f,
4025
- style: h,
4025
+ style: m,
4026
4026
  children: d
4027
4027
  }) : /* @__PURE__ */ Z("div", {
4028
4028
  id: p,
4029
- style: h,
4029
+ style: m,
4030
4030
  children: d
4031
4031
  }), /* @__PURE__ */ Z("div", {
4032
4032
  style: { minWidth: 0 },
4033
4033
  children: u && !o ? /* @__PURE__ */ Z("a", {
4034
- href: S,
4034
+ href: C,
4035
4035
  style: {
4036
4036
  color: "var(--accent)",
4037
4037
  textDecoration: "none",
@@ -4042,7 +4042,7 @@ function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4042
4042
  })]
4043
4043
  }, e);
4044
4044
  })
4045
- }), (c || C && C.length > 0) && /* @__PURE__ */ Q("div", {
4045
+ }), (c || w && w.length > 0) && /* @__PURE__ */ Q("div", {
4046
4046
  style: {
4047
4047
  minHeight: 42,
4048
4048
  padding: "6px 8px",
@@ -4053,100 +4053,100 @@ function Kr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4053
4053
  gap: 6
4054
4054
  },
4055
4055
  children: [c && /* @__PURE__ */ Q(X, { children: [
4056
- p?.saving && /* @__PURE__ */ Z(F, { size: 12 }),
4057
- p?.error && /* @__PURE__ */ Z("span", {
4056
+ m?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
4057
+ m?.error && /* @__PURE__ */ Z("span", {
4058
4058
  style: {
4059
4059
  fontSize: 11,
4060
4060
  color: "var(--danger)"
4061
4061
  },
4062
- title: p.error,
4062
+ title: m.error,
4063
4063
  children: "!"
4064
4064
  }),
4065
- l === "row_edit" && /* @__PURE__ */ Z(b, {
4065
+ l === "row_edit" && /* @__PURE__ */ Z(y, {
4066
4066
  size: 32,
4067
4067
  icon: /* @__PURE__ */ Z(e.edit, { size: 14 }),
4068
- onClick: () => g(t),
4068
+ onClick: () => _(t),
4069
4069
  title: "Edit row"
4070
4070
  }),
4071
- /* @__PURE__ */ Z(b, {
4071
+ /* @__PURE__ */ Z(y, {
4072
4072
  size: 32,
4073
4073
  icon: /* @__PURE__ */ Z(e.trash, { size: 14 }),
4074
- onClick: () => h(t),
4074
+ onClick: () => g(t),
4075
4075
  title: "Delete row"
4076
4076
  })
4077
- ] }), !c && C && C.length > 0 && /* @__PURE__ */ Z(lr, {
4078
- actions: C,
4077
+ ] }), !c && w && w.length > 0 && /* @__PURE__ */ Z(lr, {
4078
+ actions: w,
4079
4079
  objectIds: [t],
4080
- row: D,
4081
- onSuccess: w
4080
+ row: O,
4081
+ onSuccess: T
4082
4082
  })]
4083
4083
  })]
4084
4084
  });
4085
4085
  }
4086
- function qr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: u, editErrors: d, isDeleting: f, activeCell: p, setActiveCell: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
4087
- let D = H(), O = q(() => !h || Object.keys(h.buffer).length === 0 ? n : {
4086
+ function qr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: c, interaction: l, isEditing: d, editErrors: f, isDeleting: p, activeCell: m, setActiveCell: h, rowState: g, onCellChange: _, onDeleteClick: v, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
4087
+ let O = ie(), k = q(() => !g || Object.keys(g.buffer).length === 0 ? n : {
4088
4088
  ...n,
4089
- ...h.buffer
4090
- }, [n, h]);
4091
- if (l === "row_edit" && u) return /* @__PURE__ */ Z(Jr, {
4092
- values: O,
4089
+ ...g.buffer
4090
+ }, [n, g]);
4091
+ if (l === "row_edit" && d) return /* @__PURE__ */ Z(Jr, {
4092
+ values: k,
4093
4093
  entity: r,
4094
4094
  columns: o,
4095
4095
  editableColumns: s,
4096
- errors: h?.error ? [...d, `_error:${h.error}`] : d,
4097
- saving: h?.saving ?? !1,
4098
- onChange: (e, n) => g(t, e, n),
4099
- onConfirm: () => y(t),
4100
- onCancel: () => x(t),
4101
- refs: S
4096
+ errors: g?.error ? [...f, `_error:${g.error}`] : f,
4097
+ saving: g?.saving ?? !1,
4098
+ onChange: (e, n) => _(t, e, n),
4099
+ onConfirm: () => x(t),
4100
+ onCancel: () => S(t),
4101
+ refs: C
4102
4102
  });
4103
- let k = Oe, A = {
4103
+ let A = Oe, j = {
4104
4104
  padding: "4px 4px",
4105
4105
  borderBottom: "1px solid var(--divider)",
4106
4106
  verticalAlign: "middle"
4107
- }, j = l === "inline_edit";
4107
+ }, M = l === "inline_edit";
4108
4108
  return /* @__PURE__ */ Q("tr", {
4109
- style: { opacity: f ? .5 : 1 },
4109
+ style: { opacity: p ? .5 : 1 },
4110
4110
  children: [
4111
4111
  o.map((e) => {
4112
4112
  let n = r.fields.get(e), o = s.has(e);
4113
- if (j && p?.rowId === t && p?.col === e && o) return /* @__PURE__ */ Z("td", {
4114
- style: A,
4115
- children: n ? L({
4113
+ if (M && m?.rowId === t && m?.col === e && o) return /* @__PURE__ */ Z("td", {
4114
+ style: j,
4115
+ children: n ? z({
4116
4116
  field: n,
4117
4117
  fieldName: e,
4118
- value: O[e],
4118
+ value: k[e],
4119
4119
  mode: "edit",
4120
- onChange: (n) => g(t, e, n),
4121
- record: O,
4122
- refs: S,
4120
+ onChange: (n) => _(t, e, n),
4121
+ record: k,
4122
+ refs: C,
4123
4123
  compact: !0,
4124
- locale: D
4125
- }) : P(O[e])
4124
+ locale: O
4125
+ }) : W(k[e])
4126
4126
  }, e);
4127
- let c = w && e === C, l = n ? L({
4127
+ let c = T && e === w, l = n ? z({
4128
4128
  field: n,
4129
4129
  fieldName: e,
4130
- value: O[e],
4130
+ value: k[e],
4131
4131
  mode: "display",
4132
- record: O,
4133
- refs: S,
4132
+ record: k,
4133
+ refs: C,
4134
4134
  entity: r,
4135
4135
  entities: i,
4136
4136
  screens: c ? void 0 : a,
4137
- locale: D
4138
- }) : P(O[e]), u = j && o && !f;
4137
+ locale: O
4138
+ }) : W(k[e]), u = M && o && !p;
4139
4139
  return /* @__PURE__ */ Z("td", {
4140
4140
  style: {
4141
- ...k,
4141
+ ...A,
4142
4142
  cursor: u ? "pointer" : "default"
4143
4143
  },
4144
- onClick: u ? () => m({
4144
+ onClick: u ? () => h({
4145
4145
  rowId: t,
4146
4146
  col: e
4147
4147
  }) : void 0,
4148
4148
  children: c ? /* @__PURE__ */ Z("a", {
4149
- href: w,
4149
+ href: T,
4150
4150
  style: {
4151
4151
  color: "var(--accent)",
4152
4152
  textDecoration: "none",
@@ -4171,96 +4171,96 @@ function qr({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
4171
4171
  gap: 4
4172
4172
  },
4173
4173
  children: [
4174
- h?.saving && /* @__PURE__ */ Z(F, { size: 12 }),
4175
- h?.error && /* @__PURE__ */ Z("span", {
4174
+ g?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
4175
+ g?.error && /* @__PURE__ */ Z("span", {
4176
4176
  style: {
4177
4177
  fontSize: 11,
4178
4178
  color: "var(--danger)"
4179
4179
  },
4180
- title: h.error,
4180
+ title: g.error,
4181
4181
  children: "!"
4182
4182
  }),
4183
- l === "row_edit" && /* @__PURE__ */ Z(b, {
4183
+ l === "row_edit" && /* @__PURE__ */ Z(y, {
4184
4184
  size: 24,
4185
4185
  icon: /* @__PURE__ */ Z(e.edit, { size: 12 }),
4186
- onClick: () => v(t),
4186
+ onClick: () => b(t),
4187
4187
  title: "Edit row"
4188
4188
  }),
4189
- /* @__PURE__ */ Z(b, {
4189
+ /* @__PURE__ */ Z(y, {
4190
4190
  size: 24,
4191
4191
  icon: /* @__PURE__ */ Z(e.trash, { size: 12 }),
4192
- onClick: () => _(t),
4192
+ onClick: () => v(t),
4193
4193
  title: "Delete row"
4194
4194
  })
4195
4195
  ]
4196
4196
  })
4197
4197
  }),
4198
- !c && T && T.length > 0 && /* @__PURE__ */ Z("td", {
4198
+ !c && E && E.length > 0 && /* @__PURE__ */ Z("td", {
4199
4199
  style: {
4200
4200
  padding: "4px 8px",
4201
4201
  borderBottom: "1px solid var(--divider)",
4202
4202
  verticalAlign: "middle"
4203
4203
  },
4204
4204
  children: /* @__PURE__ */ Z(lr, {
4205
- actions: T,
4205
+ actions: E,
4206
4206
  objectIds: [t],
4207
- row: O,
4208
- onSuccess: E
4207
+ row: k,
4208
+ onSuccess: D
4209
4209
  })
4210
4210
  })
4211
4211
  ]
4212
4212
  });
4213
4213
  }
4214
- function Jr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: u, accent: d }) {
4215
- let f = H(), p = a.find((e) => e.startsWith("_error:")), m = new Set(a.filter((e) => !e.startsWith("_error:"))), h = {
4214
+ function Jr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: d, accent: f }) {
4215
+ let p = ie(), m = a.find((e) => e.startsWith("_error:")), h = new Set(a.filter((e) => !e.startsWith("_error:"))), g = {
4216
4216
  padding: "6px 12px",
4217
4217
  borderBottom: "1px solid var(--divider)",
4218
4218
  verticalAlign: "middle",
4219
4219
  height: 40,
4220
4220
  minWidth: 0
4221
- }, g = {
4221
+ }, _ = {
4222
4222
  display: "block",
4223
4223
  width: "100%",
4224
4224
  maxWidth: "100%",
4225
4225
  minWidth: 0
4226
4226
  };
4227
4227
  return /* @__PURE__ */ Q("tr", {
4228
- style: d ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
4228
+ style: f ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
4229
4229
  onKeyDown: (e) => {
4230
4230
  e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), c()) : e.key === "Escape" && (e.preventDefault(), l());
4231
4231
  },
4232
4232
  children: [r.map((e) => {
4233
- let r = n.fields.get(e), a = i.has(e), o = m.has(e);
4233
+ let r = n.fields.get(e), a = i.has(e), o = h.has(e);
4234
4234
  return a ? /* @__PURE__ */ Z("td", {
4235
4235
  style: {
4236
- ...h,
4236
+ ...g,
4237
4237
  outline: o ? "1px solid var(--danger)" : "none",
4238
4238
  outlineOffset: -1
4239
4239
  },
4240
4240
  title: o ? `${e} is required` : void 0,
4241
4241
  children: /* @__PURE__ */ Z("div", {
4242
- style: g,
4243
- children: r ? L({
4242
+ style: _,
4243
+ children: r ? z({
4244
4244
  field: r,
4245
4245
  fieldName: e,
4246
4246
  value: t[e],
4247
4247
  mode: "edit",
4248
4248
  onChange: (t) => s(e, t),
4249
4249
  record: t,
4250
- refs: u,
4250
+ refs: d,
4251
4251
  compact: !0,
4252
- locale: f
4253
- }) : P(t[e])
4252
+ locale: p
4253
+ }) : W(t[e])
4254
4254
  })
4255
4255
  }, e) : /* @__PURE__ */ Z("td", {
4256
4256
  style: {
4257
- ...h,
4257
+ ...g,
4258
4258
  color: "var(--text-3)"
4259
4259
  },
4260
- children: r?.auto ? "—" : P(t[e])
4260
+ children: r?.auto ? "—" : W(t[e])
4261
4261
  }, e);
4262
4262
  }), /* @__PURE__ */ Z("td", {
4263
- style: h,
4263
+ style: g,
4264
4264
  children: /* @__PURE__ */ Q("div", {
4265
4265
  style: {
4266
4266
  display: "flex",
@@ -4269,21 +4269,21 @@ function Jr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4269
4269
  justifyContent: "flex-end"
4270
4270
  },
4271
4271
  children: [
4272
- p && /* @__PURE__ */ Z("span", {
4272
+ m && /* @__PURE__ */ Z("span", {
4273
4273
  style: {
4274
4274
  fontSize: 11,
4275
4275
  color: "var(--danger)"
4276
4276
  },
4277
- title: p.slice(7),
4277
+ title: m.slice(7),
4278
4278
  children: "!"
4279
4279
  }),
4280
- /* @__PURE__ */ Z(b, {
4280
+ /* @__PURE__ */ Z(y, {
4281
4281
  size: 24,
4282
- icon: Z(o ? F : e.check, { size: 12 }),
4282
+ icon: Z(o ? u : e.check, { size: 12 }),
4283
4283
  onClick: c,
4284
4284
  title: "Confirm (Enter)"
4285
4285
  }),
4286
- /* @__PURE__ */ Z(b, {
4286
+ /* @__PURE__ */ Z(y, {
4287
4287
  size: 24,
4288
4288
  icon: /* @__PURE__ */ Z(e.x, { size: 12 }),
4289
4289
  onClick: l,
@@ -4294,15 +4294,15 @@ function Jr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4294
4294
  })]
4295
4295
  });
4296
4296
  }
4297
- function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: u, accent: d }) {
4298
- let f = H(), p = Me(), m = a.find((e) => e.startsWith("_error:")), h = new Set(a.filter((e) => !e.startsWith("_error:")));
4297
+ function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: c, onCancel: l, refs: d, accent: f }) {
4298
+ let p = ie(), m = Me(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:")));
4299
4299
  return /* @__PURE__ */ Q("div", {
4300
4300
  style: {
4301
4301
  border: "1px solid var(--border)",
4302
4302
  borderRadius: 8,
4303
4303
  background: "var(--surface)",
4304
4304
  overflow: "hidden",
4305
- boxShadow: d ? "inset 3px 0 0 var(--accent)" : void 0
4305
+ boxShadow: f ? "inset 3px 0 0 var(--accent)" : void 0
4306
4306
  },
4307
4307
  onKeyDown: (e) => {
4308
4308
  e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), c()) : e.key === "Escape" && (e.preventDefault(), l());
@@ -4315,7 +4315,7 @@ function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4315
4315
  gap: 12
4316
4316
  },
4317
4317
  children: r.map((e) => {
4318
- let r = n.fields.get(e), a = i.has(e), o = h.has(e), c = r ? ie(r, e) : e, l = `${p}-${e}`, d = `${l}-label`, m = {
4318
+ let r = n.fields.get(e), a = i.has(e), o = g.has(e), c = r ? H(r, e) : e, l = `${m}-${e}`, u = `${l}-label`, f = {
4319
4319
  fontSize: 11.5,
4320
4320
  fontWeight: 600,
4321
4321
  color: "var(--text-3)"
@@ -4328,13 +4328,13 @@ function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4328
4328
  minWidth: 0
4329
4329
  },
4330
4330
  children: [a && r ? /* @__PURE__ */ Z("label", {
4331
- id: d,
4331
+ id: u,
4332
4332
  htmlFor: l,
4333
- style: m,
4333
+ style: f,
4334
4334
  children: c
4335
4335
  }) : /* @__PURE__ */ Z("div", {
4336
- id: d,
4337
- style: m,
4336
+ id: u,
4337
+ style: f,
4338
4338
  children: c
4339
4339
  }), /* @__PURE__ */ Z("div", {
4340
4340
  style: {
@@ -4344,19 +4344,19 @@ function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4344
4344
  borderRadius: o ? 5 : 0
4345
4345
  },
4346
4346
  title: o ? `${e} is required` : void 0,
4347
- children: a ? r ? L({
4347
+ children: a ? r ? z({
4348
4348
  field: r,
4349
4349
  fieldName: e,
4350
4350
  value: t[e],
4351
4351
  mode: "edit",
4352
4352
  onChange: (t) => s(e, t),
4353
4353
  record: t,
4354
- refs: u,
4354
+ refs: d,
4355
4355
  compact: !0,
4356
4356
  fieldId: l,
4357
- labelId: d,
4358
- locale: f
4359
- }) : P(t[e]) : r?.auto ? "—" : P(t[e])
4357
+ labelId: u,
4358
+ locale: p
4359
+ }) : W(t[e]) : r?.auto ? "—" : W(t[e])
4360
4360
  })]
4361
4361
  }, e);
4362
4362
  })
@@ -4371,21 +4371,21 @@ function Yr({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
4371
4371
  gap: 6
4372
4372
  },
4373
4373
  children: [
4374
- m && /* @__PURE__ */ Z("span", {
4374
+ h && /* @__PURE__ */ Z("span", {
4375
4375
  style: {
4376
4376
  fontSize: 11,
4377
4377
  color: "var(--danger)"
4378
4378
  },
4379
- title: m.slice(7),
4379
+ title: h.slice(7),
4380
4380
  children: "!"
4381
4381
  }),
4382
- /* @__PURE__ */ Z(b, {
4382
+ /* @__PURE__ */ Z(y, {
4383
4383
  size: 32,
4384
- icon: Z(o ? F : e.check, { size: 14 }),
4384
+ icon: Z(o ? u : e.check, { size: 14 }),
4385
4385
  onClick: c,
4386
4386
  title: "Confirm (Enter)"
4387
4387
  }),
4388
- /* @__PURE__ */ Z(b, {
4388
+ /* @__PURE__ */ Z(y, {
4389
4389
  size: 32,
4390
4390
  icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
4391
4391
  onClick: l,
@@ -4607,7 +4607,7 @@ function ci(e, t) {
4607
4607
  //#endregion
4608
4608
  //#region src/hooks/useScreenBack.ts
4609
4609
  function li(e) {
4610
- let t = Fe(), n = f(), r = y(), i = lt((e) => e.depth), { data: a } = U(), o = e?.fallback, s = ct((e) => {
4610
+ let t = Fe(), n = b(), r = v(), i = lt((e) => e.depth), { data: a } = P(), o = e?.fallback, s = ct((e) => {
4611
4611
  let t = e.tabs.find((t) => t.id === e.activeTabId);
4612
4612
  return t ? t.returnTo : void 0;
4613
4613
  }), { hasOriginBack: c, allowFallbackBack: l } = q(() => gt(s, n.enabled), [s, n.enabled]), u = G(() => {
@@ -4622,7 +4622,7 @@ function li(e) {
4622
4622
  }
4623
4623
  if (i.kind === "live" && i.tabId) e.commitTabNavigation(i.tabId, { search: i.search ?? "" });
4624
4624
  else if (i.kind === "reopen") {
4625
- let t = i.title ? void 0 : ne(i.pathname, a?.screens, a?.entities);
4625
+ let t = i.title ? void 0 : S(i.pathname, a?.screens, a?.entities);
4626
4626
  e.openTab({
4627
4627
  pathname: i.pathname,
4628
4628
  search: i.search ?? "",
@@ -4926,7 +4926,7 @@ function Wi(e, t) {
4926
4926
  function Gi(e, t) {
4927
4927
  if (!e) return [];
4928
4928
  let n = new $();
4929
- for (let r of T(e)) n.add(r), t.addField(r, "identity");
4929
+ for (let r of D(e)) n.add(r), t.addField(r, "identity");
4930
4930
  let r = Fi(e, e.display.display_field, { explicit: !0 });
4931
4931
  r && (n.add(r), t.addField(r, "display"), ia(e, r, t, "display"));
4932
4932
  for (let r of Ki(e.display.display_template)) {
@@ -5186,7 +5186,7 @@ var $ = class {
5186
5186
  },
5187
5187
  children: this.state.error?.message || "An unexpected error occurred."
5188
5188
  }),
5189
- /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(d, {
5189
+ /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(l, {
5190
5190
  onClick: this.handleRetry,
5191
5191
  children: "Try again"
5192
5192
  }) })
@@ -5208,7 +5208,7 @@ function ua(e, t) {
5208
5208
  let n = la(e, t), r = n[2];
5209
5209
  return Re({
5210
5210
  queryKey: n,
5211
- queryFn: () => E(e, t),
5211
+ queryFn: () => O(e, t),
5212
5212
  enabled: !!e && !!t && t !== "new" && r !== void 0
5213
5213
  });
5214
5214
  }