@nivaro/react 0.3.41 → 0.3.43

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 (97) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +733 -15
  5. package/dist/index.js +820 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/ProfileView.js +776 -1003
  20. package/dist/shared/components/RecentRecordsRail.js +34 -16
  21. package/dist/shared/components/RecordReadView.js +500 -477
  22. package/dist/shared/components/Skeletons.js +199 -0
  23. package/dist/shared/components/SlowNotice.js +63 -0
  24. package/dist/shared/components/Term.js +23 -0
  25. package/dist/shared/components/WidgetSlot.js +350 -353
  26. package/dist/shared/components/access/PermissionSummary.js +106 -0
  27. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  28. package/dist/shared/components/chat/ChatPanel.js +902 -886
  29. package/dist/shared/components/chat/MemberPaging.js +70 -0
  30. package/dist/shared/components/chat/RoomParts.js +147 -117
  31. package/dist/shared/components/chat/ScreenClip.js +73 -69
  32. package/dist/shared/components/chat/chat-core.js +449 -396
  33. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  34. package/dist/shared/components/help-videos/api.js +2 -5
  35. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  36. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  37. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  38. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  39. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  40. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  41. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  42. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  43. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  44. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  45. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  46. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  47. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  48. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  49. package/dist/shared/components/item-edit/field-sources.js +33 -0
  50. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  51. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  52. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  53. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  54. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  55. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  56. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  57. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  58. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  59. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  60. package/dist/shared/components/list/InlineEdit.js +363 -0
  61. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  62. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  63. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  64. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  65. package/dist/shared/components/notifications/changes-lines.js +24 -0
  66. package/dist/shared/components/notifications/why-lines.js +64 -0
  67. package/dist/shared/components/panels/CommentPanel.js +316 -281
  68. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  69. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  70. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  71. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  72. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  73. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  74. package/dist/shared/components/profile/PersonProfile.js +57 -52
  75. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  76. package/dist/shared/hooks/useSlowReason.js +39 -0
  77. package/dist/shared/lib/activity-sentence.js +670 -0
  78. package/dist/shared/lib/config-sentences.js +418 -0
  79. package/dist/shared/lib/core-glossary.js +229 -0
  80. package/dist/shared/lib/error-hints.js +159 -0
  81. package/dist/shared/lib/error-message.js +105 -0
  82. package/dist/shared/lib/error-toast.js +22 -0
  83. package/dist/shared/lib/field-comments.js +25 -0
  84. package/dist/shared/lib/filter-sentence.js +261 -0
  85. package/dist/shared/lib/glossary.js +55 -48
  86. package/dist/shared/lib/idle-reload.js +138 -0
  87. package/dist/shared/lib/layout-resolve.js +42 -29
  88. package/dist/shared/lib/list-inline-edit.js +190 -0
  89. package/dist/shared/lib/list-link.js +147 -0
  90. package/dist/shared/lib/nav-trail.js +107 -0
  91. package/dist/shared/lib/prefetch.js +259 -106
  92. package/dist/shared/lib/record-ref.js +72 -0
  93. package/dist/shared/lib/reload-holds.js +25 -0
  94. package/dist/shared/lib/safe-error.js +52 -24
  95. package/dist/shared/lib/skeleton-shapes.js +72 -0
  96. package/dist/shared/lib/slow-reason.js +63 -0
  97. package/package.json +1 -1
