@nivaro/react 0.3.113 → 0.3.115

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 (285) 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 +1727 -19
  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 +4088 -3592
  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 +544 -504
  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/PageRenderer.js +636 -599
  39. package/dist/shared/components/PresenceDot.js +21 -0
  40. package/dist/shared/components/ProfileView.js +656 -536
  41. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  42. package/dist/shared/components/RecentRecordsRail.js +51 -48
  43. package/dist/shared/components/RecordCompare.js +241 -150
  44. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  45. package/dist/shared/components/RecordGridEditor.js +350 -311
  46. package/dist/shared/components/RecordHoverCard.js +147 -0
  47. package/dist/shared/components/RecordPeekHost.js +111 -0
  48. package/dist/shared/components/RecordReadView.js +414 -412
  49. package/dist/shared/components/RelativeTime.js +16 -0
  50. package/dist/shared/components/ReportView.js +1396 -1304
  51. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  52. package/dist/shared/components/TabCountHost.js +10 -0
  53. package/dist/shared/components/TickerNumber.js +19 -18
  54. package/dist/shared/components/TipLayer.js +70 -58
  55. package/dist/shared/components/WidgetImageMenu.js +59 -0
  56. package/dist/shared/components/WidgetSlot.js +571 -524
  57. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  58. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  59. package/dist/shared/components/cbv/approval-changed.js +20 -0
  60. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  61. package/dist/shared/components/cbv/column-totals.js +75 -67
  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/api.js +161 -117
  79. package/dist/shared/components/integrations/console/tone.js +15 -12
  80. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  81. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  82. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  83. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  84. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  85. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  86. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  87. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  88. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  89. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  90. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  91. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  92. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  93. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  94. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  95. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  96. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  97. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  98. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  99. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  100. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  101. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  102. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  103. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  104. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  105. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  106. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  107. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  108. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  109. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  110. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  111. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  112. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  113. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  114. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  115. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  116. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  117. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  118. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  119. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  120. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  121. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  122. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  123. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  124. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  125. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  126. package/dist/shared/components/item-edit/file-live.js +77 -0
  127. package/dist/shared/components/item-edit/file-processing.js +87 -0
  128. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  129. package/dist/shared/components/item-edit/live-related.js +23 -0
  130. package/dist/shared/components/item-edit/live-title.js +66 -0
  131. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  132. package/dist/shared/components/item-edit/removed-line.js +58 -0
  133. package/dist/shared/components/item-edit/render-stability.js +70 -59
  134. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  135. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  136. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  137. package/dist/shared/components/list/InlineEdit.js +504 -208
  138. package/dist/shared/components/list/ListViewers.js +81 -0
  139. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  140. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  141. package/dist/shared/components/merge/merge-values.js +110 -0
  142. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  143. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  144. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  145. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  146. package/dist/shared/components/notifications/bundles.js +21 -19
  147. package/dist/shared/components/notifications/resolved-line.js +25 -0
  148. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  149. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  150. package/dist/shared/components/panels/AlertBanners.js +132 -0
  151. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  152. package/dist/shared/components/panels/BranchLanes.js +82 -54
  153. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  154. package/dist/shared/components/panels/CommentImages.js +219 -0
  155. package/dist/shared/components/panels/CommentPanel.js +649 -530
  156. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  157. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  158. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  159. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  160. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  161. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  162. package/dist/shared/components/panels/SlaClock.js +130 -99
  163. package/dist/shared/components/panels/TaskPanel.js +308 -287
  164. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  165. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  166. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  167. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  168. package/dist/shared/components/profile/AgentNameField.js +141 -0
  169. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  170. package/dist/shared/components/profile/PersonAccess.js +398 -330
  171. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  172. package/dist/shared/components/profile/PersonProfile.js +81 -73
  173. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  174. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  175. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  176. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  177. package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
  178. package/dist/shared/components/queue/queue-totals.js +92 -0
  179. package/dist/shared/components/queue/worklist-helpers.js +18 -14
  180. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  181. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  182. package/dist/shared/components/support/ReportProblem.js +1 -0
  183. package/dist/shared/components/support/ScreenShare.js +554 -0
  184. package/dist/shared/components/support/SupportView.js +160 -129
  185. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  186. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  187. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  188. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  189. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  190. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  191. package/dist/shared/lib/activity-sentence.js +87 -75
  192. package/dist/shared/lib/agent-presence.js +46 -0
  193. package/dist/shared/lib/approval-progress.js +49 -0
  194. package/dist/shared/lib/attention-prefs.js +27 -0
  195. package/dist/shared/lib/cell-locks.js +56 -0
  196. package/dist/shared/lib/co-edit.js +166 -0
  197. package/dist/shared/lib/coedit-registry.js +44 -0
  198. package/dist/shared/lib/comment-awareness.js +124 -0
  199. package/dist/shared/lib/comment-images.js +45 -0
  200. package/dist/shared/lib/config-watch.js +94 -0
  201. package/dist/shared/lib/copy-rules.js +65 -0
  202. package/dist/shared/lib/count-step.js +30 -0
  203. package/dist/shared/lib/deadline-ticker.js +68 -0
  204. package/dist/shared/lib/derived-causes.js +115 -0
  205. package/dist/shared/lib/draft-store.js +114 -85
  206. package/dist/shared/lib/error-hints.js +1 -0
  207. package/dist/shared/lib/field-merge.js +126 -0
  208. package/dist/shared/lib/filter-sentence.js +10 -10
  209. package/dist/shared/lib/focus-mode.js +16 -12
  210. package/dist/shared/lib/grid-cursors.js +77 -0
  211. package/dist/shared/lib/grid-presence.js +182 -0
  212. package/dist/shared/lib/idle-reload.js +100 -73
  213. package/dist/shared/lib/in-step.js +45 -0
  214. package/dist/shared/lib/integration-chip.js +19 -18
  215. package/dist/shared/lib/line-locks.js +141 -0
  216. package/dist/shared/lib/line-split.js +41 -0
  217. package/dist/shared/lib/linked-changes.js +150 -0
  218. package/dist/shared/lib/list-link.js +56 -50
  219. package/dist/shared/lib/list-return.js +231 -0
  220. package/dist/shared/lib/list-viewers.js +52 -0
  221. package/dist/shared/lib/live-announcer.js +86 -0
  222. package/dist/shared/lib/live-counts.js +85 -0
  223. package/dist/shared/lib/live-data-changed.js +108 -0
  224. package/dist/shared/lib/live-deltas.js +81 -0
  225. package/dist/shared/lib/live-findings.js +113 -0
  226. package/dist/shared/lib/live-groups.js +122 -0
  227. package/dist/shared/lib/live-link-labels.js +162 -0
  228. package/dist/shared/lib/live-list-flow.js +334 -0
  229. package/dist/shared/lib/live-list.js +143 -129
  230. package/dist/shared/lib/live-moves.js +51 -0
  231. package/dist/shared/lib/live-ops.js +26 -26
  232. package/dist/shared/lib/live-pickers.js +7 -0
  233. package/dist/shared/lib/live-preference.js +184 -0
  234. package/dist/shared/lib/live-queries.js +226 -181
  235. package/dist/shared/lib/live-screen.js +333 -0
  236. package/dist/shared/lib/live-search.js +108 -0
  237. package/dist/shared/lib/live-seen.js +35 -0
  238. package/dist/shared/lib/live-views.js +100 -0
  239. package/dist/shared/lib/live.js +159 -133
  240. package/dist/shared/lib/missed-updates.js +198 -0
  241. package/dist/shared/lib/newer-file.js +56 -0
  242. package/dist/shared/lib/notification-sound.js +42 -20
  243. package/dist/shared/lib/own-writes.js +59 -41
  244. package/dist/shared/lib/picker-badges.js +94 -0
  245. package/dist/shared/lib/presence-signals.js +131 -84
  246. package/dist/shared/lib/realtime.js +49 -24
  247. package/dist/shared/lib/record-gaps.js +85 -0
  248. package/dist/shared/lib/record-outbox.js +369 -222
  249. package/dist/shared/lib/record-peek.js +75 -0
  250. package/dist/shared/lib/record-tabs.js +92 -72
  251. package/dist/shared/lib/relative-ticker.js +42 -0
  252. package/dist/shared/lib/request-gate.js +119 -119
  253. package/dist/shared/lib/rollup-recalc.js +107 -0
  254. package/dist/shared/lib/room-gaps.js +40 -36
  255. package/dist/shared/lib/rum.js +137 -87
  256. package/dist/shared/lib/save-progress.js +20 -0
  257. package/dist/shared/lib/scheduled-countdown.js +67 -0
  258. package/dist/shared/lib/screen-refresh.js +160 -0
  259. package/dist/shared/lib/screen-share.js +234 -0
  260. package/dist/shared/lib/seen-since.js +74 -0
  261. package/dist/shared/lib/selection-watch.js +205 -0
  262. package/dist/shared/lib/send-status.js +132 -0
  263. package/dist/shared/lib/send-view.js +23 -0
  264. package/dist/shared/lib/socket-liveness.js +155 -0
  265. package/dist/shared/lib/socket-realtime.js +168 -140
  266. package/dist/shared/lib/state-census.js +53 -0
  267. package/dist/shared/lib/summary-mode.js +61 -39
  268. package/dist/shared/lib/tab-attention.js +143 -32
  269. package/dist/shared/lib/table-density.js +64 -0
  270. package/dist/shared/lib/track-travel.js +40 -0
  271. package/dist/shared/lib/unseen-changes.js +68 -0
  272. package/dist/shared/lib/upload-file.js +33 -0
  273. package/dist/shared/lib/upload-presence.js +127 -0
  274. package/dist/shared/lib/urgent-chime.js +65 -0
  275. package/dist/shared/lib/use-online-users.js +32 -11
  276. package/dist/shared/lib/user-sync.js +155 -39
  277. package/dist/shared/lib/waiting-count.js +44 -0
  278. package/dist/shared/lib/watch-desktop.js +83 -0
  279. package/dist/shared/lib/watch-list.js +447 -0
  280. package/dist/shared/lib/widget-image-render.js +64 -0
  281. package/dist/shared/lib/widget-image.js +111 -0
  282. package/dist/shared/lib/worker-socket.js +130 -104
  283. package/dist/shared/lib/write-to-screen.js +133 -0
  284. package/package.json +1 -1
  285. package/styles.css +49 -1
