@nivaro/react 0.3.117 → 0.3.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +136 -14
  4. package/dist/index.js +488 -485
  5. package/dist/shared/components/ActivityEntry.js +130 -125
  6. package/dist/shared/components/AgentPresenceChip.js +36 -26
  7. package/dist/shared/components/CellCopyLayer.js +50 -45
  8. package/dist/shared/components/CollectionBrowserView.js +3757 -3695
  9. package/dist/shared/components/FilePreviewLightbox.js +96 -58
  10. package/dist/shared/components/InStep.js +18 -17
  11. package/dist/shared/components/ItemEditForm.js +4451 -4385
  12. package/dist/shared/components/JobsTray.js +8 -8
  13. package/dist/shared/components/LiveNewMatchesPill.js +21 -14
  14. package/dist/shared/components/LiveOffNote.js +3 -2
  15. package/dist/shared/components/LiveRowMark.js +53 -23
  16. package/dist/shared/components/LiveTraceView.js +162 -123
  17. package/dist/shared/components/MyWorkView.js +320 -299
  18. package/dist/shared/components/NotificationBell.js +14 -14
  19. package/dist/shared/components/OverflowRail.js +1 -1
  20. package/dist/shared/components/PageRenderer.js +120 -116
  21. package/dist/shared/components/ProfileView.js +203 -202
  22. package/dist/shared/components/RealtimeStatusBanner.js +31 -29
  23. package/dist/shared/components/RecordDrilldownSheet.js +7 -7
  24. package/dist/shared/components/RecordHoverCard.js +102 -84
  25. package/dist/shared/components/RecordReadView.js +146 -146
  26. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  27. package/dist/shared/components/TipLayer.js +65 -58
  28. package/dist/shared/components/WidgetImageMenu.js +83 -43
  29. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  31. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  32. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  33. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  34. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  35. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  37. package/dist/shared/components/collections-directory/page-model.js +72 -67
  38. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  39. package/dist/shared/components/integrations/SendStatus.js +65 -59
  40. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  41. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  42. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  43. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +135 -94
  44. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  45. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  46. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  47. package/dist/shared/components/item-edit/FieldComments.js +88 -85
  48. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  49. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  50. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  51. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  52. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  53. package/dist/shared/components/item-edit/HeaderTools.js +245 -141
  54. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  55. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  56. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  57. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  58. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  59. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  60. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  61. package/dist/shared/components/item-edit/RecordHelpChip.js +15 -16
  62. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  63. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  64. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  65. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  66. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  67. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  68. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  69. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  70. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  71. package/dist/shared/components/item-edit/UserChip.js +1 -1
  72. package/dist/shared/components/item-edit/addendum-view.js +6 -0
  73. package/dist/shared/components/item-edit/file-live.js +69 -54
  74. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  75. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  76. package/dist/shared/components/item-edit/removed-line.js +31 -25
  77. package/dist/shared/components/layout-editor/pickers/field-picker.js +151 -130
  78. package/dist/shared/components/list/ListViewers.js +46 -35
  79. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  80. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  81. package/dist/shared/components/panels/AlertBanners.js +82 -72
  82. package/dist/shared/components/panels/BranchLanes.js +22 -22
  83. package/dist/shared/components/panels/CommentImages.js +123 -102
  84. package/dist/shared/components/panels/CommentPanel.js +186 -185
  85. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  86. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  87. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  88. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  89. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  90. package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
  91. package/dist/shared/components/profile/AgentNameField.js +107 -81
  92. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  93. package/dist/shared/components/profile/PersonAccess.js +599 -495
  94. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  95. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  96. package/dist/shared/components/profile/primitives.js +1 -1
  97. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  98. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  99. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  100. package/dist/shared/components/support/AssignRules.js +1733 -0
  101. package/dist/shared/components/support/PersonPick.js +88 -0
  102. package/dist/shared/components/support/RequestList.js +790 -0
  103. package/dist/shared/components/support/ScreenShare.js +158 -152
  104. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  105. package/dist/shared/components/support/SupportView.js +140 -246
  106. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  107. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  108. package/dist/shared/components/support/assign-rules-text.js +171 -0
  109. package/dist/shared/components/support/support-list.js +125 -0
  110. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  111. package/dist/shared/components/ui/checkbox.js +6 -6
  112. package/dist/shared/components/ui/select.js +43 -39
  113. package/dist/shared/components/ui/sheet.js +9 -9
  114. package/dist/shared/components/ui/switch.js +12 -11
  115. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  116. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  117. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  118. package/dist/shared/lib/activity-sentence.js +103 -91
  119. package/dist/shared/lib/agent-presence.js +27 -21
  120. package/dist/shared/lib/approval-progress.js +2 -2
  121. package/dist/shared/lib/copy-rules.js +31 -24
  122. package/dist/shared/lib/derived-causes.js +113 -78
  123. package/dist/shared/lib/grid-cursors.js +26 -26
  124. package/dist/shared/lib/label-flash.js +27 -0
  125. package/dist/shared/lib/list-return.js +137 -125
  126. package/dist/shared/lib/live-deltas.js +40 -34
  127. package/dist/shared/lib/live-groups.js +56 -52
  128. package/dist/shared/lib/live-preference.js +64 -59
  129. package/dist/shared/lib/live-screen.js +223 -192
  130. package/dist/shared/lib/partner-failure.js +11 -11
  131. package/dist/shared/lib/rollup-recalc.js +68 -64
  132. package/dist/shared/lib/screen-refresh.js +74 -68
  133. package/dist/shared/lib/screen-share.js +108 -104
  134. package/dist/shared/lib/send-status.js +77 -61
  135. package/dist/shared/lib/text-diff-window.js +29 -0
  136. package/dist/shared/lib/watch-list.js +210 -209
  137. package/dist/shared/lib/widget-image-render.js +72 -49
  138. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { isOwnWrite as A } from "./own-writes.js";
