@nivaro/react 0.3.109 → 0.3.111

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