@@ -1,90 +1,91 @@
1
- import { jsx as t, jsxs as b, Fragment as be } from "react/jsx-runtime";
2
- import { useQueryClient as Qe, useQuery as Ge } from "@tanstack/react-query";
3
- import { AlertTriangle as Ve, RefreshCw as Fe, MoreVertical as Xe, MoreHorizontal as Ye, Clipboard as Ze, Copy as et, Clock as tt, Calendar as rt, Paperclip as nt, Folder as lt, File as at, FileText as it, Bell as st, Phone as ot, MessageSquare as ct, Mail as dt, UserCheck as ut, UserPlus as pt, Users as ft, User as mt, Activity as ht, Zap as gt, Power as yt, Search as bt, Filter as wt, Sliders as xt, Settings as vt, RotateCcw as _t, Pause as Nt, Play as kt, HelpCircle as St, Info as Rt, AlertCircle as Lt, Flag as $t, Bookmark as Ct, Heart as Et, Star as jt, Unlock as Tt, Lock as Ot, EyeOff as It, Eye as Dt, Send as qt, Upload as Ut, Download as At, Save as Pt, Trash2 as Wt, Edit2 as Mt, Edit as Bt, Minus as Ht, Plus as Vt, XCircle as Ft, X as Jt, CheckCircle as zt, Check as Kt, Share2 as Qt, Link as Gt, ExternalLink as Xt, ArrowUpRight as Yt, ArrowDown as Zt, ArrowUp as er, ArrowLeft as tr, ArrowRight as rr } from "lucide-react";
4
- import { useState as P, useRef as le, useCallback as Oe, useEffect as Y, useMemo as Ie } from "react";
5
- import { useApiFetchConfig as we, useDrilldown as nr, useOptionalNivaroClient as lr } from "../context.js";
6
- import { useDebounced as ar } from "../hooks/useDebounced.js";
7
- import { PRETEND_DOWN_EVENT as De } from "../lib/client-chaos.js";
8
- import { get as ir, post as sr } from "../lib/commands.js";
9
- import { HEADER_CELL_DENSE as or, HEADER_CELL_LIST as cr, HEADER_LABEL as dr, HEADER_VALUE_LINE as ur, HEADER_VALUE_HERO as pr, HEADER_VALUE as fr } from "../lib/header-strip.js";
10
- import { loadErrorText as qe } from "../lib/load-error.js";
11
- import { affixesFor as ae, formatWidgetValue as ie } from "../lib/widget-value-format.js";
12
- import { BackgroundRunOffer as mr } from "./BackgroundRunOffer.js";
13
- import { cacheStampTip as hr, CacheStamp as gr } from "./CacheStamp.js";
14
- import { useStagedRelations as yr } from "./item-edit/O2MStagingContext.js";
15
- import { LoadErrorNote as Ue } from "./LoadErrorNote.js";
16
- import { QueryTable as br } from "./QueryTable.js";
17
- import { Button as ne } from "./ui/button.js";
18
- import { DropdownMenu as Ae, DropdownMenuTrigger as Pe, DropdownMenuContent as We, DropdownMenuItem as Me } from "./ui/dropdown-menu.js";
19
- import { reportSlotScalar as wr, ReportSlotWidget as xr } from "./widgets/ReportSlotWidget.js";
20
- import { ReviewListWidget as vr } from "./widgets/ReviewListWidget.js";
21
- import { RollupWidget as _r } from "./widgets/RollupWidget.js";
1
+ import { jsx as t, jsxs as x, Fragment as we } from "react/jsx-runtime";
2
+ import { useQueryClient as Xe, useQuery as Ye } from "@tanstack/react-query";
3
+ import { AlertTriangle as Je, RefreshCw as ze, MoreVertical as Ze, MoreHorizontal as et, Clipboard as tt, Copy as rt, Clock as nt, Calendar as lt, Paperclip as it, Folder as at, File as st, FileText as ot, Bell as ct, Phone as dt, MessageSquare as ut, Mail as ft, UserCheck as pt, UserPlus as mt, Users as ht, User as gt, Activity as yt, Zap as xt, Power as bt, Search as wt, Filter as vt, Sliders as _t, Settings as Nt, RotateCcw as kt, Pause as St, Play as Rt, HelpCircle as Lt, Info as $t, AlertCircle as Ct, Flag as Et, Bookmark as Tt, Heart as jt, Star as Ot, Unlock as It, Lock as Dt, EyeOff as qt, Eye as Ut, Send as At, Upload as Pt, Download as Wt, Save as Mt, Trash2 as Bt, Edit2 as Ht, Edit as Vt, Minus as Ft, Plus as Jt, XCircle as zt, X as Kt, CheckCircle as Qt, Check as Gt, Share2 as Xt, Link as Yt, ExternalLink as Zt, ArrowUpRight as er, ArrowDown as tr, ArrowUp as rr, ArrowLeft as nr, ArrowRight as lr } from "lucide-react";
4
+ import { useState as P, useRef as ie, useCallback as De, useEffect as Y, useMemo as qe } from "react";
5
+ import { useApiFetchConfig as ve, useDrilldown as ir, useOptionalNivaroClient as ar } from "../context.js";
6
+ import { useDebounced as sr } from "../hooks/useDebounced.js";
7
+ import { PRETEND_DOWN_EVENT as Ue } from "../lib/client-chaos.js";
8
+ import { get as or, post as cr } from "../lib/commands.js";
9
+ import { HEADER_CELL_DENSE as dr, HEADER_CELL_LIST as ur, HEADER_LABEL as fr, HEADER_VALUE_LINE as pr, HEADER_VALUE_HERO as mr, HEADER_VALUE as hr } from "../lib/header-strip.js";
10
+ import { loadErrorText as Ae } from "../lib/load-error.js";
11
+ import { affixesFor as ae, formatWidgetValue as se } from "../lib/widget-value-format.js";
12
+ import { BackgroundRunOffer as gr } from "./BackgroundRunOffer.js";
13
+ import { cacheStampTip as yr, CacheStamp as xr } from "./CacheStamp.js";
14
+ import { useStagedRelations as br } from "./item-edit/O2MStagingContext.js";
15
+ import { LoadErrorNote as Pe } from "./LoadErrorNote.js";
16
+ import { QueryTable as wr } from "./QueryTable.js";
17
+ import { CardSkeleton as he } from "./Skeletons.js";
18
+ import { Button as le } from "./ui/button.js";
19
+ import { DropdownMenu as We, DropdownMenuTrigger as Me, DropdownMenuContent as Be, DropdownMenuItem as He } from "./ui/dropdown-menu.js";
20
+ import { reportSlotScalar as vr, ReportSlotWidget as _r } from "./widgets/ReportSlotWidget.js";
21
+ import { ReviewListWidget as Nr } from "./widgets/ReviewListWidget.js";
22
+ import { RollupWidget as kr } from "./widgets/RollupWidget.js";
22
23
  const Q = {
23
- ArrowRight: rr,
24
- ArrowLeft: tr,
25
- ArrowUp: er,
26
- ArrowDown: Zt,
27
- ArrowUpRight: Yt,
28
- ExternalLink: Xt,
29
- Link: Gt,
30
- Share2: Qt,
31
- Check: Kt,
32
- CheckCircle: zt,
33
- X: Jt,
34
- XCircle: Ft,
35
- Plus: Vt,
36
- Minus: Ht,
37
- Edit: Bt,
38
- Edit2: Mt,
39
- Trash2: Wt,
40
- Save: Pt,
41
- Download: At,
42
- Upload: Ut,
43
- Send: qt,
44
- Eye: Dt,
45
- EyeOff: It,
46
- Lock: Ot,
47
- Unlock: Tt,
48
- Star: jt,
49
- Heart: Et,
50
- Bookmark: Ct,
51
- Flag: $t,
52
- AlertCircle: Lt,
53
- AlertTriangle: Ve,
54
- Info: Rt,
55
- HelpCircle: St,
56
- Play: kt,
57
- Pause: Nt,
58
- RefreshCw: Fe,
59
- RotateCcw: _t,
60
- Settings: vt,
61
- Sliders: xt,
62
- Filter: wt,
63
- Search: bt,
64
- Power: yt,
65
- Zap: gt,
66
- Activity: ht,
67
- User: mt,
68
- Users: ft,
69
- UserPlus: pt,
70
- UserCheck: ut,
71
- Mail: dt,
72
- MessageSquare: ct,
73
- Phone: ot,
74
- Bell: st,
75
- FileText: it,
76
- File: at,
77
- Folder: lt,
78
- Paperclip: nt,
79
- Calendar: rt,
80
- Clock: tt,
81
- Copy: et,
82
- Clipboard: Ze,
83
- MoreHorizontal: Ye,
84
- MoreVertical: Xe
24
+ ArrowRight: lr,
25
+ ArrowLeft: nr,
26
+ ArrowUp: rr,
27
+ ArrowDown: tr,
28
+ ArrowUpRight: er,
29
+ ExternalLink: Zt,
30
+ Link: Yt,
31
+ Share2: Xt,
32
+ Check: Gt,
33
+ CheckCircle: Qt,
34
+ X: Kt,
35
+ XCircle: zt,
36
+ Plus: Jt,
37
+ Minus: Ft,
38
+ Edit: Vt,
39
+ Edit2: Ht,
40
+ Trash2: Bt,
41
+ Save: Mt,
42
+ Download: Wt,
43
+ Upload: Pt,
44
+ Send: At,
45
+ Eye: Ut,
46
+ EyeOff: qt,
47
+ Lock: Dt,
48
+ Unlock: It,
49
+ Star: Ot,
50
+ Heart: jt,
51
+ Bookmark: Tt,
52
+ Flag: Et,
53
+ AlertCircle: Ct,
54
+ AlertTriangle: Je,
55
+ Info: $t,
56
+ HelpCircle: Lt,
57
+ Play: Rt,
58
+ Pause: St,
59
+ RefreshCw: ze,
60
+ RotateCcw: kt,
61
+ Settings: Nt,
62
+ Sliders: _t,
63
+ Filter: vt,
64
+ Search: wt,
65
+ Power: bt,
66
+ Zap: xt,
67
+ Activity: yt,
68
+ User: gt,
69
+ Users: ht,
70
+ UserPlus: mt,
71
+ UserCheck: pt,
72
+ Mail: ft,
73
+ MessageSquare: ut,
74
+ Phone: dt,
75
+ Bell: ct,
76
+ FileText: ot,
77
+ File: st,
78
+ Folder: at,
79
+ Paperclip: it,
80
+ Calendar: lt,
81
+ Clock: nt,
82
+ Copy: rt,
83
+ Clipboard: tt,
84
+ MoreHorizontal: et,
85
+ MoreVertical: Ze
85
86
  };
