@nivaro/react 0.3.9 → 0.3.11

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 (80) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +103 -4
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1632 -1564
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +4386 -4142
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +527 -479
  15. package/dist/shared/components/QueryStatStrip.js +74 -70
  16. package/dist/shared/components/RecordGridEditor.js +76 -75
  17. package/dist/shared/components/ReportView.js +818 -827
  18. package/dist/shared/components/SheetHeaderBody.js +16 -14
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/SlashCommands.js +30 -29
  24. package/dist/shared/components/chat/chat-outbox.js +76 -75
  25. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  26. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  27. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  28. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  31. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  32. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  33. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  34. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  35. package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
  36. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  37. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  38. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  39. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  40. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  41. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  42. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  43. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  44. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  45. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  46. package/dist/shared/components/item-edit/helpers.js +133 -134
  47. package/dist/shared/components/item-edit/line-qty.js +57 -0
  48. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  49. package/dist/shared/components/item-edit/staged-links.js +86 -0
  50. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  51. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  52. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  53. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  54. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  55. package/dist/shared/components/panels/CommentPanel.js +350 -315
  56. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  57. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  58. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  59. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  60. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  61. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  62. package/dist/shared/components/queue/QueueWorklist.js +1026 -957
  63. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  64. package/dist/shared/lib/client-version.js +63 -0
  65. package/dist/shared/lib/force-reload.js +36 -0
  66. package/dist/shared/lib/load-error.js +11 -10
  67. package/dist/shared/lib/obligation-banner.js +14 -13
  68. package/dist/shared/lib/obligation-reason-text.js +13 -0
  69. package/dist/shared/lib/presence-live.js +54 -35
  70. package/dist/shared/lib/query-filter-seed.js +34 -11
  71. package/dist/shared/lib/record-outbox.js +76 -75
  72. package/dist/shared/lib/safe-error.js +39 -0
  73. package/dist/shared/lib/sanitize-html.js +24 -15
  74. package/dist/shared/lib/server-clock.js +11 -7
  75. package/dist/shared/lib/sheet-def.js +38 -22
  76. package/dist/shared/lib/unique-options.js +10 -0
  77. package/dist/shared/lib/unsaved-work.js +62 -0
  78. package/dist/shared/lib/utils.js +57 -43
  79. package/dist/shared/lib/validation-rules.js +58 -34
  80. package/package.json +1 -1
@@ -1,22 +1,24 @@
1
- import { jsx as t, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
- import { useQuery as D, useQueryClient as We } from "@tanstack/react-query";
3
- import { useState as j, useEffect as Z, useRef as ee, useMemo as Oe, useCallback as Te } from "react";
4
- import { createPortal as Me } from "react-dom";
5
- import { useNivaroClient as z, useDrilldown as ye, useOverlayState as Ae, DrilldownContext as Pe, useItemNavigation as Fe } from "../context.js";
6
- import { get as ve, post as V } from "../lib/commands.js";
7
- import { initialFilterSelection as Ee } from "../lib/query-filter-seed.js";
8
- import { resolveSheetDef as Be } from "../lib/sheet-def.js";
9
- import { useMyScopes as Le, matchScopeDimension as fe, effectiveScopeSeedIds as Ie, translateScopeValues as Qe } from "../lib/use-my-scopes.js";
10
- import { titleCase as E, formatRelative as De, formatNumber as ze } from "../lib/utils.js";
11
- import { CacheStamp as Ke } from "./CacheStamp.js";
12
- import { RelationCombobox as Ge } from "./item-edit/RelationCombobox.js";
13
- import { MatrixEditor as te } from "./MatrixEditor.js";
14
- import { QueryStatStrip as Ve } from "./QueryStatStrip.js";
15
- import { QueryTable as He } from "./QueryTable.js";
16
- import { RecordDrilldownSheet as Ue } from "./RecordDrilldownSheet.js";
17
- import { RecordGridEditor as be } from "./RecordGridEditor.js";
18
- import { SheetHeaderBody as Ye } from "./SheetHeaderBody.js";
19
- const J = 76;
1
+ import { jsx as t, jsxs as p, Fragment as E } from "react/jsx-runtime";
2
+ import { useQuery as Q, useQueryClient as Ae } from "@tanstack/react-query";
3
+ import { useState as q, useEffect as ee, useRef as te, useMemo as Pe, useCallback as Fe } from "react";
4
+ import { createPortal as Be } from "react-dom";
5
+ import { useNivaroClient as D, useDrilldown as ke, useOverlayState as Ee, DrilldownContext as Le, useItemNavigation as Ie } from "../context.js";
6
+ import { get as we, post as U } from "../lib/commands.js";
7
+ import { explicitAllUrlParams as Qe, initialFilterSelection as De, filterSelectionToSearch as ze } from "../lib/query-filter-seed.js";
8
+ import { uniqueByValue as Ke } from "../lib/unique-options.js";
9
+ import { userErrorMessage as Ne } from "../lib/safe-error.js";
10
+ import { resolveSheetDef as Ve } from "../lib/sheet-def.js";
11
+ import { useMyScopes as Ge, matchScopeDimension as ge, effectiveScopeSeedIds as Ue, translateScopeValues as He } from "../lib/use-my-scopes.js";
12
+ import { titleCase as L, formatRelative as Ye, formatNumber as Je } from "../lib/utils.js";
13
+ import { CacheStamp as Xe } from "./CacheStamp.js";
14
+ import { RelationCombobox as Ze } from "./item-edit/RelationCombobox.js";
15
+ import { MatrixEditor as re } from "./MatrixEditor.js";
16
+ import { QueryStatStrip as et } from "./QueryStatStrip.js";
17
+ import { QueryTable as tt } from "./QueryTable.js";
18
+ import { RecordDrilldownSheet as rt } from "./RecordDrilldownSheet.js";
19
+ import { RecordGridEditor as ye } from "./RecordGridEditor.js";
20
+ import { SheetHeaderBody as at } from "./SheetHeaderBody.js";
21
+ const X = 76;
20
22
  function H() {
21
23
  return /* @__PURE__ */ t("div", { className: "space-y-1.5 p-3", children: [1, 2, 3].map((e) => /* @__PURE__ */ t(
22
24
  "div",
@@ -26,155 +28,155 @@ function H() {
26
28
  e
27
29
  )) });
28
30
  }
29
- function U({ error: e }) {
30
- const r = e instanceof Error ? e.message : "Failed to load widget data";
31
+ function Y({ error: e }) {
32
+ const r = Ne(e, "Failed to load widget data");
31
33
  return /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-3 text-[12px] text-amber-600 dark:text-amber-500", children: r });
32
34
  }
33
- function Je(e) {
35
+ function lt(e) {
34
36
  if (e == null) return "—";
35
37
  if (typeof e == "boolean") return e ? "true" : "false";
36
38
  const r = String(e);
37
39
  return r.length > 80 ? `${r.slice(0, 80)}…` : r;
38
40
  }
39
- function X(e, r) {
40
- const l = [], n = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
41
- return e.split(n).forEach((s, m) => {
42
- const i = `${r}-${m}`;
43
- if (s)
44
- if (s.startsWith("**") && s.endsWith("**"))
45
- l.push(/* @__PURE__ */ t("strong", { children: s.slice(2, -2) }, i));
46
- else if (s.startsWith("*") && s.endsWith("*") && s.length > 2)
47
- l.push(/* @__PURE__ */ t("em", { children: s.slice(1, -1) }, i));
48
- else if (s.startsWith("`") && s.endsWith("`"))
49
- l.push(
41
+ function Z(e, r) {
42
+ const a = [], n = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
43
+ return e.split(n).forEach((i, m) => {
44
+ const s = `${r}-${m}`;
45
+ if (i)
46
+ if (i.startsWith("**") && i.endsWith("**"))
47
+ a.push(/* @__PURE__ */ t("strong", { children: i.slice(2, -2) }, s));
48
+ else if (i.startsWith("*") && i.endsWith("*") && i.length > 2)
49
+ a.push(/* @__PURE__ */ t("em", { children: i.slice(1, -1) }, s));
50
+ else if (i.startsWith("`") && i.endsWith("`"))
51
+ a.push(
50
52
  /* @__PURE__ */ t(
51
53
  "code",
52
54
  {
53
55
  className: "rounded bg-slate-100 px-1 py-0.5 font-mono text-[0.9em] dark:bg-muted",
54
- children: s.slice(1, -1)
56
+ children: i.slice(1, -1)
55
57
  },
56
- i
58
+ s
57
59
  )
58
60
  );
59
61
  else {
60
- const a = s.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
61
- a && (/^https?:\/\//i.test(a[2]) || a[2].startsWith("/")) ? l.push(
62
- /* @__PURE__ */ t("a", { href: a[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: a[1] }, i)
63
- ) : l.push(s);
62
+ const l = i.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
63
+ l && (/^https?:\/\//i.test(l[2]) || l[2].startsWith("/")) ? a.push(
64
+ /* @__PURE__ */ t("a", { href: l[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: l[1] }, s)
65
+ ) : a.push(i);
64
66
  }
65
- }), l;
67
+ }), a;
66
68
  }
67
- function Xe({ content: e }) {
69
+ function nt({ content: e }) {
68
70
  const r = [];
69
- let l = [], n = [], s = !1;
70
- const m = (a) => {
71
- l.length && (r.push(
72
- /* @__PURE__ */ t("p", { className: "leading-relaxed", children: X(l.join(" "), a) }, a)
73
- ), l = []);
74
- }, i = (a) => {
71
+ let a = [], n = [], i = !1;
72
+ const m = (l) => {
73
+ a.length && (r.push(
74
+ /* @__PURE__ */ t("p", { className: "leading-relaxed", children: Z(a.join(" "), l) }, l)
75
+ ), a = []);
76
+ }, s = (l) => {
75
77
  if (!n.length) return;
76
- const d = n.map((u, x) => /* @__PURE__ */ t("li", { children: X(u, `${a}-${x}`) }, `${a}-${x}`));
78
+ const o = n.map((u, x) => /* @__PURE__ */ t("li", { children: Z(u, `${l}-${x}`) }, `${l}-${x}`));
77
79
  r.push(
78
- s ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: d }, a) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: d }, a)
80
+ i ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: o }, l) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: o }, l)
79
81
  ), n = [];
80
82
  };
81
83
  return e.split(`
82
- `).forEach((a, d) => {
83
- const u = `md-${d}`, x = a.match(/^(#{1,3})\s+(.*)$/), f = a.match(/^[-*]\s+(.*)$/), w = a.match(/^\d+\.\s+(.*)$/);
84
+ `).forEach((l, o) => {
85
+ const u = `md-${o}`, x = l.match(/^(#{1,3})\s+(.*)$/), b = l.match(/^[-*]\s+(.*)$/), N = l.match(/^\d+\.\s+(.*)$/);
84
86
  if (x) {
85
- i(`${u}-fl`), m(`${u}-fp`);
86
- const g = x[1].length, _ = g === 1 ? "text-[17px] font-semibold" : g === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
87
+ s(`${u}-fl`), m(`${u}-fp`);
88
+ const S = x[1].length, W = S === 1 ? "text-[17px] font-semibold" : S === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
87
89
  r.push(
88
- /* @__PURE__ */ t("div", { className: `${_} text-slate-900 dark:text-slate-100`, children: X(x[2], `${u}-h`) }, u)
90
+ /* @__PURE__ */ t("div", { className: `${W} text-slate-900 dark:text-slate-100`, children: Z(x[2], `${u}-h`) }, u)
89
91
  );
90
- } else if (f || w) {
92
+ } else if (b || N) {
91
93
  m(`${u}-fp`);
92
- const g = !!w;
93
- n.length && s !== g && i(`${u}-fl`), s = g, n.push((f == null ? void 0 : f[1]) ?? (w == null ? void 0 : w[1]));
94
- } else a.trim() === "" ? (i(`${u}-fl`), m(`${u}-fp`)) : (i(`${u}-fl`), l.push(a.trim()));
95
- }), i("md-end-l"), m("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
94
+ const S = !!N;
95
+ n.length && i !== S && s(`${u}-fl`), i = S, n.push((b == null ? void 0 : b[1]) ?? (N == null ? void 0 : N[1]));
96
+ } else l.trim() === "" ? (s(`${u}-fl`), m(`${u}-fp`)) : (s(`${u}-fl`), a.push(l.trim()));
97
+ }), s("md-end-l"), m("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
96
98
  }
97
- function re(e, r, l) {
98
- const n = z();
99
- return D({
99
+ function ae(e, r, a) {
100
+ const n = D();
101
+ return Q({
100
102
  queryKey: ["page-renderer-widget-data", e, r.id],
101
- queryFn: () => n.request(V(`/pages/${e}/widget-data`, { widget_id: r.id })).then((s) => s.data),
102
- enabled: l,
103
+ queryFn: () => n.request(U(`/pages/${e}/widget-data`, { widget_id: r.id })).then((i) => i.data),
104
+ enabled: a,
103
105
  retry: !1,
104
106
  staleTime: 3e4
105
107
  });
106
108
  }
107
- function Ze({ slug: e, widget: r }) {
109
+ function st({ slug: e, widget: r }) {
108
110
  var u;
109
- const l = r.config ?? {}, { data: n, isLoading: s, error: m } = re(e, r, !!l.collection), i = Fe();
110
- if (!l.collection)
111
+ const a = r.config ?? {}, { data: n, isLoading: i, error: m } = ae(e, r, !!a.collection), s = Ie();
112
+ if (!a.collection)
111
113
  return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
112
- if (s) return /* @__PURE__ */ t(H, {});
113
- if (m) return /* @__PURE__ */ t(U, { error: m });
114
- const a = (n == null ? void 0 : n.rows) ?? [];
115
- if (!a.length) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No records" });
116
- const d = (u = l.columns) != null && u.length ? l.columns : Object.keys(a[0]).filter((x) => {
117
- const f = a[0][x];
118
- return f === null || ["string", "number", "boolean"].includes(typeof f);
114
+ if (i) return /* @__PURE__ */ t(H, {});
115
+ if (m) return /* @__PURE__ */ t(Y, { error: m });
116
+ const l = (n == null ? void 0 : n.rows) ?? [];
117
+ if (!l.length) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No records" });
118
+ const o = (u = a.columns) != null && u.length ? a.columns : Object.keys(l[0]).filter((x) => {
119
+ const b = l[0][x];
120
+ return b === null || ["string", "number", "boolean"].includes(typeof b);
119
121
  }).slice(0, 5);
120
122
  return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ p("table", { className: "w-full text-[12px]", children: [
121
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children: d.map((x) => /* @__PURE__ */ t(
123
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children: o.map((x) => /* @__PURE__ */ t(
122
124
  "th",
123
125
  {
124
126
  className: "whitespace-nowrap px-3 py-1.5 text-left font-medium text-slate-400",
125
- children: E(x)
127
+ children: L(x)
126
128
  },
127
129
  x
128
130
  )) }) }),
129
- /* @__PURE__ */ t("tbody", { children: a.map((x, f) => /* @__PURE__ */ t(
131
+ /* @__PURE__ */ t("tbody", { children: l.map((x, b) => /* @__PURE__ */ t(
130
132
  "tr",
131
133
  {
132
- onClick: x.id != null ? () => i.open({ collection: l.collection, itemId: String(x.id) }) : void 0,
134
+ onClick: x.id != null ? () => s.open({ collection: a.collection, itemId: String(x.id) }) : void 0,
133
135
  className: `border-b border-slate-50 last:border-0 dark:border-border/50 ${x.id != null ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40" : ""}`,
134
- children: d.map((w) => /* @__PURE__ */ t(
136
+ children: o.map((N) => /* @__PURE__ */ t(
135
137
  "td",
136
138
  {
137
139
  className: "whitespace-nowrap px-3 py-1.5 text-slate-700 dark:text-slate-300",
138
- children: Je(x[w])
140
+ children: lt(x[N])
139
141
  },
140
- w
142
+ N
141
143
  ))
142
144
  },
143
- x.id != null ? `${x.id}-${f}` : f
145
+ x.id != null ? `${x.id}-${b}` : b
144
146
  )) })
145
147
  ] }) });
