@declarion/react 0.40.0 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { $ as n, A as r, An as i, At as a, Dn as o, En as s, Fn as c, Jn as l, Kt as u, M as d, Q as f, Sn as p, Tn as m, Un as h, X as g, ar as _, bn as v, bt as y, er as b, f as x, hn as S, it as C, j as w, jn as T, or as E, sr as D, vt as O, wn as k, xn as A, yt as j } from "./useCurrentScreen-mw8TfE8q.js";
3
- import { A as M, F as ee, I as N, J as P, L as F, P as I, R as L, T as R, V as z, at as B, d as V, it as te, mt as ne, o as re, pt as ie, q as ae, r as oe, t as se, u as ce, z as le } from "./registry-DFtAh6zc.js";
4
- import { n as ue, r as de, t as fe } from "./dataTableStyles-vwD1mVOP.js";
5
- import { Suspense as pe, createContext as me, lazy as he, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
2
+ import { $ as n, A as r, An as i, At as a, Dn as o, En as s, Fn as c, Kt as l, M as u, Q as d, Sn as f, Tn as p, Wn as m, X as h, Yn as g, bn as _, bt as v, cr as y, f as b, hn as x, it as S, j as C, jn as w, or as T, sr as E, tr as D, vt as O, wn as k, xn as A, yt as j } from "./useCurrentScreen-C33VZcNn.js";
3
+ import { A as M, F as ee, I as te, J as N, L as P, P as F, R as I, T as L, V as R, at as z, d as B, it as ne, mt as re, o as ie, pt as ae, q as oe, r as se, t as ce, u as le, z as ue } from "./registry-DbZX1hy8.js";
4
+ import { n as de, r as fe, t as pe } from "./dataTableStyles-vwD1mVOP.js";
5
+ import { Suspense as me, createContext as he, lazy as V, useCallback as H, useContext as ge, useEffect as U, useId as _e, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K } from "react";
6
6
  import { useInfiniteQuery as ye, useMutation as be, useQueryClient as xe } from "@tanstack/react-query";
7
7
  import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
8
8
  //#region src/lib/size-value.ts
@@ -61,16 +61,16 @@ function we({ config: e, ctx: t }) {
61
61
  }, [u, p]), h = u ?? p(), g = e.height ? Ee(e.height) : void 0;