86
- function xe({ awaiting: l, dark: s }) {
87
- return /* @__PURE__ */ b(
87
+ function _e({ awaiting: l, dark: s }) {
88
+ return /* @__PURE__ */ x(
88
89
  "span",
89
90
  {
90
91
  className: `text-[12px] font-normal italic ${s ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
@@ -97,35 +98,35 @@ function xe({ awaiting: l, dark: s }) {
97
98
  }
98
99
  );
99
100
  }
100
- function me({
101
+ function ge({
101
102
  label: l,
102
103
  value: s,
103
104
  display: o,
104
- loading: a,
105
+ loading: i,
105
106
  awaiting: c
106
107
  }) {
107
- const { prefix: m, suffix: v } = ae(s, o), w = a ? null : ie(s, o.format ?? "");
108
+ const { prefix: m, suffix: v } = ae(s, o), b = i ? null : se(s, o.format ?? "");
108
109
  return (
109
110
  // Same label / value vocabulary as a field tile in the record sub-header
110
111
  // (lib/header-strip.ts) — the two kinds of cell read as one row.
111
- /* @__PURE__ */ b(
112
+ /* @__PURE__ */ x(
112
113
  "div",
113
114
  {
114
- className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${or} ${cr}`,
115
+ className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${dr} ${ur}`,
115
116
  children: [
116
- /* @__PURE__ */ t("span", { className: dr, "data-header-label": !0, children: l }),
117
+ /* @__PURE__ */ t("span", { className: fr, "data-header-label": !0, children: l }),
117
118
  /* @__PURE__ */ t(
118
119
  "span",
119
120
  {
120
121
  "data-header-value": !0,
121
- className: `${ur} max-w-[232px] items-baseline truncate leading-tight`,
122
- children: a ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : c && s == null ? /* @__PURE__ */ t(xe, { awaiting: c }) : /* @__PURE__ */ b(
122
+ className: `${pr} max-w-[232px] items-baseline truncate leading-tight`,
123
+ children: i ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : c && s == null ? /* @__PURE__ */ t(_e, { awaiting: c }) : /* @__PURE__ */ x(
123
124
  "span",
124
125
  {
125
- className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ? pr : fr,
126
+ className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ? mr : hr,
126
127
  children: [
127
128
  m,
128
- w,
129
+ b,
129
130
  v
130
131
  ]
131
132
  }
@@ -137,18 +138,18 @@ function me({
137
138
  )
138
139
  );
139
140
  }
140
- function Nr({
141
+ function Sr({
141
142
  data: l,
142
143
  label: s,
143
144
  loading: o,
144
- widgetConfig: a,
145
+ widgetConfig: i,
145
146
  awaiting: c
146
147
  }) {
147
148
  const m = "h-full flex items-stretch divide-x divide-slate-200 dark:divide-border [[data-header-list]_&]:w-full [[data-header-list]_&]:flex-col [[data-header-list]_&]:divide-x-0";
148
149
  if (l && "values" in l) {
149
- const w = l.values ?? [];
150
- return w.length === 0 ? null : /* @__PURE__ */ t("div", { className: m, children: w.map((_, R) => /* @__PURE__ */ t(
151
- me,
150
+ const b = l.values ?? [];
151
+ return b.length === 0 ? null : /* @__PURE__ */ t("div", { className: m, children: b.map((_, R) => /* @__PURE__ */ t(
152
+ ge,
152
153
  {
153
154
  label: _.label,
154
155
  value: _.value,
@@ -160,9 +161,9 @@ function Nr({
160
161
  )) });
161
162
  }
162
163
  if (o) {
163
- const w = (a == null ? void 0 : a.value_fields) ?? [], _ = w.length > 0 ? w : [{ label: s }];
164
+ const b = (i == null ? void 0 : i.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: s }];
164
165
  return /* @__PURE__ */ t("div", { className: m, children: _.map((R, $) => /* @__PURE__ */ t(
165
- me,
166
+ ge,
166
167
  {
167
168
  label: R.label ?? s,
168
169
  display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
@@ -174,7 +175,7 @@ function Nr({
174
175
  if (!l) return null;
175
176
  const v = l.display ?? {};
176
177
  return /* @__PURE__ */ t("div", { className: m, children: /* @__PURE__ */ t(
177
- me,
178
+ ge,
178
179
  {
179
180
  label: s,
180
181
  value: l.value,
@@ -184,89 +185,89 @@ function Nr({
184
185
  }
185
186
  ) });
186
187
  }
187
- function kr(l, s) {
188
+ function Rr(l, s) {
188
189
  if (Object.hasOwn(l, s)) return l[s] ?? null;
189
190
  const o = s.split(".");
190
- let a = l;
191
+ let i = l;
191
192
  for (const c of o) {
192
- if (a == null || typeof a != "object") return a ?? null;
193
- a = a[c];
193
+ if (i == null || typeof i != "object") return i ?? null;
194
+ i = i[c];
194
195
  }
195
- return a ?? null;
196
+ return i ?? null;
196
197
  }
197
- function Sr(l, s) {
198
+ function Lr(l, s) {
198
199
  const o = {};
199
- for (const a of l)
200
- if (a.binding_type === "item_field")
201
- o[a.key] = kr(s, a.binding_value);
202
- else if (a.binding_type === "static")
203
- o[a.key] = a.binding_value;
204
- else if (a.binding_type === "url_param" && typeof window < "u") {
200
+ for (const i of l)
201
+ if (i.binding_type === "item_field")
202
+ o[i.key] = Rr(s, i.binding_value);
203
+ else if (i.binding_type === "static")
204
+ o[i.key] = i.binding_value;
205
+ else if (i.binding_type === "url_param" && typeof window < "u") {
205
206
  const c = new URLSearchParams(window.location.search);
206
- o[a.key] = c.get(a.binding_value) ?? null;
207
+ o[i.key] = c.get(i.binding_value) ?? null;
207
208
  }
208
209
  return o;
209
210
  }
210
- function he({
211
+ function ye({
211
212
  data: l,
212
213
  awaiting: s
213
214
  }) {
214
- if (s && l.value == null) return /* @__PURE__ */ t(xe, { awaiting: s });
215
- const o = l.display ?? {}, { prefix: a, suffix: c } = ae(l.value, o), m = ie(l.value, o.format ?? "");
216
- return /* @__PURE__ */ b("div", { className: "flex items-baseline gap-1", children: [
217
- a && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: a }),
215
+ if (s && l.value == null) return /* @__PURE__ */ t(_e, { awaiting: s });
216
+ const o = l.display ?? {}, { prefix: i, suffix: c } = ae(l.value, o), m = se(l.value, o.format ?? "");
217
+ return /* @__PURE__ */ x("div", { className: "flex items-baseline gap-1", children: [
218
+ i && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: i }),
218
219
  /* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: m }),
219
220
  c && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: c })
220
221
  ] });
221
222
  }
222
- function ge({
223
+ function xe({
223
224
  label: l,
224
225
  value: s,
225
226
  display: o,
226
- dark: a,
227
+ dark: i,
227
228
  loading: c,
228
229
  awaiting: m
229
230
  }) {
230
- const { prefix: v, suffix: w } = ae(s, o), _ = c ? null : ie(s, o.format ?? "");
231
- return /* @__PURE__ */ b("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
231
+ const { prefix: v, suffix: b } = ae(s, o), _ = c ? null : se(s, o.format ?? "");
232
+ return /* @__PURE__ */ x("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
232
233
  /* @__PURE__ */ t(
233
234
  "span",
234
235
  {
235
- className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${a ? "text-slate-500" : "text-slate-400"}`,
236
+ className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${i ? "text-slate-500" : "text-slate-400"}`,
236
237
  children: l
237
238
  }
238
239
  ),
239
240
  /* @__PURE__ */ t(
240
241
  "span",
241
242
  {
242
- className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${a ? "text-slate-100" : "text-slate-900"}`,
243
+ className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${i ? "text-slate-100" : "text-slate-900"}`,
243
244
  children: c ? /* @__PURE__ */ t(
244
245
  "span",
245
246
  {
246
- className: `animate-pulse inline-block h-3 w-14 rounded ${a ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
247
+ className: `animate-pulse inline-block h-3 w-14 rounded ${i ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
247
248
  }
248
- ) : m && s == null ? /* @__PURE__ */ t(xe, { awaiting: m, dark: a }) : /* @__PURE__ */ b(be, { children: [
249
- v && /* @__PURE__ */ t("span", { className: `text-[10px] ${a ? "text-slate-400" : "text-slate-500"}`, children: v }),
249
+ ) : m && s == null ? /* @__PURE__ */ t(_e, { awaiting: m, dark: i }) : /* @__PURE__ */ x(we, { children: [
250
+ v && /* @__PURE__ */ t("span", { className: `text-[10px] ${i ? "text-slate-400" : "text-slate-500"}`, children: v }),
250
251
  _,
251
- w && /* @__PURE__ */ t("span", { className: `text-[10px] ${a ? "text-slate-400" : "text-slate-500"}`, children: w })
252
+ b && /* @__PURE__ */ t("span", { className: `text-[10px] ${i ? "text-slate-400" : "text-slate-500"}`, children: b })
252
253
  ] })
253
254
  }
254
255
  )
255
256
  ] });
256
257
  }
257
- function Rr({
258
+ function $r({
258
259
  data: l,
259
260
  label: s,
260
261
  style: o,
261
- loading: a,
262
+ loading: i,
262
263
  widgetConfig: c,
263
264
  awaiting: m
264
265
  }) {
265
- const v = o === "pill-dark", w = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
266
+ const v = o === "pill-dark", b = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
266
267
  if (l && "values" in l) {
267
268
  const R = l.values ?? [];
268
- return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: w, children: R.map(($, k) => /* @__PURE__ */ t(
269
- ge,
269
+ return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: b, children: R.map(($, k) => /* @__PURE__ */ t(
270
+ xe,
270
271
  {
271
272
  label: $.label,
272
273
  value: $.value,
@@ -278,10 +279,10 @@ function Rr({
278
279
  k
279
280
  )) });
280
281
  }
281
- if (a) {
282
+ if (i) {
282
283
  const R = (c == null ? void 0 : c.value_fields) ?? [], $ = R.length > 0 ? R : [{ label: s }];
283
- return /* @__PURE__ */ t("div", { className: w, children: $.map((k, U) => /* @__PURE__ */ t(
284
- ge,
284
+ return /* @__PURE__ */ t("div", { className: b, children: $.map((k, U) => /* @__PURE__ */ t(
285
+ xe,
285
286
  {
286
287
  label: k.label ?? s,
287
288
  display: { prefix: k.prefix ?? "", suffix: k.suffix ?? "", format: k.format ?? "" },
@@ -293,8 +294,8 @@ function Rr({
293
294
  }
294
295
  if (!l) return null;
295
296
  const _ = l.display ?? {};
296
- return /* @__PURE__ */ t("div", { className: w, children: /* @__PURE__ */ t(
297
- ge,
297
+ return /* @__PURE__ */ t("div", { className: b, children: /* @__PURE__ */ t(
298
+ xe,
298
299
  {
299
300
  label: s,
300
301
  value: l.value,
@@ -305,46 +306,46 @@ function Rr({
305
306
  }
306
307
  ) });
307
308
  }
308
- function Be({ data: l }) {
309
+ function Ve({ data: l }) {
309
310
  const s = l.values ?? [];
310
311
  return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
311
312
  "div",
312
313
  {
313
314
  className: "grid gap-3",
314
315
  style: { gridTemplateColumns: `repeat(${Math.min(s.length, 3)}, minmax(0, 1fr))` },
315
- children: s.map((o, a) => {
316
- var w;
317
- const { prefix: c, suffix: m } = ae(o.value, o.display), v = ((w = o.display) == null ? void 0 : w.format) ?? "";
318
- return /* @__PURE__ */ b("div", { className: "flex flex-col gap-0.5", children: [
316
+ children: s.map((o, i) => {
317
+ var b;
318
+ const { prefix: c, suffix: m } = ae(o.value, o.display), v = ((b = o.display) == null ? void 0 : b.format) ?? "";
319
+ return /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
319
320
  o.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: o.label }),
320
- /* @__PURE__ */ b("div", { className: "flex items-baseline gap-0.5", children: [
321
+ /* @__PURE__ */ x("div", { className: "flex items-baseline gap-0.5", children: [
321
322
  c && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: c }),
322
- /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: ie(o.value, v) }),
323
+ /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: se(o.value, v) }),
323
324
  m && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: m })
324
325
  ] })
325
- ] }, a);
326
+ ] }, i);
326
327
  })
327
328
  }
328
329
  );
329
330
  }
330
- function Lr({ data: l }) {
331
+ function Cr({ data: l }) {
331
332
  const s = l.rows ?? [], o = l.fields ?? [];
332
- return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ b("table", { className: "w-full text-[12px]", children: [
333
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((a) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: a }, a)) }) }),
334
- /* @__PURE__ */ t("tbody", { children: s.map((a, c) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: o.map((m) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(a[m] ?? "") }, m)) }, c)) })
333
+ return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ x("table", { className: "w-full text-[12px]", children: [
334
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((i) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: i }, i)) }) }),
335
+ /* @__PURE__ */ t("tbody", { children: s.map((i, c) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: o.map((m) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(i[m] ?? "") }, m)) }, c)) })
335
336
  ] }) });
336
337
  }
337
- function He({
338
+ function Fe({
338
339
  data: l,
339
340
  widgetId: s,
340
341
  inputs: o,
341
- apiBase: a,
342
+ apiBase: i,
342
343
  onAction: c
343
344
  }) {
344
- const m = l.buttons ?? [], [v, w] = P(null), _ = we(), R = async ($) => {
345
- w($);
345
+ const m = l.buttons ?? [], [v, b] = P(null), _ = ve(), R = async ($) => {
346
+ b($);
346
347
  try {
347
- const k = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${a}/widgets-internal/${s}/action`, {
348
+ const k = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${i}/widgets-internal/${s}/action`, {
348
349
  method: "POST",
349
350
  headers: {
350
351
  "Content-Type": "application/json",
@@ -362,7 +363,7 @@ function He({
362
363
  }
363
364
  c == null || c(C);
364
365
  } finally {
365
- w(null);
366
+ b(null);
366
367
  }
367
368
  };
368
369
  return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: m.map(($, k) => {
@@ -380,50 +381,50 @@ function He({
380
381
  );
381
382
  }) });
382
383
  }
383
- const $r = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
384
- function ye({
384
+ const Er = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
385
+ function be({
385
386
  buttons: l,
386
387
  layout: s,
387
388
  widgetId: o,
388
- inputs: a,
389
+ inputs: i,
389
390
  apiBase: c,
390
391
  onClientAction: m
391
392
  }) {
392
- const [v, w] = P(null), [_, R] = P(null), [$, k] = P({}), U = le(null), q = we();
393
+ const [v, b] = P(null), [_, R] = P(null), [$, k] = P({}), U = ie(null), q = ve();
393
394
  function C(e) {
394
395
  return e === !0 || e === 1 ? "1" : e === !1 || e === 0 ? "0" : String(e ?? "");
395
396
  }
396
- function E(e, p) {
397
- const u = e.id ?? String(p);
398
- return $[u] !== void 0 ? $[u] : e.is_on !== void 0 ? e.is_on : C(a[e.toggle_input ?? ""]) === C(e.toggle_on_value ?? "1");
397
+ function E(e, f) {
398
+ const u = e.id ?? String(f);
399
+ return $[u] !== void 0 ? $[u] : e.is_on !== void 0 ? e.is_on : C(i[e.toggle_input ?? ""]) === C(e.toggle_on_value ?? "1");
399
400
  }
400
- function G(e, p) {
401
- if (e.action !== "toggle") return e.label ?? `Action ${p + 1}`;
402
- const u = e.action_config, f = e.toggle_input || (u == null ? void 0 : u.toggle_input) || (u == null ? void 0 : u.field) || "", j = f && f !== e.toggle_input ? { ...e, toggle_input: f } : e;
403
- return E(j, p) ? e.label_on || e.label || `Action ${p + 1}` : e.label_off || e.label || `Action ${p + 1}`;
401
+ function G(e, f) {
402
+ if (e.action !== "toggle") return e.label ?? `Action ${f + 1}`;
403
+ const u = e.action_config, p = e.toggle_input || (u == null ? void 0 : u.toggle_input) || (u == null ? void 0 : u.field) || "", T = p && p !== e.toggle_input ? { ...e, toggle_input: p } : e;
404
+ return E(T, f) ? e.label_on || e.label || `Action ${f + 1}` : e.label_off || e.label || `Action ${f + 1}`;
404
405
  }
405
- function se(e) {
406
+ function oe(e) {
406
407
  try {
407
408
  if (e.startsWith("/") && !e.startsWith("//")) return e;
408
- const p = new URL(e, window.location.origin);
409
- return ["http:", "https:"].includes(p.protocol) ? p.toString() : null;
409
+ const f = new URL(e, window.location.origin);
410
+ return ["http:", "https:"].includes(f.protocol) ? f.toString() : null;
410
411
  } catch {
411
412
  return null;
412
413
  }
413
414
  }
414
- async function r(e, p) {
415
- const u = e.id ?? String(p);
415
+ async function r(e, f) {
416
+ const u = e.id ?? String(f);
416
417
  R(u);
417
418
  try {
418
- const f = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", g = (await (await fetch(`${c}/widgets-internal/${o}/action`, {
419
+ const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", g = (await (await fetch(`${c}/widgets-internal/${o}/action`, {
419
420
  method: "POST",
420
421
  headers: {
421
422
  "Content-Type": "application/json",
422
423
  ...q.authHeaders,
423
- ...f ? { "x-workspace": f } : {}
424
+ ...p ? { "x-workspace": p } : {}
424
425
  },
425
426
  credentials: q.credentials,
426
- body: JSON.stringify({ button_index: p, inputs: a })
427
+ body: JSON.stringify({ button_index: f, inputs: i })
427
428
  })).json()).data;
428
429
  if (g != null && g.redirect_url)
429
430
  try {
@@ -435,27 +436,27 @@ function ye({
435
436
  R(null);
436
437
  }
437
438
  }
438
- function z(e, p) {
439
+ function z(e, f) {
439
440
  const u = e.action ?? "open-url";
440
- if ($r.has(u)) {
441
+ if (Er.has(u)) {
441
442
  if (u === "toggle") {
442
- const f = e.id ?? String(p);
443
- k((j) => ({ ...j, [f]: !E(e, p) }));
443
+ const p = e.id ?? String(f);
444
+ k((T) => ({ ...T, [p]: !E(e, f) }));
444
445
  }
445
- r(e, p);
446
+ r(e, f);
446
447
  return;
447
448
  }
448
449
  if (u === "open-url" && e.url) {
449
- const f = se(e.url);
450
- if (!f) return;
451
- e.new_tab ? window.open(f, "_blank", "noopener,noreferrer") : window.location.href = f;
450
+ const p = oe(e.url);
451
+ if (!p) return;
452
+ e.new_tab ? window.open(p, "_blank", "noopener,noreferrer") : window.location.href = p;
452
453
  } else if (u === "email") {
453
- const f = [];
454
- e.email_subject && f.push(`subject=${encodeURIComponent(e.email_subject)}`), e.email_body && f.push(`body=${encodeURIComponent(e.email_body)}`), window.location.href = `mailto:${e.email_to ?? ""}${f.length ? `?${f.join("&")}` : ""}`;
454
+ const p = [];
455
+ e.email_subject && p.push(`subject=${encodeURIComponent(e.email_subject)}`), e.email_body && p.push(`body=${encodeURIComponent(e.email_body)}`), window.location.href = `mailto:${e.email_to ?? ""}${p.length ? `?${p.join("&")}` : ""}`;
455
456
  } else if (u === "copy") {
456
- const f = e.copy_value ?? "";
457
- navigator.clipboard.writeText(f).then(() => {
458
- w(e.id ?? String(p)), U.current && clearTimeout(U.current), U.current = setTimeout(() => w(null), 1800);
457
+ const p = e.copy_value ?? "";
458
+ navigator.clipboard.writeText(p).then(() => {
459
+ b(e.id ?? String(f)), U.current && clearTimeout(U.current), U.current = setTimeout(() => b(null), 1800);
459
460
  });
460
461
  } else u === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (m == null || m({
461
462
  type: "open-sidebar",
@@ -463,27 +464,27 @@ function ye({
463
464
  itemId: e.sidebar_id
464
465
  }));
465
466
  }
466
- function i(e) {
467
- const p = e.replace("#", "");
468
- if (p.length < 6) return !0;
469
- const u = parseInt(p.slice(0, 2), 16), f = parseInt(p.slice(2, 4), 16), j = parseInt(p.slice(4, 6), 16);
470
- return (u * 299 + f * 587 + j * 114) / 1e3 > 128;
467
+ function a(e) {
468
+ const f = e.replace("#", "");
469
+ if (f.length < 6) return !0;
470
+ const u = parseInt(f.slice(0, 2), 16), p = parseInt(f.slice(2, 4), 16), T = parseInt(f.slice(4, 6), 16);
471
+ return (u * 299 + p * 587 + T * 114) / 1e3 > 128;
471
472
  }
472
- function Z(e, p, u) {
473
- const f = e.id ?? String(p), j = v === f, A = _ === f;
473
+ function Z(e, f, u) {
474
+ const p = e.id ?? String(f), T = v === p, A = _ === p;
474
475
  let g = e.label ?? "Button", N = e.variant ?? "secondary";
475
476
  const W = e.action_config, D = e.toggle_input || (W == null ? void 0 : W.toggle_input) || (W == null ? void 0 : W.field) || "";
476
477
  if (e.action === "toggle") {
477
- const O = D && D !== e.toggle_input ? { ...e, toggle_input: D } : e, V = E(O, p);
478
+ const O = D && D !== e.toggle_input ? { ...e, toggle_input: D } : e, V = E(O, f);
478
479
  g = V ? e.label_on || g : e.label_off || g, N = V ? e.variant_on ?? N : e.variant_off ?? N;
479
480
  }
480
481
  const H = e.icon ? Q[e.icon] : null, L = e.color ? {
481
482
  backgroundColor: e.color,
482
483
  borderColor: e.color,
483
- color: i(e.color) ? "#1e293b" : "#ffffff"
484
+ color: a(e.color) ? "#1e293b" : "#ffffff"
484
485
  } : void 0;
485
- return /* @__PURE__ */ b(
486
- ne,
486
+ return /* @__PURE__ */ x(
487
+ le,
487
488
  {
488
489
  type: "button",
489
490
  variant: N,
@@ -491,18 +492,18 @@ function ye({
491
492
  className: "h-7 gap-1.5 text-[12px]",
492
493
  style: L,
493
494
  disabled: _ !== null,
494
- onClick: () => z(e, p),
495
+ onClick: () => z(e, f),
495
496
  children: [
496
497
  H && /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5 shrink-0" }),
497
- A ? "…" : j ? "✓ Copied" : g
498
+ A ? "…" : T ? "✓ Copied" : g
498
499
  ]
499
500
  },
500
- f
501
+ p
501
502
  );
502
503
  }
503
504
  if (l.length === 0) return null;
504
505
  if (s === "split" && l.length > 1) {
505
- const [e, ...p] = l, u = e.id ?? "0", f = _ === u, j = e.action === "none" || !e.action;
506
+ const [e, ...f] = l, u = e.id ?? "0", p = _ === u, T = e.action === "none" || !e.action;
506
507
  let A = e.label ?? "Button", g = e.variant ?? "default";
507
508
  const N = e.action_config, W = e.toggle_input || (N == null ? void 0 : N.toggle_input) || (N == null ? void 0 : N.field) || "";
508
509
  if (e.action === "toggle" && W) {
@@ -512,11 +513,11 @@ function ye({
512
513
  const D = e.icon ? Q[e.icon] : null, H = e.color ? {
513
514
  backgroundColor: e.color,
514
515
  borderColor: e.color,
515
- color: i(e.color) ? "#1e293b" : "#ffffff"
516
+ color: a(e.color) ? "#1e293b" : "#ffffff"
516
517
  } : void 0;
517
- return j ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ b(Ae, { children: [
518
- /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ b(
519
- ne,
518
+ return T ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ x(We, { children: [
519
+ /* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ x(
520
+ le,
520
521
  {
521
522
  type: "button",
522
523
  variant: g,
@@ -540,8 +541,8 @@ function ye({
540
541
  ]
541
542
  }
542
543
  ) }),
543
- /* @__PURE__ */ t(We, { align: "end", className: "min-w-[140px]", children: p.map((L, O) => /* @__PURE__ */ b(
544
- Me,
544
+ /* @__PURE__ */ t(Be, { align: "end", className: "min-w-[140px]", children: f.map((L, O) => /* @__PURE__ */ x(
545
+ He,
545
546
  {
546
547
  className: "cursor-pointer text-[12px]",
547
548
  onSelect: () => z(L, O + 1),
@@ -555,9 +556,9 @@ function ye({
555
556
  },
556
557
  L.id ?? O
557
558
  )) })
558
- ] }) }) : /* @__PURE__ */ b("div", { className: "flex items-center", children: [
559
- /* @__PURE__ */ b(
560
- ne,
559
+ ] }) }) : /* @__PURE__ */ x("div", { className: "flex items-center", children: [
560
+ /* @__PURE__ */ x(
561
+ le,
561
562
  {
562
563
  type: "button",
563
564
  variant: g,
@@ -568,13 +569,13 @@ function ye({
568
569
  onClick: () => z(e, 0),
569
570
  children: [
570
571
  D && /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
571
- f ? "…" : v === u ? "✓ Copied" : A
572
+ p ? "…" : v === u ? "✓ Copied" : A
572
573
  ]
573
574
  }
574
575
  ),
575
- /* @__PURE__ */ b(Ae, { children: [
576
- /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ t(
577
- ne,
576
+ /* @__PURE__ */ x(We, { children: [
577
+ /* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ t(
578
+ le,
578
579
  {
579
580
  type: "button",
580
581
  variant: g,
@@ -595,8 +596,8 @@ function ye({
595
596
  ) })
596
597
  }
597
598
  ) }),
598
- /* @__PURE__ */ t(We, { align: "end", className: "min-w-[140px]", children: p.map((L, O) => /* @__PURE__ */ b(
599
- Me,
599
+ /* @__PURE__ */ t(Be, { align: "end", className: "min-w-[140px]", children: f.map((L, O) => /* @__PURE__ */ x(
600
+ He,
600
601
  {
601
602
  className: "text-[12px]",
602
603
  onSelect: () => z(L, O + 1),
@@ -613,17 +614,17 @@ function ye({
613
614
  ] })
614
615
  ] });
615
616
  }
616
- return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: l.map((e, p) => Z(e, p)) });
617
+ return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: l.map((e, f) => Z(e, f)) });
617
618
  }
618
- function Gr({
619
+ function Zr({
619
620
  widgetId: l,
620
621
  inputBindings: s = [],
621
622
  itemDraft: o = {},
622
- itemCollection: a,
623
+ itemCollection: i,
623
624
  ready: c = !0,
624
625
  label: m,
625
626
  defaultExpanded: v = !0,
626
- frameless: w = !1,
627
+ frameless: b = !1,
627
628
  apiBase: _,
628
629
  compact: R = !1,
629
630
  strip: $ = !1,
@@ -631,29 +632,29 @@ function Gr({
631
632
  onWidgetType: U,
632
633
  onContentChange: q
633
634
  }) {
634
- var je, Te;
635
- const C = we(), E = _ ?? C.apiBase, [G, se] = P(v), [r, z] = P(null), [i, Z] = P(null), [e, p] = P(!0), [u, f] = P(!0), [j, A] = P(!0), [g, N] = P(null), [W, D] = P(0), [H, L] = P(null), O = le(!1), V = Oe(() => {
635
+ var Oe, Ie;
636
+ const C = ve(), E = _ ?? C.apiBase, [G, oe] = P(v), [r, z] = P(null), [a, Z] = P(null), [e, f] = P(!0), [u, p] = P(!0), [T, A] = P(!0), [g, N] = P(null), [W, D] = P(0), [H, L] = P(null), O = ie(!1), V = De(() => {
636
637
  O.current = !0, D((n) => n + 1);
637
- }, []), oe = le(null), ce = le(!1), ve = Qe();
638
+ }, []), ce = ie(null), de = ie(!1), Ne = Xe();
638
639
  Y(() => {
639
640
  const n = r == null ? void 0 : r.widget_type;
640
641
  if (n !== "rollup" && n !== "review_list" && n !== "custom-query") return;
641
642
  let d = null;
642
- const y = ve.getQueryCache().subscribe((S) => {
643
+ const y = Ne.getQueryCache().subscribe((S) => {
643
644
  var K;
644
645
  if (S.type !== "updated" || ((K = S.action) == null ? void 0 : K.type) !== "success") return;
645
- const x = S.query.queryKey, T = x == null ? void 0 : x[0];
646
- typeof T == "string" && (!T.startsWith("o2m-rows") && !T.startsWith("nested") && T !== "match-agg" && T !== "m2m-items" || S.query.state.dataUpdateCount <= 1 || T.startsWith("o2m-rows") && oe.current != null && String(x[3]) !== String(oe.current) || (d && clearTimeout(d), d = setTimeout(() => D((re) => re + 1), 400)));
646
+ const w = S.query.queryKey, j = w == null ? void 0 : w[0];
647
+ typeof j == "string" && (!j.startsWith("o2m-rows") && !j.startsWith("nested") && j !== "match-agg" && j !== "m2m-items" || S.query.state.dataUpdateCount <= 1 || j.startsWith("o2m-rows") && ce.current != null && String(w[3]) !== String(ce.current) || (d && clearTimeout(d), d = setTimeout(() => D((ne) => ne + 1), 400)));
647
648
  });
648
649
  return () => {
649
650
  d && clearTimeout(d), y();
650
651
  };
651
- }, [ve, r == null ? void 0 : r.widget_type]);
652
- const _e = {};
652
+ }, [Ne, r == null ? void 0 : r.widget_type]);
653
+ const ke = {};
653
654
  for (const [n, d] of Object.entries(o))
654
- n.includes(".") || (d == null || typeof d != "object") && (_e[n] = d);
655
- const I = { ..._e, ...Sr(s, o) }, de = yr(), F = Ie(() => {
656
- if ((r == null ? void 0 : r.widget_type) !== "rollup" || !de) return null;
655
+ n.includes(".") || (d == null || typeof d != "object") && (ke[n] = d);
656
+ const I = { ...ke, ...Lr(s, o) }, ue = br(), F = qe(() => {
657
+ if ((r == null ? void 0 : r.widget_type) !== "rollup" || !ue) return null;
657
658
  const n = r.config, d = n == null ? void 0 : n.collection;
658
659
  if (!d) return null;
659
660
  const y = {
@@ -661,33 +662,33 @@ function Gr({
661
662
  updated: [],
662
663
  deleted: []
663
664
  };
664
- for (const S of de.byGrid.values()) {
665
- const x = S[d];
666
- x && (y.created.push(...x.created), y.updated.push(...x.updated), y.deleted.push(...x.deleted));
665
+ for (const S of ue.byGrid.values()) {
666
+ const w = S[d];
667
+ w && (y.created.push(...w.created), y.updated.push(...w.updated), y.deleted.push(...w.deleted));
667
668
  }
668
669
  return !y.created.length && !y.updated.length && !y.deleted.length ? null : y;
669
- }, [r, de]), Je = Ie(
670
+ }, [r, ue]), Ke = qe(
670
671
  () => F ? JSON.stringify(F) : "",
671
672
  [F]
672
- ), h = (je = r == null ? void 0 : r.config) == null ? void 0 : je.drilldown, ee = nr(), ue = h != null && h.id_input ? I[h.id_input] : null, pe = !!ee && !!(h != null && h.collection) && ue != null && ue !== "", Ne = async () => {
673
- var S, x;
673
+ ), h = (Oe = r == null ? void 0 : r.config) == null ? void 0 : Oe.drilldown, ee = ir(), fe = h != null && h.id_input ? I[h.id_input] : null, pe = !!ee && !!(h != null && h.collection) && fe != null && fe !== "", Se = async () => {
674
+ var S, w;
674
675
  if (!pe || !(h != null && h.collection)) return;
675
- const n = String(ue);
676
+ const n = String(fe);
676
677
  let d = null;
677
- const y = (T) => fetch(`${E}${T}`, {
678
+ const y = (j) => fetch(`${E}${j}`, {
678
679
  credentials: C.credentials,
679
680
  headers: C.authHeaders
680
681
  });
681
682
  try {
682
683
  if (h.match_field) {
683
- const T = await y(
684
+ const j = await y(
684
685
  `/items/${h.collection}?filter=${encodeURIComponent(
685
686
  JSON.stringify({ [h.match_field]: { _eq: n } })
686
687
  )}&fields=id&limit=1`
687
688
  );
688
- if (T.ok) {
689
- const K = await T.json(), re = (x = (S = K == null ? void 0 : K.data) == null ? void 0 : S[0]) == null ? void 0 : x.id;
690
- re != null && (d = String(re));
689
+ if (j.ok) {
690
+ const K = await j.json(), ne = (w = (S = K == null ? void 0 : K.data) == null ? void 0 : S[0]) == null ? void 0 : w.id;
691
+ ne != null && (d = String(ne));
691
692
  }
692
693
  }
693
694
  d == null && (await y(`/items/${h.collection}/${encodeURIComponent(n)}?fields=id`)).ok && (d = n);
@@ -706,9 +707,9 @@ function Gr({
706
707
  const n = o.id;
707
708
  n != null && n !== "" && (I.record_id = n);
708
709
  }
709
- oe.current = o.id ?? null;
710
- const ze = JSON.stringify(I) + (a ?? "") + Je, Ke = ar(ze, 400);
711
- function ke() {
710
+ ce.current = o.id ?? null;
711
+ const Qe = JSON.stringify(I) + (i ?? "") + Ke, Ge = sr(Qe, 400);
712
+ function Re() {
712
713
  const n = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
713
714
  return {
714
715
  "Content-Type": "application/json",
@@ -716,127 +717,127 @@ function Gr({
716
717
  ...n ? { "x-workspace": n } : {}
717
718
  };
718
719
  }
719
- const X = lr(), B = Ge({
720
+ const X = ar(), B = Ye({
720
721
  queryKey: ["nvr-widget-def", l],
721
722
  enabled: c,
722
723
  staleTime: 6e4,
723
724
  retry: !1,
724
725
  queryFn: async () => {
725
726
  if (X)
726
- return (await X.request(ir(`/widgets-internal/${l}`))).data;
727
+ return (await X.request(or(`/widgets-internal/${l}`))).data;
727
728
  const n = await fetch(`${E}/widgets-internal/${l}`, {
728
729
  credentials: C.credentials,
729
- headers: ke()
730
+ headers: Re()
730
731
  });
731
732
  if (!n.ok) throw Object.assign(new Error("Widget not found"), { status: n.status });
732
733
  return (await n.json()).data;
733
734
  }
734
- }), Se = B.refetch, fe = Oe(() => {
735
- N(null), B.error ? Se() : D((n) => n + 1);
736
- }, [B.error, Se]);
735
+ }), Le = B.refetch, me = De(() => {
736
+ N(null), B.error ? Le() : D((n) => n + 1);
737
+ }, [B.error, Le]);
737
738
  Y(() => {
738
739
  const n = () => D((d) => d + 1);
739
- return window.addEventListener(De, n), () => window.removeEventListener(De, n);
740
+ return window.addEventListener(Ue, n), () => window.removeEventListener(Ue, n);
740
741
  }, []), Y(() => {
741
- c && (B.data ? (z(B.data), p(!1), N(null), U == null || U(B.data.widget_type)) : B.error && N(qe(B.error, "this widget")));
742
+ c && (B.data ? (z(B.data), f(!1), N(null), U == null || U(B.data.widget_type)) : B.error && N(Ae(B.error, "this widget")));
742
743
  }, [c, B.data, B.error]), Y(() => {
743
744
  if (!c || !r) return;
744
745
  const n = I.record_id == null || I.record_id === "";
745
746
  if (r.widget_type === "review_list" && n || r.widget_type === "rollup" && n && !F) return;
746
747
  let d = !1;
747
- return ce.current || (f(!0), A(!0)), (async () => {
748
+ return de.current || (p(!0), A(!0)), (async () => {
748
749
  try {
749
750
  const y = {
750
751
  inputs: F ? { ...I, staged: F } : I,
751
752
  draft: o,
752
753
  bindings: s,
753
- item_collection: a
754
+ item_collection: i
754
755
  };
755
756
  O.current && (y.refresh = !0, O.current = !1), L(y);
756
757
  let S;
757
758
  if (X)
758
759
  S = await X.request(
759
- sr(`/widgets-internal/${l}/render`, y)
760
+ cr(`/widgets-internal/${l}/render`, y)
760
761
  );
761
762
  else {
762
- const x = await fetch(`${E}/widgets-internal/${l}/render`, {
763
+ const w = await fetch(`${E}/widgets-internal/${l}/render`, {
763
764
  method: "POST",
764
765
  credentials: C.credentials,
765
- headers: ke(),
766
+ headers: Re(),
766
767
  body: JSON.stringify(y)
767
768
  });
768
- if (!x.ok)
769
- throw Object.assign(new Error("Render failed"), { status: x.status });
770
- S = await x.json();
769
+ if (!w.ok)
770
+ throw Object.assign(new Error("Render failed"), { status: w.status });
771
+ S = await w.json();
771
772
  }
772
773
  if (d) return;
773
- d || (ce.current = !0, Z(S.data), f(!1), N(null));
774
+ d || (de.current = !0, Z(S.data), p(!1), N(null));
774
775
  } catch (y) {
775
- d || N(qe(y, "this widget"));
776
+ d || N(Ae(y, "this widget"));
776
777
  } finally {
777
778
  d || A(!1);
778
779
  }
779
780
  })(), () => {
780
781
  d = !0;
781
782
  };
782
- }, [l, E, Ke, c, W, r == null ? void 0 : r.widget_type]), Y(() => {
783
+ }, [l, E, Ge, c, W, r == null ? void 0 : r.widget_type]), Y(() => {
783
784
  if (q) {
784
785
  if (g) {
785
786
  q(!0);
786
787
  return;
787
788
  }
788
- if (i) {
789
+ if (a) {
789
790
  if ((r == null ? void 0 : r.widget_type) === "review_list" || (r == null ? void 0 : r.widget_type) === "rollup") {
790
- const n = i.rows;
791
+ const n = a.rows;
791
792
  q(Array.isArray(n) && n.length > 0);
792
793
  return;
793
794
  }
794
- if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in i) {
795
- const n = i.rows;
795
+ if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in a) {
796
+ const n = a.rows;
796
797
  q(Array.isArray(n) && n.length > 0);
797
798
  return;
798
799
  }
799
800
  q(!0);
800
801
  }
801
802
  }
802
- }, [i, g, r == null ? void 0 : r.widget_type, q]);
803
- const J = m || (r == null ? void 0 : r.name) || "", te = (r == null ? void 0 : r.widget_type) === "report_widget" && i ? wr(i) : i, M = (() => {
804
- const n = i == null ? void 0 : i.awaiting;
803
+ }, [a, g, r == null ? void 0 : r.widget_type, q]);
804
+ const J = m || (r == null ? void 0 : r.name) || "", te = (r == null ? void 0 : r.widget_type) === "report_widget" && a ? vr(a) : a, M = (() => {
805
+ const n = a == null ? void 0 : a.awaiting;
805
806
  if (!Array.isArray(n) || n.length === 0) return null;
806
807
  const d = n.map((y) => {
807
- const S = s.find((T) => T.key === y && T.binding_type === "item_field");
808
- return String((S == null ? void 0 : S.binding_value) ?? y).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (T) => T.toUpperCase());
808
+ const S = s.find((j) => j.key === y && j.binding_type === "item_field");
809
+ return String((S == null ? void 0 : S.binding_value) ?? y).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (j) => j.toUpperCase());
809
810
  });
810
811
  return [...new Set(d)].join(", ");
811
- })(), Re = I.record_id, Le = Re == null || Re === "";
812
- if ((r == null ? void 0 : r.widget_type) === "review_list" && Le || (r == null ? void 0 : r.widget_type) === "rollup" && Le && !F) return null;
812
+ })(), $e = I.record_id, Ce = $e == null || $e === "";
813
+ if ((r == null ? void 0 : r.widget_type) === "review_list" && Ce || (r == null ? void 0 : r.widget_type) === "rollup" && Ce && !F) return null;
813
814
  if (R) {
814
- const n = ((Te = r == null ? void 0 : r.config) == null ? void 0 : Te.compact_style) ?? "default", d = n === "pill-dark" || n === "pill-light";
815
+ const n = ((Ie = r == null ? void 0 : r.config) == null ? void 0 : Ie.compact_style) ?? "default", d = n === "pill-dark" || n === "pill-light";
815
816
  if (g)
816
817
  return /* @__PURE__ */ t(
817
818
  "button",
818
819
  {
819
820
  type: "button",
820
- onClick: fe,
821
+ onClick: me,
821
822
  "data-load-error": "",
822
823
  "data-tip": `${g} Click to try again.`,
823
824
  "aria-label": `${g} Try again`,
824
825
  className: "inline-flex h-5 w-5 items-center justify-center rounded text-amber-500 hover:bg-amber-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-amber-400 dark:hover:bg-amber-400/10",
825
- children: /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
826
+ children: /* @__PURE__ */ t(Je, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
826
827
  }
827
828
  );
828
829
  if ($) {
829
830
  if (e)
830
- return /* @__PURE__ */ b("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
831
+ return /* @__PURE__ */ x("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
831
832
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] mb-1" }),
832
833
  /* @__PURE__ */ t("span", { className: "animate-pulse h-3.5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
833
834
  ] });
834
835
  if (r.widget_type === "button-group")
835
- return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: u ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : i && /* @__PURE__ */ t(
836
- ye,
836
+ return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: u ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : a && /* @__PURE__ */ t(
837
+ be,
837
838
  {
838
- buttons: i.buttons ?? [],
839
- layout: i.layout ?? "flat",
839
+ buttons: a.buttons ?? [],
840
+ layout: a.layout ?? "flat",
840
841
  widgetId: l,
841
842
  inputs: I,
842
843
  apiBase: E,
@@ -845,7 +846,7 @@ function Gr({
845
846
  ) });
846
847
  {
847
848
  const y = /* @__PURE__ */ t(
848
- Nr,
849
+ Sr,
849
850
  {
850
851
  data: u ? null : te ?? null,
851
852
  label: m || r.name,
@@ -857,18 +858,18 @@ function Gr({
857
858
  "button",
858
859
  {
859
860
  type: "button",
860
- onClick: () => void Ne(),
861
+ onClick: () => void Se(),
861
862
  title: (h == null ? void 0 : h.title) ?? "Open details",
862
863
  className: "h-full w-full cursor-pointer text-left transition-colors hover:bg-nvr-cyan/5",
863
864
  "data-nvr-widget-drill": h == null ? void 0 : h.collection,
864
865
  children: y
865
866
  }
866
- ) : y, x = i == null ? void 0 : i.cache;
867
- return x != null && x.cache_ttl ? /* @__PURE__ */ b(
867
+ ) : y, w = a == null ? void 0 : a.cache;
868
+ return w != null && w.cache_ttl ? /* @__PURE__ */ x(
868
869
  "div",
869
870
  {
870
871
  className: "group/cache relative h-full w-full",
871
- "data-cache-stamp": x.cached ? "cached" : "fresh",
872
+ "data-cache-stamp": w.cached ? "cached" : "fresh",
872
873
  children: [
873
874
  S,
874
875
  /* @__PURE__ */ t(
@@ -879,9 +880,9 @@ function Gr({
879
880
  disabled: u,
880
881
  "data-cache-refresh": !0,
881
882
  "aria-label": "Refresh this figure",
882
- "data-tip": hr(x),
883
+ "data-tip": yr(w),
883
884
  className: "absolute bottom-1 right-1 rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-muted group-hover/cache:opacity-100 focus-visible:opacity-100 disabled:opacity-50",
884
- children: /* @__PURE__ */ t(Fe, { className: `h-3 w-3 ${u ? "animate-spin" : ""}` })
885
+ children: /* @__PURE__ */ t(ze, { className: `h-3 w-3 ${u ? "animate-spin" : ""}` })
885
886
  }
886
887
  )
887
888
  ]
@@ -899,7 +900,7 @@ function Gr({
899
900
  );
900
901
  {
901
902
  const y = /* @__PURE__ */ t(
902
- Rr,
903
+ $r,
903
904
  {
904
905
  data: u ? null : te ?? null,
905
906
  label: m || r.name,
@@ -913,7 +914,7 @@ function Gr({
913
914
  "button",
914
915
  {
915
916
  type: "button",
916
- onClick: () => void Ne(),
917
+ onClick: () => void Se(),
917
918
  title: (h == null ? void 0 : h.title) ?? "Open details",
918
919
  className: "cursor-pointer text-left",
919
920
  "data-nvr-widget-drill": h == null ? void 0 : h.collection,
@@ -922,24 +923,24 @@ function Gr({
922
923
  ) : y;
923
924
  }
924
925
  }
925
- return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: u ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : i && r && /* @__PURE__ */ b(be, { children: [
926
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(he, { data: i, awaiting: M }),
927
- r.widget_type === "report_widget" && te && /* @__PURE__ */ t(he, { data: te, awaiting: M }),
928
- r.widget_type === "custom-query" && "values" in i && /* @__PURE__ */ t(Be, { data: i }),
926
+ return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: u ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : a && r && /* @__PURE__ */ x(we, { children: [
927
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in a) && /* @__PURE__ */ t(ye, { data: a, awaiting: M }),
928
+ r.widget_type === "report_widget" && te && /* @__PURE__ */ t(ye, { data: te, awaiting: M }),
929
+ r.widget_type === "custom-query" && "values" in a && /* @__PURE__ */ t(Ve, { data: a }),
929
930
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
930
- He,
931
+ Fe,
931
932
  {
932
- data: i,
933
+ data: a,
933
934
  widgetId: l,
934
935
  inputs: I,
935
936
  apiBase: E
936
937
  }
937
938
  ),
938
939
  r.widget_type === "button-group" && /* @__PURE__ */ t(
939
- ye,
940
+ be,
940
941
  {
941
- buttons: i.buttons ?? [],
942
- layout: i.layout ?? "flat",
942
+ buttons: a.buttons ?? [],
943
+ layout: a.layout ?? "flat",
943
944
  widgetId: l,
944
945
  inputs: I,
945
946
  apiBase: E,
@@ -948,12 +949,8 @@ function Gr({
948
949
  )
949
950
  ] }) });
950
951
  }
951
- const $e = /* @__PURE__ */ b("div", { className: "space-y-2 py-0.5", children: [
952
- /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-2/3 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
953
- /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-full rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
954
- /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-5/6 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
955
- ] }), Ce = X ? /* @__PURE__ */ t(
956
- mr,
952
+ const re = r == null ? void 0 : r.widget_type, Ee = re === "stat" ? /* @__PURE__ */ t(he, { framed: !1, title: !1, kpi: !0, className: "py-0.5" }) : re === "list" || re === "review_list" || re === "custom-query" ? /* @__PURE__ */ t(he, { framed: !1, title: !1, lines: 4, className: "py-0.5" }) : /* @__PURE__ */ t(he, { framed: !1, title: !1, lines: 3, className: "py-0.5" }), Te = X ? /* @__PURE__ */ t(
953
+ gr,
957
954
  {
958
955
  className: "mt-2",
959
956
  pending: u && !!r,
@@ -961,43 +958,43 @@ function Gr({
961
958
  label: J || "Widget",
962
959
  onResult: (n) => {
963
960
  const d = n == null ? void 0 : n.data;
964
- d && (ce.current = !0, Z(d), f(!1), A(!1), N(null));
961
+ d && (de.current = !0, Z(d), p(!1), A(!1), N(null));
965
962
  },
966
963
  onGone: () => D((n) => n + 1)
967
964
  }
968
965
  ) : null;
969
- if (w)
970
- return /* @__PURE__ */ b("div", { children: [
971
- j && $e,
972
- j && Ce,
973
- g && /* @__PURE__ */ t(Ue, { message: g, onRetry: fe }),
974
- !j && !g && i && r && Ee()
966
+ if (b)
967
+ return /* @__PURE__ */ x("div", { children: [
968
+ T && Ee,
969
+ T && Te,
970
+ g && /* @__PURE__ */ t(Pe, { message: g, onRetry: me }),
971
+ !T && !g && a && r && je()
975
972
  ] });
976
- return /* @__PURE__ */ b("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
977
- /* @__PURE__ */ b(
973
+ return /* @__PURE__ */ x("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
974
+ /* @__PURE__ */ x(
978
975
  "button",
979
976
  {
980
977
  type: "button",
981
978
  className: "flex w-full items-center justify-between px-4 py-3 text-left",
982
- onClick: () => se((n) => !n),
979
+ onClick: () => oe((n) => !n),
983
980
  children: [
984
981
  /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: J || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
985
982
  /* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${G ? "rotate-90" : ""}`, children: "›" })
986
983
  ]
987
984
  }
988
985
  ),
989
- G && /* @__PURE__ */ b("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
990
- j && $e,
991
- j && Ce,
992
- g && /* @__PURE__ */ t(Ue, { message: g, onRetry: fe }),
993
- !j && !g && i && r && Ee()
986
+ G && /* @__PURE__ */ x("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
987
+ T && Ee,
988
+ T && Te,
989
+ g && /* @__PURE__ */ t(Pe, { message: g, onRetry: me }),
990
+ !T && !g && a && r && je()
994
991
  ] })
995
992
  ] });