146
148
  }
147
- function et({ slug: e, widget: r }) {
148
- const l = r.config ?? {}, { data: n, isLoading: s, error: m } = re(e, r, !!l.collection);
149
- return l.collection ? m ? /* @__PURE__ */ t(U, { error: m }) : /* @__PURE__ */ p("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
150
- s ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (n == null ? void 0 : n.value) != null ? ze(Number(n.value)) : "—" }),
151
- /* @__PURE__ */ t("span", { className: "mt-1.5 text-[12px] text-slate-400", children: l.label || `${l.aggregate ?? "count"} of ${l.collection}` })
149
+ function it({ slug: e, widget: r }) {
150
+ const a = r.config ?? {}, { data: n, isLoading: i, error: m } = ae(e, r, !!a.collection);
151
+ return a.collection ? m ? /* @__PURE__ */ t(Y, { error: m }) : /* @__PURE__ */ p("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
152
+ i ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (n == null ? void 0 : n.value) != null ? Je(Number(n.value)) : "—" }),
153
+ /* @__PURE__ */ t("span", { className: "mt-1.5 text-[12px] text-slate-400", children: a.label || `${a.aggregate ?? "count"} of ${a.collection}` })
152
154
  ] }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
153
155
  }
154
- function tt({ slug: e, widget: r }) {
155
- const { data: l, isLoading: n, error: s } = re(e, r, !0);
156
+ function ot({ slug: e, widget: r }) {
157
+ const { data: a, isLoading: n, error: i } = ae(e, r, !0);
156
158
  if (n) return /* @__PURE__ */ t(H, {});
157
- if (s) return /* @__PURE__ */ t(U, { error: s });
158
- const m = (l == null ? void 0 : l.rows) ?? [];
159
- return m.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: m.map((i) => /* @__PURE__ */ p(
159
+ if (i) return /* @__PURE__ */ t(Y, { error: i });
160
+ const m = (a == null ? void 0 : a.rows) ?? [];
161
+ return m.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: m.map((s) => /* @__PURE__ */ p(
160
162
  "div",
161
163
  {
162
164
  className: "flex items-center gap-2 border-b border-slate-50 py-1.5 text-[12px] last:border-0 dark:border-border/50",
163
165
  children: [
164
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: i.action }),
165
- i.collection && /* @__PURE__ */ p("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
166
- i.collection,
167
- i.item ? ` · ${i.item}` : ""
166
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: s.action }),
167
+ s.collection && /* @__PURE__ */ p("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
168
+ s.collection,
169
+ s.item ? ` · ${s.item}` : ""
168
170
  ] }),
169
- /* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: De(i.timestamp) })
171
+ /* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: Ye(s.timestamp) })
170
172
  ]
171
173
  },
172
- i.id
174
+ s.id
173
175
  )) }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No activity" });
174
176
  }
175
- function rt({ widget: e }) {
176
- var l;
177
- const r = String(((l = e.config) == null ? void 0 : l.url) ?? "");
177
+ function dt({ widget: e }) {
178
+ var a;
179
+ const r = String(((a = e.config) == null ? void 0 : a.url) ?? "");
178
180
  return r ? /^https?:\/\//i.test(r) ? /* @__PURE__ */ t(
179
181
  "iframe",
180
182
  {
@@ -185,20 +187,20 @@ function rt({ widget: e }) {
185
187
  }
186
188
  ) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-amber-600", children: "URL must start with http(s)://" }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set an iframe URL" });
187
189
  }
188
- function ke({
190
+ function $e({
189
191
  config: e,
190
192
  initialScope: r,
191
- width: l,
193
+ width: a,
192
194
  title: n,
193
- onClose: s
195
+ onClose: i
194
196
  }) {
195
- const m = typeof l == "number" ? `${l}px` : l ?? "85%";
196
- return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: s, children: /* @__PURE__ */ p(
197
+ const m = typeof a == "number" ? `${a}px` : a ?? "85%";
198
+ return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: i, children: /* @__PURE__ */ p(
197
199
  "div",
198
200
  {
199
201
  className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
200
202
  style: { width: m, maxWidth: "96%" },
201
- onClick: (i) => i.stopPropagation(),
203
+ onClick: (s) => s.stopPropagation(),
202
204
  children: [
203
205
  /* @__PURE__ */ p("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
204
206
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: n ?? e.title ?? "Manage" }),
@@ -206,19 +208,19 @@ function ke({
206
208
  "button",
207
209
  {
208
210
  type: "button",
209
- onClick: s,
211
+ onClick: i,
210
212
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
211
213
  children: "Close"
212
214
  }
213
215
  )
214
216
  ] }),
215
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(te, { config: e, initialScope: r }) })
217
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(re, { config: e, initialScope: r }) })
216
218
  ]
217
219
  }
218
220
  ) });
