@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
package/dist/shared/lib/live.js
CHANGED
|
@@ -1,202 +1,228 @@
|
|
|
1
|
-
import { useContext as _, useRef as h, useEffect as
|
|
1
|
+
import { useContext as _, useRef as h, useEffect as A } from "react";
|
|
2
2
|
import { ItemEditAuthContext as j } from "../context.js";
|
|
3
|
-
import { releaseLiveOwner as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { releaseLiveOwner as x, deliverLive as T } from "./focus-mode.js";
|
|
4
|
+
import { liveEventQuiet as F } from "./live-preference.js";
|
|
5
|
+
import { getLiveMode as ne, liveMotionAllowed as re, useLiveBusy as oe, useLivePreference as ie } from "./live-preference.js";
|
|
6
|
+
import { isOwnWrite as M } from "./own-writes.js";
|
|
7
|
+
import { noteOwnWrite as se, noteOwnWriteFromCommand as le } from "./own-writes.js";
|
|
8
|
+
import { useOptionalRealtime as O } from "./realtime.js";
|
|
9
|
+
const S = "nvr:live-event";
|
|
10
|
+
function U(t, ...o) {
|
|
11
|
+
return t.changedFields === null ? !t.aspectsOnly : o.some((e) => {
|
|
12
|
+
var n;
|
|
13
|
+
return (n = t.changedFields) == null ? void 0 : n.includes(e);
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
|
-
const
|
|
16
|
+
const G = {
|
|
15
17
|
state: "$state",
|
|
16
18
|
addendums: "$addendums",
|
|
17
19
|
comments: "$comments",
|
|
18
20
|
tasks: "$tasks",
|
|
19
21
|
integrations: "$integrations",
|
|
22
|
+
owners: "$owners",
|
|
20
23
|
/** An edit lock was taken or released (list rows show the lock icon). */
|
|
21
|
-
lock: "$lock"
|
|
24
|
+
lock: "$lock",
|
|
25
|
+
/** The files the record carries changed: a file field or file link, a file renamed, replaced
|
|
26
|
+
* or deleted (Files panels and file fields refetch as the viewer). */
|
|
27
|
+
files: "$files",
|
|
28
|
+
/** The SLA clock crossed its warning / breach line with no write (server flip pass). */
|
|
29
|
+
sla: "$sla",
|
|
30
|
+
/** A child or linked record changed — a line, a PO made from it, an invoice matched to it
|
|
31
|
+
* (line grids, related lists and record widgets refetch; coalesced server-side, `'*'` when a
|
|
32
|
+
* burst named more records than the cap). */
|
|
33
|
+
related: "$related",
|
|
34
|
+
/** Someone started or stopped editing a list cell of the record in place (rt6 #15): lists
|
|
35
|
+
* with inline editing re-read who holds which cell. */
|
|
36
|
+
cells: "$cells",
|
|
37
|
+
/** A scheduled change on the record was made, moved, cancelled or applied (rt7 #12). */
|
|
38
|
+
scheduled: "$scheduled",
|
|
39
|
+
/** A banner-enabled threshold alert fired on the record (rt9 #20): banners re-read. */
|
|
40
|
+
alerts: "$alerts",
|
|
41
|
+
/** A support request raised from the record opened, moved or closed (rt9 #19). */
|
|
42
|
+
support: "$support"
|
|
22
43
|
};
|
|
23
|
-
function k(
|
|
44
|
+
function k(t) {
|
|
24
45
|
for (const o of ["by", "user", "user_id"]) {
|
|
25
|
-
const e =
|
|
46
|
+
const e = t[o];
|
|
26
47
|
if (typeof e == "string" && e) return e;
|
|
27
48
|
if (e && typeof e == "object" && typeof e.id == "string")
|
|
28
49
|
return e.id;
|
|
29
50
|
}
|
|
30
51
|
return null;
|
|
31
52
|
}
|
|
32
|
-
function N(
|
|
33
|
-
const e = k(
|
|
53
|
+
function N(t, o) {
|
|
54
|
+
const e = k(t);
|
|
34
55
|
if (e && o && e.toUpperCase() === o.toUpperCase()) return !0;
|
|
35
|
-
const
|
|
36
|
-
return
|
|
56
|
+
const n = typeof t.collection == "string" ? t.collection : "", r = Array.isArray(t.changed_fields) ? t.changed_fields : null;
|
|
57
|
+
return n !== "" && t.item != null && M(n, t.item, r);
|
|
37
58
|
}
|
|
38
|
-
function
|
|
39
|
-
if (!
|
|
40
|
-
const { coalesced: o, items: e, many:
|
|
41
|
-
return
|
|
59
|
+
function Q(t) {
|
|
60
|
+
if (!t.coalesced) return [t];
|
|
61
|
+
const { coalesced: o, items: e, many: n, count: r, ...i } = t;
|
|
62
|
+
return n || !Array.isArray(e) ? [{ ...i, item: "*", ...typeof r == "number" ? { bulk: r } : {} }] : e.map((c) => ({ ...i, item: c }));
|
|
42
63
|
}
|
|
43
|
-
function
|
|
44
|
-
const o = [...new Set(
|
|
45
|
-
let e = /* @__PURE__ */ new Set(),
|
|
46
|
-
for (const r of
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
e = null,
|
|
64
|
+
function W(t) {
|
|
65
|
+
const o = [...new Set(t.map((r) => String(r.item)))];
|
|
66
|
+
let e = /* @__PURE__ */ new Set(), n = t.length > 0;
|
|
67
|
+
for (const r of t) {
|
|
68
|
+
const i = r.changed_fields;
|
|
69
|
+
if (!i || i.length === 0) {
|
|
70
|
+
e = null, n = !1;
|
|
50
71
|
continue;
|
|
51
72
|
}
|
|
52
|
-
if (
|
|
73
|
+
if (i.every((c) => c.startsWith("$")) || (n = !1), e) for (const c of i) e.add(c);
|
|
53
74
|
}
|
|
54
|
-
return
|
|
55
|
-
events:
|
|
75
|
+
return t.some((r) => r.action === "create" || r.action === "delete") && (n = !1), {
|
|
76
|
+
events: t,
|
|
56
77
|
ids: o,
|
|
57
78
|
changedFields: e ? [...e] : null,
|
|
58
|
-
aspectsOnly:
|
|
59
|
-
deleted:
|
|
60
|
-
created:
|
|
61
|
-
own:
|
|
79
|
+
aspectsOnly: n,
|
|
80
|
+
deleted: t.some((r) => r.action === "delete"),
|
|
81
|
+
created: t.some((r) => r.action === "create"),
|
|
82
|
+
own: t.length > 0 && t.every((r) => r.own)
|
|
62
83
|
};
|
|
63
84
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const f = h({}), p = (
|
|
72
|
-
|
|
73
|
-
if (!
|
|
85
|
+
function V(t, o, e = {}) {
|
|
86
|
+
const n = O(), { userId: r } = _(j), i = h(o);
|
|
87
|
+
i.current = o;
|
|
88
|
+
const c = h(e);
|
|
89
|
+
c.current = e;
|
|
90
|
+
const l = h(r);
|
|
91
|
+
l.current = r;
|
|
92
|
+
const f = h({}), p = (t == null ? [] : Array.isArray(t) ? t : [t]).filter(Boolean).join(","), w = e.enabled !== !1;
|
|
93
|
+
A(() => {
|
|
94
|
+
if (!n || !p || !w) return;
|
|
74
95
|
const g = p.split(",");
|
|
75
96
|
let a = [], y = null;
|
|
76
|
-
const
|
|
97
|
+
const R = () => {
|
|
77
98
|
y = null;
|
|
78
|
-
const
|
|
79
|
-
a = [],
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
83
|
-
const d =
|
|
84
|
-
for (const
|
|
85
|
-
const
|
|
86
|
-
|
|
99
|
+
const s = a;
|
|
100
|
+
a = [], s.length !== 0 && (c.current.focusable ? T(f.current, s, (u) => i.current(W(u))) : i.current(W(s)));
|
|
101
|
+
}, v = n.subscribeCollections(g, (s) => {
|
|
102
|
+
const u = s;
|
|
103
|
+
if (!u || !g.includes(String(u.collection))) return;
|
|
104
|
+
const d = c.current;
|
|
105
|
+
for (const L of Q(u)) {
|
|
106
|
+
const $ = { ...L, own: N(L, l.current) };
|
|
107
|
+
$.own && !d.includeOwn || d.match && !d.match($) || a.push($);
|
|
87
108
|
}
|
|
88
109
|
if (a.length === 0) return;
|
|
89
110
|
const m = d.debounceMs ?? 250;
|
|
90
|
-
m <= 0 ?
|
|
111
|
+
m <= 0 ? R() : y || (y = setTimeout(R, m));
|
|
91
112
|
});
|
|
92
113
|
return () => {
|
|
93
|
-
|
|
114
|
+
v(), y && clearTimeout(y), x(f.current);
|
|
94
115
|
};
|
|
95
|
-
}, [
|
|
116
|
+
}, [n, p, w]);
|
|
96
117
|
}
|
|
97
|
-
function
|
|
98
|
-
const r = o == null || o === "new" ? null : String(o),
|
|
99
|
-
|
|
100
|
-
...
|
|
101
|
-
match: (
|
|
118
|
+
function q(t, o, e, n = {}) {
|
|
119
|
+
const r = o == null || o === "new" ? null : String(o), i = n.match;
|
|
120
|
+
V(t && r ? t : null, e, {
|
|
121
|
+
...n,
|
|
122
|
+
match: (c) => (String(c.item) === r || c.item === "*") && (!i || i(c))
|
|
102
123
|
});
|
|
103
124
|
}
|
|
104
|
-
function
|
|
125
|
+
function H(t, o, e, n = {}) {
|
|
105
126
|
const r = h(e);
|
|
106
127
|
r.current = e;
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
128
|
+
const i = h(n.client);
|
|
129
|
+
i.current = n.client, q(
|
|
130
|
+
t,
|
|
110
131
|
o,
|
|
111
|
-
(
|
|
132
|
+
(c) => {
|
|
112
133
|
var f;
|
|
113
|
-
const
|
|
114
|
-
if (!(
|
|
115
|
-
for (const
|
|
134
|
+
const l = n.aspects;
|
|
135
|
+
if (!(l && l.length > 0 && c.changedFields !== null && !U(c, ...l)))
|
|
136
|
+
for (const b of r.current) (f = i.current) == null || f.invalidateQueries({ queryKey: b });
|
|
116
137
|
},
|
|
117
|
-
|
|
138
|
+
n
|
|
118
139
|
);
|
|
119
140
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const f = (Array.isArray(
|
|
128
|
-
|
|
129
|
-
if (!
|
|
141
|
+
function B(t, o, e = {}) {
|
|
142
|
+
const n = O(), { userId: r } = _(j), i = h(o);
|
|
143
|
+
i.current = o;
|
|
144
|
+
const c = h(e);
|
|
145
|
+
c.current = e;
|
|
146
|
+
const l = h(r);
|
|
147
|
+
l.current = r;
|
|
148
|
+
const f = (Array.isArray(t) ? t : [t]).join(","), b = e.enabled !== !1;
|
|
149
|
+
A(() => {
|
|
150
|
+
if (!b || !f) return;
|
|
130
151
|
const p = f.split(",");
|
|
131
152
|
let w = null, g = null, a = null;
|
|
132
|
-
const y = (
|
|
133
|
-
if (!p.includes(
|
|
134
|
-
const d =
|
|
153
|
+
const y = (s, u) => {
|
|
154
|
+
if (!p.includes(s) || F(s)) return;
|
|
155
|
+
const d = c.current, m = u ?? {};
|
|
135
156
|
if (!d.includeOwn && typeof m == "object") {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
157
|
+
const C = k(m);
|
|
158
|
+
if (C && l.current && C.toUpperCase() === l.current.toUpperCase())
|
|
138
159
|
return;
|
|
139
160
|
}
|
|
140
161
|
if (d.match && !d.match(m)) return;
|
|
141
|
-
let
|
|
162
|
+
let L = s;
|
|
142
163
|
try {
|
|
143
|
-
|
|
164
|
+
L = `${s}|${JSON.stringify(m)}`;
|
|
144
165
|
} catch {
|
|
145
166
|
}
|
|
146
|
-
const
|
|
147
|
-
if (w && w.sig ===
|
|
148
|
-
w = { sig:
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
|
|
167
|
+
const $ = Date.now();
|
|
168
|
+
if (w && w.sig === L && $ - w.at < 150) return;
|
|
169
|
+
w = { sig: L, at: $ };
|
|
170
|
+
const E = d.debounceMs ?? 0;
|
|
171
|
+
if (E <= 0) {
|
|
172
|
+
i.current(m, s);
|
|
152
173
|
return;
|
|
153
174
|
}
|
|
154
|
-
a = { payload: m, event:
|
|
155
|
-
g = null, a &&
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
})),
|
|
159
|
-
const
|
|
160
|
-
|
|
175
|
+
a = { payload: m, event: s }, g || (g = setTimeout(() => {
|
|
176
|
+
g = null, a && i.current(a.payload, a.event), a = null;
|
|
177
|
+
}, E));
|
|
178
|
+
}, R = p.map((s) => (n == null ? void 0 : n.on(s, (u) => y(s, u))) ?? (() => {
|
|
179
|
+
})), v = (s) => {
|
|
180
|
+
const u = s.detail;
|
|
181
|
+
u != null && u.event && y(u.event, u.payload);
|
|
161
182
|
};
|
|
162
|
-
return window.addEventListener(
|
|
163
|
-
for (const
|
|
164
|
-
window.removeEventListener(
|
|
183
|
+
return window.addEventListener(S, v), () => {
|
|
184
|
+
for (const s of R) s();
|
|
185
|
+
window.removeEventListener(S, v), g && clearTimeout(g);
|
|
165
186
|
};
|
|
166
|
-
}, [
|
|
187
|
+
}, [n, f, b]);
|
|
167
188
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
|
|
189
|
+
function X(t, o, e, n, r = {}) {
|
|
190
|
+
const i = e == null || e === "new" ? null : String(e), c = r.match;
|
|
191
|
+
B(t, n, {
|
|
171
192
|
...r,
|
|
172
|
-
enabled: r.enabled !== !1 && !!o && !!
|
|
173
|
-
match: (
|
|
193
|
+
enabled: r.enabled !== !1 && !!o && !!i,
|
|
194
|
+
match: (l) => (l == null ? void 0 : l.collection) === o && String(l == null ? void 0 : l.item) === i && (!c || c(l))
|
|
174
195
|
});
|
|
175
196
|
}
|
|
176
|
-
function
|
|
177
|
-
const e =
|
|
178
|
-
return
|
|
197
|
+
function Y(t, o = !0) {
|
|
198
|
+
const e = O(), n = !!(e != null && e.joinWatch);
|
|
199
|
+
return A(() => {
|
|
179
200
|
if (!(!o || !(e != null && e.joinWatch)))
|
|
180
|
-
return e.joinWatch(
|
|
181
|
-
}, [e,
|
|
201
|
+
return e.joinWatch(t);
|
|
202
|
+
}, [e, t, o]), n && o;
|
|
182
203
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
204
|
+
function Z() {
|
|
205
|
+
return O() != null;
|
|
185
206
|
}
|
|
186
207
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
G as LIVE_ASPECTS,
|
|
209
|
+
S as LIVE_WINDOW_EVENT,
|
|
189
210
|
U as batchTouches,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
Q as expandCoalesced,
|
|
212
|
+
ne as getLiveMode,
|
|
213
|
+
N as isOwnEvent,
|
|
214
|
+
M as isOwnWrite,
|
|
215
|
+
re as liveMotionAllowed,
|
|
216
|
+
se as noteOwnWrite,
|
|
217
|
+
le as noteOwnWriteFromCommand,
|
|
218
|
+
W as toLiveBatch,
|
|
219
|
+
Z as useLiveAvailable,
|
|
220
|
+
oe as useLiveBusy,
|
|
221
|
+
V as useLiveCollection,
|
|
222
|
+
B as useLiveEvent,
|
|
223
|
+
ie as useLivePreference,
|
|
224
|
+
q as useLiveRecord,
|
|
225
|
+
X as useLiveRecordEvent,
|
|
226
|
+
H as useLiveRecordQueries,
|
|
227
|
+
Y as useLiveWatchRoom
|
|
202
228
|
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { useRef as D, useEffect as T } from "react";
|
|
2
|
+
import { lastLiveSeen as P } from "./live-seen.js";
|
|
3
|
+
const p = "nvr-missed-snapshot", N = 200, b = 40, k = 2 * 6e4, v = 5e3, x = 15e3, C = 12, H = 20;
|
|
4
|
+
function M(t) {
|
|
5
|
+
let o = 2166136261;
|
|
6
|
+
for (let e = 0; e < t.length; e++)
|
|
7
|
+
o ^= t.charCodeAt(e), o = Math.imul(o, 16777619);
|
|
8
|
+
return (o >>> 0).toString(16).padStart(8, "0");
|
|
9
|
+
}
|
|
10
|
+
function g(t, o = 0) {
|
|
11
|
+
if (t == null) return null;
|
|
12
|
+
if (typeof t == "number" || typeof t == "boolean" || typeof t == "string") return t;
|
|
13
|
+
if (t instanceof Date) return t.toISOString();
|
|
14
|
+
if (Array.isArray(t)) return o > 2 ? `[${t.length}]` : t.map((e) => g(e, o + 1));
|
|
15
|
+
if (typeof t == "object") {
|
|
16
|
+
const e = t;
|
|
17
|
+
if ("id" in e && (typeof e.id == "string" || typeof e.id == "number")) return `#${e.id}`;
|
|
18
|
+
if (o > 2) return "{…}";
|
|
19
|
+
const s = {};
|
|
20
|
+
for (const r of Object.keys(e).sort()) s[r] = g(e[r], o + 1);
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
return String(t);
|
|
24
|
+
}
|
|
25
|
+
function I(t) {
|
|
26
|
+
return M(t === "" || t === void 0 || t === null ? "∅" : JSON.stringify(g(t)).slice(0, 8e3));
|
|
27
|
+
}
|
|
28
|
+
function J(t) {
|
|
29
|
+
return (t.fields ?? Object.keys(t.values ?? {})).filter((e) => e !== "id" && !e.startsWith("$")).slice(0, b);
|
|
30
|
+
}
|
|
31
|
+
function L(t, o, e, s = (r, a) => P(r, a)) {
|
|
32
|
+
var a;
|
|
33
|
+
const r = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const n of o) {
|
|
35
|
+
if (!(n != null && n.collection) || n.id == null || !n.values) continue;
|
|
36
|
+
const f = String(n.id), i = `${n.collection}\0${f}`, d = ((a = r.get(i)) == null ? void 0 : a.h) ?? {};
|
|
37
|
+
for (const h of J(n)) d[h] = I(n.values[h]);
|
|
38
|
+
const u = r.get(i);
|
|
39
|
+
if (r.set(i, {
|
|
40
|
+
c: n.collection,
|
|
41
|
+
id: f,
|
|
42
|
+
l: Math.max((u == null ? void 0 : u.l) ?? 0, Number(n.loadedAt) || 0),
|
|
43
|
+
s: s(n.collection, f),
|
|
44
|
+
h: d
|
|
45
|
+
}), r.size >= N) break;
|
|
46
|
+
}
|
|
47
|
+
return { v: 1, path: t, at: e, records: [...r.values()] };
|
|
48
|
+
}
|
|
49
|
+
function j(t, o, e) {
|
|
50
|
+
if (!t) return null;
|
|
51
|
+
try {
|
|
52
|
+
const s = JSON.parse(t);
|
|
53
|
+
return (s == null ? void 0 : s.v) !== 1 || s.path !== o || typeof s.at != "number" || e - s.at > k || e < s.at - 5e3 ? null : Array.isArray(s.records) ? s : null;
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function B(t, o) {
|
|
59
|
+
const e = new Map(t.records.map((n) => [`${n.c}\0${n.id}`, n])), s = /* @__PURE__ */ new Set(), r = [];
|
|
60
|
+
let a = 0;
|
|
61
|
+
for (const n of o) {
|
|
62
|
+
if (!(n != null && n.values)) continue;
|
|
63
|
+
const f = `${n.collection}\0${String(n.id)}`, i = e.get(f);
|
|
64
|
+
if (!i || s.has(f) || (s.add(f), a++, i.s != null && i.s >= i.l) || !(i.l > 0) || t.at - i.l < v) continue;
|
|
65
|
+
const d = [];
|
|
66
|
+
for (const [u, h] of Object.entries(i.h))
|
|
67
|
+
u in n.values && I(n.values[u]) !== h && d.push(u);
|
|
68
|
+
d.length !== 0 && r.push({
|
|
69
|
+
collection: n.collection,
|
|
70
|
+
id: String(n.id),
|
|
71
|
+
fields: d.slice(0, b),
|
|
72
|
+
gap_s: Math.max(0, Math.round((t.at - i.l) / 1e3))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return { compared: a, missed: r };
|
|
76
|
+
}
|
|
77
|
+
function X(t) {
|
|
78
|
+
return (t == null ? void 0 : t.type) === "reload";
|
|
79
|
+
}
|
|
80
|
+
function F(t, o, e = C) {
|
|
81
|
+
return t.filter((s) => o - s < 36e5).length < e;
|
|
82
|
+
}
|
|
83
|
+
const y = /* @__PURE__ */ new Map();
|
|
84
|
+
let G = 1;
|
|
85
|
+
function K(t) {
|
|
86
|
+
const o = G++;
|
|
87
|
+
return y.set(o, t), () => {
|
|
88
|
+
y.delete(o);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function O() {
|
|
92
|
+
const t = [];
|
|
93
|
+
for (const o of y.values())
|
|
94
|
+
try {
|
|
95
|
+
for (const e of o())
|
|
96
|
+
if (t.push(e), t.length >= N * 2) return t;
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
function Y(t) {
|
|
102
|
+
const o = D(t);
|
|
103
|
+
o.current = t, T(
|
|
104
|
+
() => K(() => {
|
|
105
|
+
const e = o.current;
|
|
106
|
+
return (typeof e == "function" ? e() : e) ?? [];
|
|
107
|
+
}),
|
|
108
|
+
[]
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const E = "nvr-missed-beacons";
|
|
112
|
+
let $ = !1;
|
|
113
|
+
function V(t) {
|
|
114
|
+
var A, _;
|
|
115
|
+
if ($ || typeof window > "u" || typeof sessionStorage > "u") return;
|
|
116
|
+
$ = !0;
|
|
117
|
+
const o = () => `${window.location.pathname}${window.location.search}`, e = Date.now();
|
|
118
|
+
window.addEventListener("pagehide", () => {
|
|
119
|
+
try {
|
|
120
|
+
const c = O();
|
|
121
|
+
if (c.length === 0) {
|
|
122
|
+
sessionStorage.removeItem(p);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
sessionStorage.setItem(
|
|
126
|
+
p,
|
|
127
|
+
JSON.stringify(L(o(), c, Date.now()))
|
|
128
|
+
);
|
|
129
|
+
} catch {
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
let s = null;
|
|
133
|
+
try {
|
|
134
|
+
const c = (_ = (A = performance.getEntriesByType) == null ? void 0 : A.call(performance, "navigation")) == null ? void 0 : _[0], S = sessionStorage.getItem(p);
|
|
135
|
+
sessionStorage.removeItem(p), X(c) && (s = j(S, o(), e));
|
|
136
|
+
} catch {
|
|
137
|
+
s = null;
|
|
138
|
+
}
|
|
139
|
+
if (!s || s.records.length === 0) return;
|
|
140
|
+
const r = s, a = { compared: 0, missed: [] }, n = /* @__PURE__ */ new Set(), f = new Set(r.records.map((c) => `${c.c}\0${c.id}`));
|
|
141
|
+
let i = !1;
|
|
142
|
+
const d = () => {
|
|
143
|
+
if (!i && (i = !0, a.compared !== 0)) {
|
|
144
|
+
try {
|
|
145
|
+
const c = Date.now(), S = JSON.parse(sessionStorage.getItem(E) ?? "[]"), l = Array.isArray(S) ? S.filter((R) => c - R < 36e5) : [];
|
|
146
|
+
if (!F(l, c)) return;
|
|
147
|
+
sessionStorage.setItem(E, JSON.stringify([...l, c]));
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
t.send({
|
|
151
|
+
route: t.routePattern(window.location.pathname).slice(0, 300),
|
|
152
|
+
reload_s: Math.max(0, Math.round((e - r.at) / 1e3)),
|
|
153
|
+
went_ago_s: Math.max(0, Math.round((Date.now() - r.at) / 1e3)),
|
|
154
|
+
compared: a.compared,
|
|
155
|
+
missed: a.missed.slice(0, H)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}, u = () => {
|
|
159
|
+
const c = O().filter(
|
|
160
|
+
(l) => l.loadedAt >= e && !n.has(`${l.collection}\0${String(l.id)}`)
|
|
161
|
+
), S = B(r, c);
|
|
162
|
+
for (const l of c) n.add(`${l.collection}\0${String(l.id)}`);
|
|
163
|
+
return a.compared += S.compared, a.missed.push(...S.missed), [...f].every((l) => n.has(l));
|
|
164
|
+
}, h = [1500, 3e3, 6e3, 1e4, x];
|
|
165
|
+
let m = 0;
|
|
166
|
+
const w = () => {
|
|
167
|
+
if (i) return;
|
|
168
|
+
if (u() || m >= h.length - 1) {
|
|
169
|
+
d();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
m++, setTimeout(w, h[m] - h[m - 1]);
|
|
173
|
+
};
|
|
174
|
+
setTimeout(w, h[0]), window.addEventListener("pagehide", () => {
|
|
175
|
+
i || (u(), d());
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
export {
|
|
179
|
+
C as BEACONS_PER_HOUR,
|
|
180
|
+
x as COMPARE_FOR_MS,
|
|
181
|
+
v as IN_FLIGHT_MS,
|
|
182
|
+
H as MAX_MISSED_PER_BEACON,
|
|
183
|
+
b as MAX_SNAPSHOT_FIELDS,
|
|
184
|
+
N as MAX_SNAPSHOT_RECORDS,
|
|
185
|
+
p as SNAPSHOT_KEY,
|
|
186
|
+
k as SNAPSHOT_MAX_AGE_MS,
|
|
187
|
+
F as beaconAllowed,
|
|
188
|
+
L as buildSnapshot,
|
|
189
|
+
B as compareSnapshot,
|
|
190
|
+
M as fnv1a,
|
|
191
|
+
I as hashValue,
|
|
192
|
+
X as isReloadNavigation,
|
|
193
|
+
K as registerShownRecords,
|
|
194
|
+
O as shownRecords,
|
|
195
|
+
V as startMissedUpdateDetector,
|
|
196
|
+
j as usableSnapshot,
|
|
197
|
+
Y as useShownRecords
|
|
198
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useState as p, useRef as w, useCallback as v, useEffect as g } from "react";
|
|
2
|
+
import { useOptionalNivaroClient as S } from "../context.js";
|
|
3
|
+
import { get as $ } from "./commands.js";
|
|
4
|
+
import { useLiveRecord as h, LIVE_ASPECTS as C } from "./live.js";
|
|
5
|
+
function _(e, n) {
|
|
6
|
+
if (!e) return { kind: "none" };
|
|
7
|
+
if (!n) return { kind: "gone" };
|
|
8
|
+
const t = (o) => o.filename_download || o.title || "", s = t(n) !== t(e) && t(n) || null, l = (o) => `${o.modified_on ?? ""}|${o.filesize ?? ""}|${o.type ?? ""}`, c = l(n) !== l(e) && !R(e, n);
|
|
9
|
+
return !s && !c ? { kind: "none" } : { kind: "newer", renamed: s, replaced: c, meta: n };
|
|
10
|
+
}
|
|
11
|
+
function R(e, n) {
|
|
12
|
+
const t = (s) => s.filename_download || s.title || "";
|
|
13
|
+
return t(e) !== t(n) && String(e.filesize ?? "") === String(n.filesize ?? "") && e.type === n.type;
|
|
14
|
+
}
|
|
15
|
+
function E(e, n) {
|
|
16
|
+
const t = (n == null ? void 0 : n.modified_on) || (n == null ? void 0 : n.uploaded_on);
|
|
17
|
+
return t ? `${e}${e.includes("?") ? "&" : "?"}v=${encodeURIComponent(String(t))}` : e;
|
|
18
|
+
}
|
|
19
|
+
function U(e, n) {
|
|
20
|
+
const t = S(), [s, l] = p(null), [c, o] = p(null), [d, f] = p({ kind: "none" }), a = w(null);
|
|
21
|
+
a.current = s;
|
|
22
|
+
const r = v(
|
|
23
|
+
() => e && t ? t.request($(`/files/${encodeURIComponent(e)}/meta`)).then((i) => i.data ?? null).catch((i) => {
|
|
24
|
+
var m;
|
|
25
|
+
const u = (i == null ? void 0 : i.status) ?? ((m = i == null ? void 0 : i.response) == null ? void 0 : m.status);
|
|
26
|
+
return u === 404 || u === 403 ? null : void 0;
|
|
27
|
+
}) : Promise.resolve(void 0),
|
|
28
|
+
[t, e]
|
|
29
|
+
);
|
|
30
|
+
g(() => {
|
|
31
|
+
let i = !1;
|
|
32
|
+
return f({ kind: "none" }), l(null), o(null), r().then((u) => {
|
|
33
|
+
!i && u && l(u);
|
|
34
|
+
}), () => {
|
|
35
|
+
i = !0;
|
|
36
|
+
};
|
|
37
|
+
}, [r]), h(
|
|
38
|
+
n == null ? void 0 : n.collection,
|
|
39
|
+
(n == null ? void 0 : n.itemId) ?? null,
|
|
40
|
+
(i) => {
|
|
41
|
+
i.changedFields && !i.changedFields.includes(C.files) || r().then((u) => {
|
|
42
|
+
u !== void 0 && f(_(a.current, u));
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
{ enabled: !!e && !!n && !!t, debounceMs: 1e3 }
|
|
46
|
+
);
|
|
47
|
+
const k = v(() => {
|
|
48
|
+
d.kind === "newer" && (l(d.meta), o(d.meta), f({ kind: "none" }));
|
|
49
|
+
}, [d]);
|
|
50
|
+
return { current: c, newer: d, showNewer: k };
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
_ as compareFileMeta,
|
|
54
|
+
U as useNewerFile,
|
|
55
|
+
E as versionedUrl
|
|
56
|
+
};
|