@nivaro/react 0.3.16 → 0.3.18

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 (28) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +51 -1
  4. package/dist/index.js +243 -240
  5. package/dist/shared/components/CollectionBrowserView.js +439 -438
  6. package/dist/shared/components/ItemEditForm.js +3758 -3708
  7. package/dist/shared/components/ProfileView.js +38 -23
  8. package/dist/shared/components/RecordReadView.js +452 -430
  9. package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
  10. package/dist/shared/components/chat/ChannelArchive.js +16 -17
  11. package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
  12. package/dist/shared/components/chat/ChatPanel.js +992 -930
  13. package/dist/shared/components/chat/Composer.js +307 -303
  14. package/dist/shared/components/chat/chat-core.js +8 -4
  15. package/dist/shared/components/chat/chat-drafts.js +60 -43
  16. package/dist/shared/components/item-edit/InlineTableField.js +159 -158
  17. package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
  18. package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
  19. package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
  20. package/dist/shared/components/item-edit/picker-search.js +28 -0
  21. package/dist/shared/components/panels/RevisionsPanel.js +268 -260
  22. package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
  23. package/dist/shared/components/profile/BrowserPushCard.js +135 -89
  24. package/dist/shared/components/profile/push-failure.js +76 -0
  25. package/dist/shared/lib/display-prefs.js +90 -0
  26. package/dist/shared/lib/request-gate.js +140 -127
  27. package/dist/shared/lib/theme-accents.js +21 -16
  28. package/package.json +1 -1
