@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
@@ -0,0 +1,77 @@
1
+ const d = 150, f = 250;
2
+ function p(e = c) {
3
+ let t = null, r = null, n = null;
4
+ const o = () => {
5
+ n = null, r !== t && (t && e(t, "end"), t = r, t && e(t, "start"));
6
+ }, i = (s) => {
7
+ n && clearTimeout(n), n = setTimeout(o, s);
8
+ };
9
+ return {
10
+ focus(s) {
11
+ r = s, i(s ? 150 : 250);
12
+ },
13
+ blur() {
14
+ r = null, i(250);
15
+ },
16
+ flush() {
17
+ n && clearTimeout(n), n = null, t && e(t, "end"), t = null, r = null;
18
+ }
19
+ };
20
+ }
21
+ function c(e, t) {
22
+ typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: t } }));
23
+ }
24
+ const u = [
25
+ "#0ea5e9",
26
+ // sky
27
+ "#8b5cf6",
28
+ // violet
29
+ "#10b981",
30
+ // emerald
31
+ "#ec4899",
32
+ // pink
33
+ "#64748b",
34
+ // slate
35
+ "#84cc16"
36
+ // lime
37
+ ];
38
+ function l(e) {
39
+ const t = String(e ?? "").toUpperCase();
40
+ let r = 0;
41
+ for (let n = 0; n < t.length; n++) r = r * 31 + t.charCodeAt(n) | 0;
42
+ return u[Math.abs(r) % u.length];
43
+ }
44
+ function C(e, t = /* @__PURE__ */ new Map()) {
45
+ const r = /* @__PURE__ */ new Map(), n = (o) => o.toUpperCase();
46
+ for (const o of e) {
47
+ const i = t.get(n(o));
48
+ i && ![...r.values()].includes(i) && r.set(n(o), i);
49
+ }
50
+ for (const o of e) {
51
+ if (r.has(n(o))) continue;
52
+ const i = new Set(r.values()), s = u.find((a) => !i.has(a));
53
+ r.set(n(o), s ?? l(o));
54
+ }
55
+ return r;
56
+ }
57
+ function m(e) {
58
+ const t = e.trim().split(/\s+/).filter(Boolean);
59
+ return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
60
+ }
61
+ function S(e, t, r) {
62
+ const n = e.getAttribute("data-tip");
63
+ return e.classList.add("nvr-remote-editing"), e.dataset.remoteEditor = t.name, e.style.setProperty("--nvr-cursor", r ?? l(t.id ?? t.name)), e.setAttribute("data-tip", `${t.name} is here`), () => {
64
+ e.classList.remove("nvr-remote-editing"), delete e.dataset.remoteEditor, e.style.removeProperty("--nvr-cursor"), n == null ? e.removeAttribute("data-tip") : e.setAttribute("data-tip", n);
65
+ };
66
+ }
67
+ export {
68
+ u as CURSOR_COLORS,
69
+ f as CURSOR_LEAVE_MS,
70
+ d as CURSOR_SETTLE_MS,
71
+ C as assignCursorColors,
72
+ p as createCellAnnouncer,
73
+ l as cursorColor,
74
+ S as markRemoteCell,
75
+ m as personInitials,
76
+ c as windowCellEmit
77
+ };
@@ -0,0 +1,182 @@
1
+ import { useMemo as z, useRef as y, useCallback as H, useEffect as C, useState as D } from "react";
2
+ import { assignCursorColors as U, markRemoteCell as j, createCellAnnouncer as B, personInitials as K, cursorColor as N } from "./grid-cursors.js";
3
+ import { useLiveEvent as G } from "./live.js";
4
+ import { useLivePreference as W } from "./live-preference.js";
5
+ import { useMyUserId as q } from "./presence-signals.js";
6
+ import { useOptionalRealtime as F, useRealtimeStatus as X } from "./realtime.js";
7
+ const Y = 2e4, Z = 5e4, J = 300, b = "pg|";
8
+ function Q(o, e) {
9
+ return `${b}${o}|${e}`;
10
+ }
11
+ function O(o) {
12
+ if (!(o != null && o.startsWith(b))) return null;
13
+ const e = o.slice(b.length), r = e.indexOf("|");
14
+ return r <= 0 || r === e.length - 1 ? null : { item: e.slice(0, r), field: e.slice(r + 1) };
15
+ }
16
+ function V(o, e, r, i) {
17
+ var m, u;
18
+ const s = new Map(o), c = ((m = e == null ? void 0 : e.user) == null ? void 0 : m.id) == null ? "" : String(e.user.id);
19
+ if (!c || typeof e.page != "string" || e.item == null || r && c.toUpperCase() === r.toUpperCase()) return s;
20
+ const a = `${c.toUpperCase()}|${e.page}`;
21
+ if (e.state === "end") {
22
+ const S = s.get(a);
23
+ return S && S.item === String(e.item) && s.delete(a), s;
24
+ }
25
+ return s.set(a, {
26
+ userId: c,
27
+ name: typeof ((u = e.user) == null ? void 0 : u.name) == "string" && e.user.name ? e.user.name : "Someone",
28
+ item: String(e.item),
29
+ field: typeof e.field == "string" ? e.field : null,
30
+ page: e.page,
31
+ at: i,
32
+ color: N(c)
33
+ }), s;
34
+ }
35
+ function ee(o, e, r = Z) {
36
+ return [...o.values()].filter((i) => e - i.at <= r).sort((i, s) => i.name.localeCompare(s.name) || i.userId.localeCompare(s.userId));
37
+ }
38
+ const te = [];
39
+ function ae(o) {
40
+ const e = F(), r = X(), i = q(), s = W(), { page: c, collection: a, containerRef: m } = o, u = o.enabled !== !1 && !!e && !!a && !!c, S = z(
41
+ () => [...new Set(o.items.map(String).filter((t) => t && t !== "new"))].slice(0, J).join(""),
42
+ [o.items]
43
+ ), g = y(/* @__PURE__ */ new Set()), w = H(
44
+ (t, l) => {
45
+ for (let n = 0; n < l.length; n += 100)
46
+ e == null || e.emit(t, { collection: a, items: l.slice(n, n + 100) });
47
+ },
48
+ [e, a]
49
+ );
50
+ C(() => {
51
+ if (!u) return;
52
+ const t = new Set(S.split("").filter(Boolean)), l = [...t].filter((p) => !g.current.has(p)), n = [...g.current].filter((p) => !t.has(p));
53
+ g.current = t, l.length && w("grid:watch", l), n.length && w("grid:unwatch", n);
54
+ }, [u, S, w]), C(() => {
55
+ if (u)
56
+ return () => {
57
+ g.current.size && w("grid:unwatch", [...g.current]), g.current = /* @__PURE__ */ new Set();
58
+ };
59
+ }, [u, w]);
60
+ const v = y(!1), I = y(null);
61
+ C(() => {
62
+ if (u) {
63
+ if ((r == null ? void 0 : r.state) === "reconnecting") v.current = !0;
64
+ else if (v.current) {
65
+ v.current = !1, g.current.size && w("grid:watch", [...g.current]);
66
+ const t = I.current;
67
+ t && (e == null || e.emit("grid:here", { collection: a, page: c, ...t, state: "start" }));
68
+ }
69
+ }
70
+ }, [r == null ? void 0 : r.state, u, w, e, a, c]), G(
71
+ "access:changed",
72
+ () => {
73
+ g.current.size && w("grid:watch", [...g.current]);
74
+ },
75
+ { enabled: u, includeOwn: !0, debounceMs: 800 }
76
+ ), C(() => {
77
+ const t = m == null ? void 0 : m.current;
78
+ if (!u || !t) return;
79
+ const n = B((f, d) => {
80
+ const h = O(f);
81
+ h && (I.current = d === "start" ? h : null, e == null || e.emit("grid:here", { collection: a, page: c, item: h.item, field: h.field, state: d }));
82
+ }), p = (f) => {
83
+ var h, P;
84
+ const d = (P = (h = f == null ? void 0 : f.closest) == null ? void 0 : h.call(f, "[data-grid-cell]")) == null ? void 0 : P.getAttribute("data-grid-cell");
85
+ return O(d) ? d : null;
86
+ }, _ = (f) => {
87
+ const d = p(f.target);
88
+ d && n.focus(d);
89
+ }, $ = (f) => {
90
+ const d = f.relatedTarget, h = d && t.contains(d) ? p(d) : null;
91
+ h ? n.focus(h) : n.blur();
92
+ };
93
+ t.addEventListener("focusin", _), t.addEventListener("focusout", $);
94
+ const k = setInterval(() => {
95
+ const f = I.current;
96
+ f && (e == null || e.emit("grid:here", { collection: a, page: c, ...f, state: "start" }));
97
+ }, Y);
98
+ return () => {
99
+ t.removeEventListener("focusin", _), t.removeEventListener("focusout", $), clearInterval(k), n.flush(), I.current = null;
100
+ };
101
+ }, [u, m, e, a, c]);
102
+ const [E, x] = D(() => /* @__PURE__ */ new Map()), [L, A] = D(() => Date.now());
103
+ C(() => x(/* @__PURE__ */ new Map()), [c, a]), G(
104
+ "grid:editing",
105
+ (t) => {
106
+ const l = Date.now();
107
+ x((n) => V(n, t, i, l)), A(l);
108
+ },
109
+ {
110
+ enabled: u,
111
+ includeOwn: !0,
112
+ match: (t) => (t == null ? void 0 : t.collection) === a && (t == null ? void 0 : t.page) === c
113
+ }
114
+ ), C(() => {
115
+ if (!u || E.size === 0) return;
116
+ const t = setInterval(() => A(Date.now()), 1e4);
117
+ return () => clearInterval(t);
118
+ }, [u, E.size]);
119
+ const T = s.normal && u, R = y(/* @__PURE__ */ new Map()), M = z(() => {
120
+ if (!T) return te;
121
+ const t = ee(E, L), l = U([...new Set(t.map((n) => n.userId))], R.current);
122
+ return R.current = l, t.map((n) => ({ ...n, color: l.get(n.userId.toUpperCase()) ?? n.color }));
123
+ }, [T, E, L]);
124
+ return C(() => {
125
+ const t = m == null ? void 0 : m.current;
126
+ if (!t || M.length === 0) return;
127
+ const l = [];
128
+ for (const n of M) {
129
+ if (!n.field) continue;
130
+ const p = t.querySelector(
131
+ `[data-grid-cell="${re(Q(n.item, n.field))}"]`
132
+ );
133
+ p && (l.push(j(p, { id: n.userId, name: n.name }, n.color)), l.push(ne(p, n)));
134
+ }
135
+ return () => {
136
+ for (const n of l) n();
137
+ };
138
+ }), { editors: M };
139
+ }
140
+ function fe(o, ...e) {
141
+ let r = 5381;
142
+ const i = e.join("");
143
+ for (let s = 0; s < i.length; s++) r = (r << 5) + r + i.charCodeAt(s) | 0;
144
+ return `${o.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 24)}:${(r >>> 0).toString(36)}`;
145
+ }
146
+ function ne(o, e) {
147
+ const r = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement ? o.parentElement : o;
148
+ if (!r || typeof document > "u") return () => {
149
+ };
150
+ const i = document.createElement("span");
151
+ i.setAttribute("data-grid-presence-chip", ""), i.setAttribute("aria-hidden", "true"), i.textContent = K(e.name), Object.assign(i.style, {
152
+ position: "absolute",
153
+ top: "-7px",
154
+ right: "2px",
155
+ zIndex: "5",
156
+ padding: "0 4px",
157
+ borderRadius: "4px",
158
+ background: e.color,
159
+ color: "#fff",
160
+ font: "600 9px/14px ui-sans-serif, system-ui, sans-serif",
161
+ letterSpacing: "0.02em",
162
+ pointerEvents: "none"
163
+ });
164
+ const s = getComputedStyle(r).position === "static", c = r.style.position;
165
+ return s && (r.style.position = "relative"), r.appendChild(i), () => {
166
+ i.remove(), s && (r.style.position = c);
167
+ };
168
+ }
169
+ function re(o) {
170
+ return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(o) : o.replace(/["\\]/g, "\\$&");
171
+ }
172
+ export {
173
+ Y as GRID_HEARTBEAT_MS,
174
+ Z as GRID_MARK_TTL_MS,
175
+ J as GRID_WATCH_LIMIT,
176
+ V as foldGridEditing,
177
+ ee as freshGridEditors,
178
+ fe as gridPageKey,
179
+ Q as gridPresenceCell,
180
+ O as parseGridPresenceCell,
181
+ ae as useGridPresence
182
+ };
@@ -1,138 +1,165 @@
1
- const I = 60, b = 18e4, O = 9e5, C = 36e5, v = 9e5, M = 1;
2
- function _(e) {
3
- var t;
4
- const n = Number((t = e == null ? void 0 : e.auto_reload) == null ? void 0 : t.idle_seconds);
5
- return (Number.isFinite(n) && n > 0 ? n : 60) * 1e3;
1
+ const C = 60, O = 18e4, v = 9e5, F = 36e5, T = 9e5, g = 1;
2
+ function E(e) {
3
+ var n;
4
+ const t = Number((n = e == null ? void 0 : e.auto_reload) == null ? void 0 : n.idle_seconds);
5
+ return (Number.isFinite(t) && t > 0 ? t : 60) * 1e3;
6
6
  }
7
- function p(e, n) {
8
- var t;
9
- return e && !((t = e.auto_reload) != null && t.enabled) || n >= 36e5 ? 9e5 : 18e4;
7
+ function p(e, t) {
8
+ var n;
9
+ return e && !((n = e.auto_reload) != null && n.enabled) || t >= 36e5 ? 9e5 : 18e4;
10
10
  }
11
- function N(e) {
11
+ function Y(e) {
12
12
  var o;
13
13
  if (e.declined) return { action: "wait", reason: "declined" };
14
- const n = e.now - e.lastInput;
15
- if (n < _(e.status)) return { action: "wait", reason: "active" };
14
+ const t = e.now - e.lastInput;
15
+ if (t < E(e.status)) return { action: "wait", reason: "active" };
16
16
  if (e.unsaved.length > 0) return { action: "wait", reason: "unsaved" };
17
17
  if (e.holds.length > 0) return { action: "wait", reason: "held" };
18
- const t = e.status;
19
- return !t || e.now - e.statusAt >= p(t, n) ? { action: "check" } : (o = t.auto_reload) != null && o.enabled ? !t.older || !t.id ? { action: "wait", reason: "current" } : e.reloadedFor(t.id) >= 1 ? { action: "wait", reason: "already" } : { action: "reload", id: t.id } : { action: "wait", reason: "off" };
18
+ const n = e.status;
19
+ return !n || e.now - e.statusAt >= p(n, t) ? { action: "check" } : (o = n.auto_reload) != null && o.enabled ? !n.older || !n.id ? { action: "wait", reason: "current" } : e.reloadedFor(n.id) >= 1 ? { action: "wait", reason: "already" } : { action: "reload", id: n.id } : { action: "wait", reason: "off" };
20
+ }
21
+ const y = 24 * 36e5, S = 4 * 36e5, L = 6e4, x = 6e4;
22
+ function h(e) {
23
+ var n;
24
+ const t = Number((n = e == null ? void 0 : e.data_resync) == null ? void 0 : n.replay_window_s);
25
+ return Number.isFinite(t) && t > 0 ? t * 1e3 : y;
26
+ }
27
+ function R(e) {
28
+ var n;
29
+ const t = Number((n = e == null ? void 0 : e.data_resync) == null ? void 0 : n.idle_hours);
30
+ return Number.isFinite(t) && t > 0 ? t * 36e5 : S;
20
31
  }
21
- const S = ["keydown", "pointerdown", "touchstart", "wheel", "input"];
32
+ function H(e) {
33
+ if (e.reloadDue) return { action: "none", reason: "build" };
34
+ if (e.lastResyncAt > 0 && e.now - e.lastResyncAt < L)
35
+ return { action: "none", reason: "recent" };
36
+ if (e.awayMs >= h(e.status)) return { action: "resync", reason: "replay-window" };
37
+ if (e.missed) return { action: "resync", reason: "missed-events" };
38
+ const t = R(e.status), n = Math.max(e.lastInput, e.lastResyncAt);
39
+ return e.now - n >= t ? { action: "resync", reason: "idle-hours" } : { action: "none", reason: "fresh" };
40
+ }
41
+ const m = ["keydown", "pointerdown", "touchstart", "wheel", "input"];
22
42
  let f = Date.now(), d = !1;
23
- function A() {
43
+ function P() {
24
44
  if (d || typeof window > "u") return;
25
45
  d = !0;
26
46
  const e = () => {
27
47
  f = Date.now();
28
48
  };
29
- for (const n of S) window.addEventListener(n, e, { passive: !0, capture: !0 });
49
+ for (const t of m) window.addEventListener(t, e, { passive: !0, capture: !0 });
30
50
  }
31
- function T() {
51
+ function k() {
32
52
  return f;
33
53
  }
34
- const a = "nvr-idle-reload-scroll", L = 2 * 6e4, h = 8e3, y = 12;
35
- function R(e) {
54
+ const l = "nvr-idle-reload-scroll", D = 2 * 6e4, I = 8e3, M = 12;
55
+ function b(e) {
36
56
  if (e.id) return `#${e.id}`;
37
- const n = [];
38
- let t = e;
39
- for (; t && t !== document.body; ) {
40
- const o = t.parentElement;
57
+ const t = [];
58
+ let n = e;
59
+ for (; n && n !== document.body; ) {
60
+ const o = n.parentElement;
41
61
  if (!o) return null;
42
- n.unshift(Array.prototype.indexOf.call(o.children, t)), t = o;
62
+ t.unshift(Array.prototype.indexOf.call(o.children, n)), n = o;
43
63
  }
44
- return t === document.body ? `>${n.join(">")}` : null;
64
+ return n === document.body ? `>${t.join(">")}` : null;
45
65
  }
46
- function m(e) {
66
+ function N(e) {
47
67
  if (e.startsWith("#")) return document.getElementById(e.slice(1));
48
68
  if (!e.startsWith(">")) return null;
49
- let n = document.body;
50
- for (const t of e.slice(1).split(">")) {
51
- const o = Number(t);
52
- if (!n || t === "" || !Number.isInteger(o)) return null;
53
- n = n.children[o] ?? null;
69
+ let t = document.body;
70
+ for (const n of e.slice(1).split(">")) {
71
+ const o = Number(n);
72
+ if (!t || n === "" || !Number.isInteger(o)) return null;
73
+ t = t.children[o] ?? null;
54
74
  }
55
- return n;
75
+ return t;
56
76
  }
57
77
  function w() {
58
78
  return `${window.location.pathname}${window.location.search}`;
59
79
  }
60
- function g() {
80
+ function G() {
61
81
  try {
62
82
  const e = [];
63
- for (const t of document.querySelectorAll("body *")) {
64
- if (e.length >= y) break;
65
- if (t.scrollTop <= 0 && t.scrollLeft <= 0) continue;
66
- const o = R(t);
67
- o && e.push({ key: o, top: t.scrollTop, left: t.scrollLeft });
83
+ for (const n of document.querySelectorAll("body *")) {
84
+ if (e.length >= M) break;
85
+ if (n.scrollTop <= 0 && n.scrollLeft <= 0) continue;
86
+ const o = b(n);
87
+ o && e.push({ key: o, top: n.scrollTop, left: n.scrollLeft });
68
88
  }
69
- const n = {
89
+ const t = {
70
90
  path: w(),
71
91
  at: Date.now(),
72
92
  window: { x: window.scrollX, y: window.scrollY },
73
93
  boxes: e
74
94
  };
75
- sessionStorage.setItem(a, JSON.stringify(n));
95
+ sessionStorage.setItem(l, JSON.stringify(t));
76
96
  } catch {
77
97
  }
78
98
  }
79
- function D(e, n, t = Date.now()) {
99
+ function A(e, t, n = Date.now()) {
80
100
  if (!e) return null;
81
101
  try {
82
102
  const o = JSON.parse(e);
83
- return !o || o.path !== n || typeof o.at != "number" || t - o.at > L || t < o.at - 5e3 ? null : { ...o, boxes: Array.isArray(o.boxes) ? o.boxes : [] };
103
+ return !o || o.path !== t || typeof o.at != "number" || n - o.at > D || n < o.at - 5e3 ? null : { ...o, boxes: Array.isArray(o.boxes) ? o.boxes : [] };
84
104
  } catch {
85
105
  return null;
86
106
  }
87
107
  }
88
- function F() {
108
+ function K() {
89
109
  if (typeof window > "u") return () => {
90
110
  };
91
111
  let e = null;
92
112
  try {
93
- e = D(sessionStorage.getItem(a), w()), sessionStorage.removeItem(a);
113
+ e = A(sessionStorage.getItem(l), w()), sessionStorage.removeItem(l);
94
114
  } catch {
95
115
  e = null;
96
116
  }
97
117
  if (!e) return () => {
98
118
  };
99
- const n = e, t = new Map(n.boxes.map((r) => [r.key, r]));
100
- let o = n.window.y <= 0 && n.window.x <= 0, s = !1;
101
- const l = () => {
102
- s = !0;
119
+ const t = e, n = new Map(t.boxes.map((r) => [r.key, r]));
120
+ let o = t.window.y <= 0 && t.window.x <= 0, c = !1;
121
+ const s = () => {
122
+ c = !0;
103
123
  };
104
- window.addEventListener("pointerdown", l, { once: !0, capture: !0 }), window.addEventListener("keydown", l, { once: !0, capture: !0 }), window.addEventListener("wheel", l, { once: !0, capture: !0, passive: !0 });
105
- const E = Date.now(), u = () => {
106
- if (!s) {
107
- o || (window.scrollTo(n.window.x, n.window.y), o = Math.abs(window.scrollY - n.window.y) < 2);
108
- for (const [r, c] of t) {
109
- const i = m(r);
110
- !i || i.scrollHeight - i.clientHeight < c.top - 1 || (i.scrollTop = c.top, i.scrollLeft = c.left, t.delete(r));
124
+ window.addEventListener("pointerdown", s, { once: !0, capture: !0 }), window.addEventListener("keydown", s, { once: !0, capture: !0 }), window.addEventListener("wheel", s, { once: !0, capture: !0, passive: !0 });
125
+ const _ = Date.now(), u = () => {
126
+ if (!c) {
127
+ o || (window.scrollTo(t.window.x, t.window.y), o = Math.abs(window.scrollY - t.window.y) < 2);
128
+ for (const [r, a] of n) {
129
+ const i = N(r);
130
+ !i || i.scrollHeight - i.clientHeight < a.top - 1 || (i.scrollTop = a.top, i.scrollLeft = a.left, n.delete(r));
111
131
  }
112
- if (o && t.size === 0 || Date.now() - E > h) {
113
- s = !0;
132
+ if (o && n.size === 0 || Date.now() - _ > I) {
133
+ c = !0;
114
134
  return;
115
135
  }
116
136
  setTimeout(u, 200);
117
137
  }
118
138
  };
119
- return setTimeout(u, 0), l;
139
+ return setTimeout(u, 0), s;
120
140
  }
121
141
  export {
122
- O as CHECK_EVERY_LONG_IDLE_MS,
123
- b as CHECK_EVERY_MS,
124
- v as CHECK_EVERY_WHEN_OFF_MS,
125
- I as DEFAULT_IDLE_SECONDS,
126
- M as IDLE_RELOADS_PER_TARGET,
127
- C as LONG_IDLE_MS,
142
+ v as CHECK_EVERY_LONG_IDLE_MS,
143
+ O as CHECK_EVERY_MS,
144
+ T as CHECK_EVERY_WHEN_OFF_MS,
145
+ S as DEFAULT_IDLE_RESYNC_MS,
146
+ C as DEFAULT_IDLE_SECONDS,
147
+ y as DEFAULT_REPLAY_WINDOW_MS,
148
+ g as IDLE_RELOADS_PER_TARGET,
149
+ F as LONG_IDLE_MS,
150
+ L as RESYNC_MIN_GAP_MS,
151
+ x as SLEEP_GAP_MS,
128
152
  p as checkEveryMs,
129
- N as decideIdleReload,
130
- R as domPathKey,
131
- m as findByDomPathKey,
132
- _ as idleMsFor,
133
- T as lastIdleReloadInput,
134
- F as restoreScrollAfterReload,
135
- g as saveScrollForReload,
136
- A as trackIdleReloadInput,
137
- D as usableScroll
153
+ Y as decideIdleReload,
154
+ H as decideIdleResync,
155
+ b as domPathKey,
156
+ N as findByDomPathKey,
157
+ E as idleMsFor,
158
+ R as idleResyncMsFor,
159
+ k as lastIdleReloadInput,
160
+ h as replayWindowMsFor,
161
+ K as restoreScrollAfterReload,
162
+ G as saveScrollForReload,
163
+ P as trackIdleReloadInput,
164
+ A as usableScroll
138
165
  };
@@ -0,0 +1,45 @@
1
+ import { countdownText as c } from "./deadline-ticker.js";
2
+ const a = "$in_step", m = "__in_step__", f = "in_step";
3
+ function o(n) {
4
+ if (n == null || n === "") return null;
5
+ const e = n instanceof Date ? n.getTime() : typeof n == "number" ? n : new Date(n).getTime();
6
+ return Number.isFinite(e) ? e : null;
7
+ }
8
+ function _(n, e) {
9
+ const t = o(n);
10
+ return t == null ? null : c(Math.max(0, e - t));
11
+ }
12
+ function g(n, e, t) {
13
+ const u = _(e, t);
14
+ if (u == null) return null;
15
+ const r = String(n ?? "").trim();
16
+ return r ? `${r} · ${u}` : u;
17
+ }
18
+ function S(n, e) {
19
+ const t = _(n, e);
20
+ return t == null ? null : `for ${t}`;
21
+ }
22
+ function T(n, e, t) {
23
+ if (!n) return null;
24
+ const u = String(n).toUpperCase();
25
+ let r = null, s = null;
26
+ for (const i of e ?? []) {
27
+ if (String(i.to_state ?? "").toUpperCase() !== u) continue;
28
+ const l = o(i.timestamp);
29
+ l != null && (r == null || l > r) && (r = l, s = i.timestamp);
30
+ }
31
+ return s ?? (t && o(t) != null ? t : null);
32
+ }
33
+ function h(n) {
34
+ return n === "state_entered" ? "-aging_hours" : n === "-state_entered" || n === f ? "aging_hours" : n === `-${f}` ? "-aging_hours" : n;
35
+ }
36
+ export {
37
+ m as IN_STEP_COLUMN,
38
+ a as IN_STEP_SORT,
39
+ f as QUEUE_IN_STEP_COLUMN,
40
+ T as enteredAtFromHistory,
41
+ S as forStepText,
42
+ _ as inStepSpan,
43
+ g as inStepText,
44
+ h as queueServerSort
45
+ };
@@ -1,29 +1,30 @@
1
- const r = (e) => e === "accepted" ? "ok" : e === "failed" || e === "rejected" ? "attention" : e === "pending" ? "pending" : "neutral";
2
- function l(e, o, i = () => "") {
3
- const n = [], s = /* @__PURE__ */ new Set();
1
+ const p = (e) => e === "accepted" ? "ok" : e === "failed" || e === "rejected" ? "attention" : e === "pending" ? "pending" : "neutral";
2
+ function c(e, r, i = () => "", l = /* @__PURE__ */ new Set()) {
3
+ const u = new Set([...l].map((t) => t.toLowerCase())), o = (t, n) => n === "attention" && u.has(t.toLowerCase()) ? "retrying" : n, a = [], s = /* @__PURE__ */ new Set();
4
4
  for (const t of e) {
5
- const a = t.tone === "positive" ? "ok" : t.tone === "danger" ? "attention" : t.outcome === "pending" ? "pending" : "neutral";
6
- n.push({ name: t.api, status: a, tip: `${t.api} · ${t.text}` }), s.add(t.api.toLowerCase());
5
+ const n = t.tone === "positive" ? "ok" : t.tone === "danger" ? "attention" : t.outcome === "pending" ? "pending" : "neutral";
6
+ a.push({ name: t.api, status: o(t.api, n), tip: `${t.api} · ${t.text}` }), s.add(t.api.toLowerCase());
7
7
  }
8
- for (const t of o) {
9
- const a = t.external_api_name ?? (t.external_api != null ? `#${t.external_api}` : "External");
10
- s.has(a.toLowerCase()) || (s.add(a.toLowerCase()), n.push({
11
- name: a,
12
- status: r(t.status),
13
- tip: `${a} · ${t.status} · ${i(t.updated_at ?? t.created_at)}${t.last_error ? ` — ${t.last_error.slice(0, 120)}` : ""}`
8
+ for (const t of r) {
9
+ const n = t.external_api_name ?? (t.external_api != null ? `#${t.external_api}` : "External");
10
+ s.has(n.toLowerCase()) || (s.add(n.toLowerCase()), a.push({
11
+ name: n,
12
+ status: o(n, p(t.status)),
13
+ tip: `${n} · ${t.status} · ${i(t.updated_at ?? t.created_at)}${t.last_error ? ` — ${t.last_error.slice(0, 120)}` : ""}`
14
14
  }));
15
15
  }
16
16
  return {
17
- partners: n,
18
- ok: n.filter((t) => t.status === "ok").length,
19
- attention: n.filter((t) => t.status === "attention").length,
20
- pending: n.filter((t) => t.status === "pending").length
17
+ partners: a,
18
+ ok: a.filter((t) => t.status === "ok").length,
19
+ attention: a.filter((t) => t.status === "attention").length,
20
+ pending: a.filter((t) => t.status === "pending").length,
21
+ retrying: a.filter((t) => t.status === "retrying").length
21
22
  };
22
23
  }
23
- function u(e) {
24
+ function g(e) {
24
25
  return e.layoutOn ? e.obligations === null || e.submissions === null ? null : e.partnerIntegration !== !1 || e.obligations > 0 || e.submissions > 0 : !1;
25
26
  }
26
27
  export {
27
- u as externalRequestsShown,
28
- l as integrationChipSummary
28
+ g as externalRequestsShown,
29
+ c as integrationChipSummary
29
30
  };
@@ -0,0 +1,43 @@
1
+ import { useRef as l, useEffect as i, useLayoutEffect as f } from "react";
2
+ const s = 'input[type="checkbox"], [role="checkbox"]';
3
+ function d(e, n) {
4
+ if (!(e instanceof Element) || !n.contains(e) || !e.matches(s)) return null;
5
+ const t = e.closest("[data-row-key]");
6
+ return !t || !n.contains(t) ? null : t.getAttribute("data-row-key");
7
+ }
8
+ function m() {
9
+ const e = document.activeElement;
10
+ return !e || e === document.body || e === document.documentElement || !e.isConnected;
11
+ }
12
+ function a(e) {
13
+ return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
14
+ }
15
+ function p(e, n) {
16
+ const t = e.querySelector(`[data-row-key="${a(n)}"]`), o = t == null ? void 0 : t.querySelector(s);
17
+ return o ? (o.focus({ preventScroll: !0 }), document.activeElement === o) : !1;
18
+ }
19
+ function E(e) {
20
+ const n = l(null);
21
+ i(() => {
22
+ if (typeof document > "u") return;
23
+ const t = (r) => {
24
+ const u = e.current, c = u ? d(r.target, u) : null;
25
+ n.current = c != null ? { key: c, el: r.target } : null;
26
+ }, o = (r) => {
27
+ const u = n.current;
28
+ !u || r.target !== u.el || r.relatedTarget || setTimeout(() => {
29
+ n.current === u && u.el.isConnected && (n.current = null);
30
+ }, 0);
31
+ };
32
+ return document.addEventListener("focusin", t, !0), document.addEventListener("focusout", o, !0), () => {
33
+ document.removeEventListener("focusin", t, !0), document.removeEventListener("focusout", o, !0);
34
+ };
35
+ }, [e]), f(() => {
36
+ const t = n.current, o = e.current;
37
+ !t || !o || t.el.isConnected || !m() || p(o, t.key) || (n.current = null);
38
+ });
39
+ }
40
+ export {
41
+ p as restoreRowCheckboxFocus,
42
+ E as useKeepRowCheckboxFocus
43
+ };