@nivaro/react 0.3.88 → 0.3.89

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