@declarion/react 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as n, An as r, Cn as i, En as a, Fn as o, Gn as s, Gt as c, In as l, M as u, Tn as d, X as f, Xn as p, Z as m, _t as h, bn as g, cr as _, f as v, ir as y, j as b, kn as x, kt as S, lr as C, mn as w, nr as T, rt as E, sr as D, vt as O, wn as k, xn as A, yn as j, yt as M } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { A as ee, F as te, I as N, J as P, L as ne, P as F, R as I, T as L, V as R, at as z, d as B, it as re, mt as ie, o as ae, pt as oe, q as se, r as ce, t as le, u as ue, z as de } from "./registry-r4hiflwC.js";
2
+ import { A as n, An as r, Dn as i, En as a, Gt as o, In as s, Kn as c, Ln as l, M as u, Sn as d, Tn as f, X as p, Z as m, Zn as h, _t as g, ar as _, bn as v, cr as y, f as b, j as x, jn as S, kt as C, lr as w, mn as T, rr as E, rt as D, ur as O, vt as k, wn as A, xn as j, yt as M } from "./useCurrentScreen-A3xZDs7U.js";
3
+ import { A as ee, F as te, I as N, J as P, L as ne, P as F, R as I, T as L, V as R, at as z, d as B, it as re, mt as ie, o as ae, pt as oe, q as se, r as ce, t as le, u as ue, z as de } from "./registry-DJKp0yaV.js";
4
4
  import { n as fe, r as pe, t as me } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Suspense as he, createContext as ge, lazy as _e, useCallback as V, useContext as ve, useEffect as H, useId as ye, useLayoutEffect as be, useMemo as U, useRef as W, useState as G } from "react";
6
6
  import { useInfiniteQuery as xe, useMutation as Se, useQueryClient as Ce } from "@tanstack/react-query";
