@nivaro/react 0.3.56 → 0.3.58

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