@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.
- package/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1728 -22
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4909 -4182
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +612 -551
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/OverflowRail.js +326 -0
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/SignalCard.js +84 -77
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/list/PhonePager.js +50 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/OwnerAvatars.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/ui/popover.js +53 -29
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/keep-row-focus.js +43 -0
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/obligation-banner.js +17 -17
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/rail-menu-context.js +9 -0
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/row-surface.js +7 -0
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/table-pins.js +20 -18
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +62 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-below-md.js +29 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { useRef as C, useEffect as T, useSyncExternalStore as _ } from "react";
|
|
2
|
+
import { getLiveMode as y } from "./live-preference.js";
|
|
3
|
+
import { forgetSettledReads as D } from "./request-gate.js";
|
|
4
|
+
const M = 1600, L = 1e3, b = 2e4;
|
|
5
|
+
let p = null;
|
|
6
|
+
const w = /* @__PURE__ */ new Map();
|
|
7
|
+
let A = 1, f = null, E = 0, m = null, g = { phase: "idle", at: 0, reason: null };
|
|
8
|
+
const R = /* @__PURE__ */ new Set();
|
|
9
|
+
let i = null;
|
|
10
|
+
function S(e) {
|
|
11
|
+
g = e;
|
|
12
|
+
for (const t of [...R]) t();
|
|
13
|
+
}
|
|
14
|
+
function j(e) {
|
|
15
|
+
p = e;
|
|
16
|
+
}
|
|
17
|
+
function G() {
|
|
18
|
+
return p;
|
|
19
|
+
}
|
|
20
|
+
function B(e) {
|
|
21
|
+
const t = A++;
|
|
22
|
+
return w.set(t, e), () => {
|
|
23
|
+
w.delete(t);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function U(e, t = !0) {
|
|
27
|
+
const n = C(e);
|
|
28
|
+
n.current = e, T(() => {
|
|
29
|
+
if (t)
|
|
30
|
+
return B(() => n.current());
|
|
31
|
+
}, [t]);
|
|
32
|
+
}
|
|
33
|
+
function v(e) {
|
|
34
|
+
const t = e.meta;
|
|
35
|
+
return (t == null ? void 0 : t.screenRefresh) !== !1;
|
|
36
|
+
}
|
|
37
|
+
function O(e, t) {
|
|
38
|
+
return new Promise((n, s) => {
|
|
39
|
+
const u = setTimeout(() => s(new Error("timeout")), t);
|
|
40
|
+
Promise.resolve(e).then(
|
|
41
|
+
(o) => {
|
|
42
|
+
clearTimeout(u), n(o);
|
|
43
|
+
},
|
|
44
|
+
(o) => {
|
|
45
|
+
clearTimeout(u), s(o);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function q(e, t) {
|
|
51
|
+
const n = Date.now();
|
|
52
|
+
D();
|
|
53
|
+
let s = 0, u = 0;
|
|
54
|
+
const o = [];
|
|
55
|
+
if (e) {
|
|
56
|
+
for (const r of e.getQueryCache().getAll())
|
|
57
|
+
r.getObserversCount() > 0 && !r.isDisabled() && v(r) && o.push(r);
|
|
58
|
+
s = o.length;
|
|
59
|
+
const l = new Set(o);
|
|
60
|
+
e.invalidateQueries({
|
|
61
|
+
type: "inactive",
|
|
62
|
+
refetchType: "none",
|
|
63
|
+
predicate: (r) => v(r)
|
|
64
|
+
}), await e.refetchQueries(
|
|
65
|
+
{ predicate: (r) => l.has(r) },
|
|
66
|
+
{ cancelRefetch: !1, throwOnError: !1 }
|
|
67
|
+
), u += o.filter((r) => r.state.status === "error").length;
|
|
68
|
+
}
|
|
69
|
+
const a = [...w.values()], c = await Promise.allSettled(
|
|
70
|
+
a.map((l) => {
|
|
71
|
+
try {
|
|
72
|
+
return O(l(), b);
|
|
73
|
+
} catch (r) {
|
|
74
|
+
return Promise.reject(r);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
if (u += c.filter((l) => l.status === "rejected").length, typeof window < "u")
|
|
79
|
+
try {
|
|
80
|
+
window.dispatchEvent(new CustomEvent("nvr:screen-refresh", { detail: { reason: t } }));
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
return { queries: s, loaders: a.length, failed: u, ms: Date.now() - n };
|
|
84
|
+
}
|
|
85
|
+
function k(e = {}) {
|
|
86
|
+
const t = e.reason ?? "button";
|
|
87
|
+
if (f) return f.then((a) => ({ ...a, coalesced: !0 }));
|
|
88
|
+
const n = e.now ?? Date.now, s = t === "button" || t === "palette" || t === "shortcut";
|
|
89
|
+
if (!s && y() === "off")
|
|
90
|
+
return Promise.resolve({ queries: 0, loaders: 0, failed: 0, ms: 0, coalesced: !0 });
|
|
91
|
+
if (!s && m && n() - E < L)
|
|
92
|
+
return Promise.resolve({ ...m, coalesced: !0 });
|
|
93
|
+
const u = e.qc === void 0 ? p : e.qc;
|
|
94
|
+
i && clearTimeout(i), S({ phase: "running", at: n(), reason: t });
|
|
95
|
+
const o = q(u, t).catch(() => ({ queries: 0, loaders: 0, failed: 1, ms: 0 })).then((a) => {
|
|
96
|
+
var c;
|
|
97
|
+
return f = null, E = n(), m = a, S({ phase: a.failed > 0 ? "partial" : "done", at: n(), reason: t }), i = setTimeout(() => {
|
|
98
|
+
i = null, g.phase !== "running" && S({ phase: "idle", at: Date.now(), reason: t });
|
|
99
|
+
}, M), (c = i.unref) == null || c.call(i), a;
|
|
100
|
+
});
|
|
101
|
+
return f = o, o;
|
|
102
|
+
}
|
|
103
|
+
function P() {
|
|
104
|
+
return g;
|
|
105
|
+
}
|
|
106
|
+
function N(e) {
|
|
107
|
+
return R.add(e), () => {
|
|
108
|
+
R.delete(e);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function z() {
|
|
112
|
+
return _(N, P, P);
|
|
113
|
+
}
|
|
114
|
+
const x = ["refresh", "reload", "update", "data", "fresh", "stale"];
|
|
115
|
+
function J(e) {
|
|
116
|
+
const t = e.trim().toLowerCase();
|
|
117
|
+
return t.length < 2 ? !1 : t.split(/\s+/).every((s) => x.some((u) => u.startsWith(s)) || "this page".includes(s));
|
|
118
|
+
}
|
|
119
|
+
let d = 0;
|
|
120
|
+
const h = /* @__PURE__ */ new Set();
|
|
121
|
+
function K() {
|
|
122
|
+
d++;
|
|
123
|
+
for (const t of [...h]) t();
|
|
124
|
+
let e = !1;
|
|
125
|
+
return () => {
|
|
126
|
+
if (!e) {
|
|
127
|
+
e = !0, d = Math.max(0, d - 1);
|
|
128
|
+
for (const t of [...h]) t();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function F() {
|
|
133
|
+
return d > 0;
|
|
134
|
+
}
|
|
135
|
+
function I(e) {
|
|
136
|
+
return h.add(e), () => {
|
|
137
|
+
h.delete(e);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function V() {
|
|
141
|
+
return _(I, F, () => !1);
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
b as SCREEN_LOADER_TIMEOUT_MS,
|
|
145
|
+
M as SCREEN_REFRESH_DONE_MS,
|
|
146
|
+
L as SCREEN_REFRESH_MIN_GAP_MS,
|
|
147
|
+
F as pageRefreshButtonShown,
|
|
148
|
+
k as refreshScreenData,
|
|
149
|
+
K as registerPageRefreshButton,
|
|
150
|
+
B as registerScreenLoader,
|
|
151
|
+
v as screenRefreshAllowed,
|
|
152
|
+
G as screenRefreshClient,
|
|
153
|
+
J as screenRefreshMatches,
|
|
154
|
+
P as screenRefreshState,
|
|
155
|
+
j as setScreenRefreshClient,
|
|
156
|
+
N as subscribeScreenRefresh,
|
|
157
|
+
V as usePageRefreshButtonShown,
|
|
158
|
+
U as useScreenLoader,
|
|
159
|
+
z as useScreenRefreshState
|
|
160
|
+
};
|
|
@@ -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
|
+
};
|