@declarion/react 0.44.0 → 0.47.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 (40) hide show
  1. package/dist-lib/{DraggableChildrenTable-G4Sw1XAD.js → DraggableChildrenTable-B6KjWkwD.js} +39 -39
  2. package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
  3. package/dist-lib/{Grid-CXn-IK3H.js → Grid-OdquWJNX.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-DX8pFS5A.js → LayoutRenderer-CzAdhjNT.js} +794 -787
  5. package/dist-lib/{MarkdownRenderer-CreI9x2m.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
  6. package/dist-lib/{RefreshControl-DFh0-gCb.js → RefreshControl-F9Ib9asP.js} +179 -179
  7. package/dist-lib/{SmartDetailPage.impl-K6Jj1-9z.js → SmartDetailPage.impl-DdSu3kmW.js} +631 -593
  8. package/dist-lib/{SmartRecordListPage.impl-DQW_uVfL.js → SmartRecordListPage.impl-SkIp0_Rd.js} +220 -209
  9. package/dist-lib/api/agents.d.ts +39 -7
  10. package/dist-lib/components/agents/AgentChatPanel.d.ts +6 -1
  11. package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
  12. package/dist-lib/components/file-widgets/host.d.ts +1 -0
  13. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  14. package/dist-lib/components/pages/exportRequest.d.ts +3 -3
  15. package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
  16. package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
  17. package/dist-lib/components/pages/list/filter-meta.d.ts +22 -8
  18. package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
  19. package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
  20. package/dist-lib/hooks/useAgentConversation.d.ts +7 -19
  21. package/dist-lib/hooks/useCursorEntityData.d.ts +3 -2
  22. package/dist-lib/hooks/useFilters.d.ts +1 -0
  23. package/dist-lib/icons.js +1 -1
  24. package/dist-lib/index.d.ts +8 -1
  25. package/dist-lib/index.js +3246 -2984
  26. package/dist-lib/lib/actions.d.ts +1 -1
  27. package/dist-lib/lib/anchor.d.ts +37 -0
  28. package/dist-lib/lib/filter-evaluator.d.ts +16 -0
  29. package/dist-lib/lib/filters.d.ts +10 -4
  30. package/dist-lib/lib/messages.d.ts +1 -0
  31. package/dist-lib/lib/variants.d.ts +7 -0
  32. package/dist-lib/{registry-r4hiflwC.js → registry-C2VD-5MD.js} +1103 -879
  33. package/dist-lib/testing.js +10 -10
  34. package/dist-lib/types/api.d.ts +3 -10
  35. package/dist-lib/types/schema.d.ts +51 -13
  36. package/dist-lib/{useCurrentScreen-CpQjVmrT.js → useCurrentScreen-ow4r-nWa.js} +1130 -1054
  37. package/dist-lib/{useProperties-CULxrNT4.js → useProperties-lEKfzm2X.js} +114 -83
  38. package/dist-lib/{value-fUHxMV4r.js → value-CXohNH6a.js} +1 -1
  39. package/dist-lib/vite/index.js +23 -22
  40. package/package.json +12 -12
@@ -1,6 +1,6 @@
1
- import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as n, An as r, At as i, B as a, C as o, Cn as s, E as c, En as l, Gn as u, Gt as d, I as f, In as p, Jn as m, K as h, L as g, Ln as _, Mn as v, O as y, P as b, R as x, St as S, T as C, Tt as w, U as T, V as E, W as D, X as O, Xn as k, Zn as A, _ as j, _t as M, ar as N, b as P, bn as F, bt as I, cr as L, d as R, g as z, gt as ee, i as te, j as B, kt as ne, lr as V, mn as re, nr as ie, ot as ae, pt as oe, rt as H, sr as se, st as ce, u as le, v as ue, vt as de, wn as U, wt as fe, xn as pe, yn as me, yt as he, z as ge } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-fUHxMV4r.js";
1
+ import { s as e, t } from "./DynamicIcon-Dc2j-rg_.js";
2
+ import { A as n, At as r, B as i, C as a, Dn as o, E as s, Gt as c, I as l, K as u, Kn as d, L as f, Ln as p, Nn as m, O as h, P as g, Qn as _, R as v, Rn as y, Sn as b, St as x, T as S, Tn as C, Tt as w, U as T, V as E, W as D, X as O, Yn as k, Zn as A, _ as j, _t as M, b as N, bn as P, bt as F, cr as I, d as L, g as ee, gt as R, i as te, j as z, jn as ne, kt as re, lr as B, mn as ie, or as V, ot as ae, pt as oe, rr as se, rt as H, st as ce, u as le, ur as U, v as ue, vt as de, wn as fe, wt as pe, xn as me, yt as he, z as ge } from "./useCurrentScreen-ow4r-nWa.js";
3
+ import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-CXohNH6a.js";
4
4
  import { n as Ae, r as je, t as Me } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Component as Ne, Suspense as Pe, lazy as Fe, useCallback as W, useEffect as G, useId as Ie, useLayoutEffect as Le, useMemo as K, useRef as q, useState as J } from "react";
6
6
  import { parsePath as Re, useNavigate as ze } from "react-router";
@@ -119,14 +119,14 @@ function Je({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
119
119
  ]
120
120
  })
121
121
  }),
