@nivaro/react 0.3.114 → 0.3.116

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 (293) hide show
  1. package/dist/components/ScreenShareHost.js +24 -0
  2. package/dist/full.css +50 -2
  3. package/dist/hooks/useSessionRecorder.js +61 -60
  4. package/dist/index.d.ts +1728 -22
  5. package/dist/index.js +1091 -950
  6. package/dist/shared/components/ActivityEntry.js +209 -97
  7. package/dist/shared/components/AgentPresenceChip.js +51 -0
  8. package/dist/shared/components/AnnouncementBanner.js +56 -41
  9. package/dist/shared/components/AutolinkedText.js +98 -85
  10. package/dist/shared/components/BroadcastView.js +149 -141
  11. package/dist/shared/components/CacheStamp.js +78 -30
  12. package/dist/shared/components/CollectionBrowserView.js +4909 -4182
  13. package/dist/shared/components/ConfigChangeStrip.js +63 -0
  14. package/dist/shared/components/ConfigReachNote.js +107 -0
  15. package/dist/shared/components/ConformanceView.js +389 -319
  16. package/dist/shared/components/DataTable.js +612 -551
  17. package/dist/shared/components/DelegateCoverLine.js +164 -0
  18. package/dist/shared/components/EnvironmentNotice.js +56 -65
  19. package/dist/shared/components/FilePreviewLightbox.js +89 -43
  20. package/dist/shared/components/FindingFixedMark.js +23 -0
  21. package/dist/shared/components/GridPresenceLine.js +100 -0
  22. package/dist/shared/components/IdleReloadWatcher.js +82 -43
  23. package/dist/shared/components/InStep.js +46 -0
  24. package/dist/shared/components/ItemEditForm.js +5504 -4889
  25. package/dist/shared/components/LiveAnnouncer.js +62 -0
  26. package/dist/shared/components/LiveCount.js +54 -0
  27. package/dist/shared/components/LiveFigure.js +28 -0
  28. package/dist/shared/components/LiveListControls.js +114 -0
  29. package/dist/shared/components/LiveNewMatchesPill.js +25 -0
  30. package/dist/shared/components/LiveOffNote.js +44 -0
  31. package/dist/shared/components/LivePreferenceHost.js +42 -0
  32. package/dist/shared/components/LiveRowMark.js +25 -20
  33. package/dist/shared/components/LiveTraceView.js +257 -0
  34. package/dist/shared/components/MapView.js +30 -29
  35. package/dist/shared/components/MatrixEditor.js +497 -462
  36. package/dist/shared/components/MyWorkView.js +346 -272
  37. package/dist/shared/components/NotificationBell.js +215 -201
  38. package/dist/shared/components/OverflowRail.js +326 -0
  39. package/dist/shared/components/PageRenderer.js +636 -599
  40. package/dist/shared/components/PresenceDot.js +21 -0
  41. package/dist/shared/components/ProfileView.js +656 -536
  42. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  43. package/dist/shared/components/RecentRecordsRail.js +51 -48
  44. package/dist/shared/components/RecordCompare.js +241 -150
  45. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  46. package/dist/shared/components/RecordGridEditor.js +350 -311
  47. package/dist/shared/components/RecordHoverCard.js +147 -0
  48. package/dist/shared/components/RecordPeekHost.js +111 -0
  49. package/dist/shared/components/RecordReadView.js +414 -412
  50. package/dist/shared/components/RelativeTime.js +16 -0
  51. package/dist/shared/components/ReportView.js +1396 -1304
  52. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  53. package/dist/shared/components/TabCountHost.js +10 -0
  54. package/dist/shared/components/TickerNumber.js +19 -18
  55. package/dist/shared/components/TipLayer.js +70 -58
  56. package/dist/shared/components/WidgetImageMenu.js +59 -0
  57. package/dist/shared/components/WidgetSlot.js +571 -524
  58. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  59. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  60. package/dist/shared/components/cbv/approval-changed.js +20 -0
  61. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  62. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  63. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  65. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  66. package/dist/shared/components/change-proposals/types.js +4 -0
  67. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  68. package/dist/shared/components/chat/Composer.js +276 -298
  69. package/dist/shared/components/chat/room-due.js +13 -0
  70. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  71. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  72. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  73. package/dist/shared/components/imports/ImportConsole.js +159 -155
  74. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  75. package/dist/shared/components/integrations/SendStatus.js +202 -0
  76. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  77. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  78. package/dist/shared/components/integrations/console/SignalCard.js +84 -77
  79. package/dist/shared/components/integrations/console/api.js +161 -117
  80. package/dist/shared/components/integrations/console/tone.js +15 -12
  81. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  82. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  83. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  84. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  85. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  86. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  87. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  88. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  89. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  90. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  91. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  92. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  93. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  94. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  95. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  96. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  97. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  98. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  99. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  100. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  101. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  102. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  103. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  104. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  105. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  106. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  107. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  108. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  109. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  110. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  111. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  112. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  113. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  114. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  115. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  116. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  117. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  118. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  119. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  120. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  121. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  122. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  123. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  124. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  125. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  126. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  127. package/dist/shared/components/item-edit/file-live.js +77 -0
  128. package/dist/shared/components/item-edit/file-processing.js +87 -0
  129. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  130. package/dist/shared/components/item-edit/live-related.js +23 -0
  131. package/dist/shared/components/item-edit/live-title.js +66 -0
  132. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  133. package/dist/shared/components/item-edit/removed-line.js +58 -0
  134. package/dist/shared/components/item-edit/render-stability.js +70 -59
  135. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  136. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  137. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  138. package/dist/shared/components/list/InlineEdit.js +504 -208
  139. package/dist/shared/components/list/ListViewers.js +81 -0
  140. package/dist/shared/components/list/PhonePager.js +50 -0
  141. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  142. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  143. package/dist/shared/components/merge/merge-values.js +110 -0
  144. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  145. package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
  146. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  147. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  148. package/dist/shared/components/notifications/bundles.js +21 -19
  149. package/dist/shared/components/notifications/resolved-line.js +25 -0
  150. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  151. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  152. package/dist/shared/components/panels/AlertBanners.js +132 -0
  153. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  154. package/dist/shared/components/panels/BranchLanes.js +82 -54
  155. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  156. package/dist/shared/components/panels/CommentImages.js +219 -0
  157. package/dist/shared/components/panels/CommentPanel.js +649 -530
  158. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  159. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  160. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  161. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  162. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  163. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  164. package/dist/shared/components/panels/SlaClock.js +130 -99
  165. package/dist/shared/components/panels/TaskPanel.js +308 -287
  166. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  167. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  168. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  169. package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
  170. package/dist/shared/components/profile/AgentNameField.js +141 -0
  171. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  172. package/dist/shared/components/profile/PersonAccess.js +398 -330
  173. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  174. package/dist/shared/components/profile/PersonProfile.js +81 -73
  175. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  176. package/dist/shared/components/queue/OwnerAvatars.js +9 -9
  177. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  178. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  179. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  180. package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
  181. package/dist/shared/components/queue/worklist-helpers.js +10 -6
  182. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  183. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  184. package/dist/shared/components/support/ReportProblem.js +1 -0
  185. package/dist/shared/components/support/ScreenShare.js +554 -0
  186. package/dist/shared/components/support/SupportView.js +160 -129
  187. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  188. package/dist/shared/components/ui/popover.js +53 -29
  189. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  190. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  191. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  192. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  193. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  194. package/dist/shared/lib/activity-sentence.js +87 -75
  195. package/dist/shared/lib/agent-presence.js +46 -0
  196. package/dist/shared/lib/approval-progress.js +49 -0
  197. package/dist/shared/lib/attention-prefs.js +27 -0
  198. package/dist/shared/lib/cell-locks.js +56 -0
  199. package/dist/shared/lib/co-edit.js +166 -0
  200. package/dist/shared/lib/coedit-registry.js +44 -0
  201. package/dist/shared/lib/comment-awareness.js +124 -0
  202. package/dist/shared/lib/comment-images.js +45 -0
  203. package/dist/shared/lib/config-watch.js +94 -0
  204. package/dist/shared/lib/copy-rules.js +65 -0
  205. package/dist/shared/lib/count-step.js +30 -0
  206. package/dist/shared/lib/deadline-ticker.js +68 -0
  207. package/dist/shared/lib/derived-causes.js +115 -0
  208. package/dist/shared/lib/draft-store.js +114 -85
  209. package/dist/shared/lib/error-hints.js +1 -0
  210. package/dist/shared/lib/field-merge.js +126 -0
  211. package/dist/shared/lib/filter-sentence.js +10 -10
  212. package/dist/shared/lib/focus-mode.js +16 -12
  213. package/dist/shared/lib/grid-cursors.js +77 -0
  214. package/dist/shared/lib/grid-presence.js +182 -0
  215. package/dist/shared/lib/idle-reload.js +100 -73
  216. package/dist/shared/lib/in-step.js +45 -0
  217. package/dist/shared/lib/integration-chip.js +19 -18
  218. package/dist/shared/lib/keep-row-focus.js +43 -0
  219. package/dist/shared/lib/line-locks.js +141 -0
  220. package/dist/shared/lib/line-split.js +41 -0
  221. package/dist/shared/lib/linked-changes.js +150 -0
  222. package/dist/shared/lib/list-return.js +231 -0
  223. package/dist/shared/lib/list-viewers.js +52 -0
  224. package/dist/shared/lib/live-announcer.js +86 -0
  225. package/dist/shared/lib/live-counts.js +85 -0
  226. package/dist/shared/lib/live-data-changed.js +108 -0
  227. package/dist/shared/lib/live-deltas.js +81 -0
  228. package/dist/shared/lib/live-findings.js +113 -0
  229. package/dist/shared/lib/live-groups.js +122 -0
  230. package/dist/shared/lib/live-link-labels.js +162 -0
  231. package/dist/shared/lib/live-list-flow.js +334 -0
  232. package/dist/shared/lib/live-list.js +143 -129
  233. package/dist/shared/lib/live-moves.js +51 -0
  234. package/dist/shared/lib/live-ops.js +26 -26
  235. package/dist/shared/lib/live-pickers.js +7 -0
  236. package/dist/shared/lib/live-preference.js +184 -0
  237. package/dist/shared/lib/live-queries.js +226 -181
  238. package/dist/shared/lib/live-screen.js +333 -0
  239. package/dist/shared/lib/live-search.js +108 -0
  240. package/dist/shared/lib/live-seen.js +35 -0
  241. package/dist/shared/lib/live-views.js +100 -0
  242. package/dist/shared/lib/live.js +159 -133
  243. package/dist/shared/lib/missed-updates.js +198 -0
  244. package/dist/shared/lib/newer-file.js +56 -0
  245. package/dist/shared/lib/notification-sound.js +42 -20
  246. package/dist/shared/lib/obligation-banner.js +17 -17
  247. package/dist/shared/lib/own-writes.js +59 -41
  248. package/dist/shared/lib/picker-badges.js +94 -0
  249. package/dist/shared/lib/presence-signals.js +131 -84
  250. package/dist/shared/lib/rail-menu-context.js +9 -0
  251. package/dist/shared/lib/realtime.js +49 -24
  252. package/dist/shared/lib/record-gaps.js +85 -0
  253. package/dist/shared/lib/record-outbox.js +369 -222
  254. package/dist/shared/lib/record-peek.js +75 -0
  255. package/dist/shared/lib/record-tabs.js +92 -72
  256. package/dist/shared/lib/relative-ticker.js +42 -0
  257. package/dist/shared/lib/request-gate.js +119 -119
  258. package/dist/shared/lib/rollup-recalc.js +107 -0
  259. package/dist/shared/lib/room-gaps.js +40 -36
  260. package/dist/shared/lib/row-surface.js +7 -0
  261. package/dist/shared/lib/rum.js +137 -87
  262. package/dist/shared/lib/save-progress.js +20 -0
  263. package/dist/shared/lib/scheduled-countdown.js +67 -0
  264. package/dist/shared/lib/screen-refresh.js +160 -0
  265. package/dist/shared/lib/screen-share.js +234 -0
  266. package/dist/shared/lib/seen-since.js +74 -0
  267. package/dist/shared/lib/selection-watch.js +205 -0
  268. package/dist/shared/lib/send-status.js +132 -0
  269. package/dist/shared/lib/send-view.js +23 -0
  270. package/dist/shared/lib/socket-liveness.js +155 -0
  271. package/dist/shared/lib/socket-realtime.js +168 -140
  272. package/dist/shared/lib/state-census.js +53 -0
  273. package/dist/shared/lib/summary-mode.js +61 -39
  274. package/dist/shared/lib/tab-attention.js +143 -32
  275. package/dist/shared/lib/table-density.js +64 -0
  276. package/dist/shared/lib/table-pins.js +20 -18
  277. package/dist/shared/lib/track-travel.js +40 -0
  278. package/dist/shared/lib/unseen-changes.js +68 -0
  279. package/dist/shared/lib/upload-file.js +62 -0
  280. package/dist/shared/lib/upload-presence.js +127 -0
  281. package/dist/shared/lib/urgent-chime.js +65 -0
  282. package/dist/shared/lib/use-below-md.js +29 -0
  283. package/dist/shared/lib/use-online-users.js +32 -11
  284. package/dist/shared/lib/user-sync.js +155 -39
  285. package/dist/shared/lib/waiting-count.js +44 -0
  286. package/dist/shared/lib/watch-desktop.js +83 -0
  287. package/dist/shared/lib/watch-list.js +447 -0
  288. package/dist/shared/lib/widget-image-render.js +64 -0
  289. package/dist/shared/lib/widget-image.js +111 -0
  290. package/dist/shared/lib/worker-socket.js +130 -104
  291. package/dist/shared/lib/write-to-screen.js +133 -0
  292. package/package.json +1 -1
  293. package/styles.css +49 -1
