@nivaro/react 0.3.114 → 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.
- 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 +1717 -21
- 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 +4088 -3592
- 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 +1 -0
- 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/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/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/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 +388 -321
- 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 +1855 -1771
- 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/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 +1927 -1635
- 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/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/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/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/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/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/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -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
|
@@ -1,66 +1,70 @@
|
|
|
1
1
|
function M(c) {
|
|
2
|
-
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = { gaps: 0, missed: 0, replayed: 0, refetched: 0 },
|
|
3
|
-
const e = o.get(
|
|
4
|
-
e && (e.timer && clearTimeout(e.timer), o.delete(
|
|
5
|
-
}, S = (
|
|
6
|
-
const e = o.get(
|
|
2
|
+
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = { gaps: 0, missed: 0, replayed: 0, refetched: 0 }, a = c.graceMs ?? 1500, g = (r) => {
|
|
3
|
+
const e = o.get(r);
|
|
4
|
+
e && (e.timer && clearTimeout(e.timer), o.delete(r));
|
|
5
|
+
}, S = (r) => {
|
|
6
|
+
const e = o.get(r);
|
|
7
7
|
if (e) {
|
|
8
8
|
if (e.timer = null, e.missing.size === 0) {
|
|
9
|
-
o.delete(
|
|
9
|
+
o.delete(r);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
e.asked = !0, c.request({ room:
|
|
12
|
+
e.asked = !0, c.request({ room: r, cursor: e.fromSeq, missed: e.missing.size });
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
return {
|
|
16
|
-
observe(
|
|
17
|
-
if (!
|
|
18
|
-
const e =
|
|
16
|
+
observe(r) {
|
|
17
|
+
if (!r || typeof r != "object") return;
|
|
18
|
+
const e = r;
|
|
19
19
|
if (typeof e._room != "string" || typeof e._rseq != "number") return;
|
|
20
|
-
const t = e._room,
|
|
21
|
-
if (!
|
|
22
|
-
n.set(t, { rseq:
|
|
20
|
+
const t = e._room, s = e._rseq, q = typeof e._rseq_min == "number" ? e._rseq_min : s, f = typeof e._seq == "number" ? e._seq : 0, u = n.get(t);
|
|
21
|
+
if (!u) {
|
|
22
|
+
n.set(t, { rseq: s, seq: f });
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const d = o.get(t);
|
|
26
|
-
if (d) for (let l =
|
|
27
|
-
if (d && d.missing.size === 0 && !d.asked && g(t),
|
|
28
|
-
|
|
26
|
+
if (d) for (let l = q; l <= s; l++) d.missing.delete(l);
|
|
27
|
+
if (d && d.missing.size === 0 && !d.asked && g(t), s <= u.rseq) {
|
|
28
|
+
s < u.rseq && q === 1 && n.set(t, { rseq: s, seq: f });
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
32
|
-
const l =
|
|
31
|
+
if (q > u.rseq + 1) {
|
|
32
|
+
const l = u.rseq + 1, h = q - 1, y = h - l + 1;
|
|
33
33
|
if (i.gaps++, i.missed += y, y > 200)
|
|
34
34
|
g(t), i.refetched++, c.refetch([t]);
|
|
35
35
|
else {
|
|
36
|
-
const
|
|
37
|
-
fromSeq:
|
|
38
|
-
toSeq:
|
|
36
|
+
const m = o.get(t) ?? {
|
|
37
|
+
fromSeq: u.seq,
|
|
38
|
+
toSeq: f,
|
|
39
39
|
missing: /* @__PURE__ */ new Set(),
|
|
40
40
|
timer: null,
|
|
41
41
|
asked: !1
|
|
42
42
|
};
|
|
43
|
-
for (let p = l; p <= h; p++)
|
|
44
|
-
|
|
43
|
+
for (let p = l; p <= h; p++) m.missing.add(p);
|
|
44
|
+
m.toSeq = Math.max(m.toSeq, f), o.set(t, m), !m.timer && !m.asked && (m.timer = setTimeout(() => S(t), a));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
n.set(t, { rseq:
|
|
47
|
+
n.set(t, { rseq: s, seq: Math.max(u.seq, f) });
|
|
48
48
|
},
|
|
49
|
-
replayed(
|
|
50
|
-
const e =
|
|
49
|
+
replayed(r) {
|
|
50
|
+
const e = r == null ? void 0 : r.room;
|
|
51
51
|
if (typeof e != "string") return;
|
|
52
52
|
const t = o.get(e);
|
|
53
53
|
if (g(e), !!t) {
|
|
54
|
-
if (
|
|
54
|
+
if (r.full) {
|
|
55
55
|
i.refetched++, c.refetch([e]);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
for (const
|
|
59
|
-
typeof (
|
|
58
|
+
for (const s of r.events ?? []) {
|
|
59
|
+
if (typeof (s == null ? void 0 : s.seq) != "number" || s.seq <= t.fromSeq || !(typeof s.rseq == "number" ? t.missing.has(s.rseq) : t.toSeq === 0 || s.seq < t.toSeq)) continue;
|
|
60
|
+
i.replayed++;
|
|
61
|
+
const f = typeof s.iseq == "number" ? { _iseq: s.iseq } : {};
|
|
62
|
+
c.dispatch(s.event, { ...s.payload, _seq: s.seq, ...f });
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
},
|
|
62
|
-
reset(
|
|
63
|
-
const e =
|
|
66
|
+
reset(r) {
|
|
67
|
+
const e = r ?? [.../* @__PURE__ */ new Set([...n.keys(), ...o.keys()])];
|
|
64
68
|
for (const t of e)
|
|
65
69
|
g(t), n.delete(t);
|
|
66
70
|
},
|
|
@@ -72,7 +76,7 @@ function M(c) {
|
|
|
72
76
|
function _(c) {
|
|
73
77
|
return { collection: c, item: null, items: null, many: !0, count: 0, coalesced: !0 };
|
|
74
78
|
}
|
|
75
|
-
function
|
|
79
|
+
function b(c) {
|
|
76
80
|
const n = [];
|
|
77
81
|
for (const o of c)
|
|
78
82
|
if (o.startsWith("collection:"))
|
|
@@ -81,10 +85,10 @@ function k(c) {
|
|
|
81
85
|
payload: _(o.slice(11))
|
|
82
86
|
});
|
|
83
87
|
else if (o.startsWith("record:")) {
|
|
84
|
-
const i = o.slice(7),
|
|
85
|
-
|
|
88
|
+
const i = o.slice(7), a = i.indexOf(":");
|
|
89
|
+
a > 0 && n.push({
|
|
86
90
|
event: "collection:update",
|
|
87
|
-
payload: { collection: i.slice(0,
|
|
91
|
+
payload: { collection: i.slice(0, a), item: i.slice(a + 1) }
|
|
88
92
|
});
|
|
89
93
|
} else o.startsWith("chat:") && n.push({ event: "chat:message", payload: { room: o.slice(5), touch: !0 } });
|
|
90
94
|
return n;
|
|
@@ -92,5 +96,5 @@ function k(c) {
|
|
|
92
96
|
export {
|
|
93
97
|
_ as coarseCollectionUpdate,
|
|
94
98
|
M as createRoomGapTracker,
|
|
95
|
-
|
|
99
|
+
b as refetchEventsFor
|
|
96
100
|
};
|
package/dist/shared/lib/rum.js
CHANGED
|
@@ -1,47 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
1
|
+
import { startMissedUpdateDetector as L } from "./missed-updates.js";
|
|
2
|
+
import { isSignedOut as k, isSignedOutError as A, noteUnauthorized as O } from "./signed-out.js";
|
|
3
|
+
import { startWriteToScreen as C } from "./write-to-screen.js";
|
|
4
|
+
const I = ["navigate", "reload", "back_forward", "prerender"];
|
|
5
|
+
function B(e) {
|
|
6
|
+
return I.includes(e) ? e : "navigate";
|
|
7
|
+
}
|
|
8
|
+
const N = 1e3;
|
|
9
|
+
function R(e, n) {
|
|
10
|
+
return n != null && e - n >= 0 && e - n < N ? "back_forward" : "navigate";
|
|
11
|
+
}
|
|
12
|
+
const T = "nvr-rum-last-route";
|
|
13
|
+
let y = null, S = null, w = !1, b, d = (e) => e;
|
|
14
|
+
const c = [];
|
|
15
|
+
let g = null, E = "/api", h, p = null, l = 0, v = null;
|
|
16
|
+
function $(e) {
|
|
6
17
|
const n = e.tagName.toLowerCase(), t = (e.textContent ?? "").trim().slice(0, 40), i = e.getAttribute("aria-label"), r = e.getAttribute("data-testid");
|
|
7
18
|
return `${n}${r ? `[${r}]` : ""}${i ? ` '${i}'` : t ? ` '${t}'` : ""}`;
|
|
8
19
|
}
|
|
9
|
-
function
|
|
20
|
+
function W(e) {
|
|
10
21
|
typeof window > "u" || window.addEventListener(
|
|
11
22
|
"click",
|
|
12
23
|
(n) => {
|
|
13
24
|
const t = n.target instanceof Element ? n.target.closest('button, a, [role="button"], input, [data-testid]') : null;
|
|
14
|
-
t && (t ===
|
|
25
|
+
t && (t === p ? (l++, l === 3 && (f({
|
|
15
26
|
kind: "rage",
|
|
16
|
-
route: `${e()} :: ${
|
|
17
|
-
duration_ms:
|
|
18
|
-
}),
|
|
19
|
-
|
|
27
|
+
route: `${e()} :: ${$(t)}`.slice(0, 300),
|
|
28
|
+
duration_ms: l
|
|
29
|
+
}), s())) : (p = t, l = 1), v && clearTimeout(v), v = setTimeout(() => {
|
|
30
|
+
p = null, l = 0;
|
|
20
31
|
}, 600));
|
|
21
32
|
},
|
|
22
33
|
{ capture: !0, passive: !0 }
|
|
23
34
|
);
|
|
24
35
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
36
|
+
const P = 1e3, x = 1e4, D = 3;
|
|
37
|
+
function K(e = D, n = x) {
|
|
27
38
|
let t = [];
|
|
28
39
|
return (i) => (t = t.filter((r) => i - r < n), t.push(i), t.length >= e ? (t = [], !0) : !1);
|
|
29
40
|
}
|
|
30
|
-
function
|
|
41
|
+
function U(e) {
|
|
31
42
|
if (typeof window > "u" || typeof MutationObserver > "u") return;
|
|
32
|
-
const n =
|
|
43
|
+
const n = K();
|
|
33
44
|
window.addEventListener(
|
|
34
45
|
"click",
|
|
35
46
|
(t) => {
|
|
36
47
|
const i = t.target instanceof Element ? t.target.closest('button, a[href], [role="button"]') : null;
|
|
37
48
|
if (!i || i.disabled || i.closest(".nvr-no-record")) return;
|
|
38
49
|
const r = window.location.href;
|
|
39
|
-
let
|
|
40
|
-
const
|
|
41
|
-
|
|
50
|
+
let a = !1;
|
|
51
|
+
const u = new MutationObserver(() => {
|
|
52
|
+
a = !0;
|
|
42
53
|
});
|
|
43
54
|
try {
|
|
44
|
-
|
|
55
|
+
u.observe(document.body, {
|
|
45
56
|
subtree: !0,
|
|
46
57
|
childList: !0,
|
|
47
58
|
attributes: !0,
|
|
@@ -51,55 +62,59 @@ function A(e) {
|
|
|
51
62
|
return;
|
|
52
63
|
}
|
|
53
64
|
setTimeout(() => {
|
|
54
|
-
|
|
65
|
+
u.disconnect(), !(a || window.location.href !== r) && n(Date.now()) && (f({
|
|
55
66
|
kind: "dead",
|
|
56
|
-
route: `${e()} :: ${
|
|
57
|
-
duration_ms:
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
67
|
+
route: `${e()} :: ${$(i)}`.slice(0, 300),
|
|
68
|
+
duration_ms: D
|
|
69
|
+
}), s());
|
|
70
|
+
}, P);
|
|
60
71
|
},
|
|
61
72
|
{ capture: !0, passive: !0 }
|
|
62
73
|
);
|
|
63
74
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
const n = f == null ? void 0 : f();
|
|
73
|
-
!n && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${v}/rum`, new Blob([e], { type: "application/json" })) || fetch(`${v}/rum`, {
|
|
74
|
-
method: "POST",
|
|
75
|
-
credentials: "include",
|
|
76
|
-
headers: {
|
|
77
|
-
"Content-Type": "application/json",
|
|
78
|
-
...n ? { Authorization: `Bearer ${n}` } : {}
|
|
79
|
-
},
|
|
80
|
-
body: e,
|
|
81
|
-
keepalive: !0
|
|
82
|
-
}).then(async (i) => {
|
|
83
|
-
if (i.status !== 401) return;
|
|
84
|
-
const r = await i.json().catch(() => null);
|
|
85
|
-
T({ status: 401, response: r }) && k(!1);
|
|
86
|
-
}).catch(() => {
|
|
87
|
-
});
|
|
88
|
-
} catch {
|
|
75
|
+
function s() {
|
|
76
|
+
if (c.length !== 0) {
|
|
77
|
+
if (k()) {
|
|
78
|
+
c.length = 0;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
_("/rum", { events: c.splice(0, c.length) });
|
|
89
82
|
}
|
|
90
83
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
84
|
+
function _(e, n) {
|
|
85
|
+
if (!k())
|
|
86
|
+
try {
|
|
87
|
+
const t = JSON.stringify(n), i = h == null ? void 0 : h();
|
|
88
|
+
!i && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(`${E}${e}`, new Blob([t], { type: "application/json" })) || fetch(`${E}${e}`, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
credentials: "include",
|
|
91
|
+
headers: {
|
|
92
|
+
"Content-Type": "application/json",
|
|
93
|
+
...i ? { Authorization: `Bearer ${i}` } : {}
|
|
94
|
+
},
|
|
95
|
+
body: t,
|
|
96
|
+
keepalive: !0
|
|
97
|
+
}).then(async (a) => {
|
|
98
|
+
if (a.status !== 401) return;
|
|
99
|
+
const u = await a.json().catch(() => null);
|
|
100
|
+
A({ status: 401, response: u }) && O(!1);
|
|
101
|
+
}).catch(() => {
|
|
102
|
+
});
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function f(e) {
|
|
107
|
+
c.push({
|
|
93
108
|
...e,
|
|
94
|
-
app:
|
|
109
|
+
app: b,
|
|
95
110
|
vw: typeof window > "u" ? void 0 : window.innerWidth
|
|
96
|
-
}),
|
|
111
|
+
}), c.length >= 10 ? s() : (g && clearTimeout(g), g = setTimeout(s, 1e4));
|
|
97
112
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
100
|
-
if (!
|
|
101
|
-
const n = e.roleId &&
|
|
102
|
-
|
|
113
|
+
const q = /^[A-Za-z0-9._:-]{1,80}$/, j = /^[0-9A-Fa-f-]{36}$/;
|
|
114
|
+
function Y(e) {
|
|
115
|
+
if (!w || !q.test(e.key)) return;
|
|
116
|
+
const n = e.roleId && j.test(e.roleId) ? e.roleId.toUpperCase() : void 0;
|
|
117
|
+
f({
|
|
103
118
|
kind: "widget",
|
|
104
119
|
route: `widget:${e.key}`,
|
|
105
120
|
widget: e.key,
|
|
@@ -108,53 +123,88 @@ function B(e) {
|
|
|
108
123
|
paint_ms: Math.max(0, Math.round(e.paintMs))
|
|
109
124
|
});
|
|
110
125
|
}
|
|
111
|
-
function
|
|
112
|
-
if (!
|
|
126
|
+
function G(e) {
|
|
127
|
+
if (!w || typeof window > "u" || document.visibilityState === "hidden") return;
|
|
113
128
|
const n = performance.now();
|
|
114
129
|
let t = !1;
|
|
115
130
|
const i = () => {
|
|
116
131
|
document.visibilityState === "hidden" && (t = !0);
|
|
117
132
|
};
|
|
118
|
-
document.addEventListener("visibilitychange", i)
|
|
133
|
+
document.addEventListener("visibilitychange", i);
|
|
134
|
+
const r = d(e), a = R(n, S), u = y;
|
|
135
|
+
y = r, requestAnimationFrame(() => {
|
|
119
136
|
requestAnimationFrame(() => {
|
|
120
137
|
if (document.removeEventListener("visibilitychange", i), t) return;
|
|
121
|
-
const
|
|
122
|
-
|
|
138
|
+
const o = Math.round(performance.now() - n);
|
|
139
|
+
f({
|
|
140
|
+
route: r,
|
|
141
|
+
kind: "route",
|
|
142
|
+
duration_ms: o,
|
|
143
|
+
nav: a,
|
|
144
|
+
...a === "back_forward" && u && u !== r ? { prev: u } : {}
|
|
145
|
+
});
|
|
123
146
|
});
|
|
124
147
|
});
|
|
125
148
|
}
|
|
126
|
-
function
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
function J(e) {
|
|
150
|
+
if (w || typeof window > "u" || typeof performance > "u") return;
|
|
151
|
+
w = !0, b = e == null ? void 0 : e.app, e != null && e.routePattern && (d = e.routePattern), e != null && e.apiBase && (E = e.apiBase), h = e == null ? void 0 : e.getToken, W(() => d(window.location.pathname)), U(() => d(window.location.pathname)), window.addEventListener("popstate", () => {
|
|
152
|
+
S = performance.now();
|
|
153
|
+
});
|
|
154
|
+
let n = null;
|
|
155
|
+
try {
|
|
156
|
+
n = sessionStorage.getItem(T);
|
|
157
|
+
} catch {
|
|
158
|
+
n = null;
|
|
159
|
+
}
|
|
160
|
+
y = d(window.location.pathname), L({
|
|
161
|
+
routePattern: (o) => d(o),
|
|
162
|
+
send: (o) => _("/realtime/missed-updates", o)
|
|
163
|
+
}), C({
|
|
164
|
+
screen: () => d(window.location.pathname),
|
|
165
|
+
send: (o) => _("/rum/screen-timing", { app: b, samples: o })
|
|
166
|
+
});
|
|
167
|
+
const t = performance.getEntriesByType("navigation")[0];
|
|
168
|
+
let i = null;
|
|
131
169
|
try {
|
|
132
|
-
new PerformanceObserver((
|
|
133
|
-
const
|
|
134
|
-
(
|
|
170
|
+
new PerformanceObserver((M) => {
|
|
171
|
+
const m = M.getEntries().at(-1);
|
|
172
|
+
(m == null ? void 0 : m.startTime) != null && (i = Math.round(m.startTime));
|
|
135
173
|
}).observe({ type: "largest-contentful-paint", buffered: !0 });
|
|
136
174
|
} catch {
|
|
137
175
|
}
|
|
176
|
+
const r = d(window.location.pathname), a = B(t == null ? void 0 : t.type);
|
|
138
177
|
setTimeout(() => {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
route:
|
|
178
|
+
const o = performance.getEntriesByName("first-contentful-paint")[0];
|
|
179
|
+
f({
|
|
180
|
+
route: r,
|
|
142
181
|
kind: "load",
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
182
|
+
nav: a,
|
|
183
|
+
...a === "back_forward" && n && n !== r ? { prev: n.slice(0, 300) } : {},
|
|
184
|
+
ttfb_ms: t ? Math.round(t.responseStart) : void 0,
|
|
185
|
+
fcp_ms: o ? Math.round(o.startTime) : void 0,
|
|
186
|
+
lcp_ms: i ?? void 0,
|
|
187
|
+
duration_ms: t ? Math.round(t.loadEventEnd || t.domContentLoadedEventEnd) : void 0
|
|
147
188
|
});
|
|
148
|
-
}, 6e3), window.addEventListener("pagehide",
|
|
149
|
-
|
|
189
|
+
}, 6e3), window.addEventListener("pagehide", () => {
|
|
190
|
+
try {
|
|
191
|
+
sessionStorage.setItem(T, d(window.location.pathname));
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
}), window.addEventListener("pagehide", s), document.addEventListener("visibilitychange", () => {
|
|
195
|
+
document.visibilityState === "hidden" && s();
|
|
150
196
|
});
|
|
151
197
|
}
|
|
152
198
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
B as
|
|
159
|
-
|
|
199
|
+
D as DEAD_BURST,
|
|
200
|
+
P as DEAD_WAIT_MS,
|
|
201
|
+
x as DEAD_WINDOW_MS,
|
|
202
|
+
N as POPSTATE_WINDOW_MS,
|
|
203
|
+
K as createDeadClickCounter,
|
|
204
|
+
B as navKindOf,
|
|
205
|
+
R as routeNavKind,
|
|
206
|
+
G as rumRouteChange,
|
|
207
|
+
Y as rumWidget,
|
|
208
|
+
_ as sendTelemetry,
|
|
209
|
+
J as startRum
|
|
160
210
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const c = 20;
|
|
2
|
+
function s() {
|
|
3
|
+
return `sv${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`}`.slice(0, 40);
|
|
4
|
+
}
|
|
5
|
+
function d(n, t) {
|
|
6
|
+
return t ? `${n}${n.includes("?") ? "&" : "?"}save_progress=${encodeURIComponent(t)}` : n;
|
|
7
|
+
}
|
|
8
|
+
const i = (n, t, r) => n === 1 ? t : r;
|
|
9
|
+
function l(n, t, r = { one: "line", many: "lines" }) {
|
|
10
|
+
const o = Math.max(0, Math.round((n == null ? void 0 : n.total) ?? t)), a = i(o, r.one, r.many);
|
|
11
|
+
if (!n || n.done == null) return `Saving ${o.toLocaleString()} ${a}…`;
|
|
12
|
+
const e = Math.min(o, Math.max(0, Math.round(n.done)));
|
|
13
|
+
return n.phase === "totals" || e >= o && !n.finished ? "Updating totals…" : `Saving ${e.toLocaleString()} of ${o.toLocaleString()} ${a}…`;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
c as SAVE_PROGRESS_MIN_ROWS,
|
|
17
|
+
s as newSaveId,
|
|
18
|
+
l as saveProgressText,
|
|
19
|
+
d as withSaveId
|
|
20
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { countdownText as s } from "./deadline-ticker.js";
|
|
2
|
+
const d = /* @__PURE__ */ new Set(["pending", "applying", "executed", "failed", "undone"]);
|
|
3
|
+
function m(r, n) {
|
|
4
|
+
const e = n ? new Set(n.map((t) => t.field)) : null, i = (t) => t ? new Date(t).getTime() : 0, u = (t) => t.status === "pending" || t.status === "applying";
|
|
5
|
+
return (r ?? []).filter((t) => d.has(t.status ?? "pending")).map((t) => ({
|
|
6
|
+
...t,
|
|
7
|
+
changes: Object.fromEntries(
|
|
8
|
+
Object.entries(t.changes ?? {}).filter(([o]) => !e || e.has(o))
|
|
9
|
+
)
|
|
10
|
+
})).filter((t) => Object.keys(t.changes ?? {}).length > 0).filter((t) => Number.isFinite(new Date(t.scheduled_at).getTime())).sort((t, o) => u(t) !== u(o) ? u(t) ? -1 : 1 : u(t) ? i(t.scheduled_at) - i(o.scheduled_at) : i(o.executed_at) - i(t.executed_at));
|
|
11
|
+
}
|
|
12
|
+
function h(r, n) {
|
|
13
|
+
for (const e of r) {
|
|
14
|
+
if (e.status === "applying") return { kind: "applying", row: e };
|
|
15
|
+
if ((e.status ?? "pending") === "pending")
|
|
16
|
+
return g(e.scheduled_at, n) ? { kind: e.auto_apply === !1 ? "waiting-admin" : "applying", row: e } : { kind: "pending", row: e };
|
|
17
|
+
}
|
|
18
|
+
for (const e of r) {
|
|
19
|
+
if (e.status === "executed") return { kind: "applied", row: e };
|
|
20
|
+
if (e.status === "failed") return { kind: "failed", row: e };
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function p(r, n, e) {
|
|
25
|
+
const i = Object.keys(r);
|
|
26
|
+
if (i.length === 0) return "A change";
|
|
27
|
+
const u = i[0];
|
|
28
|
+
if (i.length > 1) {
|
|
29
|
+
const o = i.length - 1;
|
|
30
|
+
return `${n(u)} and ${o} more field${o === 1 ? "" : "s"} change`;
|
|
31
|
+
}
|
|
32
|
+
const t = r[u];
|
|
33
|
+
return t == null || t === "" ? `${n(u)} is cleared` : `${n(u)} changes to ${e(u, t)}`;
|
|
34
|
+
}
|
|
35
|
+
const c = (r, n) => r.getFullYear() === n.getFullYear() && r.getMonth() === n.getMonth() && r.getDate() === n.getDate();
|
|
36
|
+
function w(r, n, e) {
|
|
37
|
+
const i = new Date(r), u = new Date(n), t = i.toLocaleTimeString(e, { hour: "numeric", minute: "2-digit" });
|
|
38
|
+
if (c(i, u)) return t;
|
|
39
|
+
const o = new Date(u);
|
|
40
|
+
if (o.setDate(u.getDate() + 1), c(i, o)) return `tomorrow ${t}`;
|
|
41
|
+
const a = (i.getTime() - n) / 864e5;
|
|
42
|
+
return a > 0 && a < 6 ? `${i.toLocaleDateString(e, { weekday: "short" })} ${t}` : `${i.toLocaleDateString(e, {
|
|
43
|
+
month: "short",
|
|
44
|
+
day: "numeric",
|
|
45
|
+
...i.getFullYear() !== u.getFullYear() ? { year: "numeric" } : {}
|
|
46
|
+
})}, ${t}`;
|
|
47
|
+
}
|
|
48
|
+
function $(r, n) {
|
|
49
|
+
const e = new Date(r).getTime();
|
|
50
|
+
return Number.isFinite(e) ? e > n ? `in ${s(e - n)}` : n - e < 6e4 ? "due now" : `due ${s(n - e)} ago` : "";
|
|
51
|
+
}
|
|
52
|
+
function g(r, n) {
|
|
53
|
+
const e = new Date(r).getTime();
|
|
54
|
+
return Number.isFinite(e) && e <= n;
|
|
55
|
+
}
|
|
56
|
+
function D(r, n, e) {
|
|
57
|
+
return `${r} at ${n}${e ? ` (scheduled by ${e})` : ""}`;
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
p as changeSentence,
|
|
61
|
+
h as chipOf,
|
|
62
|
+
$ as countdownPart,
|
|
63
|
+
D as fullSentence,
|
|
64
|
+
g as isDue,
|
|
65
|
+
m as readableRecent,
|
|
66
|
+
w as whenText
|
|
67
|
+
};
|
|
@@ -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
|
+
};
|