219
221
  }
220
- function lt({ widget: e }) {
221
- const r = e.config ?? {}, [l, n] = j(!1);
222
+ function ct({ widget: e }) {
223
+ const r = e.config ?? {}, [a, n] = q(!1);
222
224
  return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */ p("div", { className: "flex h-full items-center", children: [
223
225
  /* @__PURE__ */ t(
224
226
  "button",
@@ -229,53 +231,54 @@ function lt({ widget: e }) {
229
231
  children: r.button_label ?? r.title ?? "Manage"
230
232
  }
231
233
  ),
232
- l && /* @__PURE__ */ t(
233
- ke,
234
+ a && /* @__PURE__ */ t(
235
+ $e,
234
236
  {
235
237
  config: r,
236
238
  width: r.sheet_width,
237
239
  onClose: () => n(!1)
238
240
  }
239
241
  )
240
- ] }) : /* @__PURE__ */ t(te, { config: r });
242
+ ] }) : /* @__PURE__ */ t(re, { config: r });
241
243
  }
242
- function at(e) {
243
- return Ee(
244
+ function mt(e) {
245
+ return De(
244
246
  e,
245
247
  typeof window > "u" ? "" : window.location.search
246
248
  );
247
249
  }
248
- function Ne(e, r, l, n, s, m) {
250
+ function Se(e, r, a, n, i, m) {
249
251
  if (typeof e != "string") return e;
250
252
  if (e.startsWith("$row.")) return r == null ? void 0 : r[e.slice(5)];
251
253
  if (e.startsWith("$rows.")) {
252
- const i = e.slice(6), a = [...new Set(l.map((d) => d[i]).filter((d) => d != null && d !== ""))];
253
- return a.length ? a.join(",") : void 0;
254
+ const s = e.slice(6), l = [...new Set(a.map((o) => o[s]).filter((o) => o != null && o !== ""))];
255
+ return l.length ? l.join(",") : void 0;
254
256
  }
255
257
  if (e.startsWith("$param.")) return n[e.slice(7)];
256
258
  if (e.startsWith("$filters.")) {
257
- const i = e.slice(9), a = m == null ? void 0 : m.find((u) => u.param === i), d = s[i] ?? [];
258
- return d.length ? d.map((u) => String(u[(a == null ? void 0 : a.value_field) ?? "id"] ?? "")).join(",") : void 0;
259
+ const s = e.slice(9), l = m == null ? void 0 : m.find((u) => u.param === s), o = i[s] ?? [];
260
+ return o.length ? o.map((u) => String(u[(l == null ? void 0 : l.value_field) ?? "id"] ?? "")).join(",") : void 0;
259
261
  }
260
262
  return e;
261
263
  }
262
- function nt(e, r, l, n, s, m) {
263
- const i = {};
264
- for (const [a, d] of Object.entries(e.params ?? {})) {
265
- const u = Ne(d, r, l, n, s, m);
266
- u !== void 0 && (i[a] = u);
264
+ function ut(e, r, a, n, i, m) {
265
+ const s = {};
266
+ for (const [l, o] of Object.entries(e.params ?? {})) {
267
+ const u = Se(o, r, a, n, i, m);
268
+ u !== void 0 && (s[l] = u);
267
269
  }
268
- return { ...e, params: i };
270
+ return { ...e, params: s };
269
271
  }
270
- function st({
272
+ function pt({
271
273
  config: e,
272
274
  stats: r,
273
- asOf: l
275
+ asOf: a,
276
+ note: n
274
277
  }) {
275
- const n = z(), s = e.params ?? {}, { data: m, isPending: i, isError: a } = D({
276
- queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(s)],
277
- queryFn: () => n.request(
278
- V(`/custom-queries/${e.query_slug}/execute`, { params: s })
278
+ const i = D(), m = e.params ?? {}, { data: s, isPending: l, isError: o } = Q({
279
+ queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(m)],
280
+ queryFn: () => i.request(
281
+ U(`/custom-queries/${e.query_slug}/execute`, { params: m })
279
282
  ),
280
283
  enabled: !!e.query_slug,
281
284
  staleTime: 6e4
@@ -286,151 +289,173 @@ function st({
286
289
  className: "shrink-0 border-b border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card",
287
290
  "data-sheet-header": !0,
288
291
  children: /* @__PURE__ */ t(
289
- Ye,
292
+ at,
290
293
  {
291
294
  stats: r,
292
- rows: (m == null ? void 0 : m.data) ?? [],
293
- params: s,
294
- loading: i && !a,
295
- error: a,
296
- asOf: l
295
+ rows: (s == null ? void 0 : s.data) ?? [],
296
+ params: m,
297
+ loading: l && !o,
298
+ error: o,
299
+ asOf: a,
300
+ note: n
297
301
  }
298
302
  )
299
303
  }
300
304
  );
301
305
  }
302
- function it({
306
+ function ht({
303
307
  def: e,
304
308
  row: r,
305
- onClose: l
309
+ onClose: a
306
310
  }) {
307
- const [n, s] = j(e.initialTab ?? 0), m = e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (d, u) => {
311
+ const [n, i] = q(e.initialTab ?? 0), m = e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (o, u) => {
308
312
  const x = r == null ? void 0 : r[u];
309
313
  return x == null ? "" : String(x);
310
- }) : "Details", i = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", a = e.resolvedTabs[n];
311
- return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */ p(
314
+ }) : "Details", s = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", l = e.resolvedTabs[n];
315
+ return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: a, children: /* @__PURE__ */ p(
312
316
  "div",
313
317
  {
314
318
  className: "flex h-full flex-col border-l border-slate-200 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
315
- style: { width: i, maxWidth: "96%" },
316
- onClick: (d) => d.stopPropagation(),
319
+ style: { width: s, maxWidth: "96%" },
320
+ onClick: (o) => o.stopPropagation(),
317
321
  children: [
318
322
  /* @__PURE__ */ p("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
319
323
  /* @__PURE__ */ p("div", { className: "flex items-center gap-3", children: [
320
324
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: m }),
321
- e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((d, u) => /* @__PURE__ */ t(
325
+ e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((o, u) => /* @__PURE__ */ t(
322
326
  "button",
323
327
  {
324
328
  type: "button",
325
- onClick: () => s(u),
329
+ onClick: () => i(u),
326
330
  className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${u === n ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
327
- children: d.label
331
+ children: o.label
328
332
  },
329
- d.label
333
+ o.label
330
334
  )) })
331
335
  ] }),
332
336
  /* @__PURE__ */ t(
333
337
  "button",
334
338
  {
335
339
  type: "button",
336
- onClick: l,
340
+ onClick: a,
337
341
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
338
342
  children: "Close"
339
343
  }
340
344
  )
341
345
  ] }),
342
- e.header && /* @__PURE__ */ t(st, { config: e.header.config, stats: e.header.stats, asOf: e.header.asOf }),
343
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: a != null && a.matrix ? /* @__PURE__ */ t(
344
- te,
346
+ e.header && /* @__PURE__ */ t(
347
+ pt,
348
+ {
349
+ config: e.header.config,
350
+ stats: e.header.stats,
351
+ asOf: e.header.asOf,
352
+ note: e.header.note
353
+ }
354
+ ),
355
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: l != null && l.matrix ? /* @__PURE__ */ t(
356
+ re,
345
357
  {
346
- config: a.matrix.config,
347
- initialScope: a.matrix.initialScope,
358
+ config: l.matrix.config,
359
+ initialScope: l.matrix.initialScope,
348
360
  lockScope: !0
349
361
  },
350
362
  n
351
- ) : a != null && a.config ? /* @__PURE__ */ t(we, { config: a.config }, n) : /* @__PURE__ */ t("p", { className: "p-4 text-[12px] text-slate-400", children: "Sheet not configured" }) })
363
+ ) : l != null && l.config ? /* @__PURE__ */ p(E, { children: [
364
+ l.note && /* @__PURE__ */ t(
365
+ "p",
366
+ {
367
+ className: "border-b border-slate-200 bg-white px-4 py-1.5 text-[11.5px] text-slate-500 dark:border-border dark:bg-card dark:text-slate-400",
368
+ "data-sheet-tab-note": !0,
369
+ children: l.note
370
+ }
371
+ ),
372
+ /* @__PURE__ */ t(_e, { config: l.config }, n)
373
+ ] }) : /* @__PURE__ */ t("p", { className: "p-4 text-[12px] text-slate-400", children: "Sheet not configured" }) })
352
374
  ]
353
375
  }
354
376
  ) });
355
377
  }
356
- function ot(e, r, l, n) {
378
+ function xt(e, r, a, n) {
357
379
  if (!e) return;
358
- const s = (d) => {
359
- const u = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(d);
380
+ const i = (o) => {
381
+ const u = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(o);
360
382
  if (!u) return;
361
- const x = n == null ? void 0 : n.find((g) => g.param === u[1]), f = (l == null ? void 0 : l[u[1]]) ?? [];
362
- if (f.length === 0) return;
363
- const w = u[2] ?? (x == null ? void 0 : x.value_field) ?? "id";
364
- return f.map((g) => g[w]);
365
- }, m = (d) => typeof d == "string" && d.startsWith("$row.") ? r[d.slice(5)] : typeof d == "string" && d.startsWith("$filters.") ? s(d) : Array.isArray(d) ? d.map(m) : d && typeof d == "object" ? Object.fromEntries(
366
- Object.entries(d).map(([u, x]) => [u, m(x)])
367
- ) : d, i = (d) => d === void 0 ? !0 : Array.isArray(d) ? d.some(i) : d && typeof d == "object" ? Object.values(d).some(i) : !1, a = m(e);
368
- return Array.isArray(a._and) && (a._and = a._and.filter((d) => !i(d))), i(a) ? void 0 : a;
383
+ const x = n == null ? void 0 : n.find((S) => S.param === u[1]), b = (a == null ? void 0 : a[u[1]]) ?? [];
384
+ if (b.length === 0) return;
385
+ const N = u[2] ?? (x == null ? void 0 : x.value_field) ?? "id";
386
+ return b.map((S) => S[N]);
387
+ }, m = (o) => typeof o == "string" && o.startsWith("$row.") ? r[o.slice(5)] : typeof o == "string" && o.startsWith("$filters.") ? i(o) : Array.isArray(o) ? o.map(m) : o && typeof o == "object" ? Object.fromEntries(
388
+ Object.entries(o).map(([u, x]) => [u, m(x)])
389
+ ) : o, s = (o) => o === void 0 ? !0 : Array.isArray(o) ? o.some(s) : o && typeof o == "object" ? Object.values(o).some(s) : !1, l = m(e);
390
+ return Array.isArray(l._and) && (l._and = l._and.filter((o) => !s(o))), s(l) ? void 0 : l;
369
391
  }
370
- function dt({
392
+ function ft({
371
393
  filter: e,
372
394
  selected: r,
373
- onChange: l,
395
+ onChange: a,
374
396
  allowedIds: n,
375
- scopeDefault: s
397
+ scopeDefault: i
376
398
  }) {
377
- const m = z(), [i, a] = j(!1), [d, u] = j(""), x = ee(null), f = e.value_field ?? "id", w = e.label_field ?? f, { data: g = [] } = D({
378
- queryKey: ["page-renderer-filter", e.collection, f, w, e.sort],
399
+ const m = D(), [s, l] = q(!1), [o, u] = q(""), x = te(null), b = e.value_field ?? "id", N = e.label_field ?? b, { data: S = [] } = Q({
400
+ queryKey: ["page-renderer-filter", e.collection, b, N, e.sort],
379
401
  queryFn: () => m.request(
380
- ve(`/items/${e.collection}`, {
381
- fields: [.../* @__PURE__ */ new Set(["id", f, w])].join(","),
402
+ we(`/items/${e.collection}`, {
403
+ fields: [.../* @__PURE__ */ new Set(["id", b, N])].join(","),
382
404
  limit: e.limit ?? 500,
383
405
  ...e.sort ? { sort: e.sort } : {}
384
406
  })
385
- ).then(($) => $.data ?? []),
407
+ ).then((w) => w.data ?? []),
386
408
  staleTime: 6e4
387
409
  });
388
- Z(() => {
389
- if (!i) return;
390
- const $ = (q) => {
391
- x.current && !x.current.contains(q.target) && a(!1);
410
+ ee(() => {
411
+ if (!s) return;
412
+ const w = ($) => {
413
+ x.current && !x.current.contains($.target) && l(!1);
392
414
  };
393
- return window.addEventListener("mousedown", $), () => window.removeEventListener("mousedown", $);
394
- }, [i]);
395
- const _ = e.label ?? E(e.param), O = (n != null && n.length ? g.filter(($) => n.some((q) => String(q) === String($.id))) : g).filter(
396
- ($) => d ? String($[w] ?? "").toLowerCase().includes(d.toLowerCase()) : !0
397
- ), S = n != null && n.length ? {
415
+ return window.addEventListener("mousedown", w), () => window.removeEventListener("mousedown", w);
416
+ }, [s]);
417
+ const W = e.label ?? L(e.param), j = Ke(
418
+ n != null && n.length ? S.filter((w) => n.some(($) => String($) === String(w.id))) : S,
419
+ (w) => String(w[b] ?? "")
420
+ ).filter(
421
+ (w) => o ? String(w[N] ?? "").toLowerCase().includes(o.toLowerCase()) : !0
422
+ ), R = n != null && n.length ? {
398
423
  label: "restricted",
399
424
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
400
- title: `Options limited to your restricted ${_} scope${s ? "; selection seeded from your defaults" : ""}`
401
- } : s && r.length > 0 ? {
402
- label: "default",
425
+ title: `Options limited to your restricted ${W} scope${i ? "; selection seeded from your defaults" : ""}`
426
+ } : i && r.length > 0 ? {
427
+ label: "your default",
403
428
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
404
- title: `Pre-selected from your default ${_} scope — adjust freely`
429
+ title: `Pre-selected from your default ${W} scope — adjust freely`
405
430
  } : null;
406
431
  return /* @__PURE__ */ p("div", { ref: x, className: "relative", children: [
407
432
  /* @__PURE__ */ p(
408
433
  "button",
409
434
  {
410
435
  type: "button",
411
- onClick: () => a(($) => !$),
436
+ onClick: () => l((w) => !w),
412
437
  className: `inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] transition-colors ${r.length > 0 ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-700 dark:text-slate-200" : "border-slate-200 bg-white text-slate-600 hover:border-slate-400 dark:border-border dark:bg-card dark:text-slate-300"}`,
413
438
  children: [
414
- /* @__PURE__ */ t("span", { className: "font-medium", children: _ }),
415
- S && /* @__PURE__ */ t(
439
+ /* @__PURE__ */ t("span", { className: "font-medium", children: W }),
440
+ R && /* @__PURE__ */ t(
416
441
  "span",
417
442
  {
418
- title: S.title,
419
- className: `rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${S.cls}`,
420
- children: S.label
443
+ title: R.title,
444
+ className: `rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${R.cls}`,
445
+ children: R.label
421
446
  }
422
447
  ),
423
- /* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][w] ?? r[0][f] ?? "") : `${r.length} selected` }),
448
+ /* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][N] ?? r[0][b] ?? "") : `${r.length} selected` }),
424
449
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: "⌃" })
425
450
  ]
426
451
  }
427
452
  ),
428
- i && /* @__PURE__ */ p("div", { className: "absolute left-0 top-9 z-40 w-56 rounded-md border border-slate-200 bg-white p-1 shadow-md dark:border-border dark:bg-popover", children: [
453
+ s && /* @__PURE__ */ p("div", { className: "absolute left-0 top-9 z-40 w-56 rounded-md border border-slate-200 bg-white p-1 shadow-md dark:border-border dark:bg-popover", children: [
429
454
  /* @__PURE__ */ t(
430
455
  "input",
431
456
  {
432
- value: d,
433
- onChange: ($) => u($.target.value),
457
+ value: o,
458
+ onChange: (w) => u(w.target.value),
434
459
  placeholder: "Search…",
435
460
  className: "mb-1 h-7 w-full rounded border border-slate-200 bg-white px-2 text-[12px] outline-none dark:border-border dark:bg-background"
436
461
  }
@@ -440,39 +465,45 @@ function dt({
440
465
  "button",
441
466
  {
442
467
  type: "button",
443
- onClick: () => l([]),
468
+ onClick: () => a([]),
444
469
  className: "flex w-full items-center rounded px-2 py-1 text-left text-[12px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
445
470
  children: "Clear selection"
446
471
  }
447
472
  ),
448
- O.map(($) => {
449
- const q = String($[f] ?? ""), M = r.some((o) => String(o[f] ?? "") === q);
473
+ j.map((w) => {
474
+ const $ = String(w[b] ?? ""), O = r.some((d) => String(d[b] ?? "") === $);
450
475
  return /* @__PURE__ */ p(
451
476
  "button",
452
477
  {
453
478
  type: "button",
454
- onClick: () => l(
455
- M ? r.filter((o) => String(o[f] ?? "") !== q) : [...r, $]
456
- ),
479
+ onClick: () => {
480
+ if (e.single) {
481
+ a(O ? [] : [w]), l(!1);
482
+ return;
483
+ }
484
+ a(
485
+ O ? r.filter((d) => String(d[b] ?? "") !== $) : [...r, w]
486
+ );
487
+ },
457
488
  className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
458
489
  children: [
459
- /* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${M ? "" : "invisible"}`, children: "✓" }),
460
- /* @__PURE__ */ t("span", { className: "truncate", children: String($[w] ?? q) })
490
+ /* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${O ? "" : "invisible"}`, children: "✓" }),
491
+ /* @__PURE__ */ t("span", { className: "truncate", children: String(w[N] ?? $) })
461
492
  ]
462
493
  },
463
- q
494
+ $
464
495
  );
465
496
  }),
466
- O.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-[12px] text-slate-400", children: "No options" })
497
+ j.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-[12px] text-slate-400", children: "No options" })
467
498
  ] })
468
499
  ] })
469
500
  ] });
470
501
  }
471
- function ct({ widget: e }) {
472
- return /* @__PURE__ */ t(we, { config: e.config ?? {} });
502
+ function bt({ widget: e }) {
503
+ return /* @__PURE__ */ t(_e, { config: e.config ?? {} });
473
504
  }
474
- function mt({ widget: e }) {
475
- const r = e.config ?? {}, [l, n] = j(!1);
505
+ function gt({ widget: e }) {
506
+ const r = e.config ?? {}, [a, n] = q(!1);
476
507
  return r.collection ? r.display === "drawer" ? /* @__PURE__ */ p("div", { className: "flex h-full items-center", children: [
477
508
  /* @__PURE__ */ t(
478
509
  "button",
@@ -483,7 +514,7 @@ function mt({ widget: e }) {
483
514
  children: r.button_label ?? r.title ?? "Manage"
484
515
  }
485
516
  ),
486
- l && /* @__PURE__ */ t(
517
+ a && /* @__PURE__ */ t(
487
518
  "div",
488
519
  {
489
520
  className: "fixed inset-0 z-50 flex justify-end bg-black/30",
@@ -496,7 +527,7 @@ function mt({ widget: e }) {
496
527
  width: typeof r.sheet_width == "number" ? `${r.sheet_width}px` : r.sheet_width ?? "92%",
497
528
  maxWidth: "96%"
498
529
  },
499
- onClick: (s) => s.stopPropagation(),
530
+ onClick: (i) => i.stopPropagation(),
500
531
  children: [
501
532
  /* @__PURE__ */ p("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
502
533
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: r.button_label ?? r.title ?? "Manage" }),
@@ -510,24 +541,24 @@ function mt({ widget: e }) {
510
541
  }
511
542
  )
512
543
  ] }),
513
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(be, { config: r }) })
544
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(ye, { config: r }) })
514
545
  ]
515
546
  }
516
547
  )
517
548
  }
518
549
  )
519
- ] }) : /* @__PURE__ */ t(be, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
550
+ ] }) : /* @__PURE__ */ t(ye, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
520
551
  }
521
- function ut({
552
+ function yt({
522
553
  cfg: e
523
554
  }) {
524
- const [r, l] = j(!1), n = { ...e };
555
+ const [r, a] = q(!1), n = { ...e };
525
556
  return delete n.display, /* @__PURE__ */ p("div", { className: "flex h-full items-center", children: [
526
557
  /* @__PURE__ */ t(
527
558
  "button",
528
559
  {
529
560
  type: "button",
530
- onClick: () => l(!0),
561
+ onClick: () => a(!0),
531
562
  className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
532
563
  children: e.button_label ?? e.label ?? "View"
533
564
  }
@@ -536,7 +567,7 @@ function ut({
536
567
  "div",
537
568
  {
538
569
  className: "fixed inset-0 z-50 flex justify-end bg-black/30",
539
- onClick: () => l(!1),
570
+ onClick: () => a(!1),
540
571
  children: /* @__PURE__ */ p(
541
572
  "div",
542
573
  {
@@ -545,7 +576,7 @@ function ut({
545
576
  width: typeof e.sheet_width == "number" ? `${e.sheet_width}px` : e.sheet_width ?? "90%",
546
577
  maxWidth: "96%"
547
578
  },
548
- onClick: (s) => s.stopPropagation(),
579
+ onClick: (i) => i.stopPropagation(),
549
580
  children: [
550
581
  /* @__PURE__ */ p("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
551
582
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: e.button_label ?? e.label ?? "View" }),
@@ -553,13 +584,13 @@ function ut({
553
584
  "button",
554
585
  {
555
586
  type: "button",
556
- onClick: () => l(!1),
587
+ onClick: () => a(!1),
557
588
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
558
589
  children: "Close"
559
590
  }
560
591
  )
561
592
  ] }),
562
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t($e, { config: n }) })
593
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ce, { config: n }) })
563
594
  ]
564
595
  }
565
596
  )
@@ -567,152 +598,168 @@ function ut({
567
598
  )
568
599
  ] });
569
600
  }
570
- function we({ config: e }) {
571
- return e.display === "drawer" ? /* @__PURE__ */ t(ut, { cfg: e }) : /* @__PURE__ */ t($e, { config: e });
601
+ function _e({ config: e }) {
602
+ return e.display === "drawer" ? /* @__PURE__ */ t(yt, { cfg: e }) : /* @__PURE__ */ t(Ce, { config: e });
572
603
  }
573
- function $e({ config: e }) {
574
- var de, ce, me, ue, pe, he, xe;
575
- const r = z(), l = ye(), [n, s] = j(null), [m, i] = j(null), [a, d] = j(null), [u, x] = j(
576
- () => at(e.filters)
577
- ), [f, w] = j(null), [g, _] = j(null), A = (g == null ? void 0 : g.phase) === "running", O = We();
578
- Z(() => {
579
- if ((g == null ? void 0 : g.phase) !== "running") return;
604
+ function Ce({ config: e }) {
605
+ var me, ue, pe, he, xe, fe, be;
606
+ const r = D(), a = ke(), [n, i] = q(null), [m, s] = q(null), [l, o] = q(null), [u, x] = q(
607
+ () => mt(e.filters)
608
+ ), [b] = q(
609
+ () => Qe(e.filters, typeof window > "u" ? "" : window.location.search)
610
+ ), N = (c, h) => {
611
+ const g = { ...u, [c]: h };
612
+ if (x(g), typeof window > "u" || !(e.filters ?? []).some((k) => k.url_param)) return;
613
+ const f = ze(e.filters, g, window.location.search);
614
+ f !== window.location.search && window.history.replaceState(
615
+ window.history.state,
616
+ "",
617
+ `${window.location.pathname}${f}${window.location.hash}`
618
+ );
619
+ }, [S, W] = q(null), [C, j] = q(null), R = (C == null ? void 0 : C.phase) === "running", w = Ae();
620
+ ee(() => {
621
+ if ((C == null ? void 0 : C.phase) !== "running") return;
580
622
  const c = window.setInterval(() => {
581
- _(
623
+ j(
582
624
  (h) => (h == null ? void 0 : h.phase) === "running" ? { ...h, elapsedMs: Date.now() - h.startedAt } : h
583
625
  );
584
626
  }, 250);
585
627
  return () => window.clearInterval(c);
586
- }, [g == null ? void 0 : g.phase]);
587
- const { scopes: S, ready: $ } = Le(), q = ee(!1), [M, o] = j(!1), [v, B] = j(/* @__PURE__ */ new Set());
588
- Z(() => {
589
- if (q.current || !$) return;
590
- q.current = !0;
591
- const c = (e.filters ?? []).filter((h) => !(u[h.param] ?? []).length);
592
- if (!S || !c.length) {
593
- o(!0);
628
+ }, [C == null ? void 0 : C.phase]);
629
+ const { scopes: $, ready: O } = Ge(), d = te(!1), [y, F] = q(!1), [z, K] = q(/* @__PURE__ */ new Set());
630
+ ee(() => {
631
+ if (d.current || !O) return;
632
+ d.current = !0;
633
+ const c = (e.filters ?? []).filter(
634
+ (h) => !(u[h.param] ?? []).length && !b.has(h.param)
635
+ );
636
+ if (!$ || !c.length) {
637
+ F(!0);
594
638
  return;
595
639
  }
596
640
  (async () => {
597
641
  try {
598
642
  const h = {};
599
- for (const y of c) {
600
- const b = fe(S, { key: y.param, collection: y.collection });
601
- if (!b) continue;
602
- const N = Ie(S, b.name);
603
- if (!N.length) continue;
604
- const C = y.value_field ?? "id", T = await Qe(
643
+ for (const g of c) {
644
+ const f = ge($, { key: g.param, collection: g.collection });
645
+ if (!f) continue;
646
+ const k = Ue($, f.name);
647
+ if (!k.length) continue;
648
+ const _ = g.value_field ?? "id", M = await He(
605
649
  r,
606
- b,
607
- N,
608
- C
650
+ f,
651
+ k,
652
+ _
609
653
  );
610
- T.length && (h[y.param] = T.map((F, I) => ({ [C]: F, id: N[I] })));
654
+ if (M.length) {
655
+ const P = M.map((I, Me) => ({ [_]: I, id: k[Me] }));
656
+ h[g.param] = g.single ? P.slice(0, 1) : P;
657
+ }
611
658
  }
612
- Object.keys(h).length && (x((y) => {
613
- const b = { ...y };
614
- for (const [N, C] of Object.entries(h))
615
- (b[N] ?? []).length || (b[N] = C);
616
- return b;
617
- }), B(new Set(Object.keys(h))));
659
+ Object.keys(h).length && (x((g) => {
660
+ const f = { ...g };
661
+ for (const [k, _] of Object.entries(h))
662
+ (f[k] ?? []).length || (f[k] = _);
663
+ return f;
664
+ }), K(new Set(Object.keys(h))));
618
665
  } finally {
619
- o(!0);
666
+ F(!0);
620
667
  }
621
668
  })();
622
- }, [$, S, e.filters, u, r]);
623
- const R = Oe(() => {
669
+ }, [O, $, e.filters, u, r, b]);
670
+ const T = Pe(() => {
624
671
  const c = { ...e.params ?? {} };
625
672
  for (const h of e.filters ?? []) {
626
- const y = u[h.param] ?? [];
627
- y.length > 0 && (c[h.param] = y.map((b) => String(b[h.value_field ?? "id"] ?? "")).join(","));
673
+ const g = u[h.param] ?? [];
674
+ g.length > 0 && (c[h.param] = g.map((f) => String(f[h.value_field ?? "id"] ?? "")).join(","));
628
675
  }
629
676
  return c;
630
- }, [e.params, e.filters, u]), P = ee(!1), {
631
- data: W,
632
- isPending: L,
633
- error: le,
634
- refetch: ae,
635
- isFetching: Se
636
- } = D({
637
- queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(R)],
677
+ }, [e.params, e.filters, u]), B = te(!1), {
678
+ data: A,
679
+ isPending: le,
680
+ error: ne,
681
+ refetch: se,
682
+ isFetching: qe
683
+ } = Q({
684
+ queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(T)],
638
685
  queryFn: () => {
639
- const c = P.current;
640
- return P.current = !1, r.request(
641
- V(`/custom-queries/${e.query_slug}/execute`, {
642
- params: R,
686
+ const c = B.current;
687
+ return B.current = !1, r.request(
688
+ U(`/custom-queries/${e.query_slug}/execute`, {
689
+ params: T,
643
690
  ...c ? { refresh: !0 } : {}
644
691
  })
645
692
  );
646
693
  },
647
- enabled: !!e.query_slug && M,
694
+ enabled: !!e.query_slug && y,
648
695
  staleTime: 6e4
649
- }), K = W == null ? void 0 : W.data, Ce = Te(() => {
650
- P.current = !0, ae();
651
- }, [ae]), ne = L;
696
+ }), V = A == null ? void 0 : A.data, je = Fe(() => {
697
+ B.current = !0, se();
698
+ }, [se]), ie = le;
652
699
  if (!e.query_slug) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set a query slug" });
653
- const _e = (c) => {
654
- var N;
700
+ const Re = (c) => {
701
+ var k;
655
702
  const h = {};
656
- for (const [C, T] of Object.entries(c.params ?? {})) {
657
- const F = Ne(T, null, K ?? [], R, u, e.filters);
658
- if (F === void 0) {
659
- w(`Select a value for "${C}" first`);
703
+ for (const [_, M] of Object.entries(c.params ?? {})) {
704
+ const P = Se(M, null, V ?? [], T, u, e.filters);
705
+ if (P === void 0) {
706
+ W(`Select a value for "${_}" first`);
660
707
  return;
661
708
  }
662
- h[C] = F;
709
+ h[_] = P;
663
710
  }
664
- const y = (N = c.confirm) == null ? void 0 : N.replace(/\{(\w+)\}/g, (C, T) => String(h[T] ?? "")), b = {
711
+ const g = (k = c.confirm) == null ? void 0 : k.replace(/\{(\w+)\}/g, (_, M) => String(h[M] ?? "")), f = {
665
712
  action: c,
666
713
  params: h,
667
- phase: y ? "confirm" : "running",
668
- confirmText: y ?? null,
714
+ phase: g ? "confirm" : "running",
715
+ confirmText: g ?? null,
669
716
  startedAt: Date.now(),
670
717
  elapsedMs: 0
671
718
  };
672
- _(b), y || se(b);
673
- }, se = async (c) => {
719
+ j(f), g || oe(f);
720
+ }, oe = async (c) => {
674
721
  const h = Date.now();
675
- _({ ...c, phase: "running", startedAt: h, elapsedMs: 0 });
722
+ j({ ...c, phase: "running", startedAt: h, elapsedMs: 0 });
676
723
  try {
677
- const y = await r.request(
678
- V(`/custom-queries/${c.action.query_slug}/execute`, { params: c.params })
679
- ), b = Array.isArray(y == null ? void 0 : y.data) ? y.data : [];
680
- _(
681
- (N) => N && N.action === c.action ? {
682
- ...N,
724
+ const g = await r.request(
725
+ U(`/custom-queries/${c.action.query_slug}/execute`, { params: c.params })
726
+ ), f = Array.isArray(g == null ? void 0 : g.data) ? g.data : [];
727
+ j(
728
+ (k) => k && k.action === c.action ? {
729
+ ...k,
683
730
  phase: "done",
684
731
  elapsedMs: Date.now() - h,
685
- resultRows: b.length,
686
- resultSample: b[0] ?? null
687
- } : N
688
- ), w(
732
+ resultRows: f.length,
733
+ resultSample: f[0] ?? null
734
+ } : k
735
+ ), W(
689
736
  `${c.action.success_message ?? `${c.action.label} completed`} · ${G(Date.now() - h)}`
690
- ), O.invalidateQueries({ queryKey: ["page-renderer-query", e.query_slug] });
691
- } catch (y) {
692
- const b = y instanceof Error ? y.message : "unknown error";
693
- _(
694
- (N) => N && N.action === c.action ? { ...N, phase: "error", elapsedMs: Date.now() - h, error: b } : N
695
- ), w(`${c.action.label} failed: ${b}`);
737
+ ), w.invalidateQueries({ queryKey: ["page-renderer-query", e.query_slug] });
738
+ } catch (g) {
739
+ const f = Ne(g, "unknown error");
740
+ j(
741
+ (k) => k && k.action === c.action ? { ...k, phase: "error", elapsedMs: Date.now() - h, error: f } : k
742
+ ), W(`${c.action.label} failed: ${f}`);
696
743
  }
697
- }, qe = /* @__PURE__ */ t(
698
- Ke,
744
+ }, We = /* @__PURE__ */ t(
745
+ Xe,
699
746
  {
700
- envelope: W,
701
- onRefresh: Ce,
702
- refreshing: Se && !L,
747
+ envelope: A,
748
+ onRefresh: je,
749
+ refreshing: qe && !le,
703
750
  className: "ml-auto"
704
751
  }
705
- ), Y = e.filters && e.filters.length > 0 || (de = e.actions) != null && de.length || W != null && W.cache_ttl ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
752
+ ), J = e.filters && e.filters.length > 0 || (me = e.actions) != null && me.length || A != null && A.cache_ttl ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
706
753
  (e.filters ?? []).map((c) => {
707
- const h = fe(S, { key: c.param, collection: c.collection }), y = h ? (S == null ? void 0 : S.restricted[h.name]) ?? [] : [];
754
+ const h = ge($, { key: c.param, collection: c.collection }), g = h ? ($ == null ? void 0 : $.restricted[h.name]) ?? [] : [];
708
755
  return /* @__PURE__ */ t(
709
- dt,
756
+ ft,
710
757
  {
711
758
  filter: c,
712
759
  selected: u[c.param] ?? [],
713
- allowedIds: y.length > 0 ? y : void 0,
714
- scopeDefault: v.has(c.param),
715
- onChange: (b) => x((N) => ({ ...N, [c.param]: b }))
760
+ allowedIds: g.length > 0 ? g : void 0,
761
+ scopeDefault: z.has(c.param),
762
+ onChange: (f) => N(c.param, f)
716
763
  },
717
764
  c.param
718
765
  );
@@ -721,140 +768,141 @@ function $e({ config: e }) {
721
768
  "button",
722
769
  {
723
770
  type: "button",
724
- disabled: A,
725
- onClick: () => void _e(c),
771
+ disabled: R,
772
+ onClick: () => void Re(c),
726
773
  className: "ml-auto inline-flex h-8 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:opacity-90 disabled:opacity-50",
727
- children: A ? "Running…" : c.label
774
+ children: R ? "Running…" : c.label
728
775
  },
729
776
  c.label
730
777
  )),
731
- f && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: f }),
732
- qe
733
- ] }) : null, ie = (ce = e.stats) != null && ce.length ? /* @__PURE__ */ t(
734
- Ve,
778
+ S && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: S }),
779
+ We
780
+ ] }) : null, de = (ue = e.stats) != null && ue.length ? /* @__PURE__ */ t(
781
+ et,
735
782
  {
736
783
  stats: e.stats,
737
- rows: K ?? [],
738
- effectiveParams: R,
739
- loading: ne
784
+ rows: V ?? [],
785
+ effectiveParams: T,
786
+ loading: ie
740
787
  }
741
788
  ) : null;
742
- if (ne)
789
+ if (ie)
743
790
  return /* @__PURE__ */ p("div", { className: "p-3", children: [
744
- Y,
745
- ie,
791
+ J,
792
+ de,
746
793
  /* @__PURE__ */ t(H, {})
747
794
  ] });
748
- if (le)
795
+ if (ne)
749
796
  return /* @__PURE__ */ p("div", { className: "p-3", children: [
750
- Y,
751
- /* @__PURE__ */ t(U, { error: le })
797
+ J,
798
+ /* @__PURE__ */ t(Y, { error: ne })
752
799
  ] });
753
- const k = e.row_click, oe = (c, h) => {
754
- const b = Be(c, (C) => nt(
755
- C,
800
+ const v = e.row_click, ce = (c, h) => {
801
+ const f = Ve(c, (_) => ut(
802
+ _,
756
803
  h,
757
- K ?? [],
758
- R,
804
+ V ?? [],
805
+ T,
759
806
  u,
760
807
  e.filters
761
- )), N = b.resolvedTabs.map((C) => {
762
- if ("matrix" in C) {
763
- const T = {};
764
- for (const [F, I] of Object.entries(C.matrix.scope))
765
- T[F] = I.startsWith("$row.") ? h == null ? void 0 : h[I.slice(5)] : I;
808
+ )), k = f.resolvedTabs.map((_) => {
809
+ if ("matrix" in _) {
810
+ const M = {};
811
+ for (const [P, I] of Object.entries(_.matrix.scope))
812
+ M[P] = I.startsWith("$row.") ? h == null ? void 0 : h[I.slice(5)] : I;
766
813
  return {
767
- label: C.label,
768
- matrix: { config: C.matrix.config, initialScope: T }
814
+ label: _.label,
815
+ matrix: { config: _.matrix.config, initialScope: M }
769
816
  };
770
817
  }
771
- return { label: C.label, config: C.config };
818
+ return { label: _.label, note: _.note, config: _.config };
772
819
  });
773
- d({
820
+ o({
774
821
  def: {
775
822
  ...c,
776
- resolvedTabs: N,
777
- header: b.header ? {
778
- config: b.header.config,
779
- stats: b.header.stats,
780
- asOf: b.header.asOf
823
+ resolvedTabs: k,
824
+ header: f.header ? {
825
+ config: f.header.config,
826
+ stats: f.header.stats,
827
+ asOf: f.header.asOf,
828
+ note: f.header.note
781
829
  } : null,
782
- initialTab: b.initialTab
830
+ initialTab: f.initialTab
783
831
  },
784
832
  row: h
785
833
  });
786
- }, je = k ? (c) => {
787
- k.picker ? s(c) : k.sheet ? oe(k.sheet, c) : k.matrix && c.id != null ? i(c.id) : k.drill && c.id != null && (l == null || l.open({
788
- collection: k.drill.collection ?? "",
834
+ }, Te = v ? (c) => {
835
+ v.picker ? i(c) : v.sheet ? ce(v.sheet, c) : v.matrix && c.id != null ? s(c.id) : v.drill && c.id != null && (a == null || a.open({
836
+ collection: v.drill.collection ?? "",
789
837
  itemId: String(c.id),
790
- layoutId: k.drill.layout_id,
791
- width: k.drill.width
838
+ layoutId: v.drill.layout_id,
839
+ width: v.drill.width
792
840
  }));
793
- } : void 0, Re = (me = e.row_actions) != null && me.length ? e.row_actions.map((c) => ({
841
+ } : void 0, Oe = (pe = e.row_actions) != null && pe.length ? e.row_actions.map((c) => ({
794
842
  label: c.label,
795
- onClick: (h) => oe(c.sheet, h)
843
+ onClick: (h) => ce(c.sheet, h)
796
844
  })) : void 0;
797
845
  return /* @__PURE__ */ p(
798
846
  "div",
799
847
  {
800
- className: (ue = e.table) != null && ue.sticky ? (
848
+ className: (he = e.table) != null && he.sticky ? (
801
849
  // Sticky grids own their scroll: filters/stats stay pinned above a
802
850
  // scrolling table region (header/first-column/totals pin inside it).
803
851
  "flex h-full min-h-0 flex-col overflow-hidden p-3"
804
852
  ) : "h-full overflow-auto p-3",
805
853
  children: [
806
- Y,
807
- ie,
854
+ J,
855
+ de,
808
856
  /* @__PURE__ */ t(
809
- He,
857
+ tt,
810
858
  {
811
- rows: K ?? [],
859
+ rows: V ?? [],
812
860
  config: (
813
861
  // Current-month highlight only applies when the selected year param
814
862
  // IS the current year — otherwise strip it.
815
- (pe = e.table) != null && pe.highlight_group && e.table.highlight_year_param ? Number(
816
- String(R[e.table.highlight_year_param] ?? "").split(",")[0]
863
+ (xe = e.table) != null && xe.highlight_group && e.table.highlight_year_param ? Number(
864
+ String(T[e.table.highlight_year_param] ?? "").split(",")[0]
817
865
  ) === (/* @__PURE__ */ new Date()).getFullYear() ? e.table : { ...e.table, highlight_group: void 0 } : e.table
818
866
  ),
819
- onRowClick: je,
820
- rowActions: Re,
867
+ onRowClick: Te,
868
+ rowActions: Oe,
821
869
  emptyText: e.empty_label,
822
- pivotYear: (xe = (he = e.table) == null ? void 0 : he.pivot) != null && xe.year_param && Number(String(R[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
870
+ pivotYear: (be = (fe = e.table) == null ? void 0 : fe.pivot) != null && be.year_param && Number(String(T[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
823
871
  }
824
872
  ),
825
- (k == null ? void 0 : k.picker) && n && /* @__PURE__ */ t(
873
+ (v == null ? void 0 : v.picker) && n && /* @__PURE__ */ t(
826
874
  "div",
827
875
  {
828
876
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 pt-32",
829
- onClick: () => s(null),
877
+ onClick: () => i(null),
830
878
  children: /* @__PURE__ */ p(
831
879
  "div",
832
880
  {
833
881
  className: "w-[420px] rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-background",
834
882
  onClick: (c) => c.stopPropagation(),
835
883
  children: [
836
- /* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: k.picker.title ?? "Choose a record" }),
884
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: v.picker.title ?? "Choose a record" }),
837
885
  /* @__PURE__ */ t(
838
- Ge,
886
+ Ze,
839
887
  {
840
- collection: k.picker.collection,
888
+ collection: v.picker.collection,
841
889
  value: null,
842
890
  onChange: (c) => {
843
- var h, y, b, N;
844
- if (s(null), c != null) {
845
- if (k.matrix) {
846
- i(c);
891
+ var h, g, f, k;
892
+ if (i(null), c != null) {
893
+ if (v.matrix) {
894
+ s(c);
847
895
  return;
848
896
  }
849
- l == null || l.open({
850
- collection: ((h = k.drill) == null ? void 0 : h.collection) ?? ((y = k.picker) == null ? void 0 : y.collection) ?? "",
897
+ a == null || a.open({
898
+ collection: ((h = v.drill) == null ? void 0 : h.collection) ?? ((g = v.picker) == null ? void 0 : g.collection) ?? "",
851
899
  itemId: String(c),
852
- layoutId: (b = k.drill) == null ? void 0 : b.layout_id,
853
- width: (N = k.drill) == null ? void 0 : N.width
900
+ layoutId: (f = v.drill) == null ? void 0 : f.layout_id,
901
+ width: (k = v.drill) == null ? void 0 : k.width
854
902
  });
855
903
  }
856
904
  },
857
- extraFilter: ot(k.picker.filter, n, u, e.filters),
905
+ extraFilter: xt(v.picker.filter, n, u, e.filters),
858
906
  placeholder: "Search…"
859
907
  }
860
908
  ),
@@ -862,7 +910,7 @@ function $e({ config: e }) {
862
910
  "button",
863
911
  {
864
912
  type: "button",
865
- onClick: () => s(null),
913
+ onClick: () => i(null),
866
914
  className: "mt-3 h-7 rounded px-2 text-[12px] text-slate-500 hover:text-slate-700",
867
915
  children: "Cancel"
868
916
  }
@@ -872,24 +920,24 @@ function $e({ config: e }) {
872
920
  )
873
921
  }
874
922
  ),
875
- (k == null ? void 0 : k.matrix) && m != null && /* @__PURE__ */ t(
876
- ke,
923
+ (v == null ? void 0 : v.matrix) && m != null && /* @__PURE__ */ t(
924
+ $e,
877
925
  {
878
- config: k.matrix.config,
879
- initialScope: { [k.matrix.scope_field]: m },
880
- width: k.matrix.width,
881
- title: k.matrix.title,
882
- onClose: () => i(null)
926
+ config: v.matrix.config,
927
+ initialScope: { [v.matrix.scope_field]: m },
928
+ width: v.matrix.width,
929
+ title: v.matrix.title,
930
+ onClose: () => s(null)
883
931
  }
884
932
  ),
885
- a && /* @__PURE__ */ t(it, { def: a.def, row: a.row, onClose: () => d(null) }),
886
- g && /* @__PURE__ */ t(
887
- pt,
933
+ l && /* @__PURE__ */ t(ht, { def: l.def, row: l.row, onClose: () => o(null) }),
934
+ C && /* @__PURE__ */ t(
935
+ vt,
888
936
  {
889
- run: g,
890
- onConfirm: () => void se(g),
937
+ run: C,
938
+ onConfirm: () => void oe(C),
891
939
  onClose: () => {
892
- _(null);
940
+ j(null);
893
941
  }
894
942
  }
895
943
  )
@@ -898,20 +946,20 @@ function $e({ config: e }) {
898
946
  );
899
947
  }
900
948
  const G = (e) => e < 6e4 ? `${(e / 1e3).toFixed(e < 1e4 ? 1 : 0)}s` : `${Math.floor(e / 6e4)}m ${Math.round(e % 6e4 / 1e3)}s`;
901
- function pt({
949
+ function vt({
902
950
  run: e,
903
951
  onConfirm: r,
904
- onClose: l
952
+ onClose: a
905
953
  }) {
906
954
  const n = Object.entries(e.params);
907
- return Me(
908
- /* @__PURE__ */ p(Q, { children: [
955
+ return Be(
956
+ /* @__PURE__ */ p(E, { children: [
909
957
  /* @__PURE__ */ t(
910
958
  "div",
911
959
  {
912
960
  role: "presentation",
913
961
  className: "fixed inset-0 z-40 bg-slate-950/40",
914
- onClick: e.phase === "running" ? void 0 : l
962
+ onClick: e.phase === "running" ? void 0 : a
915
963
  }
916
964
  ),
917
965
  /* @__PURE__ */ p(
@@ -923,11 +971,11 @@ function pt({
923
971
  className: "fixed left-1/2 top-[24vh] z-50 w-[min(400px,92vw)] -translate-x-1/2 rounded-xl border border-slate-200 bg-white p-4 shadow-2xl dark:border-border dark:bg-card",
924
972
  children: [
925
973
  /* @__PURE__ */ t("p", { className: "text-[13.5px] font-semibold text-slate-900 dark:text-foreground", children: e.action.label }),
926
- n.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: n.map(([s, m]) => /* @__PURE__ */ p("div", { className: "flex gap-2", children: [
927
- /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: E(s) }),
974
+ n.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: n.map(([i, m]) => /* @__PURE__ */ p("div", { className: "flex gap-2", children: [
975
+ /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: L(i) }),
928
976
  /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m) })
929
- ] }, s)) }),
930
- e.phase === "confirm" && /* @__PURE__ */ p(Q, { children: [
977
+ ] }, i)) }),
978
+ e.phase === "confirm" && /* @__PURE__ */ p(E, { children: [
931
979
  /* @__PURE__ */ t("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: e.confirmText }),
932
980
  /* @__PURE__ */ p("div", { className: "mt-3 flex gap-2", children: [
933
981
  /* @__PURE__ */ t(
@@ -943,7 +991,7 @@ function pt({
943
991
  "button",
944
992
  {
945
993
  type: "button",
946
- onClick: l,
994
+ onClick: a,
947
995
  className: "h-8 rounded-md border border-slate-200 px-3 text-[12.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300",
948
996
  children: "Cancel"
949
997
  }
@@ -955,17 +1003,17 @@ function pt({
955
1003
  "Running… ",
956
1004
  /* @__PURE__ */ t("span", { className: "tabular-nums", children: G(e.elapsedMs) })
957
1005
  ] }),
958
- e.phase === "done" && /* @__PURE__ */ p(Q, { children: [
1006
+ e.phase === "done" && /* @__PURE__ */ p(E, { children: [
959
1007
  /* @__PURE__ */ p("p", { className: "mt-2 text-[12.5px] font-medium text-emerald-600 dark:text-emerald-400", children: [
960
1008
  e.action.success_message ?? "Completed",
961
1009
  " · ",
962
1010
  G(e.elapsedMs)
963
1011
  ] }),
964
1012
  e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */ p("dl", { className: "mt-2 max-h-40 space-y-0.5 overflow-y-auto rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: [
965
- Object.entries(e.resultSample).slice(0, 8).map(([s, m]) => /* @__PURE__ */ p("div", { className: "flex gap-2", children: [
966
- /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: E(s) }),
1013
+ Object.entries(e.resultSample).slice(0, 8).map(([i, m]) => /* @__PURE__ */ p("div", { className: "flex gap-2", children: [
1014
+ /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: L(i) }),
967
1015
  /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m ?? "—") })
968
- ] }, s)),
1016
+ ] }, i)),
969
1017
  e.resultRows > 1 && /* @__PURE__ */ p("p", { className: "pt-0.5 text-slate-400", children: [
970
1018
  "…",
971
1019
  e.resultRows,
@@ -976,13 +1024,13 @@ function pt({
976
1024
  "button",
977
1025
  {
978
1026
  type: "button",
979
- onClick: l,
1027
+ onClick: a,
980
1028
  className: "mt-3 h-8 w-full rounded-md border border-slate-200 text-[12.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300",
981
1029
  children: "Close"
982
1030
  }
983
1031
  )
984
1032
  ] }),
985
- e.phase === "error" && /* @__PURE__ */ p(Q, { children: [
1033
+ e.phase === "error" && /* @__PURE__ */ p(E, { children: [
986
1034
  /* @__PURE__ */ p("p", { className: "mt-2 text-[12.5px] font-medium text-red-600 dark:text-red-400", children: [
987
1035
  "Failed after ",
988
1036
  G(e.elapsedMs),
@@ -1003,7 +1051,7 @@ function pt({
1003
1051
  "button",
1004
1052
  {
1005
1053
  type: "button",
1006
- onClick: l,
1054
+ onClick: a,
1007
1055
  className: "h-8 rounded-md border border-slate-200 px-3 text-[12.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300",
1008
1056
  children: "Close"
1009
1057
  }
@@ -1017,124 +1065,124 @@ function pt({
1017
1065
  document.body
1018
1066
  );
1019
1067
  }
1020
- function ge({ slug: e, widget: r }) {
1021
- var l;
1068
+ function ve({ slug: e, widget: r }) {
1069
+ var a;
1022
1070
  switch (r.type) {
1023
1071
  case "table":
1024
- return /* @__PURE__ */ t(Ze, { slug: e, widget: r });
1072
+ return /* @__PURE__ */ t(st, { slug: e, widget: r });
1025
1073
  case "kpi":
1026
- return /* @__PURE__ */ t(et, { slug: e, widget: r });
1074
+ return /* @__PURE__ */ t(it, { slug: e, widget: r });
1027
1075
  case "markdown":
1028
- return /* @__PURE__ */ t(Xe, { content: String(((l = r.config) == null ? void 0 : l.content) ?? "") });
1076
+ return /* @__PURE__ */ t(nt, { content: String(((a = r.config) == null ? void 0 : a.content) ?? "") });
1029
1077
  case "iframe":
1030
- return /* @__PURE__ */ t(rt, { widget: r });
1078
+ return /* @__PURE__ */ t(dt, { widget: r });
1031
1079
  case "query":
1032
- return /* @__PURE__ */ t(ct, { widget: r });
1080
+ return /* @__PURE__ */ t(bt, { widget: r });
1033
1081
  case "matrix":
1034
- return /* @__PURE__ */ t(lt, { widget: r });
1082
+ return /* @__PURE__ */ t(ct, { widget: r });
1035
1083
  case "record-grid":
1036
- return /* @__PURE__ */ t(mt, { widget: r });
1084
+ return /* @__PURE__ */ t(gt, { widget: r });
1037
1085
  case "recent-activity":
1038
- return /* @__PURE__ */ t(tt, { slug: e, widget: r });
1086
+ return /* @__PURE__ */ t(ot, { slug: e, widget: r });
1039
1087
  default:
1040
1088
  return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Unknown widget" });
1041
1089
  }
1042
1090
  }
1043
- function Ot({ slug: e, hideHeader: r, className: l }) {
1044
- var q, M;
1045
- const n = z(), s = ye(), m = Ae("drill.page"), i = m.value, {
1046
- data: a,
1047
- isLoading: d,
1091
+ function It({ slug: e, hideHeader: r, className: a }) {
1092
+ var $, O;
1093
+ const n = D(), i = ke(), m = Ee("drill.page"), s = m.value, {
1094
+ data: l,
1095
+ isLoading: o,
1048
1096
  error: u
1049
- } = D({
1097
+ } = Q({
1050
1098
  queryKey: ["page-renderer", e],
1051
- queryFn: () => n.request(ve(`/pages/${e}`)).then((o) => o.data),
1099
+ queryFn: () => n.request(we(`/pages/${e}`)).then((d) => d.data),
1052
1100
  enabled: !!e,
1053
1101
  retry: !1
1054
1102
  });
1055
- if (d)
1056
- return /* @__PURE__ */ t("div", { className: l ?? "p-6", children: /* @__PURE__ */ t(H, {}) });
1057
- if (u || !a)
1103
+ if (o)
1104
+ return /* @__PURE__ */ t("div", { className: a ?? "p-6", children: /* @__PURE__ */ t(H, {}) });
1105
+ if (u || !l)
1058
1106
  return /* @__PURE__ */ p(
1059
1107
  "div",
1060
1108
  {
1061
- className: `flex flex-col items-center justify-center p-10 text-center ${l ?? ""}`,
1109
+ className: `flex flex-col items-center justify-center p-10 text-center ${a ?? ""}`,
1062
1110
  children: [
1063
1111
  /* @__PURE__ */ t("p", { className: "text-sm font-medium text-slate-600 dark:text-slate-300", children: "Page not found" }),
1064
1112
  /* @__PURE__ */ t("p", { className: "mt-1 text-xs text-slate-400", children: "This page does not exist or you do not have access to it." })
1065
1113
  ]
1066
1114
  }
1067
1115
  );
1068
- const x = ((q = a.layout) == null ? void 0 : q.columns) ?? 12, f = ((M = a.layout) == null ? void 0 : M.widgets) ?? [], w = (o) => {
1069
- var v;
1070
- return (o.type === "matrix" || o.type === "query" || o.type === "record-grid") && ((v = o.config) == null ? void 0 : v.display) === "drawer";
1071
- }, g = [...new Set(f.filter(w).map((o) => o.y))].filter((o) => f.every((v) => w(v) || o < v.y || o >= v.y + Math.max(v.h, 1))).sort((o, v) => o - v), _ = g.map((o) => ({
1072
- y: o,
1073
- items: f.filter((v) => v.y === o && w(v)).sort((v, B) => v.x - B.x)
1074
- })), A = f.filter((o) => !(w(o) && g.includes(o.y))), O = (o) => o - g.filter((v) => v < o).length, S = A.find((o) => {
1075
- var v;
1076
- return (v = o.config) == null ? void 0 : v.full_height;
1077
- }), $ = /* @__PURE__ */ p("div", { className: `flex h-full min-h-0 flex-col ${l ?? ""}`, children: [
1078
- !r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: a.name }) }),
1079
- /* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${S ? "flex flex-col" : ""}`, children: f.length === 0 ? /* @__PURE__ */ t("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ p(Q, { children: [
1080
- _.map((o) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: o.items.map((v) => /* @__PURE__ */ t(ge, { slug: a.slug, widget: v }, v.id)) }, o.y)),
1116
+ const x = (($ = l.layout) == null ? void 0 : $.columns) ?? 12, b = ((O = l.layout) == null ? void 0 : O.widgets) ?? [], N = (d) => {
1117
+ var y;
1118
+ return (d.type === "matrix" || d.type === "query" || d.type === "record-grid") && ((y = d.config) == null ? void 0 : y.display) === "drawer";
1119
+ }, S = [...new Set(b.filter(N).map((d) => d.y))].filter((d) => b.every((y) => N(y) || d < y.y || d >= y.y + Math.max(y.h, 1))).sort((d, y) => d - y), W = S.map((d) => ({
1120
+ y: d,
1121
+ items: b.filter((y) => y.y === d && N(y)).sort((y, F) => y.x - F.x)
1122
+ })), C = b.filter((d) => !(N(d) && S.includes(d.y))), j = (d) => d - S.filter((y) => y < d).length, R = C.find((d) => {
1123
+ var y;
1124
+ return (y = d.config) == null ? void 0 : y.full_height;
1125
+ }), w = /* @__PURE__ */ p("div", { className: `flex h-full min-h-0 flex-col ${a ?? ""}`, children: [
1126
+ !r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: l.name }) }),
1127
+ /* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${R ? "flex flex-col" : ""}`, children: b.length === 0 ? /* @__PURE__ */ t("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ p(E, { children: [
1128
+ W.map((d) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: d.items.map((y) => /* @__PURE__ */ t(ve, { slug: l.slug, widget: y }, y.id)) }, d.y)),
1081
1129
  /* @__PURE__ */ t(
1082
1130
  "div",
1083
1131
  {
1084
- className: S ? "grid min-h-0 flex-1 gap-4" : "grid gap-4",
1132
+ className: R ? "grid min-h-0 flex-1 gap-4" : "grid gap-4",
1085
1133
  style: {
1086
1134
  gridTemplateColumns: `repeat(${x}, minmax(0, 1fr))`,
1087
1135
  // repeat(0, …) is INVALID CSS (count must be ≥1) and drops the
1088
1136
  // whole declaration — a fill widget in the first row band emits
1089
1137
  // just the stretching track.
1090
- ...S ? {
1091
- gridTemplateRows: `${O(S.y) > 0 ? `repeat(${O(S.y)}, ${J}px) ` : ""}minmax(${J * 3}px, 1fr)`
1138
+ ...R ? {
1139
+ gridTemplateRows: `${j(R.y) > 0 ? `repeat(${j(R.y)}, ${X}px) ` : ""}minmax(${X * 3}px, 1fr)`
1092
1140
  } : {},
1093
- gridAutoRows: `${J}px`
1141
+ gridAutoRows: `${X}px`
1094
1142
  },
1095
- children: A.map((o) => {
1096
- var R, P, W, L;
1097
- const v = (o.type === "matrix" || o.type === "query" || o.type === "record-grid") && ((R = o.config) == null ? void 0 : R.display) === "drawer", B = o === S;
1143
+ children: C.map((d) => {
1144
+ var z, K, T, B;
1145
+ const y = (d.type === "matrix" || d.type === "query" || d.type === "record-grid") && ((z = d.config) == null ? void 0 : z.display) === "drawer", F = d === R;
1098
1146
  return /* @__PURE__ */ p(
1099
1147
  "div",
1100
1148
  {
1101
- className: v ? "flex min-h-0 flex-col" : "flex min-h-0 flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm dark:border-border dark:bg-card",
1149
+ className: y ? "flex min-h-0 flex-col" : "flex min-h-0 flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm dark:border-border dark:bg-card",
1102
1150
  style: {
1103
- gridColumn: `${Math.min(o.x, x - 1) + 1} / span ${Math.min(o.w, x)}`,
1104
- gridRow: B ? `${O(o.y) + 1} / -1` : `${O(o.y) + 1} / span ${Math.max(o.h, 1)}`
1151
+ gridColumn: `${Math.min(d.x, x - 1) + 1} / span ${Math.min(d.w, x)}`,
1152
+ gridRow: F ? `${j(d.y) + 1} / -1` : `${j(d.y) + 1} / span ${Math.max(d.h, 1)}`
1105
1153
  },
1106
1154
  children: [
1107
- !v && o.type !== "kpi" && o.type !== "markdown" && ((P = o.config) == null ? void 0 : P.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((W = o.config) == null ? void 0 : W.label) ?? "") || (typeof ((L = o.config) == null ? void 0 : L.collection) == "string" ? E(String(o.config.collection)) : E(o.type)) }),
1108
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(ge, { slug: a.slug, widget: o }) })
1155
+ !y && d.type !== "kpi" && d.type !== "markdown" && ((K = d.config) == null ? void 0 : K.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((T = d.config) == null ? void 0 : T.label) ?? "") || (typeof ((B = d.config) == null ? void 0 : B.collection) == "string" ? L(String(d.config.collection)) : L(d.type)) }),
1156
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(ve, { slug: l.slug, widget: d }) })
1109
1157
  ]
1110
1158
  },
1111
- o.id
1159
+ d.id
1112
1160
  );
1113
1161
  })
1114
1162
  }
1115
1163
  )
1116
1164
  ] }) })
1117
1165
  ] });
1118
- return s ? $ : /* @__PURE__ */ p(Pe.Provider, { value: { open: (o) => m.push([o]) }, children: [
1119
- i != null && i.length ? /* @__PURE__ */ t(
1120
- Ue,
1166
+ return i ? w : /* @__PURE__ */ p(Le.Provider, { value: { open: (d) => m.push([d]) }, children: [
1167
+ s != null && s.length ? /* @__PURE__ */ t(
1168
+ rt,
1121
1169
  {
1122
- collection: i[0].collection,
1123
- itemId: i[0].itemId,
1124
- layoutId: i[0].layoutId,
1125
- width: i[0].width,
1126
- title: i[0].title,
1127
- stack: i,
1128
- onPush: (o) => m.push([...i, o]),
1170
+ collection: s[0].collection,
1171
+ itemId: s[0].itemId,
1172
+ layoutId: s[0].layoutId,
1173
+ width: s[0].width,
1174
+ title: s[0].title,
1175
+ stack: s,
1176
+ onPush: (d) => m.push([...s, d]),
1129
1177
  onPop: () => m.back(),
1130
- onClose: () => m.back(i.length)
1178
+ onClose: () => m.back(s.length)
1131
1179
  }
1132
1180
  ) : null,
1133
- $
1181
+ w
1134
1182
  ] });
1135
1183
  }
1136
1184
  export {
1137
- Ot as PageRenderer,
1138
- we as QueryWidgetView,
1139
- mt as RecordGridWidgetBody
1185
+ It as PageRenderer,
1186
+ _e as QueryWidgetView,
1187
+ gt as RecordGridWidgetBody
1140
1188
  };