@@ -1,95 +1,96 @@
1
- import { jsx as t, jsxs as w, Fragment as ke } from "react/jsx-runtime";
2
- import { useQueryClient as rt, useQuery as nt } from "@tanstack/react-query";
3
- import { AlertTriangle as Xe, RefreshCw as Ye, MoreVertical as lt, MoreHorizontal as st, Clipboard as it, Copy as at, Clock as ot, Calendar as ct, Paperclip as dt, Folder as ut, File as ft, FileText as pt, Bell as mt, Phone as ht, MessageSquare as gt, Mail as yt, UserCheck as xt, UserPlus as wt, Users as bt, User as vt, Activity as _t, Zap as Nt, Power as kt, Search as St, Filter as Rt, Sliders as Lt, Settings as Ct, RotateCcw as $t, Pause as Et, Play as Tt, HelpCircle as qt, Info as jt, AlertCircle as Ot, Flag as It, Bookmark as Dt, Heart as At, Star as Wt, Unlock as Ut, Lock as Pt, EyeOff as Mt, Eye as Bt, Send as Ht, Upload as Vt, Download as Ft, Save as Jt, Trash2 as Kt, Edit2 as Qt, Edit as zt, Minus as Gt, Plus as Xt, XCircle as Yt, X as Zt, CheckCircle as er, Check as tr, Share2 as rr, Link as nr, ExternalLink as lr, ArrowUpRight as sr, ArrowDown as ir, ArrowUp as ar, ArrowLeft as or, ArrowRight as cr } from "lucide-react";
4
- import { useState as H, useRef as re, useCallback as Ue, useEffect as te, useMemo as Pe } from "react";
5
- import { useApiFetchConfig as Se, useDrilldown as dr, useOptionalNivaroClient as ur } from "../context.js";
6
- import { useDebounced as fr } from "../hooks/useDebounced.js";
7
- import { PRETEND_DOWN_EVENT as Me } from "../lib/client-chaos.js";
8
- import { get as pr, post as mr } from "../lib/commands.js";
9
- import { HEADER_CELL_DENSE as hr, HEADER_CELL_LIST as gr, HEADER_LABEL as yr, HEADER_VALUE_LINE as xr, HEADER_VALUE_HERO as wr, HEADER_VALUE as br } from "../lib/header-strip.js";
10
- import { loadErrorText as Be } from "../lib/load-error.js";
11
- import { useStartsOpen as vr } from "../lib/use-starts-open.js";
12
- import { affixesFor as de, formatWidgetValue as ue } from "../lib/widget-value-format.js";
13
- import { BackgroundRunOffer as _r } from "./BackgroundRunOffer.js";
14
- import { cacheStampTip as Nr, CacheStamp as kr } from "./CacheStamp.js";
15
- import { useStagedRelations as Sr } from "./item-edit/O2MStagingContext.js";
16
- import { LoadErrorNote as He } from "./LoadErrorNote.js";
17
- import { QueryTable as Rr } from "./QueryTable.js";
18
- import { CardSkeleton as we } from "./Skeletons.js";
19
- import { Button as ce } from "./ui/button.js";
20
- import { DropdownMenu as Ve, DropdownMenuTrigger as Fe, DropdownMenuContent as Je, DropdownMenuItem as Ke } from "./ui/dropdown-menu.js";
21
- import { reportSlotScalar as Lr, ReportSlotWidget as Cr } from "./widgets/ReportSlotWidget.js";
22
- import { ReviewListWidget as $r } from "./widgets/ReviewListWidget.js";
23
- import { RollupWidget as Er } from "./widgets/RollupWidget.js";
24
- const Y = {
25
- ArrowRight: cr,
26
- ArrowLeft: or,
27
- ArrowUp: ar,
28
- ArrowDown: ir,
29
- ArrowUpRight: sr,
30
- ExternalLink: lr,
31
- Link: nr,
32
- Share2: rr,
33
- Check: tr,
34
- CheckCircle: er,
35
- X: Zt,
36
- XCircle: Yt,
37
- Plus: Xt,
38
- Minus: Gt,
39
- Edit: zt,
40
- Edit2: Qt,
41
- Trash2: Kt,
42
- Save: Jt,
43
- Download: Ft,
44
- Upload: Vt,
45
- Send: Ht,
46
- Eye: Bt,
47
- EyeOff: Mt,
48
- Lock: Pt,
49
- Unlock: Ut,
50
- Star: Wt,
51
- Heart: At,
52
- Bookmark: Dt,
53
- Flag: It,
54
- AlertCircle: Ot,
55
- AlertTriangle: Xe,
56
- Info: jt,
57
- HelpCircle: qt,
58
- Play: Tt,
59
- Pause: Et,
60
- RefreshCw: Ye,
61
- RotateCcw: $t,
62
- Settings: Ct,
63
- Sliders: Lt,
64
- Filter: Rt,
65
- Search: St,
66
- Power: kt,
67
- Zap: Nt,
68
- Activity: _t,
69
- User: vt,
70
- Users: bt,
71
- UserPlus: wt,
72
- UserCheck: xt,
73
- Mail: yt,
74
- MessageSquare: gt,
75
- Phone: ht,
76
- Bell: mt,
77
- FileText: pt,
78
- File: ft,
79
- Folder: ut,
80
- Paperclip: dt,
81
- Calendar: ct,
82
- Clock: ot,
83
- Copy: at,
84
- Clipboard: it,
85
- MoreHorizontal: st,
86
- MoreVertical: lt
1
+ import { jsx as t, jsxs as x, Fragment as Ee } from "react/jsx-runtime";
2
+ import { useQueryClient as dt, useQuery as ft } from "@tanstack/react-query";
3
+ import { AlertTriangle as lt, RefreshCw as it, MoreVertical as pt, MoreHorizontal as mt, Clipboard as ht, Copy as gt, Clock as yt, Calendar as wt, Paperclip as xt, Folder as bt, File as vt, FileText as _t, Bell as kt, Phone as Nt, MessageSquare as St, Mail as Rt, UserCheck as Lt, UserPlus as Ct, Users as $t, User as Et, Activity as Tt, Zap as qt, Power as jt, Search as Ot, Filter as It, Sliders as Dt, Settings as At, RotateCcw as Wt, Pause as Ut, Play as Pt, HelpCircle as Mt, Info as Ht, AlertCircle as Bt, Flag as Vt, Bookmark as Ft, Heart as Kt, Star as Gt, Unlock as Jt, Lock as Qt, EyeOff as zt, Eye as Xt, Send as Yt, Upload as Zt, Download as er, Save as tr, Trash2 as rr, Edit2 as nr, Edit as sr, Minus as lr, Plus as ir, XCircle as ar, X as or, CheckCircle as cr, Check as ur, Share2 as dr, Link as fr, ExternalLink as pr, ArrowUpRight as mr, ArrowDown as hr, ArrowUp as gr, ArrowLeft as yr, ArrowRight as wr } from "lucide-react";
4
+ import { useState as B, useRef as F, useCallback as Ne, useEffect as Y, useMemo as Je } from "react";
5
+ import { useApiFetchConfig as Te, useDrilldown as xr, useOptionalNivaroClient as br } from "../context.js";
6
+ import { useDebounced as vr } from "../hooks/useDebounced.js";
7
+ import { PRETEND_DOWN_EVENT as Qe } from "../lib/client-chaos.js";
8
+ import { get as _r, post as kr } from "../lib/commands.js";
9
+ import { HEADER_CELL_DENSE as Nr, HEADER_CELL_LIST as Sr, HEADER_LABEL as Rr, HEADER_VALUE_LINE as Lr, HEADER_VALUE_HERO as Cr, HEADER_VALUE as $r } from "../lib/header-strip.js";
10
+ import { useLiveRecord as Er, LIVE_ASPECTS as se } from "../lib/live.js";
11
+ import { loadErrorText as ze } from "../lib/load-error.js";
12
+ import { useStartsOpen as Tr } from "../lib/use-starts-open.js";
13
+ import { affixesFor as fe, formatWidgetValue as pe } from "../lib/widget-value-format.js";
14
+ import { BackgroundRunOffer as qr } from "./BackgroundRunOffer.js";
15
+ import { cacheStampTip as jr, LiveCacheStamp as Or } from "./CacheStamp.js";
16
+ import { useStagedRelations as Ir } from "./item-edit/O2MStagingContext.js";
17
+ import { LoadErrorNote as Xe } from "./LoadErrorNote.js";
18
+ import { QueryTable as Dr } from "./QueryTable.js";
19
+ import { CardSkeleton as Se } from "./Skeletons.js";
20
+ import { Button as de } from "./ui/button.js";
21
+ import { DropdownMenu as Ye, DropdownMenuTrigger as Ze, DropdownMenuContent as et, DropdownMenuItem as tt } from "./ui/dropdown-menu.js";
22
+ import { reportSlotScalar as Ar, ReportSlotWidget as Wr } from "./widgets/ReportSlotWidget.js";
23
+ import { ReviewListWidget as Ur } from "./widgets/ReviewListWidget.js";
24
+ import { RollupWidget as Pr } from "./widgets/RollupWidget.js";
25
+ const te = {
26
+ ArrowRight: wr,
27
+ ArrowLeft: yr,
28
+ ArrowUp: gr,
29
+ ArrowDown: hr,
30
+ ArrowUpRight: mr,
31
+ ExternalLink: pr,
32
+ Link: fr,
33
+ Share2: dr,
34
+ Check: ur,
35
+ CheckCircle: cr,
36
+ X: or,
37
+ XCircle: ar,
38
+ Plus: ir,
39
+ Minus: lr,
40
+ Edit: sr,
41
+ Edit2: nr,
42
+ Trash2: rr,
43
+ Save: tr,
44
+ Download: er,
45
+ Upload: Zt,
46
+ Send: Yt,
47
+ Eye: Xt,
48
+ EyeOff: zt,
49
+ Lock: Qt,
50
+ Unlock: Jt,
51
+ Star: Gt,
52
+ Heart: Kt,
53
+ Bookmark: Ft,
54
+ Flag: Vt,
55
+ AlertCircle: Bt,
56
+ AlertTriangle: lt,
57
+ Info: Ht,
58
+ HelpCircle: Mt,
59
+ Play: Pt,
60
+ Pause: Ut,
61
+ RefreshCw: it,
62
+ RotateCcw: Wt,
63
+ Settings: At,
64
+ Sliders: Dt,
65
+ Filter: It,
66
+ Search: Ot,
67
+ Power: jt,
68
+ Zap: qt,
69
+ Activity: Tt,
70
+ User: Et,
71
+ Users: $t,
72
+ UserPlus: Ct,
73
+ UserCheck: Lt,
74
+ Mail: Rt,
75
+ MessageSquare: St,
76
+ Phone: Nt,
77
+ Bell: kt,
78
+ FileText: _t,
79
+ File: vt,
80
+ Folder: bt,
81
+ Paperclip: xt,
82
+ Calendar: wt,
83
+ Clock: yt,
84
+ Copy: gt,
85
+ Clipboard: ht,
86
+ MoreHorizontal: mt,
87
+ MoreVertical: pt
87
88
  };
88
- function Re({ awaiting: n, dark: a }) {
89
- return /* @__PURE__ */ w(
89
+ function qe({ awaiting: n, dark: i }) {
90
+ return /* @__PURE__ */ x(
90
91
  "span",
91
92
  {
92
- className: `text-[12px] font-normal italic ${a ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
93
+ className: `text-[12px] font-normal italic ${i ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
93
94
  "data-widget-awaiting": n,
94
95
  "data-tip": `Waiting for ${n} — this figure is scoped to it and shows once it is set`,
95
96
  children: [
@@ -99,32 +100,32 @@ function Re({ awaiting: n, dark: a }) {
99
100
  }
100
101
  );
101
102
  }
102
- function be({
103
+ function Re({
103
104
  label: n,
104
- value: a,
105
- display: o,
106
- loading: s,
107
- awaiting: d
105
+ value: i,
106
+ display: a,
107
+ loading: l,
108
+ awaiting: u
108
109
  }) {
109
- const { prefix: g, suffix: v } = de(a, o), b = s ? null : ue(a, o.format ?? "");
110
+ const { prefix: g, suffix: v } = fe(i, a), b = l ? null : pe(i, a.format ?? "");
110
111
  return (
111
112
  // Same label / value vocabulary as a field tile in the record sub-header
112
113
  // (lib/header-strip.ts) — the two kinds of cell read as one row.
113
- /* @__PURE__ */ w(
114
+ /* @__PURE__ */ x(
114
115
  "div",
115
116
  {
116
- className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${hr} ${gr}`,
117
+ className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${Nr} ${Sr}`,
117
118
  children: [
118
- /* @__PURE__ */ t("span", { className: yr, "data-header-label": !0, children: n }),
119
+ /* @__PURE__ */ t("span", { className: Rr, "data-header-label": !0, children: n }),
119
120
  /* @__PURE__ */ t(
120
121
  "span",
121
122
  {
122
123
  "data-header-value": !0,
123
- className: `${xr} max-w-[232px] items-baseline truncate leading-tight`,
124
- children: s ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : d && a == null ? /* @__PURE__ */ t(Re, { awaiting: d }) : /* @__PURE__ */ w(
124
+ className: `${Lr} max-w-[232px] items-baseline truncate leading-tight`,
125
+ children: l ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : u && i == null ? /* @__PURE__ */ t(qe, { awaiting: u }) : /* @__PURE__ */ x(
125
126
  "span",
126
127
  {
127
- className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(g) ? wr : br,
128
+ className: String(a.format ?? "").startsWith("currency") || /^[$€£¥]/.test(g) ? Cr : $r,
128
129
  children: [
129
130
  g,
130
131
  b,
@@ -139,34 +140,34 @@ function be({
139
140
  )
140
141
  );
141
142
  }
142
- function Tr({
143
+ function Mr({
143
144
  data: n,
144
- label: a,
145
- loading: o,
146
- widgetConfig: s,
147
- awaiting: d
145
+ label: i,
146
+ loading: a,
147
+ widgetConfig: l,
148
+ awaiting: u
148
149
  }) {
149
150
  const g = "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";
150
151
  if (n && "values" in n) {
151
152
  const b = n.values ?? [];
152
153
  return b.length === 0 ? null : /* @__PURE__ */ t("div", { className: g, children: b.map((_, R) => /* @__PURE__ */ t(
153
- be,
154
+ Re,
154
155
  {
155
156
  label: _.label,
156
157
  value: _.value,
157
158
  display: _.display ?? {},
158
159
  loading: !1,
159
- awaiting: d
160
+ awaiting: u
160
161
  },
161
162
  R
162
163
  )) });
163
164
  }
164
- if (o) {
165
- const b = (s == null ? void 0 : s.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: a }];
165
+ if (a) {
166
+ const b = (l == null ? void 0 : l.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: i }];
166
167
  return /* @__PURE__ */ t("div", { className: g, children: _.map((R, C) => /* @__PURE__ */ t(
167
- be,
168
+ Re,
168
169
  {
169
- label: R.label ?? a,
170
+ label: R.label ?? i,
170
171
  display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
171
172
  loading: !0
172
173
  },
@@ -176,99 +177,99 @@ function Tr({
176
177
  if (!n) return null;
177
178
  const v = n.display ?? {};
178
179
  return /* @__PURE__ */ t("div", { className: g, children: /* @__PURE__ */ t(
179
- be,
180
+ Re,
180
181
  {
181
- label: a,
182
+ label: i,
182
183
  value: n.value,
183
184
  display: v,
184
185
  loading: !1,
185
- awaiting: d
186
+ awaiting: u
186
187
  }
187
188
  ) });
188
189
  }
189
- function qr(n, a) {
190
- if (Object.hasOwn(n, a)) return n[a] ?? null;
191
- const o = a.split(".");
192
- let s = n;
193
- for (const d of o) {
194
- if (s == null || typeof s != "object") return s ?? null;
195
- s = s[d];
190
+ function Hr(n, i) {
191
+ if (Object.hasOwn(n, i)) return n[i] ?? null;
192
+ const a = i.split(".");
193
+ let l = n;
194
+ for (const u of a) {
195
+ if (l == null || typeof l != "object") return l ?? null;
196
+ l = l[u];
196
197
  }
197
- return s ?? null;
198
+ return l ?? null;
198
199
  }
199
- function jr(n, a) {
200
- const o = {};
201
- for (const s of n)
202
- if (s.binding_type === "item_field")
203
- o[s.key] = qr(a, s.binding_value);
204
- else if (s.binding_type === "static")
205
- o[s.key] = s.binding_value;
206
- else if (s.binding_type === "url_param" && typeof window < "u") {
207
- const d = new URLSearchParams(window.location.search);
208
- o[s.key] = d.get(s.binding_value) ?? null;
200
+ function Br(n, i) {
201
+ const a = {};
202
+ for (const l of n)
203
+ if (l.binding_type === "item_field")
204
+ a[l.key] = Hr(i, l.binding_value);
205
+ else if (l.binding_type === "static")
206
+ a[l.key] = l.binding_value;
207
+ else if (l.binding_type === "url_param" && typeof window < "u") {
208
+ const u = new URLSearchParams(window.location.search);
209
+ a[l.key] = u.get(l.binding_value) ?? null;
209
210
  }
210
- return o;
211
+ return a;
211
212
  }
212
- function ve({
213
+ function Le({
213
214
  data: n,
214
- awaiting: a
215
+ awaiting: i
215
216
  }) {
216
- if (a && n.value == null) return /* @__PURE__ */ t(Re, { awaiting: a });
217
- const o = n.display ?? {}, { prefix: s, suffix: d } = de(n.value, o), g = ue(n.value, o.format ?? "");
218
- return /* @__PURE__ */ w("div", { className: "flex items-baseline gap-1", children: [
219
- s && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: s }),
217
+ if (i && n.value == null) return /* @__PURE__ */ t(qe, { awaiting: i });
218
+ const a = n.display ?? {}, { prefix: l, suffix: u } = fe(n.value, a), g = pe(n.value, a.format ?? "");
219
+ return /* @__PURE__ */ x("div", { className: "flex items-baseline gap-1", children: [
220
+ l && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: l }),
220
221
  /* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: g }),
221
- d && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: d })
222
+ u && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: u })
222
223
  ] });
223
224
  }
224
- function _e({
225
+ function Ce({
225
226
  label: n,
226
- value: a,
227
- display: o,
228
- dark: s,
229
- loading: d,
227
+ value: i,
228
+ display: a,
229
+ dark: l,
230
+ loading: u,
230
231
  awaiting: g
231
232
  }) {
232
- const { prefix: v, suffix: b } = de(a, o), _ = d ? null : ue(a, o.format ?? "");
233
- return /* @__PURE__ */ w("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
233
+ const { prefix: v, suffix: b } = fe(i, a), _ = u ? null : pe(i, a.format ?? "");
234
+ return /* @__PURE__ */ x("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
234
235
  /* @__PURE__ */ t(
235
236
  "span",
236
237
  {
237
- className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${s ? "text-slate-500" : "text-slate-400"}`,
238
+ className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${l ? "text-slate-500" : "text-slate-400"}`,
238
239
  children: n
239
240
  }
240
241
  ),
241
242
  /* @__PURE__ */ t(
242
243
  "span",
243
244
  {
244
- className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${s ? "text-slate-100" : "text-slate-900"}`,
245
- children: d ? /* @__PURE__ */ t(
245
+ className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${l ? "text-slate-100" : "text-slate-900"}`,
246
+ children: u ? /* @__PURE__ */ t(
246
247
  "span",
247
248
  {
248
- className: `animate-pulse inline-block h-3 w-14 rounded ${s ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
249
+ className: `animate-pulse inline-block h-3 w-14 rounded ${l ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
249
250
  }
250
- ) : g && a == null ? /* @__PURE__ */ t(Re, { awaiting: g, dark: s }) : /* @__PURE__ */ w(ke, { children: [
251
- v && /* @__PURE__ */ t("span", { className: `text-[10px] ${s ? "text-slate-400" : "text-slate-500"}`, children: v }),
251
+ ) : g && i == null ? /* @__PURE__ */ t(qe, { awaiting: g, dark: l }) : /* @__PURE__ */ x(Ee, { children: [
252
+ v && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: v }),
252
253
  _,
253
- b && /* @__PURE__ */ t("span", { className: `text-[10px] ${s ? "text-slate-400" : "text-slate-500"}`, children: b })
254
+ b && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: b })
254
255
  ] })
255
256
  }
256
257
  )
257
258
  ] });
258
259
  }
259
- function Or({
260
+ function Vr({
260
261
  data: n,
261
- label: a,
262
- style: o,
263
- loading: s,
264
- widgetConfig: d,
262
+ label: i,
263
+ style: a,
264
+ loading: l,
265
+ widgetConfig: u,
265
266
  awaiting: g
266
267
  }) {
267
- 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";
268
+ const v = a === "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";
268
269
  if (n && "values" in n) {
269
270
  const R = n.values ?? [];
270
271
  return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: b, children: R.map((C, S) => /* @__PURE__ */ t(
271
- _e,
272
+ Ce,
272
273
  {
273
274
  label: C.label,
274
275
  value: C.value,
@@ -280,12 +281,12 @@ function Or({
280
281
  S
281
282
  )) });
282
283
  }
283
- if (s) {
284
- const R = (d == null ? void 0 : d.value_fields) ?? [], C = R.length > 0 ? R : [{ label: a }];
284
+ if (l) {
285
+ const R = (u == null ? void 0 : u.value_fields) ?? [], C = R.length > 0 ? R : [{ label: i }];
285
286
  return /* @__PURE__ */ t("div", { className: b, children: C.map((S, U) => /* @__PURE__ */ t(
286
- _e,
287
+ Ce,
287
288
  {
288
- label: S.label ?? a,
289
+ label: S.label ?? i,
289
290
  display: { prefix: S.prefix ?? "", suffix: S.suffix ?? "", format: S.format ?? "" },
290
291
  dark: v,
291
292
  loading: !0
@@ -296,9 +297,9 @@ function Or({
296
297
  if (!n) return null;
297
298
  const _ = n.display ?? {};
298
299
  return /* @__PURE__ */ t("div", { className: b, children: /* @__PURE__ */ t(
299
- _e,
300
+ Ce,
300
301
  {
301
- label: a,
302
+ label: i,
302
303
  value: n.value,
303
304
  display: _,
304
305
  dark: v,
@@ -307,46 +308,46 @@ function Or({
307
308
  }
308
309
  ) });
309
310
  }
310
- function Qe({ data: n }) {
311
- const a = n.values ?? [];
312
- return a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
311
+ function rt({ data: n }) {
312
+ const i = n.values ?? [];
313
+ return i.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
313
314
  "div",
314
315
  {
315
316
  className: "grid gap-3",
316
- style: { gridTemplateColumns: `repeat(${Math.min(a.length, 3)}, minmax(0, 1fr))` },
317
- children: a.map((o, s) => {
317
+ style: { gridTemplateColumns: `repeat(${Math.min(i.length, 3)}, minmax(0, 1fr))` },
318
+ children: i.map((a, l) => {
318
319
  var b;
319
- const { prefix: d, suffix: g } = de(o.value, o.display), v = ((b = o.display) == null ? void 0 : b.format) ?? "";
320
- return /* @__PURE__ */ w("div", { className: "flex flex-col gap-0.5", children: [
321
- o.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: o.label }),
322
- /* @__PURE__ */ w("div", { className: "flex items-baseline gap-0.5", children: [
323
- d && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: d }),
324
- /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: ue(o.value, v) }),
320
+ const { prefix: u, suffix: g } = fe(a.value, a.display), v = ((b = a.display) == null ? void 0 : b.format) ?? "";
321
+ return /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
322
+ a.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: a.label }),
323
+ /* @__PURE__ */ x("div", { className: "flex items-baseline gap-0.5", children: [
324
+ u && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: u }),
325
+ /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: pe(a.value, v) }),
325
326
  g && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: g })
326
327
  ] })
327
- ] }, s);
328
+ ] }, l);
328
329
  })
329
330
  }
330
331
  );
331
332
  }
332
- function Ir({ data: n }) {
333
- const a = n.rows ?? [], o = n.fields ?? [];
334
- return a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ w("table", { className: "w-full text-[12px]", children: [
335
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((s) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: s }, s)) }) }),
336
- /* @__PURE__ */ t("tbody", { children: a.map((s, d) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: o.map((g) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(s[g] ?? "") }, g)) }, d)) })
333
+ function Fr({ data: n }) {
334
+ const i = n.rows ?? [], a = n.fields ?? [];
335
+ return i.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: [
336
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: a.map((l) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: l }, l)) }) }),
337
+ /* @__PURE__ */ t("tbody", { children: i.map((l, u) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: a.map((g) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(l[g] ?? "") }, g)) }, u)) })
337
338
  ] }) });
338
339
  }
339
- function ze({
340
+ function nt({
340
341
  data: n,
341
- widgetId: a,
342
- inputs: o,
343
- apiBase: s,
344
- onAction: d
342
+ widgetId: i,
343
+ inputs: a,
344
+ apiBase: l,
345
+ onAction: u
345
346
  }) {
346
- const g = n.buttons ?? [], [v, b] = H(null), _ = Se(), R = async (C) => {
347
+ const g = n.buttons ?? [], [v, b] = B(null), _ = Te(), R = async (C) => {
347
348
  b(C);
348
349
  try {
349
- const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", $ = (await (await fetch(`${s}/widgets-internal/${a}/action`, {
350
+ const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", E = (await (await fetch(`${l}/widgets-internal/${i}/action`, {
350
351
  method: "POST",
351
352
  headers: {
352
353
  "Content-Type": "application/json",
@@ -354,26 +355,26 @@ function ze({
354
355
  ...S ? { "x-workspace": S } : {}
355
356
  },
356
357
  credentials: _.credentials,
357
- body: JSON.stringify({ button_index: C, inputs: o })
358
+ body: JSON.stringify({ button_index: C, inputs: a })
358
359
  })).json()).data;
359
- if ($ != null && $.redirect_url)
360
+ if (E != null && E.redirect_url)
360
361
  try {
361
- const E = new URL($.redirect_url, window.location.origin);
362
- E.origin === window.location.origin && (window.location.href = E.toString());
362
+ const T = new URL(E.redirect_url, window.location.origin);
363
+ T.origin === window.location.origin && (window.location.href = T.toString());
363
364
  } catch {
364
365
  }
365
- d == null || d($);
366
+ u == null || u(E);
366
367
  } finally {
367
368
  b(null);
368
369
  }
369
370
  };
370
371
  return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: g.map((C, S) => {
371
- const U = C.style ?? "secondary", A = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50", $ = U === "primary" ? `${A} bg-nvr-cyan text-white hover:bg-nvr-cyan/90` : U === "danger" ? `${A} bg-red-500 text-white hover:bg-red-600` : `${A} border border-slate-200 bg-white text-slate-700 hover:bg-slate-50`;
372
+ const U = C.style ?? "secondary", A = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50", E = U === "primary" ? `${A} bg-nvr-cyan text-white hover:bg-nvr-cyan/90` : U === "danger" ? `${A} bg-red-500 text-white hover:bg-red-600` : `${A} border border-slate-200 bg-white text-slate-700 hover:bg-slate-50`;
372
373
  return /* @__PURE__ */ t(
373
374
  "button",
374
375
  {
375
376
  type: "button",
376
- className: $,
377
+ className: E,
377
378
  disabled: v !== null,
378
379
  onClick: () => R(S),
379
380
  children: v === S ? "…" : String(C.label ?? `Action ${S + 1}`)
@@ -382,29 +383,29 @@ function ze({
382
383
  );
383
384
  }) });
384
385
  }
385
- const Dr = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
386
- function Ne({
386
+ const Kr = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
387
+ function $e({
387
388
  buttons: n,
388
- layout: a,
389
- widgetId: o,
390
- inputs: s,
391
- apiBase: d,
389
+ layout: i,
390
+ widgetId: a,
391
+ inputs: l,
392
+ apiBase: u,
392
393
  onClientAction: g
393
394
  }) {
394
- const [v, b] = H(null), [_, R] = H(null), [C, S] = H({}), U = re(null), A = Se();
395
- function $(e) {
395
+ const [v, b] = B(null), [_, R] = B(null), [C, S] = B({}), U = F(null), A = Te();
396
+ function E(e) {
396
397
  return e === !0 || e === 1 ? "1" : e === !1 || e === 0 ? "0" : String(e ?? "");
397
398
  }
398
- function E(e, f) {
399
- const u = e.id ?? String(f);
400
- return C[u] !== void 0 ? C[u] : e.is_on !== void 0 ? e.is_on : $(s[e.toggle_input ?? ""]) === $(e.toggle_on_value ?? "1");
399
+ function T(e, f) {
400
+ const d = e.id ?? String(f);
401
+ return C[d] !== void 0 ? C[d] : e.is_on !== void 0 ? e.is_on : E(l[e.toggle_input ?? ""]) === E(e.toggle_on_value ?? "1");
401
402
  }
402
- function Z(e, f) {
403
+ function K(e, f) {
403
404
  if (e.action !== "toggle") return e.label ?? `Action ${f + 1}`;
404
- 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;
405
- return E(T, f) ? e.label_on || e.label || `Action ${f + 1}` : e.label_off || e.label || `Action ${f + 1}`;
405
+ const d = e.action_config, p = e.toggle_input || (d == null ? void 0 : d.toggle_input) || (d == null ? void 0 : d.field) || "", q = p && p !== e.toggle_input ? { ...e, toggle_input: p } : e;
406
+ return T(q, f) ? e.label_on || e.label || `Action ${f + 1}` : e.label_off || e.label || `Action ${f + 1}`;
406
407
  }
407
- function fe(e) {
408
+ function me(e) {
408
409
  try {
409
410
  if (e.startsWith("/") && !e.startsWith("//")) return e;
410
411
  const f = new URL(e, window.location.origin);
@@ -414,10 +415,10 @@ function Ne({
414
415
  }
415
416
  }
416
417
  async function r(e, f) {
417
- const u = e.id ?? String(f);
418
- R(u);
418
+ const d = e.id ?? String(f);
419
+ R(d);
419
420
  try {
420
- const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", x = (await (await fetch(`${d}/widgets-internal/${o}/action`, {
421
+ const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", w = (await (await fetch(`${u}/widgets-internal/${a}/action`, {
421
422
  method: "POST",
422
423
  headers: {
423
424
  "Content-Type": "application/json",
@@ -425,109 +426,109 @@ function Ne({
425
426
  ...p ? { "x-workspace": p } : {}
426
427
  },
427
428
  credentials: A.credentials,
428
- body: JSON.stringify({ button_index: f, inputs: s })
429
+ body: JSON.stringify({ button_index: f, inputs: l })
429
430
  })).json()).data;
430
- if (x != null && x.redirect_url)
431
+ if (w != null && w.redirect_url)
431
432
  try {
432
- const N = new URL(x.redirect_url, window.location.origin);
433
- N.origin === window.location.origin && (window.location.href = N.toString());
433
+ const k = new URL(w.redirect_url, window.location.origin);
434
+ k.origin === window.location.origin && (window.location.href = k.toString());
434
435
  } catch {
435
436
  }
436
437
  } finally {
437
438
  R(null);
438
439
  }
439
440
  }
440
- function G(e, f) {
441
- const u = e.action ?? "open-url";
442
- if (Dr.has(u)) {
443
- if (u === "toggle") {
441
+ function Z(e, f) {
442
+ const d = e.action ?? "open-url";
443
+ if (Kr.has(d)) {
444
+ if (d === "toggle") {
444
445
  const p = e.id ?? String(f);
445
- S((T) => ({ ...T, [p]: !E(e, f) }));
446
+ S((q) => ({ ...q, [p]: !T(e, f) }));
446
447
  }
447
448
  r(e, f);
448
449
  return;
449
450
  }
450
- if (u === "open-url" && e.url) {
451
- const p = fe(e.url);
451
+ if (d === "open-url" && e.url) {
452
+ const p = me(e.url);
452
453
  if (!p) return;
453
454
  e.new_tab ? window.open(p, "_blank", "noopener,noreferrer") : window.location.href = p;
454
- } else if (u === "email") {
455
+ } else if (d === "email") {
455
456
  const p = [];
456
457
  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("&")}` : ""}`;
457
- } else if (u === "copy") {
458
+ } else if (d === "copy") {
458
459
  const p = e.copy_value ?? "";
459
460
  navigator.clipboard.writeText(p).then(() => {
460
461
  b(e.id ?? String(f)), U.current && clearTimeout(U.current), U.current = setTimeout(() => b(null), 1800);
461
462
  });
462
- } else u === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (g == null || g({
463
+ } else d === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (g == null || g({
463
464
  type: "open-sidebar",
464
465
  collection: e.sidebar_collection,
465
466
  itemId: e.sidebar_id
466
467
  }));
467
468
  }
468
- function i(e) {
469
+ function o(e) {
469
470
  const f = e.replace("#", "");
470
471
  if (f.length < 6) return !0;
471
- const u = parseInt(f.slice(0, 2), 16), p = parseInt(f.slice(2, 4), 16), T = parseInt(f.slice(4, 6), 16);
472
- return (u * 299 + p * 587 + T * 114) / 1e3 > 128;
472
+ const d = parseInt(f.slice(0, 2), 16), p = parseInt(f.slice(2, 4), 16), q = parseInt(f.slice(4, 6), 16);
473
+ return (d * 299 + p * 587 + q * 114) / 1e3 > 128;
473
474
  }
474
- function ne(e, f, u) {
475
- const p = e.id ?? String(f), T = v === p, P = _ === p;
476
- let x = e.label ?? "Button", N = e.variant ?? "secondary";
477
- const M = e.action_config, I = e.toggle_input || (M == null ? void 0 : M.toggle_input) || (M == null ? void 0 : M.field) || "";
475
+ function le(e, f, d) {
476
+ const p = e.id ?? String(f), q = v === p, P = _ === p;
477
+ let w = e.label ?? "Button", k = e.variant ?? "secondary";
478
+ const M = e.action_config, j = e.toggle_input || (M == null ? void 0 : M.toggle_input) || (M == null ? void 0 : M.field) || "";
478
479
  if (e.action === "toggle") {
479
- const q = I && I !== e.toggle_input ? { ...e, toggle_input: I } : e, J = E(q, f);
480
- x = J ? e.label_on || x : e.label_off || x, N = J ? e.variant_on ?? N : e.variant_off ?? N;
480
+ const $ = j && j !== e.toggle_input ? { ...e, toggle_input: j } : e, J = T($, f);
481
+ w = J ? e.label_on || w : e.label_off || w, k = J ? e.variant_on ?? k : e.variant_off ?? k;
481
482
  }
482
- const F = e.icon ? Y[e.icon] : null, L = e.color ? {
483
+ const G = e.icon ? te[e.icon] : null, L = e.color ? {
483
484
  backgroundColor: e.color,
484
485
  borderColor: e.color,
485
- color: i(e.color) ? "#1e293b" : "#ffffff"
486
+ color: o(e.color) ? "#1e293b" : "#ffffff"
486
487
  } : void 0;
487
- return /* @__PURE__ */ w(
488
- ce,
488
+ return /* @__PURE__ */ x(
489
+ de,
489
490
  {
490
491
  type: "button",
491
- variant: N,
492
+ variant: k,
492
493
  size: "sm",
493
494
  className: "h-7 gap-1.5 text-[12px]",
494
495
  style: L,
495
496
  disabled: _ !== null,
496
- onClick: () => G(e, f),
497
+ onClick: () => Z(e, f),
497
498
  children: [
498
- F && /* @__PURE__ */ t(F, { className: "h-3.5 w-3.5 shrink-0" }),
499
- P ? "…" : T ? "✓ Copied" : x
499
+ G && /* @__PURE__ */ t(G, { className: "h-3.5 w-3.5 shrink-0" }),
500
+ P ? "…" : q ? "✓ Copied" : w
500
501
  ]
501
502
  },
502
503
  p
503
504
  );
504
505
  }
505
506
  if (n.length === 0) return null;
506
- if (a === "split" && n.length > 1) {
507
- const [e, ...f] = n, u = e.id ?? "0", p = _ === u, T = e.action === "none" || !e.action;
508
- let P = e.label ?? "Button", x = e.variant ?? "default";
509
- const N = e.action_config, M = e.toggle_input || (N == null ? void 0 : N.toggle_input) || (N == null ? void 0 : N.field) || "";
507
+ if (i === "split" && n.length > 1) {
508
+ const [e, ...f] = n, d = e.id ?? "0", p = _ === d, q = e.action === "none" || !e.action;
509
+ let P = e.label ?? "Button", w = e.variant ?? "default";
510
+ const k = e.action_config, M = e.toggle_input || (k == null ? void 0 : k.toggle_input) || (k == null ? void 0 : k.field) || "";
510
511
  if (e.action === "toggle" && M) {
511
- const L = M !== e.toggle_input ? { ...e, toggle_input: M } : e, q = E(L, 0);
512
- P = q ? e.label_on || P : e.label_off || P, x = q ? e.variant_on ?? x : e.variant_off ?? x;
512
+ const L = M !== e.toggle_input ? { ...e, toggle_input: M } : e, $ = T(L, 0);
513
+ P = $ ? e.label_on || P : e.label_off || P, w = $ ? e.variant_on ?? w : e.variant_off ?? w;
513
514
  }
514
- const I = e.icon ? Y[e.icon] : null, F = e.color ? {
515
+ const j = e.icon ? te[e.icon] : null, G = e.color ? {
515
516
  backgroundColor: e.color,
516
517
  borderColor: e.color,
517
- color: i(e.color) ? "#1e293b" : "#ffffff"
518
+ color: o(e.color) ? "#1e293b" : "#ffffff"
518
519
  } : void 0;
519
- return T ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ w(Ve, { children: [
520
- /* @__PURE__ */ t(Fe, { asChild: !0, children: /* @__PURE__ */ w(
521
- ce,
520
+ return q ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ x(Ye, { children: [
521
+ /* @__PURE__ */ t(Ze, { asChild: !0, children: /* @__PURE__ */ x(
522
+ de,
522
523
  {
523
524
  type: "button",
524
- variant: x,
525
+ variant: w,
525
526
  size: "sm",
526
527
  className: "h-7 gap-1.5 text-[12px]",
527
- style: F,
528
+ style: G,
528
529
  disabled: _ !== null,
529
530
  children: [
530
- I && /* @__PURE__ */ t(I, { className: "h-3.5 w-3.5 shrink-0" }),
531
+ j && /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 shrink-0" }),
531
532
  P,
532
533
  /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
533
534
  "path",
@@ -542,47 +543,47 @@ function Ne({
542
543
  ]
543
544
  }
544
545
  ) }),
545
- /* @__PURE__ */ t(Je, { align: "end", className: "min-w-[140px]", children: f.map((L, q) => /* @__PURE__ */ w(
546
- Ke,
546
+ /* @__PURE__ */ t(et, { align: "end", className: "min-w-[140px]", children: f.map((L, $) => /* @__PURE__ */ x(
547
+ tt,
547
548
  {
548
549
  className: "cursor-pointer text-[12px]",
549
- onSelect: () => G(L, q + 1),
550
+ onSelect: () => Z(L, $ + 1),
550
551
  children: [
551
- L.icon && Y[L.icon] && (() => {
552
- const J = Y[L.icon];
552
+ L.icon && te[L.icon] && (() => {
553
+ const J = te[L.icon];
553
554
  return /* @__PURE__ */ t(J, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
554
555
  })(),
555
- Z(L, q + 1)
556
+ K(L, $ + 1)
556
557
  ]
557
558
  },
558
- L.id ?? q
559
+ L.id ?? $
559
560
  )) })
560
- ] }) }) : /* @__PURE__ */ w("div", { className: "flex items-center", children: [
561
- /* @__PURE__ */ w(
562
- ce,
561
+ ] }) }) : /* @__PURE__ */ x("div", { className: "flex items-center", children: [
562
+ /* @__PURE__ */ x(
563
+ de,
563
564
  {
564
565
  type: "button",
565
- variant: x,
566
+ variant: w,
566
567
  size: "sm",
567
568
  className: "h-7 rounded-r-none text-[12px] gap-1.5 border-r-0",
568
- style: F,
569
+ style: G,
569
570
  disabled: _ !== null,
570
- onClick: () => G(e, 0),
571
+ onClick: () => Z(e, 0),
571
572
  children: [
572
- I && /* @__PURE__ */ t(I, { className: "h-3.5 w-3.5 shrink-0" }),
573
- p ? "…" : v === u ? "✓ Copied" : P
573
+ j && /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 shrink-0" }),
574
+ p ? "…" : v === d ? "✓ Copied" : P
574
575
  ]
575
576
  }
576
577
  ),
577
- /* @__PURE__ */ w(Ve, { children: [
578
- /* @__PURE__ */ t(Fe, { asChild: !0, children: /* @__PURE__ */ t(
579
- ce,
578
+ /* @__PURE__ */ x(Ye, { children: [
579
+ /* @__PURE__ */ t(Ze, { asChild: !0, children: /* @__PURE__ */ t(
580
+ de,
580
581
  {
581
582
  type: "button",
582
- variant: x,
583
+ variant: w,
583
584
  size: "sm",
584
585
  className: "h-7 rounded-l-none px-1.5 text-[12px]",
585
- style: F,
586
+ style: G,
586
587
  disabled: _ !== null,
587
588
  "aria-label": "More actions",
588
589
  children: /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
@@ -597,38 +598,51 @@ function Ne({
597
598
  ) })
598
599
  }
599
600
  ) }),
600
- /* @__PURE__ */ t(Je, { align: "end", className: "min-w-[140px]", children: f.map((L, q) => /* @__PURE__ */ w(
601
- Ke,
601
+ /* @__PURE__ */ t(et, { align: "end", className: "min-w-[140px]", children: f.map((L, $) => /* @__PURE__ */ x(
602
+ tt,
602
603
  {
603
604
  className: "text-[12px]",
604
- onSelect: () => G(L, q + 1),
605
+ onSelect: () => Z(L, $ + 1),
605
606
  children: [
606
- L.icon && Y[L.icon] && (() => {
607
- const J = Y[L.icon];
607
+ L.icon && te[L.icon] && (() => {
608
+ const J = te[L.icon];
608
609
  return /* @__PURE__ */ t(J, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
609
610
  })(),
610
- Z(L, q + 1)
611
+ K(L, $ + 1)
611
612
  ]
612
613
  },
613
- L.id ?? q
614
+ L.id ?? $
614
615
  )) })
615
616
  ] })
616
617
  ] });
617
618
  }
618
- return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, f) => ne(e, f)) });
619
+ return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, f) => le(e, f)) });
619
620
  }
620
- function Ge(n, a) {
621
- var s;
622
- if (a == null) return { next: n, moved: !1 };
623
- const o = ((s = a == null ? void 0 : a.instance) == null ? void 0 : s.current_state) ?? null;
624
- return { next: o, moved: n !== void 0 && n !== o };
621
+ function st(n, i) {
622
+ var l;
623
+ if (i == null) return { next: n, moved: !1 };
624
+ const a = ((l = i == null ? void 0 : i.instance) == null ? void 0 : l.current_state) ?? null;
625
+ return { next: a, moved: n !== void 0 && n !== a };
625
626
  }
626
- function on({
627
+ const Gr = 5e3, Jr = /* @__PURE__ */ new Set([
628
+ se.comments,
629
+ se.tasks,
630
+ se.lock,
631
+ se.sla,
632
+ // A move refreshes widgets through the host's pipeline read (hostStepChange below).
633
+ se.state
634
+ ]);
635
+ function Qr(n, i) {
636
+ return n.deleted ? !1 : n.changedFields === null ? !0 : n.changedFields.some(
637
+ (a) => a.startsWith("$") ? !Jr.has(a) : !i.has(a)
638
+ );
639
+ }
640
+ function _n({
627
641
  widgetId: n,
628
- inputBindings: a = [],
629
- itemDraft: o = {},
630
- itemCollection: s,
631
- ready: d = !0,
642
+ inputBindings: i = [],
643
+ itemDraft: a = {},
644
+ itemCollection: l,
645
+ ready: u = !0,
632
646
  label: g,
633
647
  defaultExpanded: v = !0,
634
648
  frameless: b = !1,
@@ -639,95 +653,125 @@ function on({
639
653
  onWidgetType: U,
640
654
  onContentChange: A
641
655
  }) {
642
- var De, Ae;
643
- const $ = Se(), E = _ ?? $.apiBase, [Z, fe] = vr(v, !0), [r, G] = H(null), [i, ne] = H(null), [e, f] = H(!0), [u, p] = H(!0), [T, P] = H(!0), [x, N] = H(null), [M, I] = H(0), [F, L] = H(null), q = re(!1), J = Ue(() => {
644
- q.current = !0, I((l) => l + 1);
645
- }, []), K = re(null), le = re(void 0), pe = re(!1), se = rt();
646
- te(() => {
647
- var k;
648
- const l = r == null ? void 0 : r.widget_type;
649
- if (l !== "rollup" && l !== "review_list" && l !== "custom-query") return;
656
+ var Fe, Ke;
657
+ const E = Te(), T = _ ?? E.apiBase, [K, me] = Tr(v, !0), [r, Z] = B(null), [o, le] = B(null), [e, f] = B(!0), [d, p] = B(!0), [q, P] = B(!0), [w, k] = B(null), [M, j] = B(0), [G, L] = B(null), $ = F(!1), J = Ne(() => {
658
+ $.current = !0, j((s) => s + 1);
659
+ }, []), Q = F(null), ie = F(void 0), he = F(!1), ae = dt();
660
+ Y(() => {
661
+ var N;
662
+ const s = r == null ? void 0 : r.widget_type;
663
+ if (s !== "rollup" && s !== "review_list" && s !== "custom-query") return;
650
664
  let c = null;
651
- if (le.current === void 0 && K.current != null) {
652
- const h = se.getQueryCache().findAll({ queryKey: ["pipeline-instance-lock"] }).find((O) => String(O.queryKey[2]) === String(K.current));
653
- (h == null ? void 0 : h.state.status) === "success" && (le.current = Ge(void 0, h.state.data).next);
665
+ if (ie.current === void 0 && Q.current != null) {
666
+ const h = ae.getQueryCache().findAll({ queryKey: ["pipeline-instance-lock"] }).find((I) => String(I.queryKey[2]) === String(Q.current));
667
+ (h == null ? void 0 : h.state.status) === "success" && (ie.current = st(void 0, h.state.data).next);
654
668
  }
655
669
  const m = /* @__PURE__ */ new WeakMap();
656
- for (const h of se.getQueryCache().getAll()) {
657
- const O = (k = h.queryKey) == null ? void 0 : k[0];
658
- typeof O != "string" || h.state.status !== "success" || (O.startsWith("o2m-rows") || O.startsWith("nested") || O === "match-agg" || O === "m2m-items") && m.set(h, h.state.data);
670
+ for (const h of ae.getQueryCache().getAll()) {
671
+ const I = (N = h.queryKey) == null ? void 0 : N[0];
672
+ typeof I != "string" || h.state.status !== "success" || (I.startsWith("o2m-rows") || I.startsWith("nested") || I === "match-agg" || I === "m2m-items") && m.set(h, h.state.data);
659
673
  }
660
- const j = se.getQueryCache().subscribe((h) => {
661
- var We;
662
- if (h.type !== "updated" || ((We = h.action) == null ? void 0 : We.type) !== "success") return;
663
- const O = h.query.queryKey, W = O == null ? void 0 : O[0];
674
+ const O = ae.getQueryCache().subscribe((h) => {
675
+ var Ge;
676
+ if (h.type !== "updated" || ((Ge = h.action) == null ? void 0 : Ge.type) !== "success") return;
677
+ const I = h.query.queryKey, W = I == null ? void 0 : I[0];
664
678
  if (typeof W != "string") return;
665
679
  if (W.startsWith("o2m-rows") || W.startsWith("nested") || W === "match-agg" || W === "m2m-items") {
666
- const X = m.has(h.query), xe = m.get(h.query);
667
- if (m.set(h.query, h.query.state.data), X && xe === h.query.state.data) return;
680
+ const ee = m.has(h.query), ke = m.get(h.query);
681
+ if (m.set(h.query, h.query.state.data), ee && ke === h.query.state.data) return;
668
682
  }
669
683
  if (W === "pipeline-instance-lock") {
670
- if (K.current == null || String(O[2]) !== String(K.current))
684
+ if (Q.current == null || String(I[2]) !== String(Q.current))
671
685
  return;
672
- const X = Ge(le.current, h.query.state.data);
673
- if (le.current = X.next, !X.moved) return;
686
+ const ee = st(ie.current, h.query.state.data);
687
+ if (ie.current = ee.next, !ee.moved) return;
674
688
  c && clearTimeout(c), c = setTimeout(() => {
675
- q.current = !0, I((xe) => xe + 1);
689
+ $.current = !0, j((ke) => ke + 1);
676
690
  }, 400);
677
691
  return;
678
692
  }
679
- !W.startsWith("o2m-rows") && !W.startsWith("nested") && W !== "match-agg" && W !== "m2m-items" || h.query.state.dataUpdateCount <= 1 || W.startsWith("o2m-rows") && K.current != null && String(O[3]) !== String(K.current) || (c && clearTimeout(c), c = setTimeout(() => I((X) => X + 1), 400));
693
+ !W.startsWith("o2m-rows") && !W.startsWith("nested") && W !== "match-agg" && W !== "m2m-items" || h.query.state.dataUpdateCount <= 1 || W.startsWith("o2m-rows") && Q.current != null && String(I[3]) !== String(Q.current) || (c && clearTimeout(c), c = setTimeout(() => j((ee) => ee + 1), 400));
680
694
  });
681
695
  return () => {
682
- c && clearTimeout(c), j();
696
+ c && clearTimeout(c), O();
683
697
  };
684
- }, [se, r == null ? void 0 : r.widget_type]);
685
- const Le = {};
686
- for (const [l, c] of Object.entries(o))
687
- l.includes(".") || (c == null || typeof c != "object") && (Le[l] = c);
688
- const D = { ...Le, ...jr(a, o) }, me = Sr(), Q = Pe(() => {
689
- if ((r == null ? void 0 : r.widget_type) !== "rollup" || !me) return null;
690
- const l = r.config, c = l == null ? void 0 : l.collection;
698
+ }, [ae, r == null ? void 0 : r.widget_type]);
699
+ const ge = a.id, je = F(/* @__PURE__ */ new Set());
700
+ je.current = new Set(Object.keys(a));
701
+ const at = !!r && (r.widget_type === "rollup" || r.widget_type === "review_list" || r.widget_type === "custom-query" || i.length > 0), ye = F(!1), re = F(null), Oe = F(0), Ie = F(K);
702
+ Ie.current = K;
703
+ const we = Ne(() => {
704
+ if (!Ie.current) {
705
+ ye.current = !0;
706
+ return;
707
+ }
708
+ if (re.current) return;
709
+ const s = Math.max(1200, Oe.current + Gr - Date.now());
710
+ re.current = setTimeout(() => {
711
+ re.current = null, Oe.current = Date.now(), $.current = !0, j((c) => c + 1);
712
+ }, s);
713
+ }, []);
714
+ Er(
715
+ l,
716
+ ge,
717
+ (s) => {
718
+ Qr(s, je.current) && we();
719
+ },
720
+ { enabled: at && ge != null && ge !== "" }
721
+ ), Y(() => {
722
+ K && ye.current && (ye.current = !1, we());
723
+ }, [K, we]), Y(
724
+ () => () => {
725
+ re.current && clearTimeout(re.current);
726
+ },
727
+ []
728
+ );
729
+ const De = {};
730
+ for (const [s, c] of Object.entries(a))
731
+ s.includes(".") || (c == null || typeof c != "object") && (De[s] = c);
732
+ const D = { ...De, ...Br(i, a) }, xe = Ir(), z = Je(() => {
733
+ if ((r == null ? void 0 : r.widget_type) !== "rollup" || !xe) return null;
734
+ const s = r.config, c = s == null ? void 0 : s.collection;
691
735
  if (!c) return null;
692
736
  const m = {
693
737
  created: [],
694
738
  updated: [],
695
739
  deleted: []
696
740
  };
697
- for (const j of me.byGrid.values()) {
698
- const k = j[c];
699
- k && (m.created.push(...k.created), m.updated.push(...k.updated), m.deleted.push(...k.deleted));
741
+ for (const O of xe.byGrid.values()) {
742
+ const N = O[c];
743
+ N && (m.created.push(...N.created), m.updated.push(...N.updated), m.deleted.push(...N.deleted));
700
744
  }
701
745
  return !m.created.length && !m.updated.length && !m.deleted.length ? null : m;
702
- }, [r, me]), Ze = Pe(
703
- () => Q ? JSON.stringify(Q) : "",
704
- [Q]
705
- ), y = (De = r == null ? void 0 : r.config) == null ? void 0 : De.drilldown, ie = dr(), he = y != null && y.id_input ? D[y.id_input] : null, ge = !!ie && !!(y != null && y.collection) && he != null && he !== "", Ce = async () => {
706
- var j, k;
707
- if (!ge || !(y != null && y.collection)) return;
708
- const l = String(he);
746
+ }, [r, xe]), ot = Je(
747
+ () => z ? JSON.stringify(z) : "",
748
+ [z]
749
+ ), y = (Fe = r == null ? void 0 : r.config) == null ? void 0 : Fe.drilldown, oe = xr(), be = y != null && y.id_input ? D[y.id_input] : null, ve = !!oe && !!(y != null && y.collection) && be != null && be !== "", Ae = async () => {
750
+ var O, N;
751
+ if (!ve || !(y != null && y.collection)) return;
752
+ const s = String(be);
709
753
  let c = null;
710
- const m = (h) => fetch(`${E}${h}`, {
711
- credentials: $.credentials,
712
- headers: $.authHeaders
754
+ const m = (h) => fetch(`${T}${h}`, {
755
+ credentials: E.credentials,
756
+ headers: E.authHeaders
713
757
  });
714
758
  try {
715
759
  if (y.match_field) {
716
760
  const h = await m(
717
761
  `/items/${y.collection}?filter=${encodeURIComponent(
718
- JSON.stringify({ [y.match_field]: { _eq: l } })
762
+ JSON.stringify({ [y.match_field]: { _eq: s } })
719
763
  )}&fields=id&limit=1`
720
764
  );
721
765
  if (h.ok) {
722
- const O = await h.json(), W = (k = (j = O == null ? void 0 : O.data) == null ? void 0 : j[0]) == null ? void 0 : k.id;
766
+ const I = await h.json(), W = (N = (O = I == null ? void 0 : I.data) == null ? void 0 : O[0]) == null ? void 0 : N.id;
723
767
  W != null && (c = String(W));
724
768
  }
725
769
  }
726
- c == null && (await m(`/items/${y.collection}/${encodeURIComponent(l)}?fields=id`)).ok && (c = l);
770
+ c == null && (await m(`/items/${y.collection}/${encodeURIComponent(s)}?fields=id`)).ok && (c = s);
727
771
  } catch {
728
772
  return;
729
773
  }
730
- c != null && (ie == null || ie.open({
774
+ c != null && (oe == null || oe.open({
731
775
  collection: y.collection,
732
776
  itemId: c,
733
777
  layoutId: y.layout_id ?? null,
@@ -736,190 +780,190 @@ function on({
736
780
  }));
737
781
  };
738
782
  if (D.record_id == null || D.record_id === "") {
739
- const l = o.id;
740
- l != null && l !== "" && (D.record_id = l);
783
+ const s = a.id;
784
+ s != null && s !== "" && (D.record_id = s);
741
785
  }
742
- K.current = o.id ?? null;
743
- const et = JSON.stringify(D) + (s ?? "") + Ze, tt = fr(et, 400);
744
- function $e() {
745
- const l = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
786
+ Q.current = a.id ?? null;
787
+ const ct = JSON.stringify(D) + (l ?? "") + ot, ut = vr(ct, 400);
788
+ function We() {
789
+ const s = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
746
790
  return {
747
791
  "Content-Type": "application/json",
748
- ...$.authHeaders,
749
- ...l ? { "x-workspace": l } : {}
792
+ ...E.authHeaders,
793
+ ...s ? { "x-workspace": s } : {}
750
794
  };
751
795
  }
752
- const ee = ur(), V = nt({
796
+ const ne = br(), V = ft({
753
797
  queryKey: ["nvr-widget-def", n],
754
- enabled: d,
798
+ enabled: u,
755
799
  staleTime: 6e4,
756
800
  retry: !1,
757
801
  queryFn: async () => {
758
- if (ee)
759
- return (await ee.request(pr(`/widgets-internal/${n}`))).data;
760
- const l = await fetch(`${E}/widgets-internal/${n}`, {
761
- credentials: $.credentials,
762
- headers: $e()
802
+ if (ne)
803
+ return (await ne.request(_r(`/widgets-internal/${n}`))).data;
804
+ const s = await fetch(`${T}/widgets-internal/${n}`, {
805
+ credentials: E.credentials,
806
+ headers: We()
763
807
  });
764
- if (!l.ok) throw Object.assign(new Error("Widget not found"), { status: l.status });
765
- return (await l.json()).data;
808
+ if (!s.ok) throw Object.assign(new Error("Widget not found"), { status: s.status });
809
+ return (await s.json()).data;
766
810
  }
767
- }), Ee = V.refetch, ye = Ue(() => {
768
- N(null), V.error ? Ee() : I((l) => l + 1);
769
- }, [V.error, Ee]);
770
- te(() => {
771
- const l = () => I((c) => c + 1);
772
- return window.addEventListener(Me, l), () => window.removeEventListener(Me, l);
773
- }, []), te(() => {
774
- d && (V.data ? (G(V.data), f(!1), N(null), U == null || U(V.data.widget_type)) : V.error && N(Be(V.error, "this widget")));
775
- }, [d, V.data, V.error]), te(() => {
776
- if (!d || !r) return;
777
- const l = D.record_id == null || D.record_id === "";
778
- if (r.widget_type === "review_list" && l || r.widget_type === "rollup" && l && !Q) return;
811
+ }), Ue = V.refetch, _e = Ne(() => {
812
+ k(null), V.error ? Ue() : j((s) => s + 1);
813
+ }, [V.error, Ue]);
814
+ Y(() => {
815
+ const s = () => j((c) => c + 1);
816
+ return window.addEventListener(Qe, s), () => window.removeEventListener(Qe, s);
817
+ }, []), Y(() => {
818
+ u && (V.data ? (Z(V.data), f(!1), k(null), U == null || U(V.data.widget_type)) : V.error && k(ze(V.error, "this widget")));
819
+ }, [u, V.data, V.error]), Y(() => {
820
+ if (!u || !r) return;
821
+ const s = D.record_id == null || D.record_id === "";
822
+ if (r.widget_type === "review_list" && s || r.widget_type === "rollup" && s && !z) return;
779
823
  let c = !1;
780
- return pe.current || (p(!0), P(!0)), (async () => {
824
+ return he.current || (p(!0), P(!0)), (async () => {
781
825
  try {
782
826
  const m = {
783
- inputs: Q ? { ...D, staged: Q } : D,
784
- draft: o,
785
- bindings: a,
786
- item_collection: s
827
+ inputs: z ? { ...D, staged: z } : D,
828
+ draft: a,
829
+ bindings: i,
830
+ item_collection: l
787
831
  };
788
- q.current && (m.refresh = !0, q.current = !1), L(m);
789
- let j;
790
- if (ee)
791
- j = await ee.request(
792
- mr(`/widgets-internal/${n}/render`, m)
832
+ $.current && (m.refresh = !0, $.current = !1), L(m);
833
+ let O;
834
+ if (ne)
835
+ O = await ne.request(
836
+ kr(`/widgets-internal/${n}/render`, m)
793
837
  );
794
838
  else {
795
- const k = await fetch(`${E}/widgets-internal/${n}/render`, {
839
+ const N = await fetch(`${T}/widgets-internal/${n}/render`, {
796
840
  method: "POST",
797
- credentials: $.credentials,
798
- headers: $e(),
841
+ credentials: E.credentials,
842
+ headers: We(),
799
843
  body: JSON.stringify(m)
800
844
  });
801
- if (!k.ok)
802
- throw Object.assign(new Error("Render failed"), { status: k.status });
803
- j = await k.json();
845
+ if (!N.ok)
846
+ throw Object.assign(new Error("Render failed"), { status: N.status });
847
+ O = await N.json();
804
848
  }
805
849
  if (c) return;
806
- c || (pe.current = !0, ne(j.data), p(!1), N(null));
850
+ c || (he.current = !0, le(O.data), p(!1), k(null));
807
851
  } catch (m) {
808
- c || N(Be(m, "this widget"));
852
+ c || k(ze(m, "this widget"));
809
853
  } finally {
810
854
  c || P(!1);
811
855
  }
812
856
  })(), () => {
813
857
  c = !0;
814
858
  };
815
- }, [n, E, tt, d, M, r == null ? void 0 : r.widget_type]), te(() => {
859
+ }, [n, T, ut, u, M, r == null ? void 0 : r.widget_type]), Y(() => {
816
860
  if (A) {
817
- if (x) {
861
+ if (w) {
818
862
  A(!0);
819
863
  return;
820
864
  }
821
- if (i) {
865
+ if (o) {
822
866
  if ((r == null ? void 0 : r.widget_type) === "review_list" || (r == null ? void 0 : r.widget_type) === "rollup") {
823
- const l = i.rows;
824
- A(Array.isArray(l) && l.length > 0);
867
+ const s = o.rows;
868
+ A(Array.isArray(s) && s.length > 0);
825
869
  return;
826
870
  }
827
- if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in i) {
828
- const l = i.rows;
829
- A(Array.isArray(l) && l.length > 0);
871
+ if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in o) {
872
+ const s = o.rows;
873
+ A(Array.isArray(s) && s.length > 0);
830
874
  return;
831
875
  }
832
876
  A(!0);
833
877
  }
834
878
  }
835
- }, [i, x, r == null ? void 0 : r.widget_type, A]);
836
- const z = g || (r == null ? void 0 : r.name) || "", ae = (r == null ? void 0 : r.widget_type) === "report_widget" && i ? Lr(i) : i, B = (() => {
837
- const l = i == null ? void 0 : i.awaiting;
838
- if (!Array.isArray(l) || l.length === 0) return null;
839
- const c = l.map((m) => {
840
- const j = a.find((h) => h.key === m && h.binding_type === "item_field");
841
- return String((j == null ? void 0 : j.binding_value) ?? m).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (h) => h.toUpperCase());
879
+ }, [o, w, r == null ? void 0 : r.widget_type, A]);
880
+ const X = g || (r == null ? void 0 : r.name) || "", ce = (r == null ? void 0 : r.widget_type) === "report_widget" && o ? Ar(o) : o, H = (() => {
881
+ const s = o == null ? void 0 : o.awaiting;
882
+ if (!Array.isArray(s) || s.length === 0) return null;
883
+ const c = s.map((m) => {
884
+ const O = i.find((h) => h.key === m && h.binding_type === "item_field");
885
+ return String((O == null ? void 0 : O.binding_value) ?? m).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (h) => h.toUpperCase());
842
886
  });
843
887
  return [...new Set(c)].join(", ");
844
- })(), Te = D.record_id, qe = Te == null || Te === "";
845
- if ((r == null ? void 0 : r.widget_type) === "review_list" && qe || (r == null ? void 0 : r.widget_type) === "rollup" && qe && !Q) return null;
888
+ })(), Pe = D.record_id, Me = Pe == null || Pe === "";
889
+ if ((r == null ? void 0 : r.widget_type) === "review_list" && Me || (r == null ? void 0 : r.widget_type) === "rollup" && Me && !z) return null;
846
890
  if (R) {
847
- const l = ((Ae = r == null ? void 0 : r.config) == null ? void 0 : Ae.compact_style) ?? "default", c = l === "pill-dark" || l === "pill-light";
848
- if (x)
891
+ const s = ((Ke = r == null ? void 0 : r.config) == null ? void 0 : Ke.compact_style) ?? "default", c = s === "pill-dark" || s === "pill-light";
892
+ if (w)
849
893
  return /* @__PURE__ */ t(
850
894
  "button",
851
895
  {
852
896
  type: "button",
853
- onClick: ye,
897
+ onClick: _e,
854
898
  "data-load-error": "",
855
- "data-tip": `${x} Click to try again.`,
856
- "aria-label": `${x} Try again`,
899
+ "data-tip": `${w} Click to try again.`,
900
+ "aria-label": `${w} Try again`,
857
901
  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",
858
- children: /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
902
+ children: /* @__PURE__ */ t(lt, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
859
903
  }
860
904
  );
861
905
  if (C) {
862
906
  if (e)
863
- return /* @__PURE__ */ w("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
907
+ return /* @__PURE__ */ x("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
864
908
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] mb-1" }),
865
909
  /* @__PURE__ */ t("span", { className: "animate-pulse h-3.5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
866
910
  ] });
867
911
  if (r.widget_type === "button-group")
868
- 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(
869
- Ne,
912
+ return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: d ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : o && /* @__PURE__ */ t(
913
+ $e,
870
914
  {
871
- buttons: i.buttons ?? [],
872
- layout: i.layout ?? "flat",
915
+ buttons: o.buttons ?? [],
916
+ layout: o.layout ?? "flat",
873
917
  widgetId: n,
874
918
  inputs: D,
875
- apiBase: E,
919
+ apiBase: T,
876
920
  onClientAction: S
877
921
  }
878
922
  ) });
879
923
  {
880
924
  const m = /* @__PURE__ */ t(
881
- Tr,
925
+ Mr,
882
926
  {
883
- data: u ? null : ae ?? null,
927
+ data: d ? null : ce ?? null,
884
928
  label: g || r.name,
885
- loading: u,
929
+ loading: d,
886
930
  widgetConfig: r.config,
887
- awaiting: B
931
+ awaiting: H
888
932
  }
889
- ), j = ge ? /* @__PURE__ */ t(
933
+ ), O = ve ? /* @__PURE__ */ t(
890
934
  "button",
891
935
  {
892
936
  type: "button",
893
- onClick: () => void Ce(),
937
+ onClick: () => void Ae(),
894
938
  title: (y == null ? void 0 : y.title) ?? "Open details",
895
939
  className: "h-full w-full cursor-pointer text-left transition-colors hover:bg-nvr-cyan/5",
896
940
  "data-nvr-widget-drill": y == null ? void 0 : y.collection,
897
941
  children: m
898
942
  }
899
- ) : m, k = i == null ? void 0 : i.cache;
900
- return k != null && k.cache_ttl ? /* @__PURE__ */ w(
943
+ ) : m, N = o == null ? void 0 : o.cache;
944
+ return N != null && N.cache_ttl ? /* @__PURE__ */ x(
901
945
  "div",
902
946
  {
903
947
  className: "group/cache relative h-full w-full",
904
- "data-cache-stamp": k.cached ? "cached" : "fresh",
948
+ "data-cache-stamp": N.cached ? "cached" : "fresh",
905
949
  children: [
906
- j,
950
+ O,
907
951
  /* @__PURE__ */ t(
908
952
  "button",
909
953
  {
910
954
  type: "button",
911
955
  onClick: J,
912
- disabled: u,
956
+ disabled: d,
913
957
  "data-cache-refresh": !0,
914
958
  "aria-label": "Refresh this figure",
915
- "data-tip": Nr(k),
959
+ "data-tip": jr(N),
916
960
  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",
917
- children: /* @__PURE__ */ t(Ye, { className: `h-3 w-3 ${u ? "animate-spin" : ""}` })
961
+ children: /* @__PURE__ */ t(it, { className: `h-3 w-3 ${d ? "animate-spin" : ""}` })
918
962
  }
919
963
  )
920
964
  ]
921
965
  }
922
- ) : j;
966
+ ) : O;
923
967
  }
924
968
  }
925
969
  if (c) {
@@ -927,26 +971,26 @@ function on({
927
971
  return /* @__PURE__ */ t(
928
972
  "div",
929
973
  {
930
- className: `animate-pulse h-8 w-36 rounded-md ${l === "pill-dark" ? "bg-slate-700 border border-slate-700" : "bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] border border-slate-200"}`
974
+ className: `animate-pulse h-8 w-36 rounded-md ${s === "pill-dark" ? "bg-slate-700 border border-slate-700" : "bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] border border-slate-200"}`
931
975
  }
932
976
  );
933
977
  {
934
978
  const m = /* @__PURE__ */ t(
935
- Or,
979
+ Vr,
936
980
  {
937
- data: u ? null : ae ?? null,
981
+ data: d ? null : ce ?? null,
938
982
  label: g || r.name,
939
- style: l,
940
- loading: u,
983
+ style: s,
984
+ loading: d,
941
985
  widgetConfig: r.config,
942
- awaiting: B
986
+ awaiting: H
943
987
  }
944
988
  );
945
- return ge ? /* @__PURE__ */ t(
989
+ return ve ? /* @__PURE__ */ t(
946
990
  "button",
947
991
  {
948
992
  type: "button",
949
- onClick: () => void Ce(),
993
+ onClick: () => void Ae(),
950
994
  title: (y == null ? void 0 : y.title) ?? "Open details",
951
995
  className: "cursor-pointer text-left",
952
996
  "data-nvr-widget-drill": y == null ? void 0 : y.collection,
@@ -955,150 +999,150 @@ function on({
955
999
  ) : m;
956
1000
  }
957
1001
  }
958
- 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__ */ w(ke, { children: [
959
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(ve, { data: i, awaiting: B }),
960
- r.widget_type === "report_widget" && ae && /* @__PURE__ */ t(ve, { data: ae, awaiting: B }),
961
- r.widget_type === "custom-query" && "values" in i && /* @__PURE__ */ t(Qe, { data: i }),
1002
+ 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: d ? /* @__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))]" }) }) : o && r && /* @__PURE__ */ x(Ee, { children: [
1003
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in o) && /* @__PURE__ */ t(Le, { data: o, awaiting: H }),
1004
+ r.widget_type === "report_widget" && ce && /* @__PURE__ */ t(Le, { data: ce, awaiting: H }),
1005
+ r.widget_type === "custom-query" && "values" in o && /* @__PURE__ */ t(rt, { data: o }),
962
1006
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
963
- ze,
1007
+ nt,
964
1008
  {
965
- data: i,
1009
+ data: o,
966
1010
  widgetId: n,
967
1011
  inputs: D,
968
- apiBase: E
1012
+ apiBase: T
969
1013
  }
970
1014
  ),
971
1015
  r.widget_type === "button-group" && /* @__PURE__ */ t(
972
- Ne,
1016
+ $e,
973
1017
  {
974
- buttons: i.buttons ?? [],
975
- layout: i.layout ?? "flat",
1018
+ buttons: o.buttons ?? [],
1019
+ layout: o.layout ?? "flat",
976
1020
  widgetId: n,
977
1021
  inputs: D,
978
- apiBase: E,
1022
+ apiBase: T,
979
1023
  onClientAction: S
980
1024
  }
981
1025
  )
982
1026
  ] }) });
983
1027
  }
984
- const oe = r == null ? void 0 : r.widget_type, je = oe === "stat" ? /* @__PURE__ */ t(we, { framed: !1, title: !1, kpi: !0, className: "py-0.5" }) : oe === "list" || oe === "review_list" || oe === "custom-query" ? /* @__PURE__ */ t(we, { framed: !1, title: !1, lines: 4, className: "py-0.5" }) : /* @__PURE__ */ t(we, { framed: !1, title: !1, lines: 3, className: "py-0.5" }), Oe = ee ? /* @__PURE__ */ t(
985
- _r,
1028
+ const ue = r == null ? void 0 : r.widget_type, He = ue === "stat" ? /* @__PURE__ */ t(Se, { framed: !1, title: !1, kpi: !0, className: "py-0.5" }) : ue === "list" || ue === "review_list" || ue === "custom-query" ? /* @__PURE__ */ t(Se, { framed: !1, title: !1, lines: 4, className: "py-0.5" }) : /* @__PURE__ */ t(Se, { framed: !1, title: !1, lines: 3, className: "py-0.5" }), Be = ne ? /* @__PURE__ */ t(
1029
+ qr,
986
1030
  {
987
1031
  className: "mt-2",
988
- pending: u && !!r,
989
- request: F ? { method: "POST", url: `/widgets-internal/${n}/render`, body: F } : null,
990
- label: z || "Widget",
991
- onResult: (l) => {
992
- const c = l == null ? void 0 : l.data;
993
- c && (pe.current = !0, ne(c), p(!1), P(!1), N(null));
1032
+ pending: d && !!r,
1033
+ request: G ? { method: "POST", url: `/widgets-internal/${n}/render`, body: G } : null,
1034
+ label: X || "Widget",
1035
+ onResult: (s) => {
1036
+ const c = s == null ? void 0 : s.data;
1037
+ c && (he.current = !0, le(c), p(!1), P(!1), k(null));
994
1038
  },
995
- onGone: () => I((l) => l + 1)
1039
+ onGone: () => j((s) => s + 1)
996
1040
  }
997
1041
  ) : null;
998
1042
  if (b)
999
- return /* @__PURE__ */ w("div", { children: [
1000
- T && je,
1001
- T && Oe,
1002
- x && /* @__PURE__ */ t(He, { message: x, onRetry: ye }),
1003
- !T && !x && i && r && Ie()
1043
+ return /* @__PURE__ */ x("div", { children: [
1044
+ q && He,
1045
+ q && Be,
1046
+ w && /* @__PURE__ */ t(Xe, { message: w, onRetry: _e }),
1047
+ !q && !w && o && r && Ve()
1004
1048
  ] });
1005
- return /* @__PURE__ */ w("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
1006
- /* @__PURE__ */ w(
1049
+ return /* @__PURE__ */ x("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
1050
+ /* @__PURE__ */ x(
1007
1051
  "button",
1008
1052
  {
1009
1053
  type: "button",
1010
1054
  className: "flex w-full items-center justify-between px-4 py-3 text-left",
1011
- onClick: () => fe((l) => !l),
1055
+ onClick: () => me((s) => !s),
1012
1056
  children: [
1013
- /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: z || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
1014
- /* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${Z ? "rotate-90" : ""}`, children: "›" })
1057
+ /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: X || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
1058
+ /* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${K ? "rotate-90" : ""}`, children: "›" })
1015
1059
  ]
1016
1060
  }
1017
1061
  ),
1018
- Z && /* @__PURE__ */ w("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
1019
- T && je,
1020
- T && Oe,
1021
- x && /* @__PURE__ */ t(He, { message: x, onRetry: ye }),
1022
- !T && !x && i && r && Ie()
1062
+ K && /* @__PURE__ */ x("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
1063
+ q && He,
1064
+ q && Be,
1065
+ w && /* @__PURE__ */ t(Xe, { message: w, onRetry: _e }),
1066
+ !q && !w && o && r && Ve()
1023
1067
  ] })
1024
1068
  ] });
1025
- function Ie() {
1026
- var l;
1027
- return !i || !r ? null : /* @__PURE__ */ w(ke, { children: [
1028
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(ve, { data: i, awaiting: B }),
1029
- r.widget_type === "custom-query" && "values" in i && (B ? /* @__PURE__ */ w(
1069
+ function Ve() {
1070
+ var s;
1071
+ return !o || !r ? null : /* @__PURE__ */ x(Ee, { children: [
1072
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in o) && /* @__PURE__ */ t(Le, { data: o, awaiting: H }),
1073
+ r.widget_type === "custom-query" && "values" in o && (H ? /* @__PURE__ */ x(
1030
1074
  "p",
1031
1075
  {
1032
1076
  className: "text-[12px] text-slate-500 dark:text-slate-400",
1033
- "data-widget-awaiting": B,
1077
+ "data-widget-awaiting": H,
1034
1078
  children: [
1035
1079
  "Set ",
1036
- B,
1080
+ H,
1037
1081
  " on this record to see ",
1038
- z || "this",
1082
+ X || "this",
1039
1083
  "."
1040
1084
  ]
1041
1085
  }
1042
- ) : /* @__PURE__ */ t(Qe, { data: i })),
1043
- r.widget_type === "list" && /* @__PURE__ */ t(Ir, { data: i }),
1044
- B && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ w(
1086
+ ) : /* @__PURE__ */ t(rt, { data: o })),
1087
+ r.widget_type === "list" && /* @__PURE__ */ t(Fr, { data: o }),
1088
+ H && r.widget_type === "custom-query" && "rows" in o && /* @__PURE__ */ x(
1045
1089
  "p",
1046
1090
  {
1047
1091
  className: "text-[12px] text-slate-500 dark:text-slate-400",
1048
- "data-widget-awaiting": B,
1092
+ "data-widget-awaiting": H,
1049
1093
  children: [
1050
1094
  "Set ",
1051
- B,
1095
+ H,
1052
1096
  " on this record to see ",
1053
- z || "this",
1097
+ X || "this",
1054
1098
  "."
1055
1099
  ]
1056
1100
  }
1057
1101
  ),
1058
- !B && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ t(
1059
- Rr,
1102
+ !H && r.widget_type === "custom-query" && "rows" in o && /* @__PURE__ */ t(
1103
+ Dr,
1060
1104
  {
1061
- rows: i.rows ?? [],
1062
- config: (l = r.config) == null ? void 0 : l.table,
1063
- emptyLabel: z
1105
+ rows: o.rows ?? [],
1106
+ config: (s = r.config) == null ? void 0 : s.table,
1107
+ emptyLabel: X
1064
1108
  }
1065
1109
  ),
1066
1110
  r.widget_type === "review_list" && /* @__PURE__ */ t(
1067
- $r,
1111
+ Ur,
1068
1112
  {
1069
- data: i,
1113
+ data: o,
1070
1114
  config: r.config ?? {},
1071
- onRefetch: () => I((c) => c + 1),
1115
+ onRefetch: () => j((c) => c + 1),
1072
1116
  hostRecordId: D.record_id,
1073
- emptyLabel: z
1117
+ emptyLabel: X
1074
1118
  }
1075
1119
  ),
1076
1120
  r.widget_type === "rollup" && /* @__PURE__ */ t(
1077
- Er,
1121
+ Pr,
1078
1122
  {
1079
- data: i,
1123
+ data: o,
1080
1124
  config: r.config ?? {},
1081
- emptyLabel: z
1125
+ emptyLabel: X
1082
1126
  }
1083
1127
  ),
1084
- r.widget_type === "report_widget" && /* @__PURE__ */ t(Cr, { payload: i }),
1128
+ r.widget_type === "report_widget" && /* @__PURE__ */ t(Wr, { payload: o }),
1085
1129
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
1086
- ze,
1130
+ nt,
1087
1131
  {
1088
- data: i,
1132
+ data: o,
1089
1133
  widgetId: n,
1090
1134
  inputs: D,
1091
- apiBase: E
1135
+ apiBase: T
1092
1136
  }
1093
1137
  ),
1094
1138
  r.widget_type === "button-group" && /* @__PURE__ */ t(
1095
- Ne,
1139
+ $e,
1096
1140
  {
1097
- buttons: i.buttons ?? [],
1098
- layout: i.layout ?? "flat",
1141
+ buttons: o.buttons ?? [],
1142
+ layout: o.layout ?? "flat",
1099
1143
  widgetId: n,
1100
1144
  inputs: D,
1101
- apiBase: E,
1145
+ apiBase: T,
1102
1146
  onClientAction: S
1103
1147
  }
1104
1148
  ),
@@ -1111,13 +1155,14 @@ function on({
1111
1155
  "review_list",
1112
1156
  "rollup",
1113
1157
  "report_widget"
1114
- ].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(i, null, 2) }),
1115
- i.cache ? /* @__PURE__ */ t(
1116
- kr,
1158
+ ].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(o, null, 2) }),
1159
+ o.cache ? /* @__PURE__ */ t(
1160
+ Or,
1117
1161
  {
1118
- envelope: i.cache,
1162
+ scope: `widget:${n}`,
1163
+ envelope: o.cache,
1119
1164
  onRefresh: J,
1120
- refreshing: u,
1165
+ refreshing: d,
1121
1166
  className: "mt-2 justify-end"
1122
1167
  }
1123
1168
  ) : null
@@ -1125,6 +1170,8 @@ function on({
1125
1170
  }
1126
1171
  }
1127
1172
  export {
1128
- on as WidgetSlot,
1129
- Ge as hostStepChange
1173
+ Gr as LIVE_WIDGET_GAP_MS,
1174
+ _n as WidgetSlot,
1175
+ st as hostStepChange,
1176
+ Qr as widgetLiveRelevant
1130
1177
  };