2
- const w = "nvr:list-return", x = 360 * 60 * 1e3, v = 500, S = (e, t) => !!e && !!t && e.collection === t.collection && String(e.id).toLowerCase() === String(t.id).toLowerCase();
3
- function y() {
4
- var t, n;
1
+ import { isOwnWrite as h } from "./own-writes.js";
2
+ const w = "nvr:list-return", x = 360 * 60 * 1e3, v = 500, S = (t, e) => !!t && !!e && t.collection === e.collection && String(t.id).toLowerCase() === String(e.id).toLowerCase();
3
+ function g() {
4
+ var e, n;
5
5
  if (typeof window > "u") return null;
6
- const e = (n = (t = window.history) == null ? void 0 : t.state) == null ? void 0 : n.idx;
7
- return typeof e == "number" && Number.isFinite(e) ? e : null;
6
+ const t = (n = (e = window.history) == null ? void 0 : e.state) == null ? void 0 : n.idx;
7
+ return typeof t == "number" && Number.isFinite(t) ? t : null;
8
8
  }
9
9
  function m() {
10
10
  try {
@@ -13,119 +13,131 @@ function m() {
13
13
  return null;
14
14
  }
15
15
  }
16
- function T(e) {
17
- const t = m();
18
- if (!t) return;
19
- const n = y(), r = [], o = /* @__PURE__ */ new Set();
20
- for (const i of e.rows) {
16
+ function k(t) {
17
+ const e = m();
18
+ if (!e) return;
19
+ const n = g(), r = [], o = /* @__PURE__ */ new Set();
20
+ for (const i of t.rows) {
21
21
  if (!(i != null && i.collection) || i.id == null || i.id === "") continue;
22
- const u = `${i.collection}${String(i.id).toLowerCase()}`;
23
- if (!o.has(u) && (o.add(u), r.push({ collection: i.collection, id: String(i.id) }), r.length >= v))
22
+ const s = `${i.collection}${String(i.id).toLowerCase()}`;
23
+ if (!o.has(s) && (o.add(s), r.push({ collection: i.collection, id: String(i.id) }), r.length >= v))
24
24
  break;
25
25
  }
26
- const c = {
27
- list: e.list,
28
- label: e.label ?? null,
29
- path: e.path ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : ""),
26
+ const l = {
27
+ list: t.list,
28
+ label: t.label ?? null,
29
+ path: t.path ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : ""),
30
30
  rows: r,
31
- current: { collection: e.opened.collection, id: String(e.opened.id) },
32
- opened: { collection: e.opened.collection, id: String(e.opened.id) },
31
+ ...typeof t.total == "number" && Number.isFinite(t.total) && t.total >= 0 ? { total: Math.round(t.total), ...t.totalApprox ? { totalApprox: !0 } : {} } : {},
32
+ ...typeof t.offset == "number" && Number.isFinite(t.offset) && t.offset > 0 ? { offset: Math.floor(t.offset) } : {},
33
+ current: { collection: t.opened.collection, id: String(t.opened.id) },
34
+ opened: { collection: t.opened.collection, id: String(t.opened.id) },
33
35
  idx: n == null ? null : n + 1,
34
- entry: e.entry ?? null,
36
+ entry: t.entry ?? null,
35
37
  at: Date.now()
36
38
  };
37
39
  try {
38
- t.setItem(w, JSON.stringify(c));
40
+ e.setItem(w, JSON.stringify(l));
39
41
  } catch {
40
42
  }
41
43
  }
42
- function g(e = Date.now()) {
43
- const t = m();
44
- if (!t) return null;
44
+ function y(t = Date.now()) {
45
+ const e = m();
46
+ if (!e) return null;
45
47
  try {
46
- const n = t.getItem(w);
48
+ const n = e.getItem(w);
47
49
  if (!n) return null;
48
50
  const r = JSON.parse(n);
49
- return !r || typeof r.list != "string" || !Array.isArray(r.rows) || !r.current || !(e - Number(r.at ?? 0) <= x) ? null : r;
51
+ return !r || typeof r.list != "string" || !Array.isArray(r.rows) || !r.current || !(t - Number(r.at ?? 0) <= x) ? null : r;
50
52
  } catch {
51
53
  return null;
52
54
  }
53
55
  }
54
- function R(e) {
55
- var t;
56
+ function R(t) {
57
+ var e;
56
58
  try {
57
- (t = m()) == null || t.setItem(w, JSON.stringify(e));
59
+ (e = m()) == null || e.setItem(w, JSON.stringify(t));
58
60
  } catch {
59
61
  }
60
62
  }
61
- function _(e, t) {
62
- if (!e) return null;
63
- const n = e.rows.findIndex((r) => S(r, t));
64
- return n < 0 ? null : {
63
+ function _(t, e) {
64
+ if (!t) return null;
65
+ const n = t.rows.findIndex((s) => S(s, e));
66
+ if (n < 0) return null;
67
+ const r = t.rows.length, o = typeof t.offset == "number" && Number.isFinite(t.offset) && t.offset > 0 ? Math.floor(t.offset) : 0, i = typeof t.total == "number" && Number.isFinite(t.total) ? Math.max(Number(t.total), o + r) : null;
68
+ return {
65
69
  index: n + 1,
66
- total: e.rows.length,
67
- prev: n > 0 ? e.rows[n - 1] : null,
68
- next: n < e.rows.length - 1 ? e.rows[n + 1] : null
70
+ total: r,
71
+ prev: n > 0 ? t.rows[n - 1] : null,
72
+ next: n < r - 1 ? t.rows[n + 1] : null,
73
+ position: o + n + 1,
74
+ listTotal: i,
75
+ approx: i != null && !!t.totalApprox,
76
+ moreAfter: i != null && o + r < i,
77
+ moreBefore: o > 0
69
78
  };
70
79
  }
71
- function I(e, t = g()) {
72
- if (!t || !S(t.current, e)) return null;
73
- const n = y();
74
- return t.idx != null && n != null && t.idx !== n ? null : _(t, e) ? t : null;
80
+ function T(t, e = y()) {
81
+ if (!e || !S(e.current, t)) return null;
82
+ const n = g();
83
+ return e.idx != null && n != null && e.idx !== n ? null : _(e, t) ? e : null;
75
84
  }
76
- function O(e) {
77
- const t = g();
78
- t && R({ ...t, current: { collection: e.collection, id: String(e.id) }, at: Date.now() });
85
+ function $(t) {
86
+ const e = y();
87
+ e && R({ ...e, current: { collection: t.collection, id: String(t.id) }, at: Date.now() });
79
88
  }
80
- function $(e, t = g()) {
81
- return !t || t.list !== e ? null : t.current;
89
+ function I(t, e = y()) {
90
+ return !e || e.list !== t ? null : e.current;
82
91
  }
83
- function k(e, t) {
84
- var i;
85
- if (!e || typeof window > "u" || !t) return !1;
86
- const n = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t.replace(/"/g, '\\"'), r = e.querySelector(`[data-row-key="${n}"]`);
92
+ function O(t, e) {
93
+ var a;
94
+ if (!t || typeof window > "u" || !e) return !1;
95
+ const n = typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, '\\"'), r = t.querySelector(`[data-row-key="${n}"]`);
87
96
  if (!r) return !1;
88
97
  r.setAttribute("data-return-row", "");
89
98
  let o = !1;
90
99
  try {
91
- o = !!((i = window.matchMedia) != null && i.call(window, "(prefers-reduced-motion: reduce)").matches);
100
+ o = !!((a = window.matchMedia) != null && a.call(window, "(prefers-reduced-motion: reduce)").matches);
92
101
  } catch {
93
102
  o = !1;
94
103
  }
95
- const c = Array.from(r.children);
96
- return o || c.some((u) => typeof u.animate != "function") ? (setTimeout(() => r.removeAttribute("data-return-row"), 1800), !0) : (c.forEach((u, a) => {
97
- const s = a === 0 ? "inset 3px 0 0 0 rgba(0, 206, 255, 0.85), " : "";
104
+ const l = Array.from(r.children);
105
+ if (o || l.some((u) => typeof u.animate != "function"))
106
+ return setTimeout(() => r.removeAttribute("data-return-row"), 1800), !0;
107
+ const s = `rgba(0, 206, 255, ${typeof document < "u" && document.documentElement.classList.contains("dark") ? 0.1 : 0.16})`;
108
+ return l.forEach((u, c) => {
109
+ const f = c === 0 ? "inset 3px 0 0 0 rgba(0, 206, 255, 0.85), " : "";
98
110
  u.animate(
99
111
  [
100
- { boxShadow: `${s}inset 0 0 0 9999px rgba(0, 206, 255, 0.10)` },
101
- { boxShadow: `${s}inset 0 0 0 9999px rgba(0, 206, 255, 0.10)`, offset: 0.55 },
112
+ { boxShadow: `${f}inset 0 0 0 9999px ${s}` },
113
+ { boxShadow: `${f}inset 0 0 0 9999px ${s}`, offset: 0.55 },
102
114
  {
103
- boxShadow: `${a === 0 ? "inset 3px 0 0 0 rgba(0, 206, 255, 0), " : ""}inset 0 0 0 9999px rgba(0, 206, 255, 0)`
115
+ boxShadow: `${c === 0 ? "inset 3px 0 0 0 rgba(0, 206, 255, 0), " : ""}inset 0 0 0 9999px rgba(0, 206, 255, 0)`
104
116
  }
105
117
  ],
106
118
  { duration: 2400, easing: "ease-out" }
107
119
  );
108
- }), setTimeout(() => r.removeAttribute("data-return-row"), 2400), !0);
120
+ }), setTimeout(() => r.removeAttribute("data-return-row"), 2400), !0;
109
121
  }
110
- function C(e, t) {
111
- const n = e.getBoundingClientRect(), r = { top: 0, bottom: typeof window < "u" ? window.innerHeight : 0 };
122
+ function C(t, e) {
123
+ const n = t.getBoundingClientRect(), r = { top: 0, bottom: typeof window < "u" ? window.innerHeight : 0 };
112
124
  return n.bottom > r.top + 4 && n.top < r.bottom - 4;
113
125
  }
114
- const L = 300, h = 900 * 1e3, E = 40, p = /* @__PURE__ */ new Map();
115
- function N(e) {
116
- if (!e.coalesced) return [e];
117
- const { coalesced: t, items: n, many: r, count: o, ...c } = e;
118
- return r || !Array.isArray(n) ? [{ ...c, item: "*" }] : n.map((i) => ({ ...c, item: i }));
126
+ const L = 300, b = 900 * 1e3, N = 40, p = /* @__PURE__ */ new Map();
127
+ function M(t) {
128
+ if (!t.coalesced) return [t];
129
+ const { coalesced: e, items: n, many: r, count: o, ...l } = t;
130
+ return r || !Array.isArray(n) ? [{ ...l, item: "*" }] : n.map((i) => ({ ...l, item: i }));
119
131
  }
120
- function d(e, t) {
121
- e.complete && (e.complete = !1, e.reason = t, e.events = []);
132
+ function d(t, e) {
133
+ t.complete && (t.complete = !1, t.reason = e, t.events = []);
122
134
  }
123
- function D(e, t, n) {
135
+ function F(t, e, n) {
124
136
  const r = [...new Set(n.filter(Boolean))];
125
- if (!e || !t || r.length === 0) return () => {
137
+ if (!t || !e || r.length === 0) return () => {
126
138
  };
127
139
  const o = {
128
- key: t,
140
+ key: e,
129
141
  events: [],
130
142
  complete: !0,
131
143
  away: !1,
@@ -134,11 +146,11 @@ function D(e, t, n) {
134
146
  stop: () => {
135
147
  },
136
148
  timer: null
137
- }, c = (s) => {
149
+ }, l = (u) => {
138
150
  if (!(!o.away || !o.complete))
139
- for (const l of N(s)) {
140
- if (!l || !r.includes(String(l.collection))) continue;
141
- if (String(l.item) === "*") {
151
+ for (const c of M(u)) {
152
+ if (!c || !r.includes(String(c.collection))) continue;
153
+ if (String(c.item) === "*") {
142
154
  d(o, "bulk");
143
155
  return;
144
156
  }
@@ -146,61 +158,61 @@ function D(e, t, n) {
146
158
  d(o, "overflow");
147
159
  return;
148
160
  }
149
- const f = Array.isArray(l.changed_fields) ? l.changed_fields : null;
161
+ const f = Array.isArray(c.changed_fields) ? c.changed_fields : null;
150
162
  o.events.push({
151
- collection: String(l.collection),
152
- item: String(l.item),
153
- ...l.action ? { action: l.action } : {},
163
+ collection: String(c.collection),
164
+ item: String(c.item),
165
+ ...c.action ? { action: c.action } : {},
154
166
  ...f ? { changed_fields: [...f] } : {},
155
- own: A(String(l.collection), String(l.item), f)
167
+ own: h(String(c.collection), String(c.item), f)
156
168
  });
157
169
  }
158
- }, i = e.subscribeCollections(r, c), u = e.onStatus ? e.onStatus((s) => {
159
- o.away && (s.state === "reconnecting" ? o.dropped = !0 : o.dropped && (o.dropped = !1, s.resumed !== "replayed" && d(o, "reconnect")));
170
+ }, i = t.subscribeCollections(r, l), s = t.onStatus ? t.onStatus((u) => {
171
+ o.away && (u.state === "reconnecting" ? o.dropped = !0 : o.dropped && (o.dropped = !1, u.resumed !== "replayed" && d(o, "reconnect")));
160
172
  }) : () => {
161
173
  }, a = () => {
162
174
  o.away && d(o, "stale");
163
175
  };
164
176
  return typeof window < "u" && (window.addEventListener("nvr:catchup-full", a), window.addEventListener("nvr:realtime-stale", a)), o.stop = () => {
165
- i(), u(), typeof window < "u" && (window.removeEventListener("nvr:catchup-full", a), window.removeEventListener("nvr:realtime-stale", a)), o.timer && clearTimeout(o.timer), o.timer = null;
177
+ i(), s(), typeof window < "u" && (window.removeEventListener("nvr:catchup-full", a), window.removeEventListener("nvr:realtime-stale", a)), o.timer && clearTimeout(o.timer), o.timer = null;
166
178
  }, () => {
167
- const s = p.get(t);
168
- s && s !== o && s.stop(), o.away = !0, o.leftAt = Date.now(), o.timer = setTimeout(() => {
179
+ const u = p.get(e);
180
+ u && u !== o && u.stop(), o.away = !0, o.leftAt = Date.now(), o.timer = setTimeout(() => {
169
181
  o.stop(), d(o, "expired");
170
- }, h), p.set(t, o);
182
+ }, b), p.set(e, o);
171
183
  };
172
184
  }
173
- function b(e, t) {
174
- const n = t - e.leftAt > h;
185
+ function A(t, e) {
186
+ const n = e - t.leftAt > b;
175
187
  return {
176
- events: e.complete && !n ? [...e.events] : [],
177
- complete: e.complete && !n,
178
- ...e.reason ? { reason: e.reason } : n ? { reason: "expired" } : {},
179
- leftAt: e.leftAt,
180
- awayMs: Math.max(0, t - e.leftAt)
188
+ events: t.complete && !n ? [...t.events] : [],
189
+ complete: t.complete && !n,
190
+ ...t.reason ? { reason: t.reason } : n ? { reason: "expired" } : {},
191
+ leftAt: t.leftAt,
192
+ awayMs: Math.max(0, e - t.leftAt)
181
193
  };
182
194
  }
183
- function J(e, t = Date.now()) {
184
- const n = p.get(e);
185
- return n != null && n.away ? b(n, t) : null;
186
- }
187
- function W(e, t = Date.now()) {
188
- const n = p.get(e);
189
- return n != null && n.away ? (p.delete(e), n.stop(), b(n, t)) : null;
190
- }
191
- function X(e, t = {}) {
192
- return e ? e.complete ? e.events.length === 0 ? "keep" : new Set(e.events.map((r) => `${r.collection}${String(r.item)}`)).size <= (t.maxRows ?? E) ? "replay" : "refetch" : "refetch" : "fresh";
193
- }
194
- function j(e, t, n = (r) => String(r.id)) {
195
- if (!e || !t) return [];
196
- const r = new Map(e.map((c) => [n(c), c])), o = [];
197
- for (const c of t) {
198
- const i = n(c), u = r.get(i);
199
- if (!u) continue;
200
- const a = /* @__PURE__ */ new Set([...Object.keys(u), ...Object.keys(c)]);
201
- for (const s of a) {
202
- const l = u[s], f = c[s];
203
- if (l !== f && !(l && f && typeof l == "object" && typeof f == "object" && JSON.stringify(l) === JSON.stringify(f))) {
195
+ function D(t, e = Date.now()) {
196
+ const n = p.get(t);
197
+ return n != null && n.away ? A(n, e) : null;
198
+ }
199
+ function J(t, e = Date.now()) {
200
+ const n = p.get(t);
201
+ return n != null && n.away ? (p.delete(t), n.stop(), A(n, e)) : null;
202
+ }
203
+ function W(t, e = {}) {
204
+ return t ? t.complete ? t.events.length === 0 ? "keep" : new Set(t.events.map((r) => `${r.collection}${String(r.item)}`)).size <= (e.maxRows ?? N) ? "replay" : "refetch" : "refetch" : "fresh";
205
+ }
206
+ function X(t, e, n = (r) => String(r.id)) {
207
+ if (!t || !e) return [];
208
+ const r = new Map(t.map((l) => [n(l), l])), o = [];
209
+ for (const l of e) {
210
+ const i = n(l), s = r.get(i);
211
+ if (!s) continue;
212
+ const a = /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(l)]);
213
+ for (const u of a) {
214
+ const c = s[u], f = l[u];
215
+ if (c !== f && !(c && f && typeof c == "object" && typeof f == "object" && JSON.stringify(c) === JSON.stringify(f))) {
204
216
  o.push(i);
205
217
  break;
206
218
  }
@@ -210,22 +222,22 @@ function j(e, t, n = (r) => String(r.id)) {
210
222
  }
211
223
  export {
212
224
  L as AWAY_MAX_EVENTS,
213
- h as AWAY_MAX_MS,
225
+ b as AWAY_MAX_MS,
214
226
  w as LIST_RETURN_KEY,
215
227
  x as LIST_RETURN_MAX_AGE_MS,
216
228
  v as LIST_RETURN_MAX_ROWS,
217
- E as RETURN_MAX_ROWS,
218
- j as changedRowIds,
229
+ N as RETURN_MAX_ROWS,
230
+ X as changedRowIds,
219
231
  _ as listNeighbors,
220
- I as listReturnFor,
221
- k as markReturnRow,
222
- T as noteListOpen,
223
- J as peekListAway,
224
- X as planListReturn,
225
- g as readListReturn,
226
- $ as returnRowFor,
232
+ T as listReturnFor,
233
+ O as markReturnRow,
234
+ k as noteListOpen,
235
+ D as peekListAway,
236
+ W as planListReturn,
237
+ y as readListReturn,
238
+ I as returnRowFor,
227
239
  C as rowInView,
228
- D as standbyListAway,
229
- O as stepListReturn,
230
- W as takeListAway
240
+ F as standbyListAway,
241
+ $ as stepListReturn,
242
+ J as takeListAway
231
243
  };
@@ -1,9 +1,9 @@
1
- import { useState as d, useEffect as f, useMemo as y } from "react";
1
+ import { useState as d, useEffect as f, useMemo as m } from "react";
2
2
  function p(t) {
3
3
  if (t == null) return null;
4
- const n = String(t).trim().replace(/−/g, "-");
5
- if (!/^-?\d{1,3}(,\d{3})*$|^-?\d+$/.test(n)) return null;
6
- const r = Number(n.replace(/,/g, ""));
4
+ const e = String(t).trim().replace(/−/g, "-");
5
+ if (!/^-?\d{1,3}(,\d{3})*$|^-?\d+$/.test(e)) return null;
6
+ const r = Number(e.replace(/,/g, ""));
7
7
  return Number.isSafeInteger(r) ? r : null;
8
8
  }
9
9
  const o = (t) => String(t).padStart(2, "0");
@@ -11,36 +11,42 @@ function g(t) {
11
11
  return `${t.getFullYear()}-${o(t.getMonth() + 1)}-${o(t.getDate())}`;
12
12
  }
13
13
  function N(t) {
14
- const n = new Date(t.getFullYear(), t.getMonth(), t.getDate() - 1);
15
- return g(n);
14
+ const e = new Date(t.getFullYear(), t.getMonth(), t.getDate() - 1);
15
+ return g(e);
16
16
  }
17
- function c(t, n, r = /* @__PURE__ */ new Date()) {
18
- const e = g(r);
19
- return t ? t.day === e ? t.last === n ? t : { ...t, last: n } : {
20
- day: e,
21
- first: n,
17
+ function c(t, e, r = /* @__PURE__ */ new Date()) {
18
+ const n = g(r);
19
+ return t ? t.day === n ? t.last === e ? t : { ...t, last: e } : {
20
+ day: n,
21
+ first: e,
22
22
  firstHour: r.getHours(),
23
- last: n,
23
+ last: e,
24
24
  // Only the day right before counts as "yesterday"; an older visit is no baseline.
25
25
  prevLast: t.day === N(r) ? t.last : null
26
- } : { day: e, first: n, firstHour: r.getHours(), last: n, prevLast: null };
26
+ } : { day: n, first: e, firstHour: r.getHours(), last: e, prevLast: null };
27
27
  }
28
- function S(t) {
28
+ function h(t) {
29
29
  if (!t) return null;
30
- let n = t.last - t.first, r = t.firstHour < 12 ? "this morning" : "earlier today";
31
- if (n === 0) {
30
+ let e = t.last - t.first, r = t.firstHour < 12 ? "this morning" : "earlier today";
31
+ if (e === 0) {
32
32
  if (t.prevLast == null || t.prevLast === t.last) return null;
33
- n = t.last - t.prevLast, r = "yesterday";
33
+ e = t.last - t.prevLast, r = "yesterday";
34
34
  }
35
- const e = `${n > 0 ? "+" : "−"}${Math.abs(n).toLocaleString("en-US")}`;
36
- return { delta: n, sign: e, since: r, text: `${e} since ${r}` };
35
+ const n = `${e > 0 ? "+" : "−"}${Math.abs(e).toLocaleString("en-US")}`;
36
+ return {
37
+ delta: e,
38
+ sign: n,
39
+ since: r,
40
+ text: `${n} ${r === "yesterday" ? "vs yesterday" : "today"}`,
41
+ phrase: `${n} since ${r}`
42
+ };
37
43
  }
38
- const m = "nvr:chip:";
44
+ const y = "nvr:chip:";
39
45
  function i(t) {
40
46
  try {
41
- const n = localStorage.getItem(m + t);
42
- if (!n) return null;
43
- const r = JSON.parse(n);
47
+ const e = localStorage.getItem(y + t);
48
+ if (!e) return null;
49
+ const r = JSON.parse(e);
44
50
  return typeof r.day != "string" || !Number.isFinite(r.first) || !Number.isFinite(r.last) || !Number.isFinite(r.firstHour) ? null : {
45
51
  day: r.day,
46
52
  first: Number(r.first),
@@ -52,30 +58,30 @@ function i(t) {
52
58
  return null;
53
59
  }
54
60
  }
55
- function h(t, n) {
61
+ function S(t, e) {
56
62
  try {
57
- localStorage.setItem(m + t, JSON.stringify(n));
63
+ localStorage.setItem(y + t, JSON.stringify(e));
58
64
  } catch {
59
65
  }
60
66
  }
61
- function $(t, n, r = !0) {
62
- const e = r ? p(n) : null, [u, l] = d(
67
+ function L(t, e, r = !0) {
68
+ const n = r ? p(e) : null, [u, a] = d(
63
69
  () => r ? i(t) : null
64
70
  );
65
71
  return f(() => {
66
- l(r ? i(t) : null);
72
+ a(r ? i(t) : null);
67
73
  }, [t, r]), f(() => {
68
- e != null && l((a) => {
69
- const s = c(a ?? i(t), e);
70
- return s !== a && h(t, s), s;
74
+ n != null && a((l) => {
75
+ const s = c(l ?? i(t), n);
76
+ return s !== l && S(t, s), s;
71
77
  });
72
- }, [e, t]), y(() => e == null ? null : S(c(u, e)), [e, u]);
78
+ }, [n, t]), m(() => n == null ? null : h(c(u, n)), [n, u]);
73
79
  }
74
80
  export {
75
81
  c as advanceBaseline,
76
82
  g as dayKey,
77
- S as deltaChip,
83
+ h as deltaChip,
78
84
  p as parseCount,
79
85
  i as readBaseline,
80
- $ as useChangeChip
86
+ L as useChangeChip
81
87
  };