@nivaro/react 0.3.88 → 0.3.90

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.
@@ -1,45 +1,47 @@
1
- var fn = Object.defineProperty;
2
- var hn = (t, e, r) => e in t ? fn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var We = (t, e, r) => hn(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { jsx as n, jsxs as i, Fragment as be } from "react/jsx-runtime";
5
- import { useQueryClient as Re, useQuery as le, useMutation as qe } from "@tanstack/react-query";
6
- import { ArrowRight as rt, Loader2 as pe, Check as je, GitBranch as ze, AlertTriangle as bn, ChevronDown as _e, Send as qt, Users as Rt, Undo2 as gn, Minus as xn, UserPlus as yn, X as Mt, Zap as Pt, Search as wn } from "lucide-react";
7
- import { useState as j, useRef as ae, useEffect as he, useMemo as Be, Suspense as Dt, useCallback as Ft, lazy as vn } from "react";
8
- import { toast as X } from "sonner";
9
- import { useNivaroClient as xe, useItemEditAuth as kn } from "../../context.js";
10
- import { get as ce, post as Se, del as Nn } from "../../lib/commands.js";
11
- import { errorToastOptions as At, toastError as _n } from "../../lib/error-toast.js";
12
- import { useRecordSignalWhile as Ot, useRecordSignalPeers as Sn, signalSentence as Cn } from "../../lib/presence-signals.js";
13
- import { RUN_TRANSITION_EVENT as Le } from "../../lib/run-transition.js";
14
- import { userErrorMessage as Me } from "../../lib/safe-error.js";
15
- import { serverNow as $n } from "../../lib/server-clock.js";
16
- import { userCardQuery as Tn } from "../../lib/user-cards.js";
17
- import { cn as ge, titleCase as qn, toLocalDateString as Rn, formatRelative as at, formatDateTime as yt, humanHours as Mn } from "../../lib/utils.js";
18
- import { PushReadinessChip as Pn } from "../integrations/RecordIntegrationPreview.js";
19
- import { useHeaderFold as Dn } from "../item-edit/HeaderTools.js";
20
- import { invalidateRecordInsights as Ee, invalidateRecordData as Pe } from "../item-edit/RecordInsights.js";
21
- import { UserChip as Ut } from "../item-edit/UserChip.js";
22
- import { OwnerAvatars as Fn } from "../queue/OwnerAvatars.js";
23
- import { UserAvatar as An } from "../UserAvatar.js";
24
- import { Button as re } from "../ui/button.js";
25
- import { DropdownMenu as Ve, DropdownMenuTrigger as Xe, DropdownMenuContent as Ye, DropdownMenuGroup as wt, DropdownMenuSeparator as vt, DropdownMenuItem as Oe, DropdownMenuLabel as On } from "../ui/dropdown-menu.js";
26
- import { Popover as st, PopoverTrigger as it, PopoverContent as lt } from "../ui/popover.js";
27
- import { Skeleton as we } from "../ui/skeleton.js";
28
- import { TooltipProvider as Bt, Tooltip as Je, TooltipTrigger as Ze, TooltipContent as et } from "../ui/tooltip.js";
29
- import { isAccessRefusal as Lt, deniedToastAction as Et, WhyOwnersButton as Un } from "./AccessInsights.js";
30
- import { BranchLanes as Bn } from "./BranchLanes.js";
31
- import { landingState as Ln, landingSkipGroups as En, joinLabels as kt } from "./landing-state.js";
32
- import { SlaClockLine as jn } from "./SlaClock.js";
33
- const jt = vn(
1
+ var wn = Object.defineProperty;
2
+ var vn = (t, e, r) => e in t ? wn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var Ve = (t, e, r) => vn(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { jsx as n, jsxs as i, Fragment as xe } from "react/jsx-runtime";
5
+ import { useQueryClient as De, useQuery as oe, useMutation as Pe } from "@tanstack/react-query";
6
+ import { ArrowRight as lt, Loader2 as me, Check as We, GitBranch as Xe, AlertTriangle as kn, ChevronDown as $e, Send as Ft, Users as At, Undo2 as Nn, Minus as _n, UserPlus as Sn, X as Ot, Zap as Ut, Search as Cn } from "lucide-react";
7
+ import { useState as I, useRef as ne, useEffect as fe, useMemo as Ie, Suspense as Et, useCallback as Lt, lazy as $n } from "react";
8
+ import { toast as Y } from "sonner";
9
+ import { useNivaroClient as we, useItemEditAuth as Bt } from "../../context.js";
10
+ import { get as ce, post as Te, del as Tn } from "../../lib/commands.js";
11
+ import { errorToastOptions as jt, toastError as qn } from "../../lib/error-toast.js";
12
+ import { useRecordSignalWhile as It, useRecordSignalPeers as Mn, signalSentence as Rn } from "../../lib/presence-signals.js";
13
+ import { OPEN_MOVE_STATE_EVENT as Nt } from "../../lib/move-state.js";
14
+ import { RUN_TRANSITION_EVENT as Ke } from "../../lib/run-transition.js";
15
+ import { userErrorMessage as Fe } from "../../lib/safe-error.js";
16
+ import { serverNow as Pn } from "../../lib/server-clock.js";
17
+ import { userCardQuery as Dn } from "../../lib/user-cards.js";
18
+ import { cn as ye, titleCase as Fn, toLocalDateString as An, formatRelative as ot, formatDateTime as _t, humanHours as On } from "../../lib/utils.js";
19
+ import { PushReadinessChip as Un } from "../integrations/RecordIntegrationPreview.js";
20
+ import { useHeaderFold as En } from "../item-edit/HeaderTools.js";
21
+ import { invalidateRecordInsights as Qe, invalidateRecordData as Ae } from "../item-edit/RecordInsights.js";
22
+ import { UserChip as Kt } from "../item-edit/UserChip.js";
23
+ import { OwnerAvatars as Ln } from "../queue/OwnerAvatars.js";
24
+ import { UserAvatar as Bn } from "../UserAvatar.js";
25
+ import { Button as ae } from "../ui/button.js";
26
+ import { DropdownMenu as Ze, DropdownMenuTrigger as et, DropdownMenuContent as tt, DropdownMenuGroup as St, DropdownMenuSeparator as Ct, DropdownMenuItem as Be, DropdownMenuLabel as jn } from "../ui/dropdown-menu.js";
27
+ import { Popover as dt, PopoverTrigger as ct, PopoverContent as ut } from "../ui/popover.js";
28
+ import { Skeleton as ke } from "../ui/skeleton.js";
29
+ import { TooltipProvider as Qt, Tooltip as nt, TooltipTrigger as rt, TooltipContent as at } from "../ui/tooltip.js";
30
+ import { isAccessRefusal as Wt, deniedToastAction as zt, WhyOwnersButton as In } from "./AccessInsights.js";
31
+ import { BranchLanes as Kn } from "./BranchLanes.js";
32
+ import { landingState as Qn, landingSkipGroups as Wn, joinLabels as $t } from "./landing-state.js";
33
+ import { MoveToStatePanel as zn } from "./MoveToStatePanel.js";
34
+ import { SlaClockLine as Hn } from "./SlaClock.js";
35
+ const Ht = $n(
34
36
  () => import("./TransitionRequirementsDialog.js").then((t) => ({
35
37
  default: t.TransitionRequirementsDialog
36
38
  }))
37
39
  );
38
- function ot(t, e) {
40
+ function mt(t, e) {
39
41
  const r = t || "System";
40
42
  return e.on_behalf_of_name ? `${r}, for ${e.on_behalf_of_name}` : r;
41
43
  }
42
- function In(t) {
44
+ function Gn(t) {
43
45
  if (t.transition) return null;
44
46
  const e = (t.comment ?? "").trim();
45
47
  if (!e.startsWith("{")) return null;
@@ -53,20 +55,20 @@ function In(t) {
53
55
  }
54
56
  return null;
55
57
  }
56
- function Ue(t) {
58
+ function je(t) {
57
59
  return !(t.first_name || t.last_name || t.user_email);
58
60
  }
59
- function tt(t) {
61
+ function st(t) {
60
62
  const e = (t.comment ?? "").trim().toLowerCase();
61
63
  return t.origin === "import" || e.startsWith("import:") ? "Imported" : t.origin === "integration" ? "By an integration" : /-state-sync$/.test(e) || e.startsWith("legacy-") ? "Synced from another system" : e === "state-merge" || e === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
62
64
  }
63
- function nt(t) {
65
+ function it(t) {
64
66
  if (t.transition_text) return t.transition_text;
65
67
  if (t.transition_label) return `Rule: ${t.transition_label}`;
66
68
  const e = (t.comment ?? "").trim(), r = /^auto: (.+)$/i.exec(e);
67
69
  return r ? `Rule: ${r[1]}` : /-state-sync$/i.test(e) ? "The state was copied in from the system that owned this record" : /^instance-migration/i.test(e) ? "Moved when the pipeline was reshaped" : /^state-merge/i.test(e) ? "Moved when two states were merged" : null;
68
70
  }
69
- const Nt = {
71
+ const Tt = {
70
72
  validation: "the partner refused what we sent",
71
73
  not_found: "the partner could not find what we referred to",
72
74
  auth: "the partner refused our credentials",
@@ -74,24 +76,24 @@ const Nt = {
74
76
  rate_limited: "the partner asked us to slow down",
75
77
  unknown: "the partner refused it"
76
78
  };
77
- function Kn(t) {
78
- const e = Math.ceil((new Date(t).getTime() - $n()) / 6e4);
79
+ function Vn(t) {
80
+ const e = Math.ceil((new Date(t).getTime() - Pn()) / 6e4);
79
81
  return !Number.isFinite(e) || e <= 0 ? "on the next check" : e < 60 ? `in ${e} min` : `in ${Math.round(e / 60)}h`;
80
82
  }
81
- function Qn({ held: t }) {
83
+ function Xn({ held: t }) {
82
84
  return t.length === 0 ? null : /* @__PURE__ */ n(
83
85
  "div",
84
86
  {
85
87
  className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
86
88
  "data-pipeline-auto-held": !0,
87
89
  children: t.map((e) => {
88
- const r = e.transition_label ?? "An automatic move", a = Nt[e.error_class ?? "unknown"] ?? Nt.unknown;
90
+ const r = e.transition_label ?? "An automatic move", s = Tt[e.error_class ?? "unknown"] ?? Tt.unknown;
89
91
  return /* @__PURE__ */ i("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
90
92
  /* @__PURE__ */ i("p", { className: "font-medium", children: [
91
93
  "Needs a person: ",
92
94
  r,
93
95
  " stopped retrying — ",
94
- a,
96
+ s,
95
97
  "."
96
98
  ] }),
97
99
  e.error && /* @__PURE__ */ n(
@@ -103,7 +105,7 @@ function Qn({ held: t }) {
103
105
  }
104
106
  ),
105
107
  /* @__PURE__ */ i("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
106
- e.retry_at ? `It tries the same push again ${Kn(e.retry_at)}. ` : "It will not send the same push again on its own. ",
108
+ e.retry_at ? `It tries the same push again ${Vn(e.retry_at)}. ` : "It will not send the same push again on its own. ",
107
109
  "Fix the record so what it sends changes, retry the push, or move the record by hand.",
108
110
  e.attempts > 1 ? ` ${e.attempts} attempts so far.` : ""
109
111
  ] })
@@ -112,75 +114,75 @@ function Qn({ held: t }) {
112
114
  }
113
115
  );
114
116
  }
115
- function It(t) {
117
+ function Gt(t) {
116
118
  var r;
117
119
  const e = t == null ? void 0 : t.response;
118
120
  return ((e == null ? void 0 : e.code) ?? ((r = e == null ? void 0 : e.data) == null ? void 0 : r.code)) === "TRANSITION_DUPLICATE";
119
121
  }
120
- function Kt(t) {
122
+ function Vt(t) {
121
123
  var r;
122
124
  const e = t;
123
125
  return (e == null ? void 0 : e.status) === 422 && ((r = e.response) == null ? void 0 : r.error) === "TRANSITION_REQUIREMENTS" ? e.response.requirements ?? [] : null;
124
126
  }
125
- function Qt(t) {
126
- var a;
127
- const e = t == null ? void 0 : t.response, r = (e == null ? void 0 : e.code) ?? ((a = e == null ? void 0 : e.data) == null ? void 0 : a.code);
127
+ function Xt(t) {
128
+ var s;
129
+ const e = t == null ? void 0 : t.response, r = (e == null ? void 0 : e.code) ?? ((s = e == null ? void 0 : e.data) == null ? void 0 : s.code);
128
130
  return typeof r == "string" ? r : null;
129
131
  }
130
- function Wt(t) {
131
- if (Qt(t) !== "RECORD_LOCKED") return null;
132
+ function Yt(t) {
133
+ if (Xt(t) !== "RECORD_LOCKED") return null;
132
134
  const e = t == null ? void 0 : t.response, r = e != null && e.data && typeof e.data == "object" ? e.data : e;
133
135
  if ((r == null ? void 0 : r.move_anyway) !== !0) return null;
134
- const a = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
135
- return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${a ?? "Someone else"} is editing this record right now.`, holder: a };
136
+ const s = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
137
+ return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${s ?? "Someone else"} is editing this record right now.`, holder: s };
136
138
  }
137
- const Wn = {
139
+ const Yn = {
138
140
  PRIORITY_REQUIRED: "priority",
139
141
  // A held record does not move forward (efp-ops hold-gate, army 11): taking
140
142
  // the hold off is one deliberate, noted step, then the move is tried again.
141
143
  ON_HOLD: "remove-hold"
142
144
  };
143
- function zt(t, e) {
144
- const r = Qt(t), a = r ? Wn[r] : void 0;
145
- return !r || !a ? null : { code: r, actionKey: a, transitionId: e.transition_id, comment: e.comment };
145
+ function Jt(t, e) {
146
+ const r = Xt(t), s = r ? Yn[r] : void 0;
147
+ return !r || !s ? null : { code: r, actionKey: s, transitionId: e.transition_id, comment: e.comment };
146
148
  }
147
- const zn = 600;
148
- function Ht(t) {
149
- const e = Re(), [r, a] = j(!1), l = ae(!0);
150
- he(() => (l.current = !0, () => {
149
+ const Jn = 600;
150
+ function Zt(t) {
151
+ const e = De(), [r, s] = I(!1), l = ne(!0);
152
+ fe(() => (l.current = !0, () => {
151
153
  l.current = !1;
152
154
  }), []);
153
- const c = ae(t);
155
+ const c = ne(t);
154
156
  c.current = t;
155
- const m = Ft(async () => {
156
- a(!0);
157
+ const p = Lt(async () => {
158
+ s(!0);
157
159
  try {
158
160
  await e.refetchQueries({ queryKey: [...c.current], type: "active" });
159
161
  } catch {
160
162
  }
161
- await new Promise((b) => setTimeout(b, zn)), l.current && a(!1);
163
+ await new Promise((b) => setTimeout(b, Jn)), l.current && s(!1);
162
164
  }, [e]);
163
- return { settling: r, settle: m };
165
+ return { settling: r, settle: p };
164
166
  }
165
- const $e = 1500, _t = 4e3;
166
- class Hn {
167
+ const Me = 1500, qt = 4e3;
168
+ class Zn {
167
169
  constructor() {
168
- We(this, "seen", null);
169
- We(this, "fresh", /* @__PURE__ */ new Map());
170
+ Ve(this, "seen", null);
171
+ Ve(this, "fresh", /* @__PURE__ */ new Map());
170
172
  }
171
173
  /** Feed the ids on offer now. */
172
174
  observe(e, r) {
173
- const a = new Set(e.map((l) => String(l).toUpperCase()));
175
+ const s = new Set(e.map((l) => String(l).toUpperCase()));
174
176
  if (this.seen)
175
- for (const l of a)
177
+ for (const l of s)
176
178
  this.seen.has(l) || this.fresh.set(l, { at: r, hovered: !1, left: !1 });
177
- for (const l of [...this.fresh.keys()]) a.has(l) || this.fresh.delete(l);
178
- this.seen = a;
179
+ for (const l of [...this.fresh.keys()]) s.has(l) || this.fresh.delete(l);
180
+ this.seen = s;
179
181
  }
180
182
  /** The pointer is on the button. */
181
183
  enter(e, r) {
182
- const a = this.fresh.get(String(e).toUpperCase());
183
- a && !a.left && r - a.at < $e && (a.hovered = !0);
184
+ const s = this.fresh.get(String(e).toUpperCase());
185
+ s && !s.left && r - s.at < Me && (s.hovered = !0);
184
186
  }
185
187
  /** The pointer left the button. */
186
188
  leave(e) {
@@ -189,102 +191,102 @@ class Hn {
189
191
  }
190
192
  /** Still inert (no state change)? */
191
193
  inert(e, r) {
192
- const a = this.fresh.get(String(e).toUpperCase());
193
- return !a || r - a.at >= _t ? !1 : r - a.at < $e || a.hovered && !a.left;
194
+ const s = this.fresh.get(String(e).toUpperCase());
195
+ return !s || r - s.at >= qt ? !1 : r - s.at < Me || s.hovered && !s.left;
194
196
  }
195
197
  /** A press: true = let it through. A press inside the window counts as the pointer being there. */
196
198
  press(e, r) {
197
- const a = String(e).toUpperCase(), l = this.fresh.get(a);
198
- return l ? r - l.at < $e ? (l.hovered = !0, l.left = !1, !1) : l.hovered && !l.left && r - l.at < _t ? !1 : (this.fresh.delete(a), !0) : !0;
199
+ const s = String(e).toUpperCase(), l = this.fresh.get(s);
200
+ return l ? r - l.at < Me ? (l.hovered = !0, l.left = !1, !1) : l.hovered && !l.left && r - l.at < qt ? !1 : (this.fresh.delete(s), !0) : !0;
199
201
  }
200
202
  /** Inside its time window (drawn dimmed)? */
201
203
  timed(e, r) {
202
- const a = this.fresh.get(String(e).toUpperCase());
203
- return !!a && r - a.at < $e;
204
+ const s = this.fresh.get(String(e).toUpperCase());
205
+ return !!s && r - s.at < Me;
204
206
  }
205
207
  /** Any button still inside its time window? */
206
208
  hasTimed(e) {
207
- for (const r of this.fresh.values()) if (e - r.at < $e) return !0;
209
+ for (const r of this.fresh.values()) if (e - r.at < Me) return !0;
208
210
  return !1;
209
211
  }
210
212
  reset() {
211
213
  this.seen = null, this.fresh.clear();
212
214
  }
213
215
  }
214
- function Gt(t, e) {
215
- const r = ae(null);
216
- r.current || (r.current = new Hn());
217
- const a = r.current, l = ae(e);
218
- l.current !== e && (l.current = e, a.reset());
219
- const [, c] = j(0), m = t ? t.join(",") : null;
220
- return Be(() => {
221
- t && a.observe(t, Date.now());
222
- }, [a, m]), he(() => {
223
- if (!a.hasTimed(Date.now())) return;
224
- const b = setTimeout(() => c((h) => h + 1), $e + 20);
216
+ function en(t, e) {
217
+ const r = ne(null);
218
+ r.current || (r.current = new Zn());
219
+ const s = r.current, l = ne(e);
220
+ l.current !== e && (l.current = e, s.reset());
221
+ const [, c] = I(0), p = t ? t.join(",") : null;
222
+ return Ie(() => {
223
+ t && s.observe(t, Date.now());
224
+ }, [s, p]), fe(() => {
225
+ if (!s.hasTimed(Date.now())) return;
226
+ const b = setTimeout(() => c((f) => f + 1), Me + 20);
225
227
  return () => clearTimeout(b);
226
- }, [a, m]), {
227
- dimmed: (b) => a.timed(b, Date.now()),
228
- press: (b) => a.press(b, Date.now()),
228
+ }, [s, p]), {
229
+ dimmed: (b) => s.timed(b, Date.now()),
230
+ press: (b) => s.press(b, Date.now()),
229
231
  bind: (b) => ({
230
- onPointerEnter: () => a.enter(b, Date.now()),
231
- onPointerMove: () => a.enter(b, Date.now()),
232
- onPointerLeave: () => a.leave(b)
232
+ onPointerEnter: () => s.enter(b, Date.now()),
233
+ onPointerMove: () => s.enter(b, Date.now()),
234
+ onPointerLeave: () => s.leave(b)
233
235
  })
234
236
  };
235
237
  }
236
- function Vt(t, e) {
238
+ function tn(t, e) {
237
239
  return ["approval-brief", t, String(e)];
238
240
  }
239
- function Xt(t, e, r) {
241
+ function nn(t, e, r) {
240
242
  return t.request(
241
243
  ce(`/pipelines/instance/${e}/${r}/approval-brief`)
242
- ).then((a) => a.data);
244
+ ).then((s) => s.data);
243
245
  }
244
- function Gn(t) {
246
+ function er(t) {
245
247
  return (t ?? []).filter((e) => e.tone === "warn" || e.tone === "danger");
246
248
  }
247
- function St(t) {
249
+ function Mt(t) {
248
250
  return `${(t.label ?? "").trim().toLowerCase()}|${(t.text ?? "").trim().toLowerCase()}`;
249
251
  }
250
- function Vn(t) {
252
+ function tr(t) {
251
253
  const e = Math.max(0, Math.floor(Number(t) || 0));
252
254
  return e === 0 ? "today" : e === 1 ? "1 day ago" : `${e} days ago`;
253
255
  }
254
- function Xn(t, e, r = 40) {
255
- const a = (_) => _ == null || _ === "" ? "" : String(_), l = a(t), c = a(e), m = (_) => _ === "" ? "(empty)" : _;
256
- if (t === void 0) return { old: null, new: He(m(c), 0, r) };
257
- if (l.length <= r && c.length <= r) return { old: m(l), new: m(c) };
256
+ function nr(t, e, r = 40) {
257
+ const s = (_) => _ == null || _ === "" ? "" : String(_), l = s(t), c = s(e), p = (_) => _ === "" ? "(empty)" : _;
258
+ if (t === void 0) return { old: null, new: Ye(p(c), 0, r) };
259
+ if (l.length <= r && c.length <= r) return { old: p(l), new: p(c) };
258
260
  let b = 0;
259
261
  for (; b < l.length && b < c.length && l[b] === c[b]; ) b++;
260
- const h = b > r / 2 ? b - Math.floor(r / 3) : 0;
261
- return { old: He(m(l), h, r), new: He(m(c), h, r) };
262
+ const f = b > r / 2 ? b - Math.floor(r / 3) : 0;
263
+ return { old: Ye(p(l), f, r), new: Ye(p(c), f, r) };
262
264
  }
263
- function He(t, e, r) {
264
- const a = Math.min(e, Math.max(0, t.length - r)), l = t.slice(a, a + r);
265
- return `${a > 0 ? "…" : ""}${l}${a + r < t.length ? "…" : ""}`;
265
+ function Ye(t, e, r) {
266
+ const s = Math.min(e, Math.max(0, t.length - r)), l = t.slice(s, s + r);
267
+ return `${s > 0 ? "…" : ""}${l}${s + r < t.length ? "…" : ""}`;
266
268
  }
267
- const Yn = 4e3;
268
- function Yt(t, e) {
269
- const r = xe(), a = Re();
270
- return Ft(async () => {
269
+ const rr = 4e3;
270
+ function rn(t, e) {
271
+ const r = we(), s = De();
272
+ return Lt(async () => {
271
273
  try {
272
274
  const l = await Promise.race([
273
- a.fetchQuery({
274
- queryKey: Vt(t, e),
275
- queryFn: () => Xt(r, t, e),
275
+ s.fetchQuery({
276
+ queryKey: tn(t, e),
277
+ queryFn: () => nn(r, t, e),
276
278
  staleTime: 0,
277
279
  retry: !1
278
280
  }),
279
- new Promise((c) => setTimeout(() => c(null), Yn))
281
+ new Promise((c) => setTimeout(() => c(null), rr))
280
282
  ]);
281
- return Gn(l == null ? void 0 : l.lines);
283
+ return er(l == null ? void 0 : l.lines);
282
284
  } catch {
283
285
  return [];
284
286
  }
285
- }, [r, a, t, e]);
287
+ }, [r, s, t, e]);
286
288
  }
287
- function Jt({ lines: t }) {
289
+ function an({ lines: t }) {
288
290
  return t.length === 0 ? null : /* @__PURE__ */ i(
289
291
  "div",
290
292
  {
@@ -300,22 +302,22 @@ function Jt({ lines: t }) {
300
302
  }
301
303
  );
302
304
  }
303
- function De(t, e, r) {
305
+ function Oe(t, e, r) {
304
306
  if (!r) return !1;
305
- const a = e.find(
307
+ const s = e.find(
306
308
  (c) => String(c.id).toUpperCase() === String(r).toUpperCase()
307
309
  ), l = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
308
- return !!a && !!l && l.sort < a.sort;
310
+ return !!s && !!l && l.sort < s.sort;
309
311
  }
310
- function Zt(t, e, r) {
312
+ function sn(t, e, r) {
311
313
  var l;
312
314
  if (!t) return !1;
313
315
  if ((((l = t.order_partners) == null ? void 0 : l.length) ?? 0) > 0) return !0;
314
- if (De(t, e, r)) return !1;
315
- const a = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
316
- return !!(a != null && a.is_terminal) && !/(^|_)cancel/i.test(String(a.key ?? ""));
316
+ if (Oe(t, e, r)) return !1;
317
+ const s = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
318
+ return !!(s != null && s.is_terminal) && !/(^|_)cancel/i.test(String(s.key ?? ""));
317
319
  }
318
- const Ct = {
320
+ const Rt = {
319
321
  red: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
320
322
  amber: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
321
323
  yellow: "border-yellow-200 bg-yellow-50 text-yellow-800 dark:border-yellow-500/30 dark:bg-yellow-500/10 dark:text-yellow-300",
@@ -323,14 +325,14 @@ const Ct = {
323
325
  blue: "border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
324
326
  purple: "border-violet-200 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300"
325
327
  };
326
- function en({ flags: t }) {
327
- return !t || t.length === 0 ? null : /* @__PURE__ */ n(be, { children: t.map((e) => /* @__PURE__ */ i(
328
+ function ln({ flags: t }) {
329
+ return !t || t.length === 0 ? null : /* @__PURE__ */ n(xe, { children: t.map((e) => /* @__PURE__ */ i(
328
330
  "span",
329
331
  {
330
332
  "data-record-flag": e.name,
331
- className: ge(
333
+ className: ye(
332
334
  "inline-flex shrink-0 items-center gap-1 self-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",
333
- Ct[e.color] ?? Ct.amber
335
+ Rt[e.color] ?? Rt.amber
334
336
  ),
335
337
  children: [
336
338
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-current", "aria-hidden": !0 }),
@@ -340,95 +342,95 @@ function en({ flags: t }) {
340
342
  e.name
341
343
  )) });
342
344
  }
343
- function $t(t) {
345
+ function Pt(t) {
344
346
  return t.replace(/\s+IIP$/i, "");
345
347
  }
346
- function tn({
348
+ function on({
347
349
  collection: t,
348
350
  item: e,
349
351
  tx: r
350
352
  }) {
351
- const a = xe(), l = (r == null ? void 0 : r.order_partners) ?? [], { data: c } = le({
353
+ const s = we(), l = (r == null ? void 0 : r.order_partners) ?? [], { data: c } = oe({
352
354
  queryKey: ["push-preflight", t, e, "t", (r == null ? void 0 : r.id) ?? ""],
353
- queryFn: () => a.request(
355
+ queryFn: () => s.request(
354
356
  ce(`/integration-preview/${t}/${encodeURIComponent(e)}/preflight`, {
355
357
  transition_id: (r == null ? void 0 : r.id) ?? ""
356
358
  })
357
- ).then((h) => h.data),
359
+ ).then((f) => f.data),
358
360
  enabled: l.length > 0 && !!(r != null && r.id),
359
361
  staleTime: 2e4
360
362
  });
361
363
  if (l.length === 0) return null;
362
- const m = c != null && c.pushes ? c.pushes.filter((h) => h.status === "would_push" && l.includes(h.api_name)).map((h) => $t(h.api_name)) : null, b = [...new Set(m ?? l.map($t))];
364
+ const p = c != null && c.pushes ? c.pushes.filter((f) => f.status === "would_push" && l.includes(f.api_name)).map((f) => Pt(f.api_name)) : null, b = [...new Set(p ?? l.map(Pt))];
363
365
  return /* @__PURE__ */ i(
364
366
  "p",
365
367
  {
366
368
  "data-order-send-note": !0,
367
369
  className: "flex items-start gap-1.5 rounded-md border border-sky-200 bg-sky-50 px-2.5 py-1.5 text-[12px] text-sky-900 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-200",
368
370
  children: [
369
- /* @__PURE__ */ n(qt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
370
- m && m.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${b.join(" or ")}. It cannot be called back from here.`
371
+ /* @__PURE__ */ n(Ft, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
372
+ p && p.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${b.join(" or ")}. It cannot be called back from here.`
371
373
  ]
372
374
  }
373
375
  );
374
376
  }
375
- function nn(t) {
377
+ function dn(t) {
376
378
  return t != null && t.instance ? (t.available_transitions ?? []).some(
377
379
  (e) => {
378
380
  var r;
379
- return De(e, t.states ?? [], (r = t.instance) == null ? void 0 : r.current_state);
381
+ return Oe(e, t.states ?? [], (r = t.instance) == null ? void 0 : r.current_state);
380
382
  }
381
383
  ) : !1;
382
384
  }
383
- function rn(t, e, r, a) {
384
- if (!a || a.size === 0) return t;
385
- const l = new Set([...a.keys()].map((c) => String(c).toUpperCase()));
385
+ function cn(t, e, r, s) {
386
+ if (!s || s.size === 0) return t;
387
+ const l = new Set([...s.keys()].map((c) => String(c).toUpperCase()));
386
388
  return t.filter(
387
- (c) => !(!c.to_previous && l.has(String(c.to_state).toUpperCase()) && De(c, e, r))
389
+ (c) => !(!c.to_previous && l.has(String(c.to_state).toUpperCase()) && Oe(c, e, r))
388
390
  );
389
391
  }
390
- function an(t, e, r) {
391
- var h, _, k, w, q, F;
392
- const a = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
393
- (B) => B.id === e
394
- ), l = r == null ? void 0 : r.data, c = ((h = l == null ? void 0 : l.new_state) == null ? void 0 : h.id) ?? ((_ = l == null ? void 0 : l.instance) == null ? void 0 : _.current_state) ?? null, m = ((k = l == null ? void 0 : l.new_state) == null ? void 0 : k.label) ?? (a ? (q = (w = t == null ? void 0 : t.states) == null ? void 0 : w.find((B) => B.id === a.to_state)) == null ? void 0 : q.label : void 0) ?? null, b = ((F = t == null ? void 0 : t.instance) == null ? void 0 : F.current_state) ?? null;
395
- return b && c && String(b) === String(c) ? "Nothing moved" : a != null && a.label && m ? `${a.label} — now ${m}` : m ? `Moved to ${m}` : a != null && a.label ? `${a.label} done` : "Transition executed";
392
+ function un(t, e, r) {
393
+ var f, _, v, y, $, A;
394
+ const s = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
395
+ (E) => E.id === e
396
+ ), l = r == null ? void 0 : r.data, c = ((f = l == null ? void 0 : l.new_state) == null ? void 0 : f.id) ?? ((_ = l == null ? void 0 : l.instance) == null ? void 0 : _.current_state) ?? null, p = ((v = l == null ? void 0 : l.new_state) == null ? void 0 : v.label) ?? (s ? ($ = (y = t == null ? void 0 : t.states) == null ? void 0 : y.find((E) => E.id === s.to_state)) == null ? void 0 : $.label : void 0) ?? null, b = ((A = t == null ? void 0 : t.instance) == null ? void 0 : A.current_state) ?? null;
397
+ return b && c && String(b) === String(c) ? "Nothing moved" : s != null && s.label && p ? `${s.label} — now ${p}` : p ? `Moved to ${p}` : s != null && s.label ? `${s.label} done` : "Transition executed";
396
398
  }
397
- const Jn = 1200;
398
- function sn(t) {
399
+ const ar = 1200;
400
+ function mn(t) {
399
401
  const e = `nvr-move-${Math.random().toString(36).slice(2)}`;
400
402
  let r = !1;
401
- const a = setTimeout(() => {
402
- r = !0, X.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
403
- }, Jn);
403
+ const s = setTimeout(() => {
404
+ r = !0, Y.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
405
+ }, ar);
404
406
  return {
405
407
  /** Options for the result toast: replaces the loading one when shown. */
406
- done: () => (clearTimeout(a), r ? { id: e, duration: 7e3 } : {}),
408
+ done: () => (clearTimeout(s), r ? { id: e, duration: 7e3 } : {}),
407
409
  /** An error toast of its own follows — drop the loading one. */
408
410
  fail: () => {
409
- clearTimeout(a), r && X.dismiss(e);
411
+ clearTimeout(s), r && Y.dismiss(e);
410
412
  }
411
413
  };
412
414
  }
413
- function ln(t, e, r) {
414
- for (const a of [
415
+ function pn(t, e, r) {
416
+ for (const s of [
415
417
  "pipeline-owners-resolved",
416
418
  "pipeline-instance-owners",
417
419
  "pipeline-all-owners"
418
420
  ])
419
- t.invalidateQueries({ queryKey: [a, e, r] });
421
+ t.invalidateQueries({ queryKey: [s, e, r] });
420
422
  }
421
- function Zn(t, e, r) {
423
+ function sr(t, e, r) {
422
424
  var b;
423
425
  if (!e) return null;
424
- const a = new Map(r.map((h) => [String(h.id).toUpperCase(), h.sort])), l = [...t].sort(
425
- (h, _) => new Date(_.timestamp).getTime() - new Date(h.timestamp).getTime()
426
+ const s = new Map(r.map((f) => [String(f.id).toUpperCase(), f.sort])), l = [...t].sort(
427
+ (f, _) => new Date(_.timestamp).getTime() - new Date(f.timestamp).getTime()
426
428
  )[0];
427
429
  if (!(l != null && l.from_state) || String(l.to_state).toUpperCase() !== String(e).toUpperCase() || !((b = l.comment) != null && b.trim()) || l.origin && l.origin !== "person") return null;
428
- const c = a.get(String(l.from_state).toUpperCase()), m = a.get(String(l.to_state).toUpperCase());
429
- return c == null || m == null || m >= c ? null : l;
430
+ const c = s.get(String(l.from_state).toUpperCase()), p = s.get(String(l.to_state).toUpperCase());
431
+ return c == null || p == null || p >= c ? null : l;
430
432
  }
431
- function er({ entry: t }) {
433
+ function ir({ entry: t }) {
432
434
  const e = [t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email || "Someone";
433
435
  return /* @__PURE__ */ i(
434
436
  "div",
@@ -437,7 +439,7 @@ function er({ entry: t }) {
437
439
  "data-send-back-notice": !0,
438
440
  children: [
439
441
  /* @__PURE__ */ n(
440
- gn,
442
+ Nn,
441
443
  {
442
444
  "aria-hidden": !0,
443
445
  className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
@@ -447,65 +449,65 @@ function er({ entry: t }) {
447
449
  /* @__PURE__ */ n("p", { className: "whitespace-pre-line break-words text-[13px] leading-snug text-slate-800 dark:text-slate-100", children: t.comment }),
448
450
  /* @__PURE__ */ i("p", { className: "mt-0.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: [
449
451
  "Sent back by ",
450
- ot(e, t),
452
+ mt(e, t),
451
453
  " · ",
452
- at(t.timestamp)
454
+ ot(t.timestamp)
453
455
  ] })
454
456
  ] })
455
457
  ]
456
458
  }
457
459
  );
458
460
  }
459
- function on({
461
+ function fn({
460
462
  collection: t,
461
463
  item: e,
462
464
  offer: r,
463
- onFixed: a,
465
+ onFixed: s,
464
466
  onDismiss: l,
465
467
  className: c,
466
- style: m
468
+ style: p
467
469
  }) {
468
- const b = xe(), h = Re(), [_, k] = j(""), { data: w, isLoading: q } = le({
470
+ const b = we(), f = De(), [_, v] = I(""), { data: y, isLoading: $ } = oe({
469
471
  queryKey: ["bulk-actions-available-one", t, r.actionKey],
470
- queryFn: async () => ((await b.request(ce("/bulk-actions/available", { collection: t }))).data ?? []).find((L) => L.key === r.actionKey) ?? null,
472
+ queryFn: async () => ((await b.request(ce("/bulk-actions/available", { collection: t }))).data ?? []).find((H) => H.key === r.actionKey) ?? null,
471
473
  staleTime: 6e4
472
- }), F = qe({
474
+ }), A = Pe({
473
475
  mutationFn: async () => {
474
- var R, D;
475
- const A = { collection: t, ids: [e], reason: _.trim() || null }, I = ((w == null ? void 0 : w.source) === "extension" ? await b.request(Se(`/bulk-actions/${r.actionKey}/execute`, A)) : await b.request(Se("/bulk-actions/run", { ...A, key: r.actionKey }))).data ?? {};
476
- if ((w == null ? void 0 : w.source) !== "extension" && !(I.succeeded && I.succeeded > 0))
476
+ var T, P;
477
+ const B = { collection: t, ids: [e], reason: _.trim() || null }, K = ((y == null ? void 0 : y.source) === "extension" ? await b.request(Te(`/bulk-actions/${r.actionKey}/execute`, B)) : await b.request(Te("/bulk-actions/run", { ...B, key: r.actionKey }))).data ?? {};
478
+ if ((y == null ? void 0 : y.source) !== "extension" && !(K.succeeded && K.succeeded > 0))
477
479
  throw new Error(
478
- ((D = (R = I.errors) == null ? void 0 : R[0]) == null ? void 0 : D.error) || `${(w == null ? void 0 : w.label) ?? "The fix"} did not change the record`
480
+ ((P = (T = K.errors) == null ? void 0 : T[0]) == null ? void 0 : P.error) || `${(y == null ? void 0 : y.label) ?? "The fix"} did not change the record`
479
481
  );
480
482
  },
481
483
  onSuccess: () => {
482
- Pe(h, t, e), X.success(`${(w == null ? void 0 : w.label) ?? "Done"} — trying again`), a();
484
+ Ae(f, t, e), Y.success(`${(y == null ? void 0 : y.label) ?? "Done"} — trying again`), s();
483
485
  },
484
- onError: (A) => _n(A, `${(w == null ? void 0 : w.label) ?? "The fix"} failed`)
486
+ onError: (B) => qn(B, `${(y == null ? void 0 : y.label) ?? "The fix"} failed`)
485
487
  });
486
- if (q || !w) return null;
487
- const B = !F.isPending && (!w.require_reason || _.trim().length > 0);
488
+ if ($ || !y) return null;
489
+ const E = !A.isPending && (!y.require_reason || _.trim().length > 0);
488
490
  return /* @__PURE__ */ i(
489
491
  "div",
490
492
  {
491
- className: ge(
493
+ className: ye(
492
494
  "space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
493
495
  c
494
496
  ),
495
- style: m,
497
+ style: p,
496
498
  "data-refusal-fix": r.code,
497
499
  children: [
498
500
  /* @__PURE__ */ i("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
499
501
  "You can fix this here: ",
500
- w.label,
502
+ y.label,
501
503
  ", then the move is tried again."
502
504
  ] }),
503
- w.require_reason && /* @__PURE__ */ n(
505
+ y.require_reason && /* @__PURE__ */ n(
504
506
  "input",
505
507
  {
506
508
  type: "text",
507
509
  value: _,
508
- onChange: (A) => k(A.target.value),
510
+ onChange: (B) => v(B.target.value),
509
511
  placeholder: "Reason (required)",
510
512
  "aria-label": "Reason",
511
513
  className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30 dark:border-border dark:bg-card"
@@ -513,7 +515,7 @@ function on({
513
515
  ),
514
516
  /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
515
517
  /* @__PURE__ */ n(
516
- re,
518
+ ae,
517
519
  {
518
520
  type: "button",
519
521
  size: "sm",
@@ -524,16 +526,16 @@ function on({
524
526
  }
525
527
  ),
526
528
  /* @__PURE__ */ i(
527
- re,
529
+ ae,
528
530
  {
529
531
  type: "button",
530
532
  size: "sm",
531
533
  className: "h-7 gap-1.5 text-[12px]",
532
- disabled: !B,
533
- onClick: () => F.mutate(),
534
+ disabled: !E,
535
+ onClick: () => A.mutate(),
534
536
  children: [
535
- F.isPending && /* @__PURE__ */ n(pe, { className: "h-3 w-3 animate-spin" }),
536
- w.label,
537
+ A.isPending && /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }),
538
+ y.label,
537
539
  ", then try again"
538
540
  ]
539
541
  }
@@ -543,7 +545,7 @@ function on({
543
545
  }
544
546
  );
545
547
  }
546
- function ve({
548
+ function Ne({
547
549
  label: t,
548
550
  color: e,
549
551
  small: r
@@ -562,187 +564,187 @@ function ve({
562
564
  t
563
565
  );
564
566
  }
565
- function Ge(t) {
567
+ function Je(t) {
566
568
  const e = Math.floor(t / 6e4);
567
- return e < 60 ? `${Math.max(1, e)}m` : Mn(t / 36e5);
569
+ return e < 60 ? `${Math.max(1, e)}m` : On(t / 36e5);
568
570
  }
569
- function tr({
571
+ function lr({
570
572
  history: t,
571
573
  completedAt: e
572
574
  }) {
573
575
  const r = [...t].sort(
574
- (m, b) => new Date(m.timestamp).getTime() - new Date(b.timestamp).getTime()
576
+ (p, b) => new Date(p.timestamp).getTime() - new Date(b.timestamp).getTime()
575
577
  );
576
578
  if (r.length === 0) return null;
577
- const a = e ? new Date(e).getTime() : Date.now(), l = r.map((m, b) => {
578
- const h = new Date(m.timestamp).getTime(), _ = b + 1 < r.length ? new Date(r[b + 1].timestamp).getTime() : a;
579
+ const s = e ? new Date(e).getTime() : Date.now(), l = r.map((p, b) => {
580
+ const f = new Date(p.timestamp).getTime(), _ = b + 1 < r.length ? new Date(r[b + 1].timestamp).getTime() : s;
579
581
  return {
580
- key: m.id,
581
- label: m.to_state_label,
582
- color: m.to_state_color,
583
- ms: Math.max(0, _ - h),
582
+ key: p.id,
583
+ label: p.to_state_label,
584
+ color: p.to_state_color,
585
+ ms: Math.max(0, _ - f),
584
586
  current: b === r.length - 1 && !e
585
587
  };
586
- }).filter((m) => m.ms > 0 || m.current);
588
+ }).filter((p) => p.ms > 0 || p.current);
587
589
  if (l.length < 2) return null;
588
- const c = l.reduce((m, b) => m + b.ms, 0);
590
+ const c = l.reduce((p, b) => p + b.ms, 0);
589
591
  return c <= 0 ? null : /* @__PURE__ */ i("div", { "data-state-timeline": !0, children: [
590
592
  /* @__PURE__ */ i("div", { className: "mb-1 flex items-center justify-between", children: [
591
593
  /* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
592
594
  /* @__PURE__ */ i("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
593
- Ge(c),
595
+ Je(c),
594
596
  " total",
595
597
  e ? "" : " · so far"
596
598
  ] })
597
599
  ] }),
598
- /* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: l.map((m) => {
599
- const b = m.ms / c * 100;
600
+ /* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: l.map((p) => {
601
+ const b = p.ms / c * 100;
600
602
  return /* @__PURE__ */ i(
601
603
  "div",
602
604
  {
603
- "data-tip": `${m.label} — ${Ge(m.ms)}${m.current ? " (current)" : ""}`,
605
+ "data-tip": `${p.label} — ${Je(p.ms)}${p.current ? " (current)" : ""}`,
604
606
  className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
605
607
  style: {
606
608
  width: `${b}%`,
607
- backgroundColor: m.color ? `${m.color}55` : "rgba(100,116,139,.25)"
609
+ backgroundColor: p.color ? `${p.color}55` : "rgba(100,116,139,.25)"
608
610
  },
609
611
  children: [
610
612
  b >= 14 && /* @__PURE__ */ i("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
611
- m.label,
613
+ p.label,
612
614
  " · ",
613
- Ge(m.ms)
615
+ Je(p.ms)
614
616
  ] }),
615
- m.current && /* @__PURE__ */ n(
617
+ p.current && /* @__PURE__ */ n(
616
618
  "span",
617
619
  {
618
620
  className: "absolute inset-y-0 right-0 w-[2px]",
619
- style: { backgroundColor: m.color ?? "#64748b" }
621
+ style: { backgroundColor: p.color ?? "#64748b" }
620
622
  }
621
623
  )
622
624
  ]
623
625
  },
624
- m.key
626
+ p.key
625
627
  );
626
628
  }) })
627
629
  ] });
628
630
  }
629
- function nr({
631
+ function or({
630
632
  states: t,
631
633
  allTransitions: e,
632
634
  availableTransitions: r,
633
- currentStateId: a,
635
+ currentStateId: s,
634
636
  history: l,
635
637
  onPathIds: c,
636
- skippedStates: m
638
+ skippedStates: p
637
639
  }) {
638
- var Q;
639
- const b = ae(null);
640
- he(() => {
641
- const u = b.current;
642
- if (!u || u.scrollWidth <= u.clientWidth) return;
643
- const g = u.querySelector("[data-track-current]");
644
- if (!g) return;
645
- const N = u.getBoundingClientRect(), T = g.getBoundingClientRect();
646
- u.scrollLeft += T.left + T.width / 2 - (N.left + N.width / 2);
647
- }, [a]);
648
- const h = new Set(l.map((u) => u.to_state)), _ = t.find((u) => u.is_initial);
649
- _ && _.id !== a && h.add(_.id);
650
- const k = (Q = l[0]) == null ? void 0 : Q.from_state;
651
- k && k !== a && h.add(k);
652
- const w = (() => {
640
+ var L;
641
+ const b = ne(null);
642
+ fe(() => {
643
+ const h = b.current;
644
+ if (!h || h.scrollWidth <= h.clientWidth) return;
645
+ const x = h.querySelector("[data-track-current]");
646
+ if (!x) return;
647
+ const w = h.getBoundingClientRect(), q = x.getBoundingClientRect();
648
+ h.scrollLeft += q.left + q.width / 2 - (w.left + w.width / 2);
649
+ }, [s]);
650
+ const f = new Set(l.map((h) => h.to_state)), _ = t.find((h) => h.is_initial);
651
+ _ && _.id !== s && f.add(_.id);
652
+ const v = (L = l[0]) == null ? void 0 : L.from_state;
653
+ v && v !== s && f.add(v);
654
+ const y = (() => {
653
655
  if (c)
654
- return t.filter((y) => c.has(y.id) || h.has(y.id) || y.id === a).filter((y) => {
655
- const S = y.stage_visibility ?? "always";
656
- return S === "hide" ? !1 : S === "hide_unless_active" ? h.has(y.id) || y.id === a : !0;
657
- }).sort((y, S) => y.sort - S.sort);
656
+ return t.filter((g) => c.has(g.id) || f.has(g.id) || g.id === s).filter((g) => {
657
+ const k = g.stage_visibility ?? "always";
658
+ return k === "hide" ? !1 : k === "hide_unless_active" ? f.has(g.id) || g.id === s : !0;
659
+ }).sort((g, k) => g.sort - k.sort);
658
660
  if (e.length === 0) {
659
- const y = /* @__PURE__ */ new Set([...h]);
660
- return a && y.add(a), t.filter((S) => y.has(S.id)).sort((S, E) => S.sort - E.sort);
661
+ const g = /* @__PURE__ */ new Set([...f]);
662
+ return s && g.add(s), t.filter((k) => g.has(k.id)).sort((k, G) => k.sort - G.sort);
661
663
  }
662
- const u = new Set(
663
- l.filter((y) => y.from_state).map((y) => `${y.from_state}:${y.to_state}`)
664
- ), g = new Set(l.map((y) => y.from_state).filter(Boolean)), N = e.filter((y) => y.from_state !== null), T = /* @__PURE__ */ new Map();
665
- for (const y of N) {
666
- const S = y.from_state;
667
- if (g.has(S) && !u.has(`${S}:${y.to_state}`)) continue;
668
- const E = T.get(S) ?? [];
669
- E.push(y.to_state), T.set(S, E);
664
+ const h = new Set(
665
+ l.filter((g) => g.from_state).map((g) => `${g.from_state}:${g.to_state}`)
666
+ ), x = new Set(l.map((g) => g.from_state).filter(Boolean)), w = e.filter((g) => g.from_state !== null), q = /* @__PURE__ */ new Map();
667
+ for (const g of w) {
668
+ const k = g.from_state;
669
+ if (x.has(k) && !h.has(`${k}:${g.to_state}`)) continue;
670
+ const G = q.get(k) ?? [];
671
+ G.push(g.to_state), q.set(k, G);
670
672
  }
671
- if (a) {
672
- const y = N.filter((S) => S.from_state === a).map((S) => S.to_state);
673
- T.set(a, [
674
- .../* @__PURE__ */ new Set([...r.map((S) => S.to_state), ...y])
673
+ if (s) {
674
+ const g = w.filter((k) => k.from_state === s).map((k) => k.to_state);
675
+ q.set(s, [
676
+ .../* @__PURE__ */ new Set([...r.map((k) => k.to_state), ...g])
675
677
  ]);
676
678
  }
677
- const d = /* @__PURE__ */ new Set(), K = t.filter((y) => y.is_initial).map((y) => y.id);
678
- for (; K.length; ) {
679
- const y = K.shift();
680
- if (!d.has(y)) {
681
- d.add(y);
682
- for (const S of T.get(y) ?? []) d.has(S) || K.push(S);
679
+ const o = /* @__PURE__ */ new Set(), Q = t.filter((g) => g.is_initial).map((g) => g.id);
680
+ for (; Q.length; ) {
681
+ const g = Q.shift();
682
+ if (!o.has(g)) {
683
+ o.add(g);
684
+ for (const k of q.get(g) ?? []) o.has(k) || Q.push(k);
683
685
  }
684
686
  }
685
- const te = /* @__PURE__ */ new Set([...d, ...h]);
686
- return a && te.add(a), t.filter((y) => te.has(y.id)).filter((y) => {
687
- const S = y.stage_visibility ?? "always";
688
- return S === "hide" ? !1 : S === "hide_unless_active" ? h.has(y.id) || y.id === a : !0;
689
- }).sort((y, S) => y.sort - S.sort);
687
+ const X = /* @__PURE__ */ new Set([...o, ...f]);
688
+ return s && X.add(s), t.filter((g) => X.has(g.id)).filter((g) => {
689
+ const k = g.stage_visibility ?? "always";
690
+ return k === "hide" ? !1 : k === "hide_unless_active" ? f.has(g.id) || g.id === s : !0;
691
+ }).sort((g, k) => g.sort - k.sort);
690
692
  })();
691
- if (w.length < 2) return null;
692
- const q = w.findIndex((u) => u.id === a), F = new Map(w.map((u, g) => [u.id, g])), B = new Map(t.map((u) => [u.id, u.label]));
693
- function A(u, g) {
694
- const N = F.get(u);
695
- return N == null ? [] : [...l].filter((T) => {
696
- if (!T.from_state) return !1;
697
- const d = F.get(T.from_state), K = F.get(T.to_state);
698
- return d == null || K == null ? !1 : d === N && K > N || K < d && d - 1 === N;
699
- }).sort((T, d) => new Date(T.timestamp).getTime() - new Date(d.timestamp).getTime());
693
+ if (y.length < 2) return null;
694
+ const $ = y.findIndex((h) => h.id === s), A = new Map(y.map((h, x) => [h.id, x])), E = new Map(t.map((h) => [h.id, h.label]));
695
+ function B(h, x) {
696
+ const w = A.get(h);
697
+ return w == null ? [] : [...l].filter((q) => {
698
+ if (!q.from_state) return !1;
699
+ const o = A.get(q.from_state), Q = A.get(q.to_state);
700
+ return o == null || Q == null ? !1 : o === w && Q > w || Q < o && o - 1 === w;
701
+ }).sort((q, o) => new Date(q.timestamp).getTime() - new Date(o.timestamp).getTime());
700
702
  }
701
- function L(u) {
702
- var g, N, T, d;
703
- return Ue(u) ? /* @__PURE__ */ n(Pt, { className: "inline h-2.5 w-2.5", "aria-label": tt(u) }) : ((((g = u.first_name) == null ? void 0 : g[0]) ?? "") + (((N = u.last_name) == null ? void 0 : N[0]) ?? "")).toUpperCase() || ((d = (T = u.user_email) == null ? void 0 : T[0]) == null ? void 0 : d.toUpperCase()) || "?";
703
+ function H(h) {
704
+ var x, w, q, o;
705
+ return je(h) ? /* @__PURE__ */ n(Ut, { className: "inline h-2.5 w-2.5", "aria-label": st(h) }) : ((((x = h.first_name) == null ? void 0 : x[0]) ?? "") + (((w = h.last_name) == null ? void 0 : w[0]) ?? "")).toUpperCase() || ((o = (q = h.user_email) == null ? void 0 : q[0]) == null ? void 0 : o.toUpperCase()) || "?";
704
706
  }
705
- function I(u) {
706
- return ot([u.first_name, u.last_name].filter(Boolean).join(" ") || u.user_email, u);
707
+ function K(h) {
708
+ return mt([h.first_name, h.last_name].filter(Boolean).join(" ") || h.user_email, h);
707
709
  }
708
- const R = /* @__PURE__ */ new Map();
709
- for (const u of [...l].sort(
710
- (g, N) => new Date(g.timestamp).getTime() - new Date(N.timestamp).getTime()
710
+ const T = /* @__PURE__ */ new Map();
711
+ for (const h of [...l].sort(
712
+ (x, w) => new Date(x.timestamp).getTime() - new Date(w.timestamp).getTime()
711
713
  )) {
712
- if (!u.from_state) continue;
713
- const g = F.get(u.from_state), N = F.get(u.to_state);
714
- if (!(g == null || N == null || N <= g + 1))
715
- for (let T = g + 1; T < N; T++) {
716
- const d = w[T].id;
717
- !h.has(d) && !R.has(d) && R.set(d, u);
714
+ if (!h.from_state) continue;
715
+ const x = A.get(h.from_state), w = A.get(h.to_state);
716
+ if (!(x == null || w == null || w <= x + 1))
717
+ for (let q = x + 1; q < w; q++) {
718
+ const o = y[q].id;
719
+ !f.has(o) && !T.has(o) && T.set(o, h);
718
720
  }
719
721
  }
720
- function D(u) {
721
- const g = B.get(u.from_state ?? "") ?? "the previous step", N = B.get(u.to_state) ?? "the next step", T = Ue(u) ? "it moved automatically" : `${I(u)} moved it`;
722
- return `Passed over on ${yt(u.timestamp)} — ${T} straight from ${g} to ${N}`;
722
+ function P(h) {
723
+ const x = E.get(h.from_state ?? "") ?? "the previous step", w = E.get(h.to_state) ?? "the next step", q = je(h) ? "it moved automatically" : `${K(h)} moved it`;
724
+ return `Passed over on ${_t(h.timestamp)} — ${q} straight from ${x} to ${w}`;
723
725
  }
724
- return /* @__PURE__ */ n(Bt, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: b, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: w.map((u, g) => {
725
- const N = u.id === a, T = h.has(u.id), d = T && !N && (q < 0 || g < q), K = T && !N && !d, te = !T && !N ? R.get(u.id) : void 0, y = !T && !N ? m == null ? void 0 : m.get(u.id) : void 0, S = te || y ? [...te ? [D(te)] : [], ...y ?? []] : void 0, E = S !== void 0, Y = u.color ?? "#94a3b8", G = g === w.length - 1, z = G ? null : w[g + 1], oe = z ? A(u.id, z.id) : [];
726
+ return /* @__PURE__ */ n(Qt, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: b, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: y.map((h, x) => {
727
+ const w = h.id === s, q = f.has(h.id), o = q && !w && ($ < 0 || x < $), Q = q && !w && !o, X = !q && !w ? T.get(h.id) : void 0, g = !q && !w ? p == null ? void 0 : p.get(h.id) : void 0, k = X || g ? [...X ? [P(X)] : [], ...g ?? []] : void 0, G = k !== void 0, se = h.color ?? "#94a3b8", ee = x === y.length - 1, re = ee ? null : y[x + 1], z = re ? B(h.id, re.id) : [];
726
728
  return /* @__PURE__ */ i("div", { className: "flex flex-1 items-start", children: [
727
729
  /* @__PURE__ */ i("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
728
730
  /* @__PURE__ */ n(
729
731
  "div",
730
732
  {
731
- "data-track-current": N || void 0,
732
- className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${N || d ? "nvr-fill-sweep" : ""}`,
733
- "data-tip": K ? `Passed before the record was sent back — it needs this step again.${u.description ? ` ${u.description}` : ""}` : u.description || void 0,
734
- "data-track-again": K || void 0,
733
+ "data-track-current": w || void 0,
734
+ className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${w || o ? "nvr-fill-sweep" : ""}`,
735
+ "data-tip": Q ? `Passed before the record was sent back — it needs this step again.${h.description ? ` ${h.description}` : ""}` : h.description || void 0,
736
+ "data-track-again": Q || void 0,
735
737
  style: {
736
- backgroundColor: N || d ? Y : E ? "transparent" : "#f1f5f9",
737
- border: N || d ? "none" : E ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
738
- boxShadow: N ? `0 0 0 3px white, 0 0 0 5px ${Y}` : void 0
738
+ backgroundColor: w || o ? se : G ? "transparent" : "#f1f5f9",
739
+ border: w || o ? "none" : G ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
740
+ boxShadow: w ? `0 0 0 3px white, 0 0 0 5px ${se}` : void 0
739
741
  },
740
- children: d ? /* @__PURE__ */ n(je, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : N ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : E ? /* @__PURE__ */ n(xn, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
742
+ children: o ? /* @__PURE__ */ n(We, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : w ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : G ? /* @__PURE__ */ n(_n, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
741
743
  },
742
- N ? "cur" : d ? "done" : E ? "skip" : "todo"
744
+ w ? "cur" : o ? "done" : G ? "skip" : "todo"
743
745
  ),
744
- E ? /* @__PURE__ */ i(Je, { children: [
745
- /* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ n(
746
+ G ? /* @__PURE__ */ i(nt, { children: [
747
+ /* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ n(
746
748
  "span",
747
749
  {
748
750
  className: "w-full cursor-help break-words text-center leading-snug",
@@ -754,39 +756,39 @@ function nr({
754
756
  textDecoration: "line-through",
755
757
  textDecorationColor: "#cbd5e1"
756
758
  },
757
- children: u.label
759
+ children: h.label
758
760
  }
759
761
  ) }),
760
- /* @__PURE__ */ i(et, { className: "max-w-[260px]", children: [
762
+ /* @__PURE__ */ i(at, { className: "max-w-[260px]", children: [
761
763
  /* @__PURE__ */ n("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
762
- S.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: S.map(($) => /* @__PURE__ */ n("li", { children: $ }, $)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
764
+ k.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: k.map((C) => /* @__PURE__ */ n("li", { children: C }, C)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
763
765
  ] })
764
766
  ] }) : /* @__PURE__ */ n(
765
767
  "span",
766
768
  {
767
- className: ge(
769
+ className: ye(
768
770
  "w-full break-words text-center leading-snug",
769
- !N && !d && "text-slate-500 dark:text-slate-400"
771
+ !w && !o && "text-slate-500 dark:text-slate-400"
770
772
  ),
771
773
  style: {
772
774
  fontSize: "11px",
773
- color: N ? Y : d ? "#475569" : void 0,
774
- fontWeight: N ? 600 : d ? 500 : 400,
775
+ color: w ? se : o ? "#475569" : void 0,
776
+ fontWeight: w ? 600 : o ? 500 : 400,
775
777
  wordBreak: "break-word"
776
778
  },
777
- children: u.label
779
+ children: h.label
778
780
  }
779
781
  )
780
782
  ] }),
781
- !G && /* @__PURE__ */ i("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
783
+ !ee && /* @__PURE__ */ i("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
782
784
  (() => {
783
- const $ = d ? `${Y}55` : "#e8ecf0";
785
+ const C = o ? `${se}55` : "#e8ecf0";
784
786
  return /* @__PURE__ */ i("div", { className: "flex w-full shrink-0 items-center", children: [
785
787
  /* @__PURE__ */ n(
786
788
  "div",
787
789
  {
788
790
  className: "h-0.5 flex-1 rounded-l-sm",
789
- style: { backgroundColor: $ }
791
+ style: { backgroundColor: C }
790
792
  }
791
793
  ),
792
794
  /* @__PURE__ */ n(
@@ -797,65 +799,65 @@ function nr({
797
799
  height: 0,
798
800
  borderTop: "3px solid transparent",
799
801
  borderBottom: "3px solid transparent",
800
- borderLeft: `5px solid ${$}`
802
+ borderLeft: `5px solid ${C}`
801
803
  }
802
804
  }
803
805
  )
804
806
  ] });
805
807
  })(),
806
- oe.map(($) => {
807
- const o = $.from_state !== u.id, ue = Math.abs(
808
- (F.get($.to_state) ?? 0) - (F.get($.from_state ?? "") ?? 0)
809
- ) > 1 ? B.get($.to_state) ?? "" : null;
810
- return /* @__PURE__ */ i(Je, { children: [
811
- /* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
808
+ z.map((C) => {
809
+ const de = C.from_state !== h.id, J = Math.abs(
810
+ (A.get(C.to_state) ?? 0) - (A.get(C.from_state ?? "") ?? 0)
811
+ ) > 1 ? E.get(C.to_state) ?? "" : null;
812
+ return /* @__PURE__ */ i(nt, { children: [
813
+ /* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
812
814
  /* @__PURE__ */ i(
813
815
  "span",
814
816
  {
815
817
  className: "text-center font-mono text-[9px] font-semibold leading-none",
816
- style: { color: o ? "#d97706" : "#475569" },
818
+ style: { color: de ? "#d97706" : "#475569" },
817
819
  children: [
818
- o && "↩ ",
819
- L($)
820
+ de && "↩ ",
821
+ H(C)
820
822
  ]
821
823
  }
822
824
  ),
823
- /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: at($.timestamp) })
825
+ /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: ot(C.timestamp) })
824
826
  ] }) }),
825
- /* @__PURE__ */ i(et, { side: "top", className: "space-y-0.5 text-[12px]", children: [
826
- Ue($) ? /* @__PURE__ */ i(be, { children: [
827
+ /* @__PURE__ */ i(at, { side: "top", className: "space-y-0.5 text-[12px]", children: [
828
+ je(C) ? /* @__PURE__ */ i(xe, { children: [
827
829
  /* @__PURE__ */ i("p", { className: "font-medium", children: [
828
- o ? "↩ Sent back · " : "",
829
- tt($)
830
+ de ? "↩ Sent back · " : "",
831
+ st(C)
830
832
  ] }),
831
- nt($) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: nt($) })
833
+ it(C) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: it(C) })
832
834
  ] }) : /* @__PURE__ */ i("p", { className: "font-medium", children: [
833
- o ? "↩ Sent back by" : "Approved by",
835
+ de ? "↩ Sent back by" : "Approved by",
834
836
  " ",
835
- I($)
837
+ K(C)
836
838
  ] }),
837
- ue && /* @__PURE__ */ i("p", { className: "text-muted-foreground", children: [
839
+ J && /* @__PURE__ */ i("p", { className: "text-muted-foreground", children: [
838
840
  "→ straight to ",
839
- ue
841
+ J
840
842
  ] }),
841
- /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: yt($.timestamp) })
843
+ /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: _t(C.timestamp) })
842
844
  ] })
843
- ] }, $.id);
845
+ ] }, C.id);
844
846
  })
845
847
  ] })
846
- ] }, u.id);
848
+ ] }, h.id);
847
849
  }) }) }) });
848
850
  }
849
- function rr({ history: t }) {
851
+ function dr({ history: t }) {
850
852
  return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((e) => {
851
- const r = Ue(e), a = r ? tt(e) : ot([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), l = In(e), c = e.comment && !r && !l ? e.comment : null, m = l ?? (r ? nt(e) : null);
853
+ const r = je(e), s = r ? st(e) : mt([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), l = Gn(e), c = e.comment && !r && !l ? e.comment : null, p = l ?? (r ? it(e) : null);
852
854
  return /* @__PURE__ */ i("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
853
855
  /* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
854
856
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
855
857
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
856
- e.from_state_label ? /* @__PURE__ */ n(ve, { label: e.from_state_label, color: e.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
857
- /* @__PURE__ */ n(rt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
858
- /* @__PURE__ */ n(ve, { label: e.to_state_label, color: e.to_state_color, small: !0 })
858
+ e.from_state_label ? /* @__PURE__ */ n(Ne, { label: e.from_state_label, color: e.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
859
+ /* @__PURE__ */ n(lt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
860
+ /* @__PURE__ */ n(Ne, { label: e.to_state_label, color: e.to_state_color, small: !0 })
859
861
  ] }),
860
862
  c && /* @__PURE__ */ i("p", { className: "mt-1 text-slate-500 italic", children: [
861
863
  '"',
@@ -868,11 +870,11 @@ function rr({ history: t }) {
868
870
  className: "mt-0.5 text-slate-400",
869
871
  "data-history-on-behalf": e.on_behalf_of_name ? e.on_behalf_of ?? "" : void 0,
870
872
  children: [
871
- r && /* @__PURE__ */ n(Pt, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
872
- a,
873
- m ? ` · ${m}` : "",
873
+ r && /* @__PURE__ */ n(Ut, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
874
+ s,
875
+ p ? ` · ${p}` : "",
874
876
  " · ",
875
- at(e.timestamp)
877
+ ot(e.timestamp)
876
878
  ]
877
879
  }
878
880
  )
@@ -880,17 +882,17 @@ function rr({ history: t }) {
880
882
  ] }, e.id);
881
883
  }) });
882
884
  }
883
- function ar({ value: t, onChange: e }) {
884
- const r = xe(), [a, l] = j(!1), [c, m] = j(""), [b, h] = j(""), _ = ae(null), k = ae(null);
885
- he(() => {
886
- a ? setTimeout(() => {
887
- var R;
888
- return (R = _.current) == null ? void 0 : R.focus();
889
- }, 50) : m("");
890
- }, [a]), he(() => (k.current && clearTimeout(k.current), k.current = setTimeout(() => h(c), 250), () => {
891
- k.current && clearTimeout(k.current);
885
+ function cr({ value: t, onChange: e }) {
886
+ const r = we(), [s, l] = I(!1), [c, p] = I(""), [b, f] = I(""), _ = ne(null), v = ne(null);
887
+ fe(() => {
888
+ s ? setTimeout(() => {
889
+ var T;
890
+ return (T = _.current) == null ? void 0 : T.focus();
891
+ }, 50) : p("");
892
+ }, [s]), fe(() => (v.current && clearTimeout(v.current), v.current = setTimeout(() => f(c), 250), () => {
893
+ v.current && clearTimeout(v.current);
892
894
  }), [c]);
893
- const { data: w, isLoading: q } = le({
895
+ const { data: y, isLoading: $ } = oe({
894
896
  queryKey: ["users", "async-search", b],
895
897
  queryFn: () => r.request(
896
898
  ce("/users", {
@@ -898,24 +900,24 @@ function ar({ value: t, onChange: e }) {
898
900
  sort: "first_name",
899
901
  ...b ? { search: b } : {}
900
902
  })
901
- ).then((R) => R.data),
902
- enabled: a,
903
+ ).then((T) => T.data),
904
+ enabled: s,
903
905
  staleTime: 3e4
904
- }), { data: F } = le({
905
- ...Tn(r, t),
906
+ }), { data: A } = oe({
907
+ ...Dn(r, t),
906
908
  enabled: !!t,
907
909
  staleTime: 5 * 6e4
908
- }), B = w ?? [], A = F ?? B.find((R) => R.id === t) ?? null, L = A ? [A.first_name, A.last_name].filter(Boolean).join(" ").trim() || A.email : t ? "Selected person" : null, I = (R) => [R.first_name, R.last_name].filter(Boolean).join(" ").trim();
909
- return /* @__PURE__ */ i(st, { open: a, onOpenChange: l, children: [
910
+ }), E = y ?? [], B = A ?? E.find((T) => T.id === t) ?? null, H = B ? [B.first_name, B.last_name].filter(Boolean).join(" ").trim() || B.email : t ? "Selected person" : null, K = (T) => [T.first_name, T.last_name].filter(Boolean).join(" ").trim();
911
+ return /* @__PURE__ */ i(dt, { open: s, onOpenChange: l, children: [
910
912
  /* @__PURE__ */ i("div", { className: "relative flex h-8 w-full", children: [
911
- /* @__PURE__ */ n(it, { asChild: !0, children: /* @__PURE__ */ i(
913
+ /* @__PURE__ */ n(ct, { asChild: !0, children: /* @__PURE__ */ i(
912
914
  "button",
913
915
  {
914
916
  type: "button",
915
917
  className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 hover:border-slate-300",
916
918
  children: [
917
- /* @__PURE__ */ n("span", { className: `flex-1 truncate ${L ? "" : "text-slate-400"}`, children: L ?? "Select a user…" }),
918
- /* @__PURE__ */ n(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
919
+ /* @__PURE__ */ n("span", { className: `flex-1 truncate ${H ? "" : "text-slate-400"}`, children: H ?? "Select a user…" }),
920
+ /* @__PURE__ */ n($e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
919
921
  ]
920
922
  }
921
923
  ) }),
@@ -923,64 +925,64 @@ function ar({ value: t, onChange: e }) {
923
925
  "button",
924
926
  {
925
927
  type: "button",
926
- onClick: (R) => {
927
- R.stopPropagation(), e("");
928
+ onClick: (T) => {
929
+ T.stopPropagation(), e("");
928
930
  },
929
931
  className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
930
- children: /* @__PURE__ */ n(Mt, { className: "h-3 w-3" })
932
+ children: /* @__PURE__ */ n(Ot, { className: "h-3 w-3" })
931
933
  }
932
934
  )
933
935
  ] }),
934
- /* @__PURE__ */ i(lt, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
936
+ /* @__PURE__ */ i(ut, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
935
937
  /* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ i("div", { className: "relative", children: [
936
- /* @__PURE__ */ n(wn, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
938
+ /* @__PURE__ */ n(Cn, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
937
939
  /* @__PURE__ */ n(
938
940
  "input",
939
941
  {
940
942
  ref: _,
941
943
  value: c,
942
- onChange: (R) => m(R.target.value),
944
+ onChange: (T) => p(T.target.value),
943
945
  placeholder: "Search users…",
944
946
  className: "h-7 w-full rounded-md bg-slate-50 pl-7 pr-2 text-[12px] placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-nvr-cyan/40"
945
947
  }
946
948
  )
947
949
  ] }) }),
948
- /* @__PURE__ */ n("div", { className: "max-h-56 overflow-y-auto py-1", children: q ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
949
- /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }),
950
+ /* @__PURE__ */ n("div", { className: "max-h-56 overflow-y-auto py-1", children: $ ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
951
+ /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }),
950
952
  "Loading…"
951
- ] }) : B.length === 0 ? /* @__PURE__ */ n("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : B.map((R) => {
952
- const D = I(R), Q = D ? `${D} (${R.email})` : R.email, u = R.id === t;
953
+ ] }) : E.length === 0 ? /* @__PURE__ */ n("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : E.map((T) => {
954
+ const P = K(T), L = P ? `${P} (${T.email})` : T.email, h = T.id === t;
953
955
  return /* @__PURE__ */ i(
954
956
  "button",
955
957
  {
956
958
  type: "button",
957
959
  onClick: () => {
958
- e(R.id), l(!1);
960
+ e(T.id), l(!1);
959
961
  },
960
- className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${u ? "font-medium text-slate-800" : "text-slate-600"}`,
962
+ className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${h ? "font-medium text-slate-800" : "text-slate-600"}`,
961
963
  children: [
962
964
  /* @__PURE__ */ n(
963
- je,
965
+ We,
964
966
  {
965
- className: `h-3.5 w-3.5 shrink-0 ${u ? "text-nvr-cyan" : "opacity-0"}`
967
+ className: `h-3.5 w-3.5 shrink-0 ${h ? "text-nvr-cyan" : "opacity-0"}`
966
968
  }
967
969
  ),
968
- Q
970
+ L
969
971
  ]
970
972
  },
971
- R.id
973
+ T.id
972
974
  );
973
975
  }) })
974
976
  ] })
975
977
  ] });
976
978
  }
977
- function Tt({
979
+ function Dt({
978
980
  userId: t,
979
981
  name: e,
980
982
  email: r,
981
- initials: a
983
+ initials: s
982
984
  }) {
983
- return /* @__PURE__ */ n(Ut, { userId: t, children: /* @__PURE__ */ i(
985
+ return /* @__PURE__ */ n(Kt, { userId: t, children: /* @__PURE__ */ i(
984
986
  "button",
985
987
  {
986
988
  type: "button",
@@ -988,12 +990,12 @@ function Tt({
988
990
  className: "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
989
991
  children: [
990
992
  /* @__PURE__ */ n(
991
- An,
993
+ Bn,
992
994
  {
993
995
  userId: t,
994
996
  alt: e,
995
997
  className: "h-6 w-6",
996
- fallback: /* @__PURE__ */ n("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80 dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: a })
998
+ fallback: /* @__PURE__ */ n("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80 dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: s })
997
999
  }
998
1000
  ),
999
1001
  /* @__PURE__ */ i("span", { className: "min-w-0 flex-1", children: [
@@ -1004,157 +1006,157 @@ function Tt({
1004
1006
  }
1005
1007
  ) });
1006
1008
  }
1007
- function sr({
1009
+ function ur({
1008
1010
  collection: t,
1009
1011
  item: e,
1010
1012
  states: r,
1011
- currentStateId: a,
1013
+ currentStateId: s,
1012
1014
  returned: l = !1
1013
1015
  }) {
1014
- var me, ne, ke, Ne;
1015
- const c = xe(), m = Re(), { isAdmin: b } = kn(), [h, _] = j(!1), [k, w] = j(""), [q, F] = j(""), [B, A] = j(!1), L = ["pipeline-instance-owners", t, e], I = ["pipeline-owners-can-add", t, e], R = () => c.request(
1016
+ var he, be, d, _e;
1017
+ const c = we(), p = De(), { isAdmin: b } = Bt(), [f, _] = I(!1), [v, y] = I(""), [$, A] = I(""), [E, B] = I(!1), H = ["pipeline-instance-owners", t, e], K = ["pipeline-owners-can-add", t, e], T = () => c.request(
1016
1018
  ce(`/pipelines/instance/${t}/${e}/owners`)
1017
- ).then((s) => {
1018
- var p;
1019
- return m.setQueryData(I, ((p = s.meta) == null ? void 0 : p.can_add) ?? null), s;
1020
- }), { data: D, isLoading: Q } = le({
1021
- queryKey: L,
1022
- queryFn: () => R().then((s) => s.data)
1023
- }), { data: u } = le({
1024
- queryKey: I,
1025
- queryFn: () => R().then((s) => {
1026
- var p;
1027
- return ((p = s.meta) == null ? void 0 : p.can_add) ?? null;
1019
+ ).then((a) => {
1020
+ var m;
1021
+ return p.setQueryData(K, ((m = a.meta) == null ? void 0 : m.can_add) ?? null), a;
1022
+ }), { data: P, isLoading: L } = oe({
1023
+ queryKey: H,
1024
+ queryFn: () => T().then((a) => a.data)
1025
+ }), { data: h } = oe({
1026
+ queryKey: K,
1027
+ queryFn: () => T().then((a) => {
1028
+ var m;
1029
+ return ((m = a.meta) == null ? void 0 : m.can_add) ?? null;
1028
1030
  }),
1029
- enabled: !Q,
1031
+ enabled: !L,
1030
1032
  staleTime: 3e4
1031
- }), g = typeof u == "boolean" ? u : b, { data: N, isLoading: T } = le({
1033
+ }), x = typeof h == "boolean" ? h : b, { data: w, isLoading: q } = oe({
1032
1034
  queryKey: ["pipeline-all-owners", t, e],
1033
1035
  queryFn: () => c.request(
1034
1036
  ce(`/pipelines/instance/${t}/${e}/owners/all`)
1035
- ).then((s) => s.data ?? null),
1036
- enabled: !!a,
1037
+ ).then((a) => a.data ?? null),
1038
+ enabled: !!s,
1037
1039
  staleTime: 3e4
1038
- }), d = new Set((D ?? []).map((s) => s.user)), K = a ? (((me = N == null ? void 0 : N[a]) == null ? void 0 : me.owners) ?? []).filter((s) => !d.has(s.id)) : [], te = new Map(
1039
- (a ? ((ne = N == null ? void 0 : N[a]) == null ? void 0 : ne.unavailable) ?? [] : []).map((s) => [
1040
- String(s.id).toUpperCase(),
1041
- s
1040
+ }), o = new Set((P ?? []).map((a) => a.user)), Q = s ? (((he = w == null ? void 0 : w[s]) == null ? void 0 : he.owners) ?? []).filter((a) => !o.has(a.id)) : [], X = new Map(
1041
+ (s ? ((be = w == null ? void 0 : w[s]) == null ? void 0 : be.unavailable) ?? [] : []).map((a) => [
1042
+ String(a.id).toUpperCase(),
1043
+ a
1042
1044
  ])
1043
- ), y = K.length + ((D == null ? void 0 : D.length) ?? 0), S = !!((ke = r.find((s) => s.id === a)) != null && ke.is_initial), E = !Q && !T, { data: Y } = le({
1045
+ ), g = Q.length + ((P == null ? void 0 : P.length) ?? 0), k = !!((d = r.find((a) => a.id === s)) != null && d.is_initial), G = !L && !q, { data: se } = oe({
1044
1046
  queryKey: ["pipeline-record-creator", t, e],
1045
1047
  queryFn: () => c.request(
1046
1048
  ce(`/pipelines/instance/${t}/${e}/creator`)
1047
- ).then((s) => s.data ?? null),
1048
- enabled: S && E && y === 0,
1049
+ ).then((a) => a.data ?? null),
1050
+ enabled: k && G && g === 0,
1049
1051
  staleTime: 6e4
1050
- }), G = S && y === 0 && (Y != null && Y.name) ? Y : null, z = () => {
1051
- m.invalidateQueries({ queryKey: L }), m.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1052
- }, oe = qe({
1052
+ }), ee = k && g === 0 && (se != null && se.name) ? se : null, re = () => {
1053
+ p.invalidateQueries({ queryKey: H }), p.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1054
+ }, z = Pe({
1053
1055
  mutationFn: () => c.request(
1054
- Se(`/pipelines/instance/${t}/${e}/owners`, {
1055
- user: k,
1056
- state: q || void 0
1056
+ Te(`/pipelines/instance/${t}/${e}/owners`, {
1057
+ user: v,
1058
+ state: $ || void 0
1057
1059
  })
1058
1060
  ),
1059
1061
  onSuccess: () => {
1060
- z(), w(""), F(""), _(!1), X.success("Owner added");
1062
+ re(), y(""), A(""), _(!1), Y.success("Owner added");
1061
1063
  },
1062
1064
  // The server's reason (a 403 says why), not a bare status phrase.
1063
- onError: (s) => X.error(Me(s, "Failed to add owner"))
1064
- }), $ = qe({
1065
- mutationFn: (s) => c.request(Nn(`/pipelines/instance-owners/${s.id}`)),
1066
- onSuccess: (s, p) => {
1067
- z();
1068
- const x = [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email;
1069
- X.success(`${x} removed as an owner`, {
1065
+ onError: (a) => Y.error(Fe(a, "Failed to add owner"))
1066
+ }), C = Pe({
1067
+ mutationFn: (a) => c.request(Tn(`/pipelines/instance-owners/${a.id}`)),
1068
+ onSuccess: (a, m) => {
1069
+ re();
1070
+ const N = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email;
1071
+ Y.success(`${N} removed as an owner`, {
1070
1072
  action: {
1071
1073
  label: "Undo",
1072
1074
  onClick: () => void c.request(
1073
- Se(`/pipelines/instance/${t}/${e}/owners`, {
1074
- user: p.user,
1075
- state: p.state || void 0
1075
+ Te(`/pipelines/instance/${t}/${e}/owners`, {
1076
+ user: m.user,
1077
+ state: m.state || void 0
1076
1078
  })
1077
- ).then(() => z()).catch((M) => X.error(Me(M, "Could not add the owner back")))
1079
+ ).then(() => re()).catch((D) => Y.error(Fe(D, "Could not add the owner back")))
1078
1080
  }
1079
1081
  });
1080
1082
  },
1081
- onError: (s) => X.error(Me(s, "Failed to remove owner"))
1082
- }), o = (s) => {
1083
- var M, P;
1084
- const p = ((M = s.first_name) == null ? void 0 : M[0]) ?? "", x = ((P = s.last_name) == null ? void 0 : P[0]) ?? "";
1085
- return (`${p}${x}`.trim() || s.email[0] || "?").toUpperCase();
1086
- }, ue = (s) => {
1087
- var p;
1088
- return s ? ((p = r.find((x) => x.id === s || x.key === s)) == null ? void 0 : p.label) ?? s : null;
1083
+ onError: (a) => Y.error(Fe(a, "Failed to remove owner"))
1084
+ }), de = (a) => {
1085
+ var D, M;
1086
+ const m = ((D = a.first_name) == null ? void 0 : D[0]) ?? "", N = ((M = a.last_name) == null ? void 0 : M[0]) ?? "";
1087
+ return (`${m}${N}`.trim() || a.email[0] || "?").toUpperCase();
1088
+ }, J = (a) => {
1089
+ var m;
1090
+ return a ? ((m = r.find((N) => N.id === a || N.key === a)) == null ? void 0 : m.label) ?? a : null;
1089
1091
  };
1090
1092
  return /* @__PURE__ */ i("div", { children: [
1091
1093
  /* @__PURE__ */ i("div", { className: "mb-3 flex items-center justify-between", children: [
1092
1094
  /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
1093
- /* @__PURE__ */ n(Rt, { className: "h-3.5 w-3.5" }),
1095
+ /* @__PURE__ */ n(At, { className: "h-3.5 w-3.5" }),
1094
1096
  "Owners",
1095
- Q || T ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : G ? null : /* @__PURE__ */ i("span", { className: "text-slate-300", children: [
1097
+ L || q ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : ee ? null : /* @__PURE__ */ i("span", { className: "text-slate-300", children: [
1096
1098
  "(",
1097
- y,
1099
+ g,
1098
1100
  ")"
1099
1101
  ] })
1100
1102
  ] }),
1101
1103
  /* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
1102
- a && /* @__PURE__ */ n(Un, { collection: t, itemId: String(e) }),
1103
- !h && g && /* @__PURE__ */ i(
1104
+ s && /* @__PURE__ */ n(In, { collection: t, itemId: String(e) }),
1105
+ !f && x && /* @__PURE__ */ i(
1104
1106
  "button",
1105
1107
  {
1106
1108
  type: "button",
1107
1109
  onClick: () => _(!0),
1108
1110
  className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
1109
1111
  children: [
1110
- /* @__PURE__ */ n(yn, { className: "h-3 w-3" }),
1112
+ /* @__PURE__ */ n(Sn, { className: "h-3 w-3" }),
1111
1113
  "Add"
1112
1114
  ]
1113
1115
  }
1114
1116
  )
1115
1117
  ] })
1116
1118
  ] }),
1117
- Q || T ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1118
- /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }),
1119
+ L || q ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1120
+ /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }),
1119
1121
  "Resolving owners…"
1120
- ] }) : G ? /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1122
+ ] }) : ee ? /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1121
1123
  l ? "Back with" : "With",
1122
1124
  " ",
1123
- /* @__PURE__ */ n(Ut, { userId: G.id, children: /* @__PURE__ */ n(
1125
+ /* @__PURE__ */ n(Kt, { userId: ee.id, children: /* @__PURE__ */ n(
1124
1126
  "button",
1125
1127
  {
1126
1128
  type: "button",
1127
- "aria-label": `${G.name} — profile`,
1129
+ "aria-label": `${ee.name} — profile`,
1128
1130
  className: "rounded font-medium text-slate-700 underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-foreground",
1129
- children: G.name
1131
+ children: ee.name
1130
1132
  }
1131
1133
  ) })
1132
- ] }) : y === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ i("div", { className: "space-y-px", children: [
1133
- K.map((s) => {
1134
- var M, P;
1135
- const p = [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email, x = (`${((M = s.first_name) == null ? void 0 : M[0]) ?? ""}${((P = s.last_name) == null ? void 0 : P[0]) ?? ""}`.trim() || s.email[0] || "?").toUpperCase();
1134
+ ] }) : g === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ i("div", { className: "space-y-px", children: [
1135
+ Q.map((a) => {
1136
+ var D, M;
1137
+ const m = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, N = (`${((D = a.first_name) == null ? void 0 : D[0]) ?? ""}${((M = a.last_name) == null ? void 0 : M[0]) ?? ""}`.trim() || a.email[0] || "?").toUpperCase();
1136
1138
  return /* @__PURE__ */ i(
1137
1139
  "div",
1138
1140
  {
1139
1141
  className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1140
1142
  children: [
1141
- /* @__PURE__ */ n(Tt, { userId: s.id, name: p, email: s.email, initials: x }),
1143
+ /* @__PURE__ */ n(Dt, { userId: a.id, name: m, email: a.email, initials: N }),
1142
1144
  (() => {
1143
- const v = te.get(String(s.id).toUpperCase());
1144
- return v ? /* @__PURE__ */ n(
1145
+ const R = X.get(String(a.id).toUpperCase());
1146
+ return R ? /* @__PURE__ */ n(
1145
1147
  "span",
1146
1148
  {
1147
- "data-owner-unavailable": v.reason,
1148
- className: ge(
1149
+ "data-owner-unavailable": R.reason,
1150
+ className: ye(
1149
1151
  "shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",
1150
- v.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1152
+ R.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1151
1153
  ),
1152
- "data-tip": v.delegate ? `${p} is ${Te[v.reason] ?? v.reason} — ${v.delegate.name} covers` : `${p} is ${Te[v.reason] ?? v.reason} and can't approve this step`,
1153
- children: v.delegate ? `${Te[v.reason] ?? v.reason} · ${v.delegate.name} covers` : Te[v.reason] ?? v.reason
1154
+ "data-tip": R.delegate ? `${m} is ${Re[R.reason] ?? R.reason} — ${R.delegate.name} covers` : `${m} is ${Re[R.reason] ?? R.reason} and can't approve this step`,
1155
+ children: R.delegate ? `${Re[R.reason] ?? R.reason} · ${R.delegate.name} covers` : Re[R.reason] ?? R.reason
1154
1156
  }
1155
1157
  ) : null;
1156
1158
  })(),
1157
- s.queue_only ? /* @__PURE__ */ n(
1159
+ a.queue_only ? /* @__PURE__ */ n(
1158
1160
  "span",
1159
1161
  {
1160
1162
  className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
@@ -1164,115 +1166,115 @@ function sr({
1164
1166
  ) : /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
1165
1167
  ]
1166
1168
  },
1167
- `group-${s.id}`
1169
+ `group-${a.id}`
1168
1170
  );
1169
1171
  }),
1170
- (D ?? []).map((s) => /* @__PURE__ */ i(
1172
+ (P ?? []).map((a) => /* @__PURE__ */ i(
1171
1173
  "div",
1172
1174
  {
1173
1175
  className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1174
1176
  children: [
1175
1177
  /* @__PURE__ */ n(
1176
- Tt,
1178
+ Dt,
1177
1179
  {
1178
- userId: s.user,
1179
- name: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email,
1180
- email: s.email,
1181
- initials: o(s)
1180
+ userId: a.user,
1181
+ name: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email,
1182
+ email: a.email,
1183
+ initials: de(a)
1182
1184
  }
1183
1185
  ),
1184
1186
  /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
1185
- /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: s.state ? ue(s.state) : "all states" }),
1187
+ /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: a.state ? J(a.state) : "all states" }),
1186
1188
  /* @__PURE__ */ n(
1187
1189
  "button",
1188
1190
  {
1189
1191
  type: "button",
1190
- "aria-label": `Remove ${[s.first_name, s.last_name].filter(Boolean).join(" ") || s.email} as an owner`,
1191
- disabled: $.isPending,
1192
- onClick: () => $.mutate(s),
1192
+ "aria-label": `Remove ${[a.first_name, a.last_name].filter(Boolean).join(" ") || a.email} as an owner`,
1193
+ disabled: C.isPending,
1194
+ onClick: () => C.mutate(a),
1193
1195
  className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
1194
- children: /* @__PURE__ */ n(Mt, { className: "h-3 w-3" })
1196
+ children: /* @__PURE__ */ n(Ot, { className: "h-3 w-3" })
1195
1197
  }
1196
1198
  )
1197
1199
  ]
1198
1200
  },
1199
- s.id
1201
+ a.id
1200
1202
  ))
1201
1203
  ] }),
1202
- h && /* @__PURE__ */ i("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
1204
+ f && /* @__PURE__ */ i("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
1203
1205
  /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
1204
- /* @__PURE__ */ n(ar, { value: k, onChange: w }),
1205
- b ? /* @__PURE__ */ i(st, { open: B, onOpenChange: A, children: [
1206
- /* @__PURE__ */ n(it, { asChild: !0, children: /* @__PURE__ */ i(
1206
+ /* @__PURE__ */ n(cr, { value: v, onChange: y }),
1207
+ b ? /* @__PURE__ */ i(dt, { open: E, onOpenChange: B, children: [
1208
+ /* @__PURE__ */ n(ct, { asChild: !0, children: /* @__PURE__ */ i(
1207
1209
  "button",
1208
1210
  {
1209
1211
  type: "button",
1210
1212
  className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
1211
1213
  children: [
1212
- /* @__PURE__ */ n("span", { className: "truncate", children: q ? ((Ne = r.find((s) => s.id === q)) == null ? void 0 : Ne.label) ?? q : "All states" }),
1213
- /* @__PURE__ */ n(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1214
+ /* @__PURE__ */ n("span", { className: "truncate", children: $ ? ((_e = r.find((a) => a.id === $)) == null ? void 0 : _e.label) ?? $ : "All states" }),
1215
+ /* @__PURE__ */ n($e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1214
1216
  ]
1215
1217
  }
1216
1218
  ) }),
1217
- /* @__PURE__ */ n(lt, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((s) => s.id)].map((s) => {
1218
- var M;
1219
- const p = s === "" ? "All states" : ((M = r.find((P) => P.id === s)) == null ? void 0 : M.label) ?? s;
1219
+ /* @__PURE__ */ n(ut, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((a) => a.id)].map((a) => {
1220
+ var D;
1221
+ const m = a === "" ? "All states" : ((D = r.find((M) => M.id === a)) == null ? void 0 : D.label) ?? a;
1220
1222
  return /* @__PURE__ */ n(
1221
1223
  "button",
1222
1224
  {
1223
1225
  type: "button",
1224
- className: ge(
1226
+ className: ye(
1225
1227
  "flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1226
- q === s && "font-medium text-slate-800 dark:text-slate-200"
1228
+ $ === a && "font-medium text-slate-800 dark:text-slate-200"
1227
1229
  ),
1228
1230
  onClick: () => {
1229
- F(s), A(!1);
1231
+ A(a), B(!1);
1230
1232
  },
1231
- children: p
1233
+ children: m
1232
1234
  },
1233
- s
1235
+ a
1234
1236
  );
1235
1237
  }) })
1236
1238
  ] }) : /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
1237
1239
  /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
1238
1240
  /* @__PURE__ */ n(
1239
- re,
1241
+ ae,
1240
1242
  {
1241
1243
  type: "button",
1242
1244
  size: "sm",
1243
1245
  variant: "ghost",
1244
1246
  className: "h-7 text-[12px]",
1245
1247
  onClick: () => {
1246
- _(!1), w(""), F("");
1248
+ _(!1), y(""), A("");
1247
1249
  },
1248
1250
  children: "Cancel"
1249
1251
  }
1250
1252
  ),
1251
1253
  /* @__PURE__ */ n(
1252
- re,
1254
+ ae,
1253
1255
  {
1254
1256
  type: "button",
1255
1257
  size: "sm",
1256
1258
  className: "h-7 text-[12px]",
1257
- disabled: !k || oe.isPending,
1258
- onClick: () => oe.mutate(),
1259
- children: oe.isPending ? /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1259
+ disabled: !v || z.isPending,
1260
+ onClick: () => z.mutate(),
1261
+ children: z.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1260
1262
  }
1261
1263
  )
1262
1264
  ] })
1263
1265
  ] })
1264
1266
  ] });
1265
1267
  }
1266
- function dn(t, e, r, a) {
1268
+ function hn(t, e, r, s) {
1267
1269
  if (!t || !(r != null && r.length)) return null;
1268
- const c = new Map(r.map((h) => [String(h.id).toUpperCase(), h])).get(String(t.to_state).toUpperCase()), m = Number(e == null ? void 0 : e.sort);
1269
- if (!c || !Number.isFinite(m) || !(Number(c.sort) > m)) return null;
1270
- const b = Ln(String(t.to_state), r, a);
1270
+ const c = new Map(r.map((f) => [String(f.id).toUpperCase(), f])).get(String(t.to_state).toUpperCase()), p = Number(e == null ? void 0 : e.sort);
1271
+ if (!c || !Number.isFinite(p) || !(Number(c.sort) > p)) return null;
1272
+ const b = Qn(String(t.to_state), r, s);
1271
1273
  return b && b.skipped.length > 0 ? b : null;
1272
1274
  }
1273
- function cn({ landing: t }) {
1275
+ function bn({ landing: t }) {
1274
1276
  if (!t || t.skipped.length === 0) return null;
1275
- const e = En(t);
1277
+ const e = Wn(t);
1276
1278
  if (e.length === 1) {
1277
1279
  const r = e[0];
1278
1280
  return /* @__PURE__ */ i(
@@ -1285,7 +1287,7 @@ function cn({ landing: t }) {
1285
1287
  /* @__PURE__ */ n("span", { className: "font-medium", children: t.state.label }),
1286
1288
  " —",
1287
1289
  " ",
1288
- kt(r.labels),
1290
+ $t(r.labels),
1289
1291
  " ",
1290
1292
  r.labels.length === 1 ? "is" : "are",
1291
1293
  " skipped",
@@ -1307,114 +1309,114 @@ function cn({ landing: t }) {
1307
1309
  ". Skipped on the way:"
1308
1310
  ] }),
1309
1311
  /* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((r) => /* @__PURE__ */ i("li", { children: [
1310
- /* @__PURE__ */ n("span", { className: "font-medium", children: kt(r.labels) }),
1312
+ /* @__PURE__ */ n("span", { className: "font-medium", children: $t(r.labels) }),
1311
1313
  r.reason ? ` — ${r.reason}` : ""
1312
1314
  ] }, r.labels.join("|"))) })
1313
1315
  ]
1314
1316
  }
1315
1317
  );
1316
1318
  }
1317
- const Te = {
1319
+ const Re = {
1318
1320
  out: "out of office",
1319
1321
  suspended: "suspended",
1320
1322
  redacted: "redacted"
1321
1323
  };
1322
- function ir({
1324
+ function mr({
1323
1325
  collection: t,
1324
1326
  item: e,
1325
1327
  states: r,
1326
- currentStateId: a
1328
+ currentStateId: s
1327
1329
  }) {
1328
- const l = xe(), [c, m] = j(!1), { data: b, isLoading: h } = le({
1330
+ const l = we(), [c, p] = I(!1), { data: b, isLoading: f } = oe({
1329
1331
  queryKey: ["pipeline-all-owners", t, e],
1330
1332
  queryFn: () => l.request(
1331
1333
  ce(`/pipelines/instance/${t}/${e}/owners/all`)
1332
- ).then((k) => k.data ?? null),
1334
+ ).then((v) => v.data ?? null),
1333
1335
  enabled: c,
1334
1336
  staleTime: 3e4
1335
- }), _ = [...r].filter((k) => {
1336
- var w;
1337
- return !b || ((w = b[k.id]) == null ? void 0 : w.on_path) !== !1;
1338
- }).sort((k, w) => k.sort - w.sort);
1339
- return /* @__PURE__ */ i(st, { open: c, onOpenChange: m, children: [
1340
- /* @__PURE__ */ n(it, { asChild: !0, children: /* @__PURE__ */ n(
1337
+ }), _ = [...r].filter((v) => {
1338
+ var y;
1339
+ return !b || ((y = b[v.id]) == null ? void 0 : y.on_path) !== !1;
1340
+ }).sort((v, y) => v.sort - y.sort);
1341
+ return /* @__PURE__ */ i(dt, { open: c, onOpenChange: p, children: [
1342
+ /* @__PURE__ */ n(ct, { asChild: !0, children: /* @__PURE__ */ n(
1341
1343
  "button",
1342
1344
  {
1343
1345
  type: "button",
1344
1346
  title: "View approval chain",
1345
1347
  className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
1346
- onClick: (k) => k.stopPropagation(),
1347
- children: /* @__PURE__ */ n(Rt, { className: "h-3.5 w-3.5" })
1348
+ onClick: (v) => v.stopPropagation(),
1349
+ children: /* @__PURE__ */ n(At, { className: "h-3.5 w-3.5" })
1348
1350
  }
1349
1351
  ) }),
1350
- /* @__PURE__ */ i(lt, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
1352
+ /* @__PURE__ */ i(ut, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
1351
1353
  /* @__PURE__ */ i("div", { className: "border-b border-slate-100 px-4 py-3", children: [
1352
1354
  /* @__PURE__ */ n("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
1353
1355
  /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
1354
1356
  ] }),
1355
- /* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: h ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((k) => /* @__PURE__ */ n(we, { className: "h-10 w-full" }, k)) }) : b ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: _.map((k) => {
1356
- var I, R, D, Q, u;
1357
- const w = (((I = b[k.id]) == null ? void 0 : I.owners) ?? []).map((g) => ({
1358
- id: g.id,
1359
- name: [g.first_name, g.last_name].filter(Boolean).join(" ") || g.email
1360
- })), q = k.id === a, F = ((R = b[k.id]) == null ? void 0 : R.skipped) === !0 && !q, B = (((D = b[k.id]) == null ? void 0 : D.skip_reasons) ?? []).filter(Boolean), A = ((Q = b[k.id]) == null ? void 0 : Q.unavailable) ?? [], L = ((u = b[k.id]) == null ? void 0 : u.blocked) === !0 && !F;
1357
+ /* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: f ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((v) => /* @__PURE__ */ n(ke, { className: "h-10 w-full" }, v)) }) : b ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: _.map((v) => {
1358
+ var K, T, P, L, h;
1359
+ const y = (((K = b[v.id]) == null ? void 0 : K.owners) ?? []).map((x) => ({
1360
+ id: x.id,
1361
+ name: [x.first_name, x.last_name].filter(Boolean).join(" ") || x.email
1362
+ })), $ = v.id === s, A = ((T = b[v.id]) == null ? void 0 : T.skipped) === !0 && !$, E = (((P = b[v.id]) == null ? void 0 : P.skip_reasons) ?? []).filter(Boolean), B = ((L = b[v.id]) == null ? void 0 : L.unavailable) ?? [], H = ((h = b[v.id]) == null ? void 0 : h.blocked) === !0 && !A;
1361
1363
  return /* @__PURE__ */ i(
1362
1364
  "div",
1363
1365
  {
1364
- className: ge(
1366
+ className: ye(
1365
1367
  "flex items-center gap-3 px-4 py-2.5",
1366
1368
  // Hex-with-alpha rather than bg-nvr-cyan/N — the
1367
1369
  // nvr-cyan token is an opaque var() so Tailwind silently
1368
1370
  // drops opacity modifiers on it. Kept very light so the
1369
1371
  // tint doesn't clash with the state badge's own color.
1370
- q && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1371
- F && "opacity-60",
1372
- L && "bg-red-50 dark:bg-red-500/10"
1372
+ $ && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1373
+ A && "opacity-60",
1374
+ H && "bg-red-50 dark:bg-red-500/10"
1373
1375
  ),
1374
- "data-chain-blocked": L ? "" : void 0,
1376
+ "data-chain-blocked": H ? "" : void 0,
1375
1377
  children: [
1376
- /* @__PURE__ */ n(ve, { label: k.label, color: k.color, small: !0 }),
1377
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: F ? (
1378
+ /* @__PURE__ */ n(Ne, { label: v.label, color: v.color, small: !0 }),
1379
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: A ? (
1378
1380
  // Radix tooltip with zero delay — native `title` waits on
1379
1381
  // the OS hover timer, and a truncated reason needs its
1380
1382
  // full text the moment the cursor lands on it.
1381
- /* @__PURE__ */ n(Bt, { delayDuration: 0, children: /* @__PURE__ */ i(Je, { children: [
1382
- /* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1383
+ /* @__PURE__ */ n(Qt, { delayDuration: 0, children: /* @__PURE__ */ i(nt, { children: [
1384
+ /* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1383
1385
  /* @__PURE__ */ n("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
1384
- B.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: B.join(" · ") })
1386
+ E.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: E.join(" · ") })
1385
1387
  ] }) }),
1386
1388
  /* @__PURE__ */ i(
1387
- et,
1389
+ at,
1388
1390
  {
1389
1391
  side: "bottom",
1390
1392
  align: "start",
1391
1393
  className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
1392
1394
  children: [
1393
1395
  /* @__PURE__ */ n("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
1394
- B.length > 0 ? B.map((g) => /* @__PURE__ */ n("p", { children: g }, g)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1396
+ E.length > 0 ? E.map((x) => /* @__PURE__ */ n("p", { children: x }, x)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1395
1397
  ]
1396
1398
  }
1397
1399
  )
1398
1400
  ] }) })
1399
- ) : /* @__PURE__ */ i(be, { children: [
1400
- /* @__PURE__ */ n(Fn, { owners: w, max: 10, emptyLabel: "—" }),
1401
- A.map((g) => /* @__PURE__ */ i(
1401
+ ) : /* @__PURE__ */ i(xe, { children: [
1402
+ /* @__PURE__ */ n(Ln, { owners: y, max: 10, emptyLabel: "—" }),
1403
+ B.map((x) => /* @__PURE__ */ i(
1402
1404
  "span",
1403
1405
  {
1404
- "data-tip": `${g.name} is ${Te[g.reason] ?? g.reason}${g.delegate ? ` — ${g.delegate.name} covers${g.delegate.expires_at ? ` until ${Rn(g.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1405
- className: ge(
1406
+ "data-tip": `${x.name} is ${Re[x.reason] ?? x.reason}${x.delegate ? ` — ${x.delegate.name} covers${x.delegate.expires_at ? ` until ${An(x.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1407
+ className: ye(
1406
1408
  "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
1407
- g.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1409
+ x.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1408
1410
  ),
1409
1411
  children: [
1410
- g.name,
1411
- g.delegate ? /* @__PURE__ */ i(be, { children: [
1412
+ x.name,
1413
+ x.delegate ? /* @__PURE__ */ i(xe, { children: [
1412
1414
  " → ",
1413
- g.delegate.name,
1414
- g.delegate.expires_at && /* @__PURE__ */ i("span", { className: "opacity-70", children: [
1415
+ x.delegate.name,
1416
+ x.delegate.expires_at && /* @__PURE__ */ i("span", { className: "opacity-70", children: [
1415
1417
  ", until",
1416
1418
  " ",
1417
- new Date(g.delegate.expires_at).toLocaleDateString(
1419
+ new Date(x.delegate.expires_at).toLocaleDateString(
1418
1420
  void 0,
1419
1421
  {
1420
1422
  month: "short",
@@ -1425,75 +1427,75 @@ function ir({
1425
1427
  ] }) : /* @__PURE__ */ i("span", { className: "opacity-80", children: [
1426
1428
  " ",
1427
1429
  "· ",
1428
- Te[g.reason] ?? g.reason
1430
+ Re[x.reason] ?? x.reason
1429
1431
  ] })
1430
1432
  ]
1431
1433
  },
1432
- g.id
1434
+ x.id
1433
1435
  )),
1434
- L && /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
1436
+ H && /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
1435
1437
  ] }) })
1436
1438
  ]
1437
1439
  },
1438
- k.id
1440
+ v.id
1439
1441
  );
1440
1442
  }) }) : /* @__PURE__ */ n("p", { className: "px-4 py-3 text-[12px] text-slate-400", children: "No pipeline configured." }) })
1441
1443
  ] })
1442
1444
  ] });
1443
1445
  }
1444
- function Lr({
1446
+ function Hr({
1445
1447
  collection: t,
1446
1448
  item: e,
1447
1449
  defaultExpanded: r,
1448
- title: a,
1450
+ title: s,
1449
1451
  showApprovalChain: l,
1450
1452
  hideActionsCollapsed: c,
1451
- hideActionsExpanded: m,
1453
+ hideActionsExpanded: p,
1452
1454
  onBeforeTransition: b,
1453
- addendumPending: h,
1455
+ addendumPending: f,
1454
1456
  addendumView: _,
1455
- asRole: k
1457
+ asRole: v
1456
1458
  }) {
1457
1459
  return e === "new" ? null : /* @__PURE__ */ n(
1458
- lr,
1460
+ pr,
1459
1461
  {
1460
1462
  collection: t,
1461
1463
  item: e,
1462
1464
  defaultExpanded: r,
1463
- title: a,
1465
+ title: s,
1464
1466
  showApprovalChain: l,
1465
1467
  hideActionsCollapsed: c,
1466
- hideActionsExpanded: m,
1468
+ hideActionsExpanded: p,
1467
1469
  onBeforeTransition: b,
1468
- addendumPending: h,
1470
+ addendumPending: f,
1469
1471
  addendumView: _,
1470
- asRole: k
1472
+ asRole: v
1471
1473
  },
1472
1474
  `${t}:${e}`
1473
1475
  );
1474
1476
  }
1475
- function un({
1477
+ function gn({
1476
1478
  collection: t,
1477
1479
  item: e,
1478
1480
  omitLines: r
1479
1481
  }) {
1480
- const a = xe(), { data: l } = le({
1481
- queryKey: Vt(t, e),
1482
- queryFn: () => Xt(a, t, e),
1482
+ const s = we(), { data: l } = oe({
1483
+ queryKey: tn(t, e),
1484
+ queryFn: () => nn(s, t, e),
1483
1485
  staleTime: 3e4,
1484
1486
  retry: !1
1485
1487
  });
1486
1488
  if (!l) return null;
1487
- const c = l.changed_by_people ?? l.changed_total, m = new Set((r ?? []).map(St)), b = (l.lines ?? []).filter((h) => !m.has(St(h)));
1489
+ const c = l.changed_by_people ?? l.changed_total, p = new Set((r ?? []).map(Mt)), b = (l.lines ?? []).filter((f) => !p.has(Mt(f)));
1488
1490
  return /* @__PURE__ */ i("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
1489
1491
  /* @__PURE__ */ i("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
1490
1492
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
1491
1493
  " ",
1492
1494
  "(",
1493
- Vn(l.days_in_state),
1495
+ tr(l.days_in_state),
1494
1496
  "):",
1495
1497
  " ",
1496
- l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ i(be, { children: [
1498
+ l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ i(xe, { children: [
1497
1499
  c > 0 && /* @__PURE__ */ i("span", { children: [
1498
1500
  c,
1499
1501
  " field",
@@ -1518,19 +1520,19 @@ function un({
1518
1520
  ] })
1519
1521
  ] }),
1520
1522
  l.field_changes.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1 space-y-0.5", children: [
1521
- l.field_changes.slice(0, 5).map((h) => {
1522
- const _ = Xn(h.old, h.new);
1523
+ l.field_changes.slice(0, 5).map((f) => {
1524
+ const _ = nr(f.old, f.new);
1523
1525
  return /* @__PURE__ */ i(
1524
1526
  "p",
1525
1527
  {
1526
- "data-brief-change": h.field,
1528
+ "data-brief-change": f.field,
1527
1529
  className: "text-[11px] text-slate-500 dark:text-muted-foreground",
1528
1530
  children: [
1529
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: h.label || qn(h.field) }),
1530
- h.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1531
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: f.label || Fn(f.field) }),
1532
+ f.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1531
1533
  ":",
1532
1534
  " ",
1533
- _.old !== null && /* @__PURE__ */ i(be, { children: [
1535
+ _.old !== null && /* @__PURE__ */ i(xe, { children: [
1534
1536
  /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: _.old }),
1535
1537
  /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " → " }),
1536
1538
  /* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
@@ -1538,7 +1540,7 @@ function un({
1538
1540
  /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: _.new })
1539
1541
  ]
1540
1542
  },
1541
- h.field
1543
+ f.field
1542
1544
  );
1543
1545
  }),
1544
1546
  l.field_changes.length > 5 && /* @__PURE__ */ i("p", { className: "text-[10.5px] text-slate-400", children: [
@@ -1547,107 +1549,122 @@ function un({
1547
1549
  " more — see History for the full trail"
1548
1550
  ] })
1549
1551
  ] }),
1550
- b.map((h) => /* @__PURE__ */ i(
1552
+ b.map((f) => /* @__PURE__ */ i(
1551
1553
  "p",
1552
1554
  {
1553
- "data-brief-line": h.label,
1555
+ "data-brief-line": f.label,
1554
1556
  className: "mt-1 text-slate-500 dark:text-muted-foreground",
1555
1557
  children: [
1556
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: h.label }),
1558
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: f.label }),
1557
1559
  " ",
1558
1560
  /* @__PURE__ */ n(
1559
1561
  "span",
1560
1562
  {
1561
- className: h.tone === "danger" ? "text-red-700 dark:text-red-300" : h.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
1562
- children: h.text
1563
+ className: f.tone === "danger" ? "text-red-700 dark:text-red-300" : f.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
1564
+ children: f.text
1563
1565
  }
1564
1566
  )
1565
1567
  ]
1566
1568
  },
1567
- `${h.label}:${h.text}`
1569
+ `${f.label}:${f.text}`
1568
1570
  ))
1569
1571
  ] });
1570
1572
  }
1571
- function lr({
1573
+ function pr({
1572
1574
  collection: t,
1573
1575
  item: e,
1574
1576
  defaultExpanded: r,
1575
- title: a,
1577
+ title: s,
1576
1578
  showApprovalChain: l,
1577
1579
  hideActionsCollapsed: c,
1578
- hideActionsExpanded: m,
1580
+ hideActionsExpanded: p,
1579
1581
  onBeforeTransition: b,
1580
- addendumPending: h,
1582
+ addendumPending: f,
1581
1583
  addendumView: _,
1582
- asRole: k
1584
+ asRole: v
1583
1585
  }) {
1584
- var pt, ft, ht;
1585
- const w = xe(), q = Re(), [F, B] = j(""), [A, L] = j(null), [I, R] = j(!1), [D, Q] = j(!1), [u, g] = j(null), [N, T] = j(null), [d, K] = j([]), te = Yt(t, String(e));
1586
- Ot(t, e, "transition", !!A || !!u);
1587
- const y = Sn(t, e, "transition"), S = ae(!1);
1588
- he(() => {
1589
- !S.current && r !== void 0 && (S.current = !0, Q(r));
1586
+ var gt, xt, yt;
1587
+ const y = we(), $ = De(), { isAdmin: A } = Bt(), [E, B] = I(0), H = ne(null);
1588
+ fe(() => {
1589
+ if (!A) return;
1590
+ const u = (S) => {
1591
+ const F = S.detail;
1592
+ !F || F.claimed || F.collection !== t || String(F.item) !== String(e) || (F.claimed = !0, q(!0), B((W) => W + 1), setTimeout(
1593
+ () => {
1594
+ var W;
1595
+ return (W = H.current) == null ? void 0 : W.scrollIntoView({ block: "center", behavior: "smooth" });
1596
+ },
1597
+ 80
1598
+ ));
1599
+ };
1600
+ return window.addEventListener(Nt, u), () => window.removeEventListener(Nt, u);
1601
+ }, [A, t, e]);
1602
+ const [K, T] = I(""), [P, L] = I(null), [h, x] = I(!1), [w, q] = I(!1), [o, Q] = I(null), [X, g] = I(null), [k, G] = I([]), se = rn(t, String(e));
1603
+ It(t, e, "transition", !!P || !!o);
1604
+ const ee = Mn(t, e, "transition"), re = ne(!1);
1605
+ fe(() => {
1606
+ !re.current && r !== void 0 && (re.current = !0, q(r));
1590
1607
  }, [r]);
1591
- const E = ae(!1), Y = (f) => {
1592
- E.current || (E.current = !0, T(null), x.mutate(f, {
1593
- onSettled: (C, U) => {
1594
- if (U) {
1595
- E.current = !1;
1608
+ const z = ne(!1), C = (u) => {
1609
+ z.current || (z.current = !0, g(null), j.mutate(u, {
1610
+ onSettled: (S, F) => {
1611
+ if (F) {
1612
+ z.current = !1;
1596
1613
  return;
1597
1614
  }
1598
- $().finally(() => {
1599
- E.current = !1;
1615
+ be().finally(() => {
1616
+ z.current = !1;
1600
1617
  });
1601
1618
  }
1602
1619
  }));
1603
- }, G = async (f) => {
1604
- var J, ie;
1605
- if (E.current) return;
1606
- if (A === f) {
1620
+ }, de = async (u) => {
1621
+ var Z, le;
1622
+ if (z.current) return;
1623
+ if (P === u) {
1607
1624
  L(null);
1608
1625
  return;
1609
1626
  }
1610
1627
  if (b) {
1611
- E.current = !0;
1612
- let ee = !1;
1628
+ z.current = !0;
1629
+ let te = !1;
1613
1630
  try {
1614
- ee = await b();
1631
+ te = await b();
1615
1632
  } finally {
1616
- E.current = !1;
1633
+ z.current = !1;
1617
1634
  }
1618
- if (!ee) return;
1635
+ if (!te) return;
1619
1636
  }
1620
- const C = (W ?? []).find((ee) => ee.id === f), U = String((C == null ? void 0 : C.comment_mode) ?? "none"), V = Zt(C, (o == null ? void 0 : o.states) ?? [], (J = o == null ? void 0 : o.instance) == null ? void 0 : J.current_state);
1621
- if (U !== "optional" && U !== "required") {
1622
- if (C && !De(C, (o == null ? void 0 : o.states) ?? [], (ie = o == null ? void 0 : o.instance) == null ? void 0 : ie.current_state)) {
1623
- E.current = !0;
1624
- let ee = [];
1637
+ const S = (ge ?? []).find((te) => te.id === u), F = String((S == null ? void 0 : S.comment_mode) ?? "none"), W = sn(S, (d == null ? void 0 : d.states) ?? [], (Z = d == null ? void 0 : d.instance) == null ? void 0 : Z.current_state);
1638
+ if (F !== "optional" && F !== "required") {
1639
+ if (S && !Oe(S, (d == null ? void 0 : d.states) ?? [], (le = d == null ? void 0 : d.instance) == null ? void 0 : le.current_state)) {
1640
+ z.current = !0;
1641
+ let te = [];
1625
1642
  try {
1626
- ee = await te();
1643
+ te = await se();
1627
1644
  } finally {
1628
- E.current = !1;
1645
+ z.current = !1;
1629
1646
  }
1630
- if (ee.length > 0 || V) {
1631
- K(ee), L(f);
1647
+ if (te.length > 0 || W) {
1648
+ G(te), L(u);
1632
1649
  return;
1633
1650
  }
1634
1651
  }
1635
- if (V) {
1636
- K([]), L(f);
1652
+ if (W) {
1653
+ G([]), L(u);
1637
1654
  return;
1638
1655
  }
1639
- Y({ transition_id: f });
1656
+ C({ transition_id: u });
1640
1657
  return;
1641
1658
  }
1642
- K([]), L(f);
1643
- }, z = k ? ["pipeline-instance", t, e, k] : ["pipeline-instance", t, e], { settling: oe, settle: $ } = Ht(z), { data: o, isLoading: ue } = le({
1644
- queryKey: z,
1645
- queryFn: () => w.request(
1659
+ G([]), L(u);
1660
+ }, J = v ? ["pipeline-instance", t, e, v] : ["pipeline-instance", t, e], { settling: he, settle: be } = Zt(J), { data: d, isLoading: _e } = oe({
1661
+ queryKey: J,
1662
+ queryFn: () => y.request(
1646
1663
  ce(
1647
- `/pipelines/instance/${t}/${e}${k ? `?as_role=${encodeURIComponent(k)}` : ""}`
1664
+ `/pipelines/instance/${t}/${e}${v ? `?as_role=${encodeURIComponent(v)}` : ""}`
1648
1665
  )
1649
1666
  ).then(
1650
- (f) => f.data ?? {
1667
+ (u) => u.data ?? {
1651
1668
  instance: null,
1652
1669
  states: [],
1653
1670
  available_transitions: [],
@@ -1657,256 +1674,256 @@ function lr({
1657
1674
  }
1658
1675
  ),
1659
1676
  staleTime: 1e4
1660
- }), me = Gt(
1661
- o ? (o.available_transitions ?? []).map((f) => String(f.id)) : null,
1677
+ }), a = en(
1678
+ d ? (d.available_transitions ?? []).map((u) => String(u.id)) : null,
1662
1679
  `${t}:${e}`
1663
1680
  );
1664
- he(
1665
- () => q.getQueryCache().subscribe((f) => {
1666
- if (f.type !== "updated" || f.action.type !== "success") return;
1667
- const C = f.query.queryKey;
1668
- Array.isArray(C) && C[0] === "item" && C[1] === t && String(C[2]) === e && q.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1681
+ fe(
1682
+ () => $.getQueryCache().subscribe((u) => {
1683
+ if (u.type !== "updated" || u.action.type !== "success") return;
1684
+ const S = u.query.queryKey;
1685
+ Array.isArray(S) && S[0] === "item" && S[1] === t && String(S[2]) === e && $.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1669
1686
  }),
1670
- [q, t, e]
1687
+ [$, t, e]
1671
1688
  );
1672
- const { data: ne, isLoading: ke } = le({
1689
+ const { data: m, isLoading: N } = oe({
1673
1690
  queryKey: ["pipeline-all-owners", t, e],
1674
- queryFn: () => w.request(
1691
+ queryFn: () => y.request(
1675
1692
  ce(`/pipelines/instance/${t}/${e}/owners/all`)
1676
- ).then((f) => f.data ?? null),
1693
+ ).then((u) => u.data ?? null),
1677
1694
  // Also when a send back is on offer: its target may be a chain step this record skipped.
1678
1695
  // And while a move is being confirmed: the panel names where it really lands.
1679
- enabled: (D || nn(o) || !!A) && !!(o != null && o.instance),
1696
+ enabled: (w || dn(d) || !!P) && !!(d != null && d.instance),
1680
1697
  staleTime: 3e4
1681
- }), Ne = Be(() => {
1682
- if (!ne) return null;
1683
- const f = Object.entries(ne);
1684
- return f.length === 0 || f.every(([, C]) => C.on_path === void 0) ? null : new Set(f.filter(([, C]) => C.on_path !== !1).map(([C]) => C));
1685
- }, [ne]), s = Be(() => {
1686
- if (!ne) return null;
1687
- const f = /* @__PURE__ */ new Map();
1688
- for (const [C, U] of Object.entries(ne))
1689
- U.skipped && f.set(C, U.skip_reasons ?? []);
1690
- return f;
1691
- }, [ne]), p = qe({
1692
- mutationFn: () => w.request(Se(`/pipelines/instance/${t}/${e}/start`, {})),
1698
+ }), D = Ie(() => {
1699
+ if (!m) return null;
1700
+ const u = Object.entries(m);
1701
+ return u.length === 0 || u.every(([, S]) => S.on_path === void 0) ? null : new Set(u.filter(([, S]) => S.on_path !== !1).map(([S]) => S));
1702
+ }, [m]), M = Ie(() => {
1703
+ if (!m) return null;
1704
+ const u = /* @__PURE__ */ new Map();
1705
+ for (const [S, F] of Object.entries(m))
1706
+ F.skipped && u.set(S, F.skip_reasons ?? []);
1707
+ return u;
1708
+ }, [m]), R = Pe({
1709
+ mutationFn: () => y.request(Te(`/pipelines/instance/${t}/${e}/start`, {})),
1693
1710
  onSuccess: () => {
1694
- q.invalidateQueries({ queryKey: z }), X.success("Pipeline started");
1711
+ $.invalidateQueries({ queryKey: J }), Y.success("Pipeline started");
1695
1712
  },
1696
- onError: () => X.error("Failed to start pipeline")
1697
- }), x = qe({
1713
+ onError: () => Y.error("Failed to start pipeline")
1714
+ }), j = Pe({
1698
1715
  mutationFn: ({
1699
- transition_id: f,
1700
- comment: C,
1701
- reviewed: U,
1702
- lock_ack: V
1703
- }) => w.request(
1704
- Se(`/pipelines/instance/${t}/${e}/transition`, {
1705
- transition_id: f,
1706
- comment: C,
1707
- ...U ? { reviewed: !0 } : {},
1708
- ...V ? { lock_ack: !0 } : {}
1716
+ transition_id: u,
1717
+ comment: S,
1718
+ reviewed: F,
1719
+ lock_ack: W
1720
+ }) => y.request(
1721
+ Te(`/pipelines/instance/${t}/${e}/transition`, {
1722
+ transition_id: u,
1723
+ comment: S,
1724
+ ...F ? { reviewed: !0 } : {},
1725
+ ...W ? { lock_ack: !0 } : {}
1709
1726
  })
1710
1727
  ),
1711
- onMutate: (f) => {
1712
- var C;
1728
+ onMutate: (u) => {
1729
+ var S;
1713
1730
  return {
1714
- slow: sn(
1715
- (C = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
1716
- (U) => U.id === f.transition_id
1717
- )) == null ? void 0 : C.label
1731
+ slow: mn(
1732
+ (S = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
1733
+ (F) => F.id === u.transition_id
1734
+ )) == null ? void 0 : S.label
1718
1735
  )
1719
1736
  };
1720
1737
  },
1721
- onSuccess: (f, C, U) => {
1722
- q.invalidateQueries({ queryKey: z }), t === "nivaro_addendums" && q.invalidateQueries({ queryKey: ["addendums"] }), Ee(q, t, String(e)), Pe(q, t, String(e)), ln(q, t, String(e)), T(null), B(""), L(null), g(null), X.success(an(o, C.transition_id, f), U == null ? void 0 : U.slow.done());
1738
+ onSuccess: (u, S, F) => {
1739
+ $.invalidateQueries({ queryKey: J }), t === "nivaro_addendums" && $.invalidateQueries({ queryKey: ["addendums"] }), Qe($, t, String(e)), Ae($, t, String(e)), pn($, t, String(e)), g(null), T(""), L(null), Q(null), Y.success(un(d, S.transition_id, u), F == null ? void 0 : F.slow.done());
1723
1740
  },
1724
- onError: (f, C, U) => {
1725
- var ee;
1726
- if (U == null || U.slow.fail(), It(f)) {
1727
- q.invalidateQueries({ queryKey: z });
1741
+ onError: (u, S, F) => {
1742
+ var te;
1743
+ if (F == null || F.slow.fail(), Gt(u)) {
1744
+ $.invalidateQueries({ queryKey: J });
1728
1745
  return;
1729
1746
  }
1730
- const V = Wt(f);
1731
- if (V) {
1747
+ const W = Yt(u);
1748
+ if (W) {
1732
1749
  L(null);
1733
- const ye = ((ee = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
1734
- (Ae) => Ae.id === C.transition_id
1735
- )) == null ? void 0 : ee.label) ?? "Move";
1736
- X.warning(V.message, {
1750
+ const ve = ((te = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
1751
+ (Le) => Le.id === S.transition_id
1752
+ )) == null ? void 0 : te.label) ?? "Move";
1753
+ Y.warning(W.message, {
1737
1754
  id: `nvr-locked-move:${t}:${String(e)}`,
1738
1755
  duration: 2e4,
1739
1756
  action: {
1740
- label: `${ye} anyway`,
1741
- onClick: () => Y({ ...C, lock_ack: !0 })
1757
+ label: `${ve} anyway`,
1758
+ onClick: () => C({ ...S, lock_ack: !0 })
1742
1759
  },
1743
1760
  cancel: { label: "Wait", onClick: () => {
1744
1761
  } }
1745
1762
  });
1746
1763
  return;
1747
1764
  }
1748
- const J = Kt(f);
1749
- if (J) {
1750
- g((ye) => ({
1751
- payload: J,
1752
- transitionId: C.transition_id,
1753
- comment: C.comment,
1754
- revision: ((ye == null ? void 0 : ye.revision) ?? 0) + 1
1765
+ const Z = Vt(u);
1766
+ if (Z) {
1767
+ Q((ve) => ({
1768
+ payload: Z,
1769
+ transitionId: S.transition_id,
1770
+ comment: S.comment,
1771
+ revision: ((ve == null ? void 0 : ve.revision) ?? 0) + 1
1755
1772
  }));
1756
1773
  return;
1757
1774
  }
1758
- const ie = f == null ? void 0 : f.response;
1759
- T(zt(f, C)), X.error(Me(f, "Failed to execute transition"), {
1775
+ const le = u == null ? void 0 : u.response;
1776
+ g(Jt(u, S)), Y.error(Fe(u, "Failed to execute transition"), {
1760
1777
  duration: 12e3,
1761
1778
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
1762
- ...At(f, { action: "Transition" }),
1779
+ ...jt(u, { action: "Transition" }),
1763
1780
  // #1867: a refusal carries "Why?" — the role, owner or access rule
1764
1781
  // that stopped it, and who can change it.
1765
- ...Lt(f) ? {
1766
- action: Et(w, {
1782
+ ...Wt(u) ? {
1783
+ action: zt(y, {
1767
1784
  collection: t,
1768
1785
  itemId: String(e),
1769
1786
  action: "transition",
1770
- transitionId: C.transition_id
1787
+ transitionId: S.transition_id
1771
1788
  })
1772
1789
  } : {}
1773
- }), g(null), L(null), Ee(q, t, String(e)), Pe(q, t, String(e)), (ie == null ? void 0 : ie.status) === 409 && q.invalidateQueries({ queryKey: z });
1790
+ }), Q(null), L(null), Qe($, t, String(e)), Ae($, t, String(e)), (le == null ? void 0 : le.status) === 409 && $.invalidateQueries({ queryKey: J });
1774
1791
  }
1775
- }), M = ae(G);
1776
- M.current = G;
1777
- const P = ae((o == null ? void 0 : o.available_transitions) ?? []);
1778
- if (P.current = (o == null ? void 0 : o.available_transitions) ?? [], he(() => {
1779
- const f = (C) => {
1780
- const U = C.detail;
1781
- if (!U || U.claimed || U.collection !== t || String(U.item) !== String(e)) return;
1782
- U.claimed = !0;
1783
- const V = String(U.transition_id).toUpperCase(), J = P.current.find((ie) => String(ie.id).toUpperCase() === V);
1784
- if (!J) {
1785
- X.error("That step is not available from where the record is now");
1792
+ }), ue = ne(de);
1793
+ ue.current = de;
1794
+ const U = ne((d == null ? void 0 : d.available_transitions) ?? []);
1795
+ if (U.current = (d == null ? void 0 : d.available_transitions) ?? [], fe(() => {
1796
+ const u = (S) => {
1797
+ const F = S.detail;
1798
+ if (!F || F.claimed || F.collection !== t || String(F.item) !== String(e)) return;
1799
+ F.claimed = !0;
1800
+ const W = String(F.transition_id).toUpperCase(), Z = U.current.find((le) => String(le.id).toUpperCase() === W);
1801
+ if (!Z) {
1802
+ Y.error("That step is not available from where the record is now");
1786
1803
  return;
1787
1804
  }
1788
- M.current(J.id);
1805
+ ue.current(Z.id);
1789
1806
  };
1790
- return window.addEventListener(Le, f), () => window.removeEventListener(Le, f);
1791
- }, [t, e]), ue)
1807
+ return window.addEventListener(Ke, u), () => window.removeEventListener(Ke, u);
1808
+ }, [t, e]), _e)
1792
1809
  return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ i("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
1793
- /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
1794
- /* @__PURE__ */ n(we, { className: "h-4 w-20" }),
1795
- /* @__PURE__ */ n(we, { className: "h-[22px] w-40 rounded-full" }),
1796
- /* @__PURE__ */ n(we, { className: "ml-auto h-3.5 w-3.5 rounded" })
1810
+ /* @__PURE__ */ n(ke, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
1811
+ /* @__PURE__ */ n(ke, { className: "h-4 w-20" }),
1812
+ /* @__PURE__ */ n(ke, { className: "h-[22px] w-40 rounded-full" }),
1813
+ /* @__PURE__ */ n(ke, { className: "ml-auto h-3.5 w-3.5 rounded" })
1797
1814
  ] }) });
1798
- if (!(o != null && o.binding)) return null;
1799
- const { instance: v, available_transitions: W, history: Z, states: O } = o, de = new Map((O ?? []).map((f) => [f.id, f])), fe = (v == null ? void 0 : v.current_state_obj) ?? null, se = A ? (W ?? []).find((f) => f.id === A) : null, mn = se ? de.get(se.to_state) : null, Fe = dn(se, fe, O, ne), Ie = (Fe == null ? void 0 : Fe.state) ?? mn, pn = v != null && v.completed_at && W ? W.filter(
1800
- (f) => f.from_state && String(f.from_state).toUpperCase() === String(v.current_state).toUpperCase()
1801
- ) : null, Ke = v != null && v.completed_at ? pn ?? [] : rn(
1802
- W ?? [],
1803
- O ?? [],
1804
- v == null ? void 0 : v.current_state,
1805
- s
1806
- ), dt = Ke.length > 0, ct = (f, C = !1) => {
1807
- const U = /* @__PURE__ */ new Map();
1808
- for (const V of f) {
1809
- const J = U.get(V.label) ?? [];
1810
- J.push(V), U.set(V.label, J);
1815
+ if (!(d != null && d.binding)) return null;
1816
+ const { instance: O, available_transitions: ge, history: Se, states: pe } = d, Ue = new Map((pe ?? []).map((u) => [u.id, u])), Ce = (O == null ? void 0 : O.current_state_obj) ?? null, ie = P ? (ge ?? []).find((u) => u.id === P) : null, xn = ie ? Ue.get(ie.to_state) : null, Ee = hn(ie, Ce, pe, m), ze = (Ee == null ? void 0 : Ee.state) ?? xn, yn = O != null && O.completed_at && ge ? ge.filter(
1817
+ (u) => u.from_state && String(u.from_state).toUpperCase() === String(O.current_state).toUpperCase()
1818
+ ) : null, He = O != null && O.completed_at ? yn ?? [] : cn(
1819
+ ge ?? [],
1820
+ pe ?? [],
1821
+ O == null ? void 0 : O.current_state,
1822
+ M
1823
+ ), pt = He.length > 0, ft = (u, S = !1) => {
1824
+ const F = /* @__PURE__ */ new Map();
1825
+ for (const W of u) {
1826
+ const Z = F.get(W.label) ?? [];
1827
+ Z.push(W), F.set(W.label, Z);
1811
1828
  }
1812
- return Array.from(U.entries()).map(([V, J]) => {
1813
- var Ae, bt;
1814
- const ie = ((Ae = J[0]) == null ? void 0 : Ae.color) ?? null, ee = J.some((H) => H.id === A), ye = (H) => ie ? H ? { backgroundColor: ie, borderColor: ie } : { borderColor: ie, color: ie } : void 0;
1815
- if (J.length === 1) {
1816
- const H = J[0], Ce = x.isPending && ((bt = x.variables) == null ? void 0 : bt.transition_id) === H.id;
1829
+ return Array.from(F.entries()).map(([W, Z]) => {
1830
+ var Le, wt;
1831
+ const le = ((Le = Z[0]) == null ? void 0 : Le.color) ?? null, te = Z.some((V) => V.id === P), ve = (V) => le ? V ? { backgroundColor: le, borderColor: le } : { borderColor: le, color: le } : void 0;
1832
+ if (Z.length === 1) {
1833
+ const V = Z[0], qe = j.isPending && ((wt = j.variables) == null ? void 0 : wt.transition_id) === V.id;
1817
1834
  return /* @__PURE__ */ i(
1818
- re,
1835
+ ae,
1819
1836
  {
1820
1837
  size: "sm",
1821
- variant: ee ? "default" : "outline",
1822
- className: `${C ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5 data-[fresh=true]:opacity-60`,
1823
- style: ye(ee),
1824
- disabled: x.isPending || oe,
1825
- "aria-disabled": me.dimmed(H.id) || void 0,
1826
- "data-fresh": me.dimmed(H.id) || void 0,
1827
- ...me.bind(H.id),
1838
+ variant: te ? "default" : "outline",
1839
+ className: `${S ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5 data-[fresh=true]:opacity-60`,
1840
+ style: ve(te),
1841
+ disabled: j.isPending || he,
1842
+ "aria-disabled": a.dimmed(V.id) || void 0,
1843
+ "data-fresh": a.dimmed(V.id) || void 0,
1844
+ ...a.bind(V.id),
1828
1845
  onClick: () => {
1829
- me.press(H.id) && G(H.id);
1846
+ a.press(V.id) && de(V.id);
1830
1847
  },
1831
1848
  children: [
1832
- Ce && /* @__PURE__ */ n(pe, { className: "h-3 w-3 animate-spin" }),
1833
- V
1849
+ qe && /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }),
1850
+ W
1834
1851
  ]
1835
1852
  },
1836
- V
1853
+ W
1837
1854
  );
1838
1855
  }
1839
- return /* @__PURE__ */ i(Ve, { children: [
1840
- /* @__PURE__ */ n(Xe, { asChild: !0, children: /* @__PURE__ */ i(
1841
- re,
1856
+ return /* @__PURE__ */ i(Ze, { children: [
1857
+ /* @__PURE__ */ n(et, { asChild: !0, children: /* @__PURE__ */ i(
1858
+ ae,
1842
1859
  {
1843
1860
  size: "sm",
1844
- variant: ee ? "default" : "outline",
1845
- className: `${C ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
1846
- style: ye(ee),
1847
- disabled: x.isPending || oe,
1861
+ variant: te ? "default" : "outline",
1862
+ className: `${S ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
1863
+ style: ve(te),
1864
+ disabled: j.isPending || he,
1848
1865
  children: [
1849
- V,
1850
- /* @__PURE__ */ n(_e, { className: "h-3 w-3" })
1866
+ W,
1867
+ /* @__PURE__ */ n($e, { className: "h-3 w-3" })
1851
1868
  ]
1852
1869
  }
1853
1870
  ) }),
1854
- /* @__PURE__ */ n(Ye, { align: "start", children: [...J].sort(
1855
- (H, Ce) => {
1856
- var gt, xt;
1857
- return (((gt = de.get(H.to_state)) == null ? void 0 : gt.sort) ?? 999) - (((xt = de.get(Ce.to_state)) == null ? void 0 : xt.sort) ?? 999);
1871
+ /* @__PURE__ */ n(tt, { align: "start", children: [...Z].sort(
1872
+ (V, qe) => {
1873
+ var vt, kt;
1874
+ return (((vt = Ue.get(V.to_state)) == null ? void 0 : vt.sort) ?? 999) - (((kt = Ue.get(qe.to_state)) == null ? void 0 : kt.sort) ?? 999);
1858
1875
  }
1859
- ).map((H) => {
1860
- var Ce;
1861
- return /* @__PURE__ */ i(Oe, { onSelect: () => G(H.id), children: [
1862
- H.color && /* @__PURE__ */ n(
1876
+ ).map((V) => {
1877
+ var qe;
1878
+ return /* @__PURE__ */ i(Be, { onSelect: () => de(V.id), children: [
1879
+ V.color && /* @__PURE__ */ n(
1863
1880
  "span",
1864
1881
  {
1865
1882
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
1866
- style: { backgroundColor: H.color }
1883
+ style: { backgroundColor: V.color }
1867
1884
  }
1868
1885
  ),
1869
- ((Ce = de.get(H.to_state)) == null ? void 0 : Ce.label) ?? H.to_state
1870
- ] }, H.id);
1886
+ ((qe = Ue.get(V.to_state)) == null ? void 0 : qe.label) ?? V.to_state
1887
+ ] }, V.id);
1871
1888
  }) })
1872
- ] }, V);
1889
+ ] }, W);
1873
1890
  });
1874
- }, Qe = N ? /* @__PURE__ */ n(
1875
- on,
1891
+ }, Ge = X ? /* @__PURE__ */ n(
1892
+ fn,
1876
1893
  {
1877
1894
  collection: t,
1878
1895
  item: String(e),
1879
- offer: N,
1880
- onDismiss: () => T(null),
1881
- onFixed: () => Y({ transition_id: N.transitionId, comment: N.comment })
1896
+ offer: X,
1897
+ onDismiss: () => g(null),
1898
+ onFixed: () => C({ transition_id: X.transitionId, comment: X.comment })
1882
1899
  }
1883
- ) : null, ut = Zn(Z ?? [], v == null ? void 0 : v.current_state, O ?? []), mt = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
1900
+ ) : null, ht = sr(Se ?? [], O == null ? void 0 : O.current_state, pe ?? []), bt = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
1884
1901
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
1885
1902
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
1886
- se && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: se.label }),
1887
- fe && Ie && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
1888
- /* @__PURE__ */ n(ve, { label: fe.label, color: fe.color, small: !0 }),
1889
- /* @__PURE__ */ n(rt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1890
- /* @__PURE__ */ n(ve, { label: Ie.label, color: Ie.color, small: !0 })
1903
+ ie && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: ie.label }),
1904
+ Ce && ze && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
1905
+ /* @__PURE__ */ n(Ne, { label: Ce.label, color: Ce.color, small: !0 }),
1906
+ /* @__PURE__ */ n(lt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1907
+ /* @__PURE__ */ n(Ne, { label: ze.label, color: ze.color, small: !0 })
1891
1908
  ] })
1892
1909
  ] }),
1893
- /* @__PURE__ */ n(cn, { landing: Fe }),
1894
- /* @__PURE__ */ n(tn, { collection: t, item: String(e), tx: se }),
1895
- /* @__PURE__ */ n(un, { collection: t, item: e, omitLines: d }),
1896
- /* @__PURE__ */ n(Jt, { lines: d }),
1910
+ /* @__PURE__ */ n(bn, { landing: Ee }),
1911
+ /* @__PURE__ */ n(on, { collection: t, item: String(e), tx: ie }),
1912
+ /* @__PURE__ */ n(gn, { collection: t, item: e, omitLines: k }),
1913
+ /* @__PURE__ */ n(an, { lines: k }),
1897
1914
  /* @__PURE__ */ n(
1898
1915
  "input",
1899
1916
  {
1900
1917
  type: "text",
1901
- value: F,
1902
- onChange: (f) => B(f.target.value),
1903
- placeholder: String((se == null ? void 0 : se.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
1918
+ value: K,
1919
+ onChange: (u) => T(u.target.value),
1920
+ placeholder: String((ie == null ? void 0 : ie.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
1904
1921
  className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
1905
1922
  }
1906
1923
  ),
1907
1924
  /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
1908
1925
  /* @__PURE__ */ n(
1909
- re,
1926
+ ae,
1910
1927
  {
1911
1928
  type: "button",
1912
1929
  size: "sm",
@@ -1917,25 +1934,25 @@ function lr({
1917
1934
  }
1918
1935
  ),
1919
1936
  /* @__PURE__ */ n(
1920
- re,
1937
+ ae,
1921
1938
  {
1922
1939
  type: "button",
1923
1940
  size: "sm",
1924
1941
  className: "h-7 gap-1.5 text-[12px]",
1925
- disabled: x.isPending || String((se == null ? void 0 : se.comment_mode) ?? "") === "required" && F.trim() === "",
1926
- onClick: () => Y({
1927
- transition_id: A,
1928
- comment: F.trim() || void 0
1942
+ disabled: j.isPending || String((ie == null ? void 0 : ie.comment_mode) ?? "") === "required" && K.trim() === "",
1943
+ onClick: () => C({
1944
+ transition_id: P,
1945
+ comment: K.trim() || void 0
1929
1946
  }),
1930
- children: x.isPending ? /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(be, { children: [
1931
- /* @__PURE__ */ n("span", { children: d.length > 0 && se ? `${se.label} anyway` : "Confirm" }),
1932
- /* @__PURE__ */ n(je, { className: "h-3 w-3" })
1947
+ children: j.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(xe, { children: [
1948
+ /* @__PURE__ */ n("span", { children: k.length > 0 && ie ? `${ie.label} anyway` : "Confirm" }),
1949
+ /* @__PURE__ */ n(We, { className: "h-3 w-3" })
1933
1950
  ] })
1934
1951
  }
1935
1952
  )
1936
1953
  ] })
1937
1954
  ] });
1938
- return /* @__PURE__ */ i(be, { children: [
1955
+ return /* @__PURE__ */ i(xe, { children: [
1939
1956
  /* @__PURE__ */ i(
1940
1957
  "div",
1941
1958
  {
@@ -1946,151 +1963,151 @@ function lr({
1946
1963
  {
1947
1964
  role: "button",
1948
1965
  tabIndex: 0,
1949
- onClick: () => Q((f) => !f),
1950
- onKeyDown: (f) => (f.key === "Enter" || f.key === " ") && Q((C) => !C),
1966
+ onClick: () => q((u) => !u),
1967
+ onKeyDown: (u) => (u.key === "Enter" || u.key === " ") && q((S) => !S),
1951
1968
  className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
1952
1969
  children: [
1953
- /* @__PURE__ */ n(ze, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
1954
- /* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: a || "Pipeline" }),
1970
+ /* @__PURE__ */ n(Xe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
1971
+ /* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: s || "Pipeline" }),
1955
1972
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
1956
1973
  _ && /* @__PURE__ */ n("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
1957
- fe && /* @__PURE__ */ n(ve, { label: fe.label, color: fe.color }),
1958
- /* @__PURE__ */ n(en, { flags: o == null ? void 0 : o.flags }),
1959
- (((pt = o == null ? void 0 : o.auto_held) == null ? void 0 : pt.length) ?? 0) > 0 && /* @__PURE__ */ i(
1974
+ Ce && /* @__PURE__ */ n(Ne, { label: Ce.label, color: Ce.color }),
1975
+ /* @__PURE__ */ n(ln, { flags: d == null ? void 0 : d.flags }),
1976
+ (((gt = d == null ? void 0 : d.auto_held) == null ? void 0 : gt.length) ?? 0) > 0 && /* @__PURE__ */ i(
1960
1977
  "span",
1961
1978
  {
1962
1979
  className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400",
1963
- "data-tip": ((o == null ? void 0 : o.auto_held) ?? []).map((f) => `${f.transition_label ?? "Automatic move"}: ${f.error ?? "refused"}`).join(`
1980
+ "data-tip": ((d == null ? void 0 : d.auto_held) ?? []).map((u) => `${u.transition_label ?? "Automatic move"}: ${u.error ?? "refused"}`).join(`
1964
1981
  `),
1965
1982
  "data-pipeline-auto-held-pill": !0,
1966
1983
  children: [
1967
- /* @__PURE__ */ n(bn, { className: "h-3 w-3 shrink-0" }),
1984
+ /* @__PURE__ */ n(kn, { className: "h-3 w-3 shrink-0" }),
1968
1985
  "Needs a person"
1969
1986
  ]
1970
1987
  }
1971
1988
  ),
1972
- h && /* @__PURE__ */ i("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
1989
+ f && /* @__PURE__ */ i("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
1973
1990
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
1974
1991
  "Addendum in review"
1975
1992
  ] }),
1976
- y.length > 0 && /* @__PURE__ */ i(
1993
+ ee.length > 0 && /* @__PURE__ */ i(
1977
1994
  "span",
1978
1995
  {
1979
1996
  className: "flex items-center gap-1 rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:border-sky-500/20 dark:bg-sky-500/10 dark:text-sky-300",
1980
1997
  "data-pipeline-approving": !0,
1981
1998
  children: [
1982
1999
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
1983
- Cn(y, "approving")
2000
+ Rn(ee, "approving")
1984
2001
  ]
1985
2002
  }
1986
2003
  )
1987
2004
  ] }),
1988
- /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-2", onClick: (f) => f.stopPropagation(), children: [
1989
- !D && dt && !c && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: ct(Ke, !0) }),
1990
- !D && !v && (o == null ? void 0 : o.binding) && /* @__PURE__ */ i(
1991
- re,
2005
+ /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-2", onClick: (u) => u.stopPropagation(), children: [
2006
+ !w && pt && !c && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: ft(He, !0) }),
2007
+ !w && !O && (d == null ? void 0 : d.binding) && /* @__PURE__ */ i(
2008
+ ae,
1992
2009
  {
1993
2010
  size: "sm",
1994
2011
  variant: "outline",
1995
2012
  className: "h-7 gap-1.5 text-[11px]",
1996
- onClick: (f) => {
1997
- f.stopPropagation(), p.mutate();
2013
+ onClick: (u) => {
2014
+ u.stopPropagation(), R.mutate();
1998
2015
  },
1999
- disabled: p.isPending,
2016
+ disabled: R.isPending,
2000
2017
  children: [
2001
- p.isPending ? /* @__PURE__ */ n(pe, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(ze, { className: "h-3 w-3" }),
2018
+ R.isPending ? /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(Xe, { className: "h-3 w-3" }),
2002
2019
  "Start"
2003
2020
  ]
2004
2021
  }
2005
2022
  ),
2006
- l && ((o == null ? void 0 : o.binding) || (o == null ? void 0 : o.instance)) && /* @__PURE__ */ n(
2007
- ir,
2023
+ l && ((d == null ? void 0 : d.binding) || (d == null ? void 0 : d.instance)) && /* @__PURE__ */ n(
2024
+ mr,
2008
2025
  {
2009
2026
  collection: t,
2010
2027
  item: e,
2011
- states: O ?? [],
2012
- currentStateId: ((ft = o == null ? void 0 : o.instance) == null ? void 0 : ft.current_state) ?? null
2028
+ states: pe ?? [],
2029
+ currentStateId: ((xt = d == null ? void 0 : d.instance) == null ? void 0 : xt.current_state) ?? null
2013
2030
  }
2014
2031
  )
2015
2032
  ] }),
2016
2033
  /* @__PURE__ */ n(
2017
- _e,
2034
+ $e,
2018
2035
  {
2019
- className: ge(
2036
+ className: ye(
2020
2037
  "h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
2021
- D && "rotate-180"
2038
+ w && "rotate-180"
2022
2039
  )
2023
2040
  }
2024
2041
  )
2025
2042
  ]
2026
2043
  }
2027
2044
  ),
2028
- !D && A && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: mt }),
2029
- !D && Qe && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Qe }),
2030
- ut && !(v != null && v.completed_at) && /* @__PURE__ */ n(er, { entry: ut }),
2031
- D && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2032
- /* @__PURE__ */ n(Qn, { held: (o == null ? void 0 : o.auto_held) ?? [] }),
2033
- h && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
2045
+ !w && P && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: bt }),
2046
+ !w && Ge && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ge }),
2047
+ ht && !(O != null && O.completed_at) && /* @__PURE__ */ n(ir, { entry: ht }),
2048
+ w && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2049
+ /* @__PURE__ */ n(Xn, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
2050
+ f && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
2034
2051
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
2035
2052
  /* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
2036
2053
  ] }),
2037
- v ? /* @__PURE__ */ i("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2038
- (O ?? []).length > 1 && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2039
- ke ? (
2054
+ O ? /* @__PURE__ */ i("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2055
+ (pe ?? []).length > 1 && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2056
+ N ? (
2040
2057
  // Path pruning arrives with the owners query — rendering
2041
2058
  // the UNPRUNED track first meant every state briefly
2042
2059
  // showed, then snapped into formation. Hold a same-height
2043
2060
  // placeholder until the real shape is known.
2044
2061
  /* @__PURE__ */ i("div", { className: "flex h-[52px] items-center gap-2", children: [
2045
- [0, 1, 2, 3, 4].map((f) => /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
2046
- /* @__PURE__ */ n(we, { className: "h-7 w-7 rounded-full" }),
2047
- f < 4 && /* @__PURE__ */ n(we, { className: "h-0.5 w-10" })
2048
- ] }, f)),
2049
- /* @__PURE__ */ n(we, { className: "ml-2 h-3 w-24" })
2062
+ [0, 1, 2, 3, 4].map((u) => /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
2063
+ /* @__PURE__ */ n(ke, { className: "h-7 w-7 rounded-full" }),
2064
+ u < 4 && /* @__PURE__ */ n(ke, { className: "h-0.5 w-10" })
2065
+ ] }, u)),
2066
+ /* @__PURE__ */ n(ke, { className: "ml-2 h-3 w-24" })
2050
2067
  ] })
2051
2068
  ) : /* @__PURE__ */ n(
2052
- nr,
2069
+ or,
2053
2070
  {
2054
- states: O,
2055
- allTransitions: (o == null ? void 0 : o.all_transitions) ?? [],
2056
- availableTransitions: W ?? [],
2057
- currentStateId: v.current_state,
2058
- history: Z ?? [],
2059
- onPathIds: Ne,
2060
- skippedStates: s
2071
+ states: pe,
2072
+ allTransitions: (d == null ? void 0 : d.all_transitions) ?? [],
2073
+ availableTransitions: ge ?? [],
2074
+ currentStateId: O.current_state,
2075
+ history: Se ?? [],
2076
+ onPathIds: D,
2077
+ skippedStates: M
2061
2078
  }
2062
2079
  ),
2063
- (o == null ? void 0 : o.branches) && /* @__PURE__ */ n(Bn, { data: o.branches }),
2080
+ (d == null ? void 0 : d.branches) && /* @__PURE__ */ n(Kn, { data: d.branches }),
2064
2081
  /* @__PURE__ */ n(
2065
- tr,
2082
+ lr,
2066
2083
  {
2067
- history: Z ?? [],
2068
- completedAt: v.completed_at
2084
+ history: Se ?? [],
2085
+ completedAt: O.completed_at
2069
2086
  }
2070
2087
  )
2071
2088
  ] }),
2072
2089
  /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2073
- !v.completed_at && /* @__PURE__ */ n(jn, { collection: t, itemId: String(e) }),
2090
+ !O.completed_at && /* @__PURE__ */ n(Hn, { collection: t, itemId: String(e) }),
2074
2091
  /* @__PURE__ */ n(
2075
- sr,
2092
+ ur,
2076
2093
  {
2077
2094
  collection: t,
2078
2095
  item: e,
2079
- states: O ?? [],
2080
- currentStateId: ((ht = o == null ? void 0 : o.instance) == null ? void 0 : ht.current_state) ?? null,
2081
- returned: ((o == null ? void 0 : o.history) ?? []).some(
2082
- (f) => {
2083
- var C;
2084
- return !!f.from_state && f.to_state === ((C = o == null ? void 0 : o.instance) == null ? void 0 : C.current_state);
2096
+ states: pe ?? [],
2097
+ currentStateId: ((yt = d == null ? void 0 : d.instance) == null ? void 0 : yt.current_state) ?? null,
2098
+ returned: ((d == null ? void 0 : d.history) ?? []).some(
2099
+ (u) => {
2100
+ var S;
2101
+ return !!u.from_state && u.to_state === ((S = d == null ? void 0 : d.instance) == null ? void 0 : S.current_state);
2085
2102
  }
2086
2103
  )
2087
2104
  }
2088
2105
  )
2089
2106
  ] }),
2090
- dt && !m && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2091
- /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: ct(Ke) }),
2092
- A && mt,
2093
- Qe
2107
+ pt && !p && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2108
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: ft(He) }),
2109
+ P && bt,
2110
+ Ge
2094
2111
  ] }),
2095
2112
  /* @__PURE__ */ i("div", { className: "px-5 py-3", children: [
2096
2113
  /* @__PURE__ */ i(
@@ -2098,14 +2115,14 @@ function lr({
2098
2115
  {
2099
2116
  type: "button",
2100
2117
  className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
2101
- onClick: () => R((f) => !f),
2118
+ onClick: () => x((u) => !u),
2102
2119
  children: [
2103
2120
  /* @__PURE__ */ n(
2104
- _e,
2121
+ $e,
2105
2122
  {
2106
- className: ge(
2123
+ className: ye(
2107
2124
  "h-3.5 w-3.5 transition-transform duration-200",
2108
- I && "rotate-180"
2125
+ h && "rotate-180"
2109
2126
  )
2110
2127
  }
2111
2128
  ),
@@ -2113,26 +2130,41 @@ function lr({
2113
2130
  " ",
2114
2131
  /* @__PURE__ */ i("span", { className: "tabular-nums", children: [
2115
2132
  "(",
2116
- (Z == null ? void 0 : Z.length) ?? 0,
2133
+ (Se == null ? void 0 : Se.length) ?? 0,
2117
2134
  ")"
2118
2135
  ] })
2119
2136
  ]
2120
2137
  }
2121
2138
  ),
2122
- I && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(rr, { history: Z ?? [] }) })
2123
- ] })
2139
+ h && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(dr, { history: Se ?? [] }) })
2140
+ ] }),
2141
+ A && (pe ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: H, children: /* @__PURE__ */ n(
2142
+ zn,
2143
+ {
2144
+ collection: t,
2145
+ item: e,
2146
+ states: pe ?? [],
2147
+ currentStateId: O.current_state ?? null,
2148
+ openSignal: E,
2149
+ onMoved: () => {
2150
+ $.invalidateQueries({ queryKey: J }), $.invalidateQueries({
2151
+ queryKey: ["pipeline-instance", t, e]
2152
+ });
2153
+ }
2154
+ }
2155
+ ) })
2124
2156
  ] }) : /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
2125
2157
  /* @__PURE__ */ n("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
2126
2158
  /* @__PURE__ */ i(
2127
- re,
2159
+ ae,
2128
2160
  {
2129
2161
  size: "sm",
2130
2162
  variant: "outline",
2131
2163
  className: "shrink-0 gap-1.5 text-[12px]",
2132
- onClick: () => p.mutate(),
2133
- disabled: p.isPending,
2164
+ onClick: () => R.mutate(),
2165
+ disabled: R.isPending,
2134
2166
  children: [
2135
- p.isPending ? /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(ze, { className: "h-3.5 w-3.5" }),
2167
+ R.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(Xe, { className: "h-3.5 w-3.5" }),
2136
2168
  "Start Pipeline"
2137
2169
  ]
2138
2170
  }
@@ -2142,111 +2174,111 @@ function lr({
2142
2174
  ]
2143
2175
  }
2144
2176
  ),
2145
- u && /* @__PURE__ */ n(Dt, { fallback: null, children: /* @__PURE__ */ n(
2146
- jt,
2177
+ o && /* @__PURE__ */ n(Et, { fallback: null, children: /* @__PURE__ */ n(
2178
+ Ht,
2147
2179
  {
2148
- payload: u.payload,
2149
- transitionId: u.transitionId,
2150
- isRetry: u.revision > 1,
2180
+ payload: o.payload,
2181
+ transitionId: o.transitionId,
2182
+ isRetry: o.revision > 1,
2151
2183
  onSubmitted: () => (
2152
2184
  // mutateAsync so the dialog can stay busy until the transition
2153
2185
  // settles; the mutation's own onError/onSuccess handle the outcome.
2154
- x.mutateAsync({
2155
- transition_id: u.transitionId,
2156
- comment: u.comment,
2186
+ j.mutateAsync({
2187
+ transition_id: o.transitionId,
2188
+ comment: o.comment,
2157
2189
  reviewed: !0
2158
2190
  }).catch(() => {
2159
2191
  })
2160
2192
  ),
2161
- executing: x.isPending,
2162
- onClose: () => g(null)
2193
+ executing: j.isPending,
2194
+ onClose: () => Q(null)
2163
2195
  },
2164
- u.revision
2196
+ o.revision
2165
2197
  ) })
2166
2198
  ] });
2167
2199
  }
2168
- function Er({
2200
+ function Gr({
2169
2201
  collection: t,
2170
2202
  item: e,
2171
2203
  onBeforeTransition: r,
2172
- wrap: a = !0
2204
+ wrap: s = !0
2173
2205
  }) {
2174
2206
  return e === "new" ? null : /* @__PURE__ */ n(
2175
- or,
2207
+ fr,
2176
2208
  {
2177
2209
  collection: t,
2178
2210
  item: e,
2179
2211
  onBeforeTransition: r,
2180
- wrap: a
2212
+ wrap: s
2181
2213
  }
2182
2214
  );
2183
2215
  }
2184
- function or({
2216
+ function fr({
2185
2217
  collection: t,
2186
2218
  item: e,
2187
2219
  onBeforeTransition: r,
2188
- wrap: a = !0
2220
+ wrap: s = !0
2189
2221
  }) {
2190
- const l = xe(), c = Re(), [m, b] = j(""), [h, _] = j(null), [k, w] = j(null), [q, F] = j(null), [B, A] = j([]), L = Yt(t, String(e));
2191
- Ot(t, e, "transition", !!h || !!k);
2192
- const I = ae(null), R = Dn(I, !a), D = ae(!1), Q = (s) => {
2193
- D.current || (D.current = !0, F(null), S.mutate(s, {
2194
- onSettled: (p, x) => {
2195
- if (x) {
2196
- D.current = !1;
2222
+ const l = we(), c = De(), [p, b] = I(""), [f, _] = I(null), [v, y] = I(null), [$, A] = I(null), [E, B] = I([]), H = rn(t, String(e));
2223
+ It(t, e, "transition", !!f || !!v);
2224
+ const K = ne(null), T = En(K, !s), P = ne(!1), L = (a) => {
2225
+ P.current || (P.current = !0, A(null), k.mutate(a, {
2226
+ onSettled: (m, N) => {
2227
+ if (N) {
2228
+ P.current = !1;
2197
2229
  return;
2198
2230
  }
2199
- T().finally(() => {
2200
- D.current = !1;
2231
+ q().finally(() => {
2232
+ P.current = !1;
2201
2233
  });
2202
2234
  }
2203
2235
  }));
2204
- }, u = async (s) => {
2205
- var P, v;
2206
- if (D.current) return;
2207
- if (h === s) {
2236
+ }, h = async (a) => {
2237
+ var M, R;
2238
+ if (P.current) return;
2239
+ if (f === a) {
2208
2240
  _(null);
2209
2241
  return;
2210
2242
  }
2211
2243
  if (r) {
2212
- D.current = !0;
2213
- let W = !1;
2244
+ P.current = !0;
2245
+ let j = !1;
2214
2246
  try {
2215
- W = await r();
2247
+ j = await r();
2216
2248
  } finally {
2217
- D.current = !1;
2249
+ P.current = !1;
2218
2250
  }
2219
- if (!W) return;
2251
+ if (!j) return;
2220
2252
  }
2221
- const p = (G ?? []).find((W) => W.id === s), x = String((p == null ? void 0 : p.comment_mode) ?? "none"), M = Zt(p, (d == null ? void 0 : d.states) ?? [], (P = d == null ? void 0 : d.instance) == null ? void 0 : P.current_state);
2222
- if (x !== "optional" && x !== "required") {
2223
- if (p && !De(p, (d == null ? void 0 : d.states) ?? [], (v = d == null ? void 0 : d.instance) == null ? void 0 : v.current_state)) {
2224
- D.current = !0;
2225
- let W = [];
2253
+ const m = (ee ?? []).find((j) => j.id === a), N = String((m == null ? void 0 : m.comment_mode) ?? "none"), D = sn(m, (o == null ? void 0 : o.states) ?? [], (M = o == null ? void 0 : o.instance) == null ? void 0 : M.current_state);
2254
+ if (N !== "optional" && N !== "required") {
2255
+ if (m && !Oe(m, (o == null ? void 0 : o.states) ?? [], (R = o == null ? void 0 : o.instance) == null ? void 0 : R.current_state)) {
2256
+ P.current = !0;
2257
+ let j = [];
2226
2258
  try {
2227
- W = await L();
2259
+ j = await H();
2228
2260
  } finally {
2229
- D.current = !1;
2261
+ P.current = !1;
2230
2262
  }
2231
- if (W.length > 0 || M) {
2232
- A(W), _(s);
2263
+ if (j.length > 0 || D) {
2264
+ B(j), _(a);
2233
2265
  return;
2234
2266
  }
2235
2267
  }
2236
- if (M) {
2237
- A([]), _(s);
2268
+ if (D) {
2269
+ B([]), _(a);
2238
2270
  return;
2239
2271
  }
2240
- Q({ transition_id: s });
2272
+ L({ transition_id: a });
2241
2273
  return;
2242
2274
  }
2243
- A([]), _(s);
2244
- }, g = ["pipeline-instance", t, e], { settling: N, settle: T } = Ht(g), { data: d } = le({
2245
- queryKey: g,
2275
+ B([]), _(a);
2276
+ }, x = ["pipeline-instance", t, e], { settling: w, settle: q } = Zt(x), { data: o } = oe({
2277
+ queryKey: x,
2246
2278
  queryFn: () => l.request(
2247
2279
  ce(`/pipelines/instance/${t}/${e}`)
2248
2280
  ).then(
2249
- (s) => s.data ?? {
2281
+ (a) => a.data ?? {
2250
2282
  instance: null,
2251
2283
  states: [],
2252
2284
  available_transitions: [],
@@ -2256,305 +2288,305 @@ function or({
2256
2288
  }
2257
2289
  ),
2258
2290
  staleTime: 1e4
2259
- }), K = Gt(
2260
- d ? (d.available_transitions ?? []).map((s) => String(s.id)) : null,
2291
+ }), Q = en(
2292
+ o ? (o.available_transitions ?? []).map((a) => String(a.id)) : null,
2261
2293
  `${t}:${e}`
2262
- ), { data: te } = le({
2294
+ ), { data: X } = oe({
2263
2295
  queryKey: ["pipeline-all-owners", t, e],
2264
2296
  queryFn: () => l.request(
2265
2297
  ce(`/pipelines/instance/${t}/${e}/owners/all`)
2266
- ).then((s) => s.data ?? null),
2298
+ ).then((a) => a.data ?? null),
2267
2299
  // Also while a move is being confirmed: the panel names where it really lands.
2268
- enabled: nn(d) || !!h,
2300
+ enabled: dn(o) || !!f,
2269
2301
  staleTime: 3e4
2270
- }), y = Be(() => {
2271
- if (!te) return null;
2272
- const s = /* @__PURE__ */ new Map();
2273
- for (const [p, x] of Object.entries(te))
2274
- x.skipped && s.set(p, x.skip_reasons ?? []);
2275
- return s;
2276
- }, [te]), S = qe({
2302
+ }), g = Ie(() => {
2303
+ if (!X) return null;
2304
+ const a = /* @__PURE__ */ new Map();
2305
+ for (const [m, N] of Object.entries(X))
2306
+ N.skipped && a.set(m, N.skip_reasons ?? []);
2307
+ return a;
2308
+ }, [X]), k = Pe({
2277
2309
  mutationFn: ({
2278
- transition_id: s,
2279
- comment: p,
2280
- reviewed: x,
2281
- lock_ack: M
2310
+ transition_id: a,
2311
+ comment: m,
2312
+ reviewed: N,
2313
+ lock_ack: D
2282
2314
  }) => l.request(
2283
- Se(`/pipelines/instance/${t}/${e}/transition`, {
2284
- transition_id: s,
2285
- comment: p,
2286
- ...x ? { reviewed: !0 } : {},
2287
- ...M ? { lock_ack: !0 } : {}
2315
+ Te(`/pipelines/instance/${t}/${e}/transition`, {
2316
+ transition_id: a,
2317
+ comment: m,
2318
+ ...N ? { reviewed: !0 } : {},
2319
+ ...D ? { lock_ack: !0 } : {}
2288
2320
  })
2289
2321
  ),
2290
- onMutate: (s) => {
2291
- var p;
2322
+ onMutate: (a) => {
2323
+ var m;
2292
2324
  return {
2293
- slow: sn(
2294
- (p = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
2295
- (x) => x.id === s.transition_id
2296
- )) == null ? void 0 : p.label
2325
+ slow: mn(
2326
+ (m = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2327
+ (N) => N.id === a.transition_id
2328
+ )) == null ? void 0 : m.label
2297
2329
  )
2298
2330
  };
2299
2331
  },
2300
- onSuccess: (s, p, x) => {
2301
- c.invalidateQueries({ queryKey: g }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Ee(c, t, String(e)), Pe(c, t, String(e)), ln(c, t, String(e)), F(null), b(""), _(null), w(null), X.success(an(d, p.transition_id, s), x == null ? void 0 : x.slow.done());
2332
+ onSuccess: (a, m, N) => {
2333
+ c.invalidateQueries({ queryKey: x }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Qe(c, t, String(e)), Ae(c, t, String(e)), pn(c, t, String(e)), A(null), b(""), _(null), y(null), Y.success(un(o, m.transition_id, a), N == null ? void 0 : N.slow.done());
2302
2334
  },
2303
- onError: (s, p, x) => {
2304
- var W;
2305
- if (x == null || x.slow.fail(), It(s)) {
2306
- c.invalidateQueries({ queryKey: g });
2335
+ onError: (a, m, N) => {
2336
+ var j;
2337
+ if (N == null || N.slow.fail(), Gt(a)) {
2338
+ c.invalidateQueries({ queryKey: x });
2307
2339
  return;
2308
2340
  }
2309
- const M = Wt(s);
2310
- if (M) {
2341
+ const D = Yt(a);
2342
+ if (D) {
2311
2343
  _(null);
2312
- const Z = ((W = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
2313
- (O) => O.id === p.transition_id
2314
- )) == null ? void 0 : W.label) ?? "Move";
2315
- X.warning(M.message, {
2344
+ const ue = ((j = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2345
+ (U) => U.id === m.transition_id
2346
+ )) == null ? void 0 : j.label) ?? "Move";
2347
+ Y.warning(D.message, {
2316
2348
  id: `nvr-locked-move:${t}:${String(e)}`,
2317
2349
  duration: 2e4,
2318
2350
  action: {
2319
- label: `${Z} anyway`,
2320
- onClick: () => Q({ ...p, lock_ack: !0 })
2351
+ label: `${ue} anyway`,
2352
+ onClick: () => L({ ...m, lock_ack: !0 })
2321
2353
  },
2322
2354
  cancel: { label: "Wait", onClick: () => {
2323
2355
  } }
2324
2356
  });
2325
2357
  return;
2326
2358
  }
2327
- const P = Kt(s);
2328
- if (P) {
2329
- w((Z) => ({
2330
- payload: P,
2331
- transitionId: p.transition_id,
2332
- comment: p.comment,
2333
- revision: ((Z == null ? void 0 : Z.revision) ?? 0) + 1
2359
+ const M = Vt(a);
2360
+ if (M) {
2361
+ y((ue) => ({
2362
+ payload: M,
2363
+ transitionId: m.transition_id,
2364
+ comment: m.comment,
2365
+ revision: ((ue == null ? void 0 : ue.revision) ?? 0) + 1
2334
2366
  }));
2335
2367
  return;
2336
2368
  }
2337
- const v = s == null ? void 0 : s.response;
2338
- F(zt(s, p)), X.error(Me(s, "Failed to execute transition"), {
2369
+ const R = a == null ? void 0 : a.response;
2370
+ A(Jt(a, m)), Y.error(Fe(a, "Failed to execute transition"), {
2339
2371
  duration: 12e3,
2340
2372
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
2341
- ...At(s, { action: "Transition" }),
2373
+ ...jt(a, { action: "Transition" }),
2342
2374
  // #1867: a refusal carries "Why?" — the role, owner or access rule
2343
2375
  // that stopped it, and who can change it.
2344
- ...Lt(s) ? {
2345
- action: Et(l, {
2376
+ ...Wt(a) ? {
2377
+ action: zt(l, {
2346
2378
  collection: t,
2347
2379
  itemId: String(e),
2348
2380
  action: "transition",
2349
- transitionId: p.transition_id
2381
+ transitionId: m.transition_id
2350
2382
  })
2351
2383
  } : {}
2352
- }), w(null), _(null), Ee(c, t, String(e)), Pe(c, t, String(e)), (v == null ? void 0 : v.status) === 409 && c.invalidateQueries({ queryKey: g });
2384
+ }), y(null), _(null), Qe(c, t, String(e)), Ae(c, t, String(e)), (R == null ? void 0 : R.status) === 409 && c.invalidateQueries({ queryKey: x });
2353
2385
  }
2354
- }), E = ae(u);
2355
- E.current = u;
2356
- const Y = ae((d == null ? void 0 : d.available_transitions) ?? []);
2357
- if (Y.current = (d == null ? void 0 : d.available_transitions) ?? [], he(() => {
2358
- const s = (p) => {
2359
- const x = p.detail;
2360
- if (!x || x.claimed || x.collection !== t || String(x.item) !== String(e)) return;
2361
- x.claimed = !0;
2362
- const M = String(x.transition_id).toUpperCase(), P = Y.current.find((v) => String(v.id).toUpperCase() === M);
2363
- if (!P) {
2364
- X.error("That step is not available from where the record is now");
2386
+ }), G = ne(h);
2387
+ G.current = h;
2388
+ const se = ne((o == null ? void 0 : o.available_transitions) ?? []);
2389
+ if (se.current = (o == null ? void 0 : o.available_transitions) ?? [], fe(() => {
2390
+ const a = (m) => {
2391
+ const N = m.detail;
2392
+ if (!N || N.claimed || N.collection !== t || String(N.item) !== String(e)) return;
2393
+ N.claimed = !0;
2394
+ const D = String(N.transition_id).toUpperCase(), M = se.current.find((R) => String(R.id).toUpperCase() === D);
2395
+ if (!M) {
2396
+ Y.error("That step is not available from where the record is now");
2365
2397
  return;
2366
2398
  }
2367
- E.current(P.id);
2399
+ G.current(M.id);
2368
2400
  };
2369
- return window.addEventListener(Le, s), () => window.removeEventListener(Le, s);
2370
- }, [t, e]), !(d != null && d.binding) || !(d != null && d.instance)) return null;
2371
- const G = rn(
2372
- (d.available_transitions ?? []).filter(
2373
- (s) => !d.instance.completed_at || s.from_state && String(s.from_state).toUpperCase() === String(d.instance.current_state).toUpperCase()
2401
+ return window.addEventListener(Ke, a), () => window.removeEventListener(Ke, a);
2402
+ }, [t, e]), !(o != null && o.binding) || !(o != null && o.instance)) return null;
2403
+ const ee = cn(
2404
+ (o.available_transitions ?? []).filter(
2405
+ (a) => !o.instance.completed_at || a.from_state && String(a.from_state).toUpperCase() === String(o.instance.current_state).toUpperCase()
2374
2406
  ),
2375
- d.states ?? [],
2376
- d.instance.current_state,
2377
- d.instance.completed_at ? null : y
2407
+ o.states ?? [],
2408
+ o.instance.current_state,
2409
+ o.instance.completed_at ? null : g
2378
2410
  );
2379
- if (G.length === 0) return null;
2380
- const z = new Map((d.states ?? []).map((s) => [s.id, s])), oe = d.instance.current_state_obj ?? null, $ = h ? G.find((s) => s.id === h) : null, o = $ ? z.get($.to_state) : null, ue = dn($, oe, d.states ?? [], te), me = (ue == null ? void 0 : ue.state) ?? o, ne = /* @__PURE__ */ new Map();
2381
- for (const s of G) {
2382
- const p = ne.get(s.label) ?? [];
2383
- p.push(s), ne.set(s.label, p);
2411
+ if (ee.length === 0) return null;
2412
+ const re = new Map((o.states ?? []).map((a) => [a.id, a])), z = o.instance.current_state_obj ?? null, C = f ? ee.find((a) => a.id === f) : null, de = C ? re.get(C.to_state) : null, J = hn(C, z, o.states ?? [], X), he = (J == null ? void 0 : J.state) ?? de, be = /* @__PURE__ */ new Map();
2413
+ for (const a of ee) {
2414
+ const m = be.get(a.label) ?? [];
2415
+ m.push(a), be.set(a.label, m);
2384
2416
  }
2385
- const ke = (s) => [...s].sort(
2386
- (p, x) => {
2387
- var M, P;
2388
- return (((M = z.get(p.to_state)) == null ? void 0 : M.sort) ?? 999) - (((P = z.get(x.to_state)) == null ? void 0 : P.sort) ?? 999);
2417
+ const d = (a) => [...a].sort(
2418
+ (m, N) => {
2419
+ var D, M;
2420
+ return (((D = re.get(m.to_state)) == null ? void 0 : D.sort) ?? 999) - (((M = re.get(N.to_state)) == null ? void 0 : M.sort) ?? 999);
2389
2421
  }
2390
- ), Ne = (() => {
2391
- var x, M, P;
2392
- const s = (x = I.current) == null ? void 0 : x.getBoundingClientRect();
2393
- if (!s) return 600;
2394
- const p = (P = (M = I.current) == null ? void 0 : M.closest('[role="dialog"]')) == null ? void 0 : P.getBoundingClientRect();
2395
- return Math.max(260, Math.min(600, s.right - ((p == null ? void 0 : p.left) ?? 0) - 12));
2422
+ ), _e = (() => {
2423
+ var N, D, M;
2424
+ const a = (N = K.current) == null ? void 0 : N.getBoundingClientRect();
2425
+ if (!a) return 600;
2426
+ const m = (M = (D = K.current) == null ? void 0 : D.closest('[role="dialog"]')) == null ? void 0 : M.getBoundingClientRect();
2427
+ return Math.max(260, Math.min(600, a.right - ((m == null ? void 0 : m.left) ?? 0) - 12));
2396
2428
  })();
2397
- return /* @__PURE__ */ i("div", { ref: I, className: "relative", children: [
2398
- R ? /* @__PURE__ */ i(Ve, { children: [
2399
- /* @__PURE__ */ n(Xe, { asChild: !0, children: /* @__PURE__ */ i(
2400
- re,
2429
+ return /* @__PURE__ */ i("div", { ref: K, className: "relative", children: [
2430
+ T ? /* @__PURE__ */ i(Ze, { children: [
2431
+ /* @__PURE__ */ n(et, { asChild: !0, children: /* @__PURE__ */ i(
2432
+ ae,
2401
2433
  {
2402
2434
  size: "sm",
2403
2435
  variant: "outline",
2404
2436
  className: "shrink-0 gap-1.5 text-[12px]",
2405
- disabled: S.isPending || N,
2437
+ disabled: k.isPending || w,
2406
2438
  "data-transitions-folded": !0,
2407
2439
  children: [
2408
- S.isPending && /* @__PURE__ */ n(pe, { className: "h-3 w-3 animate-spin" }),
2440
+ k.isPending && /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }),
2409
2441
  "Actions",
2410
- /* @__PURE__ */ n(_e, { className: "h-3 w-3" })
2442
+ /* @__PURE__ */ n($e, { className: "h-3 w-3" })
2411
2443
  ]
2412
2444
  }
2413
2445
  ) }),
2414
- /* @__PURE__ */ n(Ye, { align: "end", className: "min-w-[200px]", children: Array.from(ne.entries()).map(
2415
- ([s, p], x, M) => p.length === 1 ? /* @__PURE__ */ i(wt, { children: [
2416
- x > 0 && M[x - 1][1].length > 1 && /* @__PURE__ */ n(vt, {}),
2417
- /* @__PURE__ */ i(Oe, { onSelect: () => u(p[0].id), children: [
2418
- p[0].color && /* @__PURE__ */ n(
2446
+ /* @__PURE__ */ n(tt, { align: "end", className: "min-w-[200px]", children: Array.from(be.entries()).map(
2447
+ ([a, m], N, D) => m.length === 1 ? /* @__PURE__ */ i(St, { children: [
2448
+ N > 0 && D[N - 1][1].length > 1 && /* @__PURE__ */ n(Ct, {}),
2449
+ /* @__PURE__ */ i(Be, { onSelect: () => h(m[0].id), children: [
2450
+ m[0].color && /* @__PURE__ */ n(
2419
2451
  "span",
2420
2452
  {
2421
2453
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2422
- style: { backgroundColor: p[0].color }
2454
+ style: { backgroundColor: m[0].color }
2423
2455
  }
2424
2456
  ),
2425
- s
2457
+ a
2426
2458
  ] })
2427
- ] }, s) : /* @__PURE__ */ i(wt, { children: [
2428
- x > 0 && /* @__PURE__ */ n(vt, {}),
2429
- /* @__PURE__ */ n(On, { className: "text-[11px] text-muted-foreground", children: s }),
2430
- ke(p).map((P) => {
2431
- var v;
2432
- return /* @__PURE__ */ i(Oe, { onSelect: () => u(P.id), children: [
2433
- P.color && /* @__PURE__ */ n(
2459
+ ] }, a) : /* @__PURE__ */ i(St, { children: [
2460
+ N > 0 && /* @__PURE__ */ n(Ct, {}),
2461
+ /* @__PURE__ */ n(jn, { className: "text-[11px] text-muted-foreground", children: a }),
2462
+ d(m).map((M) => {
2463
+ var R;
2464
+ return /* @__PURE__ */ i(Be, { onSelect: () => h(M.id), children: [
2465
+ M.color && /* @__PURE__ */ n(
2434
2466
  "span",
2435
2467
  {
2436
2468
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2437
- style: { backgroundColor: P.color }
2469
+ style: { backgroundColor: M.color }
2438
2470
  }
2439
2471
  ),
2440
- ((v = z.get(P.to_state)) == null ? void 0 : v.label) ?? P.to_state
2441
- ] }, P.id);
2472
+ ((R = re.get(M.to_state)) == null ? void 0 : R.label) ?? M.to_state
2473
+ ] }, M.id);
2442
2474
  })
2443
- ] }, s)
2475
+ ] }, a)
2444
2476
  ) })
2445
2477
  ] }) : /* @__PURE__ */ i(
2446
2478
  "div",
2447
2479
  {
2448
- className: a ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
2480
+ className: s ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
2449
2481
  children: [
2450
- /* @__PURE__ */ n(en, { flags: d == null ? void 0 : d.flags }),
2451
- Array.from(ne.entries()).map(([s, p]) => {
2452
- var W, Z;
2453
- const x = p.some((O) => {
2454
- var de;
2455
- return (((de = O.order_partners) == null ? void 0 : de.length) ?? 0) > 0;
2456
- }), M = x ? null : ((W = p[0]) == null ? void 0 : W.color) ?? null, P = p.some((O) => O.id === h), v = (O) => M ? O ? { backgroundColor: M, borderColor: M } : { borderColor: M, color: M } : void 0;
2457
- if (p.length === 1) {
2458
- const O = p[0], de = S.isPending && ((Z = S.variables) == null ? void 0 : Z.transition_id) === O.id, fe = /* @__PURE__ */ i(
2459
- re,
2482
+ /* @__PURE__ */ n(ln, { flags: o == null ? void 0 : o.flags }),
2483
+ Array.from(be.entries()).map(([a, m]) => {
2484
+ var j, ue;
2485
+ const N = m.some((U) => {
2486
+ var O;
2487
+ return (((O = U.order_partners) == null ? void 0 : O.length) ?? 0) > 0;
2488
+ }), D = N ? null : ((j = m[0]) == null ? void 0 : j.color) ?? null, M = m.some((U) => U.id === f), R = (U) => D ? U ? { backgroundColor: D, borderColor: D } : { borderColor: D, color: D } : void 0;
2489
+ if (m.length === 1) {
2490
+ const U = m[0], O = k.isPending && ((ue = k.variables) == null ? void 0 : ue.transition_id) === U.id, ge = /* @__PURE__ */ i(
2491
+ ae,
2460
2492
  {
2461
2493
  size: "sm",
2462
- variant: P ? "default" : "outline",
2494
+ variant: M ? "default" : "outline",
2463
2495
  className: "gap-1.5 text-[12px] data-[fresh=true]:opacity-60",
2464
- style: v(P),
2465
- disabled: S.isPending || N,
2466
- "aria-disabled": K.dimmed(O.id) || void 0,
2467
- "data-fresh": K.dimmed(O.id) || void 0,
2468
- ...K.bind(O.id),
2496
+ style: R(M),
2497
+ disabled: k.isPending || w,
2498
+ "aria-disabled": Q.dimmed(U.id) || void 0,
2499
+ "data-fresh": Q.dimmed(U.id) || void 0,
2500
+ ...Q.bind(U.id),
2469
2501
  onClick: () => {
2470
- K.press(O.id) && u(O.id);
2502
+ Q.press(U.id) && h(U.id);
2471
2503
  },
2472
2504
  children: [
2473
- de ? /* @__PURE__ */ n(pe, { className: "h-3 w-3 animate-spin" }) : x && /* @__PURE__ */ n(qt, { className: "h-3 w-3", "aria-hidden": !0 }),
2474
- s
2505
+ O ? /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }) : N && /* @__PURE__ */ n(Ft, { className: "h-3 w-3", "aria-hidden": !0 }),
2506
+ a
2475
2507
  ]
2476
2508
  },
2477
- s
2509
+ a
2478
2510
  );
2479
- return O.pushes && O.pushes > 0 ? /* @__PURE__ */ i("span", { className: "relative inline-flex", children: [
2480
- fe,
2511
+ return U.pushes && U.pushes > 0 ? /* @__PURE__ */ i("span", { className: "relative inline-flex", children: [
2512
+ ge,
2481
2513
  /* @__PURE__ */ n(
2482
- Pn,
2514
+ Un,
2483
2515
  {
2484
2516
  collection: t,
2485
2517
  itemId: e,
2486
- transitionId: O.id,
2487
- label: s,
2518
+ transitionId: U.id,
2519
+ label: a,
2488
2520
  compact: !0
2489
2521
  }
2490
2522
  )
2491
- ] }, s) : fe;
2523
+ ] }, a) : ge;
2492
2524
  }
2493
- return /* @__PURE__ */ i(Ve, { children: [
2494
- /* @__PURE__ */ n(Xe, { asChild: !0, children: /* @__PURE__ */ i(
2495
- re,
2525
+ return /* @__PURE__ */ i(Ze, { children: [
2526
+ /* @__PURE__ */ n(et, { asChild: !0, children: /* @__PURE__ */ i(
2527
+ ae,
2496
2528
  {
2497
2529
  size: "sm",
2498
- variant: P ? "default" : "outline",
2530
+ variant: M ? "default" : "outline",
2499
2531
  className: "gap-1.5 text-[12px]",
2500
- style: v(P),
2501
- disabled: S.isPending || N,
2532
+ style: R(M),
2533
+ disabled: k.isPending || w,
2502
2534
  children: [
2503
- s,
2504
- /* @__PURE__ */ n(_e, { className: "h-3 w-3" })
2535
+ a,
2536
+ /* @__PURE__ */ n($e, { className: "h-3 w-3" })
2505
2537
  ]
2506
2538
  }
2507
2539
  ) }),
2508
- /* @__PURE__ */ n(Ye, { align: "start", children: ke(p).map((O) => {
2509
- var de;
2510
- return /* @__PURE__ */ i(Oe, { onSelect: () => u(O.id), children: [
2511
- O.color && /* @__PURE__ */ n(
2540
+ /* @__PURE__ */ n(tt, { align: "start", children: d(m).map((U) => {
2541
+ var O;
2542
+ return /* @__PURE__ */ i(Be, { onSelect: () => h(U.id), children: [
2543
+ U.color && /* @__PURE__ */ n(
2512
2544
  "span",
2513
2545
  {
2514
2546
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2515
- style: { backgroundColor: O.color }
2547
+ style: { backgroundColor: U.color }
2516
2548
  }
2517
2549
  ),
2518
- ((de = z.get(O.to_state)) == null ? void 0 : de.label) ?? O.to_state
2519
- ] }, O.id);
2550
+ ((O = re.get(U.to_state)) == null ? void 0 : O.label) ?? U.to_state
2551
+ ] }, U.id);
2520
2552
  }) })
2521
- ] }, s);
2553
+ ] }, a);
2522
2554
  })
2523
2555
  ]
2524
2556
  }
2525
2557
  ),
2526
- h && /* @__PURE__ */ i(
2558
+ f && /* @__PURE__ */ i(
2527
2559
  "div",
2528
2560
  {
2529
2561
  className: "absolute right-0 top-full z-50 mt-1 space-y-3 rounded-lg border border-slate-200 bg-white shadow-lg dark:bg-card dark:border-border p-3.5",
2530
- style: { width: Ne },
2562
+ style: { width: _e },
2531
2563
  children: [
2532
2564
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
2533
2565
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
2534
- $ && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: $.label }),
2535
- oe && me && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2536
- /* @__PURE__ */ n(ve, { label: oe.label, color: oe.color, small: !0 }),
2537
- /* @__PURE__ */ n(rt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2538
- /* @__PURE__ */ n(ve, { label: me.label, color: me.color, small: !0 })
2566
+ C && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: C.label }),
2567
+ z && he && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2568
+ /* @__PURE__ */ n(Ne, { label: z.label, color: z.color, small: !0 }),
2569
+ /* @__PURE__ */ n(lt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2570
+ /* @__PURE__ */ n(Ne, { label: he.label, color: he.color, small: !0 })
2539
2571
  ] })
2540
2572
  ] }),
2541
- /* @__PURE__ */ n(cn, { landing: ue }),
2542
- /* @__PURE__ */ n(tn, { collection: t, item: String(e), tx: $ }),
2543
- /* @__PURE__ */ n(un, { collection: t, item: e, omitLines: B }),
2544
- /* @__PURE__ */ n(Jt, { lines: B }),
2573
+ /* @__PURE__ */ n(bn, { landing: J }),
2574
+ /* @__PURE__ */ n(on, { collection: t, item: String(e), tx: C }),
2575
+ /* @__PURE__ */ n(gn, { collection: t, item: e, omitLines: E }),
2576
+ /* @__PURE__ */ n(an, { lines: E }),
2545
2577
  /* @__PURE__ */ n(
2546
2578
  "input",
2547
2579
  {
2548
2580
  type: "text",
2549
- value: m,
2550
- onChange: (s) => b(s.target.value),
2551
- placeholder: String(($ == null ? void 0 : $.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2581
+ value: p,
2582
+ onChange: (a) => b(a.target.value),
2583
+ placeholder: String((C == null ? void 0 : C.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2552
2584
  className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
2553
2585
  }
2554
2586
  ),
2555
2587
  /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
2556
2588
  /* @__PURE__ */ n(
2557
- re,
2589
+ ae,
2558
2590
  {
2559
2591
  type: "button",
2560
2592
  size: "sm",
@@ -2565,19 +2597,19 @@ function or({
2565
2597
  }
2566
2598
  ),
2567
2599
  /* @__PURE__ */ n(
2568
- re,
2600
+ ae,
2569
2601
  {
2570
2602
  type: "button",
2571
2603
  size: "sm",
2572
2604
  className: "h-7 gap-1.5 text-[12px]",
2573
- disabled: S.isPending || String(($ == null ? void 0 : $.comment_mode) ?? "") === "required" && m.trim() === "",
2574
- onClick: () => Q({
2575
- transition_id: h,
2576
- comment: m.trim() || void 0
2605
+ disabled: k.isPending || String((C == null ? void 0 : C.comment_mode) ?? "") === "required" && p.trim() === "",
2606
+ onClick: () => L({
2607
+ transition_id: f,
2608
+ comment: p.trim() || void 0
2577
2609
  }),
2578
- children: S.isPending ? /* @__PURE__ */ n(pe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(be, { children: [
2579
- /* @__PURE__ */ n("span", { children: B.length > 0 && $ ? `${$.label} anyway` : "Confirm" }),
2580
- /* @__PURE__ */ n(je, { className: "h-3 w-3" })
2610
+ children: k.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(xe, { children: [
2611
+ /* @__PURE__ */ n("span", { children: E.length > 0 && C ? `${C.label} anyway` : "Confirm" }),
2612
+ /* @__PURE__ */ n(We, { className: "h-3 w-3" })
2581
2613
  ] })
2582
2614
  }
2583
2615
  )
@@ -2585,62 +2617,62 @@ function or({
2585
2617
  ]
2586
2618
  }
2587
2619
  ),
2588
- q && !h && /* @__PURE__ */ n(
2589
- on,
2620
+ $ && !f && /* @__PURE__ */ n(
2621
+ fn,
2590
2622
  {
2591
2623
  collection: t,
2592
2624
  item: String(e),
2593
- offer: q,
2625
+ offer: $,
2594
2626
  className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
2595
- style: { width: Ne },
2596
- onDismiss: () => F(null),
2597
- onFixed: () => Q({ transition_id: q.transitionId, comment: q.comment })
2627
+ style: { width: _e },
2628
+ onDismiss: () => A(null),
2629
+ onFixed: () => L({ transition_id: $.transitionId, comment: $.comment })
2598
2630
  }
2599
2631
  ),
2600
- k && /* @__PURE__ */ n(Dt, { fallback: null, children: /* @__PURE__ */ n(
2601
- jt,
2632
+ v && /* @__PURE__ */ n(Et, { fallback: null, children: /* @__PURE__ */ n(
2633
+ Ht,
2602
2634
  {
2603
- payload: k.payload,
2604
- transitionId: k.transitionId,
2605
- isRetry: k.revision > 1,
2635
+ payload: v.payload,
2636
+ transitionId: v.transitionId,
2637
+ isRetry: v.revision > 1,
2606
2638
  onSubmitted: () => (
2607
2639
  // mutateAsync so the dialog can stay busy until the transition
2608
2640
  // settles; the mutation's own onError/onSuccess handle the outcome.
2609
- S.mutateAsync({
2610
- transition_id: k.transitionId,
2611
- comment: k.comment,
2641
+ k.mutateAsync({
2642
+ transition_id: v.transitionId,
2643
+ comment: v.comment,
2612
2644
  reviewed: !0
2613
2645
  }).catch(() => {
2614
2646
  })
2615
2647
  ),
2616
- executing: S.isPending,
2617
- onClose: () => w(null)
2648
+ executing: k.isPending,
2649
+ onClose: () => y(null)
2618
2650
  },
2619
- k.revision
2651
+ v.revision
2620
2652
  ) })
2621
2653
  ] });
2622
2654
  }
2623
2655
  export {
2624
- $e as FRESH_BUTTON_MS,
2625
- _t as FRESH_HOVER_MAX_MS,
2626
- Hn as FreshButtonGuard,
2627
- Lr as PipelinePanel,
2628
- Er as PipelineTransitionButtons,
2629
- Wn as REFUSAL_FIX_ACTIONS,
2630
- en as RecordFlagChips,
2631
- Jn as SLOW_MOVE_MS,
2632
- Zt as asksFirst,
2633
- Vn as briefAgeText,
2634
- Xn as briefDiffPair,
2635
- St as briefLineKey,
2636
- Gn as briefWarnings,
2637
- It as isDuplicateTransition,
2638
- Zn as latestSendBack,
2639
- Wt as lockedMoveOffer,
2640
- Qt as refusalCode,
2641
- zt as refusalFixFor,
2642
- sn as slowMoveToast,
2643
- Kt as transitionRequirementsFromError,
2644
- an as transitionToastText,
2645
- rn as withoutSkippedSendBacks
2656
+ Me as FRESH_BUTTON_MS,
2657
+ qt as FRESH_HOVER_MAX_MS,
2658
+ Zn as FreshButtonGuard,
2659
+ Hr as PipelinePanel,
2660
+ Gr as PipelineTransitionButtons,
2661
+ Yn as REFUSAL_FIX_ACTIONS,
2662
+ ln as RecordFlagChips,
2663
+ ar as SLOW_MOVE_MS,
2664
+ sn as asksFirst,
2665
+ tr as briefAgeText,
2666
+ nr as briefDiffPair,
2667
+ Mt as briefLineKey,
2668
+ er as briefWarnings,
2669
+ Gt as isDuplicateTransition,
2670
+ sr as latestSendBack,
2671
+ Yt as lockedMoveOffer,
2672
+ Xt as refusalCode,
2673
+ Jt as refusalFixFor,
2674
+ mn as slowMoveToast,
2675
+ Vt as transitionRequirementsFromError,
2676
+ un as transitionToastText,
2677
+ cn as withoutSkippedSendBacks
2646
2678
  };