@declarion/react 0.48.2 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist-lib/Check-DAfMbQIw.js +38 -0
  2. package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-B98Md-Yq.js} +30 -30
  3. package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BdtEd4R9.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-oVU3nEb5.js} +600 -597
  5. package/dist-lib/ListCardsBody-DYMt1H8l.js +287 -0
  6. package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-E9hbyoUn.js} +1 -1
  7. package/dist-lib/RefreshControl-B_2eW53M.js +430 -0
  8. package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-Dg22HOxb.js} +520 -515
  9. package/dist-lib/SmartListPage.impl-CPhhXT5S.js +2849 -0
  10. package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-CF0UKgUj.js} +243 -240
  11. package/dist-lib/SortHeaderMenu-DodGvb7A.js +106 -0
  12. package/dist-lib/action-dispatch-CYOw7nkP.js +1984 -0
  13. package/dist-lib/api/batch.d.ts +5 -2
  14. package/dist-lib/api/data.d.ts +35 -4
  15. package/dist-lib/api/entities.d.ts +3 -3
  16. package/dist-lib/cardProjection-D-AufCh-.js +757 -0
  17. package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
  18. package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
  19. package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
  20. package/dist-lib/components/file-widgets/upload.d.ts +6 -1
  21. package/dist-lib/components/layout/Layout.d.ts +1 -1
  22. package/dist-lib/components/layout/TopBar.d.ts +1 -1
  23. package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
  24. package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
  25. package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
  26. package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
  27. package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
  28. package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
  29. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  30. package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
  31. package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
  32. package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
  33. package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
  34. package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
  35. package/dist-lib/components/pages/list/page-size.d.ts +3 -0
  36. package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
  37. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
  38. package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
  39. package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
  40. package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
  41. package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
  42. package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
  43. package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
  44. package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
  45. package/dist-lib/field-classification-DTgUnbzd.js +1134 -0
  46. package/dist-lib/format-count-DAHCcHZO.js +1551 -0
  47. package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
  48. package/dist-lib/hooks/useText.d.ts +3 -0
  49. package/dist-lib/hooks/useViews.d.ts +1 -1
  50. package/dist-lib/index.d.ts +17 -15
  51. package/dist-lib/index.js +1783 -6287
  52. package/dist-lib/lib/messages.d.ts +7 -1
  53. package/dist-lib/lib/rowClickGesture.d.ts +12 -0
  54. package/dist-lib/lib/timestamp.d.ts +8 -3
  55. package/dist-lib/peekDraftStore-CnxqkoWN.js +194 -0
  56. package/dist-lib/record-documents-key-DEFlLxnF.js +27 -0
  57. package/dist-lib/registry-WypUQQ7t.js +1768 -0
  58. package/dist-lib/testing.d.ts +17 -2
  59. package/dist-lib/testing.js +72 -58
  60. package/dist-lib/types/api.d.ts +54 -12
  61. package/dist-lib/types/schema.d.ts +22 -6
  62. package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-C5Oio-1G.js} +1125 -1068
  63. package/dist-lib/useListQuery-Dc2vbxqs.js +87 -0
  64. package/dist-lib/useProperties-C36ENFdY.js +81 -0
  65. package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-sIuYEFaq.js} +116 -194
  66. package/dist-lib/{value-B1O6QikE.js → value-igT4LsqW.js} +69 -69
  67. package/package.json +1 -1
  68. package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
  69. package/dist-lib/registry-CCxnZW2b.js +0 -5281
  70. /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
  71. /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
  72. /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
  73. /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
  74. /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
  75. /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
  76. /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
  77. /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
  78. /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
  79. /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
  80. /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
  81. /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
  82. /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
  83. /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
  84. /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
@@ -1,6 +1,9 @@
1
1
  import { s as e, t } from "./DynamicIcon-Dc2j-rg_.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, rt as E, tr as D, ur as O, vt as k, wn as A, xn as j, yt as M } from "./useCurrentScreen-BshVTPVq.js";
3
- import { E as ee, G as N, H as P, J as F, K as I, St as L, U as R, V as z, W as te, d as B, et as V, f as ne, ft as re, j as ie, o as ae, pt as oe, r as se, t as ce, tt as le, xt as ue } from "./registry-CCxnZW2b.js";
2
+ import { $n as n, A as r, Cn as i, Dn as a, En as o, Gt as s, Jn as c, M as l, Mn as u, Nn as d, On as f, Rn as p, Sn as m, X as h, Z as g, _t as _, dr as v, f as y, fr as b, gn as x, j as S, kn as C, kt as w, rr as T, rt as E, sr as D, ur as O, vt as k, wn as A, yt as j, zn as M } from "./useCurrentScreen-C5Oio-1G.js";
3
+ import { c as ee, d as N, f as P, l as F, o as I, r as L, s as R, t as z } from "./registry-WypUQQ7t.js";
4
+ import { E as B, g as V, h as te, j as ne, m as re, n as ie, p as ae, t as oe, w as se } from "./field-classification-DTgUnbzd.js";
5
+ import { m as ce, p as le } from "./action-dispatch-CYOw7nkP.js";
6
+ import { f as ue } from "./cardProjection-D-AufCh-.js";
4
7
  import { n as de, r as fe, t as pe } from "./dataTableStyles-vwD1mVOP.js";
5
8
  import { Suspense as me, createContext as he, lazy as ge, useCallback as H, useContext as _e, useEffect as U, useId as ve, useLayoutEffect as ye, useMemo as W, useRef as G, useState as K } from "react";
6
9
  import { useInfiniteQuery as be, useMutation as xe, useQueryClient as Se } from "@tanstack/react-query";
@@ -61,16 +64,16 @@ function Te({ config: e, ctx: t }) {
61
64
  }, [u, p]), h = u ?? p(), g = e.height ? De(e.height) : void 0;