996
- function Ee() {
993
+ function je() {
997
994
  var n;
998
- return !i || !r ? null : /* @__PURE__ */ b(be, { children: [
999
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(he, { data: i, awaiting: M }),
1000
- r.widget_type === "custom-query" && "values" in i && (M ? /* @__PURE__ */ b(
995
+ return !a || !r ? null : /* @__PURE__ */ x(we, { children: [
996
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in a) && /* @__PURE__ */ t(ye, { data: a, awaiting: M }),
997
+ r.widget_type === "custom-query" && "values" in a && (M ? /* @__PURE__ */ x(
1001
998
  "p",
1002
999
  {
1003
1000
  className: "text-[12px] text-slate-500 dark:text-slate-400",
@@ -1010,9 +1007,9 @@ function Gr({
1010
1007
  "."
1011
1008
  ]
1012
1009
  }
1013
- ) : /* @__PURE__ */ t(Be, { data: i })),
1014
- r.widget_type === "list" && /* @__PURE__ */ t(Lr, { data: i }),
1015
- M && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ b(
1010
+ ) : /* @__PURE__ */ t(Ve, { data: a })),
1011
+ r.widget_type === "list" && /* @__PURE__ */ t(Cr, { data: a }),
1012
+ M && r.widget_type === "custom-query" && "rows" in a && /* @__PURE__ */ x(
1016
1013
  "p",
1017
1014
  {
1018
1015
  className: "text-[12px] text-slate-500 dark:text-slate-400",
@@ -1026,18 +1023,18 @@ function Gr({
1026
1023
  ]
1027
1024
  }
1028
1025
  ),
1029
- !M && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ t(
1030
- br,
1026
+ !M && r.widget_type === "custom-query" && "rows" in a && /* @__PURE__ */ t(
1027
+ wr,
1031
1028
  {
1032
- rows: i.rows ?? [],
1029
+ rows: a.rows ?? [],
1033
1030
  config: (n = r.config) == null ? void 0 : n.table,
1034
1031
  emptyLabel: J
1035
1032
  }
1036
1033
  ),
1037
1034
  r.widget_type === "review_list" && /* @__PURE__ */ t(
1038
- vr,
1035
+ Nr,
1039
1036
  {
1040
- data: i,
1037
+ data: a,
1041
1038
  config: r.config ?? {},
1042
1039
  onRefetch: () => D((d) => d + 1),
1043
1040
  hostRecordId: I.record_id,
@@ -1045,28 +1042,28 @@ function Gr({
1045
1042
  }
1046
1043
  ),
1047
1044
  r.widget_type === "rollup" && /* @__PURE__ */ t(
1048
- _r,
1045
+ kr,
1049
1046
  {
1050
- data: i,
1047
+ data: a,
1051
1048
  config: r.config ?? {},
1052
1049
  emptyLabel: J
1053
1050
  }
1054
1051
  ),
1055
- r.widget_type === "report_widget" && /* @__PURE__ */ t(xr, { payload: i }),
1052
+ r.widget_type === "report_widget" && /* @__PURE__ */ t(_r, { payload: a }),
1056
1053
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
1057
- He,
1054
+ Fe,
1058
1055
  {
1059
- data: i,
1056
+ data: a,
1060
1057
  widgetId: l,
1061
1058
  inputs: I,
1062
1059
  apiBase: E
1063
1060
  }
1064
1061
  ),
1065
1062
  r.widget_type === "button-group" && /* @__PURE__ */ t(
1066
- ye,
1063
+ be,
1067
1064
  {
1068
- buttons: i.buttons ?? [],
1069
- layout: i.layout ?? "flat",
1065
+ buttons: a.buttons ?? [],
1066
+ layout: a.layout ?? "flat",
1070
1067
  widgetId: l,
1071
1068
  inputs: I,
1072
1069
  apiBase: E,
@@ -1082,11 +1079,11 @@ function Gr({
1082
1079
  "review_list",
1083
1080
  "rollup",
1084
1081
  "report_widget"
1085
- ].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(i, null, 2) }),
1086
- i.cache ? /* @__PURE__ */ t(
1087
- gr,
1082
+ ].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(a, null, 2) }),
1083
+ a.cache ? /* @__PURE__ */ t(
1084
+ xr,
1088
1085
  {
1089
- envelope: i.cache,
1086
+ envelope: a.cache,
1090
1087
  onRefresh: V,
1091
1088
  refreshing: u,
1092
1089
  className: "mt-2 justify-end"
@@ -1096,5 +1093,5 @@ function Gr({
1096
1093
  }
1097
1094
  }
1098
1095
  export {
1099
- Gr as WidgetSlot
1096
+ Zr as WidgetSlot
1100
1097
  };