@@ -0,0 +1,234 @@
1
+ import { useSyncExternalStore as $ } from "react";
2
+ import { replayRecorderMode as O, tapReplayEvents as j } from "./replay-capture.js";
3
+ import { DEFAULT_REPLAY_MASKING as Y, normalizeReplayMasking as z, buildReplayMaskingOptions as B } from "./replay-masking.js";
4
+ const J = 6e4, X = 200, G = 1e4, K = 24e6, L = /* @__PURE__ */ new Set([2, 3, 4]), Q = 2, V = 4;
5
+ let v = null;
6
+ function oe(e) {
7
+ return v = e, x(), () => {
8
+ v === e && (v = null, x());
9
+ };
10
+ }
11
+ function ie() {
12
+ return v;
13
+ }
14
+ function W(e) {
15
+ return e.filter((o) => L.has(Number(o == null ? void 0 : o.type)));
16
+ }
17
+ function Z(e, o, r = J) {
18
+ const n = JSON.stringify(o), c = Math.max(1, Math.ceil(n.length / r)), a = [];
19
+ for (let s = 0; s < c; s++)
20
+ a.push({ seq: e, part: s, parts: c, data: n.slice(s * r, (s + 1) * r) });
21
+ return a;
22
+ }
23
+ function ae() {
24
+ const e = /* @__PURE__ */ new Map();
25
+ let o = -1, r = !0;
26
+ return {
27
+ /** Feed one part; returns the events to play now (maybe none) and whether a gap was seen. */
28
+ push(n) {
29
+ const c = { events: [], gap: !1, snapshot: !1 };
30
+ if (!Number.isSafeInteger(n.seq) || n.seq <= o - 1e3) return c;
31
+ let a = e.get(n.seq);
32
+ if (a || (a = { parts: n.parts, got: /* @__PURE__ */ new Map() }, e.set(n.seq, a)), a.got.set(n.part, n.data), a.got.size < a.parts) {
33
+ for (const i of [...e.keys()]) i < n.seq - 50 && e.delete(i);
34
+ return c;
35
+ }
36
+ e.delete(n.seq);
37
+ let s;
38
+ try {
39
+ const i = Array.from({ length: a.parts }, (h, m) => (a == null ? void 0 : a.got.get(m)) ?? "").join(""), l = JSON.parse(i);
40
+ s = Array.isArray(l) ? l : [];
41
+ } catch {
42
+ s = [];
43
+ }
44
+ const u = o >= 0 && n.seq !== o + 1;
45
+ n.seq > o && (o = n.seq), s = W(s);
46
+ const f = s.findIndex((i) => Number(i.type) === Q);
47
+ if (u && (r = !0), r) {
48
+ if (f < 0) return { events: [], gap: u, snapshot: !1 };
49
+ r = !1;
50
+ let i = -1;
51
+ for (let l = f - 1; l >= 0; l--)
52
+ if (Number(s[l].type) === V) {
53
+ i = l;
54
+ break;
55
+ }
56
+ return { events: s.slice(i >= 0 ? i : f), gap: u, snapshot: !0 };
57
+ }
58
+ return { events: s, gap: u, snapshot: f >= 0 };
59
+ },
60
+ reset() {
61
+ e.clear(), o = -1, r = !0;
62
+ }
63
+ };
64
+ }
65
+ let p = null;
66
+ const b = /* @__PURE__ */ new Set();
67
+ function x() {
68
+ for (const e of b) e();
69
+ }
70
+ function A(e) {
71
+ p = e, x();
72
+ }
73
+ function ee() {
74
+ return p;
75
+ }
76
+ function F(e) {
77
+ return b.add(e), () => {
78
+ b.delete(e);
79
+ };
80
+ }
81
+ function ue() {
82
+ return $(F, ee, () => null);
83
+ }
84
+ function ce() {
85
+ return $(
86
+ F,
87
+ () => v != null,
88
+ () => !1
89
+ );
90
+ }
91
+ let k = null;
92
+ function le() {
93
+ k == null || k.stop("stopped");
94
+ }
95
+ const R = {
96
+ stopped: "You stopped sharing",
97
+ expired: "Sharing stopped after 30 minutes",
98
+ stale: "Sharing stopped",
99
+ page: "Sharing stopped",
100
+ moved: "Sharing stopped: your request moved to someone else",
101
+ closed: "Sharing stopped: your request was closed",
102
+ replaced: "Sharing moved to another tab",
103
+ gone: "Sharing stopped"
104
+ };
105
+ async function fe(e) {
106
+ const o = e.runtime ?? v;
107
+ if (!o || k) return !1;
108
+ const r = await o.loadRecord().catch(() => null);
109
+ if (!r) return !1;
110
+ const { share: n, transport: c } = e, a = e.now ?? Date.now, s = e.win === void 0 ? typeof window < "u" ? window : null : e.win, u = e.masking == null ? Y : z(e.masking);
111
+ let f = !1, i = [], l = 0, h = [], m = 0, S = null, w = null, y = !1;
112
+ const E = [], M = (t) => {
113
+ !f || y || L.has(Number(t == null ? void 0 : t.type)) && i.push(t);
114
+ }, N = () => {
115
+ if (S = null, y) return;
116
+ const t = h.shift();
117
+ t && (m -= t.data.length, c.emit("screenshare:frame", { ticket: n.ticket, share: n.id, ...t }), S = setTimeout(N, Math.max(16, Math.round(t.data.length / 1e3))));
118
+ }, I = () => {
119
+ if (y || i.length === 0) return;
120
+ const t = i;
121
+ i = [];
122
+ const d = Z(l++, t);
123
+ for (const g of d)
124
+ h.push(g), m += g.data.length;
125
+ m > K && (h = [], m = 0), S || N();
126
+ }, H = async () => {
127
+ var t, d;
128
+ if (!y) {
129
+ f = !0;
130
+ try {
131
+ const g = O();
132
+ w ? (d = r.takeFullSnapshot) == null || d.call(r, !0) : g === "full" || g === "clip" ? (w = j(M), (t = r.takeFullSnapshot) == null || t.call(r, !0)) : w = r({ emit: M, ...B(() => u) }) ?? null;
133
+ } catch {
134
+ }
135
+ }
136
+ }, q = (t, d) => {
137
+ if (y) return;
138
+ y = !0, f = !1, k = null, clearInterval(P), clearInterval(U), clearTimeout(C), S && clearTimeout(S), h = [], i = [];
139
+ for (const D of E) D();
140
+ try {
141
+ w == null || w();
142
+ } catch {
143
+ }
144
+ if (t !== "ended")
145
+ try {
146
+ Promise.resolve(
147
+ c.stop(n.ticket, n.id, t === "stopped" ? void 0 : t)
148
+ ).catch(() => {
149
+ });
150
+ } catch {
151
+ }
152
+ A({ share: n, watching: [], ended: R[t === "ended" ? d ?? "gone" : t] ?? R.gone }), setTimeout(() => {
153
+ (p == null ? void 0 : p.share.id) === n.id && p.ended && A(null);
154
+ }, 4e3);
155
+ }, T = (t) => !!t && Number(t.ticket) === n.ticket && t.share === n.id;
156
+ if (E.push(
157
+ c.on("screenshare:snapshot", (t) => {
158
+ T(t) && H();
159
+ }),
160
+ c.on("screenshare:watching", (t) => {
161
+ if (!T(t)) return;
162
+ const d = Array.isArray(t.names) ? t.names.filter((g) => typeof g == "string") : [];
163
+ d.length === 0 && (f = !1), (p == null ? void 0 : p.share.id) === n.id && !p.ended && A({ ...p, watching: d });
164
+ }),
165
+ c.on("screenshare:ended", (t) => {
166
+ T(t) && q("ended", typeof t.reason == "string" ? t.reason : void 0);
167
+ })
168
+ ), s) {
169
+ const t = (d) => {
170
+ d.persisted || q("page");
171
+ };
172
+ s.addEventListener("pagehide", t), E.push(() => s.removeEventListener("pagehide", t));
173
+ }
174
+ const _ = () => c.emit("screenshare:beat", { ticket: n.ticket, share: n.id }), P = setInterval(I, X), U = setInterval(_, G), C = setTimeout(() => q("expired"), Math.max(1e3, n.expires_at - a()));
175
+ return k = { stop: q }, A({ share: n, watching: [], ended: null }), _(), !0;
176
+ }
177
+ function te(e) {
178
+ return /^Stopped sharing/i.test(e) ? null : /page closed/i.test(e) ? "ended when the page closed" : /30 minutes/i.test(e) ? "ended after 30 minutes" : /moved/i.test(e) ? "ended when the request moved" : /request closed/i.test(e) ? "ended when the request closed" : /restarted/i.test(e) ? "restarted" : "ended";
179
+ }
180
+ function he(e, o) {
181
+ if (e.action !== "support-traffic-view") return { text: e.text, showAuthor: !0 };
182
+ const r = e.user_name ?? "Someone";
183
+ if (o.isRequester)
184
+ return { text: `${r} looked at your recent activity around this ticket`, showAuthor: !1 };
185
+ const n = o.requesterName ? `${o.requesterName}'s` : "the requester’s";
186
+ return { text: `${r} viewed ${n} activity around the ticket`, showAuthor: !1 };
187
+ }
188
+ function de(e) {
189
+ var c, a;
190
+ const o = [];
191
+ let r = null;
192
+ const n = (s, u, f) => {
193
+ if (!r) return;
194
+ const { to: i, watchers: l } = r, h = [
195
+ f ? `Sharing their screen with ${i} now` : `Shared their screen with ${i}`
196
+ ];
197
+ s && h.push(s);
198
+ const m = l.length > 0 && l.every((S) => S === i);
199
+ f ? h.push(l.length ? "watching now" : "not opened yet") : l.length === 0 ? h.push("not watched") : h.push(m ? "watched" : `watched by ${l.join(", ")}`), u && h.push(u), o[r.at] = { ...r.row, text: h.join(" · ") }, r = null;
200
+ };
201
+ for (const s of e)
202
+ if (s.action === "screen-share-start") {
203
+ n(null, "restarted", !1);
204
+ const u = ((c = /with (.+)$/.exec(s.text)) == null ? void 0 : c[1]) ?? "support";
205
+ r = { at: o.length, row: s, to: u, watchers: [] }, o.push(s);
206
+ } else if (s.action === "screen-share-watch" && r) {
207
+ const u = s.user_name ?? "someone";
208
+ r.watchers.includes(u) || r.watchers.push(u);
209
+ } else if (s.action === "screen-share-stop" && r) {
210
+ const u = ((a = /\(([^)]+)\)\s*$/.exec(s.text)) == null ? void 0 : a[1]) ?? null;
211
+ n(u, te(s.text), !1);
212
+ } else o.push(s);
213
+ return n(null, null, !0), o;
214
+ }
215
+ export {
216
+ G as BEAT_MS,
217
+ R as ENDED_TEXT,
218
+ X as FLUSH_MS,
219
+ J as PART_CHARS,
220
+ K as QUEUE_MAX_CHARS,
221
+ L as SCREEN_EVENT_TYPES,
222
+ ae as createFrameAssembler,
223
+ de as foldShareHistory,
224
+ he as historyLine,
225
+ Z as packBatch,
226
+ oe as registerScreenShareRuntime,
227
+ W as screenEvents,
228
+ ie as screenShareRuntime,
229
+ ee as screenShareStatus,
230
+ fe as startScreenShare,
231
+ le as stopScreenShare,
232
+ ce as useScreenShareAvailable,
233
+ ue as useScreenShareStatus
234
+ };
@@ -0,0 +1,74 @@
1
+ import { useState as d, useEffect as S, useMemo as y } from "react";
2
+ const m = "nvr:tab-seen:", b = 2160 * 36e5, h = 400;
3
+ function I(t, e, o, n) {
4
+ return `${m}${String(t ?? "anon").toLowerCase()}:${e}:${String(o)}:${n}`;
5
+ }
6
+ function s(t) {
7
+ try {
8
+ const e = window.localStorage.getItem(t);
9
+ if (!e) return null;
10
+ const o = Number(e);
11
+ return Number.isFinite(o) && o > 0 ? o : null;
12
+ } catch {
13
+ return null;
14
+ }
15
+ }
16
+ function E(t, e = Date.now()) {
17
+ try {
18
+ window.localStorage.setItem(t, String(e)), N(e);
19
+ } catch {
20
+ }
21
+ }
22
+ let g = 0;
23
+ function N(t) {
24
+ if (!(t - g < 36e5)) {
25
+ g = t;
26
+ try {
27
+ const e = [];
28
+ for (let o = 0; o < window.localStorage.length; o++) {
29
+ const n = window.localStorage.key(o);
30
+ n != null && n.startsWith(m) && e.push([n, Number(window.localStorage.getItem(n)) || 0]);
31
+ }
32
+ e.sort((o, n) => n[1] - o[1]), e.forEach(([o, n], i) => {
33
+ (i >= h || t - n > b) && window.localStorage.removeItem(o);
34
+ });
35
+ } catch {
36
+ }
37
+ }
38
+ }
39
+ const $ = (t, e) => t != null && e != null && String(t).toLowerCase() === String(e).toLowerCase();
40
+ function p(t, e, o) {
41
+ if (e == null) return 0;
42
+ let n = 0;
43
+ for (const i of t) {
44
+ if (i.by && $(i.by, o)) continue;
45
+ const u = i.at instanceof Date ? i.at.getTime() : new Date(i.at ?? "").getTime();
46
+ Number.isFinite(u) && u > e && n++;
47
+ }
48
+ return n;
49
+ }
50
+ function D(t) {
51
+ return t > 0 ? `${t > 99 ? "99+" : t} new` : null;
52
+ }
53
+ function L(t) {
54
+ const { userId: e, collection: o, item: n, tab: i, open: u, entries: c, ready: l } = t, r = n != null && n !== "" && n !== "new" && e ? I(e, o, n, i) : null, [a, f] = d(() => r ? s(r) : null);
55
+ return S(() => {
56
+ f(r ? s(r) : null);
57
+ }, [r]), S(() => {
58
+ if (!(!r || !l) && (u || s(r) == null)) {
59
+ const w = Date.now();
60
+ E(r, w), f(w);
61
+ }
62
+ }, [r, l, u, c]), y(
63
+ () => r && l && !u ? p(c, a, e) : 0,
64
+ [r, l, u, c, a, e]
65
+ );
66
+ }
67
+ export {
68
+ p as countNewSince,
69
+ D as newCountLabel,
70
+ s as readSeen,
71
+ I as seenKey,
72
+ L as useNewSince,
73
+ E as writeSeen
74
+ };
@@ -0,0 +1,205 @@
1
+ import { useQueries as M } from "@tanstack/react-query";
2
+ import { useState as b, useEffect as S, useCallback as p, useRef as w, useMemo as g } from "react";
3
+ import { useOptionalNivaroClient as C } from "../context.js";
4
+ import { post as j } from "./commands.js";
5
+ import { useLiveCollection as L } from "./live.js";
6
+ import { serverNow as $ } from "./server-clock.js";
7
+ const y = (e, n) => `${e}:${n}`;
8
+ function k(e) {
9
+ const n = e.indexOf(":");
10
+ return { collection: e.slice(0, n), id: e.slice(n + 1) };
11
+ }
12
+ const T = 200;
13
+ function z(e, n, i) {
14
+ const s = /* @__PURE__ */ new Map();
15
+ for (const r of n) s.set(r, e.get(r) ?? i);
16
+ return s;
17
+ }
18
+ function B(e) {
19
+ const [n, i] = b(() => /* @__PURE__ */ new Map()), s = e.join("");
20
+ S(() => {
21
+ i((o) => {
22
+ const l = z(o, e, $());
23
+ return l.size === o.size && [...l].every(([c, u]) => o.get(c) === u) ? o : l;
24
+ });
25
+ }, [s]);
26
+ const r = p((o) => {
27
+ const l = $();
28
+ i((c) => {
29
+ const u = new Map(c);
30
+ for (const t of o) u.has(t) && u.set(t, l);
31
+ return u;
32
+ });
33
+ }, []);
34
+ return { picks: n, restamp: r };
35
+ }
36
+ function N(e) {
37
+ return e.deleted || e.created || !e.aspectsOnly ? !0 : (e.changedFields ?? []).includes("$state");
38
+ }
39
+ function P(e, n) {
40
+ const [i, s] = b(() => /* @__PURE__ */ new Set()), r = w(n);
41
+ r.current = n, S(() => {
42
+ s((c) => {
43
+ const u = [...c].filter((t) => n.has(t));
44
+ return u.length === c.size ? c : new Set(u);
45
+ });
46
+ }, [n]);
47
+ const o = p((c) => {
48
+ if (!N(c)) return;
49
+ const u = [];
50
+ for (const t of c.events) {
51
+ const a = String(t.collection ?? ""), f = String(t.item ?? "");
52
+ if (a)
53
+ if (f === "*")
54
+ for (const d of r.current.keys()) k(d).collection === a && u.push(d);
55
+ else {
56
+ const d = y(a, f);
57
+ r.current.has(d) && u.push(d);
58
+ }
59
+ }
60
+ u.length !== 0 && s((t) => {
61
+ const a = new Set(t);
62
+ for (const f of u) a.add(f);
63
+ return a.size === t.size ? t : a;
64
+ });
65
+ }, []);
66
+ L(n.size > 0 ? [...e] : null, o, {
67
+ debounceMs: 1e3,
68
+ enabled: n.size > 0
69
+ });
70
+ const l = p((c) => {
71
+ s((u) => {
72
+ const t = new Set(u);
73
+ for (const a of c) t.delete(a);
74
+ return t;
75
+ });
76
+ }, []);
77
+ return { marked: i, clear: l };
78
+ }
79
+ function I(e, n, i = 0) {
80
+ const s = C(), r = g(() => {
81
+ const t = /* @__PURE__ */ new Map();
82
+ for (const a of e.slice(0, T)) {
83
+ const f = n.get(a);
84
+ if (f == null) continue;
85
+ const { collection: d, id: h } = k(a), m = t.get(d) ?? [];
86
+ m.push({ id: h, since: f }), t.set(d, m);
87
+ }
88
+ return [...t.entries()].slice(0, 12);
89
+ }, [e, n]), o = M({
90
+ queries: r.map(([t, a]) => ({
91
+ queryKey: [
92
+ "bulk-selection-changes",
93
+ t,
94
+ a.map((f) => `${f.id}@${f.since}`).join(","),
95
+ i
96
+ ],
97
+ queryFn: () => s.request(
98
+ j("/bulk-preflight/changes", {
99
+ collection: t,
100
+ items: a.map((f) => ({ id: f.id, since: new Date(f.since).toISOString() }))
101
+ })
102
+ ).then((f) => f.data),
103
+ enabled: !!s && a.length > 0,
104
+ staleTime: 1e4,
105
+ retry: !1
106
+ }))
107
+ }), l = o.map((t) => t.dataUpdatedAt).join(","), c = o.some((t) => t.isFetching);
108
+ return { rows: g(() => {
109
+ const t = [];
110
+ return o.forEach((a, f) => {
111
+ var m;
112
+ const d = (m = r[f]) == null ? void 0 : m[0], h = a.data;
113
+ !d || !h || t.push(...O(d, h));
114
+ }), t.sort((a, f) => f.at.localeCompare(a.at));
115
+ }, [l, r]), checking: c };
116
+ }
117
+ function O(e, n) {
118
+ return Object.entries(n.changes ?? {}).map(([i, s]) => {
119
+ var r, o;
120
+ return {
121
+ ...s,
122
+ key: y(e, i),
123
+ collection: e,
124
+ id: i,
125
+ label: ((o = (r = n.labels) == null ? void 0 : r.records) == null ? void 0 : o[`${e}:${i}`]) ?? null,
126
+ names: s.by.map(
127
+ (l) => {
128
+ var c, u, t, a, f, d;
129
+ return ((u = (c = n.labels) == null ? void 0 : c.users) == null ? void 0 : u[l]) ?? ((a = (t = n.labels) == null ? void 0 : t.users) == null ? void 0 : a[l.toUpperCase()]) ?? ((d = (f = n.labels) == null ? void 0 : f.users) == null ? void 0 : d[l.toLowerCase()]) ?? "someone";
130
+ }
131
+ ),
132
+ fieldLabels: s.fields.map((l) => {
133
+ var c, u;
134
+ return ((u = (c = n.labels) == null ? void 0 : c.fields) == null ? void 0 : u[`${e}.${l}`]) ?? _(l);
135
+ })
136
+ };
137
+ });
138
+ }
139
+ function _(e) {
140
+ return e.split(/[_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
141
+ }
142
+ function x(e, n = 0) {
143
+ const i = [...new Set(e.filter(Boolean))], s = n + Math.max(0, i.length - 2), r = i.slice(0, 2);
144
+ return r.length === 0 ? n > 0 ? `${n} ${n === 1 ? "person" : "people"}` : "" : s === 0 ? r.length === 1 ? r[0] : `${r[0]} and ${r[1]}` : `${r.join(", ")} and ${s} other${s === 1 ? "" : "s"}`;
145
+ }
146
+ function W(e, n) {
147
+ if (e.length === 0) return null;
148
+ const i = e.flatMap((t) => t.names), s = Math.max(0, ...e.map((t) => t.unnamed)), r = i.length > 0 ? x(i) : s > 1 ? `${s} people` : "someone", o = e.length, l = n === o && o === 1 ? "This one" : `${o} of these`, c = o === 1 ? "is" : "are";
149
+ return e.every((t) => t.editing) ? `${l} ${c} being edited by ${r} right now` : `${l} ${c} open by ${r} right now`;
150
+ }
151
+ function D(e) {
152
+ return e <= 0 ? null : e === 1 ? "1 selected row changed since you picked it" : `${e} selected rows changed since you picked them`;
153
+ }
154
+ function H(e) {
155
+ const n = x(e.names) || "Someone", i = n.charAt(0).toUpperCase() + n.slice(1);
156
+ if (e.deleted) return `${i} deleted it`;
157
+ const s = [];
158
+ return e.moved_to !== void 0 && s.push(e.moved_to ? `moved it to ${e.moved_to}` : "moved it"), e.fieldLabels.length > 0 ? s.push(`changed ${A(e.fieldLabels)}`) : e.fields_unknown && s.length === 0 && s.push("changed it"), `${i} ${s.join(" and ") || "changed it"}`;
159
+ }
160
+ function A(e) {
161
+ const n = [...new Set(e)];
162
+ return n.length === 1 ? n[0] : n.length <= 3 ? `${n.slice(0, -1).join(", ")} and ${n[n.length - 1]}` : `${n.slice(0, 2).join(", ")} and ${n.length - 2} other fields`;
163
+ }
164
+ const E = (e) => {
165
+ if (e == null || e === "" || typeof e == "boolean") return null;
166
+ const n = typeof e == "number" ? e : Number(String(e).trim());
167
+ return Number.isFinite(n) ? n : null;
168
+ };
169
+ function Q(e, n, i = (s, r) => s[r]) {
170
+ const s = e.filter((o) => !!o);
171
+ return { sums: n.map((o) => {
172
+ let l = 0, c = 0;
173
+ for (const u of s) {
174
+ const t = E(i(u, o));
175
+ t != null && (l += t, c++);
176
+ }
177
+ return { key: o, sum: Math.round(l * 100) / 100, counted: c };
178
+ }).filter((o) => o.counted > 0), known: s.length };
179
+ }
180
+ function X(e, n, i) {
181
+ const s = w(/* @__PURE__ */ new Map()), r = new Set(i);
182
+ for (const o of e) {
183
+ const l = n(o);
184
+ r.has(l) && s.current.set(l, o);
185
+ }
186
+ for (const o of [...s.current.keys()]) r.has(o) || s.current.delete(o);
187
+ return i.map((o) => s.current.get(o)).filter((o) => !!o);
188
+ }
189
+ export {
190
+ T as SELECTION_CHECK_MAX,
191
+ N as batchChangesRecord,
192
+ H as changeLineText,
193
+ D as changedNoticeText,
194
+ O as changedRowsOf,
195
+ x as namesText,
196
+ W as openNoticeText,
197
+ z as reconcilePicks,
198
+ y as selKey,
199
+ Q as selectionSums,
200
+ k as splitSelKey,
201
+ X as useSelectedRowMemory,
202
+ I as useSelectionChanges,
203
+ P as useSelectionLiveMarks,
204
+ B as useSelectionPicks
205
+ };
@@ -0,0 +1,132 @@
1
+ import { describeError as S } from "./error-message.js";
2
+ import { partnerWords as N, partnerOutcome as C, partnerSaid as A } from "./partner-failure.js";
3
+ import { getDisplayTimezone as R } from "./utils.js";
4
+ function q(t, e = Date.now()) {
5
+ const n = t instanceof Date ? t : new Date(t);
6
+ if (Number.isNaN(n.getTime())) return "";
7
+ const r = R(), a = r ? { timeZone: r } : {}, o = (u) => new Intl.DateTimeFormat("en-US", {
8
+ ...a,
9
+ year: "numeric",
10
+ month: "numeric",
11
+ day: "numeric"
12
+ }).format(u), c = new Intl.DateTimeFormat("en-US", {
13
+ ...a,
14
+ hour: "numeric",
15
+ minute: "2-digit"
16
+ }).format(n);
17
+ return o(n) === o(new Date(e)) ? c : `${new Intl.DateTimeFormat("en-US", { ...a, month: "short", day: "numeric" }).format(
18
+ n
19
+ )}, ${c}`;
20
+ }
21
+ function w(t) {
22
+ if (!Number.isFinite(t) || t < 6e4) return "less than a minute";
23
+ const e = Math.round(t / 6e4);
24
+ if (e < 60) return `${e} minute${e === 1 ? "" : "s"}`;
25
+ const n = Math.round(t / 36e5);
26
+ if (n < 48) return `${n} hour${n === 1 ? "" : "s"}`;
27
+ const r = Math.round(t / 864e5);
28
+ return `${r} day${r === 1 ? "" : "s"}`;
29
+ }
30
+ function M(t) {
31
+ const e = (t ?? "").trim();
32
+ if (!e) return { text: "", quoted: !1 };
33
+ const n = /\bHTTP \d{3}: /.exec(e), r = N(n ? e.slice(n.index) : e);
34
+ return r ? { text: r.replace(/[\s.,;:]+$/, ""), quoted: !0 } : { text: D(e), quoted: !1 };
35
+ }
36
+ function D(t) {
37
+ const e = (t ?? "").trim();
38
+ if (!e) return "";
39
+ const n = /\bHTTP \d{3}: /.exec(e), r = N(n ? e.slice(n.index) : e) ?? C(e) ?? A(e);
40
+ return r ? r.replace(/[\s.,;:]+$/, "") : S({ message: e }, "").title.replace(/[\s.,;:]+$/, "");
41
+ }
42
+ const U = /* @__PURE__ */ new Set(["transient", "rate_limited"]);
43
+ function E(t, e = {}) {
44
+ var g, b, x, _;
45
+ const n = e.now ?? Date.now(), r = e.time ?? ((s) => q(s, n));
46
+ e.reason;
47
+ const a = ((g = t.api) == null ? void 0 : g.trim()) || "the other system", o = (t.status ?? "").toLowerCase(), c = t.finished_at ?? t.started_at;
48
+ if (o === "sending") {
49
+ const s = t.answer_by ? new Date(t.answer_by).getTime() : Number.NaN;
50
+ return Number.isFinite(s) && n > s ? {
51
+ state: "no_answer",
52
+ tone: "held",
53
+ text: `No answer from ${a} after ${w(n - new Date(t.started_at).getTime())} — the send is held and will not be repeated automatically`
54
+ } : {
55
+ state: "sending",
56
+ tone: "busy",
57
+ text: `Sending to ${a} now (started ${r(t.started_at)})`
58
+ };
59
+ }
60
+ if (o === "pending") {
61
+ const s = t.usual_answer_ms != null && t.usual_answer_ms > 0 ? ` · usually answers within ${w(t.usual_answer_ms)}` : "";
62
+ return {
63
+ state: "waiting",
64
+ tone: "waiting",
65
+ text: `Sent to ${a} at ${r(t.started_at)} — waiting for ${a}'s answer${s}`
66
+ };
67
+ }
68
+ if (o === "accepted") {
69
+ const s = (b = t.external_ref) == null ? void 0 : b.trim(), $ = ((x = t.ref_label) == null ? void 0 : x.trim()) || "reference";
70
+ return {
71
+ state: "accepted",
72
+ tone: "ok",
73
+ text: `${a} accepted it at ${r(c)}${s ? ` — ${$} ${s}` : ""}`
74
+ };
75
+ }
76
+ const d = (t.error_class ?? "").toLowerCase(), u = e.reason ? { text: e.reason(t.reason), quoted: !1 } : M(t.reason), i = t.retry && t.retry.at ? t.retry : null, h = i ? new Date(i.at).getTime() : Number.NaN, m = i ? `${Number.isFinite(h) && h > n ? `Retrying at ${r(i.at)}` : "Retrying now"} (attempt ${i.attempt} of ${i.of})` : "", y = (_ = t.no_retry) == null ? void 0 : _.trim(), l = (s) => i ? { retry_at: i.at } : s && y ? { detail: `It won't be sent again automatically — ${y}.` } : {};
77
+ if (U.has(d)) {
78
+ const $ = d === "rate_limited" ? `${a} was too busy to take it at ${r(c)} — nothing was sent.` : `Couldn't reach ${a} — nothing was sent.`, p = !i && t.can_resend === !0, F = i ? ` ${m}` : p ? "" : " Ask an admin to send it again.";
79
+ return {
80
+ state: "not_taken",
81
+ tone: i ? "waiting" : "problem",
82
+ text: `${$}${F}`,
83
+ ...p ? { resend: !0 } : {},
84
+ ...l(!0)
85
+ };
86
+ }
87
+ const f = `${a} refused it at ${r(c)}`;
88
+ if (d === "auth")
89
+ return {
90
+ state: "refused",
91
+ tone: i ? "waiting" : "problem",
92
+ text: `${f}: it did not accept this app's sign-in. ${i ? m : `An administrator needs to check the connection to ${a}.`}`,
93
+ ...l(!0)
94
+ };
95
+ const T = u.text ? u.quoted ? `: “${u.text}.”` : `: ${u.text}.` : ".", k = o === "rejected" || ["validation", "not_found"].includes(d);
96
+ return {
97
+ state: "refused",
98
+ tone: i ? "waiting" : "problem",
99
+ text: `${f}${T} ${i ? m : u.text ? "Change that on the record, then send it again." : "Check the record, then send it again."}`,
100
+ // "Repeating it cannot fix it" is already what the next step says.
101
+ ...l(!k)
102
+ };
103
+ }
104
+ function H(t, e = Date.now()) {
105
+ if (!t) return null;
106
+ const n = new Date(t).getTime();
107
+ if (!Number.isFinite(n) || n <= e) return null;
108
+ const r = Math.ceil((n - e) / 6e4);
109
+ return r < 60 ? `in ${r} minute${r === 1 ? "" : "s"}` : `in ${w(n - e)}`;
110
+ }
111
+ function O(t, e = Date.now()) {
112
+ var a;
113
+ const n = (a = t.retry) != null && a.at ? new Date(t.retry.at).getTime() : Number.NaN;
114
+ if (!Number.isFinite(n) || n <= e) return null;
115
+ const r = n - e;
116
+ return Math.min(r, (r - 1) % 6e4 + 1) + 250;
117
+ }
118
+ function P(t, e = Date.now()) {
119
+ if ((t.status ?? "").toLowerCase() !== "sending" || !t.answer_by) return null;
120
+ const n = new Date(t.answer_by).getTime();
121
+ return !Number.isFinite(n) || n < e ? null : n - e + 500;
122
+ }
123
+ export {
124
+ q as atClock,
125
+ P as msUntilNoAnswer,
126
+ O as msUntilRetryTick,
127
+ w as plainDuration,
128
+ D as plainSendReason,
129
+ H as retryCountdown,
130
+ M as sendReason,
131
+ E as sendStatusWords
132
+ };
@@ -0,0 +1,23 @@
1
+ import { encodeListLink as l, LIST_LINK_MAX_CHARS as i } from "./list-link.js";
2
+ function s(n, t, r, o, u) {
3
+ const e = l(r, o);
4
+ return {
5
+ kind: n,
6
+ ...n === "list" ? { collection: String(t) } : { queue: String(t) },
7
+ lv: e.length <= i ? e : null,
8
+ summary: u ?? null
9
+ };
10
+ }
11
+ function a() {
12
+ if (typeof window > "u") return null;
13
+ const n = new URLSearchParams(window.location.search).get("tab");
14
+ return n && /^[A-Za-z0-9_-]{1,40}$/.test(n) ? n : null;
15
+ }
16
+ function f(n) {
17
+ return `${n.split(/\s+/)[0] || n} sent you`;
18
+ }
19
+ export {
20
+ a as currentRecordTab,
21
+ s as listViewInput,
22
+ f as senderLead
23
+ };