62
65
  return /* @__PURE__ */ J("div", {
63
66
  ref: l,
64
- className: oe("flex", s && "flex-col"),
67
+ className: F("flex", s && "flex-col"),
65
68
  style: {
66
69
  gap: r ? `${r}px` : void 0,
67
70
  ...g
68
71
  },
69
72
  children: n.map((r, a) => /* @__PURE__ */ Y("div", {
70
- className: oe("min-w-0 flex items-stretch", s && "w-full"),
73
+ className: F("min-w-0 flex items-stretch", s && "w-full"),
71
74
  style: s ? void 0 : Ee(r.width ?? r.column?.width ?? r.row?.width ?? e.width, h[a], r.min_width, r.max_width),
72
75
  children: [/* @__PURE__ */ J("div", {
73
- className: oe("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
76
+ className: F("flex-1 min-w-0 flex flex-col", g && "overflow-y-auto overflow-x-hidden"),
74
77
  children: /* @__PURE__ */ J($, {
75
78
  node: r,
76
79
  ctx: t
@@ -123,13 +126,13 @@ function ke(e) {
123
126
  function Ae(e, t) {
124
127
  let n = ke(e);
125
128
  if (n) {
126
- if (e.label) return f(e.label);
129
+ if (e.label) return a(e.label);
127
130
  let r = t.entity.children?.find((e) => e.entity === n);
128
- if (r?.display?.name) return f(r.display.name);
131
+ if (r?.display?.name) return a(r.display.name);
129
132
  let i = t.schema.entities[n];
130
- return i && (f(i.display.name_plural) || f(i.display.name)) || n;
133
+ return i && (a(i.display.name_plural) || a(i.display.name)) || n;
131
134
  }
132
- return e.section ? f(e.section.name) : "Tab";
135
+ return e.section ? a(e.section.name) : "Tab";
133
136
  }
134
137
  function je(e, t) {
135
138
  if (e.icon) return e.icon;
@@ -144,7 +147,7 @@ function je(e, t) {
144
147
  //#endregion
145
148
  //#region src/components/detail-layout/LayoutTabs.tsx
146
149
  function Me({ config: e, ctx: n }) {
147
- let { items: r } = e, [i, a] = K(0), o = D(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
150
+ let { items: r } = e, [i, a] = K(0), o = T(), s = n.detailTabsPresentation ?? (o.isPhone ? "sections" : "scroll");
148
151
  if (r.length === 0) return null;
149
152
  if (s === "sections") {
150
153
  let e = r.map((e, t) => `detail-tab-section-${t}`);
@@ -331,28 +334,28 @@ function Me({ config: e, ctx: n }) {
331
334
  //#endregion
332
335
  //#region src/components/detail-layout/SectionBlock.tsx
333
336
  function Ne({ config: e, ctx: n }) {
334
- let { name: r, items: i, collapsed: a = !1, columns: o, icon: s, badge: c, emphasis: l } = e, u = {
337
+ let { name: r, items: i, collapsed: o = !1, columns: s, icon: c, badge: l, emphasis: u } = e, d = {
335
338
  ...n,
336
339
  withinCard: !0,
337
- ...o ? { columns: o } : null
338
- }, d = s ? /* @__PURE__ */ J(t, {
339
- name: s,
340
+ ...s ? { columns: s } : null
341
+ }, f = c ? /* @__PURE__ */ J(t, {
342
+ name: c,
340
343
  size: 14
341
- }) : void 0, p = c ? {
342
- text: f(c.text),
343
- tone: c.tone,
344
- dot: c.dot
344
+ }) : void 0, p = l ? {
345
+ text: a(l.text),
346
+ tone: l.tone,
347
+ dot: l.dot
345
348
  } : void 0;
346
- return /* @__PURE__ */ J(L, {
347
- title: f(r),
348
- defaultOpen: !a,
349
- icon: d,
349
+ return /* @__PURE__ */ J(P, {
350
+ title: a(r),
351
+ defaultOpen: !o,
352
+ icon: f,
350
353
  badge: p,
351
- emphasis: l,
354
+ emphasis: u,
352
355
  headingLevel: n.withinCard ? 3 : 2,
353
356
  children: /* @__PURE__ */ J(gn, {
354
357
  nodes: i,
355
- ctx: u
358
+ ctx: d
356
359
  })
357
360
  });
358
361
  }
@@ -383,7 +386,7 @@ function X(e, t, n) {
383
386
  return e ?? t ?? n;
384
387
  }
385
388
  function Fe(e) {
386
- return v(e, "update") ? "inline_edit" : "readonly";
389
+ return m(e, "update") ? "inline_edit" : "readonly";
387
390
  }
388
391
  function Ie(e) {
389
392
  return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
@@ -459,7 +462,7 @@ function We(e, ...t) {
459
462
  }
460
463
  }
461
464
  function Ge(e) {
462
- let t = A(e);
465
+ let t = o(e);
463
466
  return t.length > 0 ? t[0] : void 0;
464
467
  }
465
468
  function Ke(e, t) {
@@ -468,16 +471,16 @@ function Ke(e, t) {
468
471
  //#endregion
469
472
  //#region src/lib/quick-add.ts
470
473
  function qe(e, t, n, r) {
471
- let a = {
474
+ let i = {
472
475
  ...t ?? {},
473
476
  ...e
474
477
  };
475
478
  if (Array.isArray(n)) {
476
- let e = Array.isArray(r) ? r.map(String) : i(String(r), n.length);
479
+ let e = Array.isArray(r) ? r.map(String) : C(String(r), n.length);
477
480
  if (!e || e.length !== n.length) throw Error("invalid composite parent id");
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
+ for (let t = 0; t < n.length; t++) i[n[t]] = e[t];
482
+ } else i[n] = Array.isArray(r) ? r[0] : r;
483
+ return i;
481
484
  }
482
485
  function Je(e, t) {
483
486
  for (let n of t) {
@@ -489,26 +492,26 @@ function Je(e, t) {
489
492
  //#endregion
490
493
  //#region src/components/detail-layout/useQuickAdd.ts
491
494
  function Ye(e, t, n, r) {
492
- let [i, o] = K(() => {
495
+ let [i, a] = K(() => {
493
496
  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] = s()) : i[e] = t.defaults[e];
497
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = p()) : i[e] = t.defaults[e];
495
498
  return i;
496
- }), c = Se(), { mutate: l, isPending: u, error: d, reset: f } = xe({
497
- mutationFn: (t) => g(e.entity, t),
499
+ }), o = Se(), { mutate: s, isPending: c, error: l, reset: u } = xe({
500
+ mutationFn: (t) => _(e.entity, t),
498
501
  onMutate: async (r) => {
499
- let i = Array.isArray(n) ? a(n.map(String)) : n, o = [
502
+ let i = Array.isArray(n) ? f(n.map(String)) : n, a = [
500
503
  te,
501
504
  t,
502
505
  i,
503
506
  e.entity
504
507
  ];
505
- await c.cancelQueries({ queryKey: o });
506
- let s = c.getQueriesData({ queryKey: o }), l = {
508
+ await o.cancelQueries({ queryKey: a });
509
+ let s = o.getQueriesData({ queryKey: a }), c = {
507
510
  ...r,
508
511
  id: `__optimistic_${crypto.randomUUID()}`,
509
512
  __optimistic: !0
510
513
  };
511
- return c.setQueriesData({ queryKey: o }, (e) => {
514
+ return o.setQueriesData({ queryKey: a }, (e) => {
512
515
  if (!e || typeof e != "object") return e;
513
516
  if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
514
517
  let t = e, [n, ...r] = t.pages;
@@ -516,7 +519,7 @@ function Ye(e, t, n, r) {
516
519
  ...t,
517
520
  pages: [{
518
521
  ...n,
519
- data: [l, ...n.data]
522
+ data: [c, ...n.data]
520
523
  }, ...r]
521
524
  };
522
525
  }
@@ -524,54 +527,54 @@ function Ye(e, t, n, r) {
524
527
  }), { snapshots: s };
525
528
  },
526
529
  onError: (e, t, n) => {
527
- if (n?.snapshots) for (let [e, t] of n.snapshots) c.setQueryData(e, t);
530
+ if (n?.snapshots) for (let [e, t] of n.snapshots) o.setQueryData(e, t);
528
531
  },
529
532
  onSuccess: () => {
530
533
  let t = e.quick_add, n = r.entities[e.entity], i = {};
531
- if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? s() : "" : t.defaults[e];
532
- o(i);
534
+ if (t?.fields) for (let e of t.fields) i[e] = t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? p() : "" : t.defaults[e];
535
+ a(i);
533
536
  },
534
537
  onSettled: () => {
535
- let r = Array.isArray(n) ? a(n.map(String)) : n;
536
- c.invalidateQueries({ queryKey: [
538
+ let r = Array.isArray(n) ? f(n.map(String)) : n;
539
+ o.invalidateQueries({ queryKey: [
537
540
  te,
538
541
  t,
539
542
  r,
540
543
  e.entity
541
544
  ] });
542
545
  }
543
- }), p = e.quick_add, m = r.entities[e.entity], h = Je(i, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
544
- function _(t) {
545
- if (t.preventDefault(), !p) return;
546
- let r = qe(i, p.defaults, e.foreign_key, n);
547
- l(r);
546
+ }), d = e.quick_add, m = r.entities[e.entity], h = Je(i, d?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
547
+ function g(t) {
548
+ if (t.preventDefault(), !d) return;
549
+ let r = qe(i, d.defaults, e.foreign_key, n);
550
+ s(r);
548
551
  }
549
552
  function v(e, t) {
550
- d && f(), o((n) => ({
553
+ l && u(), a((n) => ({
551
554
  ...n,
552
555
  [e]: t
553
556
  }));
554
557
  }
555
558
  return {
556
559
  values: i,
557
- quickAdd: p,
560
+ quickAdd: d,
558
561
  childEntity: m,
559
- isPending: u,
560
- error: d,
562
+ isPending: c,
563
+ error: l,
561
564
  isReady: h,
562
- handleSubmit: _,
565
+ handleSubmit: g,
563
566
  handleFieldChange: v
564
567
  };
565
568
  }
566
569
  //#endregion
567
570
  //#region src/components/detail-layout/QuickAddForm.tsx
568
- function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
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 = D(), _ = ve();
571
+ function Xe({ config: t, parentEntity: n, parentId: i, schema: a }) {
572
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, n, i, a), m = r(), h = T(), g = ve();
570
573
  return !s || s.fields.length === 0 || !c ? null : /* @__PURE__ */ Y("form", {
571
- onSubmit: p,
574
+ onSubmit: f,
572
575
  style: {
573
576
  display: "flex",
574
- flexDirection: g.isPhone ? "column" : "row",
577
+ flexDirection: h.isPhone ? "column" : "row",
575
578
  alignItems: "flex-end",
576
579
  gap: 8,
577
580
  padding: "8px 0",
@@ -581,12 +584,12 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
581
584
  s.fields.map((e) => {
582
585
  let n = c.fields.get(e);
583
586
  if (!n) return null;
584
- let r = `${_}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
587
+ let r = `${g}-quick-add-${t.entity}-${e}`, i = `${r}-label`;
585
588
  return /* @__PURE__ */ Y("div", {
586
589
  style: {
587
590
  flex: 1,
588
591
  minWidth: 0,
589
- width: g.isPhone ? "100%" : void 0
592
+ width: h.isPhone ? "100%" : void 0
590
593
  },
591
594
  children: [/* @__PURE__ */ J("label", {
592
595
  id: i,
@@ -598,27 +601,27 @@ function Xe({ config: t, parentEntity: r, parentId: i, schema: a }) {
598
601
  display: "block",
599
602
  fontWeight: 500
600
603
  },
601
- children: d(n, e, a.entities)
602
- }), x({
604
+ children: A(n, e, a.entities)
605
+ }), S({
603
606
  field: n,
604
607
  fieldName: e,
605
608
  value: o[e] ?? "",
606
609
  mode: "edit",
607
- onChange: (t) => m(e, t),
610
+ onChange: (t) => p(e, t),
608
611
  record: o,
609
612
  fieldId: r,
610
613
  labelId: i,
611
- locale: h
614
+ locale: m
612
615
  })]
613
616
  }, e);
614
617
  }),
615
- /* @__PURE__ */ J(O, {
618
+ /* @__PURE__ */ J(b, {
616
619
  type: "submit",
617
620
  kind: "primary",
618
- size: g.isPhone ? "md" : "sm",
621
+ size: h.isPhone ? "md" : "sm",
619
622
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
620
- disabled: l || !f,
621
- style: g.isPhone ? { alignSelf: "flex-end" } : void 0,
623
+ disabled: l || !d,
624
+ style: h.isPhone ? { alignSelf: "flex-end" } : void 0,
622
625
  children: "Add"
623
626
  }),
624
627
  u != null && /* @__PURE__ */ J("span", {
@@ -639,10 +642,10 @@ function Ze(e, t, n) {
639
642
  return `${e}::child::${t}.${n}`;
640
643
  }
641
644
  function Qe(e) {
642
- return Math.min(I, Math.max(60, Math.round(e)));
645
+ return Math.min(se, Math.max(60, Math.round(e)));
643
646
  }
644
647
  function $e(e) {
645
- let { widths: t, setWidths: n, resetWidths: r } = F(e), [i, a] = K({}), o = G(null);
648
+ let { widths: t, setWidths: n, resetWidths: r } = B(e), [i, a] = K({}), o = G(null);
646
649
  U(() => {
647
650
  let e = (e) => {
648
651
  let t = o.current;
@@ -725,34 +728,34 @@ function et({ colId: e, onMouseDown: t }) {
725
728
  }
726
729
  //#endregion
727
730
  //#region src/components/detail-layout/ChildrenTable.tsx
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 = R((e) => e.degradedEntities), { data: m, isLoading: g, isError: _, isFetching: v, refetch: b } = N(r, i, t.entity, t.foreign_key, t.sort, t.limit), x = m?.data ?? [], C = m?.$refs, T = G(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 = W(() => {
731
+ function tt({ config: t, parentEntity: i, parentId: a, schema: o }) {
732
+ let s = o.entities[t.entity], c = Array.isArray(t.foreign_key) ? t.foreign_key.join(",") : t.foreign_key, u = $e(Ze(i, t.entity, c)), f = r(), p = re((e) => e.degradedEntities), { data: m, isLoading: h, isError: g, isFetching: _, refetch: y } = V(i, a, t.entity, t.foreign_key, t.sort, t.limit), b = m?.data ?? [], x = m?.$refs, S = G(x);
733
+ S.current = x;
734
+ let C = t.columns, w = t.interaction === "navigate", T = C[0], E = w && s ? d(void 0, s, o.screens) : null, D = s ? Ge(s) : void 0, k = W(() => {
732
735
  let e = /* @__PURE__ */ new Map();
733
- if (!o) return e;
734
- for (let t of E) {
735
- let n = o.fields.get(t);
736
- n && e.set(t, u({
736
+ if (!s) return e;
737
+ for (let t of C) {
738
+ let n = s.fields.get(t);
739
+ n && e.set(t, l({
737
740
  field: n,
738
741
  fieldName: t,
739
742
  surface: "list",
740
- entity: o,
741
- entities: a.entities,
742
- screens: a.screens,
743
- refs: () => T.current,
743
+ entity: s,
744
+ entities: o.entities,
745
+ screens: o.screens,
746
+ refs: () => S.current,
744
747
  locale: f
745
748
  }));
746
749
  }
747
750
  return e;
748
751
  }, [
749
- o,
750
- E,
751
- a.entities,
752
- a.screens,
752
+ s,
753
+ C,
754
+ o.entities,
755
+ o.screens,
753
756
  f
754
757
  ]);
755
- if (!o) return /* @__PURE__ */ J("div", {
758
+ if (!s) return /* @__PURE__ */ J("div", {
756
759
  style: {
757
760
  fontSize: 12.5,
758
761
  color: "var(--text-3)",
@@ -760,12 +763,12 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
760
763
  },
761
764
  children: "Entity not found."
762
765
  });
763
- let M = /* @__PURE__ */ J(Xe, {
766
+ let j = /* @__PURE__ */ J(Xe, {
764
767
  config: t,
765
- parentEntity: r,
766
- parentId: i,
767
- schema: a
768
- }), ee = P(o.realtime, p, t.entity), F = /* @__PURE__ */ Y("div", {
768
+ parentEntity: i,
769
+ parentId: a,
770
+ schema: o
771
+ }), ee = ae(s.realtime, p, t.entity), N = /* @__PURE__ */ Y("div", {
769
772
  style: {
770
773
  display: "flex",
771
774
  alignItems: "center",
@@ -774,40 +777,40 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
774
777
  justifyContent: "flex-end"
775
778
  },
776
779
  children: [
777
- c.hasWidths && /* @__PURE__ */ J(w, {
780
+ u.hasWidths && /* @__PURE__ */ J(v, {
778
781
  icon: /* @__PURE__ */ J(e.columns, { size: 13 }),
779
782
  title: "Reset column widths (this device)",
780
783
  size: 24,
781
- onClick: c.resetWidths
784
+ onClick: u.resetWidths
782
785
  }),
783
786
  ee && /* @__PURE__ */ J("span", {
784
787
  "data-testid": "children-live-indicator",
785
788
  title: "This table updates automatically in realtime.",
786
- children: /* @__PURE__ */ J(y, {
789
+ children: /* @__PURE__ */ J(O, {
787
790
  tone: "emerald",
788
791
  size: "xs",
789
792
  dot: !0,
790
793
  children: "Live"
791
794
  })
792
795
  }),
793
- /* @__PURE__ */ J(w, {
794
- icon: v ? /* @__PURE__ */ J("span", {
796
+ /* @__PURE__ */ J(v, {
797
+ icon: _ ? /* @__PURE__ */ J("span", {
795
798
  "data-testid": "children-refresh-spinner",
796
799
  style: { display: "inline-flex" },
797
- children: /* @__PURE__ */ J(h, { size: 13 })
800
+ children: /* @__PURE__ */ J(n, { size: 13 })
798
801
  }) : /* @__PURE__ */ J(e.refresh, { size: 13 }),
799
802
  title: "Refresh",
800
803
  size: 24,
801
- disabled: v,
804
+ disabled: _,
802
805
  onClick: () => {
803
- b();
806
+ y();
804
807
  }
805
808
  })
806
809
  ]
807
810
  });
808
- return _ ? /* @__PURE__ */ Y("div", { children: [
809
- M,
810
- F,
811
+ return g ? /* @__PURE__ */ Y("div", { children: [
812
+ j,
813
+ N,
811
814
  /* @__PURE__ */ J("div", {
812
815
  style: {
813
816
  fontSize: 12.5,
@@ -816,9 +819,9 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
816
819
  },
817
820
  children: "Failed to load. Try again."
818
821
  })
819
- ] }) : g ? /* @__PURE__ */ Y("div", { children: [
820
- M,
821
- F,
822
+ ] }) : h ? /* @__PURE__ */ Y("div", { children: [
823
+ j,
824
+ N,
822
825
  /* @__PURE__ */ J("div", {
823
826
  style: {
824
827
  display: "flex",
@@ -836,9 +839,9 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
836
839
  borderRadius: 4
837
840
  } }, e))
838
841
  })
839
- ] }) : x.length === 0 ? /* @__PURE__ */ Y("div", { children: [
840
- M,
841
- F,
842
+ ] }) : b.length === 0 ? /* @__PURE__ */ Y("div", { children: [
843
+ j,
844
+ N,
842
845
  /* @__PURE__ */ J("div", {
843
846
  style: {
844
847
  fontSize: 12.5,
@@ -848,28 +851,28 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
848
851
  children: "No records yet."
849
852
  })
850
853
  ] }) : /* @__PURE__ */ Y("div", { children: [
851
- M,
852
- F,
854
+ j,
855
+ N,
853
856
  /* @__PURE__ */ J("div", {
854
857
  style: { overflowX: "auto" },
855
858
  children: /* @__PURE__ */ Y("table", {
856
859
  style: fe,
857
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: E.map((e) => {
858
- let t = o.fields.get(e);
860
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ J("tr", { children: C.map((e) => {
861
+ let t = s.fields.get(e);
859
862
  return /* @__PURE__ */ Y("th", {
860
- style: c.headerStyle(e, de),
861
- children: [t ? d(t, e, a.entities) : e, /* @__PURE__ */ J(et, {
863
+ style: u.headerStyle(e, de),
864
+ children: [t ? A(t, e, o.entities) : e, /* @__PURE__ */ J(et, {
862
865
  colId: e,
863
- onMouseDown: c.onHandleMouseDown
866
+ onMouseDown: u.onHandleMouseDown
864
867
  })]
865
868
  }, e);
866
- }) }) }), /* @__PURE__ */ J("tbody", { children: x.map((e, t) => {
867
- let n = A ? l(e[A]) : "", r = D && k && n ? k.replace(/:\w+/, n) : void 0;
868
- return /* @__PURE__ */ J("tr", { children: E.map((t) => {
869
- let n = t === O, i = j.get(t), a = i ? i(e[t], e) : l(e[t]);
869
+ }) }) }), /* @__PURE__ */ J("tbody", { children: b.map((e, t) => {
870
+ let n = D ? M(e[D]) : "", r = w && E && n ? E.replace(/:\w+/, n) : void 0;
871
+ return /* @__PURE__ */ J("tr", { children: C.map((t) => {
872
+ let n = t === T, i = k.get(t), a = i ? i(e[t], e) : M(e[t]);
870
873
  return /* @__PURE__ */ J("td", {
871
874
  title: typeof a == "string" ? a : void 0,
872
- style: c.cellStyle(t, pe),
875
+ style: u.cellStyle(t, pe),
873
876
  children: n && r ? /* @__PURE__ */ J("a", {
874
877
  href: r,
875
878
  style: {
@@ -882,7 +885,7 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
882
885
  children: a
883
886
  }) : a
884
887
  }, t);
885
- }) }, l(e.id ?? t));
888
+ }) }, M(e.id ?? t));
886
889
  }) })]
887
890
  })
888
891
  })
@@ -890,8 +893,8 @@ function tt({ config: t, parentEntity: r, parentId: i, schema: a }) {
890
893
  }
891
894
  //#endregion
892
895
  //#region src/components/detail-layout/ChildrenList.tsx
893
- function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
894
- let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = N(t, r, e.entity, e.foreign_key, e.sort, e.limit), d = s?.data ?? [], f = s?.$refs, p = e.columns;
896
+ function nt({ config: e, parentEntity: t, parentId: n, schema: i }) {
897
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: c, isError: l } = V(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns;
895
898
  if (!a) return /* @__PURE__ */ J("div", {
896
899
  style: {
897
900
  fontSize: 12.5,
@@ -900,13 +903,13 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
900
903
  },
901
904
  children: "Entity not found."
902
905
  });
903
- let m = /* @__PURE__ */ J(Xe, {
906
+ let p = /* @__PURE__ */ J(Xe, {
904
907
  config: e,
905
908
  parentEntity: t,
906
- parentId: r,
909
+ parentId: n,
907
910
  schema: i
908
911
  });
909
- if (u) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
912
+ if (l) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
910
913
  style: {
911
914
  fontSize: 12.5,
912
915
  color: "var(--danger)",
@@ -914,7 +917,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
914
917
  },
915
918
  children: "Failed to load. Try again."
916
919
  })] });
917
- if (c) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ Y("div", {
920
+ if (c) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ Y("div", {
918
921
  style: {
919
922
  display: "flex",
920
923
  flexDirection: "column",
@@ -940,7 +943,7 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
940
943
  } })
941
944
  ]
942
945
  })] });
943
- if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
946
+ if (u.length === 0) return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
944
947
  style: {
945
948
  fontSize: 12.5,
946
949
  color: "var(--text-3)",
@@ -948,14 +951,14 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
948
951
  },
949
952
  children: "No records yet."
950
953
  })] });
951
- let h = p.length > 0 ? a.display.display_field ?? p[0] : a.display.display_field;
952
- return /* @__PURE__ */ Y("div", { children: [m, /* @__PURE__ */ J("div", {
954
+ let m = f.length > 0 ? a.display.display_field ?? f[0] : a.display.display_field;
955
+ return /* @__PURE__ */ Y("div", { children: [p, /* @__PURE__ */ J("div", {
953
956
  style: {
954
957
  display: "flex",
955
958
  flexDirection: "column"
956
959
  },
957
- children: d.map((e, t) => {
958
- let n = typeof e.$display == "string" ? e[T] : "";
960
+ children: u.map((e, t) => {
961
+ let n = typeof e.$display == "string" ? e[x] : "";
959
962
  return /* @__PURE__ */ J("div", {
960
963
  style: {
961
964
  display: "flex",
@@ -976,17 +979,17 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
976
979
  textOverflow: "ellipsis",
977
980
  whiteSpace: "nowrap"
978
981
  },
979
- children: n || (h && a.fields.get(h) ? x({
980
- field: a.fields.get(h),
981
- fieldName: h,
982
- value: e[h],
982
+ children: n || (m && a.fields.get(m) ? S({
983
+ field: a.fields.get(m),
984
+ fieldName: m,
985
+ value: e[m],
983
986
  mode: "display",
984
987
  record: e,
985
- refs: f,
988
+ refs: d,
986
989
  locale: o
987
- }) : h && e[h] != null ? l(e[h]) : null)
988
- }), p.length > 1 && (() => {
989
- let t = p.slice(1, 3).filter((t) => e[t] != null);
990
+ }) : m && e[m] != null ? M(e[m]) : null)
991
+ }), f.length > 1 && (() => {
992
+ let t = f.slice(1, 3).filter((t) => e[t] != null);
990
993
  return t.length === 0 ? null : /* @__PURE__ */ J("div", {
991
994
  style: {
992
995
  fontSize: 11.5,
@@ -995,26 +998,26 @@ function nt({ config: e, parentEntity: t, parentId: r, schema: i }) {
995
998
  textOverflow: "ellipsis",
996
999
  whiteSpace: "nowrap"
997
1000
  },
998
- children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? x({
1001
+ children: t.map((t, n) => /* @__PURE__ */ Y("span", { children: [n > 0 && " · ", a.fields.get(t) ? S({
999
1002
  field: a.fields.get(t),
1000
1003
  fieldName: t,
1001
1004
  value: e[t],
1002
1005
  mode: "display",
1003
1006
  record: e,
1004
- refs: f,
1007
+ refs: d,
1005
1008
  locale: o
1006
1009
  }) : String(e[t])] }, t))
1007
1010
  });
1008
1011
  })()]
1009
1012
  })
1010
- }, l(e.id ?? t));
1013
+ }, M(e.id ?? t));
1011
1014
  })
1012
1015
  })] });
1013
1016
  }
1014
1017
  //#endregion
1015
1018
  //#region src/components/detail-layout/ChildrenCards.tsx
1016
- function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1017
- let a = i.entities[e.entity], o = n(), { data: s, isLoading: c, isError: u } = N(t, r, 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;
1019
+ function rt({ config: e, parentEntity: t, parentId: n, schema: i }) {
1020
+ let a = i.entities[e.entity], o = r(), { data: s, isLoading: c, isError: l } = V(t, n, e.entity, e.foreign_key, e.sort, e.limit), u = s?.data ?? [], d = s?.$refs, f = e.columns, p = e.cards, m = p?.header_field ?? f[0], h = p?.badge_field, g = p?.columns_count ?? 3;
1018
1021
  if (!a) return /* @__PURE__ */ J("div", {
1019
1022
  style: {
1020
1023
  fontSize: 12.5,
@@ -1023,17 +1026,17 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1023
1026
  },
1024
1027
  children: "Entity not found."
1025
1028
  });
1026
- let v = {
1029
+ let _ = {
1027
1030
  display: "grid",
1028
- gridTemplateColumns: `repeat(auto-fill, minmax(${_ >= 4 ? 180 : 240}px, 1fr))`,
1031
+ gridTemplateColumns: `repeat(auto-fill, minmax(${g >= 4 ? 180 : 240}px, 1fr))`,
1029
1032
  gap: 12
1030
- }, b = /* @__PURE__ */ J(Xe, {
1033
+ }, v = /* @__PURE__ */ J(Xe, {
1031
1034
  config: e,
1032
1035
  parentEntity: t,
1033
- parentId: r,
1036
+ parentId: n,
1034
1037
  schema: i
1035
1038
  });
1036
- if (u) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1039
+ if (l) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
1037
1040
  style: {
1038
1041
  fontSize: 12.5,
1039
1042
  color: "var(--danger)",
@@ -1041,8 +1044,8 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1041
1044
  },
1042
1045
  children: "Failed to load. Try again."
1043
1046
  })] });
1044
- if (c) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1045
- style: v,
1047
+ if (c) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
1048
+ style: _,
1046
1049
  children: [
1047
1050
  0,
1048
1051
  1,
@@ -1053,7 +1056,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1053
1056
  borderRadius: 10
1054
1057
  } }, e))
1055
1058
  })] });
1056
- if (d.length === 0) return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1059
+ if (u.length === 0) return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
1057
1060
  style: {
1058
1061
  fontSize: 12.5,
1059
1062
  color: "var(--text-3)",
@@ -1061,10 +1064,10 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1061
1064
  },
1062
1065
  children: "No records yet."
1063
1066
  })] });
1064
- let S = p.filter((e) => e !== h && e !== g);
1065
- return /* @__PURE__ */ Y("div", { children: [b, /* @__PURE__ */ J("div", {
1066
- style: v,
1067
- children: d.map((t, n) => /* @__PURE__ */ Y("div", {
1067
+ let y = f.filter((e) => e !== m && e !== h);
1068
+ return /* @__PURE__ */ Y("div", { children: [v, /* @__PURE__ */ J("div", {
1069
+ style: _,
1070
+ children: u.map((t, n) => /* @__PURE__ */ Y("div", {
1068
1071
  style: {
1069
1072
  background: "var(--surface)",
1070
1073
  border: "1px solid var(--border)",
@@ -1078,7 +1081,7 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1078
1081
  alignItems: "center",
1079
1082
  justifyContent: "space-between",
1080
1083
  gap: 8,
1081
- borderBottom: S.length > 0 ? "1px solid var(--divider)" : "none"
1084
+ borderBottom: y.length > 0 ? "1px solid var(--divider)" : "none"
1082
1085
  },
1083
1086
  children: [/* @__PURE__ */ J("div", {
1084
1087
  style: {
@@ -1088,36 +1091,36 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1088
1091
  textOverflow: "ellipsis",
1089
1092
  whiteSpace: "nowrap"
1090
1093
  },
1091
- children: h && a.fields.get(h) ? x({
1092
- field: a.fields.get(h),
1093
- fieldName: h,
1094
- value: t[h],
1094
+ children: m && a.fields.get(m) ? S({
1095
+ field: a.fields.get(m),
1096
+ fieldName: m,
1097
+ value: t[m],
1095
1098
  mode: "display",
1096
1099
  record: t,
1097
- refs: f,
1100
+ refs: d,
1098
1101
  locale: o
1099
1102
  }) : `Record ${n + 1}`
1100
- }), g && t[g] != null && /* @__PURE__ */ J(y, {
1103
+ }), h && t[h] != null && /* @__PURE__ */ J(O, {
1101
1104
  tone: "slate",
1102
1105
  size: "xs",
1103
- children: a.fields.get(g) ? x({
1104
- field: a.fields.get(g),
1105
- fieldName: g,
1106
- value: t[g],
1106
+ children: a.fields.get(h) ? S({
1107
+ field: a.fields.get(h),
1108
+ fieldName: h,
1109
+ value: t[h],
1107
1110
  mode: "display",
1108
1111
  record: t,
1109
- refs: f,
1112
+ refs: d,
1110
1113
  locale: o
1111
- }) : l(t[g])
1114
+ }) : M(t[h])
1112
1115
  })]
1113
- }), S.length > 0 && /* @__PURE__ */ J("div", {
1116
+ }), y.length > 0 && /* @__PURE__ */ J("div", {
1114
1117
  style: {
1115
1118
  padding: "10px 14px",
1116
1119
  display: "flex",
1117
1120
  flexDirection: "column",
1118
1121
  gap: 4
1119
1122
  },
1120
- children: S.slice(0, 4).map((n) => {
1123
+ children: y.slice(0, 4).map((n) => {
1121
1124
  let r = a.fields.get(n);
1122
1125
  return r ? /* @__PURE__ */ Y("div", {
1123
1126
  style: {
@@ -1138,107 +1141,107 @@ function rt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1138
1141
  textOverflow: "ellipsis",
1139
1142
  whiteSpace: "nowrap"
1140
1143
  },
1141
- children: x({
1144
+ children: S({
1142
1145
  field: r,
1143
1146
  fieldName: n,
1144
1147
  value: t[n],
1145
1148
  mode: "display",
1146
1149
  record: t,
1147
- refs: f,
1150
+ refs: d,
1148
1151
  locale: o
1149
1152
  })
1150
1153
  })]
1151
1154
  }, n) : null;
1152
1155
  })
1153
1156
  })]
1154
- }, l(t.id ?? n)))
1157
+ }, M(t.id ?? n)))
1155
1158
  })] });
1156
1159
  }
1157
1160
  //#endregion
1158
1161
  //#region src/hooks/useTimelineData.ts
1159
1162
  var it = 50;
1160
- function at(e, t, n, r, a, s) {
1161
- let c = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? i(t, c.length) : [t], u = s ?? it, d = be({
1163
+ function at(e, t, n, r, i, a) {
1164
+ let o = Array.isArray(r) ? r : [r], c = Array.isArray(r) ? C(t, o.length) : [t], l = a ?? it, u = be({
1162
1165
  queryKey: [
1163
1166
  te,
1164
1167
  e,
1165
1168
  t,
1166
1169
  n,
1167
1170
  "timeline",
1168
- a,
1169
- u
1171
+ i,
1172
+ l
1170
1173
  ],
1171
1174
  queryFn: ({ pageParam: e }) => {
1172
1175
  let t = new URLSearchParams();
1173
- if (!l) throw Error("invalid composite parent id");
1174
- let r = c.map((e, t) => ({
1176
+ if (!c) throw Error("invalid composite parent id");
1177
+ let r = o.map((e, t) => ({
1175
1178
  field: e,
1176
1179
  op: "eq",
1177
- value: l[t]
1180
+ value: c[t]
1178
1181
  }));
1179
- 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()}`);
1182
+ 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(l)), e && t.set("after", e), s(`/api/data/${n}?${t.toString()}`);
1180
1183
  },
1181
1184
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
1182
1185
  initialPageParam: void 0,
1183
- enabled: !!e && !!t && !!n && !!r && l !== null
1186
+ enabled: !!e && !!t && !!n && !!r && c !== null
1184
1187
  });
1185
1188
  return {
1186
- rows: W(() => d.data?.pages.flatMap((e) => e.data) ?? [], [d.data?.pages]),
1187
- refs: d.data?.pages[0]?.$refs,
1188
- fetchNextPage: d.fetchNextPage,
1189
- hasOlder: !!d.hasNextPage,
1190
- isFetchingOlder: d.isFetchingNextPage,
1191
- isLoading: d.isLoading,
1192
- isError: d.isError
1189
+ rows: W(() => u.data?.pages.flatMap((e) => e.data) ?? [], [u.data?.pages]),
1190
+ refs: u.data?.pages[0]?.$refs,
1191
+ fetchNextPage: u.fetchNextPage,
1192
+ hasOlder: !!u.hasNextPage,
1193
+ isFetchingOlder: u.isFetchingNextPage,
1194
+ isLoading: u.isLoading,
1195
+ isError: u.isError
1193
1196
  };
1194
1197
  }
1195
1198
  //#endregion
1196
1199
  //#region src/components/detail-layout/TimelineComposer.tsx
1197
1200
  var ot = "quick_entry", st = 100, ct = 240, lt = 800, ut = 80;
1198
- function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1199
- 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] = K(ct), _ = G(null), v = G(null), [y, S] = K(lt);
1201
+ function dt({ config: t, parentEntity: n, parentId: i, schema: a }) {
1202
+ let { values: o, quickAdd: s, childEntity: c, isPending: l, error: u, isReady: d, handleSubmit: f, handleFieldChange: p } = Ye(t, n, i, a), m = r(), [h, g] = K(ct), _ = G(null), v = G(null), [x, C] = K(lt);
1200
1203
  U(() => {
1201
1204
  let e = v.current?.parentElement;
1202
1205
  if (!e) return;
1203
1206
  let t = () => {
1204
1207
  let t = Math.max(st, e.clientHeight - ut);
1205
- S(Math.min(lt, t));
1208
+ C(Math.min(lt, t));
1206
1209
  };
1207
1210
  t();
1208
1211
  let n = new ResizeObserver(t);
1209
1212
  return n.observe(e), () => n.disconnect();
1210
1213
  }, []), U(() => {
1211
- g((e) => Math.min(e, y));
1212
- }, [y]);
1213
- let C = G(o);
1214
- C.current = o;
1215
- let w = G(p);
1216
- w.current = p;
1217
- let T = G({}), E = W(() => ({
1218
- getField: (e) => C.current[e],
1214
+ g((e) => Math.min(e, x));
1215
+ }, [x]);
1216
+ let w = G(o);
1217
+ w.current = o;
1218
+ let T = G(p);
1219
+ T.current = p;
1220
+ let E = G({}), D = W(() => ({
1221
+ getField: (e) => w.current[e],
1219
1222
  setField: (e, t) => {
1220
- w.current(e, t);
1223
+ T.current(e, t);
1221
1224
  },
1222
1225
  focusField: (e) => {
1223
- let t = T.current[e];
1226
+ let t = E.current[e];
1224
1227
  t && (t.querySelector("textarea, input, select, [contenteditable]") ?? t).focus();
1225
1228
  }
1226
1229
  }), []);
1227
- U(() => b(ot, E), [E]);
1228
- let D = H((e) => {
1230
+ U(() => y(ot, D), [D]);
1231
+ let O = H((e) => {
1229
1232
  e.preventDefault(), _.current = {
1230
1233
  startY: e.clientY,
1231
1234
  startHeight: h
1232
1235
  };
1233
1236
  let t = (e) => {
1234
1237
  if (!_.current) return;
1235
- let t = _.current.startY - e.clientY, n = Math.min(y, Math.max(st, _.current.startHeight + t));
1238
+ let t = _.current.startY - e.clientY, n = Math.min(x, Math.max(st, _.current.startHeight + t));
1236
1239
  g(n);
1237
1240
  }, n = () => {
1238
1241
  _.current = null, document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1239
1242
  };
1240
1243
  document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1241
- }, [h, y]);
1244
+ }, [h, x]);
1242
1245
  if (!s || s.fields.length === 0 || !c) return null;
1243
1246
  let k = s.fields.find((e) => {
1244
1247
  let t = c.fields.get(e);
@@ -1253,9 +1256,9 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1253
1256
  let t = c.fields.get(e);
1254
1257
  return t ? /* @__PURE__ */ J("div", {
1255
1258
  ref: (t) => {
1256
- T.current[e] = t;
1259
+ E.current[e] = t;
1257
1260
  },
1258
- children: x({
1261
+ children: S({
1259
1262
  field: t,
1260
1263
  fieldName: e,
1261
1264
  value: o[e] ?? "",
@@ -1277,7 +1280,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1277
1280
  height: `${h}px`
1278
1281
  },
1279
1282
  children: [/* @__PURE__ */ J("div", {
1280
- onMouseDown: D,
1283
+ onMouseDown: O,
1281
1284
  title: "Drag to resize",
1282
1285
  style: {
1283
1286
  height: 12,
@@ -1324,9 +1327,9 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1324
1327
  display: "flex"
1325
1328
  },
1326
1329
  ref: (e) => {
1327
- T.current[k] = e;
1330
+ E.current[k] = e;
1328
1331
  },
1329
- children: x({
1332
+ children: S({
1330
1333
  field: c.fields.get(k),
1331
1334
  fieldName: k,
1332
1335
  value: o[k] ?? "",
@@ -1368,7 +1371,7 @@ function dt({ config: t, parentEntity: r, parentId: i, schema: a }) {
1368
1371
  }),
1369
1372
  " to add"
1370
1373
  ]
1371
- }), /* @__PURE__ */ J(O, {
1374
+ }), /* @__PURE__ */ J(b, {
1372
1375
  type: "submit",
1373
1376
  kind: "primary",
1374
1377
  icon: /* @__PURE__ */ J(e.plus, { size: 13 }),
@@ -1402,50 +1405,50 @@ function _t(e) {
1402
1405
  function vt(e, t) {
1403
1406
  if (yt(t)) {
1404
1407
  let e = t.id;
1405
- return e == null ? "" : l(e);
1408
+ return e == null ? "" : M(e);
1406
1409
  }
1407
- return M(j(e, t));
1410
+ return j(i(e, t));
1408
1411
  }
1409
1412
  function yt(e) {
1410
1413
  return e.__optimistic === !0;
1411
1414
  }
1412
- function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1413
- 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"), _ = 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);
1415
+ function bt({ config: e, parentEntity: t, parentId: r, schema: i }) {
1416
+ let o = i.entities[e.entity], { rows: s, refs: c, fetchNextPage: l, hasOlder: u, isFetchingOlder: d, isLoading: f, isError: p } = at(t, r, e.entity, e.foreign_key, e.timeline?.time_field, e.limit), m = e.timeline, h = m?.scroll ?? !1, g = (e.sort ?? "").endsWith(":asc"), _ = W(() => g ? [...s].reverse() : s, [s, g]), v = m?.auto_scroll ?? "none", y = G(null), x = G(null), S = G(!1), C = G(0), w = G(null), T = G(null), E = G(!0), D = G(null);
1414
1417
  U(() => {
1415
- x.current = !1, S.current = 0, C.current = null, w.current = null, T.current = !0, E.current = null;
1416
- }, [n]), ye(() => {
1417
- !l || !y.current || (E.current = {
1418
+ S.current = !1, C.current = 0, w.current = null, T.current = null, E.current = !0, D.current = null;
1419
+ }, [r]), ye(() => {
1420
+ !d || !y.current || (D.current = {
1418
1421
  scrollHeight: y.current.scrollHeight,
1419
1422
  scrollTop: y.current.scrollTop
1420
1423
  });
1421
- }, [l]), ye(() => {
1424
+ }, [d]), ye(() => {
1422
1425
  let e = y.current;
1423
- if (!e || _.length === 0 || !i) {
1424
- S.current = _.length;
1426
+ if (!e || _.length === 0 || !o) {
1427
+ C.current = _.length;
1425
1428
  return;
1426
1429
  }
1427
- 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;
1428
- if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), x.current = !0;
1429
- else if (o && E.current) {
1430
- let t = E.current;
1431
- g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), E.current = null;
1432
- } else s && g && T.current && (e.scrollTop = e.scrollHeight);
1433
- S.current = _.length, C.current = t, w.current = n;
1430
+ let t = vt(o, _[0]), n = vt(o, _[_.length - 1]), r = !S.current, i = _.length > C.current && C.current > 0, a = i && (g && t !== w.current && n === T.current || !g && n !== T.current && t === w.current), s = i && !a;
1431
+ if (r) g && v === "bottom" && (e.scrollTop = e.scrollHeight), S.current = !0;
1432
+ else if (a && D.current) {
1433
+ let t = D.current;
1434
+ g && (e.scrollTop = t.scrollTop + (e.scrollHeight - t.scrollHeight)), D.current = null;
1435
+ } else s && g && E.current && (e.scrollTop = e.scrollHeight);
1436
+ C.current = _.length, w.current = t, T.current = n;
1434
1437
  }, [
1435
1438
  _,
1436
1439
  v,
1437
1440
  g,
1438
- i
1441
+ o
1439
1442
  ]);
1440
- let D = H(() => {
1443
+ let O = H(() => {
1441
1444
  let e = y.current;
1442
- e && (T.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
1445
+ e && (E.current = e.scrollHeight - e.scrollTop - e.clientHeight < ft);
1443
1446
  }, []);
1444
1447
  U(() => {
1445
- let e = b.current;
1448
+ let e = x.current;
1446
1449
  if (!e || typeof IntersectionObserver > "u") return;
1447
1450
  let t = new IntersectionObserver((e) => {
1448
- for (let t of e) t.isIntersecting && c && !l && s();
1451
+ for (let t of e) t.isIntersecting && u && !d && l();
1449
1452
  }, {
1450
1453
  root: y.current ?? null,
1451
1454
  rootMargin: `${pt}px 0px 0px 0px`,
@@ -1453,12 +1456,12 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1453
1456
  });
1454
1457
  return t.observe(e), () => t.disconnect();
1455
1458
  }, [
1456
- c,
1457
- l,
1458
- s
1459
+ u,
1460
+ d,
1461
+ l
1459
1462
  ]);
1460
1463
  let [k, A] = K(null);
1461
- if (!i) return /* @__PURE__ */ J("div", {
1464
+ if (!o) return /* @__PURE__ */ J("div", {
1462
1465
  style: {
1463
1466
  fontSize: 12.5,
1464
1467
  color: "var(--text-3)",
@@ -1466,25 +1469,25 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1466
1469
  },
1467
1470
  children: "Entity not found."
1468
1471
  });
1469
- 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__ */ J("div", {
1472
+ let j = e.quick_add?.fields ?? [m?.content_field].filter(Boolean), M = a(o.display?.name_plural) || a(o.display?.name) || e.entity, ee = u ? /* @__PURE__ */ J("div", {
1470
1473
  style: {
1471
1474
  display: "flex",
1472
1475
  justifyContent: "center",
1473
1476
  padding: "6px 0"
1474
1477
  },
1475
- children: /* @__PURE__ */ J(O, {
1478
+ children: /* @__PURE__ */ J(b, {
1476
1479
  size: "xs",
1477
- onClick: () => s(),
1478
- disabled: l,
1479
- icon: l ? /* @__PURE__ */ J(h, { size: 11 }) : void 0,
1480
- children: l ? "Loading…" : "Load older"
1480
+ onClick: () => l(),
1481
+ disabled: d,
1482
+ icon: d ? /* @__PURE__ */ J(n, { size: 11 }) : void 0,
1483
+ children: d ? "Loading…" : "Load older"
1481
1484
  })
1482
1485
  }) : null, N = /* @__PURE__ */ J("div", {
1483
- ref: b,
1486
+ ref: x,
1484
1487
  "aria-hidden": "true",
1485
1488
  style: { height: 1 }
1486
1489
  }), P;
1487
- if (d) P = /* @__PURE__ */ J("div", {
1490
+ if (p) P = /* @__PURE__ */ J("div", {
1488
1491
  style: {
1489
1492
  fontSize: 12.5,
1490
1493
  color: "var(--danger)",
@@ -1492,7 +1495,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1492
1495
  },
1493
1496
  children: "Failed to load."
1494
1497
  });
1495
- else if (u) P = /* @__PURE__ */ Y("div", {
1498
+ else if (f) P = /* @__PURE__ */ Y("div", {
1496
1499
  style: {
1497
1500
  display: "flex",
1498
1501
  flexDirection: "column",
@@ -1518,42 +1521,42 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1518
1521
  children: "No activity yet."
1519
1522
  })] });
1520
1523
  else {
1521
- let a = (a, s) => {
1522
- let c = vt(i, a) || String(s);
1524
+ let n = (n, a) => {
1525
+ let s = vt(o, n) || String(a);
1523
1526
  return /* @__PURE__ */ J(xt, {
1524
- row: a,
1525
- rowId: c,
1526
- childEntity: i,
1527
+ row: n,
1528
+ rowId: s,
1529
+ childEntity: o,
1527
1530
  entityCode: e.entity,
1528
1531
  parentEntity: t,
1529
- parentId: n,
1530
- timeline: p,
1532
+ parentId: r,
1533
+ timeline: m,
1531
1534
  editableFields: j,
1532
- refs: o,
1533
- isEditing: k === c,
1534
- onStartEdit: () => A(c),
1535
+ refs: c,
1536
+ isEditing: k === s,
1537
+ onStartEdit: () => A(s),
1535
1538
  onCancelEdit: () => A(null),
1536
1539
  onSaved: () => A(null),
1537
- schema: r,
1538
- optimistic: yt(a)
1539
- }, c);
1540
- }, s = p?.time_field, c;
1541
- if (s) {
1540
+ schema: i,
1541
+ optimistic: yt(n)
1542
+ }, s);
1543
+ }, a = m?.time_field, s;
1544
+ if (a) {
1542
1545
  let e = [];
1543
1546
  _.forEach((t, n) => {
1544
- let r = t[s], i = Ct(r), a = e[e.length - 1];
1545
- !a || a.key !== i ? e.push({
1547
+ let r = t[a], i = Ct(r), o = e[e.length - 1];
1548
+ !o || o.key !== i ? e.push({
1546
1549
  key: i,
1547
1550
  label: wt(r),
1548
1551
  rows: [{
1549
1552
  row: t,
1550
1553
  idx: n
1551
1554
  }]
1552
- }) : a.rows.push({
1555
+ }) : o.rows.push({
1553
1556
  row: t,
1554
1557
  idx: n
1555
1558
  });
1556
- }), c = e.map((e) => /* @__PURE__ */ Y("div", {
1559
+ }), s = e.map((e) => /* @__PURE__ */ Y("div", {
1557
1560
  style: {
1558
1561
  display: "flex",
1559
1562
  flexDirection: "column",
@@ -1562,16 +1565,16 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1562
1565
  children: [/* @__PURE__ */ J(Tt, {
1563
1566
  label: e.label,
1564
1567
  count: e.rows.length
1565
- }), e.rows.map(({ row: e, idx: t }) => a(e, t))]
1568
+ }), e.rows.map(({ row: e, idx: t }) => n(e, t))]
1566
1569
  }, `day-${e.key}`));
1567
- } else c = _.map((e, t) => a(e, t));
1570
+ } else s = _.map((e, t) => n(e, t));
1568
1571
  P = /* @__PURE__ */ Y(q, { children: [
1569
1572
  N,
1570
1573
  ee,
1571
- c
1574
+ s
1572
1575
  ] });
1573
1576
  }
1574
- return m ? /* @__PURE__ */ Y("div", {
1577
+ return h ? /* @__PURE__ */ Y("div", {
1575
1578
  style: {
1576
1579
  display: "flex",
1577
1580
  flexDirection: "column",
@@ -1598,7 +1601,7 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1598
1601
  }),
1599
1602
  /* @__PURE__ */ J("div", {
1600
1603
  ref: y,
1601
- onScroll: D,
1604
+ onScroll: O,
1602
1605
  style: {
1603
1606
  flex: 1,
1604
1607
  overflowY: "auto",
@@ -1612,8 +1615,8 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1612
1615
  /* @__PURE__ */ J(dt, {
1613
1616
  config: e,
1614
1617
  parentEntity: t,
1615
- parentId: n,
1616
- schema: r
1618
+ parentId: r,
1619
+ schema: i
1617
1620
  })
1618
1621
  ]
1619
1622
  }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
@@ -1626,56 +1629,56 @@ function bt({ config: e, parentEntity: t, parentId: n, schema: r }) {
1626
1629
  }), /* @__PURE__ */ J(dt, {
1627
1630
  config: e,
1628
1631
  parentEntity: t,
1629
- parentId: n,
1630
- schema: r
1632
+ parentId: r,
1633
+ schema: i
1631
1634
  })] });
1632
1635
  }
1633
- 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 }) {
1634
- let S = Se(), T = n(), [D, A] = K({}), j = H(() => {
1635
- S.invalidateQueries({ queryKey: [
1636
+ function xt({ row: t, rowId: i, childEntity: a, entityCode: o, parentEntity: s, parentId: c, timeline: l, editableFields: u, refs: d, isEditing: f, onStartEdit: p, onCancelEdit: m, onSaved: h, schema: g, optimistic: _ = !1 }) {
1637
+ let y = Se(), x = r(), [C, T] = K({}), D = H(() => {
1638
+ y.invalidateQueries({ queryKey: [
1636
1639
  te,
1637
- o,
1638
1640
  s,
1639
- a
1641
+ c,
1642
+ o
1640
1643
  ] });
1641
1644
  }, [
1642
- S,
1643
- o,
1645
+ y,
1644
1646
  s,
1645
- a
1646
- ]), M = xe({
1647
+ c,
1648
+ o
1649
+ ]), j = xe({
1647
1650
  mutationFn: (e) => {
1648
- let n = t.$row_version, i = typeof n == "string" && n !== "" ? {
1651
+ let n = t.$row_version, r = typeof n == "string" && n !== "" ? {
1649
1652
  ...e,
1650
1653
  $row_version: n
1651
1654
  } : e;
1652
- return C(a, r, i);
1655
+ return w(o, i, r);
1653
1656
  },
1654
1657
  onSuccess: () => {
1655
- j(), E.success("Updated"), _();
1658
+ D(), E.success("Updated"), h();
1656
1659
  },
1657
1660
  onError: (e) => E.error(e.message)
1658
1661
  }), ee = xe({
1659
- mutationFn: () => k(a, r),
1662
+ mutationFn: () => k(o, i),
1660
1663
  onSuccess: () => {
1661
- j(), E.success("Deleted");
1664
+ D(), E.success("Deleted");
1662
1665
  },
1663
1666
  onError: (e) => E.error(e.message)
1664
1667
  }), N = H(() => {
1665
1668
  let e = {};
1666
1669
  for (let n of u) e[n] = t[n] ?? "";
1667
- A(e), m();
1670
+ T(e), p();
1668
1671
  }, [
1669
1672
  t,
1670
1673
  u,
1671
- m
1674
+ p
1672
1675
  ]), P = H((e, t) => {
1673
- A((n) => ({
1676
+ T((n) => ({
1674
1677
  ...n,
1675
1678
  [e]: t
1676
1679
  }));
1677
- }, []), F = c?.time_field, I = c?.type_field, L = c?.summary_field, R = c?.content_field, z = c?.author_field, B = c?.direction_field, V = c?.intent_field;
1678
- return p ? /* @__PURE__ */ Y("div", {
1680
+ }, []), F = l?.time_field, I = l?.type_field, L = l?.summary_field, R = l?.content_field, z = l?.author_field, B = l?.direction_field, V = l?.intent_field;
1681
+ return f ? /* @__PURE__ */ Y("div", {
1679
1682
  style: {
1680
1683
  borderRadius: 10,
1681
1684
  border: "1px solid var(--accent)",
@@ -1686,7 +1689,7 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1686
1689
  gap: 8
1687
1690
  },
1688
1691
  children: [u.map((e) => {
1689
- let t = i.fields.get(e);
1692
+ let t = a.fields.get(e);
1690
1693
  return t ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("label", {
1691
1694
  style: {
1692
1695
  fontSize: 11,
@@ -1694,15 +1697,15 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1694
1697
  marginBottom: 4,
1695
1698
  display: "block"
1696
1699
  },
1697
- children: d(t, e, v.entities)
1698
- }), x({
1700
+ children: A(t, e, g.entities)
1701
+ }), S({
1699
1702
  field: t,
1700
1703
  fieldName: e,
1701
- value: D[e] ?? "",
1704
+ value: C[e] ?? "",
1702
1705
  mode: "edit",
1703
1706
  onChange: (t) => P(e, t),
1704
- record: D,
1705
- locale: T
1707
+ record: C,
1708
+ locale: x
1706
1709
  })] }, e) : null;
1707
1710
  }), /* @__PURE__ */ Y("div", {
1708
1711
  style: {
@@ -1711,33 +1714,33 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1711
1714
  gap: 6,
1712
1715
  paddingTop: 4
1713
1716
  },
1714
- children: [/* @__PURE__ */ J(O, {
1717
+ children: [/* @__PURE__ */ J(b, {
1715
1718
  kind: "primary",
1716
1719
  size: "xs",
1717
- icon: M.isPending ? /* @__PURE__ */ J(h, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1718
- onClick: () => M.mutate(D),
1719
- disabled: M.isPending,
1720
- children: M.isPending ? "Saving…" : "Save"
1721
- }), /* @__PURE__ */ J(O, {
1720
+ icon: j.isPending ? /* @__PURE__ */ J(n, { size: 12 }) : /* @__PURE__ */ J(e.check, { size: 12 }),
1721
+ onClick: () => j.mutate(C),
1722
+ disabled: j.isPending,
1723
+ children: j.isPending ? "Saving…" : "Save"
1724
+ }), /* @__PURE__ */ J(b, {
1722
1725
  size: "xs",
1723
1726
  icon: /* @__PURE__ */ J(e.x, { size: 12 }),
1724
1727
  onClick: () => {
1725
- A({}), g();
1728
+ T({}), m();
1726
1729
  },
1727
- disabled: M.isPending,
1730
+ disabled: j.isPending,
1728
1731
  children: "Cancel"
1729
1732
  })]
1730
1733
  })]
1731
1734
  }) : /* @__PURE__ */ Y("div", {
1732
1735
  className: "group",
1733
- "data-optimistic": b || void 0,
1736
+ "data-optimistic": _ || void 0,
1734
1737
  style: {
1735
1738
  borderRadius: 10,
1736
1739
  border: "1px solid var(--border)",
1737
1740
  background: "var(--surface)",
1738
1741
  padding: 12,
1739
1742
  transition: "border-color .12s",
1740
- opacity: b ? .6 : 1
1743
+ opacity: _ ? .6 : 1
1741
1744
  },
1742
1745
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
1743
1746
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
@@ -1752,74 +1755,74 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1752
1755
  color: "var(--text-3)"
1753
1756
  },
1754
1757
  children: [
1755
- F && t[F] != null && i.fields.get(F) && /* @__PURE__ */ J("span", {
1758
+ F && t[F] != null && a.fields.get(F) && /* @__PURE__ */ J("span", {
1756
1759
  style: { fontWeight: 500 },
1757
- children: x({
1758
- field: i.fields.get(F),
1760
+ children: S({
1761
+ field: a.fields.get(F),
1759
1762
  fieldName: F,
1760
1763
  value: t[F],
1761
1764
  mode: "display",
1762
1765
  record: t,
1763
- refs: f,
1764
- locale: T
1766
+ refs: d,
1767
+ locale: x
1765
1768
  })
1766
1769
  }),
1767
- I && t[I] != null && i.fields.get(I) && /* @__PURE__ */ J(y, {
1770
+ I && t[I] != null && a.fields.get(I) && /* @__PURE__ */ J(O, {
1768
1771
  tone: "slate",
1769
1772
  size: "xs",
1770
- children: x({
1771
- field: i.fields.get(I),
1773
+ children: S({
1774
+ field: a.fields.get(I),
1772
1775
  fieldName: I,
1773
1776
  value: t[I],
1774
1777
  mode: "display",
1775
1778
  record: t,
1776
- refs: f,
1777
- locale: T
1779
+ refs: d,
1780
+ locale: x
1778
1781
  })
1779
1782
  }),
1780
- B && t[B] != null && i.fields.get(B) && /* @__PURE__ */ J(Et, {
1783
+ B && t[B] != null && a.fields.get(B) && /* @__PURE__ */ J(Et, {
1781
1784
  value: t[B],
1782
- field: i.fields.get(B)
1785
+ field: a.fields.get(B)
1783
1786
  }),
1784
- V && t[V] != null && i.fields.get(V) && /* @__PURE__ */ J(y, {
1787
+ V && t[V] != null && a.fields.get(V) && /* @__PURE__ */ J(O, {
1785
1788
  tone: "slate",
1786
1789
  size: "xs",
1787
- children: x({
1788
- field: i.fields.get(V),
1790
+ children: S({
1791
+ field: a.fields.get(V),
1789
1792
  fieldName: V,
1790
1793
  value: t[V],
1791
1794
  mode: "display",
1792
1795
  record: t,
1793
- refs: f,
1794
- locale: T
1796
+ refs: d,
1797
+ locale: x
1795
1798
  })
1796
1799
  }),
1797
- z && t[z] != null && i.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1800
+ z && t[z] != null && a.fields.get(z) && /* @__PURE__ */ Y("span", { children: [
1798
1801
  "by",
1799
1802
  " ",
1800
- x({
1801
- field: i.fields.get(z),
1803
+ S({
1804
+ field: a.fields.get(z),
1802
1805
  fieldName: z,
1803
1806
  value: t[z],
1804
1807
  mode: "display",
1805
1808
  record: t,
1806
- refs: f,
1807
- locale: T
1809
+ refs: d,
1810
+ locale: x
1808
1811
  })
1809
1812
  ] }),
1810
- !b && /* @__PURE__ */ Y("div", {
1813
+ !_ && /* @__PURE__ */ Y("div", {
1811
1814
  style: {
1812
1815
  marginLeft: "auto",
1813
1816
  display: "flex",
1814
1817
  alignItems: "center",
1815
1818
  gap: 2
1816
1819
  },
1817
- children: [/* @__PURE__ */ J(w, {
1820
+ children: [/* @__PURE__ */ J(v, {
1818
1821
  size: 22,
1819
1822
  icon: /* @__PURE__ */ J(e.edit, { size: 11 }),
1820
1823
  onClick: N,
1821
1824
  title: "Edit"
1822
- }), /* @__PURE__ */ J(w, {
1825
+ }), /* @__PURE__ */ J(v, {
1823
1826
  size: 22,
1824
1827
  icon: /* @__PURE__ */ J(e.trash, { size: 11 }),
1825
1828
  onClick: () => ee.mutate(),
@@ -1828,33 +1831,33 @@ function xt({ row: t, rowId: r, childEntity: i, entityCode: a, parentEntity: o,
1828
1831
  })
1829
1832
  ]
1830
1833
  }),
1831
- L && t[L] != null && i.fields.get(L) && /* @__PURE__ */ J("div", {
1834
+ L && t[L] != null && a.fields.get(L) && /* @__PURE__ */ J("div", {
1832
1835
  style: {
1833
1836
  fontSize: 12.5,
1834
1837
  fontWeight: 500,
1835
1838
  marginTop: 6
1836
1839
  },
1837
- children: x({
1838
- field: i.fields.get(L),
1840
+ children: S({
1841
+ field: a.fields.get(L),
1839
1842
  fieldName: L,
1840
1843
  value: t[L],
1841
1844
  mode: "display",
1842
1845
  record: t,
1843
- refs: f,
1844
- locale: T
1846
+ refs: d,
1847
+ locale: x
1845
1848
  })
1846
1849
  }),
1847
- R && t[R] != null && R !== L && i.fields.get(R) && /* @__PURE__ */ J(St, {
1848
- rendered: x({
1849
- field: i.fields.get(R),
1850
+ R && t[R] != null && R !== L && a.fields.get(R) && /* @__PURE__ */ J(St, {
1851
+ rendered: S({
1852
+ field: a.fields.get(R),
1850
1853
  fieldName: R,
1851
1854
  value: t[R],
1852
1855
  mode: "display",
1853
1856
  record: t,
1854
- refs: f,
1855
- locale: T
1857
+ refs: d,
1858
+ locale: x
1856
1859
  }),
1857
- text: l(t[R])
1860
+ text: M(t[R])
1858
1861
  })
1859
1862
  ]
1860
1863
  });
@@ -1880,7 +1883,7 @@ function St({ rendered: e, text: t }) {
1880
1883
  whiteSpace: "pre-wrap",
1881
1884
  overflowWrap: "anywhere"
1882
1885
  },
1883
- children: /* @__PURE__ */ J(_, {
1886
+ children: /* @__PURE__ */ J(D, {
1884
1887
  width: 380,
1885
1888
  content: /* @__PURE__ */ Y("div", {
1886
1889
  style: {
@@ -1903,12 +1906,12 @@ function St({ rendered: e, text: t }) {
1903
1906
  }
1904
1907
  function Ct(e) {
1905
1908
  if (e == null) return "";
1906
- let t = new Date(l(e));
1909
+ let t = new Date(M(e));
1907
1910
  return Number.isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1908
1911
  }
1909
1912
  function wt(e) {
1910
1913
  if (e == null) return "—";
1911
- let t = new Date(l(e));
1914
+ let t = new Date(M(e));
1912
1915
  if (Number.isNaN(t.getTime())) return "—";
1913
1916
  let n = /* @__PURE__ */ new Date(), r = /* @__PURE__ */ new Date();
1914
1917
  r.setDate(n.getDate() - 1);
@@ -1984,71 +1987,71 @@ function Dt(e, t) {
1984
1987
  }
1985
1988
  //#endregion
1986
1989
  //#region src/components/detail-layout/EditableChildrenTable.tsx
1987
- function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, validationErrors: s, refs: c, forceTablePresentation: u = !1 }) {
1988
- let f = n(), 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) => {
1989
- if (_.has(e) || t.position_field && e === t.position_field) return !1;
1990
- let n = r.fields.get(e);
1991
- return !(!n || n.auto || n.primary || n.source);
1992
- }), y = new Set(h.filter((e) => {
1990
+ function Ot({ config: t, childEntity: n, schema: i, rows: a, onChange: o, validationErrors: s, refs: c, forceTablePresentation: l = !1 }) {
1991
+ let u = r(), d = T(), f = G(null), p = t.columns, m = t.position_field, h = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), g = p.filter((e) => {
1992
+ if (h.has(e) || t.position_field && e === t.position_field) return !1;
1993
+ let r = n.fields.get(e);
1994
+ return !(!r || r.auto || r.primary || r.source);
1995
+ }), _ = new Set(p.filter((e) => {
1993
1996
  if (t.position_field && e === t.position_field) return !0;
1994
- let n = r.fields.get(e);
1995
- return n && (n.auto || n.primary || n.source);
1996
- })), b = H((e, t, n) => {
1997
+ let r = n.fields.get(e);
1998
+ return r && (r.auto || r.primary || r.source);
1999
+ })), y = H((e, t, n) => {
1997
2000
  o(a.map((r) => r._key === e ? {
1998
2001
  ...r,
1999
2002
  [t]: n,
2000
2003
  _dirty: !0
2001
2004
  } : r));
2002
- }, [a, o]), S = H(() => {
2005
+ }, [a, o]), x = H(() => {
2003
2006
  let e = {
2004
2007
  _key: crypto.randomUUID(),
2005
2008
  _dirty: !0
2006
2009
  };
2007
- if (g) {
2010
+ if (m) {
2008
2011
  let t = a.filter((e) => !e._deleted).reduce((e, t) => {
2009
- let n = typeof t[g] == "number" ? t[g] : -1;
2012
+ let n = typeof t[m] == "number" ? t[m] : -1;
2010
2013
  return Math.max(e, n);
2011
2014
  }, -1);
2012
- e[g] = t + 1;
2015
+ e[m] = t + 1;
2013
2016
  }
2014
- let n = t.quick_add?.defaults ?? {};
2015
- for (let t of v) {
2016
- let i = r.fields.get(t);
2017
- i && (n[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = n[t]);
2017
+ let r = t.quick_add?.defaults ?? {};
2018
+ for (let t of g) {
2019
+ let i = n.fields.get(t);
2020
+ i && (r[t] === void 0 ? i.default === void 0 ? i.type === "bool" && (e[t] = !1) : e[t] = i.default : e[t] = r[t]);
2018
2021
  }
2019
2022
  o([...a, e]);
2020
2023
  }, [
2021
2024
  a,
2022
2025
  o,
2023
- v,
2024
- r,
2026
+ g,
2027
+ n,
2025
2028
  t.quick_add?.defaults,
2026
- g
2029
+ m
2027
2030
  ]), C = H((e) => {
2028
2031
  o(a.map((t) => t._key === e ? {
2029
2032
  ...t,
2030
2033
  _deleted: !0
2031
2034
  } : t));
2032
- }, [a, o]), T = H((e) => {
2035
+ }, [a, o]), w = H((e) => {
2033
2036
  o(a.map((t) => t._key === e ? {
2034
2037
  ...t,
2035
2038
  _deleted: !1
2036
2039
  } : t));
2037
2040
  }, [a, o]), E = H((e, t) => {
2038
- if (!g) return;
2041
+ if (!m) return;
2039
2042
  let n = a.filter((e) => !e._deleted), r = a.filter((e) => e._deleted), i = n.findIndex((t) => t._key === e), s = i + t;
2040
2043
  if (i < 0 || s < 0 || s >= n.length) return;
2041
2044
  let c = [...n], [l] = c.splice(i, 1);
2042
2045
  c.splice(s, 0, l), o([...c.map((e, t) => ({
2043
2046
  ...e,
2044
- [g]: t,
2045
- _dirty: e[g] !== t || e._dirty
2047
+ [m]: t,
2048
+ _dirty: e[m] !== t || e._dirty
2046
2049
  })), ...r]);
2047
2050
  }, [
2048
2051
  a,
2049
2052
  o,
2050
- g
2051
- ]), k = H((e) => {
2053
+ m
2054
+ ]), D = H((e) => {
2052
2055
  let t = e.target, n = t.closest("td");
2053
2056
  if (!n) return;
2054
2057
  let r = n.closest("tr");
@@ -2072,7 +2075,7 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2072
2075
  if (o < t.length - 1) {
2073
2076
  let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
2074
2077
  e && e.focus();
2075
- } else S(), requestAnimationFrame(() => {
2078
+ } else x(), requestAnimationFrame(() => {
2076
2079
  let e = i.querySelectorAll("tr"), t = e[e.length - 1];
2077
2080
  if (t) {
2078
2081
  let e = t.querySelector("input, select, textarea, [tabindex]");
@@ -2080,15 +2083,15 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2080
2083
  }
2081
2084
  });
2082
2085
  } else e.key === "Escape" && t.blur?.();
2083
- }, [S]), A = de;
2084
- return p.isPhone && !u ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2086
+ }, [x]), O = de;
2087
+ return d.isPhone && !l ? /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2085
2088
  style: {
2086
2089
  display: "flex",
2087
2090
  flexDirection: "column",
2088
2091
  gap: 10
2089
2092
  },
2090
- children: a.map((t, n) => {
2091
- 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;
2093
+ children: a.map((t, r) => {
2094
+ let o = !!t._deleted, l = s?.[t._key], d = m ? a.filter((e) => !e._deleted) : [], f = m ? d.findIndex((e) => e._key === t._key) : -1;
2092
2095
  return /* @__PURE__ */ Y("div", {
2093
2096
  style: {
2094
2097
  border: "1px solid var(--border)",
@@ -2113,31 +2116,31 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2113
2116
  fontWeight: 600,
2114
2117
  color: "var(--text-2)"
2115
2118
  },
2116
- children: ["Row ", n + 1]
2119
+ children: ["Row ", r + 1]
2117
2120
  }), /* @__PURE__ */ Y("div", {
2118
2121
  style: {
2119
2122
  display: "flex",
2120
2123
  alignItems: "center",
2121
2124
  gap: 4
2122
2125
  },
2123
- children: [g && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(w, {
2126
+ children: [m && !o && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(v, {
2124
2127
  size: 32,
2125
2128
  icon: /* @__PURE__ */ J(e.up, { size: 14 }),
2126
2129
  onClick: () => E(t._key, -1),
2127
- disabled: m <= 0,
2130
+ disabled: f <= 0,
2128
2131
  title: "Move row up"
2129
- }), /* @__PURE__ */ J(w, {
2132
+ }), /* @__PURE__ */ J(v, {
2130
2133
  size: 32,
2131
2134
  icon: /* @__PURE__ */ J(e.down, { size: 14 }),
2132
2135
  onClick: () => E(t._key, 1),
2133
- disabled: m === -1 || m >= p.length - 1,
2136
+ disabled: f === -1 || f >= d.length - 1,
2134
2137
  title: "Move row down"
2135
- })] }), o ? /* @__PURE__ */ J(w, {
2138
+ })] }), o ? /* @__PURE__ */ J(v, {
2136
2139
  size: 32,
2137
2140
  icon: /* @__PURE__ */ J(e.refresh, { size: 14 }),
2138
- onClick: () => T(t._key),
2141
+ onClick: () => w(t._key),
2139
2142
  title: "Undo delete"
2140
- }) : /* @__PURE__ */ J(w, {
2143
+ }) : /* @__PURE__ */ J(v, {
2141
2144
  size: 32,
2142
2145
  icon: /* @__PURE__ */ J(e.trash, { size: 14 }),
2143
2146
  onClick: () => C(t._key),
@@ -2151,16 +2154,16 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2151
2154
  flexDirection: "column",
2152
2155
  gap: 12
2153
2156
  },
2154
- children: h.map((e) => {
2155
- 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 = {
2157
+ children: p.map((e) => {
2158
+ let r = n.fields.get(e), a = l?.includes(e), s = _.has(e), d = r ? A(r, e, i.entities) : e, f = `child-${t._key}-${e}`, p = `${f}-label`, m = {
2156
2159
  outline: a ? "1px solid var(--danger)" : "none",
2157
2160
  outlineOffset: 3,
2158
2161
  borderRadius: a ? 5 : 0
2159
- }, _ = {
2162
+ }, h = {
2160
2163
  fontSize: 11.5,
2161
2164
  fontWeight: 600,
2162
2165
  color: "var(--text-3)"
2163
- }, v = !o && !s && !!n;
2166
+ }, g = !o && !s && !!r;
2164
2167
  return /* @__PURE__ */ Y("div", {
2165
2168
  style: {
2166
2169
  display: "flex",
@@ -2170,40 +2173,40 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2170
2173
  textDecoration: o ? "line-through" : "none"
2171
2174
  },
2172
2175
  title: a ? `${e} is required` : void 0,
2173
- children: [v ? /* @__PURE__ */ J("label", {
2174
- id: h,
2175
- htmlFor: m,
2176
- style: _,
2177
- children: p
2176
+ children: [g ? /* @__PURE__ */ J("label", {
2177
+ id: p,
2178
+ htmlFor: f,
2179
+ style: h,
2180
+ children: d
2178
2181
  }) : /* @__PURE__ */ J("div", {
2179
- id: h,
2180
- style: _,
2181
- children: p
2182
+ id: p,
2183
+ style: h,
2184
+ children: d
2182
2185
  }), /* @__PURE__ */ J("div", {
2183
- style: g,
2184
- children: o || s ? n ? x({
2185
- field: n,
2186
+ style: m,
2187
+ children: o || s ? r ? S({
2188
+ field: r,
2186
2189
  fieldName: e,
2187
2190
  value: t[e],
2188
2191
  mode: "display",
2189
2192
  record: t,
2190
2193
  refs: c,
2191
- fieldId: m,
2192
- labelId: h,
2193
- locale: f
2194
- }) : l(t[e]) : n ? x({
2195
- field: n,
2194
+ fieldId: f,
2195
+ labelId: p,
2196
+ locale: u
2197
+ }) : M(t[e]) : r ? S({
2198
+ field: r,
2196
2199
  fieldName: e,
2197
2200
  value: t[e],
2198
2201
  mode: "edit",
2199
- onChange: (n) => b(t._key, e, n),
2202
+ onChange: (n) => y(t._key, e, n),
2200
2203
  record: t,
2201
2204
  refs: c,
2202
2205
  compact: !0,
2203
- fieldId: m,
2204
- labelId: h,
2205
- locale: f
2206
- }) : l(t[e])
2206
+ fieldId: f,
2207
+ labelId: p,
2208
+ locale: u
2209
+ }) : M(t[e])
2207
2210
  })]
2208
2211
  }, e);
2209
2212
  })
@@ -2212,51 +2215,51 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2212
2215
  })
2213
2216
  }), /* @__PURE__ */ J("div", {
2214
2217
  style: { marginTop: 10 },
2215
- children: /* @__PURE__ */ J(O, {
2218
+ children: /* @__PURE__ */ J(b, {
2216
2219
  kind: "ghost",
2217
2220
  size: "sm",
2218
2221
  icon: /* @__PURE__ */ J(e.plus, { size: 14 }),
2219
- onClick: S,
2222
+ onClick: x,
2220
2223
  children: "Add row"
2221
2224
  })
2222
2225
  })] }) : /* @__PURE__ */ Y("div", { children: [/* @__PURE__ */ J("div", {
2223
2226
  style: { overflowX: "auto" },
2224
2227
  children: /* @__PURE__ */ Y("table", {
2225
- ref: m,
2228
+ ref: f,
2226
2229
  style: fe,
2227
- onKeyDown: k,
2228
- children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [h.map((e) => {
2229
- let t = r.fields.get(e);
2230
+ onKeyDown: D,
2231
+ children: [/* @__PURE__ */ J("thead", { children: /* @__PURE__ */ Y("tr", { children: [p.map((e) => {
2232
+ let t = n.fields.get(e);
2230
2233
  return /* @__PURE__ */ J("th", {
2231
- style: A,
2232
- children: t ? d(t, e, i.entities) : e
2234
+ style: O,
2235
+ children: t ? A(t, e, i.entities) : e
2233
2236
  }, e);
2234
2237
  }), /* @__PURE__ */ J("th", { style: {
2235
- ...A,
2238
+ ...O,
2236
2239
  width: 40
2237
2240
  } })] }) }), /* @__PURE__ */ J("tbody", { children: a.map((t) => {
2238
- let n = !!t._deleted, i = s?.[t._key];
2241
+ let r = !!t._deleted, i = s?.[t._key];
2239
2242
  return /* @__PURE__ */ Y("tr", {
2240
- style: { opacity: n ? .5 : 1 },
2241
- children: [h.map((e) => {
2242
- let a = r.fields.get(e), o = i?.includes(e), s = y.has(e);
2243
- return n || s ? /* @__PURE__ */ J("td", {
2243
+ style: { opacity: r ? .5 : 1 },
2244
+ children: [p.map((e) => {
2245
+ let a = n.fields.get(e), o = i?.includes(e), s = _.has(e);
2246
+ return r || s ? /* @__PURE__ */ J("td", {
2244
2247
  style: {
2245
2248
  padding: "6px 12px",
2246
2249
  borderBottom: "1px solid var(--divider)",
2247
2250
  verticalAlign: "middle",
2248
- textDecoration: n ? "line-through" : "none",
2251
+ textDecoration: r ? "line-through" : "none",
2249
2252
  color: "var(--text-2)"
2250
2253
  },
2251
- children: a ? x({
2254
+ children: a ? S({
2252
2255
  field: a,
2253
2256
  fieldName: e,
2254
2257
  value: t[e],
2255
2258
  mode: "display",
2256
2259
  record: t,
2257
2260
  refs: c,
2258
- locale: f
2259
- }) : l(t[e])
2261
+ locale: u
2262
+ }) : M(t[e])
2260
2263
  }, e) : /* @__PURE__ */ J("td", {
2261
2264
  style: {
2262
2265
  padding: "4px 4px",
@@ -2267,17 +2270,17 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2267
2270
  borderRadius: o ? 4 : 0
2268
2271
  },
2269
2272
  title: o ? `${e} is required` : void 0,
2270
- children: a ? x({
2273
+ children: a ? S({
2271
2274
  field: a,
2272
2275
  fieldName: e,
2273
2276
  value: t[e],
2274
2277
  mode: "edit",
2275
- onChange: (n) => b(t._key, e, n),
2278
+ onChange: (n) => y(t._key, e, n),
2276
2279
  record: t,
2277
2280
  refs: c,
2278
2281
  compact: !0,
2279
- locale: f
2280
- }) : l(t[e])
2282
+ locale: u
2283
+ }) : M(t[e])
2281
2284
  }, e);
2282
2285
  }), /* @__PURE__ */ J("td", {
2283
2286
  style: {
@@ -2285,12 +2288,12 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2285
2288
  borderBottom: "1px solid var(--divider)",
2286
2289
  verticalAlign: "middle"
2287
2290
  },
2288
- children: n ? /* @__PURE__ */ J(w, {
2291
+ children: r ? /* @__PURE__ */ J(v, {
2289
2292
  size: 24,
2290
2293
  icon: /* @__PURE__ */ J(e.refresh, { size: 12 }),
2291
- onClick: () => T(t._key),
2294
+ onClick: () => w(t._key),
2292
2295
  title: "Undo delete"
2293
- }) : /* @__PURE__ */ J(w, {
2296
+ }) : /* @__PURE__ */ J(v, {
2294
2297
  size: 24,
2295
2298
  icon: /* @__PURE__ */ J(e.trash, { size: 12 }),
2296
2299
  onClick: () => C(t._key),
@@ -2302,20 +2305,20 @@ function Ot({ config: t, childEntity: r, schema: i, rows: a, onChange: o, valida
2302
2305
  })
2303
2306
  }), /* @__PURE__ */ J("div", {
2304
2307
  style: { marginTop: 8 },
2305
- children: /* @__PURE__ */ J(O, {
2308
+ children: /* @__PURE__ */ J(b, {
2306
2309
  kind: "ghost",
2307
2310
  size: "xs",
2308
2311
  icon: /* @__PURE__ */ J(e.plus, { size: 12 }),
2309
- onClick: S,
2312
+ onClick: x,
2310
2313
  children: "Add row"
2311
2314
  })
2312
2315
  })] });
2313
2316
  }
2314
2317
  //#endregion
2315
2318
  //#region src/components/detail-layout/ChildrenBlock.tsx
2316
- var kt = ge(() => import("./DraggableChildrenTable-p2ZSdwzj.js").then((e) => ({ default: e.DraggableChildrenTable })));
2319
+ var kt = ge(() => import("./DraggableChildrenTable-B98Md-Yq.js").then((e) => ({ default: e.DraggableChildrenTable })));
2317
2320
  function At({ node: e, ctx: n }) {
2318
- let r = D(), i = e.children;
2321
+ let r = T(), i = e.children;
2319
2322
  if (!i) return null;
2320
2323
  let a = r.isPhone && n.relatedRecordsPresentation === "table";
2321
2324
  if (n.isNew && n.mode !== "edit") return null;
@@ -2329,7 +2332,7 @@ function At({ node: e, ctx: n }) {
2329
2332
  className: "text-sm text-muted-foreground py-2",
2330
2333
  children: ["Entity not found: ", o.entity]
2331
2334
  });
2332
- let c = Pe(o, s, e), l = Ae(e, n), u = je(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(L, {
2335
+ let c = Pe(o, s, e), l = Ae(e, n), u = je(e, n), d = (e) => c.mode === "timeline" || n.withinCard ? e : /* @__PURE__ */ J(P, {
2333
2336
  title: l,
2334
2337
  icon: u ? /* @__PURE__ */ J(t, {
2335
2338
  name: u,
@@ -2337,10 +2340,10 @@ function At({ node: e, ctx: n }) {
2337
2340
  }) : void 0,
2338
2341
  children: e
2339
2342
  });
2340
- if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && v(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2343
+ if (n.mode === "edit" && c.editable && c.interaction !== "navigate" && c.interaction !== "readonly" && m(s, "update") && c.mode === "table" && n.pendingChildren !== void 0 && n.onChildrenChange) {
2341
2344
  let e = n.pendingChildren[i] ?? [], t = n.childValidationErrors?.[i], o = c.position_field ? r.isPhone && !a ? Ot : kt : Ot;
2342
2345
  return d(/* @__PURE__ */ J(me, {
2343
- fallback: /* @__PURE__ */ J(ee, {}),
2346
+ fallback: /* @__PURE__ */ J(ue, {}),
2344
2347
  children: /* @__PURE__ */ J(o, {
2345
2348
  config: c,
2346
2349
  childEntity: s,
@@ -2408,24 +2411,24 @@ function Rt({ columns: e = 2, children: t }) {
2408
2411
  });
2409
2412
  }
2410
2413
  function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: l = "display", htmlFor: u, labelId: d, labelTitle: f, "data-testid": p }) {
2411
- let h = _e(Lt), g = r || h.stackPairs, _ = !!a;
2414
+ let m = _e(Lt), h = r || m.stackPairs, _ = !!a;
2412
2415
  return /* @__PURE__ */ Y("div", {
2413
2416
  className: "detail-row",
2414
2417
  "data-error": _ || void 0,
2415
2418
  "data-testid": p,
2416
2419
  style: {
2417
2420
  display: "flex",
2418
- flexDirection: g ? "column" : "row",
2419
- gap: g ? 4 : 16,
2420
- alignItems: g ? "stretch" : "flex-start",
2421
+ flexDirection: h ? "column" : "row",
2422
+ gap: h ? 4 : 16,
2423
+ alignItems: h ? "stretch" : "flex-start",
2421
2424
  padding: "6px 0",
2422
2425
  ...r ? { gridColumn: "1 / -1" } : null
2423
2426
  },
2424
2427
  children: [/* @__PURE__ */ Y("div", {
2425
2428
  style: {
2426
- width: g ? "auto" : jt,
2429
+ width: h ? "auto" : jt,
2427
2430
  flexShrink: 0,
2428
- paddingTop: g ? 0 : Ft,
2431
+ paddingTop: h ? 0 : Ft,
2429
2432
  fontSize: 12,
2430
2433
  lineHeight: Pt,
2431
2434
  fontWeight: 500,
@@ -2474,7 +2477,7 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2474
2477
  lineHeight: Pt,
2475
2478
  color: "var(--text)",
2476
2479
  overflowWrap: "anywhere",
2477
- paddingTop: l === "display" && !g ? Ft : 0
2480
+ paddingTop: l === "display" && !h ? Ft : 0
2478
2481
  },
2479
2482
  children: _ && l === "edit" ? /* @__PURE__ */ J("div", {
2480
2483
  style: {
@@ -2491,7 +2494,7 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2491
2494
  flexShrink: 0,
2492
2495
  marginTop: -2
2493
2496
  },
2494
- children: [c && /* @__PURE__ */ J(m, {
2497
+ children: [c && /* @__PURE__ */ J(g, {
2495
2498
  value: c,
2496
2499
  size: "sm",
2497
2500
  title: "Copy value"
@@ -2514,66 +2517,66 @@ function zt({ label: t, children: n, span: r = !1, required: i, error: a, hint:
2514
2517
  //#endregion
2515
2518
  //#region src/components/detail-layout/FieldsBlock.tsx
2516
2519
  function Bt({ fields: e, ctx: t }) {
2517
- 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;
2520
+ let { entity: n, entityCode: i, record: o, mode: s, onFieldChange: c, schema: l } = t, u = r(), d = t.columns ?? 2, f = d === 1 && e.length === 1;
2518
2521
  return /* @__PURE__ */ J(Rt, {
2519
2522
  columns: d,
2520
2523
  children: e.map((e) => {
2521
- let n = e.name, d = `${i ?? "field"}-${n}`, m = `${d}-label`, h = r.fields.get(n), g = !!(h?.auto || h?.readonly || h?.source), _ = ne(r, n), v = _?.read === "denied", y = _?.write === "denied", b = o === "display" ? v : y || v, x = g || o === "edit" && y ? "display" : o, S = b ? /* @__PURE__ */ J(ue, {
2522
- tier: _.classification,
2523
- tierDef: B(c, r, n),
2524
- requiredPermission: _?.required_permission,
2524
+ let r = e.name, d = `${i ?? "field"}-${r}`, p = `${d}-label`, m = n.fields.get(r), h = !!(m?.auto || m?.readonly || m?.source), g = ie(n, r), _ = g?.read === "denied", v = g?.write === "denied", y = s === "display" ? _ : v || _, b = h || s === "edit" && v ? "display" : s, x = y ? /* @__PURE__ */ J(N, {
2525
+ tier: g.classification,
2526
+ tierDef: oe(l, n, r),
2527
+ requiredPermission: g?.required_permission,
2525
2528
  locale: u,
2526
- variant: x === "edit" ? "input" : "value"
2527
- }) : V({
2528
- entity: r,
2529
+ variant: b === "edit" ? "input" : "value"
2530
+ }) : le({
2531
+ entity: n,
2529
2532
  entityCode: i,
2530
- fieldName: n,
2531
- record: a,
2532
- mode: x,
2533
- onChange: s && !g ? (e) => s(n, e) : void 0,
2533
+ fieldName: r,
2534
+ record: o,
2535
+ mode: b,
2536
+ onChange: c && !h ? (e) => c(r, e) : void 0,
2534
2537
  refs: t.refs,
2535
- entities: c?.entities,
2536
- screens: c?.screens,
2538
+ entities: l?.entities,
2539
+ screens: l?.screens,
2537
2540
  locale: u,
2538
2541
  fieldId: d,
2539
- labelId: m,
2542
+ labelId: p,
2540
2543
  structure: e.structure
2541
2544
  });
2542
- if (!S) return null;
2543
- let C = o === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(z, {
2544
- actionCode: `${n}.action[${t}]`,
2545
+ if (!x) return null;
2546
+ let S = s === "display" && e.actions && e.actions.length > 0 ? /* @__PURE__ */ J(q, { children: e.actions.map((e, t) => /* @__PURE__ */ J(ee, {
2547
+ actionCode: `${r}.action[${t}]`,
2545
2548
  action: e,
2546
2549
  entityCode: i,
2547
- row: a,
2550
+ row: o,
2548
2551
  variant: "ghost",
2549
2552
  size: "icon"
2550
- }, t)) }) : void 0, w = !!h && It.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);
2551
- return p ? /* @__PURE__ */ Y("div", {
2553
+ }, t)) }) : void 0, C = !!m && It.has(m.type), w = o?.[r], T = b === "display" && (m?.copyable || m?.type === "uuid") && w != null && w !== "" ? M(w) : void 0, E = a(m?.display?.description);
2554
+ return f ? /* @__PURE__ */ Y("div", {
2552
2555
  style: { gridColumn: "1 / -1" },
2553
- children: [S, x === "edit" && D && /* @__PURE__ */ J("div", {
2556
+ children: [x, b === "edit" && E && /* @__PURE__ */ J("div", {
2554
2557
  style: {
2555
2558
  fontSize: 11.5,
2556
2559
  lineHeight: 1.4,
2557
2560
  color: "var(--text-3)",
2558
2561
  marginTop: 3
2559
2562
  },
2560
- children: D
2563
+ children: E
2561
2564
  })]
2562
- }, n) : /* @__PURE__ */ J(zt, {
2563
- "data-testid": `field-${n}`,
2564
- label: le(r, n, c.entities),
2565
- htmlFor: x === "edit" ? d : void 0,
2566
- labelId: m,
2567
- labelTitle: D || void 0,
2568
- required: h?.required ?? !1,
2569
- mode: x,
2570
- span: w,
2571
- error: t.fieldErrors?.[n],
2572
- hint: x === "edit" && D ? D : void 0,
2573
- actions: C,
2574
- copyValue: E,
2575
- children: S
2576
- }, n);
2565
+ }, r) : /* @__PURE__ */ J(zt, {
2566
+ "data-testid": `field-${r}`,
2567
+ label: ce(n, r, l.entities),
2568
+ htmlFor: b === "edit" ? d : void 0,
2569
+ labelId: p,
2570
+ labelTitle: E || void 0,
2571
+ required: m?.required ?? !1,
2572
+ mode: b,
2573
+ span: C,
2574
+ error: t.fieldErrors?.[r],
2575
+ hint: b === "edit" && E ? E : void 0,
2576
+ actions: S,
2577
+ copyValue: T,
2578
+ children: x
2579
+ }, r);
2577
2580
  })
2578
2581
  });
2579
2582
  }
@@ -2589,57 +2592,57 @@ var Vt = /* @__PURE__ */ new Set([
2589
2592
  "url"
2590
2593
  ]), Ht = 500;
2591
2594
  function Ut({ node: e, ctx: t }) {
2592
- let { entity: n, objectProperties: i, onSetProperty: a, isNew: o, mode: s, refs: c } = t, l = n.properties ?? {};
2593
- if (o) return null;
2594
- 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]]);
2595
+ let { entity: n, objectProperties: r, onSetProperty: i, isNew: a, mode: o, refs: s } = t, c = n.properties ?? {};
2596
+ if (a) return null;
2597
+ let l = e.properties === !0 || e.properties, d = l === !0 ? Object.entries(c).sort(([e], [t]) => e.localeCompare(t)) : l.filter((e) => c[e] != null).map((e) => [e, c[e]]);
2595
2598
  return d.length === 0 ? null : /* @__PURE__ */ J(Rt, {
2596
2599
  columns: 2,
2597
- children: d.map(([e, o]) => {
2598
- let l = i?.find((t) => t.property_code === e), u = r(o), d = o.readonly || !a ? "display" : s;
2600
+ children: d.map(([e, a]) => {
2601
+ let c = r?.find((t) => t.property_code === e), l = u(a), d = a.readonly || !i ? "display" : o;
2599
2602
  return /* @__PURE__ */ J(Wt, {
2600
2603
  propCode: e,
2601
- prop: o,
2602
- field: u,
2603
- value: l?.value,
2604
+ prop: a,
2605
+ field: l,
2606
+ value: c?.value,
2604
2607
  mode: d,
2605
- onSetProperty: a,
2606
- refs: c,
2608
+ onSetProperty: i,
2609
+ refs: s,
2607
2610
  entity: n,
2608
2611
  schema: t.schema
2609
2612
  }, e);
2610
2613
  })
2611
2614
  });
2612
2615
  }
2613
- function Wt({ propCode: e, prop: t, field: r, value: i, mode: a, onSetProperty: o, refs: s, entity: c, schema: l }) {
2614
- let u = n(), d = G(null);
2616
+ function Wt({ propCode: e, prop: t, field: n, value: i, mode: o, onSetProperty: s, refs: c, entity: l, schema: u }) {
2617
+ let d = r(), f = G(null);
2615
2618
  U(() => () => {
2616
- d.current && clearTimeout(d.current);
2619
+ f.current && clearTimeout(f.current);
2617
2620
  }, []);
2618
2621
  let p = H((n) => {
2619
- o && (Vt.has(t.type) ? (d.current && clearTimeout(d.current), d.current = setTimeout(() => o(e, n), Ht)) : o(e, n));
2622
+ s && (Vt.has(t.type) ? (f.current && clearTimeout(f.current), f.current = setTimeout(() => s(e, n), Ht)) : s(e, n));
2620
2623
  }, [
2621
2624
  e,
2622
2625
  t.type,
2623
- o
2624
- ]), m = ne(c, e), h = m?.read === "denied", g = m?.write === "denied", _ = a === "display" ? h : g || h, v = a === "edit" && g ? "display" : a;
2626
+ s
2627
+ ]), m = ie(l, e), h = m?.read === "denied", g = m?.write === "denied", _ = o === "display" ? h : g || h, v = o === "edit" && g ? "display" : o;
2625
2628
  return /* @__PURE__ */ J(zt, {
2626
- label: f(t.display?.name ?? t.name),
2629
+ label: a(t.display?.name ?? t.name),
2627
2630
  mode: v,
2628
2631
  span: It.has(t.type),
2629
- children: _ ? /* @__PURE__ */ J(ue, {
2632
+ children: _ ? /* @__PURE__ */ J(N, {
2630
2633
  tier: m.classification,
2631
- tierDef: B(l, c, e),
2634
+ tierDef: oe(u, l, e),
2632
2635
  requiredPermission: m?.required_permission,
2633
- locale: u,
2636
+ locale: d,
2634
2637
  variant: v === "edit" ? "input" : "value"
2635
- }) : x({
2636
- field: r,
2638
+ }) : S({
2639
+ field: n,
2637
2640
  fieldName: e,
2638
2641
  value: i,
2639
2642
  mode: v,
2640
2643
  onChange: v === "edit" ? p : void 0,
2641
- refs: s,
2642
- locale: u
2644
+ refs: c,
2645
+ locale: d
2643
2646
  })
2644
2647
  });
2645
2648
  }
@@ -2720,10 +2723,10 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2720
2723
  alignItems: "center",
2721
2724
  gap: 16
2722
2725
  },
2723
- children: Object.entries(e).map(([e, a]) => {
2724
- let o = t?.find((t) => t.group_code === e)?.status_code, s = o ? a.statuses.find((e) => e.code === o) : void 0;
2725
- if (a.display_mode === "stepper") {
2726
- 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;
2726
+ children: Object.entries(e).map(([e, o]) => {
2727
+ let s = t?.find((t) => t.group_code === e)?.status_code, l = s ? o.statuses.find((e) => e.code === s) : void 0;
2728
+ if (o.display_mode === "stepper") {
2729
+ let t = i === "edit", c = t ? o.transitions && s ? /* @__PURE__ */ new Set([s, ...o.transitions[s] ?? []]) : new Set(o.statuses.map((e) => e.code)) : void 0;
2727
2730
  return /* @__PURE__ */ Y("div", {
2728
2731
  style: {
2729
2732
  display: "flex",
@@ -2737,7 +2740,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2737
2740
  color: "var(--text-3)",
2738
2741
  flexShrink: 0
2739
2742
  },
2740
- children: [f(a.name), ":"]
2743
+ children: [a(o.name), ":"]
2741
2744
  }), /* @__PURE__ */ J("div", {
2742
2745
  style: {
2743
2746
  minWidth: 240,
@@ -2745,12 +2748,12 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2745
2748
  pointerEvents: r ? "none" : "auto"
2746
2749
  },
2747
2750
  children: /* @__PURE__ */ J(Gt, {
2748
- stages: a.statuses.map((e) => ({
2751
+ stages: o.statuses.map((e) => ({
2749
2752
  code: e.code,
2750
- label: f(e.name)
2753
+ label: a(e.name)
2751
2754
  })),
2752
- current: o,
2753
- selectable: s,
2755
+ current: s,
2756
+ selectable: c,
2754
2757
  onSelect: t ? (t) => n(e, t) : void 0,
2755
2758
  compact: !0
2756
2759
  })
@@ -2768,11 +2771,11 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2768
2771
  fontSize: 12,
2769
2772
  color: "var(--text-3)"
2770
2773
  },
2771
- children: [f(a.name), ":"]
2772
- }), s ? /* @__PURE__ */ J(y, {
2773
- tone: s.color ?? "slate",
2774
+ children: [a(o.name), ":"]
2775
+ }), l ? /* @__PURE__ */ J(O, {
2776
+ tone: l.color ?? "slate",
2774
2777
  size: "xs",
2775
- children: f(s.name)
2778
+ children: a(l.name)
2776
2779
  }) : /* @__PURE__ */ J("span", {
2777
2780
  style: {
2778
2781
  fontSize: 12.5,
@@ -2781,7 +2784,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2781
2784
  children: "—"
2782
2785
  })]
2783
2786
  }, e);
2784
- let l = (a.transitions && o ? a.statuses.filter((e) => e.code === o || (a.transitions[o]?.includes(e.code) ?? !1)) : a.statuses).map((e) => ({
2787
+ let u = (o.transitions && s ? o.statuses.filter((e) => e.code === s || (o.transitions[s]?.includes(e.code) ?? !1)) : o.statuses).map((e) => ({
2785
2788
  value: e.code,
2786
2789
  label: /* @__PURE__ */ Y("span", {
2787
2790
  style: {
@@ -2795,7 +2798,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2795
2798
  borderRadius: 999,
2796
2799
  background: `var(--pill-${e.color}, ${e.color})`,
2797
2800
  display: "inline-block"
2798
- } }), f(e.name)]
2801
+ } }), a(e.name)]
2799
2802
  })
2800
2803
  }));
2801
2804
  return /* @__PURE__ */ Y("div", {
@@ -2809,7 +2812,7 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2809
2812
  fontSize: 12,
2810
2813
  color: "var(--text-3)"
2811
2814
  },
2812
- children: [f(a.name), ":"]
2815
+ children: [a(o.name), ":"]
2813
2816
  }), /* @__PURE__ */ J("div", {
2814
2817
  style: {
2815
2818
  minWidth: 180,
@@ -2817,8 +2820,8 @@ function Kt({ statusGroups: e, objectStatuses: t, onSetStatus: n, isPending: r,
2817
2820
  pointerEvents: r ? "none" : "auto"
2818
2821
  },
2819
2822
  children: /* @__PURE__ */ J(c, {
2820
- value: o ?? "",
2821
- options: l,
2823
+ value: s ?? "",
2824
+ options: u,
2822
2825
  onChange: (t) => n(e, t),
2823
2826
  placeholder: "Select…"
2824
2827
  })
@@ -2943,7 +2946,7 @@ function on({ values: e, options: t }) {
2943
2946
  className: "h-[480px] w-full overflow-hidden rounded border",
2944
2947
  role: "group",
2945
2948
  "aria-label": Qt,
2946
- children: /* @__PURE__ */ J(ae, {
2949
+ children: /* @__PURE__ */ J(I, {
2947
2950
  fallback: /* @__PURE__ */ J(rn, {
2948
2951
  before: n,
2949
2952
  after: r
@@ -3074,83 +3077,83 @@ function dn(e, t) {
3074
3077
  return !t || Object.entries(t).every(([t, n]) => e[t] === n);
3075
3078
  }
3076
3079
  function fn({ values: e, options: t }) {
3077
- let r = W(() => cn(t), [t]), i = n(), a = re(), o = e.scope, s = r?.windows.some((e) => e.code === r.default_window) ? r.default_window : r?.windows[0]?.code ?? "", [c, l] = K(s), [u, d] = K("");
3080
+ let n = W(() => cn(t), [t]), i = r(), o = ne(), s = e.scope, c = n?.windows.some((e) => e.code === n.default_window) ? n.default_window : n?.windows[0]?.code ?? "", [l, u] = K(c), [d, f] = K("");
3078
3081
  U(() => {
3079
- l(s);
3080
- }, [s]), U(() => {
3081
- d("");
3082
- }, [c]);
3083
- let m = r ? [{
3084
- field: r.scope_field,
3082
+ u(c);
3083
+ }, [c]), U(() => {
3084
+ f("");
3085
+ }, [l]);
3086
+ let p = n ? [{
3087
+ field: n.scope_field,
3085
3088
  op: "eq",
3086
- value: o
3089
+ value: s
3087
3090
  }, {
3088
- field: r.window_field,
3091
+ field: n.window_field,
3089
3092
  op: "eq",
3090
- value: c
3091
- }] : [], h = p(r?.entity, {
3093
+ value: l
3094
+ }] : [], m = h(n?.entity, {
3092
3095
  per_page: 1,
3093
- filters: m
3094
- }, !!(r && o && c)), g = r?.breakdown, _ = g ? [{
3096
+ filters: p
3097
+ }, !!(n && s && l)), g = n?.breakdown, _ = g ? [{
3095
3098
  field: g.scope_field,
3096
3099
  op: "eq",
3097
- value: o
3100
+ value: s
3098
3101
  }, {
3099
3102
  field: g.window_field,
3100
3103
  op: "eq",
3101
- value: c
3102
- }] : [], v = p(g?.entity, {
3104
+ value: l
3105
+ }] : [], v = h(g?.entity, {
3103
3106
  per_page: g?.limit ?? 200,
3104
3107
  sort: g?.sort,
3105
3108
  filters: _
3106
- }, !!(g && o && c));
3107
- if (!r || !o) return /* @__PURE__ */ J("div", {
3109
+ }, !!(g && s && l));
3110
+ if (!n || !s) return /* @__PURE__ */ J("div", {
3108
3111
  role: "alert",
3109
3112
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3110
3113
  children: "Invalid entity_scorecard configuration."
3111
3114
  });
3112
- 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 && dn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3113
- let t = r.drillthrough;
3115
+ 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 = d && g?.filter_field ? b.filter((e) => e[g.filter_field] === d) : b, C = (e) => !d || !e.filtered || !g?.filter_field ? y?.[e.field] : b.find((t) => t[g.filter_field] === d && dn(t, e.filtered?.where))?.[e.filtered.field], w = (e) => {
3116
+ let t = n.drillthrough;
3114
3117
  if (!t || !e.drillthrough_value) return;
3115
- let n = [{
3118
+ let r = [{
3116
3119
  field: t.scope_field,
3117
3120
  op: "eq",
3118
- value: o
3121
+ value: s
3119
3122
  }, {
3120
3123
  field: t.window_field,
3121
3124
  op: "eq",
3122
- value: c
3125
+ value: l
3123
3126
  }];
3124
- t.filter_field && u && e.drillthrough_filter !== !1 && n.push({
3127
+ t.filter_field && d && e.drillthrough_filter !== !1 && r.push({
3125
3128
  field: t.filter_field,
3126
3129
  op: "eq",
3127
- value: u
3128
- }), t.metric_field && n.push({
3130
+ value: d
3131
+ }), t.metric_field && r.push({
3129
3132
  field: t.metric_field,
3130
3133
  op: "eq",
3131
3134
  value: e.drillthrough_value
3132
- }), a(t.route, { search: new URLSearchParams({ filters: JSON.stringify(n) }).toString() });
3133
- }, T = h.error ?? v.error;
3135
+ }), o(t.route, { search: new URLSearchParams({ filters: JSON.stringify(r) }).toString() });
3136
+ }, T = m.error ?? v.error;
3134
3137
  return /* @__PURE__ */ Y("div", {
3135
3138
  className: "flex min-w-0 flex-col gap-4",
3136
- "aria-label": f(r.title, i) || "Scorecard",
3139
+ "aria-label": a(n.title, i) || "Scorecard",
3137
3140
  children: [
3138
3141
  /* @__PURE__ */ Y("div", {
3139
3142
  className: "flex flex-wrap items-start justify-between gap-3",
3140
3143
  children: [/* @__PURE__ */ Y("div", {
3141
3144
  className: "min-w-0",
3142
3145
  children: [
3143
- r.title && /* @__PURE__ */ J("h3", {
3146
+ n.title && /* @__PURE__ */ J("h3", {
3144
3147
  className: "text-base font-semibold text-foreground",
3145
- children: f(r.title, i)
3148
+ children: a(n.title, i)
3146
3149
  }),
3147
- r.description && /* @__PURE__ */ J("p", {
3150
+ n.description && /* @__PURE__ */ J("p", {
3148
3151
  className: "mt-1 text-sm text-muted-foreground",
3149
- children: f(r.description, i)
3152
+ children: a(n.description, i)
3150
3153
  }),
3151
- r.intended_note && /* @__PURE__ */ J("p", {
3154
+ n.intended_note && /* @__PURE__ */ J("p", {
3152
3155
  className: "mt-1 text-xs text-muted-foreground",
3153
- children: f(r.intended_note, i)
3156
+ children: a(n.intended_note, i)
3154
3157
  })
3155
3158
  ]
3156
3159
  }), /* @__PURE__ */ Y("div", {
@@ -3159,23 +3162,23 @@ function fn({ values: e, options: t }) {
3159
3162
  role: "group",
3160
3163
  "aria-label": "Scorecard window",
3161
3164
  className: "inline-flex rounded border border-border p-1",
3162
- children: r.windows.map((e) => /* @__PURE__ */ J("button", {
3165
+ children: n.windows.map((e) => /* @__PURE__ */ J("button", {
3163
3166
  type: "button",
3164
- "aria-pressed": c === e.code,
3165
- onClick: () => l(e.code),
3166
- className: `rounded px-3 py-1.5 text-xs font-medium ${c === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3167
- children: f(e.label, i) || e.code
3167
+ "aria-pressed": l === e.code,
3168
+ onClick: () => u(e.code),
3169
+ className: `rounded px-3 py-1.5 text-xs font-medium ${l === e.code ? "bg-accent text-accent-foreground" : "text-muted-foreground"}`,
3170
+ children: a(e.label, i) || e.code
3168
3171
  }, e.code))
3169
3172
  }), g?.filter_field && /* @__PURE__ */ Y("label", {
3170
3173
  className: "flex items-center gap-2 text-xs text-muted-foreground",
3171
- children: [f(g.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3172
- "aria-label": f(g.filter_label, i) || "Filter",
3173
- value: u,
3174
- onChange: (e) => d(e.target.value),
3174
+ children: [a(g.filter_label, i) || "Filter", /* @__PURE__ */ Y("select", {
3175
+ "aria-label": a(g.filter_label, i) || "Filter",
3176
+ value: d,
3177
+ onChange: (e) => f(e.target.value),
3175
3178
  className: "rounded border border-border bg-background px-2 py-1.5 text-foreground",
3176
3179
  children: [/* @__PURE__ */ J("option", {
3177
3180
  value: "",
3178
- children: f(g.all_label, i) || "All"
3181
+ children: a(g.all_label, i) || "All"
3179
3182
  }), x.map((e) => /* @__PURE__ */ J("option", {
3180
3183
  value: e,
3181
3184
  children: e
@@ -3189,17 +3192,17 @@ function fn({ values: e, options: t }) {
3189
3192
  className: "rounded border border-destructive p-3 text-sm text-destructive",
3190
3193
  children: T instanceof Error ? T.message : "Scorecard data could not be loaded."
3191
3194
  }),
3192
- !T && !h.isLoading && !y && /* @__PURE__ */ J("div", {
3195
+ !T && !m.isLoading && !y && /* @__PURE__ */ J("div", {
3193
3196
  className: "rounded border border-border p-6 text-center text-sm text-muted-foreground",
3194
- children: f(r.empty_label, i) || "No scorecard data."
3197
+ children: a(n.empty_label, i) || "No scorecard data."
3195
3198
  }),
3196
3199
  y && /* @__PURE__ */ J("div", {
3197
3200
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
3198
- children: r.metrics.map((e) => {
3199
- let t = C(e), n = !!(r.drillthrough && e.drillthrough_value), a = /* @__PURE__ */ Y(q, { children: [
3201
+ children: n.metrics.map((e) => {
3202
+ let t = C(e), r = !!(n.drillthrough && e.drillthrough_value), o = /* @__PURE__ */ Y(q, { children: [
3200
3203
  /* @__PURE__ */ J("span", {
3201
3204
  className: "text-xs font-medium text-muted-foreground",
3202
- children: f(e.label, i) || e.field
3205
+ children: a(e.label, i) || e.field
3203
3206
  }),
3204
3207
  /* @__PURE__ */ J("strong", {
3205
3208
  className: `mt-2 block text-2xl font-semibold ${e.attention && Number(t) > 0 ? "text-destructive" : "text-foreground"}`,
@@ -3207,17 +3210,17 @@ function fn({ values: e, options: t }) {
3207
3210
  }),
3208
3211
  e.help && /* @__PURE__ */ J("span", {
3209
3212
  className: "mt-1 block text-xs text-muted-foreground",
3210
- children: f(e.help, i)
3213
+ children: a(e.help, i)
3211
3214
  })
3212
3215
  ] });
3213
- return n ? /* @__PURE__ */ J("button", {
3216
+ return r ? /* @__PURE__ */ J("button", {
3214
3217
  type: "button",
3215
3218
  onClick: () => w(e),
3216
3219
  className: "rounded border border-border bg-card p-3 text-left hover:bg-surface",
3217
- children: a
3220
+ children: o
3218
3221
  }, e.field) : /* @__PURE__ */ J("article", {
3219
3222
  className: "rounded border border-border bg-card p-3",
3220
- children: a
3223
+ children: o
3221
3224
  }, e.field);
3222
3225
  })
3223
3226
  }),
@@ -3229,7 +3232,7 @@ function fn({ values: e, options: t }) {
3229
3232
  className: "bg-surface text-left text-xs text-muted-foreground",
3230
3233
  children: /* @__PURE__ */ J("tr", { children: g.columns.map((e) => /* @__PURE__ */ J("th", {
3231
3234
  className: "border-b border-divider px-3 py-2 font-medium",
3232
- children: f(e.label, i) || e.field
3235
+ children: a(e.label, i) || e.field
3233
3236
  }, e.field)) })
3234
3237
  }), /* @__PURE__ */ Y("tbody", { children: [S.map((e, t) => /* @__PURE__ */ J("tr", {
3235
3238
  className: "border-b border-divider last:border-0",
@@ -3240,7 +3243,7 @@ function fn({ values: e, options: t }) {
3240
3243
  }, un(e, t))), !v.isLoading && S.length === 0 && /* @__PURE__ */ J("tr", { children: /* @__PURE__ */ J("td", {
3241
3244
  colSpan: Math.max(1, g.columns.length),
3242
3245
  className: "px-3 py-6 text-center text-muted-foreground",
3243
- children: f(g.empty_label, i) || "No breakdown rows."
3246
+ children: a(g.empty_label, i) || "No breakdown rows."
3244
3247
  }) })] })]
3245
3248
  })
3246
3249
  })
@@ -3251,13 +3254,13 @@ function fn({ values: e, options: t }) {
3251
3254
  //#region src/components/detail-layout/widgets/builtins.ts
3252
3255
  var pn = !1;
3253
3256
  function mn() {
3254
- pn ||= (se("json_diff", on), se("entity_scorecard", fn), !0);
3257
+ pn ||= (L("json_diff", on), L("entity_scorecard", fn), !0);
3255
3258
  }
3256
3259
  //#endregion
3257
3260
  //#region src/components/detail-layout/widgets/WidgetHost.tsx
3258
3261
  mn();
3259
3262
  function hn({ config: e, ctx: t }) {
3260
- let n = ce(e.type);
3263
+ let n = z(e.type);
3261
3264
  if (!n) return /* @__PURE__ */ J("span", {
3262
3265
  className: "text-sm text-muted-foreground",
3263
3266
  children: `unknown widget: ${e.type}`
@@ -3305,7 +3308,7 @@ function $({ node: e, ctx: t }) {
3305
3308
  }) : e.children ? /* @__PURE__ */ J(At, {
3306
3309
  node: e,
3307
3310
  ctx: t
3308
- }) : e.associated ? /* @__PURE__ */ J(ie, {
3311
+ }) : e.associated ? /* @__PURE__ */ J(R, {
3309
3312
  node: e,
3310
3313
  ctx: t
3311
3314
  }) : e.fields ? /* @__PURE__ */ J(Bt, {