62
62
  return /* @__PURE__ */ J("div", {
63
63
  ref: l,
64
- className: B("flex", s && "flex-col"),
64
+ className: z("flex", s && "flex-col"),
65
65
  style: {
66
66
  gap: r ? `${r}px` : void 0,
67
67
  ...g
68
68
  },
69
69
  children: n.map((r, a) => /* @__PURE__ */ Y("div", {
70
- className: B("min-w-0 flex items-stretch", s && "w-full"),
70
+ className: z("min-w-0 flex items-stretch", s && "w-full"),
71
71
  style: s ? void 0 : Te(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
72
  children: [/* @__PURE__ */ J("div", {
73
- className: B("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
73
+ className: z("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
74
  children: /* @__PURE__ */ J($, {
75
75
  node: r,
76
76
  ctx: t
@@ -123,13 +123,13 @@ function Oe(e) {
123
123
  function ke(e, t) {
124
124
  let n = Oe(e);
125
125
  if (n) {
126
- if (e.label) return m(e.label);
126
+ if (e.label) return p(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return m(r.display.name);
128
+ if (r?.display?.name) return p(r.display.name);
129
129
  let i = t.schema.entities[n];
130
- return i && (m(i.display.name_plural) || m(i.display.name)) || n;
130
+ return i && (p(i.display.name_plural) || p(i.display.name)) || n;
131
131
  }
132
- return e.section ? m(e.section.name) : "Tab";
132
+ return e.section ? p(e.section.name) : "Tab";
133
133
  }
134
134
  function Ae(e, t) {
135
135
  if (e.icon) return e.icon;
@@ -144,7 +144,7 @@ function Ae(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function je({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = K(0), o = b(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
147
+ let { items: r } = e, [i, a] = K(0), o = D(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
148
148
  if (r.length === 0) return null;
149
149
  if (s === "sections") {
150
150
  let e = r.map((e, t) => `detail-tab-section-${t}`);
@@ -339,12 +339,12 @@ function Me({ config: e, ctx: n }) {
339
339
  name: s,
340
340
  size: 14
341
341
  }) : void 0, f = c ? {
342
- text: m(c.text),
342
+ text: p(c.text),
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
- return /* @__PURE__ */ J(ne, {
347
- title: m(r),
346
+ return /* @__PURE__ */ J(re, {
347
+ title: p(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
350
  badge: f,
@@ -383,7 +383,7 @@ function X(e, t, n) {
383
383
  return e ?? t ?? n;
384
384
  }
385
385
  function Pe(e) {
386
- return v(e, "update") ? "inline_edit" : "readonly";
386
+ return _(e, "update") ? "inline_edit" : "readonly";
387
387
  }
388
388
  function Fe(e) {
389
389
  return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
@@ -491,13 +491,13 @@ function qe(e, t) {
491
491
  function Je(e, t, n, r) {
492
492
  let [i, a] = K(() => {
493
493
  let t = e.quick_add, n = r.entities[e.entity], i = {};
494
- if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = f()) : i[e] = t.defaults[e];
494
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = d()) : i[e] = t.defaults[e];
495
495
  return i;
496
- }), o = xe(), { mutate: c, isPending: l, error: u, reset: d } = be({
496
+ }), o = xe(), { mutate: c, isPending: l, error: u, reset: f } = be({
497
497
  mutationFn: (t) => O(e.entity, t),
498
498
  onMutate: async (r) => {
499
499
  let i = [
500
- F,
500
+ P,
501
501
  t,
502
502
  Array.isArray(n) ? s(n.map(String)) : n,
503
503
  e.entity
@@ -528,13 +528,13 @@ function Je(e, t, n, r) {
528
528
  },
529
529
  onSuccess: () => {
530
530
  let t = e.quick_add, n = r.entities[e.entity], i = {};
531
- if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = f() : i[e] = "" : i[e] = t.defaults[e];
531
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = d() : i[e] = "" : i[e] = t.defaults[e];
532
532
  a(i);
533
533
  },
534
534
  onSettled: () => {
535
535
  let r = Array.isArray(n) ? s(n.map(String)) : n;
536
536
  o.invalidateQueries({ queryKey: [
537
- F,
537
+ P,
538
538
  t,
539
539
  r,
540
540
  e.entity
@@ -547,7 +547,7 @@ function Je(e, t, n, r) {
547
547
  c(r);
548
548
  }
549
549
  function _(e, t) {
550
- u && d(), a((n) => ({
550
+ u && f(), a((n) => ({
551
551
  ...n,
552
552
  [e]: t
553
553
  }));
@@ -566,9 +566,9 @@ function Je(e, t, n, r) {
566
566
  //#endregion
567
567
  //#region src/components/detail-layout/QuickAddForm.tsx
568
568
  function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
569
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: m } = Je(t, n, i, a), h = r(), g = b(), _ = _e();
569
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: p, handleFieldChange: m } = Je(t, n, i, a), h = r(), g = D(), _ = _e();
570
570
  return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
571
- onSubmit: f,
571
+ onSubmit: p,
572
572
  style: {
573
573
  display: "flex",
574
574
  flexDirection: g.isPhone ? "column" : "row",
@@ -598,8 +598,8 @@ function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
598
598
  display: "block",
599
599
  fontWeight: 500
600
600
  },
601
- children: p(n, e, a.entities)
602
- }), w({
601
+ children: f(n, e, a.entities)
602
+ }), C({
603
603
  field: n,
604
604
  fieldName: e,
605
605
  value: o[e] ?? "",
@@ -612,7 +612,7 @@ function Ye({ config: t, parentEntity: n, parentId: i, schema: a }) {
612
612
  })]
613
613
  }, e);
614
614
  }),
615
- /* @__PURE__ */ J(D, {
615
+ /* @__PURE__ */ J(y, {
616
616
  type: "submit",
617
617
  kind: "primary",
618
618
  size: g.isPhone ? "md" : "sm",
@@ -639,10 +639,10 @@ function Xe(e, t, n) {
639
639
  return `${e}::child::${t}.${n}`;
640
640
  }
641
641
  function Ze(e) {
642
- return Math.min(le, Math.max(60, Math.round(e)));
642
+ return Math.min(ue, Math.max(60, Math.round(e)));
643
643
  }
644
644
  function Qe(e) {
645
- let { widths: t, setWidths: n, resetWidths: r } = z(e), [i, a] = K({}), o = G(null);
645
+ let { widths: t, setWidths: n, resetWidths: r } = R(e), [i, a] = K({}), o = G(null);
646
646
  U(() => {
647
647
  let e = (e) => {
648
648
  let t = o.current;
@@ -726,31 +726,31 @@ function $e({ colId: e, onMouseDown: t }) {
726
726
  //#endregion
727
727
  //#region src/components/detail-layout/ChildrenTable.tsx
728
728
  function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
729
- let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, u = Qe(Xe(n, t.entity, s)), f = r(), m = N((e) => e.degradedEntities), { data: h, isLoading: g, isError: v, isFetching: y, refetch: b } = L(n, i, t.entity, t.foreign_key, t.sort, t.limit), x = h?.data ?? [], S = h?.$refs, C = G(S);
730
- C.current = S;
731
- let w = t.columns, D = t.interaction === "navigate", O = w[0], k = D && o ? T(void 0, o, a.screens) : null, A = o ? We(o) : void 0, j = W(() => {
729
+ let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, l = Qe(Xe(n, t.entity, s)), d = r(), p = te((e) => e.degradedEntities), { data: m, isLoading: h, isError: _, isFetching: v, refetch: y } = I(n, i, t.entity, t.foreign_key, t.sort, t.limit), b = m?.data ?? [], x = m?.$refs, S = G(x);
730
+ S.current = x;
731
+ let C = t.columns, D = t.interaction === "navigate", O = C[0], k = D && o ? w(void 0, o, a.screens) : null, A = o ? We(o) : void 0, j = W(() => {
732
732
  let e = /* @__PURE__ */ new Map();
733
733
  if (!o) return e;
734
- for (let t of w) {
734
+ for (let t of C) {
735
735
  let n = o.fields.get(t);
736
- n && e.set(t, d({
736
+ n && e.set(t, u({
737
737
  field: n,
738
738
  fieldName: t,
739
739
  surface: "list",
740
740
  entity: o,
741
741
  entities: a.entities,
742
742
  screens: a.screens,
743
- refs: () => C.current,
744
- locale: f
743
+ refs: () => S.current,
744
+ locale: d
745
745
  }));
746
746
  }
747
747
  return e;
748
748
  }, [
749
749
  o,
750
- w,
750
+ C,
751
751
  a.entities,
752
752
  a.screens,
753
- f
753
+ d
754
754
  ]);
755
755
  if (!o) return /* @__PURE__ */ J("div", {
756
756
  style: {
@@ -765,7 +765,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
765
765
  parentEntity: n,
766
766
  parentId: i,
767
767
  schema: a
768
- }), P = ee(o.realtime, m, t.entity), F = /* @__PURE__ */ Y("div", {
768
+ }), N = ee(o.realtime, p, t.entity), P = /* @__PURE__ */ Y("div", {
769
769
  style: {
770
770
  display: "flex",
771
771
  alignItems: "center",
@@ -774,16 +774,16 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
774
774
  justifyContent: "flex-end"
775
775
  },
776
776
  children: [
777
- u.hasWidths && /* @__PURE__ */ J(E, {
777
+ l.hasWidths && /* @__PURE__ */ J(E, {
778
778
  icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
779
779
  title: "Reset column widths (this device)",
780
780
  size: 24,
781
- onClick: u.resetWidths
781
+ onClick: l.resetWidths
782
782
  }),
783
- P && /* @__PURE__ */ J("span", {
783
+ N && /* @__PURE__ */ J("span", {
784
784
  "data-testid": "children-live-indicator",
785
785
  title: "This table updates automatically in realtime.",
786
- children: /* @__PURE__ */ J(_, {
786
+ children: /* @__PURE__ */ J(T, {
787
787
  tone: "emerald",
788
788
  size: "xs",
789
789
  dot: !0,
@@ -791,23 +791,23 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
791
791
  })
792
792
  }),
793
793
  /* @__PURE__ */ J(E, {
794
- icon: y ? /* @__PURE__ */ J("span", {
794
+ icon: v ? /* @__PURE__ */ J("span", {
795
795
  "data-testid": "children-refresh-spinner",
796
796
  style: { display: "inline-flex" },
797
- children: /* @__PURE__ */ J(l, { size: 13 })
797
+ children: /* @__PURE__ */ J(g, { size: 13 })
798
798
  }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
799
799
  title: "Refresh",
800
800
  size: 24,
801
- disabled: y,
801
+ disabled: v,
802
802
  onClick: () => {
803
- b();
803
+ y();
804
804
  }
805
805
  })
806
806
  ]
807
807
  });
808
- return v ? /* @__PURE__ */ Y("div", { children: [
808
+ return _ ? /* @__PURE__ */ Y("div", { children: [
809
809
  M,
810
- F,
810
+ P,
811
811
  /* @__PURE__ */ J("div", {
812
812
  style: {
813
813
  fontSize: 12.5,
@@ -816,9 +816,9 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
816
816
  },
817
817
  children: "Failed to load. Try again."
818
818
  })
819
- ] }) : g ? /* @__PURE__ */ Y("div", { children: [
819
+ ] }) : h ? /* @__PURE__ */ Y("div", { children: [
820
820
  M,
821
- F,
821
+ P,
822
822
  /* @__PURE__ */ J("div", {
823
823
  style: {
824
824
  display: "flex",
@@ -836,9 +836,9 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
836
836
  borderRadius: 4
837
837
  } }, e))
838
838
  })
839
- ] }) : x.length === 0 ? /* @__PURE__ */ Y("div", { children: [
839
+ ] }) : b.length === 0 ? /* @__PURE__ */ Y("div", { children: [
840
840
  M,
841
- F,
841
+ P,
842
842
  /* @__PURE__ */ J("div", {
843
843
  style: {
844
844
  fontSize: 12.5,
@@ -849,27 +849,27 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
849
849
  })
850
850
  ] }) : /* @__PURE__ */ Y("div", { children: [
851
851
  M,
852
- F,
852
+ P,
853
853
  /* @__PURE__ */ J("div", {
854
854
  style: { overflowX: "auto" },
855
855
  children: /* @__PURE__ */ Y("table", {
856
- style: de,
857
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: w.map((e) => {
856
+ style: fe,
857
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: C.map((e) => {
858
858
  let t = o.fields.get(e);
859
859
  return /* @__PURE__ */ Y("th", {
860
- style: u.headerStyle(e, ue),
861
- children: [t ? p(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
860
+ style: l.headerStyle(e, de),
861
+ children: [t ? f(t, e, a.entities) : e, /* @__PURE__ */ J($e, {
862
862
  colId: e,
863
- onMouseDown: u.onHandleMouseDown
863
+ onMouseDown: l.onHandleMouseDown
864
864
  })]
865
865
  }, e);
866
- }) }) }), /* @__PURE__ */ J("tbody", { children: x.map((e, t) => {
866
+ }) }) }), /* @__PURE__ */ J("tbody", { children: b.map((e, t) => {
867
867
  let n = A ? c(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
868
- return /* @__PURE__ */ J("tr", { children: w.map((t) => {
868
+ return /* @__PURE__ */ J("tr", { children: C.map((t) => {
869
869
  let n = t === O, i = j.get(t), a = i ? i(e[t], e) : c(e[t]);
870
870
  return /* @__PURE__ */ J("td", {
871
871
  title: typeof a == "string" ? a : void 0,
872
- style: u.cellStyle(t, fe),
872
+ style: l.cellStyle(t, pe),
873
873
  children: n && r ? /* @__PURE__ */ J("a", {
874
874
  href: r,
875
875
  style: {
@@ -891,7 +891,7 @@ function et({ config: t, parentEntity: n, parentId: i, schema: a }) {
891
891
  //#endregion
892
892
  //#region src/components/detail-layout/ChildrenList.tsx
893
893
  function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
894
- let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
894
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = I(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
895
895
  if (!a) return /* @__PURE__ */ J("div", {
896
896
  style: {
897
897
  fontSize: 12.5,
@@ -974,7 +974,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
974
974
  textOverflow: "ellipsis",
975
975
  whiteSpace: "nowrap"
976
976
  },
977
- children: (typeof e.$display == "string" ? e[S] : "") || (h && a.fields.get(h) ? w({
977
+ children: (typeof e.$display == "string" ? e[x] : "") || (h && a.fields.get(h) ? C({
978
978
  field: a.fields.get(h),
979
979
  fieldName: h,
980
980
  value: e[h],
@@ -993,7 +993,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
993
993
  textOverflow: "ellipsis",
994
994
  whiteSpace: "nowrap"
995
995
  },
996
- children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? w({
996
+ children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? C({
997
997
  field: a.fields.get(t),
998
998
  fieldName: t,
999
999
  value: e[t],
@@ -1011,7 +1011,7 @@ function tt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1011
1011
  //#endregion
1012
1012
  //#region src/components/detail-layout/ChildrenCards.tsx
1013
1013
  function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1014
- let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = L(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, v = m?.columns_count ?? 3;
1014
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: l, isError: u } = I(t, n, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns, m = e.cards, h = m?.header_field ?? p[0], g = m?.badge_field, _ = m?.columns_count ?? 3;
1015
1015
  if (!a) return /* @__PURE__ */ J("div", {
1016
1016
  style: {
1017
1017
  fontSize: 12.5,
@@ -1020,17 +1020,17 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1020
1020
  },
1021
1021
  children: "Entity not found."
1022
1022
  });
1023
- let y = {
1023
+ let v = {
1024
1024
  display: "grid",
1025
- gridTemplateColumns: `repeat(auto-fill, minmax(${v >= 4 ? 180 : 240}px, 1fr))`,
1025
+ gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
1026
1026
  gap: 12
1027
- }, b = /* @__PURE__ */ J(Ye, {
1027
+ }, y = /* @__PURE__ */ J(Ye, {
1028
1028
  config: e,
1029
1029
  parentEntity: t,
1030
1030
  parentId: n,
1031
1031
  schema: i
1032
1032
  });
1033
- if (u) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1033
+ if (u) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1034
1034
  style: {
1035
1035
  fontSize: 12.5,
1036
1036
  color: "var(--danger)",
@@ -1038,8 +1038,8 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1038
1038
  },
1039
1039
  children: "Failed to load. Try again."
1040
1040
  })] });
1041
- if (l) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1042
- style: y,
1041
+ if (l) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1042
+ style: v,
1043
1043
  children: [
1044
1044
  0,
1045
1045
  1,
@@ -1050,7 +1050,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1050
1050
  borderRadius: 10
1051
1051
  } }, e))
1052
1052
  })] });
1053
- if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1053
+ if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1054
1054
  style: {
1055
1055
  fontSize: 12.5,
1056
1056
  color: "var(--text-3)",
@@ -1058,9 +1058,9 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1058
1058
  },
1059
1059
  children: "No records yet."
1060
1060
  })] });
1061
- let x = p.filter((e) => e !== h && e !== g);
1062
- return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1063
- style: y,
1061
+ let b = p.filter((e) => e !== h && e !== g);
1062
+ return /* @__PURE__ */ Y("div", { children: [y, /* @__PURE__ */ J("div", {
1063
+ style: v,
1064
1064
  children: d.map((t, n) => /* @__PURE__ */ Y("div", {
1065
1065
  style: {
1066
1066
  background: "var(--surface)",
@@ -1075,7 +1075,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1075
1075
  alignItems: "center",
1076
1076
  justifyContent: "space-between",
1077
1077
  gap: 8,
1078
- borderBottom: x.length > 0 ? "1px solid var(--divider)" : "none"
1078
+ borderBottom: b.length > 0 ? "1px solid var(--divider)" : "none"
1079
1079
  },
1080
1080
  children: [/* @__PURE__ */ J("div", {
1081
1081
  style: {
@@ -1085,7 +1085,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1085
1085
  textOverflow: "ellipsis",
1086
1086
  whiteSpace: "nowrap"
1087
1087
  },
1088
- children: h && a.fields.get(h) ? w({
1088
+ children: h && a.fields.get(h) ? C({
1089
1089
  field: a.fields.get(h),
1090
1090
  fieldName: h,
1091
1091
  value: t[h],
@@ -1094,10 +1094,10 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1094
1094
  refs: f,
1095
1095
  locale: o
1096
1096
  }) : `Record ${n + 1}`
1097
- }), g && t[g] != null && /* @__PURE__ */ J(_, {
1097
+ }), g && t[g] != null && /* @__PURE__ */ J(T, {
1098
1098
  tone: "slate",
1099
1099
  size: "xs",
1100
- children: a.fields.get(g) ? w({
1100
+ children: a.fields.get(g) ? C({
1101
1101
  field: a.fields.get(g),
1102
1102
  fieldName: g,
1103
1103
  value: t[g],
@@ -1107,14 +1107,14 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1107
1107
  locale: o
1108
1108
  }) : c(t[g])
1109
1109
  })]
1110
- }), x.length > 0 && /* @__PURE__ */ J("div", {
1110
+ }), b.length > 0 && /* @__PURE__ */ J("div", {
1111
1111
  style: {
1112
1112
  padding: "10px 14px",
1113
1113
  display: "flex",
1114
1114
  flexDirection: "column",
1115
1115
  gap: 4
1116
1116
  },
1117
- children: x.slice(0, 4).map((n) => {
1117
+ children: b.slice(0, 4).map((n) => {
1118
1118
  let r = a.fields.get(n);
1119
1119
  return r ? /* @__PURE__ */ Y("div", {
1120
1120
  style: {
@@ -1135,7 +1135,7 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1135
1135
  textOverflow: "ellipsis",
1136
1136
  whiteSpace: "nowrap"
1137
1137
  },
1138
- children: w({
1138
+ children: C({
1139
1139
  field: r,
1140
1140
  fieldName: n,
1141
1141
  value: t[n],
@@ -1155,15 +1155,15 @@ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1155
1155
  //#region src/hooks/useTimelineData.ts
1156
1156
  var rt = 50;
1157
1157
  function it(e, t, n, r, i, a) {
1158
- let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? o(t, s.length) : [t], l = a ?? rt, d = ye({
1158
+ let s = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? o(t, s.length) : [t], u = a ?? rt, d = ye({
1159
1159
  queryKey: [
1160
- F,
1160
+ P,
1161
1161
  e,
1162
1162
  t,
1163
1163
  n,
1164
1164
  "timeline",
1165
1165
  i,
1166
- l
1166
+ u
1167
1167
  ],
1168
1168
  queryFn: ({ pageParam: e }) => {
1169
1169
  let t = new URLSearchParams();
@@ -1173,7 +1173,7 @@ function it(e, t, n, r, i, a) {
1173
1173
  op: "eq",
1174
1174
  value: c[t]
1175
1175
  }));
1176
- return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(l)), e && t.set("after", e), u(`/api/data/${n}?${t.toString()}`);
1176
+ return t.set("filters", JSON.stringify(r)), t.set("preview", "true"), i ? t.set("sort", `${i}:desc`) : typeof console < "u" && console.warn(`[useTimelineData] no time_field for ${n}; fetch order falls back to API default`), t.set("limit", String(u)), e && t.set("after", e), l(`/api/data/${n}?${t.toString()}`);
1177
1177
  },
1178
1178
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1179
1179
  initialPageParam: void 0,
@@ -1193,35 +1193,35 @@ function it(e, t, n, r, i, a) {
1193
1193
  //#region src/components/detail-layout/TimelineComposer.tsx
1194
1194
  var at = "quick_entry", ot = 100, st = 240, ct = 800, lt = 80;
1195
1195
  function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1196
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, i, a), m = r(), [h, g] = K(st), _ = G(null), v = G(null), [y, b] = K(ct);
1196
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Je(t, n, i, a), m = r(), [h, g] = K(st), _ = G(null), v = G(null), [x, S] = K(ct);
1197
1197
  U(() => {
1198
1198
  let e = v.current?.parentElement;
1199
1199
  if (!e) return;
1200
1200
  let t = () => {
1201
1201
  let t = Math.max(ot, e.clientHeight - lt);
1202
- b(Math.min(ct, t));
1202
+ S(Math.min(ct, t));
1203
1203
  };
1204
1204
  t();
1205
1205
  let n = new ResizeObserver(t);
1206
1206
  return n.observe(e), () => n.disconnect();
1207
1207
  }, []), U(() => {
1208
- g((e) => Math.min(e, y));
1209
- }, [y]);
1210
- let S = G(o);
1211
- S.current = o;
1212
- let C = G(p);
1213
- C.current = p;
1214
- let T = G({}), E = W(() => ({
1215
- getField: (e) => S.current[e],
1208
+ g((e) => Math.min(e, x));
1209
+ }, [x]);
1210
+ let w = G(o);
1211
+ w.current = o;
1212
+ let T = G(p);
1213
+ T.current = p;
1214
+ let E = G({}), D = W(() => ({
1215
+ getField: (e) => w.current[e],
1216
1216
  setField: (e, t) => {
1217
- C.current(e, t);
1217
+ T.current(e, t);
1218
1218
  },
1219
1219
  focusField: (e) => {
1220
- let t = T.current[e];
1220
+ let t = E.current[e];
1221
1221
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1222
1222
  }
1223
1223
  }), []);
1224
- U(() => x(at, E), [E]);
1224
+ U(() => b(at, D), [D]);
1225
1225
  let O = H((e) => {
1226
1226
  e.preventDefault(), _.current = {
1227
1227
  startY: e.clientY,
@@ -1229,13 +1229,13 @@ function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1229
1229
  };
1230
1230
  let t = (e) => {
1231
1231
  if (!_.current) return;
1232
- let t = _.current.startY - e.clientY, n = Math.min(y, Math.max(ot, _.current.startHeight + t));
1232
+ let t = _.current.startY - e.clientY, n = Math.min(x, Math.max(ot, _.current.startHeight + t));
1233
1233
  g(n);
1234
1234
  }, n = () => {
1235
1235
  _.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1236
1236
  };
1237
1237
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1238
- }, [h, y]);
1238
+ }, [h, x]);
1239
1239
  if (!s || s.fields.length === 0 || !c) return null;
1240
1240
  let k = s.fields.find((e) => {
1241
1241
  let t = c.fields.get(e);
@@ -1250,9 +1250,9 @@ function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1250
1250
  let t = c.fields.get(e);
1251
1251
  return t ? /* @__PURE__ */ J("div", {
1252
1252
  ref: (t) => {
1253
- T.current[e] = t;
1253
+ E.current[e] = t;
1254
1254
  },
1255
- children: w({
1255
+ children: C({
1256
1256
  field: t,
1257
1257
  fieldName: e,
1258
1258
  value: o[e] ?? "",
@@ -1321,9 +1321,9 @@ function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1321
1321
  display: "flex"
1322
1322
  },
1323
1323
  ref: (e) => {
1324
- T.current[k] = e;
1324
+ E.current[k] = e;
1325
1325
  },
1326
- children: w({
1326
+ children: C({
1327
1327
  field: c.fields.get(k),
1328
1328
  fieldName: k,
1329
1329
  value: o[k] ?? "",
@@ -1365,7 +1365,7 @@ function ut({ config: t, parentEntity: n, parentId: i, schema: a }) {
1365
1365
  }),
1366
1366
  " to add"
1367
1367
  ]
1368
- }), /* @__PURE__ */ J(D, {
1368
+ }), /* @__PURE__ */ J(y, {
1369
1369
  type: "submit",
1370
1370
  kind: "primary",
1371
1371
  icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
@@ -1395,57 +1395,57 @@ function pt(e, t) {
1395
1395
  let e = t.id;
1396
1396
  return e == null ? "" : c(e);
1397
1397
  }
1398
- return y(A(e, t));
1398
+ return v(A(e, t));
1399
1399
  }
1400
1400
  function mt(e) {
1401
1401
  return e.__optimistic === !0;
1402
1402
  }
1403
1403
  function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1404
- let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: u, isLoading: d, isError: f } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, h = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = G(null), b = G(null), x = G(!1), S = G(0), C = G(null), w = G(null), T = G(!0), E = G(null);
1404
+ let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = it(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), f = e.timeline, m = f?.scroll ?? !1, h = (e.sort ?? "").endsWith(":asc"), _ = W(() => h ? [...a].reverse() : a, [a, h]), v = f?.auto_scroll ?? "none", b = G(null), x = G(null), S = G(!1), C = G(0), w = G(null), T = G(null), E = G(!0), D = G(null);
1405
1405
  U(() => {
1406
- x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
1406
+ S.current = !1, C.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
1407
1407
  }, [n]), ve(() => {
1408
- !u || !y.current || (E.current = {
1409
- scrollHeight: y.current.scrollHeight,
1410
- scrollTop: y.current.scrollTop
1408
+ !l || !b.current || (D.current = {
1409
+ scrollHeight: b.current.scrollHeight,
1410
+ scrollTop: b.current.scrollTop
1411
1411
  });
1412
- }, [u]), ve(() => {
1413
- let e = y.current;
1412
+ }, [l]), ve(() => {
1413
+ let e = b.current;
1414
1414
  if (!e || _.length === 0 || !i) {
1415
- S.current = _.length;
1415
+ C.current = _.length;
1416
1416
  return;
1417
1417
  }
1418
- let t = pt(i, _[0]), n = pt(i, _[_.length - 1]), r = !x.current, a = _.length > S.current && S.current > 0, o = a && (g && t !== C.current && n === w.current || !g && n !== w.current && t === C.current), s = a && !o;
1419
- if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1420
- else if (o && E.current) {
1421
- let t = E.current;
1422
- g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
1423
- } else s && g && T.current && (e.scrollTop = e.scrollHeight);
1424
- S.current = _.length, C.current = t, w.current = n;
1418
+ let t = pt(i, _[0]), n = pt(i, _[_.length - 1]), r = !S.current, a = _.length > C.current && C.current > 0, o = a && (h && t !== w.current && n === T.current || !h && n !== T.current && t === w.current), s = a && !o;
1419
+ if (r) h && v === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
1420
+ else if (o && D.current) {
1421
+ let t = D.current;
1422
+ h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1423
+ } else s && h && E.current && (e.scrollTop = e.scrollHeight);
1424
+ C.current = _.length, w.current = t, T.current = n;
1425
1425
  }, [
1426
1426
  _,
1427
1427
  v,
1428
- g,
1428
+ h,
1429
1429
  i
1430
1430
  ]);
1431
1431
  let O = H(() => {
1432
- let e = y.current;
1433
- e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
1432
+ let e = b.current;
1433
+ e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < dt);
1434
1434
  }, []);
1435
1435
  U(() => {
1436
- let e = b.current;
1436
+ let e = x.current;
1437
1437
  if (!e || typeof IntersectionObserver > "u") return;
1438
1438
  let t = new IntersectionObserver((e) => {
1439
- for (let t of e) t.isIntersecting && c && !u && s();
1439
+ for (let t of e) t.isIntersecting && c && !l && s();
1440
1440
  }, {
1441
- root: y.current ?? null,
1441
+ root: b.current ?? null,
1442
1442
  rootMargin: `${ft}px 0px 0px 0px`,
1443
1443
  threshold: 0
1444
1444
  });
1445
1445
  return t.observe(e), () => t.disconnect();
1446
1446
  }, [
1447
1447
  c,
1448
- u,
1448
+ l,
1449
1449
  s
1450
1450
  ]);
1451
1451
  let [k, A] = K(null);
@@ -1457,25 +1457,25 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1457
1457
  },
1458
1458
  children: "Entity not found."
1459
1459
  });
1460
- let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = m(i.display?.name_plural) || m(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
1460
+ let j = e.quick_add?.fields ?? [f?.content_field].filter(Boolean), M = p(i.display?.name_plural) || p(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ J("div", {
1461
1461
  style: {
1462
1462
  display: "flex",
1463
1463
  justifyContent: "center",
1464
1464
  padding: "6px 0"
1465
1465
  },
1466
- children: /* @__PURE__ */ J(D, {
1466
+ children: /* @__PURE__ */ J(y, {
1467
1467
  size: "xs",
1468
1468
  onClick: () => s(),
1469
- disabled: u,
1470
- icon: u ? /* @__PURE__ */ J(l, { size: 11 }) : void 0,
1471
- children: u ? "Loading…" : "Load older"
1469
+ disabled: l,
1470
+ icon: l ? /* @__PURE__ */ J(g, { size: 11 }) : void 0,
1471
+ children: l ? "Loading…" : "Load older"
1472
1472
  })
1473
- }) : null, N = /* @__PURE__ */ J("div", {
1474
- ref: b,
1473
+ }) : null, te = /* @__PURE__ */ J("div", {
1474
+ ref: x,
1475
1475
  "aria-hidden": "true",
1476
1476
  style: { height: 1 }
1477
- }), P;
1478
- if (f) P = /* @__PURE__ */ J("div", {
1477
+ }), N;
1478
+ if (d) N = /* @__PURE__ */ J("div", {
1479
1479
  style: {
1480
1480
  fontSize: 12.5,
1481
1481
  color: "var(--danger)",
@@ -1483,7 +1483,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1483
1483
  },
1484
1484
  children: "Failed to load."
1485
1485
  });
1486
- else if (d) P = /* @__PURE__ */ Y("div", {
1486
+ else if (u) N = /* @__PURE__ */ Y("div", {
1487
1487
  style: {
1488
1488
  display: "flex",
1489
1489
  flexDirection: "column",
@@ -1500,7 +1500,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1500
1500
  borderRadius: 8
1501
1501
  } })]
1502
1502
  });
1503
- else if (_.length === 0) P = /* @__PURE__ */ Y(q, { children: [N, /* @__PURE__ */ J("div", {
1503
+ else if (_.length === 0) N = /* @__PURE__ */ Y(q, { children: [te, /* @__PURE__ */ J("div", {
1504
1504
  style: {
1505
1505
  fontSize: 12.5,
1506
1506
  color: "var(--text-3)",
@@ -1518,7 +1518,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1518
1518
  entityCode: e.entity,
1519
1519
  parentEntity: t,
1520
1520
  parentId: n,
1521
- timeline: p,
1521
+ timeline: f,
1522
1522
  editableFields: j,
1523
1523
  refs: o,
1524
1524
  isEditing: k === c,
@@ -1528,7 +1528,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1528
1528
  schema: r,
1529
1529
  optimistic: mt(a)
1530
1530
  }, c);
1531
- }, s = p?.time_field, c;
1531
+ }, s = f?.time_field, c;
1532
1532
  if (s) {
1533
1533
  let e = [];
1534
1534
  _.forEach((t, n) => {
@@ -1556,13 +1556,13 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1556
1556
  }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1557
1557
  }, `day-${e.key}`));
1558
1558
  } else c = _.map((e, t) => a(e, t));
1559
- P = /* @__PURE__ */ Y(q, { children: [
1560
- N,
1559
+ N = /* @__PURE__ */ Y(q, { children: [
1560
+ te,
1561
1561
  ee,
1562
1562
  c
1563
1563
  ] });
1564
1564
  }
1565
- return h ? /* @__PURE__ */ Y("div", {
1565
+ return m ? /* @__PURE__ */ Y("div", {
1566
1566
  style: {
1567
1567
  display: "flex",
1568
1568
  flexDirection: "column",
@@ -1588,7 +1588,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1588
1588
  })
1589
1589
  }),
1590
1590
  /* @__PURE__ */ J("div", {
1591
- ref: y,
1591
+ ref: b,
1592
1592
  onScroll: O,
1593
1593
  style: {
1594
1594
  flex: 1,
@@ -1598,7 +1598,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1598
1598
  flexDirection: "column",
1599
1599
  gap: 8
1600
1600
  },
1601
- children: P
1601
+ children: N
1602
1602
  }),
1603
1603
  /* @__PURE__ */ J(ut, {
1604
1604
  config: e,
@@ -1613,7 +1613,7 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1613
1613
  flexDirection: "column",
1614
1614
  gap: 8
1615
1615
  },
1616
- children: P
1616
+ children: N
1617
1617
  }), /* @__PURE__ */ J(ut, {
1618
1618
  config: e,
1619
1619
  parentEntity: t,
@@ -1621,10 +1621,10 @@ function ht({ config: e, parentEntity: t, parentId: n, schema: r }) {
1621
1621
  schema: r
1622
1622
  })] });
1623
1623
  }
1624
- function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: u, editableFields: d, refs: f, isEditing: m, onStartEdit: h, onCancelEdit: g, onSaved: v, schema: y, optimistic: b = !1 }) {
1625
- let x = xe(), S = r(), [T, O] = K({}), k = H(() => {
1624
+ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s, parentId: c, timeline: l, editableFields: u, refs: d, isEditing: p, onStartEdit: m, onCancelEdit: h, onSaved: _, schema: v, optimistic: b = !1 }) {
1625
+ let x = xe(), w = r(), [D, O] = K({}), k = H(() => {
1626
1626
  x.invalidateQueries({ queryKey: [
1627
- F,
1627
+ P,
1628
1628
  s,
1629
1629
  c,
1630
1630
  o
@@ -1643,30 +1643,30 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1643
1643
  } : e);
1644
1644
  },
1645
1645
  onSuccess: () => {
1646
- k(), C.success("Updated"), v();
1646
+ k(), S.success("Updated"), _();
1647
1647
  },
1648
- onError: (e) => C.error(e.message)
1648
+ onError: (e) => S.error(e.message)
1649
1649
  }), M = be({
1650
1650
  mutationFn: () => j(o, n),
1651
1651
  onSuccess: () => {
1652
- k(), C.success("Deleted");
1652
+ k(), S.success("Deleted");
1653
1653
  },
1654
- onError: (e) => C.error(e.message)
1654
+ onError: (e) => S.error(e.message)
1655
1655
  }), ee = H(() => {
1656
1656
  let e = {};
1657
- for (let n of d) e[n] = t[n] ?? "";
1658
- O(e), h();
1657
+ for (let n of u) e[n] = t[n] ?? "";
1658
+ O(e), m();
1659
1659
  }, [
1660
1660
  t,
1661
- d,
1662
- h
1663
- ]), N = H((e, t) => {
1661
+ u,
1662
+ m
1663
+ ]), te = H((e, t) => {
1664
1664
  O((n) => ({
1665
1665
  ...n,
1666
1666
  [e]: t
1667
1667
  }));
1668
- }, []), P = u?.time_field, I = u?.type_field, L = u?.summary_field, R = u?.content_field, z = u?.author_field, B = u?.direction_field, V = u?.intent_field;
1669
- return m ? /* @__PURE__ */ Y("div", {
1668
+ }, []), N = l?.time_field, F = l?.type_field, I = l?.summary_field, L = l?.content_field, R = l?.author_field, z = l?.direction_field, B = l?.intent_field;
1669
+ return p ? /* @__PURE__ */ Y("div", {
1670
1670
  style: {
1671
1671
  borderRadius: 10,
1672
1672
  border: "1px solid var(--accent)",
@@ -1676,7 +1676,7 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1676
1676
  flexDirection: "column",
1677
1677
  gap: 8
1678
1678
  },
1679
- children: [d.map((e) => {
1679
+ children: [u.map((e) => {
1680
1680
  let t = i.fields.get(e);
1681
1681
  return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1682
1682
  style: {
@@ -1685,15 +1685,15 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1685
1685
  marginBottom: 4,
1686
1686
  display: "block"
1687
1687
  },
1688
- children: p(t, e, y.entities)
1689
- }), w({
1688
+ children: f(t, e, v.entities)
1689
+ }), C({
1690
1690
  field: t,
1691
1691
  fieldName: e,
1692
- value: T[e] ?? "",
1692
+ value: D[e] ?? "",
1693
1693
  mode: "edit",
1694
- onChange: (t) => N(e, t),
1695
- record: T,
1696
- locale: S
1694
+ onChange: (t) => te(e, t),
1695
+ record: D,
1696
+ locale: w
1697
1697
  })] }, e) : null;
1698
1698
  }), /* @__PURE__ */ Y("div", {
1699
1699
  style: {
@@ -1702,18 +1702,18 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1702
1702
  gap: 6,
1703
1703
  paddingTop: 4
1704
1704
  },
1705
- children: [/* @__PURE__ */ J(D, {
1705
+ children: [/* @__PURE__ */ J(y, {
1706
1706
  kind: "primary",
1707
1707
  size: "xs",
1708
- icon: A.isPending ? /* @__PURE__ */ J(l, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1709
- onClick: () => A.mutate(T),
1708
+ icon: A.isPending ? /* @__PURE__ */ J(g, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1709
+ onClick: () => A.mutate(D),
1710
1710
  disabled: A.isPending,
1711
1711
  children: A.isPending ? "Saving…" : "Save"
1712
- }), /* @__PURE__ */ J(D, {
1712
+ }), /* @__PURE__ */ J(y, {
1713
1713
  size: "xs",
1714
1714
  icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1715
1715
  onClick: () => {
1716
- O({}), g();
1716
+ O({}), h();
1717
1717
  },
1718
1718
  disabled: A.isPending,
1719
1719
  children: "Cancel"
@@ -1743,59 +1743,59 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1743
1743
  color: "var(--text-3)"
1744
1744
  },
1745
1745
  children: [
1746
- P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ J("span", {
1746
+ N && t[N] != null && i.fields.get(N) && /* @__PURE__ */ J("span", {
1747
1747
  style: { fontWeight: 500 },
1748
- children: w({
1749
- field: i.fields.get(P),
1750
- fieldName: P,
1751
- value: t[P],
1748
+ children: C({
1749
+ field: i.fields.get(N),
1750
+ fieldName: N,
1751
+ value: t[N],
1752
1752
  mode: "display",
1753
1753
  record: t,
1754
- refs: f,
1755
- locale: S
1754
+ refs: d,
1755
+ locale: w
1756
1756
  })
1757
1757
  }),
1758
- I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J(_, {
1758
+ F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J(T, {
1759
1759
  tone: "slate",
1760
1760
  size: "xs",
1761
- children: w({
1762
- field: i.fields.get(I),
1763
- fieldName: I,
1764
- value: t[I],
1761
+ children: C({
1762
+ field: i.fields.get(F),
1763
+ fieldName: F,
1764
+ value: t[F],
1765
1765
  mode: "display",
1766
1766
  record: t,
1767
- refs: f,
1768
- locale: S
1767
+ refs: d,
1768
+ locale: w
1769
1769
  })
1770
1770
  }),
1771
- B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(bt, {
1772
- value: t[B],
1773
- field: i.fields.get(B)
1771
+ z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ J(bt, {
1772
+ value: t[z],
1773
+ field: i.fields.get(z)
1774
1774
  }),
1775
- V && t[V] != null && i.fields.get(V) && /* @__PURE__ */ J(_, {
1775
+ B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(T, {
1776
1776
  tone: "slate",
1777
1777
  size: "xs",
1778
- children: w({
1779
- field: i.fields.get(V),
1780
- fieldName: V,
1781
- value: t[V],
1778
+ children: C({
1779
+ field: i.fields.get(B),
1780
+ fieldName: B,
1781
+ value: t[B],
1782
1782
  mode: "display",
1783
1783
  record: t,
1784
- refs: f,
1785
- locale: S
1784
+ refs: d,
1785
+ locale: w
1786
1786
  })
1787
1787
  }),
1788
- z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1788
+ R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ Y("span", { children: [
1789
1789
  "by",
1790
1790
  " ",
1791
- w({
1792
- field: i.fields.get(z),
1793
- fieldName: z,
1794
- value: t[z],
1791
+ C({
1792
+ field: i.fields.get(R),
1793
+ fieldName: R,
1794
+ value: t[R],
1795
1795
  mode: "display",
1796
1796
  record: t,
1797
- refs: f,
1798
- locale: S
1797
+ refs: d,
1798
+ locale: w
1799
1799
  })
1800
1800
  ] }),
1801
1801
  !b && /* @__PURE__ */ Y("div", {
@@ -1819,36 +1819,36 @@ function gt({ row: t, rowId: n, childEntity: i, entityCode: o, parentEntity: s,
1819
1819
  })
1820
1820
  ]
1821
1821
  }),
1822
- L && t[L] != null && i.fields.get(L) && /* @__PURE__ */ J("div", {
1822
+ I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J("div", {
1823
1823
  style: {
1824
1824
  fontSize: 12.5,
1825
1825
  fontWeight: 500,
1826
1826
  marginTop: 6
1827
1827
  },
1828
- children: w({
1829
- field: i.fields.get(L),
1830
- fieldName: L,
1831
- value: t[L],
1828
+ children: C({
1829
+ field: i.fields.get(I),
1830
+ fieldName: I,
1831
+ value: t[I],
1832
1832
  mode: "display",
1833
1833
  record: t,
1834
- refs: f,
1835
- locale: S
1834
+ refs: d,
1835
+ locale: w
1836
1836
  })
1837
1837
  }),
1838
- R && t[R] != null && R !== L && i.fields.get(R) && /* @__PURE__ */ J("div", {
1838
+ L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ J("div", {
1839
1839
  style: {
1840
1840
  fontSize: 12.5,
1841
1841
  fontWeight: 400,
1842
1842
  marginTop: 6
1843
1843
  },
1844
- children: w({
1845
- field: i.fields.get(R),
1846
- fieldName: R,
1847
- value: t[R],
1844
+ children: C({
1845
+ field: i.fields.get(L),
1846
+ fieldName: L,
1847
+ value: t[L],
1848
1848
  mode: "display",
1849
1849
  record: t,
1850
- refs: f,
1851
- locale: S
1850
+ refs: d,
1851
+ locale: w
1852
1852
  })
1853
1853
  })
1854
1854
  ]
@@ -1938,11 +1938,11 @@ function xt(e, t) {
1938
1938
  //#endregion
1939
1939
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1940
1940
  function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, validationErrors: s, refs: l, forceTablePresentation: u = !1 }) {
1941
- let d = r(), f = b(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = h.filter((e) => {
1941
+ let d = r(), p = D(), m = G(null), h = t.columns, g = t.position_field, _ = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = h.filter((e) => {
1942
1942
  if (_.has(e) || t.position_field && e === t.position_field) return !1;
1943
1943
  let r = n.fields.get(e);
1944
1944
  return !(!r || r.auto || r.primary || r.source);
1945
- }), y = new Set(h.filter((e) => {
1945
+ }), b = new Set(h.filter((e) => {
1946
1946
  if (t.position_field && e === t.position_field) return !0;
1947
1947
  let r = n.fields.get(e);
1948
1948
  return r && (r.auto || r.primary || r.source);
@@ -1974,7 +1974,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
1974
1974
  n,
1975
1975
  t.quick_add?.defaults,
1976
1976
  g
1977
- ]), C = H((e) => {
1977
+ ]), w = H((e) => {
1978
1978
  o(a.map((t) => t._key === e ? {
1979
1979
  ...t,
1980
1980
  _deleted: !0
@@ -2030,15 +2030,15 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2030
2030
  }
2031
2031
  });
2032
2032
  } else e.key === "Escape" && t.blur?.();
2033
- }, [S]), A = ue;
2034
- return f.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2033
+ }, [S]), A = de;
2034
+ return p.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2035
2035
  style: {
2036
2036
  display: "flex",
2037
2037
  flexDirection: "column",
2038
2038
  gap: 10
2039
2039
  },
2040
2040
  children: a.map((t, r) => {
2041
- let o = !!t._deleted, u = s?.[t._key], f = g ? a.filter((e) => !e._deleted) : [], m = g ? f.findIndex((e) => e._key === t._key) : -1;
2041
+ let o = !!t._deleted, u = s?.[t._key], p = g ? a.filter((e) => !e._deleted) : [], m = g ? p.findIndex((e) => e._key === t._key) : -1;
2042
2042
  return /* @__PURE__ */ Y("div", {
2043
2043
  style: {
2044
2044
  border: "1px solid var(--border)",
@@ -2080,7 +2080,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2080
2080
  size: 32,
2081
2081
  icon: /* @__PURE__ */ J(e.down, { size: 14 }),
2082
2082
  onClick: () => O(t._key, 1),
2083
- disabled: m === -1 || m >= f.length - 1,
2083
+ disabled: m === -1 || m >= p.length - 1,
2084
2084
  title: "Move row down"
2085
2085
  })] }), o ? /* @__PURE__ */ J(E, {
2086
2086
  size: 32,
@@ -2090,7 +2090,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2090
2090
  }) : /* @__PURE__ */ J(E, {
2091
2091
  size: 32,
2092
2092
  icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
2093
- onClick: () => C(t._key),
2093
+ onClick: () => w(t._key),
2094
2094
  title: "Delete row"
2095
2095
  })]
2096
2096
  })]
@@ -2102,7 +2102,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2102
2102
  gap: 12
2103
2103
  },
2104
2104
  children: h.map((e) => {
2105
- let r = n.fields.get(e), a = u?.includes(e), s = y.has(e), f = r ? p(r, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
2105
+ let r = n.fields.get(e), a = u?.includes(e), s = b.has(e), p = r ? f(r, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
2106
2106
  outline: a ? "1px solid var(--danger)" : "none",
2107
2107
  outlineOffset: 3,
2108
2108
  borderRadius: a ? 5 : 0
@@ -2124,14 +2124,14 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2124
2124
  id: h,
2125
2125
  htmlFor: m,
2126
2126
  style: _,
2127
- children: f
2127
+ children: p
2128
2128
  }) : /* @__PURE__ */ J("div", {
2129
2129
  id: h,
2130
2130
  style: _,
2131
- children: f
2131
+ children: p
2132
2132
  }), /* @__PURE__ */ J("div", {
2133
2133
  style: g,
2134
- children: o || s ? r ? w({
2134
+ children: o || s ? r ? C({
2135
2135
  field: r,
2136
2136
  fieldName: e,
2137
2137
  value: t[e],
@@ -2141,7 +2141,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2141
2141
  fieldId: m,
2142
2142
  labelId: h,
2143
2143
  locale: d
2144
- }) : c(t[e]) : r ? w({
2144
+ }) : c(t[e]) : r ? C({
2145
2145
  field: r,
2146
2146
  fieldName: e,
2147
2147
  value: t[e],
@@ -2162,7 +2162,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2162
2162
  })
2163
2163
  }), /* @__PURE__ */ J("div", {
2164
2164
  style: { marginTop: 10 },
2165
- children: /* @__PURE__ */ J(D, {
2165
+ children: /* @__PURE__ */ J(y, {
2166
2166
  kind: "ghost",
2167
2167
  size: "sm",
2168
2168
  icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
@@ -2173,13 +2173,13 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2173
2173
  style: { overflowX: "auto" },
2174
2174
  children: /* @__PURE__ */ Y("table", {
2175
2175
  ref: m,
2176
- style: de,
2176
+ style: fe,
2177
2177
  onKeyDown: k,
2178
2178
  children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2179
2179
  let t = n.fields.get(e);
2180
2180
  return /* @__PURE__ */ J("th", {
2181
2181
  style: A,
2182
- children: t ? p(t, e, i.entities) : e
2182
+ children: t ? f(t, e, i.entities) : e
2183
2183
  }, e);
2184
2184
  }), /* @__PURE__ */ J("th", { style: {
2185
2185
  ...A,
@@ -2189,7 +2189,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2189
2189
  return /* @__PURE__ */ Y("tr", {
2190
2190
  style: { opacity: r ? .5 : 1 },
2191
2191
  children: [h.map((e) => {
2192
- let a = n.fields.get(e), o = i?.includes(e), s = y.has(e);
2192
+ let a = n.fields.get(e), o = i?.includes(e), s = b.has(e);
2193
2193
  return r || s ? /* @__PURE__ */ J("td", {
2194
2194
  style: {
2195
2195
  padding: "6px 12px",
@@ -2198,7 +2198,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2198
2198
  textDecoration: r ? "line-through" : "none",
2199
2199
  color: "var(--text-2)"
2200
2200
  },
2201
- children: a ? w({
2201
+ children: a ? C({
2202
2202
  field: a,
2203
2203
  fieldName: e,
2204
2204
  value: t[e],
@@ -2217,7 +2217,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2217
2217
  borderRadius: o ? 4 : 0
2218
2218
  },
2219
2219
  title: o ? `${e} is required` : void 0,
2220
- children: a ? w({
2220
+ children: a ? C({
2221
2221
  field: a,
2222
2222
  fieldName: e,
2223
2223
  value: t[e],
@@ -2243,7 +2243,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2243
2243
  }) : /* @__PURE__ */ J(E, {
2244
2244
  size: 24,
2245
2245
  icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2246
- onClick: () => C(t._key),
2246
+ onClick: () => w(t._key),
2247
2247
  title: "Delete row"
2248
2248
  })
2249
2249
  })]
@@ -2252,7 +2252,7 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2252
2252
  })
2253
2253
  }), /* @__PURE__ */ J("div", {
2254
2254
  style: { marginTop: 8 },
2255
- children: /* @__PURE__ */ J(D, {
2255
+ children: /* @__PURE__ */ J(y, {
2256
2256
  kind: "ghost",
2257
2257
  size: "xs",
2258
2258
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
@@ -2263,9 +2263,9 @@ function St({ config: t, childEntity: n, schema: i, rows: a, onChange: o, valida
2263
2263
  }
2264
2264
  //#endregion
2265
2265
  //#region src/components/detail-layout/ChildrenBlock.tsx
2266
- var Ct = he(() => import("./DraggableChildrenTable-Ctmn0liO.js").then((e) => ({ default: e.DraggableChildrenTable })));
2266
+ var Ct = V(() => import("./DraggableChildrenTable-BkqtkJuz.js").then((e) => ({ default: e.DraggableChildrenTable })));
2267
2267
  function wt({ node: e, ctx: n }) {
2268
- let r = b(), i = e.children;
2268
+ let r = D(), i = e.children;
2269
2269
  if (!i) return null;
2270
2270
  let a = r.isPhone && n.relatedRecordsPresentation === "table";
2271
2271
  if (n.isNew && n.mode !== "edit") return null;
@@ -2279,7 +2279,7 @@ function wt({ node: e, ctx: n }) {
2279
2279
  className: "text-sm text-muted-foreground py-2",
2280
2280
  children: ["Entity not found: ", o.entity]
2281
2281
  });
2282
- let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(ne, {
2282
+ let c = Ne(o, s, e), l = ke(e, n), u = Ae(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(re, {
2283
2283
  title: l,
2284
2284
  icon: u ? /* @__PURE__ */ J(t, {
2285
2285
  name: u,
@@ -2287,10 +2287,10 @@ function wt({ node: e, ctx: n }) {
2287
2287
  }) : void 0,
2288
2288
  children: e
2289
2289
  });
2290
- if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2290
+ if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && _(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2291
2291
  let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? St : Ct : St;
2292
- return d(/* @__PURE__ */ J(pe, {
2293
- fallback: /* @__PURE__ */ J(R, {}),
2292
+ return d(/* @__PURE__ */ J(me, {
2293
+ fallback: /* @__PURE__ */ J(L, {}),
2294
2294
  children: /* @__PURE__ */ J(o, {
2295
2295
  config: c,
2296
2296
  childEntity: s,
@@ -2325,7 +2325,7 @@ var Tt = 150, Et = 560, Dt = "20px", Ot = 4, kt = /* @__PURE__ */ new Set([
2325
2325
  "json",
2326
2326
  "structure",
2327
2327
  "multilang_text"
2328
- ]), At = me({ columns: 2 });
2328
+ ]), At = he({ columns: 2 });
2329
2329
  function jt({ columns: e = 2, children: t }) {
2330
2330
  let n = G(null), [r, i] = K(!1);
2331
2331
  U(() => {
@@ -2462,13 +2462,13 @@ function Nt({ fields: e, ctx: t }) {
2462
2462
  return /* @__PURE__ */ J(jt, {
2463
2463
  columns: d,
2464
2464
  children: e.map((e) => {
2465
- let r = e.name, d = `${i ?? "field"}-${r}`, p = `${d}-label`, h = n.fields.get(r), g = !!(h?.auto || h?.readonly || h?.source), _ = V(n, r), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ie, {
2465
+ let r = e.name, d = `${i ?? "field"}-${r}`, m = `${d}-label`, h = n.fields.get(r), g = !!(h?.auto || h?.readonly || h?.source), _ = B(n, r), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ae, {
2466
2466
  tier: _.classification,
2467
- tierDef: ce(l, n, r),
2467
+ tierDef: le(l, n, r),
2468
2468
  requiredPermission: _?.required_permission,
2469
2469
  locale: u,
2470
2470
  variant: x === "edit" ? "input" : "value"
2471
- }) : ae({
2471
+ }) : oe({
2472
2472
  entity: n,
2473
2473
  entityCode: i,
2474
2474
  fieldName: r,
@@ -2480,17 +2480,17 @@ function Nt({ fields: e, ctx: t }) {
2480
2480
  screens: l?.screens,
2481
2481
  locale: u,
2482
2482
  fieldId: d,
2483
- labelId: p
2483
+ labelId: m
2484
2484
  });
2485
2485
  if (!S) return null;
2486
- let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(I, {
2486
+ let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(F, {
2487
2487
  actionCode: `${r}.action[${t}]`,
2488
2488
  action: e,
2489
2489
  entityCode: i,
2490
2490
  row: a,
2491
2491
  variant: "ghost",
2492
2492
  size: "icon"
2493
- }, t)) }) : void 0, w = !!h && kt.has(h.type), T = a?.[r], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? c(T) : void 0, D = m(h?.display?.description);
2493
+ }, t)) }) : void 0, w = !!h && kt.has(h.type), T = a?.[r], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? c(T) : void 0, D = p(h?.display?.description);
2494
2494
  return f ? /* @__PURE__ */ Y("div", {
2495
2495
  style: { gridColumn: "1 / -1" },
2496
2496
  children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
@@ -2503,9 +2503,9 @@ function Nt({ fields: e, ctx: t }) {
2503
2503
  children: D
2504
2504
  })]
2505
2505
  }, r) : /* @__PURE__ */ J(Mt, {
2506
- label: P(n, r, l.entities),
2506
+ label: N(n, r, l.entities),
2507
2507
  htmlFor: x === "edit" ? d : void 0,
2508
- labelId: p,
2508
+ labelId: m,
2509
2509
  labelTitle: D || void 0,
2510
2510
  required: h?.required ?? !1,
2511
2511
  mode: x,
@@ -2563,18 +2563,18 @@ function Lt({ propCode: e, prop: t, field: n, value: i, mode: a, onSetProperty:
2563
2563
  e,
2564
2564
  t.type,
2565
2565
  o
2566
- ]), p = V(c, e), h = p?.read === "denied", g = p?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2566
+ ]), m = B(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2567
2567
  return /* @__PURE__ */ J(Mt, {
2568
- label: m(t.display?.name ?? t.name),
2568
+ label: p(t.display?.name ?? t.name),
2569
2569
  mode: v,
2570
2570
  span: kt.has(t.type),
2571
- children: _ ? /* @__PURE__ */ J(ie, {
2572
- tier: p.classification,
2573
- tierDef: ce(l, c, e),
2574
- requiredPermission: p?.required_permission,
2571
+ children: _ ? /* @__PURE__ */ J(ae, {
2572
+ tier: m.classification,
2573
+ tierDef: le(l, c, e),
2574
+ requiredPermission: m?.required_permission,
2575
2575
  locale: u,
2576
2576
  variant: v === "edit" ? "input" : "value"
2577
- }) : w({
2577
+ }) : C({
2578
2578
  field: n,
2579
2579
  fieldName: e,
2580
2580
  value: i,
@@ -2679,7 +2679,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2679
2679
  color: "var(--text-3)",
2680
2680
  flexShrink: 0
2681
2681
  },
2682
- children: [m(a.name), ":"]
2682
+ children: [p(a.name), ":"]
2683
2683
  }), /* @__PURE__ */ J("div", {
2684
2684
  style: {
2685
2685
  minWidth: 240,
@@ -2689,7 +2689,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2689
2689
  children: /* @__PURE__ */ J(Rt, {
2690
2690
  stages: a.statuses.map((e) => ({
2691
2691
  code: e.code,
2692
- label: m(e.name)
2692
+ label: p(e.name)
2693
2693
  })),
2694
2694
  current: o,
2695
2695
  selectable: s,
@@ -2710,11 +2710,11 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2710
2710
  fontSize: 12,
2711
2711
  color: "var(--text-3)"
2712
2712
  },
2713
- children: [m(a.name), ":"]
2714
- }), s ? /* @__PURE__ */ J(_, {
2713
+ children: [p(a.name), ":"]
2714
+ }), s ? /* @__PURE__ */ J(T, {
2715
2715
  tone: s.color ?? "slate",
2716
2716
  size: "xs",
2717
- children: m(s.name)
2717
+ children: p(s.name)
2718
2718
  }) : /* @__PURE__ */ J("span", {
2719
2719
  style: {
2720
2720
  fontSize: 12.5,
@@ -2737,7 +2737,7 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2737
2737
  borderRadius: 999,
2738
2738
  background: `var(--pill-${e.color}, ${e.color})`,
2739
2739
  display: "inline-block"
2740
- } }), m(e.name)]
2740
+ } }), p(e.name)]
2741
2741
  })
2742
2742
  }));
2743
2743
  return /* @__PURE__ */ Y("div", {
@@ -2751,14 +2751,14 @@ function zt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2751
2751
  fontSize: 12,
2752
2752
  color: "var(--text-3)"
2753
2753
  },
2754
- children: [m(a.name), ":"]
2754
+ children: [p(a.name), ":"]
2755
2755
  }), /* @__PURE__ */ J("div", {
2756
2756
  style: {
2757
2757
  minWidth: 180,
2758
2758
  opacity: r ? .6 : 1,
2759
2759
  pointerEvents: r ? "none" : "auto"
2760
2760
  },
2761
- children: /* @__PURE__ */ J(h, {
2761
+ children: /* @__PURE__ */ J(m, {
2762
2762
  value: o ?? "",
2763
2763
  options: c,
2764
2764
  onChange: (t) => n(e, t),
@@ -2817,7 +2817,7 @@ function Wt(e) {
2817
2817
  }
2818
2818
  //#endregion
2819
2819
  //#region src/components/detail-layout/widgets/JsonDiffWidget.tsx
2820
- var Gt = "Audit change diff", Kt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), qt = he(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Jt = he(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2820
+ var Gt = "Audit change diff", Kt = V(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonDiff }))), qt = V(() => import("./MonacoJson-BfpzZ1iT.js").then((e) => ({ default: e.MonacoJsonSource }))), Jt = V(() => import("./JsonEditor-DoNmyrYd.js").then((e) => ({ default: e.JsonEditor })));
2821
2821
  function Yt() {
2822
2822
  return /* @__PURE__ */ J("div", {
2823
2823
  className: "flex h-full w-full items-center justify-center text-sm text-muted-foreground",
@@ -2825,7 +2825,7 @@ function Yt() {
2825
2825
  });
2826
2826
  }
2827
2827
  function Xt({ before: e, after: t }) {
2828
- return /* @__PURE__ */ J(pe, {
2828
+ return /* @__PURE__ */ J(me, {
2829
2829
  fallback: /* @__PURE__ */ J(Yt, {}),
2830
2830
  children: /* @__PURE__ */ Y("div", {
2831
2831
  className: "flex h-full w-full gap-2",
@@ -2885,12 +2885,12 @@ function Qt({ values: e, options: t }) {
2885
2885
  className: "h-[480px] w-full overflow-hidden rounded border",
2886
2886
  role: "group",
2887
2887
  "aria-label": Gt,
2888
- children: /* @__PURE__ */ J(re, {
2888
+ children: /* @__PURE__ */ J(ie, {
2889
2889
  fallback: /* @__PURE__ */ J(Xt, {
2890
2890
  before: n,
2891
2891
  after: r
2892
2892
  }),
2893
- children: /* @__PURE__ */ J(pe, {
2893
+ children: /* @__PURE__ */ J(me, {
2894
2894
  fallback: /* @__PURE__ */ J(Yt, {}),
2895
2895
  children: i === "diff" ? /* @__PURE__ */ J(Kt, {
2896
2896
  before: o,
@@ -3016,7 +3016,7 @@ function rn(e, t) {
3016
3016
  return !t || Object.entries(t).every(([t, n]) => e[t] === n);
3017
3017
  }
3018
3018
  function an({ values: e, options: t }) {
3019
- let n = W(() => en(t), [t]), i = r(), a = te(), o = e.scope, s = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
3019
+ let n = W(() => en(t), [t]), i = r(), a = ne(), o = e.scope, s = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
3020
3020
  U(() => {
3021
3021
  l(s);
3022
3022
  }, [s]), U(() => {
@@ -3030,28 +3030,28 @@ function an({ values: e, options: t }) {
3030
3030
  field: n.window_field,
3031
3031
  op: "eq",
3032
3032
  value: c
3033
- }] : [], p = g(n?.entity, {
3033
+ }] : [], m = h(n?.entity, {
3034
3034
  per_page: 1,
3035
3035
  filters: f
3036
- }, !!(n && o && c)), h = n?.breakdown, _ = h ? [{
3037
- field: h.scope_field,
3036
+ }, !!(n && o && c)), g = n?.breakdown, _ = g ? [{
3037
+ field: g.scope_field,
3038
3038
  op: "eq",
3039
3039
  value: o
3040
3040
  }, {
3041
- field: h.window_field,
3041
+ field: g.window_field,
3042
3042
  op: "eq",
3043
3043
  value: c
3044
- }] : [], v = g(h?.entity, {
3045
- per_page: h?.limit ?? 200,
3046
- sort: h?.sort,
3044
+ }] : [], v = h(g?.entity, {
3045
+ per_page: g?.limit ?? 200,
3046
+ sort: g?.sort,
3047
3047
  filters: _
3048
- }, !!(h && o && c));
3048
+ }, !!(g && o && c));
3049
3049
  if (!n || !o) return /* @__PURE__ */ J("div", {
3050
3050
  role: "alert",
3051
3051
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3052
3052
  children: "Invalid entity_scorecard configuration."
3053
3053
  });
3054
- let y = p.data?.data?.[0], b = v.data?.data ?? [], x = h?.filter_field ? Array.from(new Set(b.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && h?.filter_field ? b.filter((e) => e[h.filter_field] === u) : b, C = (e) => !u || !e.filtered || !h?.filter_field ? y?.[e.field] : b.find((t) => t[h.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3054
+ let y = m.data?.data?.[0], b = v.data?.data ?? [], x = g?.filter_field ? Array.from(new Set(b.map((e) => e[g.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], S = u && g?.filter_field ? b.filter((e) => e[g.filter_field] === u) : b, C = (e) => !u || !e.filtered || !g?.filter_field ? y?.[e.field] : b.find((t) => t[g.filter_field] === u && rn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3055
3055
  let t = n.drillthrough;
3056
3056
  if (!t || !e.drillthrough_value) return;
3057
3057
  let r = [{
@@ -3072,10 +3072,10 @@ function an({ values: e, options: t }) {
3072
3072
  op: "eq",
3073
3073
  value: e.drillthrough_value
3074
3074
  }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
3075
- }, T = p.error ?? v.error;
3075
+ }, T = m.error ?? v.error;
3076
3076
  return /* @__PURE__ */ Y("div", {
3077
3077
  className: "flex min-w-0 flex-col gap-4",
3078
- "aria-label": m(n.title, i) || "Scorecard",
3078
+ "aria-label": p(n.title, i) || "Scorecard",
3079
3079
  children: [
3080
3080
  /* @__PURE__ */ Y("div", {
3081
3081
  className: "flex flex-wrap items-start justify-between gap-3",
@@ -3084,15 +3084,15 @@ function an({ values: e, options: t }) {
3084
3084
  children: [
3085
3085
  n.title && /* @__PURE__ */ J("h3", {
3086
3086
  className: "text-base font-semibold text-foreground",
3087
- children: m(n.title, i)
3087
+ children: p(n.title, i)
3088
3088
  }),
3089
3089
  n.description && /* @__PURE__ */ J("p", {
3090
3090
  className: "mt-1 text-sm text-muted-foreground",
3091
- children: m(n.description, i)
3091
+ children: p(n.description, i)
3092
3092
  }),
3093
3093
  n.intended_note && /* @__PURE__ */ J("p", {
3094
3094
  className: "mt-1 text-xs text-muted-foreground",
3095
- children: m(n.intended_note, i)
3095
+ children: p(n.intended_note, i)
3096
3096
  })
3097
3097
  ]
3098
3098
  }), /* @__PURE__ */ Y("div", {
@@ -3106,18 +3106,18 @@ function an({ values: e, options: t }) {
3106
3106
  "aria-pressed": c === e.code,
3107
3107
  onClick: () => l(e.code),
3108
3108
  className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3109
- children: m(e.label, i) || e.code
3109
+ children: p(e.label, i) || e.code
3110
3110
  }, e.code))
3111
- }), h?.filter_field && /* @__PURE__ */ Y("label", {
3111
+ }), g?.filter_field && /* @__PURE__ */ Y("label", {
3112
3112
  className: "flex items-center gap-2 text-xs text-muted-foreground",
3113
- children: [m(h.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3114
- "aria-label": m(h.filter_label, i) || "Filter",
3113
+ children: [p(g.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3114
+ "aria-label": p(g.filter_label, i) || "Filter",
3115
3115
  value: u,
3116
3116
  onChange: (e) => d(e.target.value),
3117
3117
  className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3118
3118
  children: [/* @__PURE__ */ J("option", {
3119
3119
  value: "",
3120
- children: m(h.all_label, i) || "All"
3120
+ children: p(g.all_label, i) || "All"
3121
3121
  }), x.map((e) => /* @__PURE__ */ J("option", {
3122
3122
  value: e,
3123
3123
  children: e
@@ -3131,9 +3131,9 @@ function an({ values: e, options: t }) {
3131
3131
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3132
3132
  children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
3133
3133
  }),
3134
- !T && !p.isLoading && !y && /* @__PURE__ */ J("div", {
3134
+ !T && !m.isLoading && !y && /* @__PURE__ */ J("div", {
3135
3135
  className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3136
- children: m(n.empty_label, i) || "No scorecard data."
3136
+ children: p(n.empty_label, i) || "No scorecard data."
3137
3137
  }),
3138
3138
  y && /* @__PURE__ */ J("div", {
3139
3139
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
@@ -3141,7 +3141,7 @@ function an({ values: e, options: t }) {
3141
3141
  let t = C(e), r = !!(n.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
3142
3142
  /* @__PURE__ */ J("span", {
3143
3143
  className: "text-xs font-medium text-muted-foreground",
3144
- children: m(e.label, i) || e.field
3144
+ children: p(e.label, i) || e.field
3145
3145
  }),
3146
3146
  /* @__PURE__ */ J("strong", {
3147
3147
  className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
@@ -3149,7 +3149,7 @@ function an({ values: e, options: t }) {
3149
3149
  }),
3150
3150
  e.help && /* @__PURE__ */ J("span", {
3151
3151
  className: "mt-1 block text-xs text-muted-foreground",
3152
- children: m(e.help, i)
3152
+ children: p(e.help, i)
3153
3153
  })
3154
3154
  ] });
3155
3155
  return r ? /* @__PURE__ */ J("button", {
@@ -3163,26 +3163,26 @@ function an({ values: e, options: t }) {
3163
3163
  }, e.field);
3164
3164
  })
3165
3165
  }),
3166
- h && /* @__PURE__ */ J("div", {
3166
+ g && /* @__PURE__ */ J("div", {
3167
3167
  className: "min-w-0 overflow-x-auto rounded border border-border",
3168
3168
  children: /* @__PURE__ */ Y("table", {
3169
3169
  className: "w-full border-collapse text-sm",
3170
3170
  children: [/* @__PURE__ */ J("thead", {
3171
3171
  className: "bg-surface text-left text-xs text-muted-foreground",
3172
- children: /* @__PURE__ */ J("tr", { children: h.columns.map((e) => /* @__PURE__ */ J("th", {
3172
+ children: /* @__PURE__ */ J("tr", { children: g.columns.map((e) => /* @__PURE__ */ J("th", {
3173
3173
  className: "border-b border-divider px-3 py-2 font-medium",
3174
- children: m(e.label, i) || e.field
3174
+ children: p(e.label, i) || e.field
3175
3175
  }, e.field)) })
3176
3176
  }), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
3177
3177
  className: "border-b border-divider last:border-0",
3178
- children: h.columns.map((t) => /* @__PURE__ */ J("td", {
3178
+ children: g.columns.map((t) => /* @__PURE__ */ J("td", {
3179
3179
  className: "px-3 py-2 text-foreground",
3180
3180
  children: tn(e[t.field], t.format, i)
3181
3181
  }, t.field))
3182
3182
  }, nn(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
3183
- colSpan: Math.max(1, h.columns.length),
3183
+ colSpan: Math.max(1, g.columns.length),
3184
3184
  className: "px-3 py-6 text-center text-muted-foreground",
3185
- children: m(h.empty_label, i) || "No breakdown rows."
3185
+ children: p(g.empty_label, i) || "No breakdown rows."
3186
3186
  }) })] })]
3187
3187
  })
3188
3188
  })
@@ -3193,13 +3193,13 @@ function an({ values: e, options: t }) {
3193
3193
  //#region src/components/detail-layout/widgets/builtins.ts
3194
3194
  var on = !1;
3195
3195
  function sn() {
3196
- on ||= (oe("json_diff", Qt), oe("entity_scorecard", an), !0);
3196
+ on ||= (se("json_diff", Qt), se("entity_scorecard", an), !0);
3197
3197
  }
3198
3198
  //#endregion
3199
3199
  //#region src/components/detail-layout/widgets/WidgetHost.tsx
3200
3200
  sn();
3201
3201
  function cn({ config: e, ctx: t }) {
3202
- let n = se(e.type);
3202
+ let n = ce(e.type);
3203
3203
  if (!n) return /* @__PURE__ */ J("span", {
3204
3204
  className: "text-sm text-muted-foreground",
3205
3205
  children: `unknown widget: ${e.type}`