@@ -123,13 +123,13 @@ function Ae(e) {
123
123
  function je(e, t) {
124
124
  let n = Ae(e);
125
125
  if (n) {
126
- if (e.label) return k(e.label);
126
+ if (e.label) return f(e.label);
127
127
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return k(r.display.name);
128
+ if (r?.display?.name) return f(r.display.name);
129
129
  let i = t.schema.entities[n];
130
- return i && (k(i.display.name_plural) || k(i.display.name)) || n;
130
+ return i && (f(i.display.name_plural) || f(i.display.name)) || n;
131
131
  }
132
- return e.section ? k(e.section.name) : "Tab";
132
+ return e.section ? f(e.section.name) : "Tab";
133
133
  }
134
134
  function Y(e, t) {
135
135
  if (e.icon) return e.icon;
@@ -144,7 +144,7 @@ function Y(e, t) {
144
144
  //#endregion
145
145
  //#region src/components/detail-layout/LayoutTabs.tsx
146
146
  function Me({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = G(0), o = T(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
147
+ let { items: r } = e, [i, a] = G(0), o = E(), 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}`);
@@ -338,16 +338,16 @@ function Ne({ config: e, ctx: n }) {
338
338
  }, d = s ? /* @__PURE__ */ q(t, {
339
339
  name: s,
340
340
  size: 14
341
- }) : void 0, f = c ? {
342
- text: k(c.text),
341
+ }) : void 0, p = c ? {
342
+ text: f(c.text),
343
343
  tone: c.tone,
344
344
  dot: c.dot
345
345
  } : void 0;
346
346
  return /* @__PURE__ */ q(ie, {
347
- title: k(r),
347
+ title: f(r),
348
348
  defaultOpen: !a,
349
349
  icon: d,
350
- badge: f,
350
+ badge: p,
351
351
  emphasis: l,
352
352
  headingLevel: n.withinCard ? 3 : 2,
353
353
  children: /* @__PURE__ */ q(hn, {
@@ -383,7 +383,7 @@ function X(e, t, n) {
383
383
  return e ?? t ?? n;
384
384
  }
385
385
  function Fe(e) {
386
- return j(e, "update") ? "inline_edit" : "readonly";
386
+ return v(e, "update") ? "inline_edit" : "readonly";
387
387
  }
388
388
  function Ie(e) {
389
389
  return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
@@ -459,7 +459,7 @@ function We(e, ...t) {
459
459
  }
460
460
  }
461
461
  function Ge(e) {
462
- let t = i(e);
462
+ let t = A(e);
463
463
  return t.length > 0 ? t[0] : void 0;
464
464
  }
465
465
  function Ke(e, t) {
@@ -468,16 +468,16 @@ function Ke(e, t) {
468
468
  //#endregion
469
469
  //#region src/lib/quick-add.ts
470
470
  function qe(e, t, n, r) {
471
- let i = {
471
+ let a = {
472
472
  ...t ?? {},
473
473
  ...e
474
474
  };
475
475
  if (Array.isArray(n)) {
476
- let e = Array.isArray(r) ? r.map(String) : a(String(r), n.length);
476
+ let e = Array.isArray(r) ? r.map(String) : i(String(r), n.length);
477
477
  if (!e || e.length !== n.length) throw Error("invalid composite parent id");
478
- for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
479
- } else i[n] = Array.isArray(r) ? r[0] : r;
480
- return i;
478
+ for (let t = 0; t < n.length; t++) a[n[t]] = e[t];
479
+ } else a[n] = Array.isArray(r) ? r[0] : r;
480
+ return a;
481
481
  }
482
482
  function Je(e, t) {
483
483
  for (let n of t) {
@@ -489,26 +489,26 @@ function Je(e, t) {
489
489
  //#endregion
490
490
  //#region src/components/detail-layout/useQuickAdd.ts
491
491
  function Ye(e, t, n, r) {
492
- let [i, a] = G(() => {
492
+ let [i, o] = G(() => {
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] = o()) : 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] = s()) : i[e] = t.defaults[e];
495
495
  return i;
496
- }), s = Ce(), { mutate: c, isPending: l, error: u, reset: f } = Se({
497
- mutationFn: (t) => h(e.entity, t),
496
+ }), c = Ce(), { mutate: l, isPending: u, error: d, reset: f } = Se({
497
+ mutationFn: (t) => g(e.entity, t),
498
498
  onMutate: async (r) => {
499
499
  let i = [
500
500
  ne,
501
501
  t,
502
- Array.isArray(n) ? d(n.map(String)) : n,
502
+ Array.isArray(n) ? a(n.map(String)) : n,
503
503
  e.entity
504
504
  ];
505
- await s.cancelQueries({ queryKey: i });
506
- let a = s.getQueriesData({ queryKey: i }), o = {
505
+ await c.cancelQueries({ queryKey: i });
506
+ let o = c.getQueriesData({ queryKey: i }), s = {
507
507
  ...r,
508
508
  id: `__optimistic_${crypto.randomUUID()}`,
509
509
  __optimistic: !0
510
510
  };
511
- return s.setQueriesData({ queryKey: i }, (e) => {
511
+ return c.setQueriesData({ queryKey: i }, (e) => {
512
512
  if (!e || typeof e != "object") return e;
513
513
  if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
514
514
  let t = e, [n, ...r] = t.pages;
@@ -516,38 +516,38 @@ function Ye(e, t, n, r) {
516
516
  ...t,
517
517
  pages: [{
518
518
  ...n,
519
- data: [o, ...n.data]
519
+ data: [s, ...n.data]
520
520
  }, ...r]
521
521
  };
522
522
  }
523
523
  return e;
524
- }), { snapshots: a };
524
+ }), { snapshots: o };
525
525
  },
526
526
  onError: (e, t, n) => {
527
- if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
527
+ if (n?.snapshots) for (let [e, t] of n.snapshots) c.setQueryData(e, t);
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] = o() : i[e] = "" : i[e] = t.defaults[e];
532
- a(i);
531
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = s() : i[e] = "" : i[e] = t.defaults[e];
532
+ o(i);
533
533
  },
534
534
  onSettled: () => {
535
- let r = Array.isArray(n) ? d(n.map(String)) : n;
536
- s.invalidateQueries({ queryKey: [
535
+ let r = Array.isArray(n) ? a(n.map(String)) : n;
536
+ c.invalidateQueries({ queryKey: [
537
537
  ne,
538
538
  t,
539
539
  r,
540
540
  e.entity
541
541
  ] });
542
542
  }
543
- }), p = e.quick_add, m = r.entities[e.entity], g = Je(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
543
+ }), p = e.quick_add, m = r.entities[e.entity], h = Je(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
544
544
  function _(t) {
545
545
  if (t.preventDefault(), !p) return;
546
546
  let r = qe(i, p.defaults, e.foreign_key, n);
547
- c(r);
547
+ l(r);
548
548
  }
549
549
  function v(e, t) {
550
- u && f(), a((n) => ({
550
+ d && f(), o((n) => ({
551
551
  ...n,
552
552
  [e]: t
553
553
  }));
@@ -556,9 +556,9 @@ function Ye(e, t, n, r) {
556
556
  values: i,
557
557
  quickAdd: p,
558
558
  childEntity: m,
559
- isPending: l,
560
- error: u,
561
- isReady: g,
559
+ isPending: u,
560
+ error: d,
561
+ isReady: h,
562
562
  handleSubmit: _,
563
563
  handleFieldChange: v
564
564
  };
@@ -566,12 +566,12 @@ function Ye(e, t, n, r) {
566
566
  //#endregion
567
567
  //#region src/components/detail-layout/QuickAddForm.tsx
568
568
  function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
569
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, r, i, a), m = n(), h = T(), g = ye();
569
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: f, handleSubmit: p, handleFieldChange: m } = Ye(t, r, i, a), h = n(), g = E(), _ = ye();
570
570
  return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ J("form", {
571
- onSubmit: f,
571
+ onSubmit: p,
572
572
  style: {
573
573
  display: "flex",
574
- flexDirection: h.isPhone ? "column" : "row",
574
+ flexDirection: g.isPhone ? "column" : "row",
575
575
  alignItems: "flex-end",
576
576
  gap: 8,
577
577
  padding: "8px 0",
@@ -581,12 +581,12 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
581
581
  s.fields.map((e) => {
582
582
  let n = c.fields.get(e);
583
583
  if (!n) return null;
584
- let r = `${g}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
584
+ let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
585
585
  return /* @__PURE__ */ J("div", {
586
586
  style: {
587
587
  flex: 1,
588
588
  minWidth: 0,
589
- width: h.isPhone ? "100%" : void 0
589
+ width: g.isPhone ? "100%" : void 0
590
590
  },
591
591
  children: [/* @__PURE__ */ q("label", {
592
592
  id: i,
@@ -598,27 +598,27 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
598
598
  display: "block",
599
599
  fontWeight: 500
600
600
  },
601
- children: A(n, e, a.entities)
602
- }), b({
601
+ children: d(n, e, a.entities)
602
+ }), x({
603
603
  field: n,
604
604
  fieldName: e,
605
605
  value: o[e] ?? "",
606
606
  mode: "edit",
607
- onChange: (t) => p(e, t),
607
+ onChange: (t) => m(e, t),
608
608
  record: o,
609
609
  fieldId: r,
610
610
  labelId: i,
611
- locale: m
611
+ locale: h
612
612
  })]
613
613
  }, e);
614
614
  }),
615
- /* @__PURE__ */ q(C, {
615
+ /* @__PURE__ */ q(O, {
616
616
  type: "submit",
617
617
  kind: "primary",
618
- size: h.isPhone ? "md" : "sm",
618
+ size: g.isPhone ? "md" : "sm",
619
619
  icon: /* @__PURE__ */ q(e.plus, { size: 12 }),
620
- disabled: l || !d,
621
- style: h.isPhone ? { alignSelf: "flex-end" } : void 0,
620
+ disabled: l || !f,
621
+ style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
622
622
  children: "Add"
623
623
  }),
624
624
  u != null && /* @__PURE__ */ q("span", {
@@ -725,34 +725,34 @@ function et({ colId: e, onMouseDown: t }) {
725
725
  }
726
726
  //#endregion
727
727
  //#region src/components/detail-layout/ChildrenTable.tsx
728
- function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
729
- let s = o.entities[t.entity], c = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, d = $e(Ze(i, t.entity, c)), f = n(), m = N((e) => e.degradedEntities), { data: h, isLoading: g, isError: v, isFetching: y, refetch: b } = I(i, a, t.entity, t.foreign_key, t.sort, t.limit), x = h?.data ?? [], S = h?.$refs, C = W(S);
730
- C.current = S;
731
- let w = t.columns, T = t.interaction === "navigate", E = w[0], O = T && s ? r(void 0, s, o.screens) : null, k = s ? Ge(s) : void 0, j = U(() => {
728
+ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
729
+ let o = a.entities[t.entity], s = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, c = $e(Ze(r, t.entity, s)), f = n(), p = N((e) => e.degradedEntities), { data: m, isLoading: g, isError: _, isFetching: v, refetch: b } = I(r, i, t.entity, t.foreign_key, t.sort, t.limit), x = m?.data ?? [], C = m?.$refs, T = W(C);
730
+ T.current = C;
731
+ let E = t.columns, D = t.interaction === "navigate", O = E[0], k = D && o ? S(void 0, o, a.screens) : null, A = o ? Ge(o) : void 0, j = U(() => {
732
732
  let e = /* @__PURE__ */ new Map();
733
- if (!s) return e;
734
- for (let t of w) {
735
- let n = s.fields.get(t);
733
+ if (!o) return e;
734
+ for (let t of E) {
735
+ let n = o.fields.get(t);
736
736
  n && e.set(t, u({
737
737
  field: n,
738
738
  fieldName: t,
739
739
  surface: "list",
740
- entity: s,
741
- entities: o.entities,
742
- screens: o.screens,
743
- refs: () => C.current,
740
+ entity: o,
741
+ entities: a.entities,
742
+ screens: a.screens,
743
+ refs: () => T.current,
744
744
  locale: f
745
745
  }));
746
746
  }
747
747
  return e;
748
748
  }, [
749
- s,
750
- w,
751
- o.entities,
752
- o.screens,
749
+ o,
750
+ E,
751
+ a.entities,
752
+ a.screens,
753
753
  f
754
754
  ]);
755
- if (!s) return /* @__PURE__ */ q("div", {
755
+ if (!o) return /* @__PURE__ */ q("div", {
756
756
  style: {
757
757
  fontSize: 12.5,
758
758
  color: "var(--text-3)",
@@ -762,10 +762,10 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
762
762
  });
763
763
  let M = /* @__PURE__ */ q(Xe, {
764
764
  config: t,
765
- parentEntity: i,
766
- parentId: a,
767
- schema: o
768
- }), ee = te(s.realtime, m, t.entity), P = /* @__PURE__ */ J("div", {
765
+ parentEntity: r,
766
+ parentId: i,
767
+ schema: a
768
+ }), ee = te(o.realtime, p, t.entity), P = /* @__PURE__ */ J("div", {
769
769
  style: {
770
770
  display: "flex",
771
771
  alignItems: "center",
@@ -774,38 +774,38 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
774
774
  justifyContent: "flex-end"
775
775
  },
776
776
  children: [
777
- d.hasWidths && /* @__PURE__ */ q(_, {
777
+ c.hasWidths && /* @__PURE__ */ q(w, {
778
778
  icon: /* @__PURE__ */ q(e.columns, { size: 13 }),
779
779
  title: "Reset column widths (this device)",
780
780
  size: 24,
781
- onClick: d.resetWidths
781
+ onClick: c.resetWidths
782
782
  }),
783
783
  ee && /* @__PURE__ */ q("span", {
784
784
  "data-testid": "children-live-indicator",
785
785
  title: "This table updates automatically in realtime.",
786
- children: /* @__PURE__ */ q(D, {
786
+ children: /* @__PURE__ */ q(y, {
787
787
  tone: "emerald",
788
788
  size: "xs",
789
789
  dot: !0,
790
790
  children: "Live"
791
791
  })
792
792
  }),
793
- /* @__PURE__ */ q(_, {
794
- icon: y ? /* @__PURE__ */ q("span", {
793
+ /* @__PURE__ */ q(w, {
794
+ icon: v ? /* @__PURE__ */ q("span", {
795
795
  "data-testid": "children-refresh-spinner",
796
796
  style: { display: "inline-flex" },
797
- children: /* @__PURE__ */ q(p, { size: 13 })
797
+ children: /* @__PURE__ */ q(h, { size: 13 })
798
798
  }) : /* @__PURE__ */ q(e.refresh, { size: 13 }),
799
799
  title: "Refresh",
800
800
  size: 24,
801
- disabled: y,
801
+ disabled: v,
802
802
  onClick: () => {
803
803
  b();
804
804
  }
805
805
  })
806
806
  ]
807
807
  });
808
- return v ? /* @__PURE__ */ J("div", { children: [
808
+ return _ ? /* @__PURE__ */ J("div", { children: [
809
809
  M,
810
810
  P,
811
811
  /* @__PURE__ */ q("div", {
@@ -854,22 +854,22 @@ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
854
854
  style: { overflowX: "auto" },
855
855
  children: /* @__PURE__ */ J("table", {
856
856
  style: pe,
857
- children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ q("tr", { children: w.map((e) => {
858
- let t = s.fields.get(e);
857
+ children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ q("tr", { children: E.map((e) => {
858
+ let t = o.fields.get(e);
859
859
  return /* @__PURE__ */ J("th", {
860
- style: d.headerStyle(e, fe),
861
- children: [t ? A(t, e, o.entities) : e, /* @__PURE__ */ q(et, {
860
+ style: c.headerStyle(e, fe),
861
+ children: [t ? d(t, e, a.entities) : e, /* @__PURE__ */ q(et, {
862
862
  colId: e,
863
- onMouseDown: d.onHandleMouseDown
863
+ onMouseDown: c.onHandleMouseDown
864
864
  })]
865
865
  }, e);
866
866
  }) }) }), /* @__PURE__ */ q("tbody", { children: x.map((e, t) => {
867
- let n = k ? l(e[k]) : "", r = T && O && n ? O.replace(/:\w+/, n) : void 0;
868
- return /* @__PURE__ */ q("tr", { children: w.map((t) => {
869
- let n = t === E, i = j.get(t), a = i ? i(e[t], e) : l(e[t]);
867
+ let n = A ? l(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
868
+ return /* @__PURE__ */ q("tr", { children: E.map((t) => {
869
+ let n = t === O, i = j.get(t), a = i ? i(e[t], e) : l(e[t]);
870
870
  return /* @__PURE__ */ q("td", {
871
871
  title: typeof a == "string" ? a : void 0,
872
- style: d.cellStyle(t, me),
872
+ style: c.cellStyle(t, me),
873
873
  children: n && r ? /* @__PURE__ */ q("a", {
874
874
  href: r,
875
875
  style: {
@@ -974,7 +974,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
974
974
  textOverflow: "ellipsis",
975
975
  whiteSpace: "nowrap"
976
976
  },
977
- children: (typeof e.$display == "string" ? e[w] : "") || (h && a.fields.get(h) ? b({
977
+ children: (typeof e.$display == "string" ? e[T] : "") || (h && a.fields.get(h) ? x({
978
978
  field: a.fields.get(h),
979
979
  fieldName: h,
980
980
  value: e[h],
@@ -993,7 +993,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
993
993
  textOverflow: "ellipsis",
994
994
  whiteSpace: "nowrap"
995
995
  },
996
- children: t.map((t, n) => /* @__PURE__ */ J("span", { children: [n > 0 && " · ", a.fields.get(t) ? b({
996
+ children: t.map((t, n) => /* @__PURE__ */ J("span", { children: [n > 0 && " · ", a.fields.get(t) ? x({
997
997
  field: a.fields.get(t),
998
998
  fieldName: t,
999
999
  value: e[t],
@@ -1024,13 +1024,13 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1024
1024
  display: "grid",
1025
1025
  gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
1026
1026
  gap: 12
1027
- }, y = /* @__PURE__ */ q(Xe, {
1027
+ }, b = /* @__PURE__ */ q(Xe, {
1028
1028
  config: e,
1029
1029
  parentEntity: t,
1030
1030
  parentId: r,
1031
1031
  schema: i
1032
1032
  });
1033
- if (u) return /* @__PURE__ */ J("div", { children: [y, /* @__PURE__ */ q("div", {
1033
+ if (u) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1034
1034
  style: {
1035
1035
  fontSize: 12.5,
1036
1036
  color: "var(--danger)",
@@ -1038,7 +1038,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1038
1038
  },
1039
1039
  children: "Failed to load. Try again."
1040
1040
  })] });
1041
- if (c) return /* @__PURE__ */ J("div", { children: [y, /* @__PURE__ */ q("div", {
1041
+ if (c) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1042
1042
  style: v,
1043
1043
  children: [
1044
1044
  0,
@@ -1050,7 +1050,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1050
1050
  borderRadius: 10
1051
1051
  } }, e))
1052
1052
  })] });
1053
- if (d.length === 0) return /* @__PURE__ */ J("div", { children: [y, /* @__PURE__ */ q("div", {
1053
+ if (d.length === 0) return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1054
1054
  style: {
1055
1055
  fontSize: 12.5,
1056
1056
  color: "var(--text-3)",
@@ -1058,8 +1058,8 @@ function rt({ config: e, parentEntity: t, parentId: r, 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__ */ J("div", { children: [y, /* @__PURE__ */ q("div", {
1061
+ let S = p.filter((e) => e !== h && e !== g);
1062
+ return /* @__PURE__ */ J("div", { children: [b, /* @__PURE__ */ q("div", {
1063
1063
  style: v,
1064
1064
  children: d.map((t, n) => /* @__PURE__ */ J("div", {
1065
1065
  style: {
@@ -1075,7 +1075,7 @@ function rt({ config: e, parentEntity: t, parentId: r, 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: S.length > 0 ? "1px solid var(--divider)" : "none"
1079
1079
  },
1080
1080
  children: [/* @__PURE__ */ q("div", {
1081
1081
  style: {
@@ -1085,7 +1085,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1085
1085
  textOverflow: "ellipsis",
1086
1086
  whiteSpace: "nowrap"
1087
1087
  },
1088
- children: h && a.fields.get(h) ? b({
1088
+ children: h && a.fields.get(h) ? x({
1089
1089
  field: a.fields.get(h),
1090
1090
  fieldName: h,
1091
1091
  value: t[h],
@@ -1094,10 +1094,10 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1094
1094
  refs: f,
1095
1095
  locale: o
1096
1096
  }) : `Record ${n + 1}`
1097
- }), g && t[g] != null && /* @__PURE__ */ q(D, {
1097
+ }), g && t[g] != null && /* @__PURE__ */ q(y, {
1098
1098
  tone: "slate",
1099
1099
  size: "xs",
1100
- children: a.fields.get(g) ? b({
1100
+ children: a.fields.get(g) ? x({
1101
1101
  field: a.fields.get(g),
1102
1102
  fieldName: g,
1103
1103
  value: t[g],
@@ -1107,14 +1107,14 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1107
1107
  locale: o
1108
1108
  }) : l(t[g])
1109
1109
  })]
1110
- }), x.length > 0 && /* @__PURE__ */ q("div", {
1110
+ }), S.length > 0 && /* @__PURE__ */ q("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: S.slice(0, 4).map((n) => {
1118
1118
  let r = a.fields.get(n);
1119
1119
  return r ? /* @__PURE__ */ J("div", {
1120
1120
  style: {
@@ -1135,7 +1135,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1135
1135
  textOverflow: "ellipsis",
1136
1136
  whiteSpace: "nowrap"
1137
1137
  },
1138
- children: b({
1138
+ children: x({
1139
1139
  field: r,
1140
1140
  fieldName: n,
1141
1141
  value: t[n],
@@ -1154,26 +1154,26 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1154
1154
  //#endregion
1155
1155
  //#region src/hooks/useTimelineData.ts
1156
1156
  var it = 50;
1157
- function at(e, t, n, r, i, o) {
1158
- let s = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? a(t, s.length) : [t], u = o ?? it, d = xe({
1157
+ function at(e, t, n, r, a, s) {
1158
+ let c = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? i(t, c.length) : [t], u = s ?? it, d = xe({
1159
1159
  queryKey: [
1160
1160
  ne,
1161
1161
  e,
1162
1162
  t,
1163
1163
  n,
1164
1164
  "timeline",
1165
- i,
1165
+ a,
1166
1166
  u
1167
1167
  ],
1168
1168
  queryFn: ({ pageParam: e }) => {
1169
1169
  let t = new URLSearchParams();
1170
1170
  if (!l) throw Error("invalid composite parent id");
1171
- let r = s.map((e, t) => ({
1171
+ let r = c.map((e, t) => ({
1172
1172
  field: e,
1173
1173
  op: "eq",
1174
1174
  value: l[t]
1175
1175
  }));
1176
- return t.set("filters", JSON.stringify(r)), 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), c(`/api/data/${n}?${t.toString()}`);
1176
+ return t.set("filters", JSON.stringify(r)), a ? t.set("sort", `${a}: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), o(`/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,9 +1193,9 @@ function at(e, t, n, r, i, o) {
1193
1193
  //#region src/components/detail-layout/TimelineComposer.tsx
1194
1194
  var ot = "quick_entry", st = 100, ct = 240, lt = 800, ut = 80;
1195
1195
  function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1196
- let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, r, i, a), m = n(), [h, g] = G(ct), _ = W(null), y = W(null), [x, S] = G(lt);
1196
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, r, i, a), m = n(), [h, g] = G(ct), _ = W(null), v = W(null), [y, S] = G(lt);
1197
1197
  H(() => {
1198
- let e = y.current?.parentElement;
1198
+ let e = v.current?.parentElement;
1199
1199
  if (!e) return;
1200
1200
  let t = () => {
1201
1201
  let t = Math.max(st, e.clientHeight - ut);
@@ -1205,37 +1205,37 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1205
1205
  let n = new ResizeObserver(t);
1206
1206
  return n.observe(e), () => n.disconnect();
1207
1207
  }, []), H(() => {
1208
- g((e) => Math.min(e, x));
1209
- }, [x]);
1210
- let w = W(o);
1211
- w.current = o;
1212
- let T = W(p);
1213
- T.current = p;
1214
- let E = W({}), D = U(() => ({
1215
- getField: (e) => w.current[e],
1208
+ g((e) => Math.min(e, y));
1209
+ }, [y]);
1210
+ let C = W(o);
1211
+ C.current = o;
1212
+ let w = W(p);
1213
+ w.current = p;
1214
+ let T = W({}), E = U(() => ({
1215
+ getField: (e) => C.current[e],
1216
1216
  setField: (e, t) => {
1217
- T.current(e, t);
1217
+ w.current(e, t);
1218
1218
  },
1219
1219
  focusField: (e) => {
1220
- let t = E.current[e];
1220
+ let t = T.current[e];
1221
1221
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1222
1222
  }
1223
1223
  }), []);
1224
- H(() => v(ot, D), [D]);
1225
- let O = V((e) => {
1224
+ H(() => b(ot, E), [E]);
1225
+ let D = V((e) => {
1226
1226
  e.preventDefault(), _.current = {
1227
1227
  startY: e.clientY,
1228
1228
  startHeight: h
1229
1229
  };
1230
1230
  let t = (e) => {
1231
1231
  if (!_.current) return;
1232
- let t = _.current.startY - e.clientY, n = Math.min(x, Math.max(st, _.current.startHeight + t));
1232
+ let t = _.current.startY - e.clientY, n = Math.min(y, Math.max(st, _.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, x]);
1238
+ }, [h, y]);
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 dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1250
1250
  let t = c.fields.get(e);
1251
1251
  return t ? /* @__PURE__ */ q("div", {
1252
1252
  ref: (t) => {
1253
- E.current[e] = t;
1253
+ T.current[e] = t;
1254
1254
  },
1255
- children: b({
1255
+ children: x({
1256
1256
  field: t,
1257
1257
  fieldName: e,
1258
1258
  value: o[e] ?? "",
@@ -1264,7 +1264,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1264
1264
  }, e) : null;
1265
1265
  };
1266
1266
  return /* @__PURE__ */ J("div", {
1267
- ref: y,
1267
+ ref: v,
1268
1268
  style: {
1269
1269
  flexShrink: 0,
1270
1270
  borderTop: "1px solid var(--divider)",
@@ -1274,7 +1274,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1274
1274
  height: `${h}px`
1275
1275
  },
1276
1276
  children: [/* @__PURE__ */ q("div", {
1277
- onMouseDown: O,
1277
+ onMouseDown: D,
1278
1278
  title: "Drag to resize",
1279
1279
  style: {
1280
1280
  height: 12,
@@ -1321,9 +1321,9 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1321
1321
  display: "flex"
1322
1322
  },
1323
1323
  ref: (e) => {
1324
- E.current[k] = e;
1324
+ T.current[k] = e;
1325
1325
  },
1326
- children: b({
1326
+ children: x({
1327
1327
  field: c.fields.get(k),
1328
1328
  fieldName: k,
1329
1329
  value: o[k] ?? "",
@@ -1365,7 +1365,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1365
1365
  }),
1366
1366
  " to add"
1367
1367
  ]
1368
- }), /* @__PURE__ */ q(C, {
1368
+ }), /* @__PURE__ */ q(O, {
1369
1369
  type: "submit",
1370
1370
  kind: "primary",
1371
1371
  icon: /* @__PURE__ */ q(e.plus, { size: 13 }),
@@ -1401,50 +1401,50 @@ function vt(e, t) {
1401
1401
  let e = t.id;
1402
1402
  return e == null ? "" : l(e);
1403
1403
  }
1404
- return M(g(e, t));
1404
+ return M(j(e, t));
1405
1405
  }
1406
1406
  function yt(e) {
1407
1407
  return e.__optimistic === !0;
1408
1408
  }
1409
1409
  function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1410
- let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = at(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"), g = U(() => h ? [...a].reverse() : a, [a, h]), _ = f?.auto_scroll ?? "none", v = W(null), y = W(null), b = W(!1), x = W(0), S = W(null), w = W(null), T = W(!0), E = W(null);
1410
+ let i = r.entities[e.entity], { rows: a, refs: o, fetchNextPage: s, hasOlder: c, isFetchingOlder: l, isLoading: u, isError: d } = at(t, n, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), p = e.timeline, m = p?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = U(() => g ? [...a].reverse() : a, [a, g]), v = p?.auto_scroll ?? "none", y = W(null), b = W(null), x = W(!1), S = W(0), C = W(null), w = W(null), T = W(!0), E = W(null);
1411
1411
  H(() => {
1412
- b.current = !1, x.current = 0, S.current = null, w.current = null, T.current = !0, E.current = null;
1412
+ x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
1413
1413
  }, [n]), be(() => {
1414
- !l || !v.current || (E.current = {
1415
- scrollHeight: v.current.scrollHeight,
1416
- scrollTop: v.current.scrollTop
1414
+ !l || !y.current || (E.current = {
1415
+ scrollHeight: y.current.scrollHeight,
1416
+ scrollTop: y.current.scrollTop
1417
1417
  });
1418
1418
  }, [l]), be(() => {
1419
- let e = v.current;
1420
- if (!e || g.length === 0 || !i) {
1421
- x.current = g.length;
1419
+ let e = y.current;
1420
+ if (!e || _.length === 0 || !i) {
1421
+ S.current = _.length;
1422
1422
  return;
1423
1423
  }
1424
- let t = vt(i, g[0]), n = vt(i, g[g.length - 1]), r = !b.current, a = g.length > x.current && x.current > 0, o = a && (h && t !== S.current && n === w.current || !h && n !== w.current && t === S.current), s = a && !o;
1425
- if (r) h && _ === "bottom" && (e.scrollTop = e.scrollHeight), b.current = !0;
1424
+ let t = vt(i, _[0]), n = vt(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;
1425
+ if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1426
1426
  else if (o && E.current) {
1427
1427
  let t = E.current;
1428
- h && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
1429
- } else s && h && T.current && (e.scrollTop = e.scrollHeight);
1430
- x.current = g.length, S.current = t, w.current = n;
1428
+ g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
1429
+ } else s && g && T.current && (e.scrollTop = e.scrollHeight);
1430
+ S.current = _.length, C.current = t, w.current = n;
1431
1431
  }, [
1432
- g,
1433
1432
  _,
1434
- h,
1433
+ v,
1434
+ g,
1435
1435
  i
1436
1436
  ]);
1437
1437
  let D = V(() => {
1438
- let e = v.current;
1438
+ let e = y.current;
1439
1439
  e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
1440
1440
  }, []);
1441
1441
  H(() => {
1442
- let e = y.current;
1442
+ let e = b.current;
1443
1443
  if (!e || typeof IntersectionObserver > "u") return;
1444
1444
  let t = new IntersectionObserver((e) => {
1445
1445
  for (let t of e) t.isIntersecting && c && !l && s();
1446
1446
  }, {
1447
- root: v.current ?? null,
1447
+ root: y.current ?? null,
1448
1448
  rootMargin: `${pt}px 0px 0px 0px`,
1449
1449
  threshold: 0
1450
1450
  });
@@ -1454,7 +1454,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1454
1454
  l,
1455
1455
  s
1456
1456
  ]);
1457
- let [O, A] = G(null);
1457
+ let [k, A] = G(null);
1458
1458
  if (!i) return /* @__PURE__ */ q("div", {
1459
1459
  style: {
1460
1460
  fontSize: 12.5,
@@ -1463,21 +1463,21 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1463
1463
  },
1464
1464
  children: "Entity not found."
1465
1465
  });
1466
- let j = e.quick_add?.fields ?? [f?.content_field].filter(Boolean), M = k(i.display?.name_plural) || k(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ q("div", {
1466
+ let j = e.quick_add?.fields ?? [p?.content_field].filter(Boolean), M = f(i.display?.name_plural) || f(i.display?.name) || e.entity, ee = c ? /* @__PURE__ */ q("div", {
1467
1467
  style: {
1468
1468
  display: "flex",
1469
1469
  justifyContent: "center",
1470
1470
  padding: "6px 0"
1471
1471
  },
1472
- children: /* @__PURE__ */ q(C, {
1472
+ children: /* @__PURE__ */ q(O, {
1473
1473
  size: "xs",
1474
1474
  onClick: () => s(),
1475
1475
  disabled: l,
1476
- icon: l ? /* @__PURE__ */ q(p, { size: 11 }) : void 0,
1476
+ icon: l ? /* @__PURE__ */ q(h, { size: 11 }) : void 0,
1477
1477
  children: l ? "Loading…" : "Load older"
1478
1478
  })
1479
1479
  }) : null, te = /* @__PURE__ */ q("div", {
1480
- ref: y,
1480
+ ref: b,
1481
1481
  "aria-hidden": "true",
1482
1482
  style: { height: 1 }
1483
1483
  }), N;
@@ -1506,7 +1506,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1506
1506
  borderRadius: 8
1507
1507
  } })]
1508
1508
  });
1509
- else if (g.length === 0) N = /* @__PURE__ */ J(K, { children: [te, /* @__PURE__ */ q("div", {
1509
+ else if (_.length === 0) N = /* @__PURE__ */ J(K, { children: [te, /* @__PURE__ */ q("div", {
1510
1510
  style: {
1511
1511
  fontSize: 12.5,
1512
1512
  color: "var(--text-3)",
@@ -1524,20 +1524,20 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1524
1524
  entityCode: e.entity,
1525
1525
  parentEntity: t,
1526
1526
  parentId: n,
1527
- timeline: f,
1527
+ timeline: p,
1528
1528
  editableFields: j,
1529
1529
  refs: o,
1530
- isEditing: O === c,
1530
+ isEditing: k === c,
1531
1531
  onStartEdit: () => A(c),
1532
1532
  onCancelEdit: () => A(null),
1533
1533
  onSaved: () => A(null),
1534
1534
  schema: r,
1535
1535
  optimistic: yt(a)
1536
1536
  }, c);
1537
- }, s = f?.time_field, c;
1537
+ }, s = p?.time_field, c;
1538
1538
  if (s) {
1539
1539
  let e = [];
1540
- g.forEach((t, n) => {
1540
+ _.forEach((t, n) => {
1541
1541
  let r = t[s], i = Ct(r), a = e[e.length - 1];
1542
1542
  !a || a.key !== i ? e.push({
1543
1543
  key: i,
@@ -1561,7 +1561,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1561
1561
  count: e.rows.length
1562
1562
  }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1563
1563
  }, `day-${e.key}`));
1564
- } else c = g.map((e, t) => a(e, t));
1564
+ } else c = _.map((e, t) => a(e, t));
1565
1565
  N = /* @__PURE__ */ J(K, { children: [
1566
1566
  te,
1567
1567
  ee,
@@ -1594,7 +1594,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1594
1594
  })
1595
1595
  }),
1596
1596
  /* @__PURE__ */ q("div", {
1597
- ref: v,
1597
+ ref: y,
1598
1598
  onScroll: D,
1599
1599
  style: {
1600
1600
  flex: 1,
@@ -1627,52 +1627,52 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1627
1627
  schema: r
1628
1628
  })] });
1629
1629
  }
1630
- function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o, parentId: s, timeline: c, editableFields: u, refs: d, isEditing: f, onStartEdit: m, onCancelEdit: h, onSaved: g, schema: v, optimistic: y = !1 }) {
1631
- let x = Ce(), w = n(), [T, k] = G({}), j = V(() => {
1632
- x.invalidateQueries({ queryKey: [
1630
+ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o, parentId: s, timeline: c, editableFields: u, refs: f, isEditing: p, onStartEdit: m, onCancelEdit: g, onSaved: _, schema: v, optimistic: b = !1 }) {
1631
+ let S = Ce(), T = n(), [E, A] = G({}), j = V(() => {
1632
+ S.invalidateQueries({ queryKey: [
1633
1633
  ne,
1634
1634
  o,
1635
1635
  s,
1636
1636
  a
1637
1637
  ] });
1638
1638
  }, [
1639
- x,
1639
+ S,
1640
1640
  o,
1641
1641
  s,
1642
1642
  a
1643
1643
  ]), M = Se({
1644
1644
  mutationFn: (e) => {
1645
1645
  let n = t.$row_version;
1646
- return S(a, r, typeof n == "string" && n !== "" ? {
1646
+ return C(a, r, typeof n == "string" && n !== "" ? {
1647
1647
  ...e,
1648
1648
  $row_version: n
1649
1649
  } : e);
1650
1650
  },
1651
1651
  onSuccess: () => {
1652
- j(), E.success("Updated"), g();
1652
+ j(), D.success("Updated"), _();
1653
1653
  },
1654
- onError: (e) => E.error(e.message)
1654
+ onError: (e) => D.error(e.message)
1655
1655
  }), ee = Se({
1656
- mutationFn: () => O(a, r),
1656
+ mutationFn: () => k(a, r),
1657
1657
  onSuccess: () => {
1658
- j(), E.success("Deleted");
1658
+ j(), D.success("Deleted");
1659
1659
  },
1660
- onError: (e) => E.error(e.message)
1660
+ onError: (e) => D.error(e.message)
1661
1661
  }), te = V(() => {
1662
1662
  let e = {};
1663
1663
  for (let n of u) e[n] = t[n] ?? "";
1664
- k(e), m();
1664
+ A(e), m();
1665
1665
  }, [
1666
1666
  t,
1667
1667
  u,
1668
1668
  m
1669
1669
  ]), N = V((e, t) => {
1670
- k((n) => ({
1670
+ A((n) => ({
1671
1671
  ...n,
1672
1672
  [e]: t
1673
1673
  }));
1674
1674
  }, []), P = c?.time_field, F = c?.type_field, I = c?.summary_field, L = c?.content_field, R = c?.author_field, z = c?.direction_field, B = c?.intent_field;
1675
- return f ? /* @__PURE__ */ J("div", {
1675
+ return p ? /* @__PURE__ */ J("div", {
1676
1676
  style: {
1677
1677
  borderRadius: 10,
1678
1678
  border: "1px solid var(--accent)",
@@ -1691,15 +1691,15 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1691
1691
  marginBottom: 4,
1692
1692
  display: "block"
1693
1693
  },
1694
- children: A(t, e, v.entities)
1695
- }), b({
1694
+ children: d(t, e, v.entities)
1695
+ }), x({
1696
1696
  field: t,
1697
1697
  fieldName: e,
1698
- value: T[e] ?? "",
1698
+ value: E[e] ?? "",
1699
1699
  mode: "edit",
1700
1700
  onChange: (t) => N(e, t),
1701
- record: T,
1702
- locale: w
1701
+ record: E,
1702
+ locale: T
1703
1703
  })] }, e) : null;
1704
1704
  }), /* @__PURE__ */ J("div", {
1705
1705
  style: {
@@ -1708,18 +1708,18 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1708
1708
  gap: 6,
1709
1709
  paddingTop: 4
1710
1710
  },
1711
- children: [/* @__PURE__ */ q(C, {
1711
+ children: [/* @__PURE__ */ q(O, {
1712
1712
  kind: "primary",
1713
1713
  size: "xs",
1714
- icon: M.isPending ? /* @__PURE__ */ q(p, { size: 12 }) : /* @__PURE__ */ q(e.check, { size: 12 }),
1715
- onClick: () => M.mutate(T),
1714
+ icon: M.isPending ? /* @__PURE__ */ q(h, { size: 12 }) : /* @__PURE__ */ q(e.check, { size: 12 }),
1715
+ onClick: () => M.mutate(E),
1716
1716
  disabled: M.isPending,
1717
1717
  children: M.isPending ? "Saving…" : "Save"
1718
- }), /* @__PURE__ */ q(C, {
1718
+ }), /* @__PURE__ */ q(O, {
1719
1719
  size: "xs",
1720
1720
  icon: /* @__PURE__ */ q(e.x, { size: 12 }),
1721
1721
  onClick: () => {
1722
- k({}), h();
1722
+ A({}), g();
1723
1723
  },
1724
1724
  disabled: M.isPending,
1725
1725
  children: "Cancel"
@@ -1727,14 +1727,14 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1727
1727
  })]
1728
1728
  }) : /* @__PURE__ */ J("div", {
1729
1729
  className: "group",
1730
- "data-optimistic": y || void 0,
1730
+ "data-optimistic": b || void 0,
1731
1731
  style: {
1732
1732
  borderRadius: 10,
1733
1733
  border: "1px solid var(--border)",
1734
1734
  background: "var(--surface)",
1735
1735
  padding: 12,
1736
1736
  transition: "border-color .12s",
1737
- opacity: y ? .6 : 1
1737
+ opacity: b ? .6 : 1
1738
1738
  },
1739
1739
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1740
1740
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
@@ -1751,72 +1751,72 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1751
1751
  children: [
1752
1752
  P && t[P] != null && i.fields.get(P) && /* @__PURE__ */ q("span", {
1753
1753
  style: { fontWeight: 500 },
1754
- children: b({
1754
+ children: x({
1755
1755
  field: i.fields.get(P),
1756
1756
  fieldName: P,
1757
1757
  value: t[P],
1758
1758
  mode: "display",
1759
1759
  record: t,
1760
- refs: d,
1761
- locale: w
1760
+ refs: f,
1761
+ locale: T
1762
1762
  })
1763
1763
  }),
1764
- F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ q(D, {
1764
+ F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ q(y, {
1765
1765
  tone: "slate",
1766
1766
  size: "xs",
1767
- children: b({
1767
+ children: x({
1768
1768
  field: i.fields.get(F),
1769
1769
  fieldName: F,
1770
1770
  value: t[F],
1771
1771
  mode: "display",
1772
1772
  record: t,
1773
- refs: d,
1774
- locale: w
1773
+ refs: f,
1774
+ locale: T
1775
1775
  })
1776
1776
  }),
1777
1777
  z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ q(Et, {
1778
1778
  value: t[z],
1779
1779
  field: i.fields.get(z)
1780
1780
  }),
1781
- B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ q(D, {
1781
+ B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ q(y, {
1782
1782
  tone: "slate",
1783
1783
  size: "xs",
1784
- children: b({
1784
+ children: x({
1785
1785
  field: i.fields.get(B),
1786
1786
  fieldName: B,
1787
1787
  value: t[B],
1788
1788
  mode: "display",
1789
1789
  record: t,
1790
- refs: d,
1791
- locale: w
1790
+ refs: f,
1791
+ locale: T
1792
1792
  })
1793
1793
  }),
1794
1794
  R && t[R] != null && i.fields.get(R) && /* @__PURE__ */ J("span", { children: [
1795
1795
  "by",
1796
1796
  " ",
1797
- b({
1797
+ x({
1798
1798
  field: i.fields.get(R),
1799
1799
  fieldName: R,
1800
1800
  value: t[R],
1801
1801
  mode: "display",
1802
1802
  record: t,
1803
- refs: d,
1804
- locale: w
1803
+ refs: f,
1804
+ locale: T
1805
1805
  })
1806
1806
  ] }),
1807
- !y && /* @__PURE__ */ J("div", {
1807
+ !b && /* @__PURE__ */ J("div", {
1808
1808
  style: {
1809
1809
  marginLeft: "auto",
1810
1810
  display: "flex",
1811
1811
  alignItems: "center",
1812
1812
  gap: 2
1813
1813
  },
1814
- children: [/* @__PURE__ */ q(_, {
1814
+ children: [/* @__PURE__ */ q(w, {
1815
1815
  size: 22,
1816
1816
  icon: /* @__PURE__ */ q(e.edit, { size: 11 }),
1817
1817
  onClick: te,
1818
1818
  title: "Edit"
1819
- }), /* @__PURE__ */ q(_, {
1819
+ }), /* @__PURE__ */ q(w, {
1820
1820
  size: 22,
1821
1821
  icon: /* @__PURE__ */ q(e.trash, { size: 11 }),
1822
1822
  onClick: () => ee.mutate(),
@@ -1831,25 +1831,25 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1831
1831
  fontWeight: 500,
1832
1832
  marginTop: 6
1833
1833
  },
1834
- children: b({
1834
+ children: x({
1835
1835
  field: i.fields.get(I),
1836
1836
  fieldName: I,
1837
1837
  value: t[I],
1838
1838
  mode: "display",
1839
1839
  record: t,
1840
- refs: d,
1841
- locale: w
1840
+ refs: f,
1841
+ locale: T
1842
1842
  })
1843
1843
  }),
1844
1844
  L && t[L] != null && L !== I && i.fields.get(L) && /* @__PURE__ */ q(St, {
1845
- rendered: b({
1845
+ rendered: x({
1846
1846
  field: i.fields.get(L),
1847
1847
  fieldName: L,
1848
1848
  value: t[L],
1849
1849
  mode: "display",
1850
1850
  record: t,
1851
- refs: d,
1852
- locale: w
1851
+ refs: f,
1852
+ locale: T
1853
1853
  }),
1854
1854
  text: l(t[L])
1855
1855
  })
@@ -1877,7 +1877,7 @@ function St({ rendered: e, text: t }) {
1877
1877
  whiteSpace: "pre-wrap",
1878
1878
  overflowWrap: "anywhere"
1879
1879
  },
1880
- children: /* @__PURE__ */ q(y, {
1880
+ children: /* @__PURE__ */ q(_, {
1881
1881
  width: 380,
1882
1882
  content: /* @__PURE__ */ J("div", {
1883
1883
  style: {
@@ -1982,15 +1982,15 @@ function Dt(e, t) {
1982
1982
  //#endregion
1983
1983
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1984
1984
  function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, validationErrors: s, refs: c, forceTablePresentation: u = !1 }) {
1985
- let d = n(), f = T(), p = W(null), m = t.columns, h = t.position_field, g = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), v = m.filter((e) => {
1986
- if (g.has(e) || t.position_field && e === t.position_field) return !1;
1985
+ let f = n(), p = E(), m = W(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) => {
1986
+ if (_.has(e) || t.position_field && e === t.position_field) return !1;
1987
1987
  let n = r.fields.get(e);
1988
1988
  return !(!n || n.auto || n.primary || n.source);
1989
- }), y = new Set(m.filter((e) => {
1989
+ }), y = new Set(h.filter((e) => {
1990
1990
  if (t.position_field && e === t.position_field) return !0;
1991
1991
  let n = r.fields.get(e);
1992
1992
  return n && (n.auto || n.primary || n.source);
1993
- })), x = V((e, t, n) => {
1993
+ })), b = V((e, t, n) => {
1994
1994
  o(a.map((r) => r._key === e ? {
1995
1995
  ...r,
1996
1996
  [t]: n,
@@ -2001,8 +2001,8 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2001
2001
  _key: crypto.randomUUID(),
2002
2002
  _dirty: !0
2003
2003
  };
2004
- h && (e[h] = a.filter((e) => !e._deleted).reduce((e, t) => {
2005
- let n = typeof t[h] == "number" ? t[h] : -1;
2004
+ g && (e[g] = a.filter((e) => !e._deleted).reduce((e, t) => {
2005
+ let n = typeof t[g] == "number" ? t[g] : -1;
2006
2006
  return Math.max(e, n);
2007
2007
  }, -1) + 1);
2008
2008
  let n = t.quick_add?.defaults ?? {};
@@ -2017,32 +2017,32 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2017
2017
  v,
2018
2018
  r,
2019
2019
  t.quick_add?.defaults,
2020
- h
2021
- ]), w = V((e) => {
2020
+ g
2021
+ ]), C = V((e) => {
2022
2022
  o(a.map((t) => t._key === e ? {
2023
2023
  ...t,
2024
2024
  _deleted: !0
2025
2025
  } : t));
2026
- }, [a, o]), E = V((e) => {
2026
+ }, [a, o]), T = V((e) => {
2027
2027
  o(a.map((t) => t._key === e ? {
2028
2028
  ...t,
2029
2029
  _deleted: !1
2030
2030
  } : t));
2031
2031
  }, [a, o]), D = V((e, t) => {
2032
- if (!h) return;
2032
+ if (!g) return;
2033
2033
  let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
2034
2034
  if (i < 0 || s < 0 || s >= n.length) return;
2035
2035
  let c = [...n], [l] = c.splice(i, 1);
2036
2036
  c.splice(s, 0, l), o([...c.map((e, t) => ({
2037
2037
  ...e,
2038
- [h]: t,
2039
- _dirty: e[h] !== t || e._dirty
2038
+ [g]: t,
2039
+ _dirty: e[g] !== t || e._dirty
2040
2040
  })), ...r]);
2041
2041
  }, [
2042
2042
  a,
2043
2043
  o,
2044
- h
2045
- ]), O = V((e) => {
2044
+ g
2045
+ ]), k = V((e) => {
2046
2046
  let t = e.target, n = t.closest("td");
2047
2047
  if (!n) return;
2048
2048
  let r = n.closest("tr");
@@ -2074,15 +2074,15 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2074
2074
  }
2075
2075
  });
2076
2076
  } else e.key === "Escape" && t.blur?.();
2077
- }, [S]), k = fe;
2078
- return f.isPhone && !u ? /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
2077
+ }, [S]), A = fe;
2078
+ return p.isPhone && !u ? /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
2079
2079
  style: {
2080
2080
  display: "flex",
2081
2081
  flexDirection: "column",
2082
2082
  gap: 10
2083
2083
  },
2084
2084
  children: a.map((t, n) => {
2085
- let o = !!t._deleted, u = s?.[t._key], f = h ? a.filter((e) => !e._deleted) : [], p = h ? f.findIndex((e) => e._key === t._key) : -1;
2085
+ 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;
2086
2086
  return /* @__PURE__ */ J("div", {
2087
2087
  style: {
2088
2088
  border: "1px solid var(--border)",
@@ -2114,27 +2114,27 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2114
2114
  alignItems: "center",
2115
2115
  gap: 4
2116
2116
  },
2117
- children: [h && !o && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(_, {
2117
+ children: [g && !o && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(w, {
2118
2118
  size: 32,
2119
2119
  icon: /* @__PURE__ */ q(e.up, { size: 14 }),
2120
2120
  onClick: () => D(t._key, -1),
2121
- disabled: p <= 0,
2121
+ disabled: m <= 0,
2122
2122
  title: "Move row up"
2123
- }), /* @__PURE__ */ q(_, {
2123
+ }), /* @__PURE__ */ q(w, {
2124
2124
  size: 32,
2125
2125
  icon: /* @__PURE__ */ q(e.down, { size: 14 }),
2126
2126
  onClick: () => D(t._key, 1),
2127
- disabled: p === -1 || p >= f.length - 1,
2127
+ disabled: m === -1 || m >= p.length - 1,
2128
2128
  title: "Move row down"
2129
- })] }), o ? /* @__PURE__ */ q(_, {
2129
+ })] }), o ? /* @__PURE__ */ q(w, {
2130
2130
  size: 32,
2131
2131
  icon: /* @__PURE__ */ q(e.refresh, { size: 14 }),
2132
- onClick: () => E(t._key),
2132
+ onClick: () => T(t._key),
2133
2133
  title: "Undo delete"
2134
- }) : /* @__PURE__ */ q(_, {
2134
+ }) : /* @__PURE__ */ q(w, {
2135
2135
  size: 32,
2136
2136
  icon: /* @__PURE__ */ q(e.trash, { size: 14 }),
2137
- onClick: () => w(t._key),
2137
+ onClick: () => C(t._key),
2138
2138
  title: "Delete row"
2139
2139
  })]
2140
2140
  })]
@@ -2145,16 +2145,16 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2145
2145
  flexDirection: "column",
2146
2146
  gap: 12
2147
2147
  },
2148
- children: m.map((e) => {
2149
- let n = r.fields.get(e), a = u?.includes(e), s = y.has(e), f = n ? A(n, e, i.entities) : e, p = `child-${t._key}-${e}`, m = `${p}-label`, h = {
2148
+ children: h.map((e) => {
2149
+ let n = r.fields.get(e), a = u?.includes(e), s = y.has(e), p = n ? d(n, e, i.entities) : e, m = `child-${t._key}-${e}`, h = `${m}-label`, g = {
2150
2150
  outline: a ? "1px solid var(--danger)" : "none",
2151
2151
  outlineOffset: 3,
2152
2152
  borderRadius: a ? 5 : 0
2153
- }, g = {
2153
+ }, _ = {
2154
2154
  fontSize: 11.5,
2155
2155
  fontWeight: 600,
2156
2156
  color: "var(--text-3)"
2157
- }, _ = !o && !s && !!n;
2157
+ }, v = !o && !s && !!n;
2158
2158
  return /* @__PURE__ */ J("div", {
2159
2159
  style: {
2160
2160
  display: "flex",
@@ -2164,39 +2164,39 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2164
2164
  textDecoration: o ? "line-through" : "none"
2165
2165
  },
2166
2166
  title: a ? `${e} is required` : void 0,
2167
- children: [_ ? /* @__PURE__ */ q("label", {
2168
- id: m,
2169
- htmlFor: p,
2170
- style: g,
2171
- children: f
2167
+ children: [v ? /* @__PURE__ */ q("label", {
2168
+ id: h,
2169
+ htmlFor: m,
2170
+ style: _,
2171
+ children: p
2172
2172
  }) : /* @__PURE__ */ q("div", {
2173
- id: m,
2174
- style: g,
2175
- children: f
2173
+ id: h,
2174
+ style: _,
2175
+ children: p
2176
2176
  }), /* @__PURE__ */ q("div", {
2177
- style: h,
2178
- children: o || s ? n ? b({
2177
+ style: g,
2178
+ children: o || s ? n ? x({
2179
2179
  field: n,
2180
2180
  fieldName: e,
2181
2181
  value: t[e],
2182
2182
  mode: "display",
2183
2183
  record: t,
2184
2184
  refs: c,
2185
- fieldId: p,
2186
- labelId: m,
2187
- locale: d
2188
- }) : l(t[e]) : n ? b({
2185
+ fieldId: m,
2186
+ labelId: h,
2187
+ locale: f
2188
+ }) : l(t[e]) : n ? x({
2189
2189
  field: n,
2190
2190
  fieldName: e,
2191
2191
  value: t[e],
2192
2192
  mode: "edit",
2193
- onChange: (n) => x(t._key, e, n),
2193
+ onChange: (n) => b(t._key, e, n),
2194
2194
  record: t,
2195
2195
  refs: c,
2196
2196
  compact: !0,
2197
- fieldId: p,
2198
- labelId: m,
2199
- locale: d
2197
+ fieldId: m,
2198
+ labelId: h,
2199
+ locale: f
2200
2200
  }) : l(t[e])
2201
2201
  })]
2202
2202
  }, e);
@@ -2206,7 +2206,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2206
2206
  })
2207
2207
  }), /* @__PURE__ */ q("div", {
2208
2208
  style: { marginTop: 10 },
2209
- children: /* @__PURE__ */ q(C, {
2209
+ children: /* @__PURE__ */ q(O, {
2210
2210
  kind: "ghost",
2211
2211
  size: "sm",
2212
2212
  icon: /* @__PURE__ */ q(e.plus, { size: 14 }),
@@ -2216,23 +2216,23 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2216
2216
  })] }) : /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("div", {
2217
2217
  style: { overflowX: "auto" },
2218
2218
  children: /* @__PURE__ */ J("table", {
2219
- ref: p,
2219
+ ref: m,
2220
2220
  style: pe,
2221
- onKeyDown: O,
2222
- children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [m.map((e) => {
2221
+ onKeyDown: k,
2222
+ children: [/* @__PURE__ */ q("thead", { children: /* @__PURE__ */ J("tr", { children: [h.map((e) => {
2223
2223
  let t = r.fields.get(e);
2224
2224
  return /* @__PURE__ */ q("th", {
2225
- style: k,
2226
- children: t ? A(t, e, i.entities) : e
2225
+ style: A,
2226
+ children: t ? d(t, e, i.entities) : e
2227
2227
  }, e);
2228
2228
  }), /* @__PURE__ */ q("th", { style: {
2229
- ...k,
2229
+ ...A,
2230
2230
  width: 40
2231
2231
  } })] }) }), /* @__PURE__ */ q("tbody", { children: a.map((t) => {
2232
2232
  let n = !!t._deleted, i = s?.[t._key];
2233
2233
  return /* @__PURE__ */ J("tr", {
2234
2234
  style: { opacity: n ? .5 : 1 },
2235
- children: [m.map((e) => {
2235
+ children: [h.map((e) => {
2236
2236
  let a = r.fields.get(e), o = i?.includes(e), s = y.has(e);
2237
2237
  return n || s ? /* @__PURE__ */ q("td", {
2238
2238
  style: {
@@ -2242,14 +2242,14 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2242
2242
  textDecoration: n ? "line-through" : "none",
2243
2243
  color: "var(--text-2)"
2244
2244
  },
2245
- children: a ? b({
2245
+ children: a ? x({
2246
2246
  field: a,
2247
2247
  fieldName: e,
2248
2248
  value: t[e],
2249
2249
  mode: "display",
2250
2250
  record: t,
2251
2251
  refs: c,
2252
- locale: d
2252
+ locale: f
2253
2253
  }) : l(t[e])
2254
2254
  }, e) : /* @__PURE__ */ q("td", {
2255
2255
  style: {
@@ -2261,16 +2261,16 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2261
2261
  borderRadius: o ? 4 : 0
2262
2262
  },
2263
2263
  title: o ? `${e} is required` : void 0,
2264
- children: a ? b({
2264
+ children: a ? x({
2265
2265
  field: a,
2266
2266
  fieldName: e,
2267
2267
  value: t[e],
2268
2268
  mode: "edit",
2269
- onChange: (n) => x(t._key, e, n),
2269
+ onChange: (n) => b(t._key, e, n),
2270
2270
  record: t,
2271
2271
  refs: c,
2272
2272
  compact: !0,
2273
- locale: d
2273
+ locale: f
2274
2274
  }) : l(t[e])
2275
2275
  }, e);
2276
2276
  }), /* @__PURE__ */ q("td", {
@@ -2279,15 +2279,15 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2279
2279
  borderBottom: "1px solid var(--divider)",
2280
2280
  verticalAlign: "middle"
2281
2281
  },
2282
- children: n ? /* @__PURE__ */ q(_, {
2282
+ children: n ? /* @__PURE__ */ q(w, {
2283
2283
  size: 24,
2284
2284
  icon: /* @__PURE__ */ q(e.refresh, { size: 12 }),
2285
- onClick: () => E(t._key),
2285
+ onClick: () => T(t._key),
2286
2286
  title: "Undo delete"
2287
- }) : /* @__PURE__ */ q(_, {
2287
+ }) : /* @__PURE__ */ q(w, {
2288
2288
  size: 24,
2289
2289
  icon: /* @__PURE__ */ q(e.trash, { size: 12 }),
2290
- onClick: () => w(t._key),
2290
+ onClick: () => C(t._key),
2291
2291
  title: "Delete row"
2292
2292
  })
2293
2293
  })]
@@ -2296,7 +2296,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2296
2296
  })
2297
2297
  }), /* @__PURE__ */ q("div", {
2298
2298
  style: { marginTop: 8 },
2299
- children: /* @__PURE__ */ q(C, {
2299
+ children: /* @__PURE__ */ q(O, {
2300
2300
  kind: "ghost",
2301
2301
  size: "xs",
2302
2302
  icon: /* @__PURE__ */ q(e.plus, { size: 12 }),
@@ -2307,9 +2307,9 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2307
2307
  }
2308
2308
  //#endregion
2309
2309
  //#region src/components/detail-layout/ChildrenBlock.tsx
2310
- var kt = _e(() => import("./DraggableChildrenTable-G4Sw1XAD.js").then((e) => ({ default: e.DraggableChildrenTable })));
2310
+ var kt = _e(() => import("./DraggableChildrenTable-BDnJK0AU.js").then((e) => ({ default: e.DraggableChildrenTable })));
2311
2311
  function At({ node: e, ctx: n }) {
2312
- let r = T(), i = e.children;
2312
+ let r = E(), i = e.children;
2313
2313
  if (!i) return null;
2314
2314
  let a = r.isPhone && n.relatedRecordsPresentation === "table";
2315
2315
  if (n.isNew && n.mode !== "edit") return null;
@@ -2331,7 +2331,7 @@ function At({ node: e, ctx: n }) {
2331
2331
  }) : void 0,
2332
2332
  children: e
2333
2333
  });
2334
- if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && j(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2334
+ if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2335
2335
  let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? Ot : kt : Ot;
2336
2336
  return d(/* @__PURE__ */ q(he, {
2337
2337
  fallback: /* @__PURE__ */ q(L, {}),
@@ -2502,64 +2502,64 @@ function Rt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2502
2502
  //#endregion
2503
2503
  //#region src/components/detail-layout/FieldsBlock.tsx
2504
2504
  function zt({ fields: e, ctx: t }) {
2505
- let { entity: r, entityCode: i, record: a, mode: o, onFieldChange: s, schema: c } = t, u = n(), d = t.columns ?? 2, f = d === 1 && e.length === 1;
2505
+ let { entity: r, entityCode: i, record: a, mode: o, onFieldChange: s, schema: c } = t, u = n(), d = t.columns ?? 2, p = d === 1 && e.length === 1;
2506
2506
  return /* @__PURE__ */ q(Lt, {
2507
2507
  columns: d,
2508
2508
  children: e.map((e) => {
2509
- let n = e.name, d = `${i ?? "field"}-${n}`, p = `${d}-label`, m = r.fields.get(n), h = !!(m?.auto || m?.readonly || m?.source), g = B(r, n), _ = g?.read === "denied", v = g?.write === "denied", y = o === "display" ? _ : v || _, b = h || o === "edit" && v ? "display" : o, x = y ? /* @__PURE__ */ q(oe, {
2510
- tier: g.classification,
2509
+ let n = e.name, d = `${i ?? "field"}-${n}`, m = `${d}-label`, h = r.fields.get(n), g = !!(h?.auto || h?.readonly || h?.source), _ = B(r, n), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ q(oe, {
2510
+ tier: _.classification,
2511
2511
  tierDef: ue(c, r, n),
2512
- requiredPermission: g?.required_permission,
2512
+ requiredPermission: _?.required_permission,
2513
2513
  locale: u,
2514
- variant: b === "edit" ? "input" : "value"
2514
+ variant: x === "edit" ? "input" : "value"
2515
2515
  }) : se({
2516
2516
  entity: r,
2517
2517
  entityCode: i,
2518
2518
  fieldName: n,
2519
2519
  record: a,
2520
- mode: b,
2521
- onChange: s && !h ? (e) => s(n, e) : void 0,
2520
+ mode: x,
2521
+ onChange: s && !g ? (e) => s(n, e) : void 0,
2522
2522
  refs: t.refs,
2523
2523
  entities: c?.entities,
2524
2524
  screens: c?.screens,
2525
2525
  locale: u,
2526
2526
  fieldId: d,
2527
- labelId: p
2527
+ labelId: m
2528
2528
  });
2529
- if (!x) return null;
2530
- let S = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ q(K, { children: e.actions.map((e, t) => /* @__PURE__ */ q(F, {
2529
+ if (!S) return null;
2530
+ let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ q(K, { children: e.actions.map((e, t) => /* @__PURE__ */ q(F, {
2531
2531
  actionCode: `${n}.action[${t}]`,
2532
2532
  action: e,
2533
2533
  entityCode: i,
2534
2534
  row: a,
2535
2535
  variant: "ghost",
2536
2536
  size: "icon"
2537
- }, t)) }) : void 0, C = !!m && Ft.has(m.type), w = a?.[n], T = b === "display" && (m?.copyable || m?.type === "uuid") && w != null && w !== "" ? l(w) : void 0, E = k(m?.display?.description);
2538
- return f ? /* @__PURE__ */ J("div", {
2537
+ }, t)) }) : void 0, w = !!h && Ft.has(h.type), T = a?.[n], E = x === "display" && (h?.copyable || h?.type === "uuid") && T != null && T !== "" ? l(T) : void 0, D = f(h?.display?.description);
2538
+ return p ? /* @__PURE__ */ J("div", {
2539
2539
  style: { gridColumn: "1 / -1" },
2540
- children: [x, b === "edit" && E && /* @__PURE__ */ q("div", {
2540
+ children: [S, x === "edit" && D && /* @__PURE__ */ q("div", {
2541
2541
  style: {
2542
2542
  fontSize: 11.5,
2543
2543
  lineHeight: 1.4,
2544
2544
  color: "var(--text-3)",
2545
2545
  marginTop: 3
2546
2546
  },
2547
- children: E
2547
+ children: D
2548
2548
  })]
2549
2549
  }, n) : /* @__PURE__ */ q(Rt, {
2550
2550
  "data-testid": `field-${n}`,
2551
2551
  label: P(r, n, c.entities),
2552
- htmlFor: b === "edit" ? d : void 0,
2553
- labelId: p,
2554
- labelTitle: E || void 0,
2555
- required: m?.required ?? !1,
2556
- mode: b,
2557
- span: C,
2552
+ htmlFor: x === "edit" ? d : void 0,
2553
+ labelId: m,
2554
+ labelTitle: D || void 0,
2555
+ required: h?.required ?? !1,
2556
+ mode: x,
2557
+ span: w,
2558
2558
  error: t.fieldErrors?.[n],
2559
- hint: b === "edit" && E ? E : void 0,
2560
- actions: S,
2561
- copyValue: T,
2562
- children: x
2559
+ hint: x === "edit" && D ? D : void 0,
2560
+ actions: C,
2561
+ copyValue: E,
2562
+ children: S
2563
2563
  }, n);
2564
2564
  })
2565
2565
  });
@@ -2576,21 +2576,21 @@ var Bt = /* @__PURE__ */ new Set([
2576
2576
  "url"
2577
2577
  ]), Vt = 500;
2578
2578
  function Ht({ node: e, ctx: t }) {
2579
- let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
2580
- if (a) return null;
2581
- let l = e.properties === !0 || e.properties, u = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
2582
- return u.length === 0 ? null : /* @__PURE__ */ q(Lt, {
2579
+ let { entity: n, objectProperties: i, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
2580
+ if (o) return null;
2581
+ let u = e.properties === !0 || e.properties, d = u === !0 ? Object.entries(l).sort(([e], [t]) => e.localeCompare(t)) : u.filter((e) => l[e] != null).map((e) => [e, l[e]]);
2582
+ return d.length === 0 ? null : /* @__PURE__ */ q(Lt, {
2583
2583
  columns: 2,
2584
- children: u.map(([e, a]) => {
2585
- let c = r?.find((t) => t.property_code === e), l = x(a), u = a.readonly || !i ? "display" : o;
2584
+ children: d.map(([e, o]) => {
2585
+ let l = i?.find((t) => t.property_code === e), u = r(o), d = o.readonly || !a ? "display" : s;
2586
2586
  return /* @__PURE__ */ q(Ut, {
2587
2587
  propCode: e,
2588
- prop: a,
2589
- field: l,
2590
- value: c?.value,
2591
- mode: u,
2592
- onSetProperty: i,
2593
- refs: s,
2588
+ prop: o,
2589
+ field: u,
2590
+ value: l?.value,
2591
+ mode: d,
2592
+ onSetProperty: a,
2593
+ refs: c,
2594
2594
  entity: n,
2595
2595
  schema: t.schema
2596
2596
  }, e);
@@ -2602,29 +2602,29 @@ function Ut({ propCode: e, prop: t, field: r, value: i, mode: a, onSetProperty:
2602
2602
  H(() => () => {
2603
2603
  d.current && clearTimeout(d.current);
2604
2604
  }, []);
2605
- let f = V((n) => {
2605
+ let p = V((n) => {
2606
2606
  o && (Bt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Vt)) : o(e, n));
2607
2607
  }, [
2608
2608
  e,
2609
2609
  t.type,
2610
2610
  o
2611
- ]), p = B(c, e), m = p?.read === "denied", h = p?.write === "denied", g = a === "display" ? m : h || m, _ = a === "edit" && h ? "display" : a;
2611
+ ]), m = B(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2612
2612
  return /* @__PURE__ */ q(Rt, {
2613
- label: k(t.display?.name ?? t.name),
2614
- mode: _,
2613
+ label: f(t.display?.name ?? t.name),
2614
+ mode: v,
2615
2615
  span: Ft.has(t.type),
2616
- children: g ? /* @__PURE__ */ q(oe, {
2617
- tier: p.classification,
2616
+ children: _ ? /* @__PURE__ */ q(oe, {
2617
+ tier: m.classification,
2618
2618
  tierDef: ue(l, c, e),
2619
- requiredPermission: p?.required_permission,
2619
+ requiredPermission: m?.required_permission,
2620
2620
  locale: u,
2621
- variant: _ === "edit" ? "input" : "value"
2622
- }) : b({
2621
+ variant: v === "edit" ? "input" : "value"
2622
+ }) : x({
2623
2623
  field: r,
2624
2624
  fieldName: e,
2625
2625
  value: i,
2626
- mode: _,
2627
- onChange: _ === "edit" ? f : void 0,
2626
+ mode: v,
2627
+ onChange: v === "edit" ? p : void 0,
2628
2628
  refs: s,
2629
2629
  locale: u
2630
2630
  })
@@ -2708,7 +2708,7 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2708
2708
  gap: 16
2709
2709
  },
2710
2710
  children: Object.entries(e).map(([e, a]) => {
2711
- let o = t?.find((t) => t.group_code === e)?.status_code, c = o ? a.statuses.find((e) => e.code === o) : void 0;
2711
+ let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
2712
2712
  if (a.display_mode === "stepper") {
2713
2713
  let t = i === "edit", s = t ? a.transitions && o ? /* @__PURE__ */ new Set([o, ...a.transitions[o] ?? []]) : new Set(a.statuses.map((e) => e.code)) : void 0;
2714
2714
  return /* @__PURE__ */ J("div", {
@@ -2724,7 +2724,7 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2724
2724
  color: "var(--text-3)",
2725
2725
  flexShrink: 0
2726
2726
  },
2727
- children: [k(a.name), ":"]
2727
+ children: [f(a.name), ":"]
2728
2728
  }), /* @__PURE__ */ q("div", {
2729
2729
  style: {
2730
2730
  minWidth: 240,
@@ -2734,7 +2734,7 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2734
2734
  children: /* @__PURE__ */ q(Wt, {
2735
2735
  stages: a.statuses.map((e) => ({
2736
2736
  code: e.code,
2737
- label: k(e.name)
2737
+ label: f(e.name)
2738
2738
  })),
2739
2739
  current: o,
2740
2740
  selectable: s,
@@ -2755,11 +2755,11 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2755
2755
  fontSize: 12,
2756
2756
  color: "var(--text-3)"
2757
2757
  },
2758
- children: [k(a.name), ":"]
2759
- }), c ? /* @__PURE__ */ q(D, {
2760
- tone: c.color ?? "slate",
2758
+ children: [f(a.name), ":"]
2759
+ }), s ? /* @__PURE__ */ q(y, {
2760
+ tone: s.color ?? "slate",
2761
2761
  size: "xs",
2762
- children: k(c.name)
2762
+ children: f(s.name)
2763
2763
  }) : /* @__PURE__ */ q("span", {
2764
2764
  style: {
2765
2765
  fontSize: 12.5,
@@ -2782,7 +2782,7 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2782
2782
  borderRadius: 999,
2783
2783
  background: `var(--pill-${e.color}, ${e.color})`,
2784
2784
  display: "inline-block"
2785
- } }), k(e.name)]
2785
+ } }), f(e.name)]
2786
2786
  })
2787
2787
  }));
2788
2788
  return /* @__PURE__ */ J("div", {
@@ -2796,14 +2796,14 @@ function Gt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2796
2796
  fontSize: 12,
2797
2797
  color: "var(--text-3)"
2798
2798
  },
2799
- children: [k(a.name), ":"]
2799
+ children: [f(a.name), ":"]
2800
2800
  }), /* @__PURE__ */ q("div", {
2801
2801
  style: {
2802
2802
  minWidth: 180,
2803
2803
  opacity: r ? .6 : 1,
2804
2804
  pointerEvents: r ? "none" : "auto"
2805
2805
  },
2806
- children: /* @__PURE__ */ q(s, {
2806
+ children: /* @__PURE__ */ q(c, {
2807
2807
  value: o ?? "",
2808
2808
  options: l,
2809
2809
  onChange: (t) => n(e, t),
@@ -3067,7 +3067,7 @@ function dn({ values: e, options: t }) {
3067
3067
  }, [s]), H(() => {
3068
3068
  d("");
3069
3069
  }, [c]);
3070
- let p = r ? [{
3070
+ let m = r ? [{
3071
3071
  field: r.scope_field,
3072
3072
  op: "eq",
3073
3073
  value: o
@@ -3075,28 +3075,28 @@ function dn({ values: e, options: t }) {
3075
3075
  field: r.window_field,
3076
3076
  op: "eq",
3077
3077
  value: c
3078
- }] : [], m = f(r?.entity, {
3078
+ }] : [], h = p(r?.entity, {
3079
3079
  per_page: 1,
3080
- filters: p
3081
- }, !!(r && o && c)), h = r?.breakdown, g = h ? [{
3082
- field: h.scope_field,
3080
+ filters: m
3081
+ }, !!(r && o && c)), g = r?.breakdown, _ = g ? [{
3082
+ field: g.scope_field,
3083
3083
  op: "eq",
3084
3084
  value: o
3085
3085
  }, {
3086
- field: h.window_field,
3086
+ field: g.window_field,
3087
3087
  op: "eq",
3088
3088
  value: c
3089
- }] : [], _ = f(h?.entity, {
3090
- per_page: h?.limit ?? 200,
3091
- sort: h?.sort,
3092
- filters: g
3093
- }, !!(h && o && c));
3089
+ }] : [], v = p(g?.entity, {
3090
+ per_page: g?.limit ?? 200,
3091
+ sort: g?.sort,
3092
+ filters: _
3093
+ }, !!(g && o && c));
3094
3094
  if (!r || !o) return /* @__PURE__ */ q("div", {
3095
3095
  role: "alert",
3096
3096
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3097
3097
  children: "Invalid entity_scorecard configuration."
3098
3098
  });
3099
- let v = m.data?.data?.[0], y = _.data?.data ?? [], b = h?.filter_field ? Array.from(new Set(y.map((e) => e[h.filter_field]).filter((e) => typeof e == "string" && e !== ""))).sort() : [], x = u && h?.filter_field ? y.filter((e) => e[h.filter_field] === u) : y, S = (e) => !u || !e.filtered || !h?.filter_field ? v?.[e.field] : y.find((t) => t[h.filter_field] === u && un(t, e.filtered?.where))?.[e.filtered.field], C = (e) => {
3099
+ let y = h.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 && un(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3100
3100
  let t = r.drillthrough;
3101
3101
  if (!t || !e.drillthrough_value) return;
3102
3102
  let n = [{
@@ -3117,10 +3117,10 @@ function dn({ values: e, options: t }) {
3117
3117
  op: "eq",
3118
3118
  value: e.drillthrough_value
3119
3119
  }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
3120
- }, w = m.error ?? _.error;
3120
+ }, T = h.error ?? v.error;
3121
3121
  return /* @__PURE__ */ J("div", {
3122
3122
  className: "flex min-w-0 flex-col gap-4",
3123
- "aria-label": k(r.title, i) || "Scorecard",
3123
+ "aria-label": f(r.title, i) || "Scorecard",
3124
3124
  children: [
3125
3125
  /* @__PURE__ */ J("div", {
3126
3126
  className: "flex flex-wrap items-start justify-between gap-3",
@@ -3129,15 +3129,15 @@ function dn({ values: e, options: t }) {
3129
3129
  children: [
3130
3130
  r.title && /* @__PURE__ */ q("h3", {
3131
3131
  className: "text-base font-semibold text-foreground",
3132
- children: k(r.title, i)
3132
+ children: f(r.title, i)
3133
3133
  }),
3134
3134
  r.description && /* @__PURE__ */ q("p", {
3135
3135
  className: "mt-1 text-sm text-muted-foreground",
3136
- children: k(r.description, i)
3136
+ children: f(r.description, i)
3137
3137
  }),
3138
3138
  r.intended_note && /* @__PURE__ */ q("p", {
3139
3139
  className: "mt-1 text-xs text-muted-foreground",
3140
- children: k(r.intended_note, i)
3140
+ children: f(r.intended_note, i)
3141
3141
  })
3142
3142
  ]
3143
3143
  }), /* @__PURE__ */ J("div", {
@@ -3151,19 +3151,19 @@ function dn({ values: e, options: t }) {
3151
3151
  "aria-pressed": c === e.code,
3152
3152
  onClick: () => l(e.code),
3153
3153
  className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3154
- children: k(e.label, i) || e.code
3154
+ children: f(e.label, i) || e.code
3155
3155
  }, e.code))
3156
- }), h?.filter_field && /* @__PURE__ */ J("label", {
3156
+ }), g?.filter_field && /* @__PURE__ */ J("label", {
3157
3157
  className: "flex items-center gap-2 text-xs text-muted-foreground",
3158
- children: [k(h.filter_label, i) || "Filter", /* @__PURE__ */ J("select", {
3159
- "aria-label": k(h.filter_label, i) || "Filter",
3158
+ children: [f(g.filter_label, i) || "Filter", /* @__PURE__ */ J("select", {
3159
+ "aria-label": f(g.filter_label, i) || "Filter",
3160
3160
  value: u,
3161
3161
  onChange: (e) => d(e.target.value),
3162
3162
  className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3163
3163
  children: [/* @__PURE__ */ q("option", {
3164
3164
  value: "",
3165
- children: k(h.all_label, i) || "All"
3166
- }), b.map((e) => /* @__PURE__ */ q("option", {
3165
+ children: f(g.all_label, i) || "All"
3166
+ }), x.map((e) => /* @__PURE__ */ q("option", {
3167
3167
  value: e,
3168
3168
  children: e
3169
3169
  }, e))]
@@ -3171,22 +3171,22 @@ function dn({ values: e, options: t }) {
3171
3171
  })]
3172
3172
  })]
3173
3173
  }),
3174
- w && /* @__PURE__ */ q("div", {
3174
+ T && /* @__PURE__ */ q("div", {
3175
3175
  role: "alert",
3176
3176
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3177
- children: w instanceof Error ? w.message : "Scorecard data could not be loaded."
3177
+ children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
3178
3178
  }),
3179
- !w && !m.isLoading && !v && /* @__PURE__ */ q("div", {
3179
+ !T && !h.isLoading && !y && /* @__PURE__ */ q("div", {
3180
3180
  className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3181
- children: k(r.empty_label, i) || "No scorecard data."
3181
+ children: f(r.empty_label, i) || "No scorecard data."
3182
3182
  }),
3183
- v && /* @__PURE__ */ q("div", {
3183
+ y && /* @__PURE__ */ q("div", {
3184
3184
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
3185
3185
  children: r.metrics.map((e) => {
3186
- let t = S(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ J(K, { children: [
3186
+ let t = C(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ J(K, { children: [
3187
3187
  /* @__PURE__ */ q("span", {
3188
3188
  className: "text-xs font-medium text-muted-foreground",
3189
- children: k(e.label, i) || e.field
3189
+ children: f(e.label, i) || e.field
3190
3190
  }),
3191
3191
  /* @__PURE__ */ q("strong", {
3192
3192
  className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
@@ -3194,12 +3194,12 @@ function dn({ values: e, options: t }) {
3194
3194
  }),
3195
3195
  e.help && /* @__PURE__ */ q("span", {
3196
3196
  className: "mt-1 block text-xs text-muted-foreground",
3197
- children: k(e.help, i)
3197
+ children: f(e.help, i)
3198
3198
  })
3199
3199
  ] });
3200
3200
  return n ? /* @__PURE__ */ q("button", {
3201
3201
  type: "button",
3202
- onClick: () => C(e),
3202
+ onClick: () => w(e),
3203
3203
  className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
3204
3204
  children: a
3205
3205
  }, e.field) : /* @__PURE__ */ q("article", {
@@ -3208,26 +3208,26 @@ function dn({ values: e, options: t }) {
3208
3208
  }, e.field);
3209
3209
  })
3210
3210
  }),
3211
- h && /* @__PURE__ */ q("div", {
3211
+ g && /* @__PURE__ */ q("div", {
3212
3212
  className: "min-w-0 overflow-x-auto rounded border border-border",
3213
3213
  children: /* @__PURE__ */ J("table", {
3214
3214
  className: "w-full border-collapse text-sm",
3215
3215
  children: [/* @__PURE__ */ q("thead", {
3216
3216
  className: "bg-surface text-left text-xs text-muted-foreground",
3217
- children: /* @__PURE__ */ q("tr", { children: h.columns.map((e) => /* @__PURE__ */ q("th", {
3217
+ children: /* @__PURE__ */ q("tr", { children: g.columns.map((e) => /* @__PURE__ */ q("th", {
3218
3218
  className: "border-b border-divider px-3 py-2 font-medium",
3219
- children: k(e.label, i) || e.field
3219
+ children: f(e.label, i) || e.field
3220
3220
  }, e.field)) })
3221
- }), /* @__PURE__ */ J("tbody", { children: [x.map((e, t) => /* @__PURE__ */ q("tr", {
3221
+ }), /* @__PURE__ */ J("tbody", { children: [S.map((e, t) => /* @__PURE__ */ q("tr", {
3222
3222
  className: "border-b border-divider last:border-0",
3223
- children: h.columns.map((t) => /* @__PURE__ */ q("td", {
3223
+ children: g.columns.map((t) => /* @__PURE__ */ q("td", {
3224
3224
  className: "px-3 py-2 text-foreground",
3225
3225
  children: cn(e[t.field], t.format, i)
3226
3226
  }, t.field))
3227
- }, ln(e, t))), !_.isLoading && x.length === 0 && /* @__PURE__ */ q("tr", { children: /* @__PURE__ */ q("td", {
3228
- colSpan: Math.max(1, h.columns.length),
3227
+ }, ln(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ q("tr", { children: /* @__PURE__ */ q("td", {
3228
+ colSpan: Math.max(1, g.columns.length),
3229
3229
  className: "px-3 py-6 text-center text-muted-foreground",
3230
- children: k(h.empty_label, i) || "No breakdown rows."
3230
+ children: f(g.empty_label, i) || "No breakdown rows."
3231
3231
  }) })] })]
3232
3232
  })
3233
3233
  })