@@ -1,26 +1,30 @@
1
- import { jsx as i, jsxs as d } from "react/jsx-runtime";
2
- import { useQueryClient as de } from "@tanstack/react-query";
3
- import { EyeOff as ce, ArrowLeft as ue, Trash2 as me, Copy as le, FileUp as be, Bot as fe, UploadCloud as pe } from "lucide-react";
4
- import { useState as y, useRef as g, useEffect as k } from "react";
5
- import { toast as Q } from "sonner";
6
- import { useNivaroClient as he, useRecordSurface as ge, useItemEditAuth as ve } from "../../context.js";
7
- import { get as j, post as xe } from "../../lib/commands.js";
8
- import { useLiveRecord as ye, useLiveEvent as I, useLiveRecordEvent as ee, LIVE_ASPECTS as f, batchTouches as ke } from "../../lib/live.js";
9
- import { useOptionalRealtime as we } from "../../lib/realtime.js";
10
- import { useRecordTabsSignal as Ne, useRecordTabs as Te } from "../../lib/record-tabs.js";
11
- import { userErrorMessage as Se } from "../../lib/safe-error.js";
12
- import { formatRelative as Re } from "../../lib/utils.js";
13
- function _e(e, r, l) {
14
- var p;
15
- if (l.active)
1
+ import { jsx as i, jsxs as u } from "react/jsx-runtime";
2
+ import { useQueryClient as ue } from "@tanstack/react-query";
3
+ import { EyeOff as me, ArrowLeft as le, Trash2 as be, Copy as fe, FileUp as pe, Bot as he, UploadCloud as ge } from "lucide-react";
4
+ import { useState as w, useRef as h, useEffect as k } from "react";
5
+ import { toast as O } from "sonner";
6
+ import { useNivaroClient as ve, useRecordSurface as ye, useItemEditAuth as xe } from "../../context.js";
7
+ import { get as U, post as we } from "../../lib/commands.js";
8
+ import { useLiveRecord as ke, useLiveEvent as ee, useLiveRecordEvent as re, LIVE_ASPECTS as g, batchTouches as Se } from "../../lib/live.js";
9
+ import { useOptionalRealtime as Ne } from "../../lib/realtime.js";
10
+ import { useRecordTabsSignal as Re, useRecordTabs as Te } from "../../lib/record-tabs.js";
11
+ import { userErrorMessage as _e } from "../../lib/safe-error.js";
12
+ import { formatRelative as $e } from "../../lib/utils.js";
13
+ function Ee(e, r, d) {
14
+ var b;
15
+ if (d.active)
16
16
  return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
17
- const v = ((p = l.label) == null ? void 0 : p.trim()) || "A record in your tabs";
17
+ const f = ((b = d.label) == null ? void 0 : b.trim()) || "A record in your tabs";
18
18
  return {
19
- text: e ? `${e} moved ${v} to ${r}` : `${v} moved to ${r}`,
20
- open: l.open
19
+ text: e ? `${e} moved ${f} to ${r}` : `${f} moved to ${r}`,
20
+ open: d.open
21
21
  };
22
22
  }
23
- const $e = 8e3, Ee = [
23
+ function De(e, r) {
24
+ const d = e == null ? void 0 : e.user_id;
25
+ return typeof d == "string" && !!r && d.toUpperCase() === String(r).toUpperCase();
26
+ }
27
+ const Ae = 8e3, te = [
24
28
  "item",
25
29
  "rrv-record",
26
30
  "revisions",
@@ -40,26 +44,33 @@ const $e = 8e3, Ee = [
40
44
  "record-integrations",
41
45
  "record-integrity"
42
46
  ];
43
- function De(e, r, l) {
44
- const v = new Set(Ee), p = String(l);
47
+ function Ce(e, r, d) {
48
+ const f = new Set(te), b = String(d);
45
49
  e.removeQueries({
46
- predicate: (m) => v.has(m.queryKey[0]) && m.queryKey[1] === r && String(m.queryKey[2]) === p
50
+ predicate: (c) => f.has(c.queryKey[0]) && c.queryKey[1] === r && String(c.queryKey[2]) === b
51
+ });
52
+ }
53
+ function ze(e, r, d) {
54
+ if (!r || d.length === 0) return;
55
+ const f = new Set(te), b = new Set(d.map(String));
56
+ e.invalidateQueries({
57
+ predicate: (c) => f.has(c.queryKey[0]) && c.queryKey[1] === r && b.has(String(c.queryKey[2]))
47
58
  });
48
59
  }
49
- function Ae({ onBack: e }) {
50
- return /* @__PURE__ */ i("div", { className: "p-6", children: /* @__PURE__ */ d(
60
+ function Le({ onBack: e }) {
61
+ return /* @__PURE__ */ i("div", { className: "p-6", children: /* @__PURE__ */ u(
51
62
  "div",
52
63
  {
53
64
  "data-record-gone": "access",
54
65
  role: "alert",
55
66
  className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
56
67
  children: [
57
- /* @__PURE__ */ i(ce, { className: "h-4 w-4 shrink-0 text-amber-500" }),
58
- /* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
68
+ /* @__PURE__ */ i(me, { className: "h-4 w-4 shrink-0 text-amber-500" }),
69
+ /* @__PURE__ */ u("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
59
70
  /* @__PURE__ */ i("span", { className: "font-semibold", children: "You no longer have access to this record." }),
60
71
  " A role, scope or filter change hid it while you had it open."
61
72
  ] }),
62
- /* @__PURE__ */ d(
73
+ /* @__PURE__ */ u(
63
74
  "button",
64
75
  {
65
76
  type: "button",
@@ -67,7 +78,7 @@ function Ae({ onBack: e }) {
67
78
  "data-record-gone-back": !0,
68
79
  className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
69
80
  children: [
70
- /* @__PURE__ */ i(ue, { className: "h-3.5 w-3.5" }),
81
+ /* @__PURE__ */ i(le, { className: "h-3.5 w-3.5" }),
71
82
  "Back"
72
83
  ]
73
84
  }
@@ -76,107 +87,108 @@ function Ae({ onBack: e }) {
76
87
  }
77
88
  ) });
78
89
  }
79
- const Le = (e) => {
90
+ const Qe = (e) => {
80
91
  var r;
81
92
  return (e == null ? void 0 : e.status) ?? ((r = e == null ? void 0 : e.response) == null ? void 0 : r.status);
82
93
  };
83
- function He({
94
+ function Ge({
84
95
  collection: e,
85
96
  itemId: r,
86
- dirty: l = !1,
87
- loadDenied: v = !1,
88
- onGoneChange: p
97
+ dirty: d = !1,
98
+ loadDenied: f = !1,
99
+ onGoneChange: b
89
100
  }) {
90
- const m = we(), R = he(), w = de(), [D, K] = y(!1), [A, re] = y([]), [o, te] = y(null), [se, L] = y({}), [U, B] = y(!1), [F, P] = y(!1), N = g(null), T = g(null), _ = g(Date.now()), C = g(null), $ = g(p);
91
- $.current = p;
92
- const h = g(null), Y = ge(), H = g(Y);
93
- H.current = Y;
94
- const S = (s) => {
101
+ const c = Ne(), T = ve(), y = ue(), [A, j] = w(!1), [C, se] = w([]), [o, ne] = w(null), [ae, L] = w({}), [B, F] = w(!1), [P, Y] = w(!1), S = h(null), N = h(null), _ = h(Date.now()), Q = h(null), $ = h(b);
102
+ $.current = b;
103
+ const v = h(null), H = ye(), V = h(H);
104
+ V.current = H;
105
+ const R = (s) => {
95
106
  var t;
96
- h.current = s, te(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => De(w, e, r), 0);
107
+ v.current = s, ne(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => Ce(y, e, r), 0);
97
108
  };
98
109
  k(() => {
99
- _.current = Date.now(), C.current = null, L({}), h.current && S(null);
110
+ _.current = Date.now(), Q.current = null, L({}), v.current && R(null);
100
111
  }, [e, r]);
101
- const c = (s) => {
102
- for (const t of s) w.invalidateQueries({ queryKey: t });
103
- }, M = async (s) => {
112
+ const m = (s) => {
113
+ for (const t of s) y.invalidateQueries({ queryKey: t });
114
+ }, q = async (s) => {
104
115
  let t = null;
105
116
  try {
106
- t = (await R.request(
107
- j("/trash/record", { collection: e, item: r })
117
+ t = (await T.request(
118
+ U("/trash/record", { collection: e, item: r })
108
119
  )).data;
109
120
  } catch {
110
121
  t = null;
111
122
  }
112
- const n = !!(t != null && t.deleted_at) && new Date(t.deleted_at).getTime() >= _.current - 6e4;
113
- S(n || s === "deleted" && !t ? {
123
+ const a = !!(t != null && t.deleted_at) && new Date(t.deleted_at).getTime() >= _.current - 6e4;
124
+ R(a || s === "deleted" && !t ? {
114
125
  kind: "deleted",
115
126
  by: (t == null ? void 0 : t.deleted_by_name) ?? null,
116
127
  at: (t == null ? void 0 : t.deleted_at) ?? (/* @__PURE__ */ new Date()).toISOString(),
117
128
  trashId: (t == null ? void 0 : t.trash_id) ?? null,
118
129
  canRestore: !!(t != null && t.can_restore)
119
130
  } : { kind: "access" });
120
- }, ae = async () => {
131
+ }, oe = async () => {
121
132
  var s;
122
133
  try {
123
- const t = (await R.request(
124
- j(`/pipelines/instance/${e}/${r}`)
125
- )).data, n = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
126
- if (!n || n.id === C.current || n.timestamp && new Date(n.timestamp).getTime() < _.current - 5e3 || (C.current = n.id, typeof document < "u" && document.visibilityState === "hidden")) return;
127
- const u = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.user_email || null, x = n.to_state_label ?? "a new state", a = _e(u, x, H.current);
128
- Q.info(
129
- a.text,
130
- a.open ? { action: { label: "Open", onClick: a.open } } : {}
134
+ const t = (await T.request(
135
+ U(`/pipelines/instance/${e}/${r}`)
136
+ )).data, a = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
137
+ if (!a || a.id === Q.current || a.timestamp && new Date(a.timestamp).getTime() < _.current - 5e3 || (Q.current = a.id, typeof document < "u" && document.visibilityState === "hidden")) return;
138
+ const l = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.user_email || null, x = a.to_state_label ?? "a new state", n = Ee(l, x, V.current);
139
+ O.info(
140
+ n.text,
141
+ n.open ? { action: { label: "Open", onClick: n.open } } : {}
131
142
  );
132
143
  } catch {
133
144
  }
134
- }, ne = (s) => {
135
- var n;
145
+ }, ie = (s) => {
146
+ var a;
136
147
  if (s.deleted) {
137
- M("deleted");
148
+ q("deleted");
138
149
  return;
139
150
  }
140
- if (h.current) return;
141
- s.events.some((u) => u.source === "import" && !u.own) && (P(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => P(!1), $e));
142
- const t = (u) => ke(s, u);
143
- if (t(f.state) && (c([
151
+ if (v.current) return;
152
+ s.events.some((l) => l.source === "import" && !l.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), Ae));
153
+ const t = (l) => Se(s, l);
154
+ if (t(g.state) && (m([
144
155
  ["pipeline-instance", e, r],
145
156
  ["pipeline-all-owners", e, r],
146
157
  ["pipeline-instance-owners", e, r],
147
158
  ["pipeline-owners-resolved", e, r],
148
159
  ["approval-brief", e, r]
149
- ]), (n = s.changedFields) != null && n.includes(f.state) && ae()), t(f.addendums) && c([["addendums", e, r]]), t(f.comments) ? c([
160
+ ]), (a = s.changedFields) != null && a.includes(g.state) && oe()), t(g.addendums) && m([["addendums", e, r]]), t(g.comments) ? m([
150
161
  ["comments", e, r],
151
162
  ["comments-related", e, r]
152
- ]) : (t(f.state) || t(f.integrations) || t(f.addendums) || !s.aspectsOnly) && c([["comments-related", e, r]]), t(f.tasks) && c([["tasks", e, r]]), t(f.integrations) && c([
163
+ ]) : (t(g.state) || t(g.integrations) || t(g.addendums) || !s.aspectsOnly) && m([["comments-related", e, r]]), t(g.tasks) && m([["tasks", e, r]]), t(g.integrations) && m([
153
164
  ["erp-submissions", e, r],
154
165
  ["record-integrations", e, r]
155
166
  ]), !s.aspectsOnly) {
156
- if (s.ids.length > 0 && s.ids.every((u) => u === "*")) {
157
- c([
167
+ if (s.ids.length > 0 && s.ids.every((l) => l === "*")) {
168
+ m([
158
169
  ["item", e, r],
159
170
  ["pipeline-instance", e, r]
160
171
  ]);
161
172
  return;
162
173
  }
163
- V();
174
+ z(!0);
164
175
  }
165
- }, V = () => {
166
- c([
176
+ }, z = async (s) => {
177
+ m([
167
178
  ["item", e, r],
168
179
  // Summary mode reads its own copy (#1869) — it diffs + highlights.
169
180
  ["rrv-record", e, r],
170
181
  ["field-touch", e, r],
171
- ["revisions", e, r],
172
- // Who made the write — the field ghosts (#2) attribute from it.
173
- ["last-touch", e, r]
174
- ]), K(!0), T.current && clearTimeout(T.current), T.current = setTimeout(() => K(!1), 4e3);
182
+ ["revisions", e, r]
183
+ ]);
184
+ const t = ["last-touch", e, String(r)];
185
+ await y.invalidateQueries({ queryKey: t }).catch(() => {
186
+ }), !(!s || De(y.getQueryData(t), G.current)) && (j(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => j(!1), 4e3));
175
187
  };
176
- ye(e, r, ne);
177
- const { userId: z } = ve();
178
- Ne(z, "saved", e, r, () => {
179
- h.current || (V(), c([
188
+ ke(e, r, ie);
189
+ const { userId: E } = xe(), G = h(E);
190
+ G.current = E, Re(E, "saved", e, r, () => {
191
+ v.current || (z(!1), m([
180
192
  ["pipeline-instance", e, r],
181
193
  ["comments", e, r],
182
194
  ["tasks", e, r],
@@ -186,13 +198,13 @@ function He({
186
198
  ]));
187
199
  }), k(
188
200
  () => () => {
189
- T.current && clearTimeout(T.current), N.current && clearTimeout(N.current);
201
+ N.current && clearTimeout(N.current), S.current && clearTimeout(S.current);
190
202
  },
191
203
  []
192
- ), I(
204
+ ), ee(
193
205
  "owners:changed",
194
206
  () => {
195
- h.current || c([
207
+ v.current || m([
196
208
  ["pipeline-instance-owners", e, r],
197
209
  ["pipeline-owners-resolved", e, r],
198
210
  ["pipeline-all-owners", e, r],
@@ -200,45 +212,45 @@ function He({
200
212
  ]);
201
213
  },
202
214
  { debounceMs: 400 }
203
- ), ee(
215
+ ), re(
204
216
  "record:integrity",
205
217
  e,
206
218
  r,
207
- () => c([["record-integrity", e, r]])
219
+ () => m([["record-integrity", e, r]])
208
220
  );
209
- const G = g(/* @__PURE__ */ new Map());
210
- ee("record:automation", e, r, (s) => {
221
+ const J = h(/* @__PURE__ */ new Map());
222
+ re("record:automation", e, r, (s) => {
211
223
  const t = String((s == null ? void 0 : s.flow_id) ?? "");
212
224
  if (!t) return;
213
- const n = G.current, u = n.get(t);
214
- u && clearTimeout(u), n.delete(t);
215
- const x = () => L((a) => {
216
- const { [t]: b, ...q } = a;
217
- return q;
225
+ const a = J.current, l = a.get(t);
226
+ l && clearTimeout(l), a.delete(t);
227
+ const x = () => L((n) => {
228
+ const { [t]: p, ...M } = n;
229
+ return M;
218
230
  });
219
231
  if ((s == null ? void 0 : s.state) === "end") {
220
232
  x();
221
233
  return;
222
234
  }
223
- L((a) => ({ ...a, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), n.set(t, setTimeout(x, 5 * 6e4));
235
+ L((n) => ({ ...n, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), a.set(t, setTimeout(x, 5 * 6e4));
224
236
  }), k(() => {
225
- const s = G.current;
237
+ const s = J.current;
226
238
  return () => {
227
239
  for (const t of s.values()) clearTimeout(t);
228
240
  s.clear();
229
241
  };
230
- }, []), I(
242
+ }, []), ee(
231
243
  "access:changed",
232
244
  () => {
233
245
  setTimeout(
234
246
  () => {
235
247
  var s;
236
- ((s = h.current) == null ? void 0 : s.kind) !== "deleted" && R.request(j(`/items/${e}/${r}`, { fields: "id" })).then(() => {
248
+ ((s = v.current) == null ? void 0 : s.kind) !== "deleted" && T.request(U(`/items/${e}/${r}`, { fields: "id" })).then(() => {
237
249
  var t;
238
- ((t = h.current) == null ? void 0 : t.kind) === "access" && (S(null), c([["item", e, r]]));
250
+ ((t = v.current) == null ? void 0 : t.kind) === "access" && (R(null), m([["item", e, r]]));
239
251
  }).catch((t) => {
240
- const n = Le(t);
241
- (n === 403 || n === 404) && M("access");
252
+ const a = Qe(t);
253
+ (a === 403 || a === 404) && q("access");
242
254
  });
243
255
  },
244
256
  Math.floor(Math.random() * 1500)
@@ -246,62 +258,62 @@ function He({
246
258
  },
247
259
  { debounceMs: 300 }
248
260
  ), k(() => {
249
- v && !h.current && M("access");
250
- }, [v]);
251
- const E = Te(e, r, l, z), [oe, J] = y(!1);
261
+ f && !v.current && q("access");
262
+ }, [f]);
263
+ const D = Te(e, r, d, E), [de, W] = w(!1);
252
264
  k(() => {
253
- E.otherDirty || J(!1);
254
- }, [E.otherDirty]), k(() => {
255
- if (!m) return;
256
- const s = (a) => {
257
- const b = a.detail;
258
- b != null && b.name && m.emit("record:uploading", {
265
+ D.otherDirty || W(!1);
266
+ }, [D.otherDirty]), k(() => {
267
+ if (!c) return;
268
+ const s = (n) => {
269
+ const p = n.detail;
270
+ p != null && p.name && c.emit("record:uploading", {
259
271
  collection: e,
260
272
  item: String(r),
261
- name: b.name,
262
- state: b.state
273
+ name: p.name,
274
+ state: p.state
263
275
  });
264
276
  };
265
277
  window.addEventListener("nvr:upload-state", s);
266
- const t = (a) => {
267
- if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r)) return;
268
- const b = String(a.user_name ?? a.user ?? "Someone");
269
- re((q) => {
270
- const X = q.filter((Z) => !(Z.user === b && Z.name === a.name));
271
- return a.state === "start" ? [...X, { user: b, name: String(a.name) }] : X;
278
+ const t = (n) => {
279
+ if ((n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r)) return;
280
+ const p = String(n.user_name ?? n.user ?? "Someone");
281
+ se((M) => {
282
+ const Z = M.filter((I) => !(I.user === p && I.name === n.name));
283
+ return n.state === "start" ? [...Z, { user: p, name: String(n.name) }] : Z;
272
284
  });
273
- }, n = m.on("record:uploading", t), u = m.on("record:comment", (a) => {
274
- (a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r) || (w.invalidateQueries({ queryKey: ["comments", e, r] }), w.invalidateQueries({ queryKey: ["comments-related", e, r] }));
275
- }), x = (a) => t(a.detail);
285
+ }, a = c.on("record:uploading", t), l = c.on("record:comment", (n) => {
286
+ (n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r) || (y.invalidateQueries({ queryKey: ["comments", e, r] }), y.invalidateQueries({ queryKey: ["comments-related", e, r] }));
287
+ }), x = (n) => t(n.detail);
276
288
  return window.addEventListener("nvr:record-uploading", x), () => {
277
- window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", x), n(), u();
289
+ window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", x), a(), l();
278
290
  };
279
- }, [m, e, r, w]);
280
- const ie = async () => {
291
+ }, [c, e, r, y]);
292
+ const ce = async () => {
281
293
  if (o != null && o.trashId) {
282
- B(!0);
294
+ F(!0);
283
295
  try {
284
- await R.request(xe(`/trash/${o.trashId}/restore`, {})), S(null), _.current = Date.now(), c([["item", e, r]]), Q.success("Record restored");
296
+ await T.request(we(`/trash/${o.trashId}/restore`, {})), R(null), _.current = Date.now(), m([["item", e, r]]), O.success("Record restored");
285
297
  } catch (s) {
286
- Q.error(Se(s, "Restore failed"));
298
+ O.error(_e(s, "Restore failed"));
287
299
  } finally {
288
- B(!1);
300
+ F(!1);
289
301
  }
290
302
  }
291
- }, O = Object.values(se), W = E.otherDirty && !oe && !l && !o;
292
- return !o && O.length === 0 && !W && !F && (!m || !D && A.length === 0) ? null : /* @__PURE__ */ d("div", { className: "space-y-2", children: [
293
- (o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ d(
303
+ }, K = Object.values(ae), X = D.otherDirty && !de && !d && !o;
304
+ return !o && K.length === 0 && !X && !P && (!c || !A && C.length === 0) ? null : /* @__PURE__ */ u("div", { className: "space-y-2", children: [
305
+ (o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ u(
294
306
  "div",
295
307
  {
296
308
  "data-record-gone": "deleted",
297
309
  role: "alert",
298
310
  className: "flex items-center gap-3 rounded-lg border border-rose-300 bg-rose-50 px-3.5 py-2.5 dark:border-rose-500/40 dark:bg-rose-500/10",
299
311
  children: [
300
- /* @__PURE__ */ i(me, { className: "h-4 w-4 shrink-0 text-rose-500" }),
301
- /* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
312
+ /* @__PURE__ */ i(be, { className: "h-4 w-4 shrink-0 text-rose-500" }),
313
+ /* @__PURE__ */ u("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
302
314
  /* @__PURE__ */ i("span", { className: "font-semibold", children: "This record was deleted" }),
303
315
  o.by ? ` by ${o.by}` : "",
304
- o.at ? ` ${Re(o.at)}` : "",
316
+ o.at ? ` ${$e(o.at)}` : "",
305
317
  ". Saving is turned off",
306
318
  o.canRestore ? " — restore it to keep working." : "."
307
319
  ] }),
@@ -309,29 +321,29 @@ function He({
309
321
  "button",
310
322
  {
311
323
  type: "button",
312
- onClick: () => void ie(),
313
- disabled: U,
324
+ onClick: () => void ce(),
325
+ disabled: B,
314
326
  className: "h-7 shrink-0 rounded-md border border-rose-300 bg-white px-2.5 text-[11.5px] font-medium text-rose-700 hover:bg-rose-100 disabled:opacity-50 dark:border-rose-500/40 dark:bg-transparent dark:text-rose-300 dark:hover:bg-rose-500/10",
315
- children: U ? "Restoring…" : "Restore"
327
+ children: B ? "Restoring…" : "Restore"
316
328
  }
317
329
  )
318
330
  ]
319
331
  }
320
332
  ),
321
- (o == null ? void 0 : o.kind) === "access" && !p && /* @__PURE__ */ i(Ae, { onBack: () => window.history.back() }),
322
- W && /* @__PURE__ */ d(
333
+ (o == null ? void 0 : o.kind) === "access" && !b && /* @__PURE__ */ i(Le, { onBack: () => window.history.back() }),
334
+ X && /* @__PURE__ */ u(
323
335
  "div",
324
336
  {
325
337
  "data-record-other-tab": !0,
326
338
  className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
327
339
  children: [
328
- /* @__PURE__ */ i(le, { className: "h-4 w-4 shrink-0 text-amber-500" }),
340
+ /* @__PURE__ */ i(fe, { className: "h-4 w-4 shrink-0 text-amber-500" }),
329
341
  /* @__PURE__ */ i("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: "This record is open with unsaved changes in another tab — editing it here too may overwrite them." }),
330
342
  /* @__PURE__ */ i(
331
343
  "button",
332
344
  {
333
345
  type: "button",
334
- onClick: E.focusOther,
346
+ onClick: D.focusOther,
335
347
  className: "h-7 shrink-0 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
336
348
  children: "Switch to that tab"
337
349
  }
@@ -340,7 +352,7 @@ function He({
340
352
  "button",
341
353
  {
342
354
  type: "button",
343
- onClick: () => J(!0),
355
+ onClick: () => W(!0),
344
356
  className: "h-7 shrink-0 rounded-md px-2 text-[11.5px] text-amber-700 hover:bg-amber-100 dark:text-amber-300 dark:hover:bg-amber-500/10",
345
357
  children: "Dismiss"
346
358
  }
@@ -348,51 +360,51 @@ function He({
348
360
  ]
349
361
  }
350
362
  ),
351
- F && !o && /* @__PURE__ */ d(
363
+ P && !o && /* @__PURE__ */ u(
352
364
  "div",
353
365
  {
354
366
  "data-record-importing": !0,
355
367
  role: "status",
356
368
  className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
357
369
  children: [
358
- /* @__PURE__ */ i(be, { className: "h-4 w-4 shrink-0 animate-pulse text-amber-500" }),
359
- /* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
370
+ /* @__PURE__ */ i(pe, { className: "h-4 w-4 shrink-0 animate-pulse text-amber-500" }),
371
+ /* @__PURE__ */ u("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
360
372
  /* @__PURE__ */ i("span", { className: "font-semibold", children: "An import is updating this record" }),
361
373
  " — the changed fields refresh here as it goes.",
362
- l ? " Your unsaved edits may be out of date; check them before saving." : ""
374
+ d ? " Your unsaved edits may be out of date; check them before saving." : ""
363
375
  ] })
364
376
  ]
365
377
  }
366
378
  ),
367
- O.length > 0 && !o && /* @__PURE__ */ d(
379
+ K.length > 0 && !o && /* @__PURE__ */ u(
368
380
  "div",
369
381
  {
370
382
  "data-record-automation": !0,
371
383
  role: "status",
372
384
  className: "flex items-center gap-3 rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/10 px-3.5 py-2.5",
373
385
  children: [
374
- /* @__PURE__ */ i(fe, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
375
- /* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-[#67e8f9]", children: [
386
+ /* @__PURE__ */ i(he, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
387
+ /* @__PURE__ */ u("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-[#67e8f9]", children: [
376
388
  /* @__PURE__ */ i("span", { className: "font-semibold", children: "Automation is updating this record" }),
377
389
  " —",
378
390
  " ",
379
- O.join(", "),
391
+ K.join(", "),
380
392
  ". Its changes appear here when it finishes."
381
393
  ] })
382
394
  ]
383
395
  }
384
396
  ),
385
- m && (D || A.length > 0) && /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
386
- D && /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-0.5 text-[11px] font-medium text-[#0e7490] dark:text-[#67e8f9]", children: [
397
+ c && (A || C.length > 0) && /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-2", children: [
398
+ A && /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-0.5 text-[11px] font-medium text-[#0e7490] dark:text-[#67e8f9]", children: [
387
399
  /* @__PURE__ */ i("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
388
400
  "Updated just now by someone else"
389
401
  ] }),
390
- A.map((s) => /* @__PURE__ */ d(
402
+ C.map((s) => /* @__PURE__ */ u(
391
403
  "span",
392
404
  {
393
405
  className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300",
394
406
  children: [
395
- /* @__PURE__ */ i(pe, { className: "h-3 w-3 animate-pulse text-nvr-cyan" }),
407
+ /* @__PURE__ */ i(ge, { className: "h-3 w-3 animate-pulse text-nvr-cyan" }),
396
408
  s.user,
397
409
  " is uploading “",
398
410
  s.name.length > 32 ? `${s.name.slice(0, 32)}…` : s.name,
@@ -405,9 +417,11 @@ function He({
405
417
  ] });
406
418
  }
407
419
  export {
408
- Ee as RECORD_QUERY_HEADS,
409
- Ae as RecordAccessLostPanel,
410
- He as RecordLiveSync,
411
- _e as moveNotice,
412
- De as purgeRecordQueries
420
+ te as RECORD_QUERY_HEADS,
421
+ Le as RecordAccessLostPanel,
422
+ Ge as RecordLiveSync,
423
+ ze as invalidateRecordQueries,
424
+ Ee as moveNotice,
425
+ Ce as purgeRecordQueries,
426
+ De as writtenBySelf
413
427
  };