122
- i && /* @__PURE__ */ X(se, {
122
+ i && /* @__PURE__ */ X(I, {
123
123
  tone: i.tone ?? "violet",
124
124
  size: "xs",
125
125
  dot: i.dot,
126
126
  children: i.text
127
127
  }),
128
128
  r,
129
- c && /* @__PURE__ */ X(L, {
129
+ c && /* @__PURE__ */ X(B, {
130
130
  size: 24,
131
131
  icon: X(m ? e.up : e.down, { size: 14 }),
132
132
  onClick: () => h((e) => !e),
@@ -579,11 +579,11 @@ function zt(e) {
579
579
  if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
580
580
  }
581
581
  function Bt() {
582
- let e = ze(), { data: t } = i(), n = oe(), r = ce();
583
- return W((i, a) => {
584
- let { pathname: o, search: s, hash: c } = Rt(i, a?.search);
582
+ let e = ze(), { data: t } = r(), n = oe(), i = ce();
583
+ return W((r, a) => {
584
+ let { pathname: o, search: s, hash: c } = Rt(r, a?.search);
585
585
  if (n.enabled) {
586
- r(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
586
+ i(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
587
587
  return;
588
588
  }
589
589
  let l = kt.getState(), u = a?.topLevel ?? !1, d = Nt(s), f = u || typeof window > "u" ? void 0 : Ft({
@@ -614,12 +614,12 @@ function Bt() {
614
614
  }, { replace: a?.replace });
615
615
  return;
616
616
  }
617
- let m = a?.title ? void 0 : v(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
617
+ let h = a?.title ? void 0 : m(o, t?.screens, t?.entities), g = a?.title ?? h?.title ?? o, _ = a?.icon ?? h?.icon;
618
618
  l.openTab({
619
619
  pathname: o,
620
620
  search: d,
621
- title: h,
622
- icon: g,
621
+ title: g,
622
+ icon: _,
623
623
  closable: !0,
624
624
  returnTo: u ? null : f
625
625
  }), e({
@@ -632,7 +632,7 @@ function Bt() {
632
632
  t?.screens,
633
633
  t?.entities,
634
634
  n.enabled,
635
- r
635
+ i
636
636
  ]);
637
637
  }
638
638
  //#endregion
@@ -669,19 +669,19 @@ function Xt(e) {
669
669
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
670
670
  }
671
671
  function Zt(e) {
672
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, p = Ce(r), [m, h] = J("idle"), [_, v] = J(null), [y, x] = J(null), [S, C] = J(null), [w, T] = J(!1), E = q(null), D = q(!1), O = q(null), { register: k, unregister: A, isDraft: j } = b();
672
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, alt: s, disabled: c, visual: u, uploadFieldCode: d, uploadSlotCode: p } = e, m = Ce(r), [h, _] = J("idle"), [v, y] = J(null), [b, x] = J(null), [S, C] = J(null), [w, T] = J(!1), E = q(null), D = q(!1), O = q(null), { register: k, unregister: A, isDraft: j } = g();
673
673
  G(() => () => {
674
674
  E.current && E.current.abort();
675
675
  }, []);
676
- let M = K(() => be(p, s, t.display?.placeholder || n), [
676
+ let M = K(() => be(m, s, t.display?.placeholder || n), [
677
677
  s,
678
678
  t.display?.placeholder,
679
679
  n,
680
- p
680
+ m
681
681
  ]), N = (t.accepts ?? ["image/*"]).join(","), P = W(async (r) => {
682
- let o = a(r, t.accepts, t.max_size_bytes);
682
+ let o = i(r, t.accepts, t.max_size_bytes);
683
683
  if (o) {
684
- x(o), h("error");
684
+ x(o), _("error");
685
685
  return;
686
686
  }
687
687
  let s = r;
@@ -695,10 +695,10 @@ function Zt(e) {
695
695
  x({
696
696
  code: "CROP_FAILED",
697
697
  message: e instanceof Error ? e.message : "Crop failed"
698
- }), h("error");
698
+ }), _("error");
699
699
  return;
700
700
  }
701
- x(null), D.current = !1, h("uploading"), v({
701
+ x(null), D.current = !1, _("uploading"), y({
702
702
  loaded: 0,
703
703
  total: s.size,
704
704
  pct: 0
@@ -709,17 +709,17 @@ function Zt(e) {
709
709
  let r = await ge({
710
710
  file: s,
711
711
  entityCode: e.entityCode,
712
- fieldCode: u ?? n,
713
- slotCode: d,
712
+ fieldCode: d ?? n,
713
+ slotCode: p,
714
714
  signal: c.signal,
715
- onProgress: v
715
+ onProgress: y
716
716
  });
717
717
  if (D.current) {
718
- g(r.id).catch(() => {}), A(r.id);
718
+ f(r.id).catch(() => {}), A(r.id);
719
719
  return;
720
720
  }
721
- p && j(p.id) && (g(p.id).catch(() => {}), A(p.id)), k(r.id, () => g(r.id)), C(r.id), h("idle"), v(null);
722
- let a = {
721
+ m && j(m.id) && (f(m.id).catch(() => {}), A(m.id)), k(r.id, () => f(r.id)), C(r.id), _("idle"), y(null);
722
+ let i = {
723
723
  id: r.id,
724
724
  filename: r.filename,
725
725
  content_type: r.content_type,
@@ -730,17 +730,17 @@ function Zt(e) {
730
730
  url: r.url,
731
731
  metadata: r.metadata
732
732
  };
733
- i?.(t.mode === "array" ? [a] : a);
733
+ a?.(t.mode === "array" ? [i] : i);
734
734
  } catch (e) {
735
- if (e instanceof f && e.code === "ABORTED") return;
736
- let t = e instanceof f ? {
735
+ if (e instanceof l && e.code === "ABORTED") return;
736
+ let t = e instanceof l ? {
737
737
  code: e.code,
738
738
  message: e.message
739
739
  } : {
740
740
  code: "UNKNOWN",
741
741
  message: e instanceof Error ? e.message : "Upload failed"
742
742
  };
743
- x(t), h("error"), v(null);
743
+ x(t), _("error"), y(null);
744
744
  }
745
745
  }, [
746
746
  t.accepts,
@@ -749,119 +749,119 @@ function Zt(e) {
749
749
  t.display?.aspect_ratio,
750
750
  t.mode,
751
751
  n,
752
- i,
752
+ a,
753
753
  e.entityCode,
754
754
  k,
755
755
  j,
756
- p,
756
+ m,
757
757
  A,
758
- u,
759
- d
758
+ d,
759
+ p
760
760
  ]), F = W(() => {
761
- m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), v(null)), S && (g(S).catch(() => {}), A(S), C(null));
761
+ h === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, _("idle"), y(null)), S && (f(S).catch(() => {}), A(S), C(null));
762
762
  }, [
763
- m,
763
+ h,
764
764
  S,
765
765
  A
766
766
  ]), I = W(() => {
767
- p && j(p.id) && (g(p.id).catch(() => {}), A(p.id), C(null)), i?.(t.mode === "array" ? [] : null);
767
+ m && j(m.id) && (f(m.id).catch(() => {}), A(m.id), C(null)), a?.(t.mode === "array" ? [] : null);
768
768
  }, [
769
- p,
769
+ m,
770
770
  t.mode,
771
771
  j,
772
- i,
772
+ a,
773
773
  A
774
774
  ]), L = W(() => {
775
- x(null), h("idle"), O.current?.click();
776
- }, []), R = W(() => {
775
+ x(null), _("idle"), O.current?.click();
776
+ }, []), ee = W(() => {
777
777
  c || O.current?.click();
778
- }, [c]), z = W((e) => {
779
- c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
780
- }, [c, R]), ee = W((e) => {
778
+ }, [c]), R = W((e) => {
779
+ c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ee());
780
+ }, [c, ee]), te = W((e) => {
781
781
  c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
782
- }, [c]), te = W((e) => {
782
+ }, [c]), z = W((e) => {
783
783
  if (c) return;
784
784
  e.preventDefault();
785
785
  let t = e.dataTransfer.files?.[0];
786
786
  t && P(t);
787
- }, [c, P]), B = W((e) => {
787
+ }, [c, P]), ne = W((e) => {
788
788
  let t = e.target.files?.[0];
789
789
  e.target.value = "", t && P(t);
790
- }, [P]), ne = l.aspectRatio ?? en(l.shape, t.display?.aspect_ratio), V = ye(p), re = {
791
- aspectRatio: ne,
792
- width: l.width ?? (l.shape === "wide" ? "100%" : "120px")
793
- }, ie = !!p, ae = Yt(p, t.display?.listable_thumbnail), oe = Se(p, t.display?.listable_thumbnail), H = xe(p?.id, oe, ae), se = o === "display", ce = W((e) => {
790
+ }, [P]), re = u.aspectRatio ?? en(u.shape, t.display?.aspect_ratio), B = ye(m), ie = {
791
+ aspectRatio: re,
792
+ width: u.width ?? (u.shape === "wide" ? "100%" : "120px")
793
+ }, V = !!m, ae = Yt(m, t.display?.listable_thumbnail), oe = Se(m, t.display?.listable_thumbnail), se = xe(m?.id, oe, ae), H = o === "display", ce = W((e) => {
794
794
  e.stopPropagation(), T((e) => !e);
795
795
  }, []), le = W((e) => {
796
- if (!p || !w) return;
797
- 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 = Te(p, {
796
+ if (!m || !w) return;
797
+ 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 = Te(m, {
798
798
  x: Math.max(0, Math.min(1, r)),
799
- y: Math.max(0, Math.min(1, a))
799
+ y: Math.max(0, Math.min(1, i))
800
800
  });
801
- i?.(t.mode === "array" ? [o] : o), T(!1);
801
+ a?.(t.mode === "array" ? [o] : o), T(!1);
802
802
  }, [
803
803
  t.mode,
804
- p,
804
+ m,
805
805
  w,
806
- i
806
+ a
807
807
  ]);
808
- return se ? /* @__PURE__ */ X("div", {
809
- className: Qt(l.shape, !1),
810
- style: re,
808
+ return H ? /* @__PURE__ */ X("div", {
809
+ className: Qt(u.shape, !1),
810
+ style: ie,
811
811
  "aria-label": M,
812
- children: ie && H ? /* @__PURE__ */ X("img", {
813
- src: H,
812
+ children: V && se ? /* @__PURE__ */ X("img", {
813
+ src: se,
814
814
  alt: M,
815
- className: $t(l.shape),
816
- style: { objectPosition: De(V) },
815
+ className: $t(u.shape),
816
+ style: { objectPosition: De(B) },
817
817
  loading: "lazy"
818
818
  }) : /* @__PURE__ */ X(nn, {
819
- shape: l.shape,
819
+ shape: u.shape,
820
820
  label: M,
821
821
  placeholder: t.display?.placeholder
822
822
  })
823
823
  }) : /* @__PURE__ */ Z("div", {
824
- className: Qt(l.shape, !c),
825
- style: re,
824
+ className: Qt(u.shape, !c),
825
+ style: ie,
826
826
  tabIndex: c ? -1 : 0,
827
827
  role: "button",
828
828
  "aria-label": M,
829
829
  "aria-disabled": c || void 0,
830
- "aria-busy": m === "uploading" || void 0,
831
- "aria-invalid": m === "error" || void 0,
832
- onClick: m === "idle" && !ie ? R : void 0,
830
+ "aria-busy": h === "uploading" || void 0,
831
+ "aria-invalid": h === "error" || void 0,
832
+ onClick: h === "idle" && !V ? ee : void 0,
833
833
  onMouseDown: w ? le : void 0,
834
- onKeyDown: z,
835
- onDragOver: ee,
836
- onDrop: te,
834
+ onKeyDown: R,
835
+ onDragOver: te,
836
+ onDrop: z,
837
837
  "data-testid": w ? "focal-point-target" : `file-widget-${n}`,
838
838
  children: [
839
839
  /* @__PURE__ */ X("input", {
840
840
  ref: O,
841
841
  type: "file",
842
842
  accept: N,
843
- onChange: B,
843
+ onChange: ne,
844
844
  style: { display: "none" },
845
845
  "data-testid": `file-input-${n}`
846
846
  }),
847
- ie && H ? /* @__PURE__ */ X("img", {
848
- src: H,
847
+ V && se ? /* @__PURE__ */ X("img", {
848
+ src: se,
849
849
  alt: M,
850
- className: $t(l.shape),
851
- style: { objectPosition: De(V) },
850
+ className: $t(u.shape),
851
+ style: { objectPosition: De(B) },
852
852
  loading: "lazy"
853
- }) : m === "uploading" ? null : /* @__PURE__ */ X(nn, {
854
- shape: l.shape,
853
+ }) : h === "uploading" ? null : /* @__PURE__ */ X(nn, {
854
+ shape: u.shape,
855
855
  label: M,
856
856
  placeholder: t.display?.placeholder
857
857
  }),
858
- m === "uploading" && /* @__PURE__ */ X(rn, { pct: _?.pct ?? 0 }),
858
+ h === "uploading" && /* @__PURE__ */ X(rn, { pct: v?.pct ?? 0 }),
859
859
  S && /* @__PURE__ */ X("span", {
860
860
  className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
861
861
  "aria-hidden": "true",
862
862
  "data-testid": "draft-indicator"
863
863
  }),
864
- ie && m === "idle" && !c && /* @__PURE__ */ Z("div", {
864
+ V && h === "idle" && !c && /* @__PURE__ */ Z("div", {
865
865
  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",
866
866
  children: [
867
867
  t.display?.focal_point && /* @__PURE__ */ X("button", {
@@ -875,7 +875,7 @@ function Zt(e) {
875
875
  type: "button",
876
876
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
877
877
  onClick: (e) => {
878
- e.stopPropagation(), R();
878
+ e.stopPropagation(), ee();
879
879
  },
880
880
  children: "Change"
881
881
  }),
@@ -889,15 +889,15 @@ function Zt(e) {
889
889
  })
890
890
  ]
891
891
  }),
892
- V && ie && /* @__PURE__ */ X("span", {
892
+ B && V && /* @__PURE__ */ X("span", {
893
893
  className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
894
894
  style: {
895
- left: `${V.x * 100}%`,
896
- top: `${V.y * 100}%`
895
+ left: `${B.x * 100}%`,
896
+ top: `${B.y * 100}%`
897
897
  },
898
898
  "data-testid": "focal-point-marker"
899
899
  }),
900
- m === "uploading" && /* @__PURE__ */ X("button", {
900
+ h === "uploading" && /* @__PURE__ */ X("button", {
901
901
  type: "button",
902
902
  className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
903
903
  onClick: (e) => {
@@ -906,13 +906,13 @@ function Zt(e) {
906
906
  "data-testid": "cancel-upload",
907
907
  children: "Cancel"
908
908
  }),
909
- m === "error" && y && /* @__PURE__ */ Z("div", {
909
+ h === "error" && b && /* @__PURE__ */ Z("div", {
910
910
  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",
911
911
  role: "alert",
912
912
  children: [/* @__PURE__ */ X("span", {
913
913
  className: "truncate",
914
- title: y.message,
915
- children: y.message
914
+ title: b.message,
915
+ children: b.message
916
916
  }), /* @__PURE__ */ X("button", {
917
917
  type: "button",
918
918
  className: "underline",
@@ -1029,7 +1029,7 @@ function sn(e) {
1029
1029
  }
1030
1030
  //#endregion
1031
1031
  //#region src/components/file-widgets/GridLazy.tsx
1032
- var cn = Fe(() => import("./Grid-CXn-IK3H.js").then((e) => ({ default: e.Grid })));
1032
+ var cn = Fe(() => import("./Grid-OdquWJNX.js").then((e) => ({ default: e.Grid })));
1033
1033
  function ln() {
1034
1034
  return /* @__PURE__ */ X("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
1035
1035
  }
@@ -1042,25 +1042,26 @@ function un(e) {
1042
1042
  //#endregion
1043
1043
  //#region src/components/file-widgets/DocumentCard.tsx
1044
1044
  function dn({ contentType: e }) {
1045
+ let t = e ? e.includes("pdf") ? "PDF" : e.includes("word") ? "DOC" : e.includes("sheet") || e.includes("excel") ? "XLS" : e.startsWith("image/") ? "IMG" : e.split("/")[1]?.slice(0, 4).toUpperCase() ?? "FILE" : "FILE";
1045
1046
  return /* @__PURE__ */ X("div", {
1046
1047
  className: "flex h-16 w-16 flex-none items-center justify-center rounded-md border border-border bg-surface-3 text-xs font-medium text-muted-foreground",
1047
- children: e ? e.includes("pdf") ? "PDF" : e.includes("word") ? "DOC" : e.includes("sheet") || e.includes("excel") ? "XLS" : e.startsWith("image/") ? "IMG" : e.split("/")[1]?.slice(0, 4).toUpperCase() ?? "FILE" : "FILE"
1048
+ children: t
1048
1049
  });
1049
1050
  }
1050
1051
  function fn(e) {
1051
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = Ce(r), [d, p] = J("idle"), [m, h] = J(null), [_, v] = J(null), [y, S] = J(!1), [C, w] = J(u?.filename ?? ""), T = q(null), E = q(!1), D = q(null), { register: O, unregister: k, isDraft: A } = b(), { open: j } = Ee();
1052
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: u } = e, d = Ce(r), [p, m] = J("idle"), [h, _] = J(null), [y, b] = J(null), [x, S] = J(!1), [C, w] = J(d?.filename ?? ""), T = q(null), E = q(!1), D = q(null), { register: O, unregister: k, isDraft: A } = g(), { open: j } = Ee();
1052
1053
  G(() => () => {
1053
1054
  T.current && T.current.abort();
1054
1055
  }, []), G(() => {
1055
- w(u?.filename ?? "");
1056
- }, [u?.filename]);
1056
+ w(d?.filename ?? "");
1057
+ }, [d?.filename]);
1057
1058
  let M = (t.accepts ?? []).join(","), N = W(async (r) => {
1058
- let o = a(r, t.accepts, t.max_size_bytes);
1059
+ let o = i(r, t.accepts, t.max_size_bytes);
1059
1060
  if (o) {
1060
- v(o), p("error");
1061
+ b(o), m("error");
1061
1062
  return;
1062
1063
  }
1063
- v(null), E.current = !1, p("uploading"), h({
1064
+ b(null), E.current = !1, m("uploading"), _({
1064
1065
  loaded: 0,
1065
1066
  total: r.size,
1066
1067
  pct: 0
@@ -1068,96 +1069,96 @@ function fn(e) {
1068
1069
  let s = new AbortController();
1069
1070
  T.current = s;
1070
1071
  try {
1071
- let a = await ge({
1072
+ let i = await ge({
1072
1073
  file: r,
1073
1074
  entityCode: e.entityCode,
1074
1075
  fieldCode: c ?? n,
1075
- slotCode: l,
1076
+ slotCode: u,
1076
1077
  signal: s.signal,
1077
- onProgress: h
1078
+ onProgress: _
1078
1079
  });
1079
1080
  if (E.current) {
1080
- g(a.id).catch(() => {}), k(a.id);
1081
+ f(i.id).catch(() => {}), k(i.id);
1081
1082
  return;
1082
1083
  }
1083
- u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), O(a.id, () => g(a.id)), p("idle"), h(null);
1084
+ d && A(d.id) && (f(d.id).catch(() => {}), k(d.id)), O(i.id, () => f(i.id)), m("idle"), _(null);
1084
1085
  let o = {
1085
- id: a.id,
1086
- filename: a.filename,
1087
- content_type: a.content_type,
1088
- size_bytes: a.size_bytes,
1089
- sha256: a.sha256,
1090
- width: a.width,
1091
- height: a.height,
1092
- url: a.url,
1093
- metadata: a.metadata
1086
+ id: i.id,
1087
+ filename: i.filename,
1088
+ content_type: i.content_type,
1089
+ size_bytes: i.size_bytes,
1090
+ sha256: i.sha256,
1091
+ width: i.width,
1092
+ height: i.height,
1093
+ url: i.url,
1094
+ metadata: i.metadata
1094
1095
  };
1095
- i?.(t.mode === "array" ? [o] : o);
1096
+ a?.(t.mode === "array" ? [o] : o);
1096
1097
  } catch (e) {
1097
- if (e instanceof f && e.code === "ABORTED") return;
1098
- let t = e instanceof f ? {
1098
+ if (e instanceof l && e.code === "ABORTED") return;
1099
+ let t = e instanceof l ? {
1099
1100
  code: e.code,
1100
1101
  message: e.message
1101
1102
  } : {
1102
1103
  code: "UNKNOWN",
1103
1104
  message: e instanceof Error ? e.message : "Upload failed"
1104
1105
  };
1105
- v(t), p("error"), h(null);
1106
+ b(t), m("error"), _(null);
1106
1107
  }
1107
1108
  }, [
1108
1109
  t.accepts,
1109
1110
  t.max_size_bytes,
1110
1111
  t.mode,
1111
1112
  n,
1112
- u,
1113
+ d,
1113
1114
  A,
1114
- i,
1115
+ a,
1115
1116
  e.entityCode,
1116
1117
  O,
1117
1118
  k,
1118
1119
  c,
1119
- l
1120
+ u
1120
1121
  ]), P = W(() => {
1121
1122
  s || D.current?.click();
1122
1123
  }, [s]), F = W((e) => {
1123
1124
  let t = e.target.files?.[0];
1124
1125
  e.target.value = "", t && N(t);
1125
1126
  }, [N]), I = W(() => {
1126
- u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), i?.(t.mode === "array" ? [] : null);
1127
+ d && A(d.id) && (f(d.id).catch(() => {}), k(d.id)), a?.(t.mode === "array" ? [] : null);
1127
1128
  }, [
1128
- u,
1129
+ d,
1129
1130
  t.mode,
1130
1131
  A,
1131
- i,
1132
+ a,
1132
1133
  k
1133
1134
  ]), L = W(() => {
1134
- d === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, p("idle"), h(null));
1135
- }, [d]), R = W(() => {
1136
- u && j(u.id, "download", we(u));
1137
- }, [u, j]), z = u ? _e(u) : !1, ee = W(() => {
1138
- !u || !_e(u) || j(u.id, "preview", ke(u));
1139
- }, [u, j]), te = W(() => {
1140
- if (!u) {
1135
+ p === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, m("idle"), _(null));
1136
+ }, [p]), ee = W(() => {
1137
+ d && j(d.id, "download", we(d));
1138
+ }, [d, j]), R = d ? _e(d) : !1, te = W(() => {
1139
+ !d || !_e(d) || j(d.id, "preview", ke(d));
1140
+ }, [d, j]), z = W(() => {
1141
+ if (!d) {
1141
1142
  S(!1);
1142
1143
  return;
1143
1144
  }
1144
1145
  let e = C.trim();
1145
- if (S(!1), !e || e === u.filename) {
1146
- w(u.filename);
1146
+ if (S(!1), !e || e === d.filename) {
1147
+ w(d.filename);
1147
1148
  return;
1148
1149
  }
1149
1150
  let n = {
1150
- ...u,
1151
+ ...d,
1151
1152
  filename: e
1152
1153
  };
1153
- i?.(t.mode === "array" ? [n] : n);
1154
+ a?.(t.mode === "array" ? [n] : n);
1154
1155
  }, [
1155
1156
  C,
1156
- u,
1157
- i,
1157
+ d,
1158
+ a,
1158
1159
  t.mode
1159
- ]), B = o === "display";
1160
- return !u && d !== "uploading" ? /* @__PURE__ */ Z("div", {
1160
+ ]), ne = o === "display";
1161
+ return !d && p !== "uploading" ? /* @__PURE__ */ Z("div", {
1161
1162
  "data-testid": `file-widget-${n}`,
1162
1163
  className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
1163
1164
  children: [
@@ -1167,7 +1168,7 @@ function fn(e) {
1167
1168
  children: [/* @__PURE__ */ X("span", {
1168
1169
  className: "text-sm text-foreground",
1169
1170
  children: t.display?.placeholder || "No document attached"
1170
- }), !B && /* @__PURE__ */ X("button", {
1171
+ }), !ne && /* @__PURE__ */ X("button", {
1171
1172
  type: "button",
1172
1173
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1173
1174
  onClick: P,
@@ -1176,7 +1177,7 @@ function fn(e) {
1176
1177
  children: "Upload"
1177
1178
  })]
1178
1179
  }),
1179
- !B && /* @__PURE__ */ X("input", {
1180
+ !ne && /* @__PURE__ */ X("input", {
1180
1181
  ref: D,
1181
1182
  type: "file",
1182
1183
  accept: M || void 0,
@@ -1184,95 +1185,95 @@ function fn(e) {
1184
1185
  style: { display: "none" },
1185
1186
  "data-testid": `file-input-${n}`
1186
1187
  }),
1187
- d === "error" && _ && /* @__PURE__ */ X("div", {
1188
+ p === "error" && y && /* @__PURE__ */ X("div", {
1188
1189
  className: "ml-auto text-xs text-destructive",
1189
1190
  role: "alert",
1190
- children: _.message
1191
+ children: y.message
1191
1192
  })
1192
1193
  ]
1193
1194
  }) : /* @__PURE__ */ Z("div", {
1194
1195
  "data-testid": `file-widget-${n}`,
1195
1196
  className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
1196
- "aria-busy": d === "uploading" || void 0,
1197
- "aria-invalid": d === "error" || void 0,
1197
+ "aria-busy": p === "uploading" || void 0,
1198
+ "aria-invalid": p === "error" || void 0,
1198
1199
  children: [
1199
- /* @__PURE__ */ X(dn, { contentType: u?.content_type }),
1200
+ /* @__PURE__ */ X(dn, { contentType: d?.content_type }),
1200
1201
  /* @__PURE__ */ Z("div", {
1201
1202
  className: "flex min-w-0 flex-1 flex-col gap-1",
1202
1203
  children: [
1203
- y && u ? /* @__PURE__ */ X("input", {
1204
+ x && d ? /* @__PURE__ */ X("input", {
1204
1205
  type: "text",
1205
1206
  className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
1206
1207
  value: C,
1207
1208
  autoFocus: !0,
1208
1209
  onChange: (e) => w(e.target.value),
1209
- onBlur: te,
1210
+ onBlur: z,
1210
1211
  onKeyDown: (e) => {
1211
- e.key === "Enter" ? te() : e.key === "Escape" && (S(!1), w(u.filename));
1212
+ e.key === "Enter" ? z() : e.key === "Escape" && (S(!1), w(d.filename));
1212
1213
  },
1213
1214
  "data-testid": "filename-input"
1214
1215
  }) : /* @__PURE__ */ X("button", {
1215
1216
  type: "button",
1216
1217
  className: "truncate text-left text-sm font-medium text-foreground hover:underline",
1217
- onClick: () => !B && u && S(!0),
1218
- disabled: B || s || !u,
1219
- title: u?.filename,
1218
+ onClick: () => !ne && d && S(!0),
1219
+ disabled: ne || s || !d,
1220
+ title: d?.filename,
1220
1221
  "data-testid": "filename",
1221
- children: u?.filename ?? "Uploading…"
1222
+ children: d?.filename ?? "Uploading…"
1222
1223
  }),
1223
1224
  /* @__PURE__ */ Z("div", {
1224
1225
  className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
1225
1226
  children: [
1226
- u && /* @__PURE__ */ X("span", { children: x(u.size_bytes) }),
1227
- u?.page_count != null && /* @__PURE__ */ Z("span", { children: [u.page_count, " pages"] }),
1228
- u?.uploaded_at && /* @__PURE__ */ X("span", { children: pn(u.uploaded_at) }),
1229
- u?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", u.uploaded_by] }),
1230
- u?.version?.number != null && /* @__PURE__ */ Z("span", {
1227
+ d && /* @__PURE__ */ X("span", { children: v(d.size_bytes) }),
1228
+ d?.page_count != null && /* @__PURE__ */ Z("span", { children: [d.page_count, " pages"] }),
1229
+ d?.uploaded_at && /* @__PURE__ */ X("span", { children: pn(d.uploaded_at) }),
1230
+ d?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", d.uploaded_by] }),
1231
+ d?.version?.number != null && /* @__PURE__ */ Z("span", {
1231
1232
  "data-testid": "version-badge",
1232
- children: ["v", u.version.number]
1233
+ children: ["v", d.version.number]
1233
1234
  })
1234
1235
  ]
1235
1236
  }),
1236
- d === "uploading" && /* @__PURE__ */ Z("div", {
1237
+ p === "uploading" && /* @__PURE__ */ Z("div", {
1237
1238
  className: "text-xs text-muted-foreground",
1238
1239
  role: "progressbar",
1239
- "aria-valuenow": m?.pct ?? 0,
1240
+ "aria-valuenow": h?.pct ?? 0,
1240
1241
  "aria-valuemin": 0,
1241
1242
  "aria-valuemax": 100,
1242
1243
  "data-testid": "upload-progress",
1243
1244
  children: [
1244
1245
  "Uploading ",
1245
- m?.pct ?? 0,
1246
+ h?.pct ?? 0,
1246
1247
  "%"
1247
1248
  ]
1248
1249
  }),
1249
- d === "error" && _ && /* @__PURE__ */ X("div", {
1250
+ p === "error" && y && /* @__PURE__ */ X("div", {
1250
1251
  className: "text-xs text-destructive",
1251
1252
  role: "alert",
1252
- children: _.message
1253
+ children: y.message
1253
1254
  })
1254
1255
  ]
1255
1256
  }),
1256
1257
  /* @__PURE__ */ Z("div", {
1257
1258
  className: "flex flex-none items-center gap-1",
1258
- children: [u && d !== "uploading" && /* @__PURE__ */ Z(Y, { children: [
1259
+ children: [d && p !== "uploading" && /* @__PURE__ */ Z(Y, { children: [
1259
1260
  /* @__PURE__ */ X("button", {
1260
1261
  type: "button",
1261
1262
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1262
- onClick: R,
1263
+ onClick: ee,
1263
1264
  "data-testid": "download",
1264
1265
  children: "Download"
1265
1266
  }),
1266
1267
  /* @__PURE__ */ X("button", {
1267
1268
  type: "button",
1268
1269
  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",
1269
- onClick: ee,
1270
- disabled: !z,
1271
- title: z ? void 0 : "Preview is available only for images and PDFs",
1270
+ onClick: te,
1271
+ disabled: !R,
1272
+ title: R ? void 0 : "Preview is available only for images and PDFs",
1272
1273
  "data-testid": "preview",
1273
1274
  children: "Preview"
1274
1275
  }),
1275
- !B && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("button", {
1276
+ !ne && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("button", {
1276
1277
  type: "button",
1277
1278
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1278
1279
  onClick: P,
@@ -1287,7 +1288,7 @@ function fn(e) {
1287
1288
  "data-testid": "remove",
1288
1289
  children: "Remove"
1289
1290
  })] })
1290
- ] }), d === "uploading" && /* @__PURE__ */ X("button", {
1291
+ ] }), p === "uploading" && /* @__PURE__ */ X("button", {
1291
1292
  type: "button",
1292
1293
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
1293
1294
  onClick: L,
@@ -1295,7 +1296,7 @@ function fn(e) {
1295
1296
  children: "Cancel"
1296
1297
  })]
1297
1298
  }),
1298
- !B && /* @__PURE__ */ X("input", {
1299
+ !ne && /* @__PURE__ */ X("input", {
1299
1300
  ref: D,
1300
1301
  type: "file",
1301
1302
  accept: M || void 0,
@@ -1316,18 +1317,18 @@ function mn(e) {
1316
1317
  return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
1317
1318
  }
1318
1319
  function hn(e) {
1319
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s } = e, c = Oe(r), [l, u] = J([]), { register: d, unregister: p, isDraft: m } = b(), h = q(c);
1320
- h.current = c;
1321
- let _ = q(null), v = q(/* @__PURE__ */ new Set()), y = q([]);
1322
- y.current = l;
1320
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s } = e, c = Oe(r), [u, d] = J([]), { register: p, unregister: m, isDraft: h } = g(), _ = q(c);
1321
+ _.current = c;
1322
+ let y = q(null), b = q(/* @__PURE__ */ new Set()), x = q([]);
1323
+ x.current = u;
1323
1324
  let { open: S } = Ee();
1324
1325
  G(() => () => {
1325
- y.current.forEach((e) => e.abort());
1326
+ x.current.forEach((e) => e.abort());
1326
1327
  }, []);
1327
1328
  let C = (t.accepts ?? []).join(","), w = o === "display", T = W(async (r) => {
1328
- let o = a(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1329
+ let o = i(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1329
1330
  if (o) {
1330
- u((e) => [...e, {
1331
+ d((e) => [...e, {
1331
1332
  localId: s,
1332
1333
  filename: r.name,
1333
1334
  progress: null,
@@ -1336,7 +1337,7 @@ function hn(e) {
1336
1337
  }]);
1337
1338
  return;
1338
1339
  }
1339
- u((e) => [...e, {
1340
+ d((e) => [...e, {
1340
1341
  localId: s,
1341
1342
  filename: r.name,
1342
1343
  progress: {
@@ -1353,17 +1354,17 @@ function hn(e) {
1353
1354
  entityCode: e.entityCode,
1354
1355
  fieldCode: n,
1355
1356
  signal: c.signal,
1356
- onProgress: (e) => u((t) => t.map((t) => t.localId === s ? {
1357
+ onProgress: (e) => d((t) => t.map((t) => t.localId === s ? {
1357
1358
  ...t,
1358
1359
  progress: e
1359
1360
  } : t))
1360
1361
  });
1361
- if (v.current.delete(s)) {
1362
- g(t.id).catch(() => {}), p(t.id);
1362
+ if (b.current.delete(s)) {
1363
+ f(t.id).catch(() => {}), m(t.id);
1363
1364
  return;
1364
1365
  }
1365
- d(t.id, () => g(t.id));
1366
- let a = {
1366
+ p(t.id, () => f(t.id));
1367
+ let i = {
1367
1368
  id: t.id,
1368
1369
  filename: t.filename,
1369
1370
  content_type: t.content_type,
@@ -1373,21 +1374,21 @@ function hn(e) {
1373
1374
  height: t.height,
1374
1375
  url: t.url,
1375
1376
  metadata: t.metadata
1376
- }, o = [...h.current, a];
1377
- h.current = o, i?.(o), u((e) => e.filter((e) => e.localId !== s));
1377
+ }, o = [..._.current, i];
1378
+ _.current = o, a?.(o), d((e) => e.filter((e) => e.localId !== s));
1378
1379
  } catch (e) {
1379
- if (e instanceof f && e.code === "ABORTED") {
1380
- u((e) => e.filter((e) => e.localId !== s));
1380
+ if (e instanceof l && e.code === "ABORTED") {
1381
+ d((e) => e.filter((e) => e.localId !== s));
1381
1382
  return;
1382
1383
  }
1383
- let t = e instanceof f ? {
1384
+ let t = e instanceof l ? {
1384
1385
  code: e.code,
1385
1386
  message: e.message
1386
1387
  } : {
1387
1388
  code: "UNKNOWN",
1388
1389
  message: e instanceof Error ? e.message : "Upload failed"
1389
1390
  };
1390
- u((e) => e.map((e) => e.localId === s ? {
1391
+ d((e) => e.map((e) => e.localId === s ? {
1391
1392
  ...e,
1392
1393
  error: t,
1393
1394
  progress: null,
@@ -1398,24 +1399,24 @@ function hn(e) {
1398
1399
  t.accepts,
1399
1400
  t.max_size_bytes,
1400
1401
  n,
1401
- i,
1402
+ a,
1402
1403
  e.entityCode,
1403
- d,
1404
- p
1404
+ p,
1405
+ m
1405
1406
  ]), E = W((e) => {
1406
1407
  Array.from(e).forEach((e) => void T(e));
1407
1408
  }, [T]), D = W(() => {
1408
- s || _.current?.click();
1409
+ s || y.current?.click();
1409
1410
  }, [s]), O = W((e) => {
1410
1411
  let t = e.target.files;
1411
1412
  e.target.value = "", t && t.length > 0 && E(t);
1412
1413
  }, [E]), k = W((e) => {
1413
- m(e) && (g(e).catch(() => {}), p(e)), i?.(c.filter((t) => t.id !== e));
1414
+ h(e) && (f(e).catch(() => {}), m(e)), a?.(c.filter((t) => t.id !== e));
1414
1415
  }, [
1415
- m,
1416
+ h,
1416
1417
  c,
1417
- i,
1418
- p
1418
+ a,
1419
+ m
1419
1420
  ]), A = W((e) => {
1420
1421
  S(e.id, "download", we(e));
1421
1422
  }, [S]);
@@ -1425,7 +1426,7 @@ function hn(e) {
1425
1426
  children: [/* @__PURE__ */ Z("ul", {
1426
1427
  className: "flex flex-col divide-y divide-divider rounded-md border border-border bg-surface",
1427
1428
  children: [
1428
- c.length === 0 && l.length === 0 && /* @__PURE__ */ X("li", {
1429
+ c.length === 0 && u.length === 0 && /* @__PURE__ */ X("li", {
1429
1430
  className: "px-3 py-4 text-center text-sm text-muted-foreground",
1430
1431
  children: t.display?.placeholder || "No files"
1431
1432
  }),
@@ -1446,7 +1447,7 @@ function hn(e) {
1446
1447
  }),
1447
1448
  /* @__PURE__ */ X("span", {
1448
1449
  className: "flex-none text-xs text-muted-foreground",
1449
- children: x(e.size_bytes)
1450
+ children: v(e.size_bytes)
1450
1451
  }),
1451
1452
  /* @__PURE__ */ X("button", {
1452
1453
  type: "button",
@@ -1465,7 +1466,7 @@ function hn(e) {
1465
1466
  })
1466
1467
  ]
1467
1468
  }, e.id)),
1468
- l.map((e) => /* @__PURE__ */ Z("li", {
1469
+ u.map((e) => /* @__PURE__ */ Z("li", {
1469
1470
  className: "flex items-center gap-3 px-3 py-2",
1470
1471
  "data-testid": `pending-row-${e.localId}`,
1471
1472
  "aria-busy": !e.error,
@@ -1493,7 +1494,7 @@ function hn(e) {
1493
1494
  type: "button",
1494
1495
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
1495
1496
  onClick: () => {
1496
- e.abort(), v.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1497
+ e.abort(), b.current.add(e.localId), d((t) => t.filter((t) => t.localId !== e.localId));
1497
1498
  },
1498
1499
  children: e.error ? "Dismiss" : "Cancel"
1499
1500
  })
@@ -1508,7 +1509,7 @@ function hn(e) {
1508
1509
  "data-testid": "add-files",
1509
1510
  children: "Add files"
1510
1511
  }), /* @__PURE__ */ X("input", {
1511
- ref: _,
1512
+ ref: y,
1512
1513
  type: "file",
1513
1514
  accept: C || void 0,
1514
1515
  multiple: !0,
@@ -1633,14 +1634,14 @@ function Dn(e, t, n) {
1633
1634
  let r = Cn(e, t);
1634
1635
  if (r) return r.name || t;
1635
1636
  let i = e.fields.get(t);
1636
- return i ? pe(i, t, n) : t;
1637
+ return i ? b(i, t, n) : t;
1637
1638
  }
1638
1639
  function On(e) {
1639
- 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 = Cn(t, r);
1640
- if (h) {
1641
- let e = h.display?.widget ?? "", t = Ut(e);
1640
+ 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, structure: h } = e, g = Cn(t, r);
1641
+ if (g) {
1642
+ let e = g.display?.widget ?? "", t = Ut(e);
1642
1643
  return t ? /* @__PURE__ */ X(t, {
1643
- field: h,
1644
+ field: g,
1644
1645
  fieldName: r,
1645
1646
  entityCode: n,
1646
1647
  value: wn(i, r),
@@ -1653,9 +1654,12 @@ function On(e) {
1653
1654
  children: e ? `Unknown file widget: ${e}` : "Missing file widget"
1654
1655
  });
1655
1656
  }
1656
- let g = t.fields.get(r);
1657
- return g ? B({
1658
- field: g,
1657
+ let _ = t.fields.get(r), v = h && a === "display" && _ ? {
1658
+ ..._,
1659
+ structure: h
1660
+ } : _;
1661
+ return v ? z({
1662
+ field: v,
1659
1663
  entityCode: n,
1660
1664
  fieldName: r,
1661
1665
  value: Tn(t, i, r),
@@ -1933,7 +1937,7 @@ function er(e) {
1933
1937
  //#region src/hooks/useChildrenData.ts
1934
1938
  var tr = "entity-children";
1935
1939
  function nr(e, t, n, r, i, a) {
1936
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? l(t, o.length) : [t];
1940
+ let s = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? o(t, s.length) : [t];
1937
1941
  return He({
1938
1942
  queryKey: [
1939
1943
  tr,
@@ -1945,15 +1949,15 @@ function nr(e, t, n, r, i, a) {
1945
1949
  ],
1946
1950
  queryFn: () => {
1947
1951
  let e = new URLSearchParams();
1948
- if (!s) throw Error("invalid composite parent id");
1949
- let t = o.map((e, t) => ({
1952
+ if (!l) throw Error("invalid composite parent id");
1953
+ let t = s.map((e, t) => ({
1950
1954
  field: e,
1951
1955
  op: "eq",
1952
- value: s[t]
1956
+ value: l[t]
1953
1957
  }));
1954
- return e.set("filters", JSON.stringify(t)), i && e.set("sort", i), a && e.set("limit", String(a)), d(`/api/data/${n}?${e.toString()}`);
1958
+ return e.set("filters", JSON.stringify(t)), i && e.set("sort", i), a && e.set("limit", String(a)), c(`/api/data/${n}?${e.toString()}`);
1955
1959
  },
1956
- enabled: !!e && !!t && !!n && !!r && s !== null
1960
+ enabled: !!e && !!t && !!n && !!r && l !== null
1957
1961
  });
1958
1962
  }
1959
1963
  //#endregion
@@ -1972,6 +1976,7 @@ function ir(e, t, n) {
1972
1976
  //#endregion
1973
1977
  //#region src/hooks/useAssociatedData.ts
1974
1978
  function ar(e, t, n, r, i, a, o, s) {
1979
+ let l = s ? JSON.stringify(Object.entries(s).sort()) : void 0;
1975
1980
  return Be({
1976
1981
  queryKey: [
1977
1982
  tr,
@@ -1981,20 +1986,20 @@ function ar(e, t, n, r, i, a, o, s) {
1981
1986
  i,
1982
1987
  a,
1983
1988
  o,
1984
- s ? JSON.stringify(Object.entries(s).sort()) : void 0
1989
+ l
1985
1990
  ],
1986
1991
  queryFn: ({ pageParam: e }) => {
1987
- let c = new URLSearchParams(), l = [{
1992
+ let l = new URLSearchParams(), u = [{
1988
1993
  field: r,
1989
1994
  op: "eq",
1990
1995
  value: t
1991
1996
  }];
1992
- if (s) for (let [e, t] of Object.entries(s)) t && t !== "__all__" && l.push({
1997
+ if (s) for (let [e, t] of Object.entries(s)) t && t !== "__all__" && u.push({
1993
1998
  field: e,
1994
1999
  op: "eq",
1995
2000
  value: t
1996
2001
  });
1997
- 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), d(`/api/data/${n}?${c.toString()}`);
2002
+ return l.set("filters", JSON.stringify(u)), i && l.set("sort", i), a && l.set("limit", String(a)), o && l.set("search", o), e && l.set("after", e), c(`/api/data/${n}?${l.toString()}`);
1998
2003
  },
1999
2004
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
2000
2005
  initialPageParam: void 0,
@@ -2003,26 +2008,26 @@ function ar(e, t, n, r, i, a, o, s) {
2003
2008
  }
2004
2009
  //#endregion
2005
2010
  //#region src/components/shared/ActionButton.tsx
2006
- function or({ actionCode: n, action: r, entityCode: a, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
2007
- let [f, p] = J(!1), [m, h] = J(!1), { data: g } = i(), _ = Bt(), { run: v } = te(), b = C(r), x = !c || P(r.conditions, c), S = W(async () => {
2008
- if (!(!r.association || s.length === 0)) {
2011
+ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
2012
+ let [f, p] = J(!1), [m, g] = J(!1), { data: _ } = r(), v = Bt(), { run: y } = te(), b = S(i), x = !c || N(i.conditions, c), w = W(async () => {
2013
+ if (!(!i.association || s.length === 0)) {
2009
2014
  p(!0);
2010
2015
  try {
2011
- let e = await fe(a ? `${a}.${r.association}` : r.association, s), t = o(g, e.target_entity);
2012
- if (!t) {
2013
- H.error(`No list screen found for ${e.target_entity}`);
2016
+ let e = o ? `${o}.${i.association}` : i.association, t = await pe(e, s), n = a(_, t.target_entity);
2017
+ if (!n) {
2018
+ H.error(`No list screen found for ${t.target_entity}`);
2014
2019
  return;
2015
2020
  }
2016
- let n = g?.entities[e.target_entity], i = U(r.display?.name) || e.target_entity;
2017
- if (e.ids.length === 0) {
2018
- H.info(`No related ${i} found`);
2021
+ let r = _?.entities[t.target_entity], c = C(i.display?.name) || t.target_entity;
2022
+ if (t.ids.length === 0) {
2023
+ H.info(`No related ${c} found`);
2019
2024
  return;
2020
2025
  }
2021
- let c = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
2022
- l.set(`filter_${c}`, e.ids.join(",")), _(t.route, {
2023
- title: i,
2024
- icon: r.display?.icon || t.icon,
2025
- search: l.toString()
2026
+ let l = r?.fields.names().find((e) => r.fields.get(e)?.primary) ?? "id", u = new URLSearchParams();
2027
+ u.set(`filter_${l}`, t.ids.join(",")), v(n.route, {
2028
+ title: c,
2029
+ icon: i.display?.icon || n.icon,
2030
+ search: u.toString()
2026
2031
  }), d?.();
2027
2032
  } catch (e) {
2028
2033
  H.error(e instanceof Error ? e.message : "Failed to resolve association");
@@ -2031,77 +2036,77 @@ function or({ actionCode: n, action: r, entityCode: a, objectIds: s = [], row: c
2031
2036
  }
2032
2037
  }
2033
2038
  }, [
2034
- r,
2035
- a,
2039
+ i,
2040
+ o,
2036
2041
  s,
2037
- g,
2038
2042
  _,
2043
+ v,
2039
2044
  d
2040
- ]), w = r.entity ? `${r.entity}.${n}` : n, T = s.length > 0 ? s : void 0, E = W(() => {
2041
- h(!0), v({
2042
- action: r,
2043
- title: U(r.display?.name) || n,
2045
+ ]), T = i.entity ? `${i.entity}.${n}` : n, E = s.length > 0 ? s : void 0, D = W(() => {
2046
+ g(!0), y({
2047
+ action: i,
2048
+ title: C(i.display?.name) || n,
2044
2049
  row: c,
2045
- entity: a,
2046
- execute: (e) => I(w, ee(e, T)),
2050
+ entity: o,
2051
+ execute: (e) => F(T, R(e, E)),
2047
2052
  onSuccess: () => d?.()
2048
- }).finally(() => h(!1));
2053
+ }).finally(() => g(!1));
2049
2054
  }, [
2050
- v,
2051
- r,
2055
+ y,
2056
+ i,
2052
2057
  n,
2053
2058
  c,
2054
- a,
2055
- w,
2059
+ o,
2056
2060
  T,
2061
+ E,
2057
2062
  d
2058
- ]), D = W(() => {
2059
- if (R(r)) {
2060
- le(r.ui_steps, { row: c }).then(() => d?.());
2063
+ ]), O = W(() => {
2064
+ if (L(i)) {
2065
+ le(i.ui_steps, { row: c }).then(() => d?.());
2061
2066
  return;
2062
2067
  }
2063
2068
  if (b) {
2064
- S();
2069
+ w();
2065
2070
  return;
2066
2071
  }
2067
- if (r.href && !r.handler && !r.association) {
2068
- let e = y(c, a ? g?.entities[a] : void 0), t = r.href;
2069
- a && (t = t.replaceAll("${entity}", a)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), _(t, {
2070
- title: U(r.display?.name) || n,
2071
- icon: r.display?.icon
2072
+ if (i.href && !i.handler && !i.association) {
2073
+ let e = o ? _?.entities[o] : void 0, t = h(c, e), r = i.href;
2074
+ o && (r = r.replaceAll("${entity}", o)), t && (r = r.replaceAll("${id}", encodeURIComponent(t))), v(r, {
2075
+ title: C(i.display?.name) || n,
2076
+ icon: i.display?.icon
2072
2077
  }), d?.();
2073
2078
  return;
2074
2079
  }
2075
- E();
2080
+ D();
2076
2081
  }, [
2077
- r,
2082
+ i,
2078
2083
  c,
2079
- a,
2080
- g?.entities,
2084
+ o,
2085
+ _?.entities,
2081
2086
  n,
2082
- _,
2087
+ v,
2083
2088
  b,
2084
- S,
2085
- E,
2089
+ w,
2090
+ D,
2086
2091
  d
2087
- ]), O = U(r.display?.name), k = r.display?.icon, A = k && e[k], j = A ? /* @__PURE__ */ X(A, { size: 13 }) : k ? /* @__PURE__ */ X(t, {
2088
- name: k,
2092
+ ]), k = C(i.display?.name), A = i.display?.icon, j = A && e[A], M = j ? /* @__PURE__ */ X(j, { size: 13 }) : A ? /* @__PURE__ */ X(t, {
2093
+ name: A,
2089
2094
  size: 13
2090
- }) : null, M = !x || m || f;
2091
- return u === "icon" ? /* @__PURE__ */ X(L, {
2092
- icon: j ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
2093
- onClick: D,
2094
- title: O
2095
- }) : /* @__PURE__ */ X(V, {
2095
+ }) : null, P = !x || m || f;
2096
+ return u === "icon" ? /* @__PURE__ */ X(B, {
2097
+ icon: M ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
2098
+ onClick: O,
2099
+ title: k
2100
+ }) : /* @__PURE__ */ X(U, {
2096
2101
  kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
2097
2102
  size: "sm",
2098
- icon: j,
2099
- danger: r.destructive,
2100
- onClick: D,
2101
- disabled: M,
2102
- title: O,
2103
- "aria-label": O,
2104
- children: O
2103
+ icon: M,
2104
+ danger: i.destructive,
2105
+ onClick: O,
2106
+ disabled: P,
2107
+ title: k,
2108
+ "aria-label": k,
2109
+ children: k
2105
2110
  });
2106
2111
  }
2107
2112
  //#endregion
@@ -2113,7 +2118,7 @@ function cr(e) {
2113
2118
  return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
2114
2119
  }
2115
2120
  function lr(e, t, n, r, i) {
2116
- let a = cr(t), o = y(n, r?.entity), s = r?.entityCode ?? "";
2121
+ let a = cr(t), o = h(n, r?.entity), s = r?.entityCode ?? "";
2117
2122
  if (e === "__peek") return i?.({
2118
2123
  code: e,
2119
2124
  entity: s,
@@ -2181,7 +2186,8 @@ function pr(e, t, n) {
2181
2186
  if (n && e in n) return n[e];
2182
2187
  }
2183
2188
  function mr(e, t, n) {
2184
- return U(pr(e, t, n)?.display?.name) || e;
2189
+ let r = pr(e, t, n);
2190
+ return C(r?.display?.name) || e;
2185
2191
  }
2186
2192
  function hr(e, t, n) {
2187
2193
  return pr(e, t, n)?.display?.icon || void 0;
@@ -2209,7 +2215,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2209
2215
  l,
2210
2216
  u,
2211
2217
  d
2212
- ]), b = a ? /* @__PURE__ */ X(k, { size: 12 }) : m ? /* @__PURE__ */ X(t, {
2218
+ ]), b = a ? /* @__PURE__ */ X(A, { size: 12 }) : m ? /* @__PURE__ */ X(t, {
2213
2219
  name: m,
2214
2220
  size: 12
2215
2221
  }) : null;
@@ -2224,7 +2230,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2224
2230
  clip: "rect(0,0,0,0)"
2225
2231
  },
2226
2232
  children: e.reason
2227
- }), /* @__PURE__ */ X(V, {
2233
+ }), /* @__PURE__ */ X(U, {
2228
2234
  ref: s,
2229
2235
  kind: g ? "primary" : "default",
2230
2236
  danger: h,
@@ -2232,23 +2238,23 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2232
2238
  disabled: _ || a,
2233
2239
  "aria-disabled": _ ? "true" : void 0,
2234
2240
  "aria-describedby": v,
2235
- title: z(f, p, _, e.reason),
2241
+ title: ee(f, p, _, e.reason),
2236
2242
  onClick: y,
2237
2243
  style: c,
2238
2244
  children: p
2239
2245
  })] });
2240
2246
  }
2241
2247
  function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: l, row: u, widgetContext: d, onActionClick: f }) {
2242
- let p = q(null), [m, h] = J(!1), g = n.name ? U(n.name) : "Actions", _ = W((e) => {
2248
+ let p = q(null), [m, h] = J(!1), g = n.name ? C(n.name) : "Actions", _ = W((e) => {
2243
2249
  p.current = e, c?.(e);
2244
2250
  }, [c]), v = W((e, t) => (h(!1), a(e, t)), [a]);
2245
- return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
2251
+ return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(U, {
2246
2252
  ref: _,
2247
2253
  kind: "default",
2248
2254
  icon: o == null ? n.icon ? /* @__PURE__ */ X(t, {
2249
2255
  name: n.icon,
2250
2256
  size: 12
2251
- }) : void 0 : /* @__PURE__ */ X(k, { size: 12 }),
2257
+ }) : void 0 : /* @__PURE__ */ X(A, { size: 12 }),
2252
2258
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2253
2259
  "aria-haspopup": "menu",
2254
2260
  "aria-expanded": m ? "true" : "false",
@@ -2256,7 +2262,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
2256
2262
  onClick: () => h((e) => !e),
2257
2263
  style: l,
2258
2264
  children: g
2259
- }), /* @__PURE__ */ X(N, {
2265
+ }), /* @__PURE__ */ X(V, {
2260
2266
  open: m,
2261
2267
  anchor: p.current,
2262
2268
  onClose: () => h(!1),
@@ -2290,7 +2296,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
2290
2296
  })] });
2291
2297
  }
2292
2298
  function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
2293
- let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(k, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
2299
+ let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(A, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
2294
2300
  name: f,
2295
2301
  size: 12
2296
2302
  }) : null;
@@ -2309,7 +2315,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2309
2315
  role: "menuitem",
2310
2316
  "aria-disabled": m ? "true" : void 0,
2311
2317
  "aria-describedby": h,
2312
- title: z(u, d, m, e.reason),
2318
+ title: ee(u, d, m, e.reason),
2313
2319
  onClick: async () => {
2314
2320
  if (!(!u || m || a)) {
2315
2321
  o(!0);
@@ -2350,7 +2356,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2350
2356
  })] });
2351
2357
  }
2352
2358
  function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
2353
- let l = e.name ? U(e.name) : void 0;
2359
+ let l = e.name ? C(e.name) : void 0;
2354
2360
  return /* @__PURE__ */ Z(Y, { children: [l && /* @__PURE__ */ X("div", {
2355
2361
  style: {
2356
2362
  padding: "4px 10px 2px",
@@ -2390,13 +2396,13 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
2390
2396
  display: "inline-flex",
2391
2397
  alignItems: "center"
2392
2398
  },
2393
- children: [/* @__PURE__ */ X(L, {
2399
+ children: [/* @__PURE__ */ X(B, {
2394
2400
  ref: c,
2395
- icon: X(d == null ? e.more : k, { size: 14 }),
2401
+ icon: X(d == null ? e.more : A, { size: 14 }),
2396
2402
  title: "Actions",
2397
2403
  size: 28,
2398
2404
  onClick: () => u((e) => !e)
2399
- }), /* @__PURE__ */ X(N, {
2405
+ }), /* @__PURE__ */ X(V, {
2400
2406
  open: l,
2401
2407
  anchor: c.current,
2402
2408
  onClose: () => u(!1),
@@ -2418,12 +2424,12 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
2418
2424
  }
2419
2425
  function Sr(e) {
2420
2426
  let t = 0;
2421
- for (let n of e) if (n.kind === "action" && c(n.code)) t++;
2427
+ for (let n of e) if (n.kind === "action" && s(n.code)) t++;
2422
2428
  else break;
2423
2429
  return t;
2424
2430
  }
2425
2431
  function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c, ariaLabel: l = "Row actions" }) {
2426
- let { normal: u, destructive: d } = dr(e, t, n), f = Sr(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, _ = (e) => /* @__PURE__ */ X(yr, {
2432
+ let { normal: u, destructive: d } = dr(e, t, n), f = Sr(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, v = (e) => /* @__PURE__ */ X(yr, {
2427
2433
  leaf: e,
2428
2434
  entityActions: t,
2429
2435
  globalActions: n,
@@ -2438,9 +2444,9 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
2438
2444
  role: "menu",
2439
2445
  "aria-label": l,
2440
2446
  children: [
2441
- p.map((e) => e.kind === "action" ? _(e) : null),
2442
- p.length > 0 && g && /* @__PURE__ */ X(A, { divider: !0 }),
2443
- m.map((e) => e.kind === "action" ? _(e) : /* @__PURE__ */ X(br, {
2447
+ p.map((e) => e.kind === "action" ? v(e) : null),
2448
+ p.length > 0 && g && /* @__PURE__ */ X(_, { divider: !0 }),
2449
+ m.map((e) => e.kind === "action" ? v(e) : /* @__PURE__ */ X(br, {
2444
2450
  group: e,
2445
2451
  entityActions: t,
2446
2452
  globalActions: n,
@@ -2451,8 +2457,8 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
2451
2457
  widgetContext: s,
2452
2458
  onActionClick: c
2453
2459
  }, e.icon ?? "group")),
2454
- h && /* @__PURE__ */ X(A, { divider: !0 }),
2455
- d.map((e) => _(e))
2460
+ h && /* @__PURE__ */ X(_, { divider: !0 }),
2461
+ d.map((e) => v(e))
2456
2462
  ]
2457
2463
  });
2458
2464
  }
@@ -2479,66 +2485,66 @@ function Or(e, t, n, r, i, a, o, s) {
2479
2485
  };
2480
2486
  }
2481
2487
  function Q(e) {
2482
- return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? U(e.name) : ""}`;
2488
+ return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? C(e.name) : ""}`;
2483
2489
  }
2484
2490
  function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", align: l = "trailing", constrain: u = !0, row: d, widgetContext: f, onActionClick: p }) {
2485
- let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [S, C] = J(null), [w, T] = J(() => typeof document < "u" && document.documentElement.dir === "rtl");
2491
+ let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [S, w] = J(null), [T, E] = J(() => typeof document < "u" && document.documentElement.dir === "rtl");
2486
2492
  G(() => {
2487
2493
  if (typeof MutationObserver > "u") return;
2488
2494
  let e = new MutationObserver((e) => {
2489
- for (let t of e) t.attributeName === "dir" && T(document.documentElement.dir === "rtl"), t.attributeName === "lang" && x(!1);
2495
+ for (let t of e) t.attributeName === "dir" && E(document.documentElement.dir === "rtl"), t.attributeName === "lang" && x(!1);
2490
2496
  });
2491
2497
  return e.observe(document.documentElement, {
2492
2498
  attributes: !0,
2493
2499
  attributeFilter: ["dir", "lang"]
2494
2500
  }), () => e.disconnect();
2495
2501
  }, []);
2496
- let E = q(null), [D, O] = J(!1), k = W((e, t) => (O(!1), a(e, t)), [a]), A = ur(n), j = !!s, M = W(() => {
2497
- if (j || !h.current) return;
2502
+ let D = q(null), [O, k] = J(!1), A = W((e, t) => (k(!1), a(e, t)), [a]), j = ur(n), M = !!s, N = W(() => {
2503
+ if (M || !h.current) return;
2498
2504
  let e = Array.from(h.current.children), t = /* @__PURE__ */ new Map();
2499
2505
  e.forEach((e) => {
2500
2506
  let n = e.dataset.nodeKey;
2501
2507
  n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
2502
2508
  }), y(t), x(!0);
2503
- }, [j]), P = K(() => JSON.stringify(n.map((e) => Q(e))), [n]);
2509
+ }, [M]), P = K(() => JSON.stringify(n.map((e) => Q(e))), [n]);
2504
2510
  Le(() => {
2505
- if (j) {
2511
+ if (M) {
2506
2512
  x(!0);
2507
2513
  return;
2508
2514
  }
2509
2515
  x(!1);
2510
2516
  let e = requestAnimationFrame(() => {
2511
- M();
2517
+ N();
2512
2518
  });
2513
2519
  return () => cancelAnimationFrame(e);
2514
2520
  }, [
2515
2521
  P,
2516
- M,
2517
- j
2522
+ N,
2523
+ M
2518
2524
  ]), G(() => {
2519
- if (j || b) return;
2525
+ if (M || b) return;
2520
2526
  let e = setTimeout(() => {
2521
- M(), x(!0);
2527
+ N(), x(!0);
2522
2528
  }, 16);
2523
2529
  return () => clearTimeout(e);
2524
2530
  }, [
2525
2531
  b,
2526
- M,
2527
- j
2532
+ N,
2533
+ M
2528
2534
  ]), G(() => {
2529
- if (j || !u || !b || g === 0) return;
2535
+ if (M || !u || !b || g === 0) return;
2530
2536
  let e = m.current;
2531
2537
  if (!e) return;
2532
2538
  let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
2533
2539
  r > 0 && Math.abs(g - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(g)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
2534
2540
  }, [
2535
- j,
2541
+ M,
2536
2542
  u,
2537
2543
  b,
2538
2544
  g,
2539
2545
  v
2540
2546
  ]), G(() => {
2541
- if (j) return;
2547
+ if (M) return;
2542
2548
  let e = m.current;
2543
2549
  if (!e) return;
2544
2550
  if (typeof ResizeObserver > "u") {
@@ -2550,18 +2556,18 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2550
2556
  t && _(t.contentRect.width);
2551
2557
  });
2552
2558
  return t.observe(e), _(e.getBoundingClientRect().width), () => t.disconnect();
2553
- }, [j]);
2559
+ }, [M]);
2554
2560
  let F = q(void 0);
2555
2561
  G(() => {
2556
2562
  F.current = void 0;
2557
2563
  }, [P]);
2558
- let I = K(() => j || !u ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : b ? g === 0 ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : Or(n, g, o, v, r, i, s, F.current) : {
2564
+ let I = K(() => M || !u ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : b ? g === 0 ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : Or(n, g, o, v, r, i, s, F.current) : {
2559
2565
  primaryInline: [],
2560
2566
  inline: [],
2561
2567
  overflow: [],
2562
2568
  destructiveInline: []
2563
2569
  }, [
2564
- j,
2570
+ M,
2565
2571
  u,
2566
2572
  b,
2567
2573
  g,
@@ -2574,7 +2580,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2574
2580
  ]);
2575
2581
  if (G(() => {
2576
2582
  F.current = new Set([...I.inline, ...I.primaryInline].map(Q));
2577
- }, [I]), A === 0) return null;
2583
+ }, [I]), j === 0) return null;
2578
2584
  let L = I.overflow.length > 0;
2579
2585
  return /* @__PURE__ */ Z("div", {
2580
2586
  ref: m,
@@ -2582,10 +2588,10 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2582
2588
  "aria-label": c,
2583
2589
  style: {
2584
2590
  display: "flex",
2585
- flexDirection: w ? "row-reverse" : "row",
2591
+ flexDirection: T ? "row-reverse" : "row",
2586
2592
  alignItems: "center",
2587
2593
  gap: 4,
2588
- visibility: b || j ? "visible" : "hidden",
2594
+ visibility: b || M ? "visible" : "hidden",
2589
2595
  position: "relative",
2590
2596
  flex: u ? "1 1 auto" : "0 1 auto",
2591
2597
  justifyContent: l === "trailing" ? "flex-end" : "flex-start",
@@ -2605,7 +2611,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2605
2611
  top: 0,
2606
2612
  left: 0
2607
2613
  },
2608
- children: [/* @__PURE__ */ X(V, {
2614
+ children: [/* @__PURE__ */ X(U, {
2609
2615
  "data-node-key": wr,
2610
2616
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2611
2617
  tabIndex: -1,
@@ -2614,7 +2620,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2614
2620
  let a = Q(n);
2615
2621
  if (n.kind === "action") {
2616
2622
  let e = pr(n.code, r, i), o = mr(n.code, r, i), s = hr(n.code, r, i);
2617
- return /* @__PURE__ */ X(V, {
2623
+ return /* @__PURE__ */ X(U, {
2618
2624
  "data-node-key": a,
2619
2625
  icon: s ? /* @__PURE__ */ X(t, {
2620
2626
  name: s,
@@ -2624,9 +2630,10 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2624
2630
  tabIndex: -1,
2625
2631
  children: o
2626
2632
  }, a);
2627
- } else {
2628
- let t = n.name ? U(n.name) : "Actions";
2629
- return /* @__PURE__ */ X(V, {
2633
+ }
2634
+ {
2635
+ let t = n.name ? C(n.name) : "Actions";
2636
+ return /* @__PURE__ */ X(U, {
2630
2637
  "data-node-key": a,
2631
2638
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2632
2639
  tabIndex: -1,
@@ -2641,7 +2648,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2641
2648
  globalActions: i,
2642
2649
  onRun: a,
2643
2650
  loading: S === e.code,
2644
- onLoadingChange: (t) => C(t ? e.code : null),
2651
+ onLoadingChange: (t) => w(t ? e.code : null),
2645
2652
  row: d,
2646
2653
  widgetContext: f,
2647
2654
  onActionClick: p
@@ -2654,7 +2661,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2654
2661
  globalActions: i,
2655
2662
  onRun: a,
2656
2663
  loading: S === e.code,
2657
- onLoadingChange: (t) => C(t ? e.code : null),
2664
+ onLoadingChange: (t) => w(t ? e.code : null),
2658
2665
  row: d,
2659
2666
  widgetContext: f,
2660
2667
  onActionClick: p
@@ -2664,25 +2671,25 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2664
2671
  globalActions: i,
2665
2672
  onRun: a,
2666
2673
  loading: S,
2667
- onLoadingChange: C,
2674
+ onLoadingChange: w,
2668
2675
  row: d,
2669
2676
  widgetContext: f,
2670
2677
  onActionClick: p
2671
2678
  }, t);
2672
2679
  }),
2673
- L && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
2674
- ref: E,
2680
+ L && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(U, {
2681
+ ref: D,
2675
2682
  kind: "default",
2676
2683
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2677
2684
  "aria-haspopup": "menu",
2678
- "aria-expanded": D ? "true" : "false",
2679
- onClick: () => O((e) => !e),
2685
+ "aria-expanded": O ? "true" : "false",
2686
+ onClick: () => k((e) => !e),
2680
2687
  children: "Actions"
2681
- }), /* @__PURE__ */ X(N, {
2682
- open: D,
2683
- anchor: E.current,
2684
- onClose: () => O(!1),
2685
- align: w ? "start" : "end",
2688
+ }), /* @__PURE__ */ X(V, {
2689
+ open: O,
2690
+ anchor: D.current,
2691
+ onClose: () => k(!1),
2692
+ align: T ? "start" : "end",
2686
2693
  width: 220,
2687
2694
  children: /* @__PURE__ */ X("div", {
2688
2695
  role: "menu",
@@ -2691,9 +2698,9 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2691
2698
  leaf: e,
2692
2699
  entityActions: r,
2693
2700
  globalActions: i,
2694
- onRun: k,
2701
+ onRun: A,
2695
2702
  loading: S === e.code,
2696
- onLoadingChange: (t) => C(t ? e.code : null),
2703
+ onLoadingChange: (t) => w(t ? e.code : null),
2697
2704
  row: d,
2698
2705
  widgetContext: f,
2699
2706
  onActionClick: p
@@ -2701,9 +2708,9 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2701
2708
  group: e,
2702
2709
  entityActions: r,
2703
2710
  globalActions: i,
2704
- onRun: k,
2711
+ onRun: A,
2705
2712
  loading: S,
2706
- onLoadingChange: C,
2713
+ onLoadingChange: w,
2707
2714
  row: d,
2708
2715
  widgetContext: f,
2709
2716
  onActionClick: p
@@ -2716,7 +2723,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2716
2723
  globalActions: i,
2717
2724
  onRun: a,
2718
2725
  loading: S === e.code,
2719
- onLoadingChange: (t) => C(t ? e.code : null),
2726
+ onLoadingChange: (t) => w(t ? e.code : null),
2720
2727
  row: d,
2721
2728
  widgetContext: f,
2722
2729
  onActionClick: p
@@ -2787,71 +2794,230 @@ function jr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
2787
2794
  });
2788
2795
  }
2789
2796
  //#endregion
2797
+ //#region src/lib/filter-evaluator.ts
2798
+ var Mr = /* @__PURE__ */ new Set([
2799
+ "string",
2800
+ "text",
2801
+ "rich_text",
2802
+ "email",
2803
+ "url",
2804
+ "phone"
2805
+ ]), Nr = /* @__PURE__ */ new Set([
2806
+ "int",
2807
+ "float",
2808
+ "decimal"
2809
+ ]), Pr = /* @__PURE__ */ new Set([
2810
+ "date",
2811
+ "timestamp",
2812
+ "time"
2813
+ ]), Fr = /^(?:eq|not_eq|contains|starts_with|is_empty|is_not_empty)$/, Ir = /^(?:eq|not_eq|in|not_in|is_empty|is_not_empty)$/, Lr = /^(?:eq|not_eq|gt|gte|lt|lte|between|is_empty|is_not_empty)$/, Rr = {
2814
+ string: Fr,
2815
+ text: Fr,
2816
+ rich_text: Fr,
2817
+ email: Fr,
2818
+ url: Fr,
2819
+ phone: Fr,
2820
+ enum: Ir,
2821
+ int: Lr,
2822
+ float: Lr,
2823
+ decimal: Lr,
2824
+ date: Lr,
2825
+ timestamp: Lr,
2826
+ time: Lr,
2827
+ bool: /^(?:eq|is_empty)$/,
2828
+ ref: /^(?:eq|not_eq|is_empty|is_not_empty)$/,
2829
+ uuid: /^(?:eq|not_eq|is_empty|is_not_empty)$/
2830
+ };
2831
+ function zr(e, t, n) {
2832
+ return e.every((e) => Br(e, t, n));
2833
+ }
2834
+ function Br(e, t, n) {
2835
+ if (e.and) return e.and.every((e) => Br(e, t, n));
2836
+ if (e.or) return e.or.some((e) => Br(e, t, n));
2837
+ if (!e.field || !e.op) return !1;
2838
+ let r = t[e.field];
2839
+ return !r || !Rr[r.type]?.test(e.op) ? !1 : Vr(e, r.type, n[e.field]);
2840
+ }
2841
+ function Vr(e, t, n) {
2842
+ let r = Hr(n);
2843
+ if (e.op === "is_empty") return r;
2844
+ if (e.op === "is_not_empty") return !r;
2845
+ if (r) return !1;
2846
+ let i = e.value;
2847
+ switch (e.op) {
2848
+ case "eq": return Ur(t, n, i);
2849
+ case "not_eq": return !Ur(t, n, i) && Wr(t, n, i);
2850
+ case "in": return Array.isArray(i) && i.some((e) => Ur(t, n, e));
2851
+ case "not_in": return Array.isArray(i) && i.every((e) => Wr(t, n, e) && !Ur(t, n, e));
2852
+ case "contains": return typeof n == "string" && typeof i == "string" && n.toLowerCase().includes(i.toLowerCase());
2853
+ case "starts_with": return typeof n == "string" && typeof i == "string" && n.toLowerCase().startsWith(i.toLowerCase());
2854
+ case "gt": return Gr(t, n, i, (e, t) => e > t);
2855
+ case "gte": return Gr(t, n, i, (e, t) => e >= t);
2856
+ case "lt": return Gr(t, n, i, (e, t) => e < t);
2857
+ case "lte": return Gr(t, n, i, (e, t) => e <= t);
2858
+ case "between": {
2859
+ if (!Array.isArray(i) || i.length !== 2) return !1;
2860
+ let e = Kr(t, n, i[0]), r = Kr(t, n, i[1]);
2861
+ return e === void 0 || r === void 0 ? !1 : e >= 0 && r <= 0;
2862
+ }
2863
+ default: return !1;
2864
+ }
2865
+ }
2866
+ function Hr(e) {
2867
+ return e == null || e === "" || Array.isArray(e) && e.length === 0;
2868
+ }
2869
+ function Ur(e, t, n) {
2870
+ return Wr(e, t, n) ? Pr.has(e) ? Kr(e, t, n) === 0 : t === n : !1;
2871
+ }
2872
+ function Wr(e, t, n) {
2873
+ return Kr(e, t, n) !== void 0;
2874
+ }
2875
+ function Gr(e, t, n, r) {
2876
+ let i = Kr(e, t, n);
2877
+ return i !== void 0 && r(i, 0);
2878
+ }
2879
+ function Kr(e, t, n) {
2880
+ if (Nr.has(e)) return typeof t != "number" || typeof n != "number" || !Number.isFinite(t) || !Number.isFinite(n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
2881
+ if (Pr.has(e)) return typeof t != "string" || typeof n != "string" || !qr(e, t) || !qr(e, n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
2882
+ if (Mr.has(e) || e === "enum" || e === "ref" || e === "uuid") return typeof t != "string" || typeof n != "string" ? void 0 : t === n ? 0 : t < n ? -1 : 1;
2883
+ if (e === "bool") return typeof t != "boolean" || typeof n != "boolean" ? void 0 : t === n ? 0 : t ? 1 : -1;
2884
+ }
2885
+ function qr(e, t) {
2886
+ switch (e) {
2887
+ case "date": return /^\d{4}-\d{2}-\d{2}$/.test(t);
2888
+ case "time": return /^\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t);
2889
+ case "timestamp": return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t);
2890
+ default: return !1;
2891
+ }
2892
+ }
2893
+ //#endregion
2894
+ //#region src/lib/variants.ts
2895
+ function Jr(e, t) {
2896
+ let n = e.variants;
2897
+ if (!n || n.length === 0) return;
2898
+ let r = {};
2899
+ for (let [t, n] of e.fields) r[t] = n;
2900
+ for (let [e, i] of n) if (e !== "default" && i.when && zr(i.when, r, t)) return e;
2901
+ return n.has("default") ? "default" : void 0;
2902
+ }
2903
+ function Yr(e, t) {
2904
+ let n = e?.variants;
2905
+ if (!n || !n.items().some((e) => e.actions !== void 0)) return;
2906
+ let r = Jr(e, t), i = n.get("default"), a = (r ? n.get(r)?.actions : void 0) ?? i?.actions ?? [];
2907
+ return new Set(a);
2908
+ }
2909
+ function Xr(e, t) {
2910
+ if (t.length === 0) return;
2911
+ let n = t.map((t) => Yr(e, t));
2912
+ if (n.every((e) => e === void 0)) return;
2913
+ let r = n[0] ?? /* @__PURE__ */ new Set(), i = new Set(r);
2914
+ for (let e of n.slice(1)) {
2915
+ if (!e) {
2916
+ i.clear();
2917
+ break;
2918
+ }
2919
+ for (let t of i) e.has(t) || i.delete(t);
2920
+ }
2921
+ return i;
2922
+ }
2923
+ function Zr(e, t, n) {
2924
+ if (!t.variants || t.variants.length === 0) return;
2925
+ if (e.variants) {
2926
+ let r = Jr(e, n) ?? "default";
2927
+ return t.variants.has(r) ? r : "default";
2928
+ }
2929
+ let r = {};
2930
+ for (let [t, n] of e.fields) r[t] = n;
2931
+ for (let [e, i] of t.variants) if (e !== "default" && i.when && zr(i.when, r, n)) return e;
2932
+ return "default";
2933
+ }
2934
+ var Qr = [
2935
+ "items",
2936
+ "sidebar",
2937
+ "sidebar_width",
2938
+ "highlights",
2939
+ "audit",
2940
+ "actions",
2941
+ "row_actions",
2942
+ "action_layout",
2943
+ "card",
2944
+ "quick_peek"
2945
+ ];
2946
+ function $r(e, t, n) {
2947
+ if (!e || !t?.variants) return t;
2948
+ let r = Zr(e, t, n), i = r ? t.variants.get(r) : void 0;
2949
+ if (!i) return t;
2950
+ let a = { ...t };
2951
+ for (let e of Qr) i[e] !== void 0 && (a[e] = i[e]);
2952
+ return a;
2953
+ }
2954
+ //#endregion
2790
2955
  //#region src/components/shared/RowActionsKebab.tsx
2791
- function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: o, size: s = 22, align: c = "end" }) {
2792
- let l = q(null), [u, d] = J(!1), [f, p] = J(null), { run: m } = te(), h = K(() => {
2956
+ function ei({ actions: t, objectIds: n, row: r, entity: i, onSuccess: a, preMenu: o, divider: s, size: c = 22, align: l = "end" }) {
2957
+ let u = q(null), [d, f] = J(!1), [p, m] = J(null), { run: h } = te(), g = K(() => {
2793
2958
  let e = {};
2794
2959
  for (let { code: n, action: r } of t) e[n] = r;
2795
2960
  return e;
2796
- }, [t]), g = K(() => {
2961
+ }, [t]), v = K(() => {
2797
2962
  let e = t.map(({ code: e }) => ({
2798
2963
  kind: "action",
2799
2964
  code: e,
2800
2965
  enabled: !0,
2801
2966
  reason: null
2802
2967
  }));
2803
- return r ? j(e, h, void 0, r, []) : e;
2968
+ return r ? j(e, g, void 0, r, [], Yr(i, r)) : e;
2804
2969
  }, [
2805
2970
  t,
2806
- h,
2807
- r
2808
- ]), _ = W((e, t) => {
2809
- d(!1);
2810
- let a = t.entity ? `${t.entity}.${e}` : e;
2811
- return m({
2971
+ g,
2972
+ r,
2973
+ i
2974
+ ]), y = W((e, t) => {
2975
+ f(!1);
2976
+ let i = t.entity ? `${t.entity}.${e}` : e;
2977
+ return h({
2812
2978
  action: t,
2813
- title: U(t.display?.name) || e,
2979
+ title: C(t.display?.name) || e,
2814
2980
  row: r,
2815
2981
  execute: async (e) => {
2816
- let t = await I(a, ee(e, n));
2817
- return i?.(), t;
2982
+ let t = await F(i, R(e, n));
2983
+ return a?.(), t;
2818
2984
  }
2819
2985
  });
2820
2986
  }, [
2821
- m,
2987
+ h,
2822
2988
  r,
2823
2989
  n,
2824
- i
2990
+ a
2825
2991
  ]);
2826
- return !a && g.length === 0 ? null : /* @__PURE__ */ Z("div", {
2992
+ return !o && v.length === 0 ? null : /* @__PURE__ */ Z("div", {
2827
2993
  className: "sl-row-actions",
2828
- "data-open": u ? "true" : void 0,
2994
+ "data-open": d ? "true" : void 0,
2829
2995
  style: {
2830
2996
  display: "flex",
2831
2997
  alignItems: "center",
2832
2998
  justifyContent: "flex-end"
2833
2999
  },
2834
- children: [/* @__PURE__ */ X(L, {
2835
- ref: l,
2836
- size: s,
2837
- icon: /* @__PURE__ */ X(e.more, { size: Math.round(s * .55) }),
2838
- onClick: () => d((e) => !e),
3000
+ children: [/* @__PURE__ */ X(B, {
3001
+ ref: u,
3002
+ size: c,
3003
+ icon: /* @__PURE__ */ X(e.more, { size: Math.round(c * .55) }),
3004
+ onClick: () => f((e) => !e),
2839
3005
  title: "Actions"
2840
- }), /* @__PURE__ */ Z(N, {
2841
- open: u,
2842
- anchor: l.current,
2843
- onClose: () => d(!1),
3006
+ }), /* @__PURE__ */ Z(V, {
3007
+ open: d,
3008
+ anchor: u.current,
3009
+ onClose: () => f(!1),
2844
3010
  width: 200,
2845
- align: c,
3011
+ align: l,
2846
3012
  children: [
2847
- a,
2848
- a && o && g.length > 0 && /* @__PURE__ */ X(A, { divider: !0 }),
3013
+ o,
3014
+ o && s && v.length > 0 && /* @__PURE__ */ X(_, { divider: !0 }),
2849
3015
  /* @__PURE__ */ X(Cr, {
2850
- layout: g,
2851
- entityActions: h,
2852
- onRun: _,
2853
- loading: f,
2854
- onLoadingChange: p,
3016
+ layout: v,
3017
+ entityActions: g,
3018
+ onRun: y,
3019
+ loading: p,
3020
+ onLoadingChange: m,
2855
3021
  row: r
2856
3022
  })
2857
3023
  ]
@@ -2860,9 +3026,9 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2860
3026
  }
2861
3027
  //#endregion
2862
3028
  //#region src/components/detail-layout/AssociatedToolbar.tsx
2863
- function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
2864
- let l = n === !0, d = r && r.length > 0;
2865
- return !l && !d ? null : /* @__PURE__ */ Z("div", {
3029
+ function ti({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
3030
+ let l = n === !0, u = r && r.length > 0;
3031
+ return !l && !u ? null : /* @__PURE__ */ Z("div", {
2866
3032
  style: {
2867
3033
  display: "flex",
2868
3034
  alignItems: "center",
@@ -2874,41 +3040,44 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
2874
3040
  flex: 1,
2875
3041
  maxWidth: 220
2876
3042
  },
2877
- children: /* @__PURE__ */ X(m, {
3043
+ children: /* @__PURE__ */ X(k, {
2878
3044
  value: i,
2879
3045
  onChange: a,
2880
3046
  placeholder: "Search…",
2881
3047
  prefix: /* @__PURE__ */ X(e.search, { size: 12 })
2882
3048
  })
2883
- }), d && r.map((e) => {
3049
+ }), u && r.map((e) => {
2884
3050
  let n = t.fields.get(e);
2885
3051
  if (!n) return null;
2886
- let r = o[e] ?? "__all__", i = pe(n, e, c);
2887
- return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ X(Pr, {
3052
+ let r = o[e] ?? "__all__", i = b(n, e, c);
3053
+ if (n.type === "ref" && n.ref?.entity) return /* @__PURE__ */ X(ni, {
2888
3054
  field: n,
2889
3055
  label: i,
2890
3056
  value: r,
2891
3057
  onChange: (t) => s(e, t)
2892
- }, e) : n.values ? /* @__PURE__ */ X("div", {
3058
+ }, e);
3059
+ if (!n.values) return null;
3060
+ let a = [{
3061
+ value: "__all__",
3062
+ label: `All ${i}`
3063
+ }, ...n.values.map((e) => ({
3064
+ value: e.code,
3065
+ label: C(e.name) || e.code
3066
+ }))];
3067
+ return /* @__PURE__ */ X("div", {
2893
3068
  style: { width: 160 },
2894
- children: /* @__PURE__ */ X(u, {
3069
+ children: /* @__PURE__ */ X(d, {
2895
3070
  value: r,
2896
- options: [{
2897
- value: "__all__",
2898
- label: `All ${i}`
2899
- }, ...n.values.map((e) => ({
2900
- value: e.code,
2901
- label: U(e.name) || e.code
2902
- }))],
3071
+ options: a,
2903
3072
  onChange: (t) => s(e, t),
2904
3073
  placeholder: i
2905
3074
  })
2906
- }, e) : null;
3075
+ }, e);
2907
3076
  })]
2908
3077
  });
2909
3078
  }
2910
- function Pr({ field: e, label: t, value: n, onChange: r }) {
2911
- let i = h(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = K(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
3079
+ function ni({ field: e, label: t, value: n, onChange: r }) {
3080
+ let i = u(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = K(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
2912
3081
  per_page: 200,
2913
3082
  sort: a ? `${a}:asc` : void 0
2914
3083
  }), c = s?.data ?? [], l = (e) => {
@@ -2918,21 +3087,21 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
2918
3087
  return t == null ? "—" : p(t);
2919
3088
  }
2920
3089
  return p(e);
2921
- };
3090
+ }, f = [{
3091
+ value: "__all__",
3092
+ label: `All ${t}`
3093
+ }, ...c.map((e) => {
3094
+ let t = String(e[o]), n = e[ie];
3095
+ return {
3096
+ value: t,
3097
+ label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
3098
+ };
3099
+ })];
2922
3100
  return /* @__PURE__ */ X("div", {
2923
3101
  style: { width: 160 },
2924
- children: /* @__PURE__ */ X(u, {
3102
+ children: /* @__PURE__ */ X(d, {
2925
3103
  value: n,
2926
- options: [{
2927
- value: "__all__",
2928
- label: `All ${t}`
2929
- }, ...c.map((e) => {
2930
- let t = String(e[o]), n = e[re];
2931
- return {
2932
- value: t,
2933
- label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
2934
- };
2935
- })],
3104
+ options: f,
2936
3105
  onChange: r,
2937
3106
  placeholder: t
2938
3107
  })
@@ -2940,21 +3109,21 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
2940
3109
  }
2941
3110
  //#endregion
2942
3111
  //#region src/lib/action-dispatch.ts
2943
- function Fr(e, t, n, r) {
2944
- return R(t) ? (le(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
3112
+ function ri(e, t, n, r) {
3113
+ return L(t) ? (le(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
2945
3114
  }
2946
3115
  //#endregion
2947
3116
  //#region src/components/detail-layout/AssociatedBlock.tsx
2948
- function Ir(e) {
3117
+ function ii(e) {
2949
3118
  if (!e) return [];
2950
3119
  let t = [];
2951
- for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || c(n) || t.push({
3120
+ for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || s(n) || t.push({
2952
3121
  code: n,
2953
3122
  action: r
2954
3123
  }));
2955
3124
  return t;
2956
3125
  }
2957
- function Lr(e, t, n) {
3126
+ function ai(e, t, n) {
2958
3127
  if (!e) return [];
2959
3128
  let r = [];
2960
3129
  for (let [i, a] of Object.entries(e)) {
@@ -2970,7 +3139,7 @@ function Lr(e, t, n) {
2970
3139
  let n = a.resolved_params.items().filter((e) => e.name !== t);
2971
3140
  e = {
2972
3141
  ...e,
2973
- resolved_params: new _(n)
3142
+ resolved_params: new y(n)
2974
3143
  };
2975
3144
  }
2976
3145
  r.push({
@@ -2980,7 +3149,7 @@ function Lr(e, t, n) {
2980
3149
  }
2981
3150
  return r;
2982
3151
  }
2983
- function Rr(e, t, n) {
3152
+ function oi(e, t, n) {
2984
3153
  let r = e[n];
2985
3154
  if (!r) return null;
2986
3155
  let i = e[t], a = i?.children?.find((e) => e.entity === n);
@@ -3002,22 +3171,22 @@ function Rr(e, t, n) {
3002
3171
  }
3003
3172
  return null;
3004
3173
  }
3005
- function zr(e, t, n) {
3006
- let r = new Set(s(e));
3174
+ function si(e, t, n) {
3175
+ let r = new Set(fe(e));
3007
3176
  return new Set(t.filter((t) => {
3008
3177
  if (t === n || r.has(t)) return !1;
3009
3178
  let i = e.fields.get(t);
3010
3179
  return !(!i || i.auto || i.primary || i.source);
3011
3180
  }));
3012
3181
  }
3013
- function Br(e, t, n) {
3182
+ function ci(e, t, n) {
3014
3183
  return new Set(t.filter((t) => {
3015
3184
  if (t === n) return !1;
3016
3185
  let r = e.fields.get(t);
3017
3186
  return !(!r || r.auto);
3018
3187
  }));
3019
3188
  }
3020
- function Vr(e, t, n, r) {
3189
+ function li(e, t, n, r) {
3021
3190
  let i = [];
3022
3191
  for (let a of t) {
3023
3192
  let t = n.fields.get(a);
@@ -3027,7 +3196,7 @@ function Vr(e, t, n, r) {
3027
3196
  }
3028
3197
  return i;
3029
3198
  }
3030
- function Hr({ node: e, ctx: t }) {
3199
+ function ui({ node: e, ctx: t }) {
3031
3200
  let n = e.associated;
3032
3201
  if (!n || t.isNew) return null;
3033
3202
  let r = t.schema.entities[n];
@@ -3039,8 +3208,8 @@ function Hr({ node: e, ctx: t }) {
3039
3208
  },
3040
3209
  children: ["Entity not found: ", n]
3041
3210
  });
3042
- let i = Rr(t.schema.entities, t.entityCode, n);
3043
- return i ? /* @__PURE__ */ X(Ur, {
3211
+ let i = oi(t.schema.entities, t.entityCode, n);
3212
+ return i ? /* @__PURE__ */ X(di, {
3044
3213
  node: e,
3045
3214
  ctx: t,
3046
3215
  assocCode: n,
@@ -3060,12 +3229,12 @@ function Hr({ node: e, ctx: t }) {
3060
3229
  ]
3061
3230
  });
3062
3231
  }
3063
- function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3232
+ function di({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3064
3233
  let c = r.columns && r.columns.length > 0 ? r.columns.filter((e) => e !== s && !!o.fields.get(e)) : o.fields.names().filter((e) => {
3065
3234
  if (e === s) return !1;
3066
3235
  let t = o.fields.get(e);
3067
3236
  return !(!t || t.primary || t.display?.is_listable === !1);
3068
- }), l = me(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = U(o.display?.name_plural) || U(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = K(() => Lr(o.actions, s, i.recordId), [
3237
+ }), l = P(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = C(o.display?.name_plural) || C(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = K(() => ai(o.actions, s, i.recordId), [
3069
3238
  o.actions,
3070
3239
  s,
3071
3240
  i.recordId
@@ -3073,7 +3242,10 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3073
3242
  let e = {};
3074
3243
  for (let { code: t, action: n } of m) e[t] = n;
3075
3244
  return e;
3076
- }, [m]), g = K(() => j(o.action_layout ?? null ?? ue(h, "list_toolbar"), h, void 0, {}, []), [o.action_layout, h]), { run: _ } = te(), v = Bt(), y = n(), b = K(() => ({
3245
+ }, [m]), g = K(() => {
3246
+ let e = o.action_layout ?? null;
3247
+ return j(e ?? ue(h, "list_toolbar"), h, void 0, {}, []);
3248
+ }, [o.action_layout, h]), { run: _ } = te(), v = Bt(), y = n(), b = K(() => ({
3077
3249
  entity: o,
3078
3250
  entityCode: a,
3079
3251
  screenRoute: typeof window < "u" ? window.location.pathname : "",
@@ -3085,7 +3257,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3085
3257
  icon: t?.icon,
3086
3258
  search: t?.search
3087
3259
  }),
3088
- runActionApi: (e, t) => I(e, t)
3260
+ runActionApi: (e, t) => F(e, t)
3089
3261
  }), [
3090
3262
  o,
3091
3263
  a,
@@ -3096,13 +3268,13 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3096
3268
  let t = e.queryKey;
3097
3269
  return t[0] === "entity-children" && t[3] === a;
3098
3270
  } });
3099
- }, [x, a]), C = W((e, t) => {
3100
- let n = Fr(e, t, {}, a);
3271
+ }, [x, a]), w = W((e, t) => {
3272
+ let n = ri(e, t, {}, a);
3101
3273
  if (n !== null) return _({
3102
3274
  action: t,
3103
- title: U(t.display?.name) || e,
3275
+ title: C(t.display?.name) || e,
3104
3276
  execute: async (e) => {
3105
- let t = await I(n, ee(e, void 0));
3277
+ let t = await F(n, R(e, void 0));
3106
3278
  return S(), t;
3107
3279
  }
3108
3280
  });
@@ -3110,7 +3282,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3110
3282
  _,
3111
3283
  a,
3112
3284
  S
3113
- ]), [w, T] = J(0), E = /* @__PURE__ */ Z("div", {
3285
+ ]), [T, E] = J(0), D = /* @__PURE__ */ Z("div", {
3114
3286
  style: {
3115
3287
  display: "flex",
3116
3288
  alignItems: "center",
@@ -3123,7 +3295,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3123
3295
  kind: "toolbar",
3124
3296
  layout: g,
3125
3297
  entityActions: h,
3126
- onRun: C,
3298
+ onRun: w,
3127
3299
  widgetContext: b,
3128
3300
  ariaLabel: `${f} toolbar actions`
3129
3301
  }) : m.map(({ code: e, action: t }) => /* @__PURE__ */ X(or, {
@@ -3133,14 +3305,14 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3133
3305
  variant: "ghost",
3134
3306
  size: "sm",
3135
3307
  onSuccess: S
3136
- }, e)), d && /* @__PURE__ */ X(V, {
3308
+ }, e)), d && /* @__PURE__ */ X(U, {
3137
3309
  kind: "ghost",
3138
3310
  size: "xs",
3139
3311
  icon: /* @__PURE__ */ X(e.plus, { size: 12 }),
3140
- onClick: () => T((e) => e + 1),
3312
+ onClick: () => E((e) => e + 1),
3141
3313
  children: "Add row"
3142
3314
  })]
3143
- }), D = p ? /* @__PURE__ */ X(Gr, {
3315
+ }), O = p ? /* @__PURE__ */ X(pi, {
3144
3316
  entityCode: a,
3145
3317
  entity: o,
3146
3318
  parentEntity: i.entityCode,
@@ -3153,8 +3325,8 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3153
3325
  searchable: r.searchable,
3154
3326
  filterFields: r.filters,
3155
3327
  sort: r.sort,
3156
- startDraftSignal: w
3157
- }) : /* @__PURE__ */ X(Wr, {
3328
+ startDraftSignal: T
3329
+ }) : /* @__PURE__ */ X(fi, {
3158
3330
  entityCode: a,
3159
3331
  entity: o,
3160
3332
  parentEntity: i.entityCode,
@@ -3165,7 +3337,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3165
3337
  interaction: u,
3166
3338
  ctx: i,
3167
3339
  sort: r.sort,
3168
- startDraftSignal: w
3340
+ startDraftSignal: T
3169
3341
  });
3170
3342
  return i.withinCard ? /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("div", {
3171
3343
  style: {
@@ -3173,20 +3345,32 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3173
3345
  justifyContent: "flex-end",
3174
3346
  marginBottom: 8
3175
3347
  },
3176
- children: E
3177
- }), D] }) : /* @__PURE__ */ X(Je, {
3348
+ children: D
3349
+ }), O] }) : /* @__PURE__ */ X(Je, {
3178
3350
  title: f,
3179
3351
  icon: o.display?.icon ? /* @__PURE__ */ X(t, {
3180
3352
  name: o.display.icon,
3181
3353
  size: 14
3182
3354
  }) : void 0,
3183
- right: E,
3184
- children: D
3355
+ right: D,
3356
+ children: O
3185
3357
  });
3186
3358
  }
3187
- function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
3188
- let d = Ue(), { data: f, isLoading: p, isError: m } = nr(n, r, e, i, l), h = f?.data ?? [], g = f?.$refs;
3189
- return /* @__PURE__ */ X(Kr, {
3359
+ function fi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
3360
+ let d = Ue(), { data: f, isLoading: p, isError: m } = nr(n, r, e, i, l), h = f?.data ?? [], g = f?.$refs, _ = W(() => {
3361
+ d.invalidateQueries({ queryKey: [
3362
+ tr,
3363
+ n,
3364
+ r,
3365
+ e
3366
+ ] });
3367
+ }, [
3368
+ d,
3369
+ n,
3370
+ r,
3371
+ e
3372
+ ]);
3373
+ return /* @__PURE__ */ X(mi, {
3190
3374
  entityCode: e,
3191
3375
  entity: t,
3192
3376
  parentId: r,
@@ -3199,23 +3383,11 @@ function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3199
3383
  refs: g,
3200
3384
  isLoading: p,
3201
3385
  isError: m,
3202
- invalidateQuery: W(() => {
3203
- d.invalidateQueries({ queryKey: [
3204
- tr,
3205
- n,
3206
- r,
3207
- e
3208
- ] });
3209
- }, [
3210
- d,
3211
- n,
3212
- r,
3213
- e
3214
- ]),
3386
+ invalidateQuery: _,
3215
3387
  startDraftSignal: u
3216
3388
  });
3217
3389
  }
3218
- function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: d, startDraftSignal: f }) {
3390
+ function pi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: d, startDraftSignal: f }) {
3219
3391
  let p = Ue(), [m, h] = J(""), [g, _] = J(""), [v, y] = J({}), b = q(void 0);
3220
3392
  G(() => (b.current && clearTimeout(b.current), b.current = setTimeout(() => {
3221
3393
  _(m);
@@ -3233,17 +3405,19 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3233
3405
  [e]: t
3234
3406
  };
3235
3407
  });
3236
- }, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows: A, refs: j } = K(() => {
3408
+ }, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows: k, refs: j } = K(() => {
3237
3409
  if (!C?.pages) return {
3238
3410
  rows: [],
3239
3411
  refs: void 0
3240
3412
  };
3241
3413
  let e = [], t;
3242
- for (let n of C.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
3243
- else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
3244
- ...t[e],
3245
- ...r
3246
- };
3414
+ for (let n of C.pages) if (e.push(...n.data), n.$refs) {
3415
+ if (!t) t = { ...n.$refs };
3416
+ else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
3417
+ ...t[e],
3418
+ ...r
3419
+ };
3420
+ }
3247
3421
  return {
3248
3422
  rows: e,
3249
3423
  refs: t
@@ -3255,7 +3429,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3255
3429
  } });
3256
3430
  }, [p, e]);
3257
3431
  return /* @__PURE__ */ Z("div", { children: [
3258
- /* @__PURE__ */ X(Nr, {
3432
+ /* @__PURE__ */ X(ti, {
3259
3433
  entity: t,
3260
3434
  searchable: l,
3261
3435
  filterFields: u,
@@ -3265,7 +3439,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3265
3439
  onFilterChange: x,
3266
3440
  allEntities: c.schema.entities
3267
3441
  }),
3268
- /* @__PURE__ */ X(Kr, {
3442
+ /* @__PURE__ */ X(mi, {
3269
3443
  entityCode: e,
3270
3444
  entity: t,
3271
3445
  parentId: r,
@@ -3274,7 +3448,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3274
3448
  editable: o,
3275
3449
  interaction: s,
3276
3450
  ctx: c,
3277
- rows: A,
3451
+ rows: k,
3278
3452
  refs: j,
3279
3453
  isLoading: w,
3280
3454
  isError: T,
@@ -3283,10 +3457,10 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3283
3457
  }),
3284
3458
  E && /* @__PURE__ */ X("div", {
3285
3459
  style: { marginTop: 4 },
3286
- children: /* @__PURE__ */ X(V, {
3460
+ children: /* @__PURE__ */ X(U, {
3287
3461
  kind: "ghost",
3288
3462
  size: "xs",
3289
- icon: O ? /* @__PURE__ */ X(k, { size: 12 }) : void 0,
3463
+ icon: O ? /* @__PURE__ */ X(A, { size: 12 }) : void 0,
3290
3464
  onClick: () => D(),
3291
3465
  disabled: O,
3292
3466
  children: "Load more"
@@ -3294,45 +3468,45 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3294
3468
  })
3295
3469
  ] });
3296
3470
  }
3297
- function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, rows: l, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
3298
- let h = ie(), g = h.isPhone && c.relatedRecordsPresentation === "table", _ = a.find((e) => e !== i), v = K(() => s === "navigate" ? r(void 0, t, c.schema.screens) : null, [
3299
- s,
3471
+ function mi({ 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: p }) {
3472
+ let m = se(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ = K(() => o === "navigate" ? ne(void 0, t, s.schema.screens) : null, [
3473
+ o,
3300
3474
  t,
3301
- c.schema.screens
3302
- ]), y = K(() => o ? zr(t, a, i) : /* @__PURE__ */ new Set(), [
3303
- a,
3475
+ s.schema.screens
3476
+ ]), v = K(() => a ? si(t, i, r) : /* @__PURE__ */ new Set(), [
3304
3477
  i,
3478
+ r,
3305
3479
  t,
3306
- o
3307
- ]), b = K(() => Br(t, a, i), [
3308
- a,
3480
+ a
3481
+ ]), y = K(() => ci(t, i, r), [
3309
3482
  i,
3483
+ r,
3310
3484
  t
3311
3485
  ]), x = K(() => {
3312
3486
  let e = /* @__PURE__ */ new Map();
3313
- for (let n of l) {
3314
- let r = F(t, n);
3487
+ for (let n of c) {
3488
+ let r = me(t, n);
3315
3489
  e.set(he(r), r);
3316
3490
  }
3317
3491
  return e;
3318
- }, [l, t]), S = K(() => {
3492
+ }, [c, t]), S = K(() => {
3319
3493
  let e = /* @__PURE__ */ new Map();
3320
- for (let n of l) {
3494
+ for (let n of c) {
3321
3495
  let r = n.$row_version;
3322
- typeof r == "string" && r !== "" && e.set(he(F(t, n)), r);
3496
+ typeof r == "string" && r !== "" && e.set(he(me(t, n)), r);
3323
3497
  }
3324
3498
  return e;
3325
- }, [l, t]), C = K(() => Ir(t.actions), [t.actions]), [w, T] = J(null), [E, D] = J(null), [O, k] = J([]), [A, j] = J({}), N = q(A);
3326
- N.current = A;
3327
- let P = q({});
3499
+ }, [c, t]), w = K(() => ii(t.actions), [t.actions]), [T, E] = J(null), [D, O] = J(null), [k, A] = J([]), [j, N] = J({}), P = q(j);
3500
+ P.current = j;
3501
+ let F = q({});
3328
3502
  G(() => {
3329
- let e = P.current;
3503
+ let e = F.current;
3330
3504
  return () => {
3331
3505
  for (let t of Object.values(e)) clearTimeout(t);
3332
3506
  };
3333
3507
  }, []);
3334
- let [I, L] = J(null), [R, z] = J([]), [ee, B] = J(!1), { run: V } = te(), [re, ae] = J(/* @__PURE__ */ new Set()), oe = W(async (t, n, r) => {
3335
- j((e) => ({
3508
+ let [I, L] = J(null), [ee, R] = J([]), [z, B] = J(!1), { run: ie } = te(), [V, ae] = J(/* @__PURE__ */ new Set()), oe = W(async (t, n, r) => {
3509
+ N((e) => ({
3336
3510
  ...e,
3337
3511
  [t]: {
3338
3512
  ...e[t],
@@ -3345,7 +3519,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3345
3519
  ...n,
3346
3520
  $row_version: i
3347
3521
  } : n;
3348
- return await ne(e, x.get(t) ?? t, a), j((e) => {
3522
+ return await re(e, x.get(t) ?? t, a), N((e) => {
3349
3523
  let n = e[t];
3350
3524
  if (!n) return e;
3351
3525
  if (n.ver > r) return {
@@ -3357,10 +3531,10 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3357
3531
  };
3358
3532
  let { [t]: i, ...a } = e;
3359
3533
  return a;
3360
- }), p(), !0;
3534
+ }), f(), !0;
3361
3535
  } catch (e) {
3362
3536
  let n = e instanceof Error ? e.message : "Save failed";
3363
- return j((e) => ({
3537
+ return N((e) => ({
3364
3538
  ...e,
3365
3539
  [t]: {
3366
3540
  ...e[t],
@@ -3371,11 +3545,11 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3371
3545
  }
3372
3546
  }, [
3373
3547
  e,
3374
- p,
3548
+ f,
3375
3549
  x,
3376
3550
  S
3377
3551
  ]), H = W((e, t, n) => {
3378
- j((r) => {
3552
+ N((r) => {
3379
3553
  let i = r[e] ?? {
3380
3554
  buffer: {},
3381
3555
  ver: 0,
@@ -3392,89 +3566,89 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3392
3566
  ver: a
3393
3567
  }
3394
3568
  };
3395
- }), s === "inline_edit" && (P.current[e] && clearTimeout(P.current[e]), P.current[e] = setTimeout(() => {
3396
- let t = N.current[e];
3569
+ }), o === "inline_edit" && (F.current[e] && clearTimeout(F.current[e]), F.current[e] = setTimeout(() => {
3570
+ let t = P.current[e];
3397
3571
  t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
3398
3572
  }, 500));
3399
- }, [oe, s]), se = W(() => {
3573
+ }, [oe, o]), ce = W(() => {
3400
3574
  let e = {};
3401
- e[i] = n;
3402
- for (let n of a) {
3575
+ e[r] = n;
3576
+ for (let n of i) {
3403
3577
  let r = t.fields.get(n);
3404
3578
  r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
3405
3579
  }
3406
- L(e), z([]);
3580
+ L(e), R([]);
3407
3581
  }, [
3408
- i,
3582
+ r,
3409
3583
  n,
3410
- a,
3584
+ i,
3411
3585
  t.fields
3412
- ]), ce = q(m);
3586
+ ]), le = q(p);
3413
3587
  G(() => {
3414
- m !== void 0 && m !== ce.current && (ce.current = m, !I && se());
3588
+ p !== void 0 && p !== le.current && (le.current = p, !I && ce());
3415
3589
  }, [
3416
- m,
3590
+ p,
3417
3591
  I,
3418
- se
3592
+ ce
3419
3593
  ]);
3420
- let le = W(async () => {
3594
+ let U = W(async () => {
3421
3595
  if (!I) return;
3422
- let n = Vr(I, a, t, i);
3596
+ let n = li(I, i, t, r);
3423
3597
  if (n.length > 0) {
3424
- z(n);
3598
+ R(n);
3425
3599
  return;
3426
3600
  }
3427
3601
  B(!0);
3428
3602
  try {
3429
- await M(e, I), L(null), z([]), p();
3603
+ await M(e, I), L(null), R([]), f();
3430
3604
  } catch (e) {
3431
3605
  let t = e instanceof Error ? e.message : "Create failed";
3432
- z([`_error:${t}`]);
3606
+ R([`_error:${t}`]);
3433
3607
  } finally {
3434
3608
  B(!1);
3435
3609
  }
3436
3610
  }, [
3437
3611
  I,
3438
- a,
3439
- t,
3440
3612
  i,
3613
+ t,
3614
+ r,
3441
3615
  e,
3442
- p
3616
+ f
3443
3617
  ]), ue = W((e) => {
3444
- j({}), k([]), D(e);
3618
+ N({}), A([]), O(e);
3445
3619
  }, []), fe = W(async (e) => {
3446
- let n = N.current[e], r = n?.buffer ?? {};
3447
- if (Object.keys(r).length === 0) {
3448
- D(null), k([]);
3620
+ let n = P.current[e], a = n?.buffer ?? {};
3621
+ if (Object.keys(a).length === 0) {
3622
+ O(null), A([]);
3449
3623
  return;
3450
3624
  }
3451
- let o = Vr({
3452
- ...l.find((n) => he(F(t, n)) === e) ?? {},
3453
- ...r
3454
- }, a, t, i);
3625
+ let o = li({
3626
+ ...c.find((n) => he(me(t, n)) === e) ?? {},
3627
+ ...a
3628
+ }, i, t, r);
3455
3629
  if (o.length > 0) {
3456
- k(o);
3630
+ A(o);
3457
3631
  return;
3458
3632
  }
3459
- await oe(e, { ...r }, n?.ver ?? 0) && (D(null), k([]));
3633
+ await oe(e, { ...a }, n?.ver ?? 0) && (O(null), A([]));
3460
3634
  }, [
3461
- l,
3635
+ c,
3462
3636
  t,
3463
- a,
3464
3637
  i,
3638
+ r,
3465
3639
  oe
3466
- ]), me = W((e) => {
3467
- j((t) => {
3640
+ ]), pe = W((e) => {
3641
+ N((t) => {
3468
3642
  if (!t[e]) return t;
3469
3643
  let { [e]: n, ...r } = t;
3470
3644
  return r;
3471
- }), k([]), D(null);
3645
+ }), A([]), O(null);
3472
3646
  }, []), ge = W((n, r) => {
3473
3647
  let i = x.get(n) ?? n;
3474
- return V({
3648
+ return ie({
3475
3649
  action: t.actions?.__delete,
3476
3650
  destructive: !0,
3477
- title: U(t.display?.name) || "Delete",
3651
+ title: C(t.display?.name) || "Delete",
3478
3652
  row: r,
3479
3653
  entity: e,
3480
3654
  execute: async () => {
@@ -3488,16 +3662,16 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3488
3662
  });
3489
3663
  }
3490
3664
  },
3491
- onSuccess: () => p()
3665
+ onSuccess: () => f()
3492
3666
  });
3493
3667
  }, [
3494
- V,
3668
+ ie,
3495
3669
  t,
3496
3670
  e,
3497
- p,
3671
+ f,
3498
3672
  x
3499
3673
  ]);
3500
- if (f) return /* @__PURE__ */ X("div", {
3674
+ if (d) return /* @__PURE__ */ X("div", {
3501
3675
  style: {
3502
3676
  fontSize: 12.5,
3503
3677
  color: "var(--danger)",
@@ -3505,7 +3679,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3505
3679
  },
3506
3680
  children: "Failed to load."
3507
3681
  });
3508
- if (d) return /* @__PURE__ */ Z("div", {
3682
+ if (u) return /* @__PURE__ */ Z("div", {
3509
3683
  style: {
3510
3684
  display: "flex",
3511
3685
  flexDirection: "column",
@@ -3522,163 +3696,167 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3522
3696
  borderRadius: 6
3523
3697
  } })]
3524
3698
  });
3525
- let _e = l.length === 0 && !I;
3526
- return h.isPhone && !g ? /* @__PURE__ */ Z("div", { children: [_e && !o && /* @__PURE__ */ X("div", {
3699
+ let _e = c.length === 0 && !I;
3700
+ return m.isPhone && !h ? /* @__PURE__ */ Z("div", { children: [_e && !a && /* @__PURE__ */ X("div", {
3527
3701
  style: {
3528
3702
  fontSize: 12.5,
3529
3703
  color: "var(--text-3)",
3530
3704
  padding: "12px 0"
3531
3705
  },
3532
3706
  children: "No records yet."
3533
- }), (!_e || o) && /* @__PURE__ */ Z("div", {
3707
+ }), (!_e || a) && /* @__PURE__ */ Z("div", {
3534
3708
  style: {
3535
3709
  display: "flex",
3536
3710
  flexDirection: "column",
3537
3711
  gap: 10
3538
3712
  },
3539
- children: [l.map((n) => {
3540
- let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3541
- return /* @__PURE__ */ X(qr, {
3713
+ children: [c.map((n) => {
3714
+ let r = he(me(t, n)), c = V.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
3715
+ return /* @__PURE__ */ X(hi, {
3542
3716
  rowId: r,
3543
3717
  row: n,
3544
3718
  entity: t,
3545
- entities: c.schema.entities,
3546
- screens: c.schema.screens,
3547
- columns: a,
3548
- editableColumns: y,
3549
- editable: o,
3550
- interaction: s,
3551
- isEditing: E === r,
3552
- editErrors: O,
3553
- isDeleting: i,
3554
- activeCell: w,
3555
- setActiveCell: T,
3556
- rowState: l,
3719
+ entities: s.schema.entities,
3720
+ screens: s.schema.screens,
3721
+ columns: i,
3722
+ editableColumns: v,
3723
+ editable: a,
3724
+ interaction: o,
3725
+ isEditing: D === r,
3726
+ editErrors: k,
3727
+ isDeleting: c,
3728
+ activeCell: T,
3729
+ setActiveCell: E,
3730
+ rowState: u,
3557
3731
  onCellChange: H,
3558
3732
  onDeleteClick: (e) => void ge(e, n),
3559
3733
  onStartEdit: ue,
3560
3734
  onConfirmEdit: fe,
3561
- onCancelEdit: me,
3562
- refs: u,
3563
- identityCol: _,
3735
+ onCancelEdit: pe,
3736
+ refs: l,
3737
+ identityCol: g,
3564
3738
  href: d,
3565
- rowActions: C,
3739
+ rowActions: w,
3566
3740
  entityCode: e,
3567
- onRowActionSuccess: p
3741
+ onRowActionSuccess: f
3568
3742
  }, r);
3569
- }), I && /* @__PURE__ */ X(Qr, {
3743
+ }), I && /* @__PURE__ */ X(bi, {
3570
3744
  draftRow: I,
3571
3745
  entity: t,
3572
- columns: a,
3573
- editableColumns: b,
3574
- foreignKey: i,
3575
- draftErrors: R,
3576
- draftSaving: ee,
3746
+ columns: i,
3747
+ editableColumns: y,
3748
+ foreignKey: r,
3749
+ draftErrors: ee,
3750
+ draftSaving: z,
3577
3751
  onChange: (e, t) => L((n) => n && {
3578
3752
  ...n,
3579
3753
  [e]: t
3580
3754
  }),
3581
- onConfirm: le,
3755
+ onConfirm: U,
3582
3756
  onCancel: () => {
3583
- L(null), z([]);
3757
+ L(null), R([]);
3584
3758
  },
3585
- refs: u
3759
+ refs: l
3586
3760
  })]
3587
- })] }) : /* @__PURE__ */ Z("div", { children: [_e && !o && /* @__PURE__ */ X("div", {
3761
+ })] }) : /* @__PURE__ */ Z("div", { children: [_e && !a && /* @__PURE__ */ X("div", {
3588
3762
  style: {
3589
3763
  fontSize: 12.5,
3590
3764
  color: "var(--text-3)",
3591
3765
  padding: "12px 0"
3592
3766
  },
3593
3767
  children: "No records yet."
3594
- }), (!_e || o) && /* @__PURE__ */ X("div", {
3768
+ }), (!_e || a) && /* @__PURE__ */ X("div", {
3595
3769
  style: { overflowX: "auto" },
3596
3770
  children: /* @__PURE__ */ Z("table", {
3597
3771
  style: je,
3598
3772
  children: [/* @__PURE__ */ X("thead", { children: /* @__PURE__ */ Z("tr", { children: [
3599
- a.map((e) => {
3773
+ i.map((e) => {
3600
3774
  let n = t.fields.get(e);
3601
3775
  return /* @__PURE__ */ X("th", {
3602
3776
  style: Ae,
3603
- children: n ? pe(n, e, c.schema.entities) : e
3777
+ children: n ? b(n, e, s.schema.entities) : e
3604
3778
  }, e);
3605
3779
  }),
3606
- o && /* @__PURE__ */ X("th", { style: {
3780
+ a && /* @__PURE__ */ X("th", { style: {
3607
3781
  height: 30,
3608
3782
  width: 72
3609
3783
  } }),
3610
- !o && C.length > 0 && /* @__PURE__ */ X("th", { style: {
3784
+ !a && w.length > 0 && /* @__PURE__ */ X("th", { style: {
3611
3785
  height: 30,
3612
3786
  width: 40
3613
3787
  } })
3614
- ] }) }), /* @__PURE__ */ Z("tbody", { children: [l.map((n) => {
3615
- let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3616
- return /* @__PURE__ */ X(Jr, {
3788
+ ] }) }), /* @__PURE__ */ Z("tbody", { children: [c.map((n) => {
3789
+ let r = he(me(t, n)), c = V.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
3790
+ return /* @__PURE__ */ X(gi, {
3617
3791
  rowId: r,
3618
3792
  row: n,
3619
3793
  entity: t,
3620
- entities: c.schema.entities,
3621
- screens: c.schema.screens,
3622
- columns: a,
3623
- editableColumns: y,
3624
- editable: o,
3625
- interaction: s,
3626
- isEditing: E === r,
3627
- editErrors: O,
3628
- isDeleting: i,
3629
- activeCell: w,
3630
- setActiveCell: T,
3631
- rowState: l,
3794
+ entities: s.schema.entities,
3795
+ screens: s.schema.screens,
3796
+ columns: i,
3797
+ editableColumns: v,
3798
+ editable: a,
3799
+ interaction: o,
3800
+ isEditing: D === r,
3801
+ editErrors: k,
3802
+ isDeleting: c,
3803
+ activeCell: T,
3804
+ setActiveCell: E,
3805
+ rowState: u,
3632
3806
  onCellChange: H,
3633
3807
  onDeleteClick: (e) => void ge(e, n),
3634
3808
  onStartEdit: ue,
3635
3809
  onConfirmEdit: fe,
3636
- onCancelEdit: me,
3637
- refs: u,
3638
- identityCol: _,
3810
+ onCancelEdit: pe,
3811
+ refs: l,
3812
+ identityCol: g,
3639
3813
  href: d,
3640
- rowActions: C,
3814
+ rowActions: w,
3641
3815
  entityCode: e,
3642
- onRowActionSuccess: p
3816
+ onRowActionSuccess: f
3643
3817
  }, r);
3644
- }), I && /* @__PURE__ */ X(Zr, {
3818
+ }), I && /* @__PURE__ */ X(yi, {
3645
3819
  draftRow: I,
3646
3820
  entity: t,
3647
- columns: a,
3648
- editableColumns: b,
3649
- foreignKey: i,
3650
- draftErrors: R,
3651
- draftSaving: ee,
3821
+ columns: i,
3822
+ editableColumns: y,
3823
+ foreignKey: r,
3824
+ draftErrors: ee,
3825
+ draftSaving: z,
3652
3826
  onChange: (e, t) => L((n) => n && {
3653
3827
  ...n,
3654
3828
  [e]: t
3655
3829
  }),
3656
- onConfirm: le,
3830
+ onConfirm: U,
3657
3831
  onCancel: () => {
3658
- L(null), z([]);
3832
+ L(null), R([]);
3659
3833
  },
3660
- refs: u
3834
+ refs: l
3661
3835
  })] })]
3662
3836
  })
3663
3837
  })] });
3664
3838
  }
3665
- function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: b, refs: x, identityCol: S, href: C, rowActions: w, onRowActionSuccess: T }) {
3666
- let E = n(), D = Ie(), O = K(() => !h || Object.keys(h.buffer).length === 0 ? r : {
3839
+ function hi({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
3840
+ let D = n(), O = Ie(), k = K(() => !h || Object.keys(h.buffer).length === 0 ? r : {
3667
3841
  ...r,
3668
3842
  ...h.buffer
3669
3843
  }, [r, h]);
3670
- return u === "row_edit" && d ? /* @__PURE__ */ X(Xr, {
3671
- values: O,
3672
- entity: i,
3673
- columns: s,
3674
- editableColumns: c,
3675
- errors: h?.error ? [...f, `_error:${h.error}`] : f,
3676
- saving: h?.saving ?? !1,
3677
- onChange: (e, n) => g(t, e, n),
3678
- onConfirm: () => y(t),
3679
- onCancel: () => b(t),
3680
- refs: x
3681
- }) : /* @__PURE__ */ Z("div", {
3844
+ if (u === "row_edit" && d) {
3845
+ let e = h?.error ? [...f, `_error:${h.error}`] : f;
3846
+ return /* @__PURE__ */ X(vi, {
3847
+ values: k,
3848
+ entity: i,
3849
+ columns: s,
3850
+ editableColumns: c,
3851
+ errors: e,
3852
+ saving: h?.saving ?? !1,
3853
+ onChange: (e, n) => g(t, e, n),
3854
+ onConfirm: () => y(t),
3855
+ onCancel: () => x(t),
3856
+ refs: S
3857
+ });
3858
+ }
3859
+ return /* @__PURE__ */ Z("div", {
3682
3860
  style: {
3683
3861
  border: "1px solid var(--border)",
3684
3862
  borderRadius: 8,
@@ -3694,26 +3872,26 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3694
3872
  gap: 12
3695
3873
  },
3696
3874
  children: s.map((e) => {
3697
- let n = i.fields.get(e), r = l && u === "inline_edit" && c.has(e), s = C && e === S, d = n ? pe(n, e, a) : e, f = `${D}-${t}-${e}`, m = `${f}-label`, h = {
3875
+ let n = i.fields.get(e), r = l && u === "inline_edit" && c.has(e), s = w && e === C, d = n ? b(n, e, a) : e, f = `${O}-${t}-${e}`, m = `${f}-label`, h = {
3698
3876
  fontSize: 11.5,
3699
3877
  fontWeight: 600,
3700
3878
  color: "var(--text-3)"
3701
- }, _ = n ? B({
3879
+ }, _ = n ? z({
3702
3880
  field: n,
3703
3881
  fieldName: e,
3704
- value: O[e],
3882
+ value: k[e],
3705
3883
  mode: r ? "edit" : "display",
3706
3884
  onChange: r ? (n) => g(t, e, n) : void 0,
3707
- record: O,
3708
- refs: x,
3885
+ record: k,
3886
+ refs: S,
3709
3887
  compact: r,
3710
3888
  entity: i,
3711
3889
  entities: a,
3712
3890
  screens: s ? void 0 : o,
3713
3891
  fieldId: f,
3714
3892
  labelId: m,
3715
- locale: E
3716
- }) : p(O[e]);
3893
+ locale: D
3894
+ }) : p(k[e]);
3717
3895
  return /* @__PURE__ */ Z("div", {
3718
3896
  style: {
3719
3897
  display: "flex",
@@ -3733,7 +3911,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3733
3911
  }), /* @__PURE__ */ X("div", {
3734
3912
  style: { minWidth: 0 },
3735
3913
  children: s && !r ? /* @__PURE__ */ X("a", {
3736
- href: C,
3914
+ href: w,
3737
3915
  style: {
3738
3916
  color: "var(--accent)",
3739
3917
  textDecoration: "none",
@@ -3744,7 +3922,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3744
3922
  })]
3745
3923
  }, e);
3746
3924
  })
3747
- }), (l || w && w.length > 0) && /* @__PURE__ */ Z("div", {
3925
+ }), (l || T && T.length > 0) && /* @__PURE__ */ Z("div", {
3748
3926
  style: {
3749
3927
  minHeight: 42,
3750
3928
  padding: "6px 8px",
@@ -3755,7 +3933,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3755
3933
  gap: 6
3756
3934
  },
3757
3935
  children: [l && /* @__PURE__ */ Z(Y, { children: [
3758
- h?.saving && /* @__PURE__ */ X(k, { size: 12 }),
3936
+ h?.saving && /* @__PURE__ */ X(A, { size: 12 }),
3759
3937
  h?.error && /* @__PURE__ */ X("span", {
3760
3938
  style: {
3761
3939
  fontSize: 11,
@@ -3764,44 +3942,48 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3764
3942
  title: h.error,
3765
3943
  children: "!"
3766
3944
  }),
3767
- u === "row_edit" && /* @__PURE__ */ X(L, {
3945
+ u === "row_edit" && /* @__PURE__ */ X(B, {
3768
3946
  size: 32,
3769
3947
  icon: /* @__PURE__ */ X(e.edit, { size: 14 }),
3770
3948
  onClick: () => v(t),
3771
3949
  title: "Edit row"
3772
3950
  }),
3773
- /* @__PURE__ */ X(L, {
3951
+ /* @__PURE__ */ X(B, {
3774
3952
  size: 32,
3775
3953
  icon: /* @__PURE__ */ X(e.trash, { size: 14 }),
3776
3954
  onClick: () => _(t),
3777
3955
  title: "Delete row"
3778
3956
  })
3779
- ] }), !l && w && w.length > 0 && /* @__PURE__ */ X(Mr, {
3780
- actions: w,
3957
+ ] }), !l && T && T.length > 0 && /* @__PURE__ */ X(ei, {
3958
+ entity: i,
3959
+ actions: T,
3781
3960
  objectIds: [t],
3782
- row: O,
3783
- onSuccess: T
3961
+ row: k,
3962
+ onSuccess: E
3784
3963
  })]
3785
3964
  })]
3786
3965
  });
3787
3966
  }
3788
- function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
3789
- let O = n(), A = K(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
3967
+ function gi({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
3968
+ let O = n(), k = K(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
3790
3969
  ...r,
3791
3970
  ..._.buffer
3792
3971
  }, [r, _]);
3793
- if (u === "row_edit" && d) return /* @__PURE__ */ X(Yr, {
3794
- values: A,
3795
- entity: i,
3796
- columns: s,
3797
- editableColumns: c,
3798
- errors: _?.error ? [...f, `_error:${_.error}`] : f,
3799
- saving: _?.saving ?? !1,
3800
- onChange: (e, n) => v(t, e, n),
3801
- onConfirm: () => x(t),
3802
- onCancel: () => S(t),
3803
- refs: C
3804
- });
3972
+ if (u === "row_edit" && d) {
3973
+ let e = _?.error ? [...f, `_error:${_.error}`] : f;
3974
+ return /* @__PURE__ */ X(_i, {
3975
+ values: k,
3976
+ entity: i,
3977
+ columns: s,
3978
+ editableColumns: c,
3979
+ errors: e,
3980
+ saving: _?.saving ?? !1,
3981
+ onChange: (e, n) => v(t, e, n),
3982
+ onConfirm: () => x(t),
3983
+ onCancel: () => S(t),
3984
+ refs: C
3985
+ });
3986
+ }
3805
3987
  let j = Me, M = {
3806
3988
  padding: "4px 4px",
3807
3989
  borderBottom: "1px solid var(--divider)",
@@ -3814,30 +3996,30 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3814
3996
  let n = i.fields.get(e), r = c.has(e);
3815
3997
  if (N && h?.rowId === t && h?.col === e && r) return /* @__PURE__ */ X("td", {
3816
3998
  style: M,
3817
- children: n ? B({
3999
+ children: n ? z({
3818
4000
  field: n,
3819
4001
  fieldName: e,
3820
- value: A[e],
4002
+ value: k[e],
3821
4003
  mode: "edit",
3822
4004
  onChange: (n) => v(t, e, n),
3823
- record: A,
4005
+ record: k,
3824
4006
  refs: C,
3825
4007
  compact: !0,
3826
4008
  locale: O
3827
- }) : p(A[e])
4009
+ }) : p(k[e])
3828
4010
  }, e);
3829
- let s = T && e === w, l = n ? B({
4011
+ let s = T && e === w, l = n ? z({
3830
4012
  field: n,
3831
4013
  fieldName: e,
3832
- value: A[e],
4014
+ value: k[e],
3833
4015
  mode: "display",
3834
- record: A,
4016
+ record: k,
3835
4017
  refs: C,
3836
4018
  entity: i,
3837
4019
  entities: a,
3838
4020
  screens: s ? void 0 : o,
3839
4021
  locale: O
3840
- }) : p(A[e]), u = N && r && !m;
4022
+ }) : p(k[e]), u = N && r && !m;
3841
4023
  return /* @__PURE__ */ X("td", {
3842
4024
  style: {
3843
4025
  ...j,
@@ -3873,7 +4055,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3873
4055
  gap: 4
3874
4056
  },
3875
4057
  children: [
3876
- _?.saving && /* @__PURE__ */ X(k, { size: 12 }),
4058
+ _?.saving && /* @__PURE__ */ X(A, { size: 12 }),
3877
4059
  _?.error && /* @__PURE__ */ X("span", {
3878
4060
  style: {
3879
4061
  fontSize: 11,
@@ -3882,13 +4064,13 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3882
4064
  title: _.error,
3883
4065
  children: "!"
3884
4066
  }),
3885
- u === "row_edit" && /* @__PURE__ */ X(L, {
4067
+ u === "row_edit" && /* @__PURE__ */ X(B, {
3886
4068
  size: 24,
3887
4069
  icon: /* @__PURE__ */ X(e.edit, { size: 12 }),
3888
4070
  onClick: () => b(t),
3889
4071
  title: "Edit row"
3890
4072
  }),
3891
- /* @__PURE__ */ X(L, {
4073
+ /* @__PURE__ */ X(B, {
3892
4074
  size: 24,
3893
4075
  icon: /* @__PURE__ */ X(e.trash, { size: 12 }),
3894
4076
  onClick: () => y(t),
@@ -3903,17 +4085,18 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3903
4085
  borderBottom: "1px solid var(--divider)",
3904
4086
  verticalAlign: "middle"
3905
4087
  },
3906
- children: /* @__PURE__ */ X(Mr, {
4088
+ children: /* @__PURE__ */ X(ei, {
4089
+ entity: i,
3907
4090
  actions: E,
3908
4091
  objectIds: [t],
3909
- row: A,
4092
+ row: k,
3910
4093
  onSuccess: D
3911
4094
  })
3912
4095
  })
3913
4096
  ]
3914
4097
  });
3915
4098
  }
3916
- function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
4099
+ function _i({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
3917
4100
  let m = n(), h = o.find((e) => e.startsWith("_error:")), g = new Set(o.filter((e) => !e.startsWith("_error:"))), _ = {
3918
4101
  padding: "6px 12px",
3919
4102
  borderBottom: "1px solid var(--divider)",
@@ -3942,7 +4125,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
3942
4125
  title: o ? `${e} is required` : void 0,
3943
4126
  children: /* @__PURE__ */ X("div", {
3944
4127
  style: v,
3945
- children: n ? B({
4128
+ children: n ? z({
3946
4129
  field: n,
3947
4130
  fieldName: e,
3948
4131
  value: t[e],
@@ -3979,13 +4162,13 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
3979
4162
  title: h.slice(7),
3980
4163
  children: "!"
3981
4164
  }),
3982
- /* @__PURE__ */ X(L, {
4165
+ /* @__PURE__ */ X(B, {
3983
4166
  size: 24,
3984
- icon: X(s ? k : e.check, { size: 12 }),
4167
+ icon: X(s ? A : e.check, { size: 12 }),
3985
4168
  onClick: l,
3986
4169
  title: "Confirm (Enter)"
3987
4170
  }),
3988
- /* @__PURE__ */ X(L, {
4171
+ /* @__PURE__ */ X(B, {
3989
4172
  size: 24,
3990
4173
  icon: /* @__PURE__ */ X(e.x, { size: 12 }),
3991
4174
  onClick: u,
@@ -3996,7 +4179,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
3996
4179
  })]
3997
4180
  });
3998
4181
  }
3999
- function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
4182
+ function vi({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
4000
4183
  let m = n(), h = Ie(), g = o.find((e) => e.startsWith("_error:")), _ = new Set(o.filter((e) => !e.startsWith("_error:")));
4001
4184
  return /* @__PURE__ */ Z("div", {
4002
4185
  style: {
@@ -4017,7 +4200,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4017
4200
  gap: 12
4018
4201
  },
4019
4202
  children: i.map((e) => {
4020
- let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ? pe(n, e) : e, l = `${h}-${e}`, u = `${l}-label`, f = {
4203
+ let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ? b(n, e) : e, l = `${h}-${e}`, u = `${l}-label`, f = {
4021
4204
  fontSize: 11.5,
4022
4205
  fontWeight: 600,
4023
4206
  color: "var(--text-3)"
@@ -4046,7 +4229,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4046
4229
  borderRadius: o ? 5 : 0
4047
4230
  },
4048
4231
  title: o ? `${e} is required` : void 0,
4049
- children: i ? n ? B({
4232
+ children: i ? n ? z({
4050
4233
  field: n,
4051
4234
  fieldName: e,
4052
4235
  value: t[e],
@@ -4081,13 +4264,13 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4081
4264
  title: g.slice(7),
4082
4265
  children: "!"
4083
4266
  }),
4084
- /* @__PURE__ */ X(L, {
4267
+ /* @__PURE__ */ X(B, {
4085
4268
  size: 32,
4086
- icon: X(s ? k : e.check, { size: 14 }),
4269
+ icon: X(s ? A : e.check, { size: 14 }),
4087
4270
  onClick: l,
4088
4271
  title: "Confirm (Enter)"
4089
4272
  }),
4090
- /* @__PURE__ */ X(L, {
4273
+ /* @__PURE__ */ X(B, {
4091
4274
  size: 32,
4092
4275
  icon: /* @__PURE__ */ X(e.x, { size: 14 }),
4093
4276
  onClick: u,
@@ -4097,15 +4280,16 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4097
4280
  })]
4098
4281
  });
4099
4282
  }
4100
- function Zr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
4101
- return /* @__PURE__ */ X(Yr, {
4283
+ function yi({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
4284
+ let d = K(() => {
4285
+ let e = new Set(r);
4286
+ return e.delete(i), e;
4287
+ }, [r, i]);
4288
+ return /* @__PURE__ */ X(_i, {
4102
4289
  values: e,
4103
4290
  entity: t,
4104
4291
  columns: n,
4105
- editableColumns: K(() => {
4106
- let e = new Set(r);
4107
- return e.delete(i), e;
4108
- }, [r, i]),
4292
+ editableColumns: d,
4109
4293
  errors: a,
4110
4294
  saving: o,
4111
4295
  onChange: s,
@@ -4115,15 +4299,16 @@ function Zr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
4115
4299
  accent: !0
4116
4300
  });
4117
4301
  }
4118
- function Qr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
4119
- return /* @__PURE__ */ X(Xr, {
4302
+ function bi({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
4303
+ let d = K(() => {
4304
+ let e = new Set(r);
4305
+ return e.delete(i), e;
4306
+ }, [r, i]);
4307
+ return /* @__PURE__ */ X(vi, {
4120
4308
  values: e,
4121
4309
  entity: t,
4122
4310
  columns: n,
4123
- editableColumns: K(() => {
4124
- let e = new Set(r);
4125
- return e.delete(i), e;
4126
- }, [r, i]),
4311
+ editableColumns: d,
4127
4312
  errors: a,
4128
4313
  saving: o,
4129
4314
  onChange: s,
@@ -4135,76 +4320,76 @@ function Qr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
4135
4320
  }
4136
4321
  //#endregion
4137
4322
  //#region src/hooks/useMutations.ts
4138
- function $r(e) {
4323
+ function xi(e) {
4139
4324
  H.error(e.message);
4140
4325
  }
4141
- function ei(e, t, n = {}) {
4326
+ function Si(e, t, n = {}) {
4142
4327
  e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [tr, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
4143
4328
  }
4144
- function ti(e) {
4329
+ function Ci(e) {
4145
4330
  let t = Ue();
4146
4331
  return Ve({
4147
4332
  mutationFn: (t) => M(e, t),
4148
4333
  onSuccess: () => {
4149
- ei(t, e), H.success("Record created");
4334
+ Si(t, e), H.success("Record created");
4150
4335
  },
4151
- onError: $r
4336
+ onError: xi
4152
4337
  });
4153
4338
  }
4154
- function ni(e) {
4339
+ function wi(e) {
4155
4340
  let t = Ue();
4156
4341
  return Ve({
4157
- mutationFn: ({ pkValues: t, data: n }) => ne(e, t, n),
4342
+ mutationFn: ({ pkValues: t, data: n }) => re(e, t, n),
4158
4343
  onSuccess: () => {
4159
- ei(t, e, {
4344
+ Si(t, e, {
4160
4345
  item: !0,
4161
4346
  children: !0,
4162
4347
  objectMeta: !0
4163
4348
  }), H.success("Record updated");
4164
4349
  },
4165
- onError: $r
4350
+ onError: xi
4166
4351
  });
4167
4352
  }
4168
- function ri(e) {
4353
+ function Ti(e) {
4169
4354
  let t = Ue();
4170
4355
  return Ve({
4171
4356
  mutationFn: (t) => de(e, t),
4172
4357
  onSuccess: () => {
4173
- ei(t, e, { item: !0 }), H.success("Record deleted");
4358
+ Si(t, e, { item: !0 }), H.success("Record deleted");
4174
4359
  },
4175
- onError: $r
4360
+ onError: xi
4176
4361
  });
4177
4362
  }
4178
- function ii(e) {
4363
+ function Ei(e) {
4179
4364
  let t = Ue();
4180
4365
  return Ve({
4181
4366
  mutationFn: (t) => w(e, t),
4182
4367
  onSuccess: () => {
4183
- ei(t, e, {
4368
+ Si(t, e, {
4184
4369
  item: !0,
4185
4370
  objectMeta: !0
4186
4371
  }), H.success("Record restored");
4187
4372
  },
4188
- onError: $r
4373
+ onError: xi
4189
4374
  });
4190
4375
  }
4191
4376
  //#endregion
4192
4377
  //#region src/components/shared/LoadingSkeleton.tsx
4193
- var ai = {
4378
+ var Di = {
4194
4379
  display: "block",
4195
4380
  background: "linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%)",
4196
4381
  backgroundSize: "200% 100%",
4197
4382
  borderRadius: 6,
4198
4383
  animation: "declarion-shimmer 1.2s ease-in-out infinite"
4199
4384
  };
4200
- function oi({ height: e, width: t }) {
4385
+ function Oi({ height: e, width: t }) {
4201
4386
  return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("style", { children: "@keyframes declarion-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}" }), /* @__PURE__ */ X("span", { style: {
4202
- ...ai,
4387
+ ...Di,
4203
4388
  height: e,
4204
4389
  width: t ?? "100%"
4205
4390
  } })] });
4206
4391
  }
4207
- function si({ rows: e = 8, cols: t = 4 }) {
4392
+ function ki({ rows: e = 8, cols: t = 4 }) {
4208
4393
  return /* @__PURE__ */ Z("div", {
4209
4394
  style: {
4210
4395
  padding: 16,
@@ -4219,7 +4404,7 @@ function si({ rows: e = 8, cols: t = 4 }) {
4219
4404
  },
4220
4405
  children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ X("div", {
4221
4406
  style: { flex: 1 },
4222
- children: /* @__PURE__ */ X(oi, { height: 14 })
4407
+ children: /* @__PURE__ */ X(Oi, { height: 14 })
4223
4408
  }, t))
4224
4409
  }), Array.from({ length: e }).map((e, n) => /* @__PURE__ */ X("div", {
4225
4410
  style: {
@@ -4228,12 +4413,12 @@ function si({ rows: e = 8, cols: t = 4 }) {
4228
4413
  },
4229
4414
  children: Array.from({ length: t }).map((e, t) => /* @__PURE__ */ X("div", {
4230
4415
  style: { flex: 1 },
4231
- children: /* @__PURE__ */ X(oi, { height: 28 })
4416
+ children: /* @__PURE__ */ X(Oi, { height: 28 })
4232
4417
  }, t))
4233
4418
  }, n))]
4234
4419
  });
4235
4420
  }
4236
- function ci() {
4421
+ function Ai() {
4237
4422
  return /* @__PURE__ */ Z("div", {
4238
4423
  style: {
4239
4424
  padding: 20,
@@ -4242,7 +4427,7 @@ function ci() {
4242
4427
  gap: 16
4243
4428
  },
4244
4429
  children: [
4245
- /* @__PURE__ */ X(oi, {
4430
+ /* @__PURE__ */ X(Oi, {
4246
4431
  height: 12,
4247
4432
  width: 160
4248
4433
  }),
@@ -4253,11 +4438,11 @@ function ci() {
4253
4438
  gap: 12
4254
4439
  },
4255
4440
  children: [/* @__PURE__ */ X("span", { style: {
4256
- ...ai,
4441
+ ...Di,
4257
4442
  width: 32,
4258
4443
  height: 32,
4259
4444
  borderRadius: 8
4260
- } }), /* @__PURE__ */ X(oi, {
4445
+ } }), /* @__PURE__ */ X(Oi, {
4261
4446
  height: 22,
4262
4447
  width: 240
4263
4448
  })]
@@ -4274,7 +4459,7 @@ function ci() {
4274
4459
  padding: "11px 14px",
4275
4460
  borderBottom: "1px solid var(--divider)"
4276
4461
  },
4277
- children: /* @__PURE__ */ X(oi, {
4462
+ children: /* @__PURE__ */ X(Oi, {
4278
4463
  height: 13,
4279
4464
  width: 150
4280
4465
  })
@@ -4290,12 +4475,12 @@ function ci() {
4290
4475
  display: "flex",
4291
4476
  gap: 16
4292
4477
  },
4293
- children: [/* @__PURE__ */ X(oi, {
4478
+ children: [/* @__PURE__ */ X(Oi, {
4294
4479
  height: 13,
4295
4480
  width: 110
4296
4481
  }), /* @__PURE__ */ X("div", {
4297
4482
  style: { flex: 1 },
4298
- children: /* @__PURE__ */ X(oi, { height: 13 })
4483
+ children: /* @__PURE__ */ X(Oi, { height: 13 })
4299
4484
  })]
4300
4485
  }, t))
4301
4486
  })]
@@ -4305,11 +4490,11 @@ function ci() {
4305
4490
  }
4306
4491
  //#endregion
4307
4492
  //#region src/lib/sort.ts
4308
- var li = {
4493
+ var ji = {
4309
4494
  nulls_first: "first",
4310
4495
  nulls_last: "last"
4311
4496
  };
4312
- function ui(e) {
4497
+ function Mi(e) {
4313
4498
  if (!e) return [];
4314
4499
  let t = [];
4315
4500
  for (let n of e.split(",")) {
@@ -4322,14 +4507,14 @@ function ui(e) {
4322
4507
  dir: r[1]?.trim().toLowerCase() === "desc" ? "desc" : "asc"
4323
4508
  }, o = r[2]?.trim().toLowerCase();
4324
4509
  if (o) {
4325
- let e = li[o];
4510
+ let e = ji[o];
4326
4511
  e && (a.nulls = e);
4327
4512
  }
4328
4513
  t.push(a);
4329
4514
  }
4330
4515
  return t;
4331
4516
  }
4332
- function di(e) {
4517
+ function Ni(e) {
4333
4518
  if (!e) return;
4334
4519
  let t = [];
4335
4520
  for (let n of e.split(",")) {
@@ -4340,63 +4525,63 @@ function di(e) {
4340
4525
  }
4341
4526
  return t.length > 0 ? t.join(",") : void 0;
4342
4527
  }
4343
- function fi(e) {
4528
+ function Pi(e) {
4344
4529
  return e.map((e) => {
4345
4530
  let t = `${e.field}:${e.dir}`;
4346
4531
  return e.nulls === "first" ? `${t}:nulls_first` : e.nulls === "last" ? `${t}:nulls_last` : t;
4347
4532
  }).join(",");
4348
4533
  }
4349
- function pi(e, t) {
4534
+ function Fi(e, t) {
4350
4535
  let n = e.findIndex((e) => e.field === t);
4351
4536
  return n >= 0 ? [...e.slice(0, n), ...e.slice(n + 1)] : e.length >= 5 ? e : [...e, {
4352
4537
  field: t,
4353
4538
  dir: "asc"
4354
4539
  }];
4355
4540
  }
4356
- function mi(e, t) {
4541
+ function Ii(e, t) {
4357
4542
  let n = e.filter((e) => e.field !== t.field);
4358
4543
  return n.length >= 5 ? e : [...n, t];
4359
4544
  }
4360
- function hi(e, t) {
4545
+ function Li(e, t) {
4361
4546
  let n = e.findIndex((e) => e.field === t);
4362
4547
  return n < 0 ? e : [...e.slice(0, n), ...e.slice(n + 1)];
4363
4548
  }
4364
4549
  //#endregion
4365
4550
  //#region src/hooks/useScreenBack.ts
4366
- function gi(e) {
4367
- let t = ze(), n = oe(), r = ae(), a = At((e) => e.depth), { data: o } = i(), s = e?.fallback, c = kt((e) => {
4551
+ function Ri(e) {
4552
+ let t = ze(), n = oe(), i = ae(), a = At((e) => e.depth), { data: o } = r(), s = e?.fallback, c = kt((e) => {
4368
4553
  let t = e.tabs.find((t) => t.id === e.activeTabId);
4369
4554
  return t ? t.returnTo : void 0;
4370
4555
  }), { hasOriginBack: l, allowFallbackBack: u } = K(() => It(c, n.enabled), [c, n.enabled]), d = W(() => {
4371
4556
  if (n.enabled) {
4372
- At.getState().depth > 0 ? r() : s?.();
4557
+ At.getState().depth > 0 ? i() : s?.();
4373
4558
  return;
4374
4559
  }
4375
- let e = kt.getState(), i = Lt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4376
- if (!i) {
4560
+ let e = kt.getState(), r = Lt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4561
+ if (!r) {
4377
4562
  s?.();
4378
4563
  return;
4379
4564
  }
4380
- if (i.kind === "live" && i.tabId) e.commitTabNavigation(i.tabId, { search: i.search ?? "" });
4381
- else if (i.kind === "reopen") {
4382
- let t = i.title ? void 0 : v(i.pathname, o?.screens, o?.entities);
4565
+ if (r.kind === "live" && r.tabId) e.commitTabNavigation(r.tabId, { search: r.search ?? "" });
4566
+ else if (r.kind === "reopen") {
4567
+ let t = r.title ? void 0 : m(r.pathname, o?.screens, o?.entities);
4383
4568
  e.openTab({
4384
- pathname: i.pathname,
4385
- search: i.search ?? "",
4386
- title: i.title ?? t?.title ?? i.pathname,
4387
- icon: i.icon ?? t?.icon,
4388
- screen: i.screen,
4569
+ pathname: r.pathname,
4570
+ search: r.search ?? "",
4571
+ title: r.title ?? t?.title ?? r.pathname,
4572
+ icon: r.icon ?? t?.icon,
4573
+ screen: r.screen,
4389
4574
  closable: !0
4390
4575
  });
4391
4576
  }
4392
4577
  t({
4393
- pathname: i.pathname,
4394
- search: Pt(i.search),
4395
- hash: i.hash || void 0
4578
+ pathname: r.pathname,
4579
+ search: Pt(r.search),
4580
+ hash: r.hash || void 0
4396
4581
  });
4397
4582
  }, [
4398
4583
  n.enabled,
4399
- r,
4584
+ i,
4400
4585
  s,
4401
4586
  t,
4402
4587
  o?.screens,
@@ -4411,40 +4596,40 @@ function gi(e) {
4411
4596
  }
4412
4597
  //#endregion
4413
4598
  //#region src/lib/field-classification.ts
4414
- function _i(e, t) {
4599
+ function zi(e, t) {
4415
4600
  let n = e?.field_access?.[t];
4416
4601
  return !n || n.read === "granted";
4417
4602
  }
4418
- function vi(e, t) {
4603
+ function Bi(e, t) {
4419
4604
  let n = e?.field_access?.[t];
4420
4605
  return !n || n.write === "granted";
4421
4606
  }
4422
- function yi(e, t) {
4607
+ function Vi(e, t) {
4423
4608
  return e?.field_access?.[t]?.classification;
4424
4609
  }
4425
- function bi(e, t) {
4610
+ function Hi(e, t) {
4426
4611
  return e?.field_access?.[t]?.required_permission;
4427
4612
  }
4428
- function xi(e, t, n) {
4429
- let r = yi(t, n);
4613
+ function Ui(e, t, n) {
4614
+ let r = Vi(t, n);
4430
4615
  if (r) return e?.classifications?.[r];
4431
4616
  }
4432
- function Si(e, t, n) {
4433
- return !!xi(e, t, n)?.sod_protected;
4617
+ function Wi(e, t, n) {
4618
+ return !!Ui(e, t, n)?.sod_protected;
4434
4619
  }
4435
- function Ci(e, t) {
4620
+ function Gi(e, t) {
4436
4621
  return e?.field_access?.[t];
4437
4622
  }
4438
4623
  //#endregion
4439
4624
  //#region src/components/pages/list/cardProjection.ts
4440
- var wi = 4, Ti = 2, Ei = 2, Di = [
4625
+ var Ki = 4, qi = 2, Ji = 2, Yi = [
4441
4626
  "screen_card",
4442
4627
  "entity_card",
4443
4628
  "saved_view_columns",
4444
4629
  "screen_default_columns",
4445
4630
  "screen_columns",
4446
4631
  "entity_inference"
4447
- ], Oi = /* @__PURE__ */ new Set(["_select", "_actions"]), ki = /* @__PURE__ */ new Set([
4632
+ ], Xi = /* @__PURE__ */ new Set(["_select", "_actions"]), Zi = /* @__PURE__ */ new Set([
4448
4633
  "text",
4449
4634
  "rich_text",
4450
4635
  "multilang_text",
@@ -4453,11 +4638,11 @@ var wi = 4, Ti = 2, Ei = 2, Di = [
4453
4638
  "secret",
4454
4639
  "password",
4455
4640
  "bytes"
4456
- ]), Ai = /* @__PURE__ */ new Set(["enum", "bool"]), ji = /* @__PURE__ */ new Set([
4641
+ ]), Qi = /* @__PURE__ */ new Set(["enum", "bool"]), $i = /* @__PURE__ */ new Set([
4457
4642
  "date",
4458
4643
  "time",
4459
4644
  "timestamp"
4460
- ]), Mi = /* @__PURE__ */ new Set([
4645
+ ]), ea = /* @__PURE__ */ new Set([
4461
4646
  "string",
4462
4647
  "text",
4463
4648
  "email",
@@ -4483,58 +4668,88 @@ var wi = 4, Ti = 2, Ei = 2, Di = [
4483
4668
  "enum",
4484
4669
  "status"
4485
4670
  ]);
4486
- function Ni(e) {
4671
+ function ta(e) {
4487
4672
  let { entity: t, screen: n, savedViewColumns: r } = e, i = n?.card;
4488
- if (i) return Ii(t, i, "screen_card");
4489
- if (t?.card) return Ii(t, t.card, "entity_card");
4490
- let a = zi(t, n, r);
4491
- return Li(t, a.columns, a.source);
4673
+ if (i) return oa(t, i, "screen_card");
4674
+ if (t?.card) return oa(t, t.card, "entity_card");
4675
+ let a = la(t, n, r);
4676
+ return sa(t, a.columns, a.source);
4492
4677
  }
4493
- function Pi(e) {
4494
- let { entity: t, screen: n, presentation: r, visibleColumns: i, card: a, rowActions: o, toolbarActions: s, bulkActions: c, sort: l, includeDetailHandoff: u = !0, screens: d } = e, f = new ma(), p = r === "cards" ? a.renderFields : Vi(t, i, { explicit: !0 });
4495
- for (let e of p) f.addField(e, "render"), da(t, e, f, "render");
4496
- let m = Qi(t, f), h = ra(t, [
4678
+ function na(e) {
4679
+ let { entity: t, screen: n, presentation: r, visibleColumns: i, card: a, rowActions: o, toolbarActions: s, bulkActions: c, sort: l, includeDetailHandoff: u = !0, screens: d } = e, f = new Ra(), p = r === "cards" ? a.renderFields : da(t, i, { explicit: !0 }), m = r === "cards" ? ia(t, n) : [];
4680
+ for (let e of p) f.addField(e, "render"), Fa(t, e, f, "render");
4681
+ for (let e of m) p.includes(e) || (f.addField(e, "variant"), Fa(t, e, f, "variant"));
4682
+ let h = Sa(t, f), g = Da(t, [
4497
4683
  o,
4498
4684
  s,
4499
4685
  c
4500
- ], f), g = ia(t, l, f), _ = aa(t, n, d, f);
4501
- if (u) for (let e of m) f.addField(e, "detail_handoff");
4502
- let v = new $();
4503
- for (let e of m) v.add(e);
4504
- for (let e of h) v.add(e);
4505
- for (let e of g) v.add(e);
4506
- for (let e of _) v.add(e);
4507
- let y = new $();
4508
- for (let e of p) ua(t, e, y, f);
4509
- for (let e of v.values()) ua(t, e, y, f);
4510
- let b = y.values(), x = fa(f);
4686
+ ], f), _ = ra(t, n, f), v = Oa(t, l, f), y = ka(t, n, d, f);
4687
+ if (u) for (let e of h) f.addField(e, "detail_handoff");
4688
+ let b = new $();
4689
+ for (let e of h) b.add(e);
4690
+ for (let e of g) b.add(e);
4691
+ for (let e of _) b.add(e);
4692
+ for (let e of m) b.add(e);
4693
+ for (let e of v) b.add(e);
4694
+ for (let e of y) b.add(e);
4695
+ let x = new $();
4696
+ for (let e of p) Pa(t, e, x, f);
4697
+ for (let e of b.values()) Pa(t, e, x, f);
4698
+ let S = x.values(), C = Ia(f);
4511
4699
  return {
4512
4700
  renderFields: p,
4513
- dependencyFields: v.values().filter((e) => !p.includes(e)),
4514
- conditionFields: h,
4515
- identityFields: m,
4516
- sortFields: g,
4517
- selectFields: b.length > 0 ? b : void 0,
4518
- expandFields: x.length > 0 ? x : void 0,
4701
+ dependencyFields: b.values().filter((e) => !p.includes(e)),
4702
+ conditionFields: g,
4703
+ identityFields: h,
4704
+ sortFields: v,
4705
+ selectFields: S.length > 0 ? S : void 0,
4706
+ expandFields: C.length > 0 ? C : void 0,
4519
4707
  reasons: f.snapshot()
4520
4708
  };
4521
4709
  }
4522
- function Fi(e, t, n) {
4710
+ function ra(e, t, n) {
4711
+ let r = new $(), i = (t) => {
4712
+ for (let n of t) n.and ? i(n.and) : n.or ? i(n.or) : n.field && e?.fields.has(n.field) && r.add(n.field);
4713
+ };
4714
+ for (let t of e?.variants?.items() ?? []) t.when && i(t.when);
4715
+ for (let e of t?.variants?.items() ?? []) e.when && i(e.when);
4716
+ for (let e of r.values()) n.addField(e, "variant");
4717
+ return r.values();
4718
+ }
4719
+ function ia(e, t, n) {
4720
+ let r = new $();
4721
+ for (let i of ta({
4722
+ entity: e,
4723
+ screen: t,
4724
+ savedViewColumns: n
4725
+ }).renderFields) r.add(i);
4726
+ for (let i of t?.variants?.items() ?? []) {
4727
+ let a = { ...t };
4728
+ i.card !== void 0 && (a.card = i.card);
4729
+ for (let t of ta({
4730
+ entity: e,
4731
+ screen: a,
4732
+ savedViewColumns: n
4733
+ }).renderFields) r.add(t);
4734
+ }
4735
+ return r.values();
4736
+ }
4737
+ function aa(e, t, n) {
4523
4738
  if (!e || t?.on_row_click !== "peek" || t.quick_peek?.enabled === !1) return [];
4524
4739
  let r = t.quick_peek?.fields;
4525
- if (r && r.length > 0) return Vi(e, r, { explicit: !0 });
4740
+ if (r && r.length > 0) return da(e, r, { explicit: !0 });
4526
4741
  let i = t.quick_peek?.sections;
4527
4742
  if (i && i.length > 0) {
4528
4743
  let r = Object.values(n ?? {}).find((e) => e.type === "detail" && e.entity === t.entity), a = new $();
4529
- oa(r?.items, new Set(i.map(String)), a);
4530
- let o = Vi(e, a.values(), { explicit: !0 });
4744
+ Aa(r?.items, new Set(i.map(String)), a);
4745
+ let o = da(e, a.values(), { explicit: !0 });
4531
4746
  if (o.length > 0) return o;
4532
4747
  }
4533
- return la(e);
4748
+ return Na(e);
4534
4749
  }
4535
- function Ii(e, t, n) {
4536
- let r = t.max_body_fields ?? wi, i = Hi(e, t.title_field, { explicit: !0 }), a = Hi(e, t.subtitle_field, { explicit: !0 }), o = Vi(e, t.badge_fields ?? [], { explicit: !0 }), s = Vi(e, t.fields ?? [], { explicit: !0 }), c = Vi(e, t.meta_fields ?? [], { explicit: !0 });
4537
- return Ri({
4750
+ function oa(e, t, n) {
4751
+ let r = t.max_body_fields ?? Ki, i = fa(e, t.title_field, { explicit: !0 }), a = fa(e, t.subtitle_field, { explicit: !0 }), o = da(e, t.badge_fields ?? [], { explicit: !0 }), s = da(e, t.fields ?? [], { explicit: !0 }), c = da(e, t.meta_fields ?? [], { explicit: !0 });
4752
+ return ca({
4538
4753
  source: n,
4539
4754
  explicit: !0,
4540
4755
  titleField: i,
@@ -4547,28 +4762,28 @@ function Ii(e, t, n) {
4547
4762
  maxBodyFields: r
4548
4763
  });
4549
4764
  }
4550
- function Li(e, t, n) {
4551
- let r = Vi(e, t, { explicit: !1 }), i = wi, a = Hi(e, e?.display?.display_field, { explicit: !1 }), o = a ?? Ui(e, r, {
4765
+ function sa(e, t, n) {
4766
+ let r = da(e, t, { explicit: !1 }), i = Ki, a = fa(e, e?.display?.display_field, { explicit: !1 }), o = a ?? pa(e, r, {
4552
4767
  allowLong: !1,
4553
4768
  allowAuto: !1
4554
- }), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => !c?.has(t) && Gi(e, t)), u = new Set([o, l].filter((e) => !!e)), d = qi(e, r).filter((e) => !u.has(e)).slice(0, Ti);
4769
+ }), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => !c?.has(t) && ha(e, t)), u = new Set([o, l].filter((e) => !!e)), d = _a(e, r).filter((e) => !u.has(e)).slice(0, qi);
4555
4770
  for (let e of d) u.add(e);
4556
- let f = r.filter((t) => !u.has(t) && Ji(e, t)).slice(0, Ei);
4771
+ let f = r.filter((t) => !u.has(t) && va(e, t)).slice(0, Ji);
4557
4772
  for (let e of f) u.add(e);
4558
- return Ri({
4773
+ return ca({
4559
4774
  source: n,
4560
4775
  explicit: !1,
4561
4776
  titleField: o,
4562
4777
  titleUsesDisplay: s,
4563
4778
  subtitleField: l,
4564
4779
  badgeFields: d,
4565
- bodyFields: r.filter((t) => !u.has(t) && Wi(e, t)).slice(0, i),
4780
+ bodyFields: r.filter((t) => !u.has(t) && ma(e, t)).slice(0, i),
4566
4781
  metaFields: f,
4567
4782
  hideEmptyFields: !0,
4568
4783
  maxBodyFields: i
4569
4784
  });
4570
4785
  }
4571
- function Ri(e) {
4786
+ function ca(e) {
4572
4787
  let t = new $(), n = [], r = (r, i) => {
4573
4788
  !r || t.has(r) || (t.add(r), n.push({
4574
4789
  field: r,
@@ -4593,10 +4808,10 @@ function Ri(e) {
4593
4808
  maxBodyFields: e.maxBodyFields,
4594
4809
  renderFields: t.values(),
4595
4810
  fields: n,
4596
- sourcePrecedence: Di
4811
+ sourcePrecedence: Yi
4597
4812
  };
4598
4813
  }
4599
- function zi(e, t, n) {
4814
+ function la(e, t, n) {
4600
4815
  return n && n.length > 0 ? {
4601
4816
  source: "saved_view_columns",
4602
4817
  columns: n
@@ -4608,10 +4823,10 @@ function zi(e, t, n) {
4608
4823
  columns: t.columns
4609
4824
  } : {
4610
4825
  source: "entity_inference",
4611
- columns: Bi(e)
4826
+ columns: ua(e)
4612
4827
  };
4613
4828
  }
4614
- function Bi(e) {
4829
+ function ua(e) {
4615
4830
  if (!e) return [];
4616
4831
  let t = [];
4617
4832
  e.display.display_field && t.push(e.display.display_field);
@@ -4621,16 +4836,16 @@ function Bi(e) {
4621
4836
  if (e.evidence_covered && t.push("$evidence"), e.files) for (let [n] of e.files) t.push(n);
4622
4837
  return t;
4623
4838
  }
4624
- function Vi(e, t, n) {
4839
+ function da(e, t, n) {
4625
4840
  let r = new $();
4626
4841
  for (let i of t) {
4627
- let t = Hi(e, i, n);
4842
+ let t = fa(e, i, n);
4628
4843
  t && r.add(t);
4629
4844
  }
4630
4845
  return r.values();
4631
4846
  }
4632
- function Hi(e, t, n) {
4633
- if (!t || Oi.has(t)) return;
4847
+ function fa(e, t, n) {
4848
+ if (!t || Xi.has(t)) return;
4634
4849
  if (!e) return t.startsWith("$") ? void 0 : t;
4635
4850
  if (t.startsWith("$status.")) {
4636
4851
  let n = t.slice(8);
@@ -4645,55 +4860,55 @@ function Hi(e, t, n) {
4645
4860
  let r = e.fields.get(t), i = e.files?.get(t);
4646
4861
  if (!(!r && !i) && (n.explicit || !(r && r.display?.is_listable === !1) && !(i && i.display?.is_listable === !1))) return t;
4647
4862
  }
4648
- function Ui(e, t, n) {
4649
- return t.find((t) => n.exclude?.has(t) || !n.allowAuto && Xi(e, t) || !n.allowLong && Zi(e, t) ? !1 : Yi(e, t));
4863
+ function pa(e, t, n) {
4864
+ return t.find((t) => n.exclude?.has(t) || !n.allowAuto && ba(e, t) || !n.allowLong && xa(e, t) ? !1 : ya(e, t));
4650
4865
  }
4651
- function Wi(e, t) {
4652
- return !(!Yi(e, t) || Xi(e, t) || Zi(e, t));
4866
+ function ma(e, t) {
4867
+ return !(!ya(e, t) || ba(e, t) || xa(e, t));
4653
4868
  }
4654
- function Gi(e, t) {
4655
- return !(!Yi(e, t) || Xi(e, t) || Zi(e, t) || Ji(e, t) || Ki(e, t));
4869
+ function ha(e, t) {
4870
+ return !(!ya(e, t) || ba(e, t) || xa(e, t) || va(e, t) || ga(e, t));
4656
4871
  }
4657
- function Ki(e, t) {
4872
+ function ga(e, t) {
4658
4873
  if (t.startsWith("$status.") || t.startsWith("$property.") || t === "$evidence") return !0;
4659
- let n = pa(e, t);
4660
- return n.kind === "field" && Ai.has(n.field.type);
4874
+ let n = La(e, t);
4875
+ return n.kind === "field" && Qi.has(n.field.type);
4661
4876
  }
4662
- function qi(e, t) {
4877
+ function _a(e, t) {
4663
4878
  let n = new $();
4664
4879
  for (let e of t) (e.startsWith("$status.") || e.startsWith("$property.") || e === "$evidence") && n.add(e);
4665
- for (let r of t) Ki(e, r) && n.add(r);
4880
+ for (let r of t) ga(e, r) && n.add(r);
4666
4881
  return n.values();
4667
4882
  }
4668
- function Ji(e, t) {
4669
- if (Xi(e, t)) return !1;
4670
- let n = pa(e, t);
4671
- return n.kind === "field" && ji.has(n.field.type);
4883
+ function va(e, t) {
4884
+ if (ba(e, t)) return !1;
4885
+ let n = La(e, t);
4886
+ return n.kind === "field" && $i.has(n.field.type);
4672
4887
  }
4673
- function Yi(e, t) {
4674
- return pa(e, t).kind !== "missing";
4888
+ function ya(e, t) {
4889
+ return La(e, t).kind !== "missing";
4675
4890
  }
4676
- function Xi(e, t) {
4677
- let n = pa(e, t);
4891
+ function ba(e, t) {
4892
+ let n = La(e, t);
4678
4893
  return n.kind === "field" && (n.field.primary === !0 || n.field.auto === !0);
4679
4894
  }
4680
- function Zi(e, t) {
4681
- let n = pa(e, t);
4682
- return n.kind === "file" ? n.file.mode !== "single" : n.kind === "field" && ki.has(n.field.type);
4895
+ function xa(e, t) {
4896
+ let n = La(e, t);
4897
+ return n.kind === "file" ? n.file.mode !== "single" : n.kind === "field" && Zi.has(n.field.type);
4683
4898
  }
4684
- function Qi(e, t) {
4899
+ function Sa(e, t) {
4685
4900
  if (!e) return [];
4686
4901
  let n = new $();
4687
- for (let r of s(e)) n.add(r), t.addField(r, "identity");
4688
- let r = Hi(e, e.display.display_field, { explicit: !0 });
4689
- r && (n.add(r), t.addField(r, "display"), da(e, r, t, "display"));
4690
- for (let r of $i(e.display.display_template)) {
4691
- let i = Hi(e, r, { explicit: !0 });
4692
- i && (n.add(i), t.addField(i, "display_template"), da(e, i, t, "display_template"));
4902
+ for (let r of fe(e)) n.add(r), t.addField(r, "identity");
4903
+ let r = fa(e, e.display.display_field, { explicit: !0 });
4904
+ r && (n.add(r), t.addField(r, "display"), Fa(e, r, t, "display"));
4905
+ for (let r of Ca(e.display.display_template)) {
4906
+ let i = fa(e, r, { explicit: !0 });
4907
+ i && (n.add(i), t.addField(i, "display_template"), Fa(e, i, t, "display_template"));
4693
4908
  }
4694
4909
  return n.values();
4695
4910
  }
4696
- function $i(e) {
4911
+ function Ca(e) {
4697
4912
  if (!e) return [];
4698
4913
  let t = new $(), n = 0;
4699
4914
  for (; n < e.length;) {
@@ -4703,14 +4918,14 @@ function $i(e) {
4703
4918
  n = r + 2;
4704
4919
  continue;
4705
4920
  }
4706
- let i = ea(e, r + 2);
4921
+ let i = wa(e, r + 2);
4707
4922
  if (i < 0) break;
4708
- for (let n of ta(e.slice(r + 2, i))) t.add(n);
4923
+ for (let n of Ta(e.slice(r + 2, i))) t.add(n);
4709
4924
  n = i + 1;
4710
4925
  }
4711
4926
  return t.values();
4712
4927
  }
4713
- function ea(e, t) {
4928
+ function wa(e, t) {
4714
4929
  let n = 0;
4715
4930
  for (let r = t; r < e.length; r += 1) {
4716
4931
  let t = e[r];
@@ -4725,62 +4940,71 @@ function ea(e, t) {
4725
4940
  }
4726
4941
  return -1;
4727
4942
  }
4728
- function ta(e) {
4943
+ function Ta(e) {
4729
4944
  let t = new $(), n = 0;
4730
4945
  for (; n < e.length;) {
4731
4946
  let r = e.indexOf("row.", n);
4732
4947
  if (r < 0) break;
4733
- if (r > 0 && na(e.charCodeAt(r - 1))) {
4948
+ if (r > 0 && Ea(e.charCodeAt(r - 1))) {
4734
4949
  n = r + 4;
4735
4950
  continue;
4736
4951
  }
4737
4952
  let i = r + 4, a = i;
4738
- for (; a < e.length && na(e.charCodeAt(a));) a += 1;
4953
+ for (; a < e.length && Ea(e.charCodeAt(a));) a += 1;
4739
4954
  a > i && t.add(e.slice(i, a)), n = a;
4740
4955
  }
4741
4956
  return t.values();
4742
4957
  }
4743
- function na(e) {
4958
+ function Ea(e) {
4744
4959
  return e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 95;
4745
4960
  }
4746
- function ra(e, t, n) {
4961
+ function Da(e, t, n) {
4747
4962
  let r = new $();
4748
4963
  for (let i of t) for (let t of i ?? []) for (let i of [
4749
4964
  ...t.action.visible_if ?? [],
4750
4965
  ...t.action.enabled_if ?? [],
4751
4966
  ...t.action.conditions ?? []
4752
4967
  ]) {
4753
- let t = Hi(e, i.field, { explicit: !0 });
4754
- t && (r.add(t), n.addField(t, "condition"), da(e, t, n, "condition"));
4968
+ let t = fa(e, i.field, { explicit: !0 });
4969
+ t && (r.add(t), n.addField(t, "condition"), Fa(e, t, n, "condition"));
4755
4970
  }
4756
4971
  return r.values();
4757
4972
  }
4758
- function ia(e, t, n) {
4759
- let r = typeof t == "string" ? ui(t) : t ?? [], i = new $();
4973
+ function Oa(e, t, n) {
4974
+ let r = typeof t == "string" ? Mi(t) : t ?? [], i = new $();
4760
4975
  for (let t of r) {
4761
- let r = Hi(e, t.field, { explicit: !0 });
4762
- r && (i.add(r), n.addField(r, "sort"), da(e, r, n, "sort"));
4976
+ let r = fa(e, t.field, { explicit: !0 });
4977
+ r && (i.add(r), n.addField(r, "sort"), Fa(e, r, n, "sort"));
4763
4978
  }
4764
4979
  return i.values();
4765
4980
  }
4766
- function aa(e, t, n, r) {
4767
- let i = Fi(e, t, n);
4768
- for (let t of i) r.addField(t, "quick_peek"), da(e, t, r, "quick_peek");
4769
- return i;
4981
+ function ka(e, t, n, r) {
4982
+ let i = new $(), a = t?.variants?.items() ?? [];
4983
+ if (a.length === 0 || a.some((e) => e.quick_peek === void 0)) for (let r of aa(e, t, n)) i.add(r);
4984
+ for (let r of a) {
4985
+ if (r.quick_peek === void 0) continue;
4986
+ let a = {
4987
+ ...t,
4988
+ quick_peek: r.quick_peek
4989
+ };
4990
+ for (let t of aa(e, a, n)) i.add(t);
4991
+ }
4992
+ for (let t of i.values()) r.addField(t, "quick_peek"), Fa(e, t, r, "quick_peek");
4993
+ return i.values();
4770
4994
  }
4771
- function oa(e, t, n) {
4995
+ function Aa(e, t, n) {
4772
4996
  if (Array.isArray(e)) {
4773
4997
  for (let r of e) if (!(!r || typeof r != "object")) {
4774
4998
  if ("section" in r) {
4775
- let e = r.section, i = ca(e?.name);
4776
- i && t.has(i) && sa(e?.items, n);
4999
+ let e = r.section, i = Ma(e?.name);
5000
+ i && t.has(i) && ja(e?.items, n);
4777
5001
  continue;
4778
5002
  }
4779
- "fields" in r && sa([r], n);
5003
+ "fields" in r && ja([r], n);
4780
5004
  }
4781
5005
  }
4782
5006
  }
4783
- function sa(e, t) {
5007
+ function ja(e, t) {
4784
5008
  if (Array.isArray(e)) {
4785
5009
  for (let n of e) if (!(!n || typeof n != "object")) {
4786
5010
  if ("fields" in n) {
@@ -4793,11 +5017,11 @@ function sa(e, t) {
4793
5017
  }
4794
5018
  }
4795
5019
  }
4796
- "section" in n && sa(n.section?.items, t);
5020
+ "section" in n && ja(n.section?.items, t);
4797
5021
  }
4798
5022
  }
4799
5023
  }
4800
- function ca(e) {
5024
+ function Ma(e) {
4801
5025
  if (typeof e == "string") return e;
4802
5026
  if (e && typeof e == "object") {
4803
5027
  let t = Object.values(e).find((e) => typeof e == "string");
@@ -4805,21 +5029,21 @@ function ca(e) {
4805
5029
  }
4806
5030
  return "";
4807
5031
  }
4808
- function la(e) {
5032
+ function Na(e) {
4809
5033
  let t = [];
4810
5034
  for (let [n, r] of e.fields) {
4811
5035
  if (r.primary || r.auto || r.ref || r.array || r.structure || r.display?.is_listable === !1) continue;
4812
5036
  let e = (r.type || "").toLowerCase(), i = !!(r.enum || r.values);
4813
- if (!(!Mi.has(e) && !i) && (t.push(n), t.length >= 8)) break;
5037
+ if (!(!ea.has(e) && !i) && (t.push(n), t.length >= 8)) break;
4814
5038
  }
4815
5039
  return t;
4816
5040
  }
4817
- function ua(e, t, n, r) {
5041
+ function Pa(e, t, n, r) {
4818
5042
  if (!t || t.startsWith("$")) return;
4819
- let i = pa(e, t);
5043
+ let i = La(e, t);
4820
5044
  i.kind !== "missing" && (n.add(t), i.kind === "file" && r.addField(t, "file_metadata"));
4821
5045
  }
4822
- function da(e, t, n, r) {
5046
+ function Fa(e, t, n, r) {
4823
5047
  if (t.startsWith("$status.")) {
4824
5048
  n.addExpand("statuses", "status_expand"), r !== "status_expand" && n.addExpand("statuses", r), r !== "status_expand" && n.addField(t, r);
4825
5049
  return;
@@ -4834,14 +5058,14 @@ function da(e, t, n, r) {
4834
5058
  n.addExpand("evidence", "evidence_expand"), r !== "evidence_expand" && n.addExpand("evidence", r), r !== "evidence_expand" && n.addField(t, r);
4835
5059
  return;
4836
5060
  }
4837
- let i = pa(e, t);
5061
+ let i = La(e, t);
4838
5062
  i.kind === "field" && i.field.type === "ref" && (n.addExpand("refs", "ref_expand"), r !== "ref_expand" && n.addExpand("refs", r));
4839
5063
  }
4840
- function fa(e) {
5064
+ function Ia(e) {
4841
5065
  let t = e.snapshot().expand, n = [];
4842
5066
  return t.refs && n.push("refs"), t.statuses && n.push("statuses"), t.properties && n.push("properties"), t.evidence && n.push("evidence"), n;
4843
5067
  }
4844
- function pa(e, t) {
5068
+ function La(e, t) {
4845
5069
  if (!e) return { kind: t.startsWith("$") ? "synthetic" : "missing" };
4846
5070
  if (t.startsWith("$status.")) return e.status_groups?.[t.slice(8)] ? { kind: "synthetic" } : { kind: "missing" };
4847
5071
  if (t.startsWith("$property.")) return e.properties?.[t.slice(10)] ? { kind: "synthetic" } : { kind: "missing" };
@@ -4869,7 +5093,7 @@ var $ = class {
4869
5093
  values() {
4870
5094
  return [...this.#e];
4871
5095
  }
4872
- }, ma = class {
5096
+ }, Ra = class {
4873
5097
  #e = /* @__PURE__ */ new Map();
4874
5098
  #t = /* @__PURE__ */ new Map();
4875
5099
  addField(e, t) {
@@ -4892,7 +5116,7 @@ var $ = class {
4892
5116
  }
4893
5117
  r.includes(n) || r.push(n);
4894
5118
  }
4895
- }, ha = class extends Ne {
5119
+ }, za = class extends Ne {
4896
5120
  constructor(e) {
4897
5121
  super(e), this.state = {
4898
5122
  hasError: !1,
@@ -4949,7 +5173,7 @@ var $ = class {
4949
5173
  },
4950
5174
  children: this.state.error?.message || "An unexpected error occurred."
4951
5175
  }),
4952
- /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(V, {
5176
+ /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(U, {
4953
5177
  onClick: this.handleRetry,
4954
5178
  children: "Try again"
4955
5179
  }) })
@@ -4960,32 +5184,32 @@ var $ = class {
4960
5184
  };
4961
5185
  //#endregion
4962
5186
  //#region src/hooks/useObject.ts
4963
- function ga(e, t) {
5187
+ function Ba(e, t) {
4964
5188
  return [
4965
5189
  "entity-item",
4966
5190
  e,
4967
5191
  t === void 0 || t === "new" ? void 0 : typeof t == "string" ? t : Object.keys(t).sort().map((e) => [e, t[e]])
4968
5192
  ];
4969
5193
  }
4970
- function _a(e, t) {
4971
- let n = ga(e, t), r = n[2];
5194
+ function Va(e, t) {
5195
+ let n = Ba(e, t), r = n[2];
4972
5196
  return He({
4973
5197
  queryKey: n,
4974
- queryFn: () => S(e, t),
5198
+ queryFn: () => x(e, t),
4975
5199
  enabled: !!e && !!t && t !== "new" && r !== void 0
4976
5200
  });
4977
5201
  }
4978
5202
  //#endregion
4979
5203
  //#region src/components/detail-layout/widgets/registry.ts
4980
- var va = /* @__PURE__ */ new Map();
4981
- function ya(e, t) {
4982
- va.set(e, t);
5204
+ var Ha = /* @__PURE__ */ new Map();
5205
+ function Ua(e, t) {
5206
+ Ha.set(e, t);
4983
5207
  }
4984
- function ba(e) {
4985
- return va.get(e);
5208
+ function Wa(e) {
5209
+ return Ha.get(e);
4986
5210
  }
4987
- function xa(e) {
4988
- return va.has(e);
5211
+ function Ga(e) {
5212
+ return Ha.has(e);
4989
5213
  }
4990
5214
  //#endregion
4991
- export { Jt as $, Hr as A, Zn as B, di as C, ri as D, ti as E, ir as F, Cn as G, Yn as H, rr as I, Dn as J, Tn as K, tr as L, jr as M, Cr as N, ii as O, or as P, an as Q, nr as R, fi as S, si as T, In as U, er as V, Ln as W, sn as X, En as Y, on as Z, gi as _, _a as a, jt as at, ui as b, Pi as c, Et as ct, Ci as d, ct as dt, qt as et, yi as f, ft, vi as g, Si as h, ga as i, Bt as it, Fr as j, ni as k, Fi as l, bt as lt, _i as m, Je as mt, xa as n, Wt as nt, ha as o, Mt as ot, bi as p, Ye as pt, On as q, ya as r, Ht as rt, Ni as s, At as st, ba as t, Ut as tt, xi as u, kt as ut, mi as v, ci as w, hi as x, pi as y, zn as z };
5215
+ export { Tn as $, wi as A, Cr as B, Pi as C, Ci as D, ki as E, Jr as F, nr as G, ir as H, Zr as I, er as J, zn as K, Yr as L, ri as M, Xr as N, Ti as O, $r as P, Cn as Q, zr as R, Li as S, Ai as T, rr as U, or as V, tr as W, In as X, Yn as Y, Ln as Z, Bi as _, kt as _t, Va as a, an as at, Fi as b, Ye as bt, na as c, Ut as ct, Ui as d, Bt as dt, On as et, Gi as f, jt as ft, Wi as g, bt as gt, zi as h, Et as ht, Ba as i, on as it, ui as j, Ei as k, aa as l, Wt as lt, Hi as m, At as mt, Ga as n, En as nt, za as o, Jt as ot, Vi as p, Mt as pt, Zn as q, Ua as r, sn as rt, ta as s, qt as st, Wa as t, Dn as tt, ia as u, Ht as ut, Ri as v, ct as vt, Ni as w, Mi as x, Je as xt, Ii as y, ft as yt, jr as z };