@nivaro/react 0.3.26 → 0.3.28

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.
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
9
9
  import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
10
10
  import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
11
11
  import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
12
- const Ue = "nivaro-react@0.3.26", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
+ const Ue = "nivaro-react@0.3.28", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
13
13
  function Be(n) {
14
14
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
15
15
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
@@ -1,229 +1,283 @@
1
- import { jsxs as y, jsx as k } from "react/jsx-runtime";
2
- import { QueryClientContext as Le } from "@tanstack/react-query";
3
- import { Lock as H, LockOpen as ne } from "lucide-react";
4
- import { useContext as Ee, useState as _, useRef as A, useCallback as w, useEffect as N } from "react";
5
- import { toast as u } from "sonner";
6
- import { useNivaroClient as Re, useItemEditAuth as Ce } from "../../context.js";
7
- import { post as C, get as Se, del as K } from "../../lib/commands.js";
8
- import { idleState as qe } from "../../lib/idle.js";
9
- import { useOptionalRealtime as ae, updateTouches as Ae } from "../../lib/realtime.js";
10
- import { announceRecordTabs as se, useRecordTabsSignal as Te } from "../../lib/record-tabs.js";
11
- import { Button as O } from "../ui/button.js";
12
- import { Popover as oe, PopoverTrigger as ie, PopoverContent as le } from "../ui/popover.js";
13
- const Ie = 6e4, Ye = 2 * 6e4, Oe = 3e4, De = 6e4, Me = 15e3;
14
- function je() {
15
- const [t, r] = _(
1
+ import { jsxs as x, jsx as h } from "react/jsx-runtime";
2
+ import { QueryClientContext as Se } from "@tanstack/react-query";
3
+ import { Lock as Z, LockOpen as ie } from "lucide-react";
4
+ import { useContext as qe, useState as L, useRef as A, useCallback as p, useEffect as N } from "react";
5
+ import { toast as l } from "sonner";
6
+ import { useNivaroClient as Ie, useItemEditAuth as Te } from "../../context.js";
7
+ import { post as I, get as Ae, del as K } from "../../lib/commands.js";
8
+ import { idleState as Oe } from "../../lib/idle.js";
9
+ import { useOptionalRealtime as ue, updateTouches as De } from "../../lib/realtime.js";
10
+ import { announceRecordTabs as X, useRecordTabsSignal as Me } from "../../lib/record-tabs.js";
11
+ import { Button as M } from "../ui/button.js";
12
+ import { Popover as le, PopoverTrigger as ce, PopoverContent as de } from "../ui/popover.js";
13
+ const Q = 1e4, fe = 1500, Ye = 2e3, Fe = 5 * 6e4, Pe = 3e4, Be = 6e4, je = 15e3;
14
+ function ze() {
15
+ const [e, r] = L(!0);
16
+ return N(() => {
17
+ if (typeof window > "u" || typeof document > "u") return;
18
+ let o = null, E = null, y = 0;
19
+ const S = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, a = () => {
20
+ E && clearInterval(E), E = null;
21
+ }, $ = (_) => _ instanceof HTMLInputElement && _.type === "file", f = (_) => {
22
+ $(_.target) && (y = Date.now() + Fe);
23
+ }, b = (_) => {
24
+ !$(_.target) || !y || (y = 0, S() || w());
25
+ }, w = () => {
26
+ o && clearTimeout(o);
27
+ const _ = y - Date.now();
28
+ o = setTimeout(
29
+ () => {
30
+ if (o = null, !S()) {
31
+ a(), r(!1);
32
+ return;
33
+ }
34
+ a(), E = setInterval(() => {
35
+ S() || (a(), r(!1));
36
+ }, Ye);
37
+ },
38
+ _ > 0 ? Math.max(_, fe) : fe
39
+ );
40
+ }, m = () => {
41
+ o && clearTimeout(o), o = null, y = 0, a(), r(!0);
42
+ };
43
+ return window.addEventListener("blur", w), window.addEventListener("focus", m), document.addEventListener("click", f, !0), document.addEventListener("change", b, !0), document.addEventListener("cancel", b, !0), () => {
44
+ window.removeEventListener("blur", w), window.removeEventListener("focus", m), document.removeEventListener("click", f, !0), document.removeEventListener("change", b, !0), document.removeEventListener("cancel", b, !0), o && clearTimeout(o), a();
45
+ };
46
+ }, []), e;
47
+ }
48
+ function Ke() {
49
+ const [e, r] = L(
16
50
  () => typeof document > "u" || document.visibilityState !== "hidden"
17
51
  );
18
52
  return N(() => {
19
- const i = () => r(document.visibilityState !== "hidden");
20
- return document.addEventListener("visibilitychange", i), () => document.removeEventListener("visibilitychange", i);
21
- }, []), t;
53
+ const o = () => r(document.visibilityState !== "hidden");
54
+ return document.addEventListener("visibilitychange", o), () => document.removeEventListener("visibilitychange", o);
55
+ }, []), e;
22
56
  }
23
- function Xe(t, r, i, S = {}) {
24
- const { lazy: L = !1, active: T = !0 } = S, s = Re(), { isAdmin: E, userId: g } = Ce(), v = Ee(Le), [p, h] = _(null), [F, $] = _(!1), [D, J] = _(!1), [ce, ue] = _([]), [de, M] = _(null), [fe, G] = _(!1), [ke, X] = _(""), [me, P] = _(!1), [he, Z] = _(!1), j = A(null), l = A(!1), R = A(!1), Q = A(!1), V = A(0), q = A(!1), z = A(null), m = w(() => {
25
- j.current && (clearInterval(j.current), j.current = null);
26
- }, []), U = w(
27
- (a) => {
28
- var e, c;
29
- const n = a, f = n.status ?? ((e = n.response) == null ? void 0 : e.status), o = ((c = n.response) == null ? void 0 : c.data) ?? n.response;
30
- return f !== 403 || (o == null ? void 0 : o.code) !== "EDIT_LOCKED" ? !1 : (m(), l.current = !1, $(!1), u.warning(o.error || "You can no longer edit this record — your edit lock was let go"), v == null || v.invalidateQueries({ queryKey: ["pipeline-instance-lock", t, r] }), v == null || v.invalidateQueries({ queryKey: ["pipeline-instance", t, r] }), !0);
57
+ function nt(e, r, o, E = {}) {
58
+ const { lazy: y = !1, active: S = !0 } = E, a = Ie(), { isAdmin: $, userId: f } = Te(), b = qe(Se), [w, m] = L(null), [_, R] = L(!1), [Y, ee] = L(!1), [me, ke] = L([]), [he, F] = L(null), [be, te] = L(!1), [ve, re] = L(""), [ye, U] = L(!1), [ge, ne] = L(!1), B = A(null), i = A(!1), q = A(!1), H = A(!1), V = A(0), T = A(!1), P = A(null), v = p(() => {
59
+ B.current && (clearInterval(B.current), B.current = null);
60
+ }, []), W = p(
61
+ (s) => {
62
+ var t, c;
63
+ const n = s, k = n.status ?? ((t = n.response) == null ? void 0 : t.status), u = ((c = n.response) == null ? void 0 : c.data) ?? n.response;
64
+ return k !== 403 || (u == null ? void 0 : u.code) !== "EDIT_LOCKED" ? !1 : (v(), i.current = !1, R(!1), l.warning(u.error || "You can no longer edit this record — your edit lock was let go"), b == null || b.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, r] }), b == null || b.invalidateQueries({ queryKey: ["pipeline-instance", e, r] }), !0);
31
65
  },
32
- [v, t, r, m]
33
- ), d = w(async () => {
34
- var a, n;
35
- if (!t || !r || q.current) return !1;
36
- z.current = null;
66
+ [b, e, r, v]
67
+ ), d = p(async () => {
68
+ var s, n;
69
+ if (!e || !r || T.current) return !1;
70
+ P.current = null;
37
71
  try {
38
- return await s.request(C(`/item-locks/${t}/${r}/lock`, {})), l.current = !0, $(!0), P(!1), h(null), m(), j.current = setInterval(() => {
39
- const f = Math.max(
72
+ return await a.request(
73
+ I(`/item-locks/${e}/${r}/lock`, { beat_ms: Q })
74
+ ), i.current = !0, R(!0), U(!1), m(null), v(), B.current = setInterval(() => {
75
+ const k = Math.max(
40
76
  0,
41
- Math.floor((Date.now() - new Date(qe().last_active).getTime()) / 1e3)
77
+ Math.floor((Date.now() - new Date(Oe().last_active).getTime()) / 1e3)
42
78
  );
43
- s.request(C(`/item-locks/${t}/${r}/heartbeat`, { idle_seconds: f })).then((o) => {
44
- if (!(o != null && o.idle_released)) return;
45
- m(), l.current = !1, $(!1), u.info(
79
+ a.request(
80
+ I(`/item-locks/${e}/${r}/heartbeat`, {
81
+ idle_seconds: k,
82
+ beat_ms: Q
83
+ })
84
+ ).then((u) => {
85
+ if (!(u != null && u.idle_released)) return;
86
+ v(), i.current = !1, R(!1), l.info(
46
87
  "Your edit lock was released after inactivity — it re-locks when you resume."
47
88
  );
48
- const e = () => {
49
- window.removeEventListener("pointerdown", e, !0), window.removeEventListener("keydown", e, !0), d();
89
+ const t = () => {
90
+ window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", t, !0), d();
50
91
  };
51
- window.addEventListener("pointerdown", e, !0), window.addEventListener("keydown", e, !0);
52
- }).catch((o) => {
53
- var te, re;
54
- const e = o, c = e.status ?? ((te = e.response) == null ? void 0 : te.status);
55
- if (U(o) || c !== 404 && c !== 409) return;
56
- const x = ((re = e.response) == null ? void 0 : re.data) ?? e.response;
57
- if (c === 404 && !(x != null && x.locked_by)) {
92
+ window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", t, !0);
93
+ }).catch((u) => {
94
+ var ae, oe;
95
+ const t = u, c = t.status ?? ((ae = t.response) == null ? void 0 : ae.status);
96
+ if (W(u) || c !== 404 && c !== 409) return;
97
+ const C = ((oe = t.response) == null ? void 0 : oe.data) ?? t.response;
98
+ if (c === 404 && !(C != null && C.locked_by)) {
58
99
  d();
59
100
  return;
60
101
  }
61
- m(), l.current = !1, $(!1), x != null && x.locked_by && (h({
62
- locked_by: x.locked_by,
63
- locked_by_name: x.locked_by_name ?? null
64
- }), u.warning(
65
- `${x.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
102
+ v(), i.current = !1, R(!1), C != null && C.locked_by && (m({
103
+ locked_by: C.locked_by,
104
+ locked_by_name: C.locked_by_name ?? null
105
+ }), l.warning(
106
+ `${C.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
66
107
  ));
67
108
  });
68
- }, Ie), !0;
69
- } catch (f) {
70
- const o = f, e = o.status ?? ((a = o.response) == null ? void 0 : a.status), c = ((n = o.response) == null ? void 0 : n.data) ?? o.response;
71
- return z.current = e ?? null, U(f) ? !1 : e === 404 ? (q.current = !0, m(), l.current = !1, $(!1), !1) : (e === 409 && (c != null && c.locked_by) && (l.current = !1, $(!1), h({
109
+ }, Q), !0;
110
+ } catch (k) {
111
+ const u = k, t = u.status ?? ((s = u.response) == null ? void 0 : s.status), c = ((n = u.response) == null ? void 0 : n.data) ?? u.response;
112
+ return P.current = t ?? null, W(k) ? !1 : t === 404 ? (T.current = !0, v(), i.current = !1, R(!1), !1) : (t === 409 && (c != null && c.locked_by) && (i.current = !1, R(!1), m({
72
113
  locked_by: c.locked_by,
73
114
  locked_by_name: c.locked_by_name ?? null,
74
115
  ...typeof c.may_take_over == "boolean" ? { may_take_over: c.may_take_over } : {}
75
116
  })), !1);
76
117
  }
77
- }, [s, t, r, m, U]), b = w(async () => {
78
- if (!(!t || !r))
118
+ }, [a, e, r, v, W]), g = p(async () => {
119
+ if (!(!e || !r))
79
120
  try {
80
- const a = await s.request(Se(`/item-locks/${t}/${r}/lock`)), n = a == null ? void 0 : a.data;
81
- ue(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), M(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
82
- const f = (n == null ? void 0 : n.is_mine) === !0 || !!g && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === g.toLowerCase(), o = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
83
- if (l.current) return;
84
- if (!(n != null && n.locked_by) || f) {
85
- h(null);
121
+ const s = await a.request(Ae(`/item-locks/${e}/${r}/lock`)), n = s == null ? void 0 : s.data;
122
+ ke(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), F(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
123
+ const k = (n == null ? void 0 : n.is_mine) === !0 || !!f && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === f.toLowerCase(), u = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
124
+ if (i.current) return;
125
+ if (!(n != null && n.locked_by) || k) {
126
+ m(null);
86
127
  return;
87
128
  }
88
- h(
89
- (e) => e && e.locked_by === String(n.locked_by) ? {
90
- ...e,
91
- note: n.note ?? e.note ?? null,
92
- idle_minutes: n.locked_by_idle_minutes ?? e.idle_minutes ?? null,
93
- ...o
129
+ m(
130
+ (t) => t && t.locked_by === String(n.locked_by) ? {
131
+ ...t,
132
+ note: n.note ?? t.note ?? null,
133
+ idle_minutes: n.locked_by_idle_minutes ?? t.idle_minutes ?? null,
134
+ ...u
94
135
  } : {
95
136
  locked_by: String(n.locked_by),
96
137
  locked_by_name: n.locked_by_name ?? null,
97
138
  note: n.note ?? null,
98
139
  idle_minutes: n.locked_by_idle_minutes ?? null,
99
- ...o
140
+ ...u
100
141
  }
101
- ), P(!1);
102
- } catch (a) {
103
- (a == null ? void 0 : a.status) === 404 && (q.current = !0);
142
+ ), U(!1);
143
+ } catch (s) {
144
+ (s == null ? void 0 : s.status) === 404 && (T.current = !0);
104
145
  }
105
- }, [s, t, r, g]), I = (p == null ? void 0 : p.locked_by) ?? null;
146
+ }, [a, e, r, f]), O = (w == null ? void 0 : w.locked_by) ?? null;
106
147
  N(() => {
107
- I && b();
108
- }, [I, b]), N(() => {
109
- if (!I) return;
110
- const a = setInterval(() => void b(), Oe);
111
- return () => clearInterval(a);
112
- }, [I, b]), N(() => {
113
- if (!(!i || !t || !r))
114
- return R.current = !1, q.current = !1, L ? b() : d(), () => {
115
- m(), R.current = !1, l.current && (l.current = !1, s.request(K(`/item-locks/${t}/${r}/lock`)).then(() => se(g, "lock-released", t, r)).catch(() => {
148
+ O && g();
149
+ }, [O, g]), N(() => {
150
+ if (!O) return;
151
+ const s = setInterval(() => void g(), Pe);
152
+ return () => clearInterval(s);
153
+ }, [O, g]), N(() => {
154
+ if (!(!o || !e || !r))
155
+ return q.current = !1, T.current = !1, y ? g() : d(), () => {
156
+ v(), q.current = !1, i.current && (i.current = !1, a.request(K(`/item-locks/${e}/${r}/lock`)).then(() => X(f, "lock-released", e, r)).catch(() => {
116
157
  }));
117
158
  };
118
- }, [i, t, r, d, s, m, g, L, b]);
119
- const be = w(async () => {
120
- if (!(!i || l.current || Q.current) && !(Date.now() < V.current)) {
121
- Q.current = !0;
159
+ }, [o, e, r, d, a, v, f, y, g]);
160
+ const we = p(async () => {
161
+ if (!(!o || i.current || H.current) && !(Date.now() < V.current)) {
162
+ H.current = !0;
122
163
  try {
123
- const a = await d();
124
- !a && z.current === 409 && u.warning("Someone else is editing this record — your change can’t be saved yet"), !a && z.current !== 409 && !q.current && (V.current = Date.now() + Me);
164
+ const s = await d();
165
+ !s && P.current === 409 && l.warning("Someone else is editing this record — your change can’t be saved yet"), !s && P.current !== 409 && !T.current && (V.current = Date.now() + je);
125
166
  } finally {
126
- Q.current = !1;
167
+ H.current = !1;
127
168
  }
128
169
  }
129
- }, [i, d]);
170
+ }, [o, d]);
130
171
  N(() => {
131
- const a = () => {
172
+ const s = () => {
132
173
  V.current = 0;
133
174
  };
134
- return window.addEventListener("online", a), () => window.removeEventListener("online", a);
175
+ return window.addEventListener("online", s), () => window.removeEventListener("online", s);
135
176
  }, []);
136
- const ye = je(), B = T && ye;
177
+ const j = p(() => {
178
+ var s;
179
+ if (!(!e || !r))
180
+ try {
181
+ const n = (s = a.getToken) == null ? void 0 : s.call(a), k = a.url ?? "";
182
+ fetch(
183
+ `${k}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(r)}/lock/release`,
184
+ {
185
+ method: "POST",
186
+ keepalive: !0,
187
+ credentials: n ? "omit" : "include",
188
+ headers: n ? { Authorization: `Bearer ${n}` } : {}
189
+ }
190
+ ).then(() => X(f, "lock-released", e, r)).catch(() => {
191
+ });
192
+ } catch {
193
+ }
194
+ }, [a, e, r, f]), J = Ke(), xe = ze(), z = S && J && xe;
137
195
  N(() => {
138
- if (!i || !t || !r) return;
139
- if (B) {
140
- R.current && (R.current = !1, d());
141
- return;
142
- }
143
- const a = setTimeout(() => {
144
- l.current && (m(), l.current = !1, $(!1), R.current = !0, s.request(K(`/item-locks/${t}/${r}/lock`)).then(() => se(g, "lock-released", t, r)).catch(() => {
145
- }));
146
- }, Ye);
147
- return () => clearTimeout(a);
148
- }, [i, B, t, r, d, s, m, g]), N(() => {
149
- if (!i || !L || !t || !r || I || !B) return;
150
- const a = setInterval(() => {
151
- !l.current && !q.current && b();
152
- }, De);
153
- return () => clearInterval(a);
154
- }, [i, L, t, r, I, B, b]), N(() => {
155
- if (!i || !t || !r) return;
156
- const a = () => {
157
- var f;
158
- if (l.current) {
159
- m(), l.current = !1, R.current = !0;
160
- try {
161
- const o = (f = s.getToken) == null ? void 0 : f.call(s), e = s.url ?? "";
162
- fetch(
163
- `${e}/api/item-locks/${encodeURIComponent(t)}/${encodeURIComponent(r)}/lock/release`,
164
- {
165
- method: "POST",
166
- keepalive: !0,
167
- credentials: o ? "omit" : "include",
168
- headers: o ? { Authorization: `Bearer ${o}` } : {}
169
- }
170
- ).catch(() => {
171
- });
172
- } catch {
173
- }
196
+ if (!(!o || !e || !r)) {
197
+ if (z) {
198
+ q.current && (q.current = !1, d().then((s) => {
199
+ !s && P.current === 409 && l.warning(
200
+ "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it"
201
+ );
202
+ }));
203
+ return;
174
204
  }
175
- }, n = (f) => {
176
- f.persisted && R.current && (R.current = !1, d());
205
+ i.current && (v(), i.current = !1, R(!1), q.current = !0, J ? a.request(K(`/item-locks/${e}/${r}/lock`)).then(() => X(f, "lock-released", e, r)).catch(() => {
206
+ }) : j());
207
+ }
208
+ }, [
209
+ o,
210
+ z,
211
+ J,
212
+ e,
213
+ r,
214
+ d,
215
+ a,
216
+ v,
217
+ f,
218
+ j
219
+ ]), N(() => {
220
+ if (!o || !y || !e || !r || O || !z) return;
221
+ const s = setInterval(() => {
222
+ !i.current && !T.current && g();
223
+ }, Be);
224
+ return () => clearInterval(s);
225
+ }, [o, y, e, r, O, z, g]), N(() => {
226
+ if (!o || !e || !r) return;
227
+ const s = () => {
228
+ i.current && (v(), i.current = !1, q.current = !0, j());
229
+ }, n = (k) => {
230
+ k.persisted && q.current && (q.current = !1, d());
177
231
  };
178
- return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
179
- window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
232
+ return window.addEventListener("pagehide", s), window.addEventListener("pageshow", n), () => {
233
+ window.removeEventListener("pagehide", s), window.removeEventListener("pageshow", n);
180
234
  };
181
- }, [i, t, r, s, m, d]), Te(g, "lock-released", t, r, () => {
182
- i && l.current && d();
235
+ }, [o, e, r, v, d, j]), Me(f, "lock-released", e, r, () => {
236
+ o && i.current && d();
183
237
  });
184
- const W = ae();
238
+ const G = ue();
185
239
  N(() => {
186
- if (!(!i || !W || !t || !r))
187
- return W.subscribeCollections([t], (a) => {
240
+ if (!(!o || !G || !e || !r))
241
+ return G.subscribeCollections([e], (s) => {
188
242
  var n;
189
- l.current || q.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !Ae(a, r) || b();
243
+ i.current || T.current || !((n = s.changed_fields) != null && n.includes("$lock")) || !De(s, r) || g();
190
244
  });
191
- }, [i, W, t, r, b]);
192
- const Y = ae(), [ge, ee] = _(!1), ve = w(async () => {
193
- if (!(!t || !r)) {
194
- ee(!0);
245
+ }, [o, G, e, r, g]);
246
+ const D = ue(), [_e, se] = L(!1), pe = p(async () => {
247
+ if (!(!e || !r)) {
248
+ se(!0);
195
249
  try {
196
- await s.request(C(`/item-locks/${t}/${r}/lock/request`, {})), u.success("Asked the current editor to release the lock");
250
+ await a.request(I(`/item-locks/${e}/${r}/lock/request`, {})), l.success("Asked the current editor to release the lock");
197
251
  } catch {
198
- u.error("Could not send the lock request");
252
+ l.error("Could not send the lock request");
199
253
  } finally {
200
- ee(!1);
254
+ se(!1);
201
255
  }
202
256
  }
203
- }, [s, t, r]);
257
+ }, [a, e, r]);
204
258
  N(() => {
205
- if (!Y || !t || !r) return;
206
- const a = Y.on("lock:requested", (e) => {
207
- if ((e == null ? void 0 : e.collection) !== t || String(e == null ? void 0 : e.item) !== String(r) || !l.current) return;
208
- const c = (e == null ? void 0 : e.from) ?? {};
209
- u(`${c.name ?? "Someone"} is asking you to release this record`, {
259
+ if (!D || !e || !r) return;
260
+ const s = D.on("lock:requested", (t) => {
261
+ if ((t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || !i.current) return;
262
+ const c = (t == null ? void 0 : t.from) ?? {};
263
+ l(`${c.name ?? "Someone"} is asking you to release this record`, {
210
264
  duration: 3e4,
211
265
  action: {
212
266
  label: "Release",
213
267
  onClick: () => {
214
- m(), l.current = !1, $(!1), s.request(
215
- C(`/item-locks/${t}/${r}/lock/respond`, {
268
+ v(), i.current = !1, R(!1), a.request(
269
+ I(`/item-locks/${e}/${r}/lock/respond`, {
216
270
  to: c.id,
217
271
  action: "release"
218
272
  })
219
- ).then(() => u.success("Lock released")).catch(() => u.error("Failed to release the lock"));
273
+ ).then(() => l.success("Lock released")).catch(() => l.error("Failed to release the lock"));
220
274
  }
221
275
  },
222
276
  cancel: {
223
277
  label: "Keep editing",
224
278
  onClick: () => {
225
- s.request(
226
- C(`/item-locks/${t}/${r}/lock/respond`, {
279
+ a.request(
280
+ I(`/item-locks/${e}/${r}/lock/respond`, {
227
281
  to: c.id,
228
282
  action: "decline"
229
283
  })
@@ -232,125 +286,127 @@ function Xe(t, r, i, S = {}) {
232
286
  }
233
287
  }
234
288
  });
235
- }), n = Y.on("lock:response", (e) => {
236
- var c, x;
237
- (e == null ? void 0 : e.collection) !== t || String(e == null ? void 0 : e.item) !== String(r) || l.current || ((e == null ? void 0 : e.action) === "release" ? (u.success(`${((c = e == null ? void 0 : e.from) == null ? void 0 : c.name) ?? "The editor"} released the lock — it's yours`), d()) : u.warning(
238
- `${((x = e == null ? void 0 : e.from) == null ? void 0 : x.name) ?? "The editor"} is keeping the lock${e != null && e.note ? `: "${e.note}"` : ""}`
289
+ }), n = D.on("lock:response", (t) => {
290
+ var c, C;
291
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || ((t == null ? void 0 : t.action) === "release" ? (l.success(`${((c = t == null ? void 0 : t.from) == null ? void 0 : c.name) ?? "The editor"} released the lock — it's yours`), d()) : l.warning(
292
+ `${((C = t == null ? void 0 : t.from) == null ? void 0 : C.name) ?? "The editor"} is keeping the lock${t != null && t.note ? `: "${t.note}"` : ""}`
239
293
  ));
240
- }), f = Y.on("lock:available", (e) => {
241
- (e == null ? void 0 : e.collection) !== t || String(e == null ? void 0 : e.item) !== String(r) || l.current || (u.success("Your turn — the edit lock is yours"), M(null), d());
242
- }), o = Y.on("lock:queued", (e) => {
243
- (e == null ? void 0 : e.collection) !== t || String(e == null ? void 0 : e.item) !== String(r) || (l.current && u(`${(e == null ? void 0 : e.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), b());
294
+ }), k = D.on("lock:available", (t) => {
295
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || (l.success("Your turn — the edit lock is yours"), F(null), d());
296
+ }), u = D.on("lock:queued", (t) => {
297
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || (i.current && l(`${(t == null ? void 0 : t.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), g());
244
298
  });
245
299
  return () => {
246
- a(), n(), f(), o();
300
+ s(), n(), k(), u();
247
301
  };
248
- }, [Y, t, r, s, d, m, b]);
249
- const xe = w(async () => {
250
- if (!(!t || !r)) {
251
- G(!0);
302
+ }, [D, e, r, a, d, v, g]);
303
+ const Le = p(async () => {
304
+ if (!(!e || !r)) {
305
+ te(!0);
252
306
  try {
253
- const a = await s.request(
254
- C(`/item-locks/${t}/${r}/lock/queue`, {})
255
- ), n = a == null ? void 0 : a.data;
307
+ const s = await a.request(
308
+ I(`/item-locks/${e}/${r}/lock/queue`, {})
309
+ ), n = s == null ? void 0 : s.data;
256
310
  if (n != null && n.free) {
257
- M(null), h(null), u.success("Nobody is editing this record now — go ahead");
311
+ F(null), m(null), l.success("Nobody is editing this record now — go ahead");
258
312
  return;
259
313
  }
260
- const f = n == null ? void 0 : n.position;
261
- M(typeof f == "number" ? f : 1), u.success("You are in line — the lock comes to you automatically when it frees up"), b();
314
+ const k = n == null ? void 0 : n.position;
315
+ F(typeof k == "number" ? k : 1), l.success("You are in line — the lock comes to you automatically when it frees up"), g();
262
316
  } catch {
263
- u.error("Could not join the queue");
317
+ l.error("Could not join the queue");
264
318
  } finally {
265
- G(!1);
319
+ te(!1);
266
320
  }
267
321
  }
268
- }, [s, t, r, b]), we = w(async () => {
269
- if (!(!t || !r))
322
+ }, [a, e, r, g]), Ee = p(async () => {
323
+ if (!(!e || !r))
270
324
  try {
271
- await s.request(K(`/item-locks/${t}/${r}/lock/queue`)), M(null), b();
325
+ await a.request(K(`/item-locks/${e}/${r}/lock/queue`)), F(null), g();
272
326
  } catch {
273
327
  }
274
- }, [s, t, r, b]), _e = w(
275
- async (a) => {
276
- if (!(!t || !r || !l.current)) {
277
- X(a);
328
+ }, [a, e, r, g]), $e = p(
329
+ async (s) => {
330
+ if (!(!e || !r || !i.current)) {
331
+ re(s);
278
332
  try {
279
- await s.request(C(`/item-locks/${t}/${r}/lock/note`, { note: a }));
333
+ await a.request(I(`/item-locks/${e}/${r}/lock/note`, { note: s }));
280
334
  } catch {
281
335
  }
282
336
  }
283
337
  },
284
- [s, t, r]
285
- ), pe = w(async () => {
286
- if (!(!t || !r || !l.current)) {
287
- Z(!0), m(), l.current = !1, $(!1);
338
+ [a, e, r]
339
+ ), Ce = p(async () => {
340
+ if (!(!e || !r || !i.current)) {
341
+ ne(!0), v(), i.current = !1, R(!1);
288
342
  try {
289
- await s.request(K(`/item-locks/${t}/${r}/lock`)), P(!0), X(""), u.success("Lock released — anyone can edit this record now");
343
+ await a.request(K(`/item-locks/${e}/${r}/lock`)), U(!0), re(""), l.success("Lock released — anyone can edit this record now");
290
344
  } catch {
291
- u.error("Failed to release the lock"), d();
345
+ l.error("Failed to release the lock"), d();
292
346
  } finally {
293
- Z(!1);
347
+ ne(!1);
294
348
  }
295
349
  }
296
- }, [s, t, r, m, d]), $e = w(async () => {
297
- if (l.current) return !0;
298
- const a = await d();
299
- return a && u.success("You hold the edit lock again"), a;
300
- }, [d]), Ne = w(async () => {
301
- var a;
302
- if (!(!t || !r)) {
303
- J(!0);
350
+ }, [a, e, r, v, d]), Ne = p(async () => {
351
+ if (i.current) return !0;
352
+ const s = await d();
353
+ return s && l.success("You hold the edit lock again"), s;
354
+ }, [d]), Re = p(async () => {
355
+ var s;
356
+ if (!(!e || !r)) {
357
+ ee(!0);
304
358
  try {
305
- await s.request(C(`/item-locks/${t}/${r}/lock/force`, {})), u.success("You now hold the edit lock"), await d();
359
+ await a.request(
360
+ I(`/item-locks/${e}/${r}/lock/force`, { beat_ms: Q })
361
+ ), l.success("You now hold the edit lock"), await d();
306
362
  } catch (n) {
307
- const f = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
308
- u.error(f), (n == null ? void 0 : n.status) === 403 && h((o) => o && { ...o, may_take_over: !1 });
363
+ const k = ((s = n == null ? void 0 : n.response) == null ? void 0 : s.error) ?? "Failed to take over the lock";
364
+ l.error(k), (n == null ? void 0 : n.status) === 403 && m((u) => u && { ...u, may_take_over: !1 });
309
365
  } finally {
310
- J(!1);
366
+ ee(!1);
311
367
  }
312
368
  }
313
- }, [s, t, r, d]);
369
+ }, [a, e, r, d]);
314
370
  return {
315
- lockHolder: p,
316
- acquired: F,
317
- isReadOnly: !!p,
318
- takeOver: Ne,
319
- takingOver: D,
320
- isAdmin: E,
321
- requestLock: ve,
322
- requesting: ge,
323
- queue: ce,
324
- myPosition: de,
325
- joinQueue: xe,
326
- leaveQueue: we,
327
- joining: fe,
328
- myNote: ke,
329
- saveNote: _e,
330
- release: pe,
331
- releasing: he,
332
- released: me,
333
- relock: $e,
334
- claim: be
371
+ lockHolder: w,
372
+ acquired: _,
373
+ isReadOnly: !!w,
374
+ takeOver: Re,
375
+ takingOver: Y,
376
+ isAdmin: $,
377
+ requestLock: pe,
378
+ requesting: _e,
379
+ queue: me,
380
+ myPosition: he,
381
+ joinQueue: Le,
382
+ leaveQueue: Ee,
383
+ joining: be,
384
+ myNote: ve,
385
+ saveNote: $e,
386
+ release: Ce,
387
+ releasing: ge,
388
+ released: ye,
389
+ relock: Ne,
390
+ claim: we
335
391
  };
336
392
  }
337
- function Ze({
338
- note: t,
393
+ function st({
394
+ note: e,
339
395
  onSave: r,
340
- waiting: i,
341
- onRelease: S,
342
- releasing: L,
343
- released: T,
344
- onRelock: s
396
+ waiting: o,
397
+ onRelease: E,
398
+ releasing: y,
399
+ released: S,
400
+ onRelock: a
345
401
  }) {
346
- var p;
347
- const [E, g] = _(t);
348
- N(() => g(t), [t]);
349
- const v = () => {
350
- E.trim() !== t && r(E.trim());
402
+ var w;
403
+ const [$, f] = L(e);
404
+ N(() => f(e), [e]);
405
+ const b = () => {
406
+ $.trim() !== e && r($.trim());
351
407
  };
352
- return T ? /* @__PURE__ */ y(oe, { children: [
353
- /* @__PURE__ */ k(ie, { asChild: !0, children: /* @__PURE__ */ k(
408
+ return S ? /* @__PURE__ */ x(le, { children: [
409
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ h(
354
410
  "button",
355
411
  {
356
412
  type: "button",
@@ -358,117 +414,117 @@ function Ze({
358
414
  title: "Lock released — anyone can edit this record",
359
415
  "data-lock-released": !0,
360
416
  className: "relative inline-flex h-8 w-8 items-center justify-center text-slate-400 transition-colors hover:bg-accent hover:text-accent-foreground dark:text-slate-500",
361
- children: /* @__PURE__ */ k(ne, { className: "h-4 w-4", strokeWidth: 2 })
417
+ children: /* @__PURE__ */ h(ie, { className: "h-4 w-4", strokeWidth: 2 })
362
418
  }
363
419
  ) }),
364
- /* @__PURE__ */ y(le, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
365
- /* @__PURE__ */ k("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
366
- /* @__PURE__ */ k("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
367
- /* @__PURE__ */ y(
368
- O,
420
+ /* @__PURE__ */ x(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
421
+ /* @__PURE__ */ h("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
422
+ /* @__PURE__ */ h("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
423
+ /* @__PURE__ */ x(
424
+ M,
369
425
  {
370
426
  type: "button",
371
427
  size: "sm",
372
428
  className: "mt-2 h-7 w-full text-[12px]",
373
- onClick: s,
429
+ onClick: a,
374
430
  "data-lock-relock": !0,
375
431
  children: [
376
- /* @__PURE__ */ k(H, { className: "mr-1.5 h-3.5 w-3.5" }),
432
+ /* @__PURE__ */ h(Z, { className: "mr-1.5 h-3.5 w-3.5" }),
377
433
  " Lock again"
378
434
  ]
379
435
  }
380
436
  )
381
437
  ] })
382
- ] }) : /* @__PURE__ */ y(oe, { children: [
383
- /* @__PURE__ */ k(ie, { asChild: !0, children: /* @__PURE__ */ y(
438
+ ] }) : /* @__PURE__ */ x(le, { children: [
439
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ x(
384
440
  "button",
385
441
  {
386
442
  type: "button",
387
443
  "aria-label": "You hold the edit lock — add a note for others",
388
- title: i.length > 0 ? `You hold the edit lock · ${i.length} waiting` : "You hold the edit lock",
444
+ title: o.length > 0 ? `You hold the edit lock · ${o.length} waiting` : "You hold the edit lock",
389
445
  "data-lock-holder": !0,
390
446
  className: "relative inline-flex h-8 w-8 items-center justify-center text-[#0e7490] transition-colors hover:bg-accent hover:text-accent-foreground dark:text-nvr-cyan",
391
447
  children: [
392
- /* @__PURE__ */ k(H, { className: "h-4 w-4", strokeWidth: 2 }),
393
- i.length > 0 && /* @__PURE__ */ k("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
448
+ /* @__PURE__ */ h(Z, { className: "h-4 w-4", strokeWidth: 2 }),
449
+ o.length > 0 && /* @__PURE__ */ h("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
394
450
  ]
395
451
  }
396
452
  ) }),
397
- /* @__PURE__ */ y(le, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
398
- /* @__PURE__ */ k("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
399
- /* @__PURE__ */ k("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
400
- /* @__PURE__ */ k(
453
+ /* @__PURE__ */ x(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
454
+ /* @__PURE__ */ h("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
455
+ /* @__PURE__ */ h("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
456
+ /* @__PURE__ */ h(
401
457
  "input",
402
458
  {
403
- value: E,
404
- onChange: (h) => g(h.target.value.slice(0, 300)),
405
- onBlur: v,
406
- onKeyDown: (h) => {
407
- h.key === "Enter" && (h.preventDefault(), v());
459
+ value: $,
460
+ onChange: (m) => f(m.target.value.slice(0, 300)),
461
+ onBlur: b,
462
+ onKeyDown: (m) => {
463
+ m.key === "Enter" && (m.preventDefault(), b());
408
464
  },
409
465
  placeholder: "“editing lines, ~15 min”",
410
466
  "aria-label": "Lock note",
411
467
  className: "mt-2 h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card"
412
468
  }
413
469
  ),
414
- i.length > 0 && /* @__PURE__ */ y("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
415
- /* @__PURE__ */ y("span", { className: "font-semibold", children: [
416
- i.length,
470
+ o.length > 0 && /* @__PURE__ */ x("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
471
+ /* @__PURE__ */ x("span", { className: "font-semibold", children: [
472
+ o.length,
417
473
  " waiting for the lock:"
418
474
  ] }),
419
475
  " ",
420
- i.map((h) => h.name ?? "someone").join(", ")
476
+ o.map((m) => m.name ?? "someone").join(", ")
421
477
  ] }),
422
- S && /* @__PURE__ */ y(
423
- O,
478
+ E && /* @__PURE__ */ x(
479
+ M,
424
480
  {
425
481
  type: "button",
426
482
  variant: "outline",
427
483
  size: "sm",
428
484
  className: "mt-2 h-7 w-full text-[12px]",
429
- onClick: S,
430
- disabled: L,
485
+ onClick: E,
486
+ disabled: y,
431
487
  "data-lock-release": !0,
432
488
  children: [
433
- /* @__PURE__ */ k(ne, { className: "mr-1.5 h-3.5 w-3.5" }),
434
- L ? "Releasing…" : i.length > 0 ? `Release lock to ${((p = i[0]) == null ? void 0 : p.name) ?? "the next person"}` : "Release lock"
489
+ /* @__PURE__ */ h(ie, { className: "mr-1.5 h-3.5 w-3.5" }),
490
+ y ? "Releasing…" : o.length > 0 ? `Release lock to ${((w = o[0]) == null ? void 0 : w.name) ?? "the next person"}` : "Release lock"
435
491
  ]
436
492
  }
437
493
  )
438
494
  ] })
439
495
  ] });
440
496
  }
441
- function et({
442
- lockHolder: t,
497
+ function at({
498
+ lockHolder: e,
443
499
  onTakeOver: r,
444
- takingOver: i,
445
- isAdmin: S,
446
- onRequestLock: L,
447
- requesting: T,
448
- queue: s,
449
- myPosition: E,
450
- onJoinQueue: g,
451
- onLeaveQueue: v,
452
- joining: p,
453
- noun: h = "this item",
454
- readOnlyText: F = "fields are read-only"
500
+ takingOver: o,
501
+ isAdmin: E,
502
+ onRequestLock: y,
503
+ requesting: S,
504
+ queue: a,
505
+ myPosition: $,
506
+ onJoinQueue: f,
507
+ onLeaveQueue: b,
508
+ joining: w,
509
+ noun: m = "this item",
510
+ readOnlyText: _ = "fields are read-only"
455
511
  }) {
456
- if (!t) return null;
457
- const $ = t.locked_by_name || "Another user", D = (s == null ? void 0 : s.length) ?? 0;
458
- return /* @__PURE__ */ y(
512
+ if (!e) return null;
513
+ const R = e.locked_by_name || "Another user", Y = (a == null ? void 0 : a.length) ?? 0;
514
+ return /* @__PURE__ */ x(
459
515
  "div",
460
516
  {
461
517
  className: "mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100",
462
518
  "data-lock-banner": !0,
463
519
  children: [
464
- /* @__PURE__ */ k(H, { className: "h-4 w-4 shrink-0 text-amber-500" }),
465
- /* @__PURE__ */ y("span", { className: "min-w-0 flex-1", children: [
466
- /* @__PURE__ */ k("span", { className: "font-medium", children: $ }),
520
+ /* @__PURE__ */ h(Z, { className: "h-4 w-4 shrink-0 text-amber-500" }),
521
+ /* @__PURE__ */ x("span", { className: "min-w-0 flex-1", children: [
522
+ /* @__PURE__ */ h("span", { className: "font-medium", children: R }),
467
523
  " is editing ",
468
- h,
524
+ m,
469
525
  " — ",
470
- F,
471
- t.idle_minutes != null && t.idle_minutes >= 2 && /* @__PURE__ */ y(
526
+ _,
527
+ e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */ x(
472
528
  "span",
473
529
  {
474
530
  className: "ml-1.5 rounded bg-amber-100 px-1 py-px text-[10px] font-semibold text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",
@@ -476,74 +532,74 @@ function et({
476
532
  "data-tip": "How long since they last touched anything — they may have stepped away",
477
533
  children: [
478
534
  "idle ",
479
- t.idle_minutes,
535
+ e.idle_minutes,
480
536
  "m"
481
537
  ]
482
538
  }
483
539
  ),
484
540
  " ",
485
541
  "until the lock is released.",
486
- t.note && /* @__PURE__ */ y("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
542
+ e.note && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
487
543
  "“",
488
- t.note,
544
+ e.note,
489
545
  "”"
490
546
  ] }),
491
- D > 0 && E == null && /* @__PURE__ */ y("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
492
- D,
547
+ Y > 0 && $ == null && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
548
+ Y,
493
549
  " ",
494
- D === 1 ? "person is" : "people are",
550
+ Y === 1 ? "person is" : "people are",
495
551
  " already waiting."
496
552
  ] })
497
553
  ] }),
498
- g && (E != null ? /* @__PURE__ */ y(
499
- O,
554
+ f && ($ != null ? /* @__PURE__ */ x(
555
+ M,
500
556
  {
501
557
  size: "sm",
502
558
  variant: "outline",
503
559
  className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
504
- onClick: v,
560
+ onClick: b,
505
561
  "data-lock-queue-leave": !0,
506
562
  children: [
507
563
  "You’re #",
508
- E,
564
+ $,
509
565
  " in line · Leave"
510
566
  ]
511
567
  }
512
- ) : /* @__PURE__ */ k(
513
- O,
568
+ ) : /* @__PURE__ */ h(
569
+ M,
514
570
  {
515
571
  size: "sm",
516
572
  variant: "outline",
517
573
  className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
518
- onClick: g,
519
- disabled: p,
574
+ onClick: f,
575
+ disabled: w,
520
576
  "data-lock-queue-join": !0,
521
- children: p ? "Joining…" : "Ask to be next"
577
+ children: w ? "Joining…" : "Ask to be next"
522
578
  }
523
579
  )),
524
- L && /* @__PURE__ */ k(
525
- O,
580
+ y && /* @__PURE__ */ h(
581
+ M,
526
582
  {
527
583
  size: "sm",
528
584
  variant: "outline",
529
585
  className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
530
- onClick: L,
531
- disabled: T,
532
- children: T ? "Asking…" : "Ask them to wrap up"
586
+ onClick: y,
587
+ disabled: S,
588
+ children: S ? "Asking…" : "Ask them to wrap up"
533
589
  }
534
590
  ),
535
591
  // Admins always; other roles only when the server says they may (the
536
592
  // takeover-role allowlist, #256) — unknown = offered, and a 403 then
537
593
  // hides it. A Take over that can only fail was a dead end.
538
- (S || t.may_take_over !== !1) && /* @__PURE__ */ k(
539
- O,
594
+ (E || e.may_take_over !== !1) && /* @__PURE__ */ h(
595
+ M,
540
596
  {
541
597
  size: "sm",
542
598
  variant: "outline",
543
- className: S ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
599
+ className: E ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
544
600
  onClick: r,
545
- disabled: i,
546
- children: i ? "Taking over…" : "Take over"
601
+ disabled: o,
602
+ children: o ? "Taking over…" : "Take over"
547
603
  }
548
604
  )
549
605
  ]
@@ -551,7 +607,7 @@ function et({
551
607
  );
552
608
  }
553
609
  export {
554
- et as ItemLockBanner,
555
- Ze as LockHolderButton,
556
- Xe as useItemLock
610
+ at as ItemLockBanner,
611
+ st as LockHolderButton,
612
+ nt as useItemLock
557
613
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.26",
3
+ "version": "0.3.28",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",