@nivaro/react 0.3.99 → 0.3.101

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