@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,73 +1,95 @@
|
|
|
1
|
-
import { normalizeRecordConditions as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
if (!e || typeof e != "object") return
|
|
5
|
-
const t = e,
|
|
1
|
+
import { normalizeRecordConditions as d, recordMatchesAll as c } from "./record-conditions.js";
|
|
2
|
+
const m = "__none__", f = { default: "edit", rules: [] };
|
|
3
|
+
function y(e) {
|
|
4
|
+
if (!e || typeof e != "object") return f;
|
|
5
|
+
const t = e, r = t.default === "summary" ? "summary" : "edit", o = [];
|
|
6
6
|
if (Array.isArray(t.rules))
|
|
7
|
-
for (const
|
|
8
|
-
if (!
|
|
9
|
-
const s =
|
|
10
|
-
|
|
7
|
+
for (const n of t.rules) {
|
|
8
|
+
if (!n || typeof n != "object") continue;
|
|
9
|
+
const s = n;
|
|
10
|
+
o.push({
|
|
11
11
|
roles: Array.isArray(s.roles) ? s.roles.map(String) : null,
|
|
12
12
|
states: Array.isArray(s.states) ? s.states.map(String) : null,
|
|
13
13
|
states_op: s.states_op === "not_in" ? "not_in" : "in",
|
|
14
|
-
conditions:
|
|
14
|
+
conditions: d(s.conditions),
|
|
15
15
|
mode: s.mode === "summary" ? "summary" : "edit"
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
default: r,
|
|
20
|
+
rules: o,
|
|
21
|
+
...t.edit_lock ? { edit_lock: t.edit_lock } : {},
|
|
22
|
+
...t.change_proposals === !0 ? { change_proposals: !0 } : {},
|
|
23
|
+
...t.line_locks === !0 ? { line_locks: !0 } : {},
|
|
24
|
+
...t.changed_after_approval === !1 ? { changed_after_approval: !1 } : u(t.changed_after_approval) ? { changed_after_approval: { states: u(t.changed_after_approval) ?? [] } } : {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function u(e) {
|
|
28
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
29
|
+
const t = e.states, r = Array.isArray(t) ? t.filter((o) => typeof o == "string") : [];
|
|
30
|
+
return r.length > 0 ? r : null;
|
|
31
|
+
}
|
|
32
|
+
function h(e) {
|
|
33
|
+
var o, n;
|
|
34
|
+
if (!e) return null;
|
|
35
|
+
const t = e.changed_after_approval;
|
|
36
|
+
if (t === !1) return null;
|
|
37
|
+
if (t && t.states.length > 0) return t.states;
|
|
38
|
+
const r = ((n = (o = e.edit_lock) == null ? void 0 : o.admin_only) == null ? void 0 : n.states) ?? [];
|
|
39
|
+
return r.length > 0 ? r : null;
|
|
19
40
|
}
|
|
20
41
|
const S = (e) => !!(e != null && e.rules.some((t) => {
|
|
21
|
-
var
|
|
22
|
-
return (((
|
|
23
|
-
})),
|
|
24
|
-
var
|
|
25
|
-
return (((
|
|
42
|
+
var r;
|
|
43
|
+
return (((r = t.roles) == null ? void 0 : r.length) ?? 0) > 0;
|
|
44
|
+
})), A = (e) => !!(e != null && e.rules.some((t) => {
|
|
45
|
+
var r;
|
|
46
|
+
return (((r = t.states) == null ? void 0 : r.length) ?? 0) > 0;
|
|
26
47
|
})), R = (e) => !!(e != null && e.rules.some((t) => {
|
|
27
|
-
var o;
|
|
28
|
-
return (((o = t.conditions) == null ? void 0 : o.length) ?? 0) > 0;
|
|
29
|
-
}));
|
|
30
|
-
function A(e, t) {
|
|
31
48
|
var r;
|
|
49
|
+
return (((r = t.conditions) == null ? void 0 : r.length) ?? 0) > 0;
|
|
50
|
+
}));
|
|
51
|
+
function v(e, t) {
|
|
52
|
+
var n;
|
|
32
53
|
if (t.isNew || !e) return "edit";
|
|
33
|
-
const
|
|
54
|
+
const r = t.role ? t.role.toLowerCase() : null, o = t.stateKey ?? m;
|
|
34
55
|
for (const s of e.rules) {
|
|
35
56
|
const l = s.roles ?? [];
|
|
36
|
-
if (l.length > 0 && (!
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
if (!(s.states_op === "not_in" ? !
|
|
57
|
+
if (l.length > 0 && (!r || !l.some((a) => a.toLowerCase() === r))) continue;
|
|
58
|
+
const i = s.states ?? [];
|
|
59
|
+
if (i.length > 0) {
|
|
60
|
+
const a = i.includes(o);
|
|
61
|
+
if (!(s.states_op === "not_in" ? !a : a)) continue;
|
|
41
62
|
}
|
|
42
|
-
if (!((((
|
|
63
|
+
if (!((((n = s.conditions) == null ? void 0 : n.length) ?? 0) > 0 && (!t.record || !c(t.record, s.conditions))))
|
|
43
64
|
return s.mode;
|
|
44
65
|
}
|
|
45
66
|
return e.default;
|
|
46
67
|
}
|
|
47
|
-
function
|
|
48
|
-
return JSON.stringify([e, t ?? null,
|
|
68
|
+
function k(e, t, r) {
|
|
69
|
+
return JSON.stringify([e, t ?? null, r ? r.toLowerCase() : null]);
|
|
49
70
|
}
|
|
50
71
|
function N(e, t) {
|
|
51
72
|
if (!e) return !1;
|
|
52
73
|
try {
|
|
53
|
-
const
|
|
54
|
-
return Array.isArray(
|
|
74
|
+
const r = JSON.parse(e);
|
|
75
|
+
return Array.isArray(r) && r[0] === t;
|
|
55
76
|
} catch {
|
|
56
77
|
return !1;
|
|
57
78
|
}
|
|
58
79
|
}
|
|
59
|
-
function
|
|
80
|
+
function g(e) {
|
|
60
81
|
return !e.first && (e.unsaved || e.lineDrafts > 0);
|
|
61
82
|
}
|
|
62
83
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
84
|
+
f as EMPTY_SUMMARY_RULES,
|
|
85
|
+
m as NO_STATE,
|
|
86
|
+
h as approvalBadgeStates,
|
|
87
|
+
g as holdSummaryReresolve,
|
|
88
|
+
y as normalizeSummaryModeRules,
|
|
89
|
+
v as resolveSummaryMode,
|
|
68
90
|
N as sameSummaryRecord,
|
|
69
|
-
|
|
91
|
+
k as summaryResolveSignature,
|
|
70
92
|
R as summaryRulesNeedRecord,
|
|
71
93
|
S as summaryRulesNeedRole,
|
|
72
|
-
|
|
94
|
+
A as summaryRulesNeedState
|
|
73
95
|
};
|
|
@@ -1,48 +1,159 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { useRef as x, useEffect as w } from "react";
|
|
2
|
+
const B = /^\(\d+\+?\) /, u = /* @__PURE__ */ new Map();
|
|
3
|
+
let c = null, g = [], l = null, M = 0, m = "";
|
|
4
|
+
function E(t) {
|
|
5
|
+
return t > 0 ? `(${t > 99 ? "99+" : Math.floor(t)}) ` : "";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function R(t, n, e, i = []) {
|
|
8
|
+
const o = [...new Set([e, ...i].filter((f) => !!f))];
|
|
9
|
+
let r = t;
|
|
10
|
+
for (let f = 0; f < 8; f++) {
|
|
11
|
+
const s = r;
|
|
12
|
+
r = r.replace(B, "");
|
|
13
|
+
for (const a of o) r.startsWith(`${a} · `) && (r = r.slice(a.length + 3));
|
|
14
|
+
if (r === s) break;
|
|
15
|
+
}
|
|
16
|
+
return E(n) + (e ? `${e} · ` : "") + r;
|
|
17
|
+
}
|
|
18
|
+
function $(t) {
|
|
19
|
+
return t > 0 ? t > 9 ? "9+" : String(Math.floor(t)) : "";
|
|
20
|
+
}
|
|
21
|
+
function q(t, n) {
|
|
22
|
+
const e = t.length > 1, i = Math.round(n * (e ? 0.33 : 0.28));
|
|
23
|
+
return {
|
|
24
|
+
cx: n - i,
|
|
25
|
+
cy: i,
|
|
26
|
+
r: i,
|
|
27
|
+
ring: Math.max(1, Math.round(n * 0.05)),
|
|
28
|
+
font: Math.round(n * (e ? 0.34 : 0.44))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function T() {
|
|
32
|
+
let t = 0;
|
|
33
|
+
for (const n of u.values()) t = Math.max(t, n.count);
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
function L() {
|
|
37
|
+
for (const t of u.values()) if (t.favicon && t.count > 0) return !0;
|
|
38
|
+
return !1;
|
|
39
|
+
}
|
|
40
|
+
function k() {
|
|
41
|
+
const t = R(document.title, T(), c, g);
|
|
42
|
+
g = [], document.title !== t && (document.title = t);
|
|
43
|
+
}
|
|
44
|
+
function S() {
|
|
45
|
+
return u.size > 0 || !!c;
|
|
9
46
|
}
|
|
10
47
|
function p() {
|
|
11
|
-
|
|
12
|
-
for (const r of t.values()) e = Math.max(e, r);
|
|
13
|
-
return e;
|
|
48
|
+
return [...document.querySelectorAll('link[rel~="icon"]')];
|
|
14
49
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
50
|
+
function A(t) {
|
|
51
|
+
var n;
|
|
52
|
+
for (const e of t)
|
|
53
|
+
if (e.href && e.href !== m) return e.href;
|
|
54
|
+
return ((n = t.find((e) => e.dataset.nvrIcon)) == null ? void 0 : n.dataset.nvrIcon) ?? "";
|
|
18
55
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
56
|
+
function O() {
|
|
57
|
+
M++;
|
|
58
|
+
for (const t of p())
|
|
59
|
+
t.dataset.nvrIcon !== void 0 && (t.dataset.nvrIcon && (t.href = t.dataset.nvrIcon), delete t.dataset.nvrIcon);
|
|
60
|
+
m = "";
|
|
23
61
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
62
|
+
function I(t, n, e) {
|
|
63
|
+
const i = $(e), o = q(i, n);
|
|
64
|
+
t.beginPath(), t.arc(o.cx, o.cy, o.r + o.ring, 0, Math.PI * 2), t.fillStyle = "#ffffff", t.fill(), t.beginPath(), t.arc(o.cx, o.cy, o.r, 0, Math.PI * 2), t.fillStyle = "#dc2626", t.fill(), t.fillStyle = "#ffffff", t.font = `bold ${o.font}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "middle", t.fillText(i, o.cx, o.cy + n * 0.02);
|
|
26
65
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
|
|
66
|
+
function P() {
|
|
67
|
+
const t = p();
|
|
68
|
+
if (t.length === 0) return;
|
|
69
|
+
if (!L()) {
|
|
70
|
+
O();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const n = A(t);
|
|
74
|
+
for (const h of t) h.dataset.nvrIcon === void 0 && (h.dataset.nvrIcon = n);
|
|
75
|
+
const e = T(), i = ++M, o = (h) => {
|
|
76
|
+
if (i !== M) return;
|
|
77
|
+
let y = "";
|
|
78
|
+
try {
|
|
79
|
+
y = h.toDataURL("image/png");
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
m = y;
|
|
84
|
+
for (const b of p())
|
|
85
|
+
b.dataset.nvrIcon === void 0 && (b.dataset.nvrIcon = n), b.href = y;
|
|
86
|
+
}, r = 64, f = document.createElement("canvas");
|
|
87
|
+
f.width = r, f.height = r;
|
|
88
|
+
let s = null;
|
|
89
|
+
try {
|
|
90
|
+
s = f.getContext("2d");
|
|
91
|
+
} catch {
|
|
92
|
+
s = null;
|
|
93
|
+
}
|
|
94
|
+
if (!s) return;
|
|
95
|
+
const a = s, v = new Image();
|
|
96
|
+
if (v.onload = () => {
|
|
97
|
+
a.drawImage(v, 0, 0, r, r), I(a, r, e), o(f);
|
|
98
|
+
}, v.onerror = () => {
|
|
99
|
+
I(a, r, e), o(f);
|
|
100
|
+
}, !n) {
|
|
101
|
+
I(a, r, e), o(f);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
v.src = n;
|
|
105
|
+
}
|
|
106
|
+
function F() {
|
|
107
|
+
l || typeof MutationObserver > "u" || (l = new MutationObserver((t) => {
|
|
108
|
+
if (!S()) return;
|
|
109
|
+
if (k(), t.some(
|
|
110
|
+
(e) => e.type === "attributes" && e.target instanceof HTMLLinkElement && e.target.href !== m && e.target.rel.includes("icon")
|
|
111
|
+
) && L()) {
|
|
112
|
+
for (const e of p()) delete e.dataset.nvrIcon;
|
|
113
|
+
P();
|
|
114
|
+
}
|
|
115
|
+
}), l.observe(document.head, {
|
|
116
|
+
subtree: !0,
|
|
117
|
+
childList: !0,
|
|
118
|
+
characterData: !0,
|
|
119
|
+
attributes: !0,
|
|
120
|
+
attributeFilter: ["href"]
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
function d() {
|
|
124
|
+
k(), P(), !S() && l && (l.disconnect(), l = null);
|
|
125
|
+
}
|
|
126
|
+
function D(t, n = {}) {
|
|
127
|
+
const e = x(Symbol("tab-attention")), i = n.enabled ?? !0, o = n.favicon === !0;
|
|
128
|
+
w(() => {
|
|
30
129
|
if (typeof document > "u") return;
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
|
|
130
|
+
const r = e.current;
|
|
131
|
+
if (!i) {
|
|
132
|
+
u.delete(r) && d();
|
|
34
133
|
return;
|
|
35
134
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
135
|
+
const f = u.get(r);
|
|
136
|
+
f && f.count === t && f.favicon === o || (u.set(r, { count: t, favicon: o }), F(), d());
|
|
137
|
+
}, [t, i, o]), w(() => {
|
|
138
|
+
const r = e.current;
|
|
39
139
|
return () => {
|
|
40
|
-
|
|
140
|
+
u.delete(r) && d();
|
|
41
141
|
};
|
|
42
142
|
}, []);
|
|
43
143
|
}
|
|
144
|
+
function H(t) {
|
|
145
|
+
w(() => {
|
|
146
|
+
if (!(typeof document > "u" || !t))
|
|
147
|
+
return c && c !== t && g.push(c), c = t, F(), d(), () => {
|
|
148
|
+
c === t && (c = null, g.push(t), d());
|
|
149
|
+
};
|
|
150
|
+
}, [t]);
|
|
151
|
+
}
|
|
44
152
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
153
|
+
R as composeTabTitle,
|
|
154
|
+
q as faviconBadgeLayout,
|
|
155
|
+
$ as faviconBadgeText,
|
|
156
|
+
E as tabTitlePrefix,
|
|
157
|
+
D as useTabAttention,
|
|
158
|
+
H as useTabTitleLabel
|
|
48
159
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useQuery as y } from "@tanstack/react-query";
|
|
2
|
+
import { useState as d, useRef as p, useEffect as u, useCallback as b } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as S } from "../context.js";
|
|
4
|
+
import { get as _, patch as g } from "./commands.js";
|
|
5
|
+
import { userSyncScoped as s, announceLocalPrefs as v } from "./user-sync.js";
|
|
6
|
+
const a = "nvr_table_density", h = 5e3;
|
|
7
|
+
function l() {
|
|
8
|
+
try {
|
|
9
|
+
return localStorage.getItem(a) === "comfortable" ? "comfortable" : "compact";
|
|
10
|
+
} catch {
|
|
11
|
+
return "compact";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function E(t) {
|
|
15
|
+
const r = t == null ? void 0 : t.table_density;
|
|
16
|
+
return r === "compact" || r === "comfortable" ? r : null;
|
|
17
|
+
}
|
|
18
|
+
function A() {
|
|
19
|
+
const t = S(), [r, c] = d(l), i = p(0);
|
|
20
|
+
u(() => {
|
|
21
|
+
const e = (o) => {
|
|
22
|
+
o.key === a && c(l());
|
|
23
|
+
};
|
|
24
|
+
return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
|
|
25
|
+
}, []);
|
|
26
|
+
const { data: m } = y({
|
|
27
|
+
queryKey: ["nvr-profile-prefs"],
|
|
28
|
+
queryFn: () => t.request(_("/users/me")).then((e) => {
|
|
29
|
+
var o;
|
|
30
|
+
return ((o = e.data) == null ? void 0 : o.preferences) ?? {};
|
|
31
|
+
}),
|
|
32
|
+
enabled: !!t,
|
|
33
|
+
staleTime: 6e4,
|
|
34
|
+
retry: !1
|
|
35
|
+
}), n = E(m);
|
|
36
|
+
u(() => {
|
|
37
|
+
if (!(!n || s()) && !(Date.now() - i.current < h)) {
|
|
38
|
+
c((e) => e === n ? e : n);
|
|
39
|
+
try {
|
|
40
|
+
localStorage.setItem(a, n);
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [n]);
|
|
45
|
+
const f = b(
|
|
46
|
+
(e) => {
|
|
47
|
+
if (i.current = Date.now(), c(e), !s())
|
|
48
|
+
try {
|
|
49
|
+
localStorage.setItem(a, e);
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
!t || s() || t.request(g("/users/me/preferences", { table_density: e })).then(() => v(["table_density"])).catch(() => {
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
[t]
|
|
56
|
+
);
|
|
57
|
+
return [r, f];
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
a as TABLE_DENSITY_KEY,
|
|
61
|
+
E as densityFromPrefs,
|
|
62
|
+
l as readLocalDensity,
|
|
63
|
+
A as useTableDensity
|
|
64
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRef as a, useState as p, useEffect as v } from "react";
|
|
2
|
+
import { liveMotionAllowed as M } from "./live-preference.js";
|
|
3
|
+
import { isOwnWrite as d } from "./own-writes.js";
|
|
4
|
+
const m = 840, w = 240, c = (n) => String(n ?? "").toUpperCase();
|
|
5
|
+
function R(n, o) {
|
|
6
|
+
if (!o) return null;
|
|
7
|
+
const t = n.map(c), r = t.indexOf(c(o.from)), e = t.indexOf(c(o.to));
|
|
8
|
+
if (r < 0 || e < 0 || r === e) return null;
|
|
9
|
+
const f = e < r, s = Math.abs(e - r), u = Math.max(90, Math.min(w, Math.floor(m / s))), l = /* @__PURE__ */ new Map();
|
|
10
|
+
for (let i = 0; i < s; i++) {
|
|
11
|
+
const T = f ? r - 1 - i : r + i;
|
|
12
|
+
l.set(T, i * u);
|
|
13
|
+
}
|
|
14
|
+
return { seg: u, segments: l, backward: f, arriveIndex: e, arriveDelay: s * u };
|
|
15
|
+
}
|
|
16
|
+
function A(n, o, t) {
|
|
17
|
+
return !n || !o || c(n) === c(o) ? !1 : !t.own && t.motion;
|
|
18
|
+
}
|
|
19
|
+
function E(n, o, t) {
|
|
20
|
+
const r = a(void 0), e = a(0), [f, s] = p(null);
|
|
21
|
+
return v(() => {
|
|
22
|
+
const u = r.current;
|
|
23
|
+
if (r.current = t ?? null, u === void 0) return;
|
|
24
|
+
const l = !!n && d(n, o, ["$state"]);
|
|
25
|
+
if (!A(u, t, { own: l, motion: M() })) {
|
|
26
|
+
s(null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
e.current += 1, s({ from: u, to: t, n: e.current });
|
|
30
|
+
const i = setTimeout(() => s(null), m + 600);
|
|
31
|
+
return () => clearTimeout(i);
|
|
32
|
+
}, [t, n, o]), f;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
w as TRACK_TRAVEL_SEG_MS,
|
|
36
|
+
m as TRACK_TRAVEL_TOTAL_MS,
|
|
37
|
+
A as shouldTravel,
|
|
38
|
+
R as travelPlan,
|
|
39
|
+
E as useTrackTravel
|
|
40
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var l = (e, s, t) => s in e ? f(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
3
|
+
var o = (e, s, t) => l(e, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { serverClockOffset as u } from "./server-clock.js";
|
|
5
|
+
const h = 1e3;
|
|
6
|
+
function a(e, s, t) {
|
|
7
|
+
if (!Array.isArray(e) || e.length < 3) return null;
|
|
8
|
+
const r = e[0];
|
|
9
|
+
return (r === "item" || r === "rrv-record") && e[1] === s ? String(e[2]) === t ? "field" : null : r === "o2m-rows" && typeof e[1] == "string" && String(e[3]) === t ? `lines:${e[1]}` : r === "m2m-items" && typeof e[1] == "string" && String(e[3]) === t ? `files:${e[1]}` : null;
|
|
10
|
+
}
|
|
11
|
+
function p(e, s, t = h) {
|
|
12
|
+
return e.filter((r) => {
|
|
13
|
+
const i = Date.parse(r.at);
|
|
14
|
+
return Number.isFinite(i) ? !s.some((n) => n.scope === r.scope && n.at >= i - t) : !0;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const c = (e) => e + u();
|
|
18
|
+
class g {
|
|
19
|
+
constructor(s, t) {
|
|
20
|
+
o(this, "starts", /* @__PURE__ */ new Map());
|
|
21
|
+
o(this, "marks", []);
|
|
22
|
+
o(this, "first", null);
|
|
23
|
+
this.collection = s, this.itemId = t;
|
|
24
|
+
}
|
|
25
|
+
seed(s) {
|
|
26
|
+
for (const t of s) {
|
|
27
|
+
const r = a(t.queryKey, this.collection, this.itemId);
|
|
28
|
+
!r || !t.dataUpdatedAt || this.mark(r, c(t.dataUpdatedAt) - 1e3);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** A read of `hash` started (client ms). */
|
|
32
|
+
started(s, t = Date.now()) {
|
|
33
|
+
this.starts.set(s, c(t));
|
|
34
|
+
}
|
|
35
|
+
/** A read of `hash` (for `queryKey`) finished well. */
|
|
36
|
+
succeeded(s, t, r = Date.now()) {
|
|
37
|
+
const i = a(t, this.collection, this.itemId), n = this.starts.get(s) ?? c(r) - 1e3;
|
|
38
|
+
this.starts.delete(s), i && this.mark(i, n);
|
|
39
|
+
}
|
|
40
|
+
mark(s, t) {
|
|
41
|
+
(this.first == null || t < this.first) && (this.first = t), this.marks.push({ scope: s, at: t });
|
|
42
|
+
const r = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const i of this.marks) {
|
|
44
|
+
const n = r.get(i.scope);
|
|
45
|
+
(!n || i.at > n.at) && r.set(i.scope, i);
|
|
46
|
+
}
|
|
47
|
+
this.marks = [...r.values()];
|
|
48
|
+
}
|
|
49
|
+
/** When the page first read the record (server ms), or null before any read. */
|
|
50
|
+
since() {
|
|
51
|
+
return this.first;
|
|
52
|
+
}
|
|
53
|
+
/** The newest read of the record's own fields (server ms). */
|
|
54
|
+
fieldsSince() {
|
|
55
|
+
var s;
|
|
56
|
+
return ((s = this.marks.find((t) => t.scope === "field")) == null ? void 0 : s.at) ?? null;
|
|
57
|
+
}
|
|
58
|
+
all() {
|
|
59
|
+
return [...this.marks];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
h as SEEN_SKEW_MS,
|
|
64
|
+
g as SeenLog,
|
|
65
|
+
p as filterUnseen,
|
|
66
|
+
a as scopeOfQueryKey,
|
|
67
|
+
c as toServerTime
|
|
68
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function i(o, s) {
|
|
2
|
+
if (o === 413) return "That file is too large to upload.";
|
|
3
|
+
try {
|
|
4
|
+
const e = JSON.parse(s).error;
|
|
5
|
+
if (typeof e == "string" && e && !/^(\d{3}\b|[A-Z_]{4,}$)/.test(e)) return e;
|
|
6
|
+
} catch {
|
|
7
|
+
}
|
|
8
|
+
return "Upload failed";
|
|
9
|
+
}
|
|
10
|
+
function p(o, s, e) {
|
|
11
|
+
const t = new XMLHttpRequest();
|
|
12
|
+
t.upload.onprogress = (r) => {
|
|
13
|
+
var a;
|
|
14
|
+
r.lengthComputable && ((a = e.onProgress) == null || a.call(e, r.loaded / r.total));
|
|
15
|
+
}, t.onload = () => {
|
|
16
|
+
if (t.status >= 200 && t.status < 300)
|
|
17
|
+
try {
|
|
18
|
+
e.onDone(JSON.parse(t.responseText).data.id);
|
|
19
|
+
} catch {
|
|
20
|
+
e.onError("Upload failed");
|
|
21
|
+
}
|
|
22
|
+
else
|
|
23
|
+
e.onError(i(t.status, t.responseText));
|
|
24
|
+
}, t.onerror = () => e.onError("Upload failed"), t.open("POST", `${o.apiBase}/files/upload`);
|
|
25
|
+
for (const [r, a] of Object.entries(o.authHeaders)) t.setRequestHeader(r, a);
|
|
26
|
+
t.withCredentials = o.credentials === "include";
|
|
27
|
+
const n = new FormData();
|
|
28
|
+
return n.append("file", s), t.send(n), { xhr: t, abort: () => t.abort() };
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
p as startFileUpload,
|
|
32
|
+
i as uploadFailureMessage
|
|
33
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { useEffect as U, useSyncExternalStore as _ } from "react";
|
|
2
|
+
import { startFileUpload as b } from "./upload-file.js";
|
|
3
|
+
const v = "nvr:upload-state", M = 500, R = 3e4;
|
|
4
|
+
let g = 0;
|
|
5
|
+
function k() {
|
|
6
|
+
return g = (g + 1) % 1e6, `u${Date.now().toString(36)}${g.toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
7
|
+
}
|
|
8
|
+
function h(e) {
|
|
9
|
+
if (typeof window > "u") return;
|
|
10
|
+
const t = {
|
|
11
|
+
...e,
|
|
12
|
+
state: e.phase === "done" || e.phase === "cancel" ? "done" : "start"
|
|
13
|
+
};
|
|
14
|
+
window.dispatchEvent(new CustomEvent(v, { detail: t }));
|
|
15
|
+
}
|
|
16
|
+
function D() {
|
|
17
|
+
return typeof window > "u" || typeof XMLHttpRequest > "u" ? !1 : window.__nvrViewAsFetch !== !0;
|
|
18
|
+
}
|
|
19
|
+
function N(e, t) {
|
|
20
|
+
const r = {
|
|
21
|
+
upload: k(),
|
|
22
|
+
name: e.name,
|
|
23
|
+
field: t.field,
|
|
24
|
+
collection: t.collection,
|
|
25
|
+
item: t.item
|
|
26
|
+
};
|
|
27
|
+
h({ ...r, phase: "start", pct: 0 });
|
|
28
|
+
let o = 0;
|
|
29
|
+
const a = (l) => h({ ...r, phase: l, pct: null });
|
|
30
|
+
return D() ? new Promise((l, p) => {
|
|
31
|
+
b(t.cfg, e, {
|
|
32
|
+
onProgress: (i) => {
|
|
33
|
+
var S;
|
|
34
|
+
const u = Math.max(0, Math.min(100, Math.round(i * 100)));
|
|
35
|
+
(S = t.onProgress) == null || S.call(t, u);
|
|
36
|
+
const m = Date.now();
|
|
37
|
+
m - o < M && u < 100 || (o = m, h({ ...r, phase: "progress", pct: u }));
|
|
38
|
+
},
|
|
39
|
+
onDone: (i) => {
|
|
40
|
+
a("done"), l({ id: i });
|
|
41
|
+
},
|
|
42
|
+
onError: (i) => {
|
|
43
|
+
a("cancel"), p(new Error(i));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}) : t.fallback(e).then(
|
|
47
|
+
(l) => (a("done"), l),
|
|
48
|
+
(l) => {
|
|
49
|
+
throw a("cancel"), l;
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
let s = [];
|
|
54
|
+
const c = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set();
|
|
55
|
+
let d = null, y = { uploads: s };
|
|
56
|
+
const f = () => {
|
|
57
|
+
y = { uploads: s };
|
|
58
|
+
for (const e of w) e();
|
|
59
|
+
};
|
|
60
|
+
function P() {
|
|
61
|
+
d || typeof setInterval > "u" || (d = setInterval(() => {
|
|
62
|
+
const e = Date.now() - R, t = s.filter((n) => n.seen >= e);
|
|
63
|
+
t.length !== s.length && (s = t, f()), s.length === 0 && d && (clearInterval(d), d = null);
|
|
64
|
+
}, 5e3));
|
|
65
|
+
}
|
|
66
|
+
function x(e, t = Date.now()) {
|
|
67
|
+
if (!e || typeof e != "object") return;
|
|
68
|
+
const n = e;
|
|
69
|
+
if (n.collection == null || n.item == null) return;
|
|
70
|
+
const r = String(n.user_name ?? n.user ?? "Someone"), a = n.name_hidden === !0 ? null : String(n.name ?? "") || null, l = typeof n.upload == "string" && n.upload ? n.upload : `${r}:${a ?? ""}`, p = String(n.phase ?? (n.state === "done" ? "done" : "start")), i = s.filter((m) => m.key !== l);
|
|
71
|
+
if (p === "done" || p === "cancel") {
|
|
72
|
+
i.length !== s.length && (s = i, f());
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const u = Number.isFinite(Number(n.pct)) && n.pct !== null ? Number(n.pct) : null;
|
|
76
|
+
s = [
|
|
77
|
+
...i,
|
|
78
|
+
{
|
|
79
|
+
key: l,
|
|
80
|
+
collection: String(n.collection),
|
|
81
|
+
item: String(n.item),
|
|
82
|
+
field: typeof n.field == "string" && n.field ? n.field : null,
|
|
83
|
+
user: r,
|
|
84
|
+
name: a,
|
|
85
|
+
pct: u,
|
|
86
|
+
seen: t
|
|
87
|
+
}
|
|
88
|
+
], P(), f();
|
|
89
|
+
}
|
|
90
|
+
const A = (e) => (w.add(e), () => {
|
|
91
|
+
w.delete(e);
|
|
92
|
+
}), $ = () => y, E = (e, t, n) => `${e}\0${t}\0${n}`;
|
|
93
|
+
function F(e, t, n, r) {
|
|
94
|
+
return e.filter((o) => o.collection !== t || o.item !== String(n) ? !1 : r === void 0 ? !0 : r === "unclaimed" ? !o.field || !c.has(E(t, String(n), o.field)) : o.field === r);
|
|
95
|
+
}
|
|
96
|
+
function L(e, t, n) {
|
|
97
|
+
const { uploads: r } = _(A, $, $);
|
|
98
|
+
return !e || t == null ? [] : F(r, e, String(t), n);
|
|
99
|
+
}
|
|
100
|
+
function O(e, t, n) {
|
|
101
|
+
U(() => {
|
|
102
|
+
if (!e || t == null || !n) return;
|
|
103
|
+
const r = E(e, String(t), n);
|
|
104
|
+
return c.set(r, (c.get(r) ?? 0) + 1), f(), () => {
|
|
105
|
+
const o = (c.get(r) ?? 1) - 1;
|
|
106
|
+
o <= 0 ? c.delete(r) : c.set(r, o), f();
|
|
107
|
+
};
|
|
108
|
+
}, [e, t, n]);
|
|
109
|
+
}
|
|
110
|
+
function q(e) {
|
|
111
|
+
const t = e.name ? e.name.length > 40 ? `${e.name.slice(0, 39)}…` : e.name : null, n = t ? `“${t}”` : "a file", r = e.pct != null && e.pct > 0 && e.pct < 100 ? ` (${e.pct}%)` : "";
|
|
112
|
+
return `${e.user} is uploading ${n}${r}`;
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
M as PROGRESS_REPORT_MS,
|
|
116
|
+
R as STALE_MS,
|
|
117
|
+
v as UPLOAD_STATE_EVENT,
|
|
118
|
+
x as applyRemoteUpload,
|
|
119
|
+
k as newUploadId,
|
|
120
|
+
D as progressUploadAllowed,
|
|
121
|
+
F as remoteUploadsFor,
|
|
122
|
+
h as reportUploadState,
|
|
123
|
+
N as trackedUpload,
|
|
124
|
+
q as uploadSentence,
|
|
125
|
+
O as useClaimUploadField,
|
|
126
|
+
L as useRemoteUploads
|
|
127
|
+
};
|