@nivaro/react 0.3.93 → 0.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,38 +1,38 @@
1
- var wn = Object.defineProperty;
2
- var vn = (t, e, r) => e in t ? wn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var Ve = (t, e, r) => vn(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { jsx as n, jsxs as i, Fragment as xe } from "react/jsx-runtime";
5
- import { useQueryClient as De, useQuery as oe, useMutation as Pe } from "@tanstack/react-query";
6
- import { ArrowRight as lt, Loader2 as me, Check as We, GitBranch as Xe, AlertTriangle as kn, ChevronDown as $e, Send as Ft, Users as At, Undo2 as Nn, Minus as _n, UserPlus as Sn, X as Ot, Zap as Ut, Search as Cn } from "lucide-react";
7
- import { useState as I, useRef as ne, useEffect as fe, useMemo as Ie, Suspense as Et, useCallback as Lt, lazy as $n } from "react";
1
+ var vn = Object.defineProperty;
2
+ var kn = (t, e, r) => e in t ? vn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var Ve = (t, e, r) => kn(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { jsx as n, jsxs as i, Fragment as ye } from "react/jsx-runtime";
5
+ import { useQueryClient as Fe, useQuery as oe, useMutation as Pe } from "@tanstack/react-query";
6
+ import { ArrowRight as lt, Loader2 as me, Check as We, GitBranch as Xe, AlertTriangle as Nn, ChevronDown as $e, Send as Dt, Users as Ot, Undo2 as _n, Minus as Sn, UserPlus as Cn, X as Ut, Zap as Et, Search as $n } from "lucide-react";
7
+ import { useState as I, useRef as ne, useEffect as fe, useMemo as Ie, Suspense as Lt, useCallback as Bt, lazy as Tn } from "react";
8
8
  import { toast as Y } from "sonner";
9
- import { useNivaroClient as we, useItemEditAuth as Bt } from "../../context.js";
10
- import { get as ce, post as Te, del as Tn } from "../../lib/commands.js";
11
- import { errorToastOptions as jt, toastError as qn } from "../../lib/error-toast.js";
12
- import { useRecordSignalWhile as It, useRecordSignalPeers as Mn, signalSentence as Rn } from "../../lib/presence-signals.js";
9
+ import { useNivaroClient as we, useItemEditAuth as jt } from "../../context.js";
10
+ import { get as ce, post as Te, del as qn } from "../../lib/commands.js";
11
+ import { errorToastOptions as It, toastError as Mn } from "../../lib/error-toast.js";
13
12
  import { OPEN_MOVE_STATE_EVENT as Nt } from "../../lib/move-state.js";
13
+ import { useRecordSignalWhile as Kt, useRecordSignalPeers as Rn, signalSentence as Pn } from "../../lib/presence-signals.js";
14
14
  import { RUN_TRANSITION_EVENT as Ke } from "../../lib/run-transition.js";
15
- import { userErrorMessage as Fe } from "../../lib/safe-error.js";
16
- import { serverNow as Pn } from "../../lib/server-clock.js";
17
- import { userCardQuery as Dn } from "../../lib/user-cards.js";
18
- import { cn as ye, titleCase as Fn, toLocalDateString as An, formatRelative as ot, formatDateTime as _t, humanHours as On } from "../../lib/utils.js";
19
- import { PushReadinessChip as Un } from "../integrations/RecordIntegrationPreview.js";
20
- import { useHeaderFold as En } from "../item-edit/HeaderTools.js";
21
- import { invalidateRecordInsights as Qe, invalidateRecordData as Ae } from "../item-edit/RecordInsights.js";
22
- import { UserChip as Kt } from "../item-edit/UserChip.js";
23
- import { OwnerAvatars as Ln } from "../queue/OwnerAvatars.js";
24
- import { UserAvatar as Bn } from "../UserAvatar.js";
15
+ import { userErrorMessage as Ae } from "../../lib/safe-error.js";
16
+ import { serverNow as Fn } from "../../lib/server-clock.js";
17
+ import { userCardQuery as An } from "../../lib/user-cards.js";
18
+ import { cn as he, titleCase as Dn, toLocalDateString as On, formatRelative as ot, formatDateTime as _t, humanHours as Un } from "../../lib/utils.js";
19
+ import { PushReadinessChip as En } from "../integrations/RecordIntegrationPreview.js";
20
+ import { useHeaderFold as Ln } from "../item-edit/HeaderTools.js";
21
+ import { invalidateRecordInsights as Qe, invalidateRecordData as De } from "../item-edit/RecordInsights.js";
22
+ import { UserChip as Qt } from "../item-edit/UserChip.js";
23
+ import { OwnerAvatars as Bn } from "../queue/OwnerAvatars.js";
24
+ import { UserAvatar as jn } from "../UserAvatar.js";
25
25
  import { Button as ae } from "../ui/button.js";
26
- import { DropdownMenu as Ze, DropdownMenuTrigger as et, DropdownMenuContent as tt, DropdownMenuGroup as St, DropdownMenuSeparator as Ct, DropdownMenuItem as Be, DropdownMenuLabel as jn } from "../ui/dropdown-menu.js";
26
+ import { DropdownMenu as Ze, DropdownMenuTrigger as et, DropdownMenuContent as tt, DropdownMenuGroup as St, DropdownMenuSeparator as Ct, DropdownMenuItem as Be, DropdownMenuLabel as In } from "../ui/dropdown-menu.js";
27
27
  import { Popover as dt, PopoverTrigger as ct, PopoverContent as ut } from "../ui/popover.js";
28
28
  import { Skeleton as ke } from "../ui/skeleton.js";
29
- import { TooltipProvider as Qt, Tooltip as nt, TooltipTrigger as rt, TooltipContent as at } from "../ui/tooltip.js";
30
- import { isAccessRefusal as Wt, deniedToastAction as zt, WhyOwnersButton as In } from "./AccessInsights.js";
31
- import { BranchLanes as Kn } from "./BranchLanes.js";
32
- import { landingState as Qn, landingSkipGroups as Wn, joinLabels as $t } from "./landing-state.js";
33
- import { MoveToStatePanel as zn } from "./MoveToStatePanel.js";
34
- import { SlaClockLine as Hn } from "./SlaClock.js";
35
- const Ht = $n(
29
+ import { TooltipProvider as Wt, Tooltip as nt, TooltipTrigger as rt, TooltipContent as at } from "../ui/tooltip.js";
30
+ import { isAccessRefusal as zt, deniedToastAction as Ht, WhyOwnersButton as Kn } from "./AccessInsights.js";
31
+ import { BranchLanes as Qn } from "./BranchLanes.js";
32
+ import { landingState as Wn, landingSkipGroups as zn, joinLabels as $t } from "./landing-state.js";
33
+ import { MoveToStatePanel as Hn } from "./MoveToStatePanel.js";
34
+ import { SlaClockLine as Gn } from "./SlaClock.js";
35
+ const Gt = Tn(
36
36
  () => import("./TransitionRequirementsDialog.js").then((t) => ({
37
37
  default: t.TransitionRequirementsDialog
38
38
  }))
@@ -41,7 +41,7 @@ function mt(t, e) {
41
41
  const r = t || "System";
42
42
  return e.on_behalf_of_name ? `${r}, for ${e.on_behalf_of_name}` : r;
43
43
  }
44
- function Gn(t) {
44
+ function Vn(t) {
45
45
  if (t.transition) return null;
46
46
  const e = (t.comment ?? "").trim();
47
47
  if (!e.startsWith("{")) return null;
@@ -76,11 +76,11 @@ const Tt = {
76
76
  rate_limited: "the partner asked us to slow down",
77
77
  unknown: "the partner refused it"
78
78
  };
79
- function Vn(t) {
80
- const e = Math.ceil((new Date(t).getTime() - Pn()) / 6e4);
79
+ function Xn(t) {
80
+ const e = Math.ceil((new Date(t).getTime() - Fn()) / 6e4);
81
81
  return !Number.isFinite(e) || e <= 0 ? "on the next check" : e < 60 ? `in ${e} min` : `in ${Math.round(e / 60)}h`;
82
82
  }
83
- function Xn({ held: t }) {
83
+ function Yn({ held: t }) {
84
84
  return t.length === 0 ? null : /* @__PURE__ */ n(
85
85
  "div",
86
86
  {
@@ -105,7 +105,7 @@ function Xn({ held: t }) {
105
105
  }
106
106
  ),
107
107
  /* @__PURE__ */ i("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
108
- e.retry_at ? `It tries the same push again ${Vn(e.retry_at)}. ` : "It will not send the same push again on its own. ",
108
+ e.retry_at ? `It tries the same push again ${Xn(e.retry_at)}. ` : "It will not send the same push again on its own. ",
109
109
  "Fix the record so what it sends changes, retry the push, or move the record by hand.",
110
110
  e.attempts > 1 ? ` ${e.attempts} attempts so far.` : ""
111
111
  ] })
@@ -114,58 +114,58 @@ function Xn({ held: t }) {
114
114
  }
115
115
  );
116
116
  }
117
- function Gt(t) {
117
+ function Vt(t) {
118
118
  var r;
119
119
  const e = t == null ? void 0 : t.response;
120
120
  return ((e == null ? void 0 : e.code) ?? ((r = e == null ? void 0 : e.data) == null ? void 0 : r.code)) === "TRANSITION_DUPLICATE";
121
121
  }
122
- function Vt(t) {
122
+ function Xt(t) {
123
123
  var r;
124
124
  const e = t;
125
125
  return (e == null ? void 0 : e.status) === 422 && ((r = e.response) == null ? void 0 : r.error) === "TRANSITION_REQUIREMENTS" ? e.response.requirements ?? [] : null;
126
126
  }
127
- function Xt(t) {
127
+ function Yt(t) {
128
128
  var s;
129
129
  const e = t == null ? void 0 : t.response, r = (e == null ? void 0 : e.code) ?? ((s = e == null ? void 0 : e.data) == null ? void 0 : s.code);
130
130
  return typeof r == "string" ? r : null;
131
131
  }
132
- function Yt(t) {
133
- if (Xt(t) !== "RECORD_LOCKED") return null;
132
+ function Jt(t) {
133
+ if (Yt(t) !== "RECORD_LOCKED") return null;
134
134
  const e = t == null ? void 0 : t.response, r = e != null && e.data && typeof e.data == "object" ? e.data : e;
135
135
  if ((r == null ? void 0 : r.move_anyway) !== !0) return null;
136
136
  const s = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
137
137
  return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${s ?? "Someone else"} is editing this record right now.`, holder: s };
138
138
  }
139
- const Yn = {
139
+ const Jn = {
140
140
  PRIORITY_REQUIRED: "priority",
141
141
  // A held record does not move forward (efp-ops hold-gate, army 11): taking
142
142
  // the hold off is one deliberate, noted step, then the move is tried again.
143
143
  ON_HOLD: "remove-hold"
144
144
  };
145
- function Jt(t, e) {
146
- const r = Xt(t), s = r ? Yn[r] : void 0;
145
+ function Zt(t, e) {
146
+ const r = Yt(t), s = r ? Jn[r] : void 0;
147
147
  return !r || !s ? null : { code: r, actionKey: s, transitionId: e.transition_id, comment: e.comment };
148
148
  }
149
- const Jn = 600;
150
- function Zt(t) {
151
- const e = De(), [r, s] = I(!1), l = ne(!0);
149
+ const Zn = 600;
150
+ function en(t) {
151
+ const e = Fe(), [r, s] = I(!1), l = ne(!0);
152
152
  fe(() => (l.current = !0, () => {
153
153
  l.current = !1;
154
154
  }), []);
155
155
  const c = ne(t);
156
156
  c.current = t;
157
- const p = Lt(async () => {
157
+ const p = Bt(async () => {
158
158
  s(!0);
159
159
  try {
160
160
  await e.refetchQueries({ queryKey: [...c.current], type: "active" });
161
161
  } catch {
162
162
  }
163
- await new Promise((b) => setTimeout(b, Jn)), l.current && s(!1);
163
+ await new Promise((b) => setTimeout(b, Zn)), l.current && s(!1);
164
164
  }, [e]);
165
165
  return { settling: r, settle: p };
166
166
  }
167
167
  const Me = 1500, qt = 4e3;
168
- class Zn {
168
+ class er {
169
169
  constructor() {
170
170
  Ve(this, "seen", null);
171
171
  Ve(this, "fresh", /* @__PURE__ */ new Map());
@@ -213,9 +213,9 @@ class Zn {
213
213
  this.seen = null, this.fresh.clear();
214
214
  }
215
215
  }
216
- function en(t, e) {
216
+ function tn(t, e) {
217
217
  const r = ne(null);
218
- r.current || (r.current = new Zn());
218
+ r.current || (r.current = new er());
219
219
  const s = r.current, l = ne(e);
220
220
  l.current !== e && (l.current = e, s.reset());
221
221
  const [, c] = I(0), p = t ? t.join(",") : null;
@@ -235,25 +235,25 @@ function en(t, e) {
235
235
  })
236
236
  };
237
237
  }
238
- function tn(t, e) {
238
+ function nn(t, e) {
239
239
  return ["approval-brief", t, String(e)];
240
240
  }
241
- function nn(t, e, r) {
241
+ function rn(t, e, r) {
242
242
  return t.request(
243
243
  ce(`/pipelines/instance/${e}/${r}/approval-brief`)
244
244
  ).then((s) => s.data);
245
245
  }
246
- function er(t) {
246
+ function tr(t) {
247
247
  return (t ?? []).filter((e) => e.tone === "warn" || e.tone === "danger");
248
248
  }
249
249
  function Mt(t) {
250
250
  return `${(t.label ?? "").trim().toLowerCase()}|${(t.text ?? "").trim().toLowerCase()}`;
251
251
  }
252
- function tr(t) {
252
+ function nr(t) {
253
253
  const e = Math.max(0, Math.floor(Number(t) || 0));
254
254
  return e === 0 ? "today" : e === 1 ? "1 day ago" : `${e} days ago`;
255
255
  }
256
- function nr(t, e, r = 40) {
256
+ function rr(t, e, r = 40) {
257
257
  const s = (_) => _ == null || _ === "" ? "" : String(_), l = s(t), c = s(e), p = (_) => _ === "" ? "(empty)" : _;
258
258
  if (t === void 0) return { old: null, new: Ye(p(c), 0, r) };
259
259
  if (l.length <= r && c.length <= r) return { old: p(l), new: p(c) };
@@ -266,27 +266,27 @@ function Ye(t, e, r) {
266
266
  const s = Math.min(e, Math.max(0, t.length - r)), l = t.slice(s, s + r);
267
267
  return `${s > 0 ? "…" : ""}${l}${s + r < t.length ? "…" : ""}`;
268
268
  }
269
- const rr = 4e3;
270
- function rn(t, e) {
271
- const r = we(), s = De();
272
- return Lt(async () => {
269
+ const ar = 4e3;
270
+ function an(t, e) {
271
+ const r = we(), s = Fe();
272
+ return Bt(async () => {
273
273
  try {
274
274
  const l = await Promise.race([
275
275
  s.fetchQuery({
276
- queryKey: tn(t, e),
277
- queryFn: () => nn(r, t, e),
276
+ queryKey: nn(t, e),
277
+ queryFn: () => rn(r, t, e),
278
278
  staleTime: 0,
279
279
  retry: !1
280
280
  }),
281
- new Promise((c) => setTimeout(() => c(null), rr))
281
+ new Promise((c) => setTimeout(() => c(null), ar))
282
282
  ]);
283
- return er(l == null ? void 0 : l.lines);
283
+ return tr(l == null ? void 0 : l.lines);
284
284
  } catch {
285
285
  return [];
286
286
  }
287
287
  }, [r, s, t, e]);
288
288
  }
289
- function an({ lines: t }) {
289
+ function sn({ lines: t }) {
290
290
  return t.length === 0 ? null : /* @__PURE__ */ i(
291
291
  "div",
292
292
  {
@@ -309,7 +309,7 @@ function Oe(t, e, r) {
309
309
  ), l = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
310
310
  return !!s && !!l && l.sort < s.sort;
311
311
  }
312
- function sn(t, e, r) {
312
+ function ln(t, e, r) {
313
313
  var l;
314
314
  if (!t) return !1;
315
315
  if ((((l = t.order_partners) == null ? void 0 : l.length) ?? 0) > 0) return !0;
@@ -324,28 +324,59 @@ const Rt = {
324
324
  green: "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
325
325
  blue: "border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
326
326
  purple: "border-violet-200 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300"
327
+ }, Pt = {
328
+ red: "text-red-700 dark:text-red-300",
329
+ amber: "text-amber-700 dark:text-amber-300",
330
+ yellow: "text-yellow-700 dark:text-yellow-300",
331
+ green: "text-emerald-700 dark:text-emerald-300",
332
+ blue: "text-sky-700 dark:text-sky-300",
333
+ purple: "text-violet-700 dark:text-violet-300"
327
334
  };
328
- function ln({ flags: t }) {
329
- return !t || t.length === 0 ? null : /* @__PURE__ */ n(xe, { children: t.map((e) => /* @__PURE__ */ i(
335
+ function on({
336
+ flags: t,
337
+ variant: e = "chip"
338
+ }) {
339
+ return !t || t.length === 0 ? null : e === "inline" ? /* @__PURE__ */ n(
340
+ "span",
341
+ {
342
+ className: "inline-flex h-6 shrink-0 items-center gap-3 self-center border-x border-slate-200 px-3 dark:border-border",
343
+ "data-record-flags-inline": !0,
344
+ children: t.map((r) => /* @__PURE__ */ i(
345
+ "span",
346
+ {
347
+ "data-record-flag": r.name,
348
+ className: he(
349
+ "inline-flex items-center gap-1.5 whitespace-nowrap text-[12px] font-medium",
350
+ Pt[r.color] ?? Pt.amber
351
+ ),
352
+ children: [
353
+ /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-current", "aria-hidden": !0 }),
354
+ r.name
355
+ ]
356
+ },
357
+ r.name
358
+ ))
359
+ }
360
+ ) : /* @__PURE__ */ n(ye, { children: t.map((r) => /* @__PURE__ */ i(
330
361
  "span",
331
362
  {
332
- "data-record-flag": e.name,
333
- className: ye(
363
+ "data-record-flag": r.name,
364
+ className: he(
334
365
  "inline-flex shrink-0 items-center gap-1 self-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",
335
- Rt[e.color] ?? Rt.amber
366
+ Rt[r.color] ?? Rt.amber
336
367
  ),
337
368
  children: [
338
369
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-current", "aria-hidden": !0 }),
339
- e.name
370
+ r.name
340
371
  ]
341
372
  },
342
- e.name
373
+ r.name
343
374
  )) });
344
375
  }
345
- function Pt(t) {
376
+ function Ft(t) {
346
377
  return t.replace(/\s+IIP$/i, "");
347
378
  }
348
- function on({
379
+ function dn({
349
380
  collection: t,
350
381
  item: e,
351
382
  tx: r
@@ -361,20 +392,20 @@ function on({
361
392
  staleTime: 2e4
362
393
  });
363
394
  if (l.length === 0) return null;
364
- const p = c != null && c.pushes ? c.pushes.filter((f) => f.status === "would_push" && l.includes(f.api_name)).map((f) => Pt(f.api_name)) : null, b = [...new Set(p ?? l.map(Pt))];
395
+ const p = c != null && c.pushes ? c.pushes.filter((f) => f.status === "would_push" && l.includes(f.api_name)).map((f) => Ft(f.api_name)) : null, b = [...new Set(p ?? l.map(Ft))];
365
396
  return /* @__PURE__ */ i(
366
397
  "p",
367
398
  {
368
399
  "data-order-send-note": !0,
369
400
  className: "flex items-start gap-1.5 rounded-md border border-sky-200 bg-sky-50 px-2.5 py-1.5 text-[12px] text-sky-900 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-200",
370
401
  children: [
371
- /* @__PURE__ */ n(Ft, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
402
+ /* @__PURE__ */ n(Dt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
372
403
  p && p.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${b.join(" or ")}. It cannot be called back from here.`
373
404
  ]
374
405
  }
375
406
  );
376
407
  }
377
- function dn(t) {
408
+ function cn(t) {
378
409
  return t != null && t.instance ? (t.available_transitions ?? []).some(
379
410
  (e) => {
380
411
  var r;
@@ -382,27 +413,27 @@ function dn(t) {
382
413
  }
383
414
  ) : !1;
384
415
  }
385
- function cn(t, e, r, s) {
416
+ function un(t, e, r, s) {
386
417
  if (!s || s.size === 0) return t;
387
418
  const l = new Set([...s.keys()].map((c) => String(c).toUpperCase()));
388
419
  return t.filter(
389
420
  (c) => !(!c.to_previous && l.has(String(c.to_state).toUpperCase()) && Oe(c, e, r))
390
421
  );
391
422
  }
392
- function un(t, e, r) {
393
- var f, _, v, y, $, A;
423
+ function mn(t, e, r) {
424
+ var f, _, v, y, $, D;
394
425
  const s = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
395
426
  (E) => E.id === e
396
- ), l = r == null ? void 0 : r.data, c = ((f = l == null ? void 0 : l.new_state) == null ? void 0 : f.id) ?? ((_ = l == null ? void 0 : l.instance) == null ? void 0 : _.current_state) ?? null, p = ((v = l == null ? void 0 : l.new_state) == null ? void 0 : v.label) ?? (s ? ($ = (y = t == null ? void 0 : t.states) == null ? void 0 : y.find((E) => E.id === s.to_state)) == null ? void 0 : $.label : void 0) ?? null, b = ((A = t == null ? void 0 : t.instance) == null ? void 0 : A.current_state) ?? null;
427
+ ), l = r == null ? void 0 : r.data, c = ((f = l == null ? void 0 : l.new_state) == null ? void 0 : f.id) ?? ((_ = l == null ? void 0 : l.instance) == null ? void 0 : _.current_state) ?? null, p = ((v = l == null ? void 0 : l.new_state) == null ? void 0 : v.label) ?? (s ? ($ = (y = t == null ? void 0 : t.states) == null ? void 0 : y.find((E) => E.id === s.to_state)) == null ? void 0 : $.label : void 0) ?? null, b = ((D = t == null ? void 0 : t.instance) == null ? void 0 : D.current_state) ?? null;
397
428
  return b && c && String(b) === String(c) ? "Nothing moved" : s != null && s.label && p ? `${s.label} — now ${p}` : p ? `Moved to ${p}` : s != null && s.label ? `${s.label} done` : "Transition executed";
398
429
  }
399
- const ar = 1200;
400
- function mn(t) {
430
+ const sr = 1200;
431
+ function pn(t) {
401
432
  const e = `nvr-move-${Math.random().toString(36).slice(2)}`;
402
433
  let r = !1;
403
434
  const s = setTimeout(() => {
404
435
  r = !0, Y.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
405
- }, ar);
436
+ }, sr);
406
437
  return {
407
438
  /** Options for the result toast: replaces the loading one when shown. */
408
439
  done: () => (clearTimeout(s), r ? { id: e, duration: 7e3 } : {}),
@@ -412,7 +443,7 @@ function mn(t) {
412
443
  }
413
444
  };
414
445
  }
415
- function pn(t, e, r) {
446
+ function fn(t, e, r) {
416
447
  for (const s of [
417
448
  "pipeline-owners-resolved",
418
449
  "pipeline-instance-owners",
@@ -420,7 +451,7 @@ function pn(t, e, r) {
420
451
  ])
421
452
  t.invalidateQueries({ queryKey: [s, e, r] });
422
453
  }
423
- function sr(t, e, r) {
454
+ function ir(t, e, r) {
424
455
  var b;
425
456
  if (!e) return null;
426
457
  const s = new Map(r.map((f) => [String(f.id).toUpperCase(), f.sort])), l = [...t].sort(
@@ -430,7 +461,7 @@ function sr(t, e, r) {
430
461
  const c = s.get(String(l.from_state).toUpperCase()), p = s.get(String(l.to_state).toUpperCase());
431
462
  return c == null || p == null || p >= c ? null : l;
432
463
  }
433
- function ir({ entry: t }) {
464
+ function lr({ entry: t }) {
434
465
  const e = [t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email || "Someone";
435
466
  return /* @__PURE__ */ i(
436
467
  "div",
@@ -439,7 +470,7 @@ function ir({ entry: t }) {
439
470
  "data-send-back-notice": !0,
440
471
  children: [
441
472
  /* @__PURE__ */ n(
442
- Nn,
473
+ _n,
443
474
  {
444
475
  "aria-hidden": !0,
445
476
  className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
@@ -458,7 +489,7 @@ function ir({ entry: t }) {
458
489
  }
459
490
  );
460
491
  }
461
- function fn({
492
+ function hn({
462
493
  collection: t,
463
494
  item: e,
464
495
  offer: r,
@@ -467,11 +498,11 @@ function fn({
467
498
  className: c,
468
499
  style: p
469
500
  }) {
470
- const b = we(), f = De(), [_, v] = I(""), { data: y, isLoading: $ } = oe({
501
+ const b = we(), f = Fe(), [_, v] = I(""), { data: y, isLoading: $ } = oe({
471
502
  queryKey: ["bulk-actions-available-one", t, r.actionKey],
472
503
  queryFn: async () => ((await b.request(ce("/bulk-actions/available", { collection: t }))).data ?? []).find((H) => H.key === r.actionKey) ?? null,
473
504
  staleTime: 6e4
474
- }), A = Pe({
505
+ }), D = Pe({
475
506
  mutationFn: async () => {
476
507
  var T, P;
477
508
  const B = { collection: t, ids: [e], reason: _.trim() || null }, K = ((y == null ? void 0 : y.source) === "extension" ? await b.request(Te(`/bulk-actions/${r.actionKey}/execute`, B)) : await b.request(Te("/bulk-actions/run", { ...B, key: r.actionKey }))).data ?? {};
@@ -481,16 +512,16 @@ function fn({
481
512
  );
482
513
  },
483
514
  onSuccess: () => {
484
- Ae(f, t, e), Y.success(`${(y == null ? void 0 : y.label) ?? "Done"} — trying again`), s();
515
+ De(f, t, e), Y.success(`${(y == null ? void 0 : y.label) ?? "Done"} — trying again`), s();
485
516
  },
486
- onError: (B) => qn(B, `${(y == null ? void 0 : y.label) ?? "The fix"} failed`)
517
+ onError: (B) => Mn(B, `${(y == null ? void 0 : y.label) ?? "The fix"} failed`)
487
518
  });
488
519
  if ($ || !y) return null;
489
- const E = !A.isPending && (!y.require_reason || _.trim().length > 0);
520
+ const E = !D.isPending && (!y.require_reason || _.trim().length > 0);
490
521
  return /* @__PURE__ */ i(
491
522
  "div",
492
523
  {
493
- className: ye(
524
+ className: he(
494
525
  "space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
495
526
  c
496
527
  ),
@@ -532,9 +563,9 @@ function fn({
532
563
  size: "sm",
533
564
  className: "h-7 gap-1.5 text-[12px]",
534
565
  disabled: !E,
535
- onClick: () => A.mutate(),
566
+ onClick: () => D.mutate(),
536
567
  children: [
537
- A.isPending && /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }),
568
+ D.isPending && /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }),
538
569
  y.label,
539
570
  ", then try again"
540
571
  ]
@@ -566,9 +597,9 @@ function Ne({
566
597
  }
567
598
  function Je(t) {
568
599
  const e = Math.floor(t / 6e4);
569
- return e < 60 ? `${Math.max(1, e)}m` : On(t / 36e5);
600
+ return e < 60 ? `${Math.max(1, e)}m` : Un(t / 36e5);
570
601
  }
571
- function lr({
602
+ function or({
572
603
  history: t,
573
604
  completedAt: e
574
605
  }) {
@@ -628,7 +659,7 @@ function lr({
628
659
  }) })
629
660
  ] });
630
661
  }
631
- function or({
662
+ function dr({
632
663
  states: t,
633
664
  allTransitions: e,
634
665
  availableTransitions: r,
@@ -691,18 +722,18 @@ function or({
691
722
  }).sort((g, k) => g.sort - k.sort);
692
723
  })();
693
724
  if (y.length < 2) return null;
694
- const $ = y.findIndex((h) => h.id === s), A = new Map(y.map((h, x) => [h.id, x])), E = new Map(t.map((h) => [h.id, h.label]));
725
+ const $ = y.findIndex((h) => h.id === s), D = new Map(y.map((h, x) => [h.id, x])), E = new Map(t.map((h) => [h.id, h.label]));
695
726
  function B(h, x) {
696
- const w = A.get(h);
727
+ const w = D.get(h);
697
728
  return w == null ? [] : [...l].filter((q) => {
698
729
  if (!q.from_state) return !1;
699
- const o = A.get(q.from_state), Q = A.get(q.to_state);
730
+ const o = D.get(q.from_state), Q = D.get(q.to_state);
700
731
  return o == null || Q == null ? !1 : o === w && Q > w || Q < o && o - 1 === w;
701
732
  }).sort((q, o) => new Date(q.timestamp).getTime() - new Date(o.timestamp).getTime());
702
733
  }
703
734
  function H(h) {
704
735
  var x, w, q, o;
705
- return je(h) ? /* @__PURE__ */ n(Ut, { className: "inline h-2.5 w-2.5", "aria-label": st(h) }) : ((((x = h.first_name) == null ? void 0 : x[0]) ?? "") + (((w = h.last_name) == null ? void 0 : w[0]) ?? "")).toUpperCase() || ((o = (q = h.user_email) == null ? void 0 : q[0]) == null ? void 0 : o.toUpperCase()) || "?";
736
+ return je(h) ? /* @__PURE__ */ n(Et, { className: "inline h-2.5 w-2.5", "aria-label": st(h) }) : ((((x = h.first_name) == null ? void 0 : x[0]) ?? "") + (((w = h.last_name) == null ? void 0 : w[0]) ?? "")).toUpperCase() || ((o = (q = h.user_email) == null ? void 0 : q[0]) == null ? void 0 : o.toUpperCase()) || "?";
706
737
  }
707
738
  function K(h) {
708
739
  return mt([h.first_name, h.last_name].filter(Boolean).join(" ") || h.user_email, h);
@@ -712,7 +743,7 @@ function or({
712
743
  (x, w) => new Date(x.timestamp).getTime() - new Date(w.timestamp).getTime()
713
744
  )) {
714
745
  if (!h.from_state) continue;
715
- const x = A.get(h.from_state), w = A.get(h.to_state);
746
+ const x = D.get(h.from_state), w = D.get(h.to_state);
716
747
  if (!(x == null || w == null || w <= x + 1))
717
748
  for (let q = x + 1; q < w; q++) {
718
749
  const o = y[q].id;
@@ -723,7 +754,7 @@ function or({
723
754
  const x = E.get(h.from_state ?? "") ?? "the previous step", w = E.get(h.to_state) ?? "the next step", q = je(h) ? "it moved automatically" : `${K(h)} moved it`;
724
755
  return `Passed over on ${_t(h.timestamp)} — ${q} straight from ${x} to ${w}`;
725
756
  }
726
- return /* @__PURE__ */ n(Qt, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: b, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: y.map((h, x) => {
757
+ return /* @__PURE__ */ n(Wt, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: b, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: y.map((h, x) => {
727
758
  const w = h.id === s, q = f.has(h.id), o = q && !w && ($ < 0 || x < $), Q = q && !w && !o, X = !q && !w ? T.get(h.id) : void 0, g = !q && !w ? p == null ? void 0 : p.get(h.id) : void 0, k = X || g ? [...X ? [P(X)] : [], ...g ?? []] : void 0, G = k !== void 0, se = h.color ?? "#94a3b8", ee = x === y.length - 1, re = ee ? null : y[x + 1], z = re ? B(h.id, re.id) : [];
728
759
  return /* @__PURE__ */ i("div", { className: "flex flex-1 items-start", children: [
729
760
  /* @__PURE__ */ i("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
@@ -739,7 +770,7 @@ function or({
739
770
  border: w || o ? "none" : G ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
740
771
  boxShadow: w ? `0 0 0 3px white, 0 0 0 5px ${se}` : void 0
741
772
  },
742
- children: o ? /* @__PURE__ */ n(We, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : w ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : G ? /* @__PURE__ */ n(_n, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
773
+ children: o ? /* @__PURE__ */ n(We, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : w ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : G ? /* @__PURE__ */ n(Sn, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
743
774
  },
744
775
  w ? "cur" : o ? "done" : G ? "skip" : "todo"
745
776
  ),
@@ -766,7 +797,7 @@ function or({
766
797
  ] }) : /* @__PURE__ */ n(
767
798
  "span",
768
799
  {
769
- className: ye(
800
+ className: he(
770
801
  "w-full break-words text-center leading-snug",
771
802
  !w && !o && "text-slate-500 dark:text-slate-400"
772
803
  ),
@@ -807,7 +838,7 @@ function or({
807
838
  })(),
808
839
  z.map((C) => {
809
840
  const de = C.from_state !== h.id, J = Math.abs(
810
- (A.get(C.to_state) ?? 0) - (A.get(C.from_state ?? "") ?? 0)
841
+ (D.get(C.to_state) ?? 0) - (D.get(C.from_state ?? "") ?? 0)
811
842
  ) > 1 ? E.get(C.to_state) ?? "" : null;
812
843
  return /* @__PURE__ */ i(nt, { children: [
813
844
  /* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
@@ -825,7 +856,7 @@ function or({
825
856
  /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: ot(C.timestamp) })
826
857
  ] }) }),
827
858
  /* @__PURE__ */ i(at, { side: "top", className: "space-y-0.5 text-[12px]", children: [
828
- je(C) ? /* @__PURE__ */ i(xe, { children: [
859
+ je(C) ? /* @__PURE__ */ i(ye, { children: [
829
860
  /* @__PURE__ */ i("p", { className: "font-medium", children: [
830
861
  de ? "↩ Sent back · " : "",
831
862
  st(C)
@@ -848,9 +879,9 @@ function or({
848
879
  ] }, h.id);
849
880
  }) }) }) });
850
881
  }
851
- function dr({ history: t }) {
882
+ function cr({ history: t }) {
852
883
  return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((e) => {
853
- const r = je(e), s = r ? st(e) : mt([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), l = Gn(e), c = e.comment && !r && !l ? e.comment : null, p = l ?? (r ? it(e) : null);
884
+ const r = je(e), s = r ? st(e) : mt([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), l = Vn(e), c = e.comment && !r && !l ? e.comment : null, p = l ?? (r ? it(e) : null);
854
885
  return /* @__PURE__ */ i("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
855
886
  /* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
856
887
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
@@ -870,7 +901,7 @@ function dr({ history: t }) {
870
901
  className: "mt-0.5 text-slate-400",
871
902
  "data-history-on-behalf": e.on_behalf_of_name ? e.on_behalf_of ?? "" : void 0,
872
903
  children: [
873
- r && /* @__PURE__ */ n(Ut, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
904
+ r && /* @__PURE__ */ n(Et, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
874
905
  s,
875
906
  p ? ` · ${p}` : "",
876
907
  " · ",
@@ -882,7 +913,7 @@ function dr({ history: t }) {
882
913
  ] }, e.id);
883
914
  }) });
884
915
  }
885
- function cr({ value: t, onChange: e }) {
916
+ function ur({ value: t, onChange: e }) {
886
917
  const r = we(), [s, l] = I(!1), [c, p] = I(""), [b, f] = I(""), _ = ne(null), v = ne(null);
887
918
  fe(() => {
888
919
  s ? setTimeout(() => {
@@ -903,11 +934,11 @@ function cr({ value: t, onChange: e }) {
903
934
  ).then((T) => T.data),
904
935
  enabled: s,
905
936
  staleTime: 3e4
906
- }), { data: A } = oe({
907
- ...Dn(r, t),
937
+ }), { data: D } = oe({
938
+ ...An(r, t),
908
939
  enabled: !!t,
909
940
  staleTime: 5 * 6e4
910
- }), E = y ?? [], B = A ?? E.find((T) => T.id === t) ?? null, H = B ? [B.first_name, B.last_name].filter(Boolean).join(" ").trim() || B.email : t ? "Selected person" : null, K = (T) => [T.first_name, T.last_name].filter(Boolean).join(" ").trim();
941
+ }), E = y ?? [], B = D ?? E.find((T) => T.id === t) ?? null, H = B ? [B.first_name, B.last_name].filter(Boolean).join(" ").trim() || B.email : t ? "Selected person" : null, K = (T) => [T.first_name, T.last_name].filter(Boolean).join(" ").trim();
911
942
  return /* @__PURE__ */ i(dt, { open: s, onOpenChange: l, children: [
912
943
  /* @__PURE__ */ i("div", { className: "relative flex h-8 w-full", children: [
913
944
  /* @__PURE__ */ n(ct, { asChild: !0, children: /* @__PURE__ */ i(
@@ -929,13 +960,13 @@ function cr({ value: t, onChange: e }) {
929
960
  T.stopPropagation(), e("");
930
961
  },
931
962
  className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
932
- children: /* @__PURE__ */ n(Ot, { className: "h-3 w-3" })
963
+ children: /* @__PURE__ */ n(Ut, { className: "h-3 w-3" })
933
964
  }
934
965
  )
935
966
  ] }),
936
967
  /* @__PURE__ */ i(ut, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
937
968
  /* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ i("div", { className: "relative", children: [
938
- /* @__PURE__ */ n(Cn, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
969
+ /* @__PURE__ */ n($n, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
939
970
  /* @__PURE__ */ n(
940
971
  "input",
941
972
  {
@@ -976,13 +1007,13 @@ function cr({ value: t, onChange: e }) {
976
1007
  ] })
977
1008
  ] });
978
1009
  }
979
- function Dt({
1010
+ function At({
980
1011
  userId: t,
981
1012
  name: e,
982
1013
  email: r,
983
1014
  initials: s
984
1015
  }) {
985
- return /* @__PURE__ */ n(Kt, { userId: t, children: /* @__PURE__ */ i(
1016
+ return /* @__PURE__ */ n(Qt, { userId: t, children: /* @__PURE__ */ i(
986
1017
  "button",
987
1018
  {
988
1019
  type: "button",
@@ -990,7 +1021,7 @@ function Dt({
990
1021
  className: "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
991
1022
  children: [
992
1023
  /* @__PURE__ */ n(
993
- Bn,
1024
+ jn,
994
1025
  {
995
1026
  userId: t,
996
1027
  alt: e,
@@ -1006,15 +1037,15 @@ function Dt({
1006
1037
  }
1007
1038
  ) });
1008
1039
  }
1009
- function ur({
1040
+ function mr({
1010
1041
  collection: t,
1011
1042
  item: e,
1012
1043
  states: r,
1013
1044
  currentStateId: s,
1014
1045
  returned: l = !1
1015
1046
  }) {
1016
- var he, be, d, _e;
1017
- const c = we(), p = De(), { isAdmin: b } = Bt(), [f, _] = I(!1), [v, y] = I(""), [$, A] = I(""), [E, B] = I(!1), H = ["pipeline-instance-owners", t, e], K = ["pipeline-owners-can-add", t, e], T = () => c.request(
1047
+ var be, ge, d, _e;
1048
+ const c = we(), p = Fe(), { isAdmin: b } = jt(), [f, _] = I(!1), [v, y] = I(""), [$, D] = I(""), [E, B] = I(!1), H = ["pipeline-instance-owners", t, e], K = ["pipeline-owners-can-add", t, e], T = () => c.request(
1018
1049
  ce(`/pipelines/instance/${t}/${e}/owners`)
1019
1050
  ).then((a) => {
1020
1051
  var m;
@@ -1037,8 +1068,8 @@ function ur({
1037
1068
  ).then((a) => a.data ?? null),
1038
1069
  enabled: !!s,
1039
1070
  staleTime: 3e4
1040
- }), o = new Set((P ?? []).map((a) => a.user)), Q = s ? (((he = w == null ? void 0 : w[s]) == null ? void 0 : he.owners) ?? []).filter((a) => !o.has(a.id)) : [], X = new Map(
1041
- (s ? ((be = w == null ? void 0 : w[s]) == null ? void 0 : be.unavailable) ?? [] : []).map((a) => [
1071
+ }), o = new Set((P ?? []).map((a) => a.user)), Q = s ? (((be = w == null ? void 0 : w[s]) == null ? void 0 : be.owners) ?? []).filter((a) => !o.has(a.id)) : [], X = new Map(
1072
+ (s ? ((ge = w == null ? void 0 : w[s]) == null ? void 0 : ge.unavailable) ?? [] : []).map((a) => [
1042
1073
  String(a.id).toUpperCase(),
1043
1074
  a
1044
1075
  ])
@@ -1059,12 +1090,12 @@ function ur({
1059
1090
  })
1060
1091
  ),
1061
1092
  onSuccess: () => {
1062
- re(), y(""), A(""), _(!1), Y.success("Owner added");
1093
+ re(), y(""), D(""), _(!1), Y.success("Owner added");
1063
1094
  },
1064
1095
  // The server's reason (a 403 says why), not a bare status phrase.
1065
- onError: (a) => Y.error(Fe(a, "Failed to add owner"))
1096
+ onError: (a) => Y.error(Ae(a, "Failed to add owner"))
1066
1097
  }), C = Pe({
1067
- mutationFn: (a) => c.request(Tn(`/pipelines/instance-owners/${a.id}`)),
1098
+ mutationFn: (a) => c.request(qn(`/pipelines/instance-owners/${a.id}`)),
1068
1099
  onSuccess: (a, m) => {
1069
1100
  re();
1070
1101
  const N = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email;
@@ -1076,14 +1107,14 @@ function ur({
1076
1107
  user: m.user,
1077
1108
  state: m.state || void 0
1078
1109
  })
1079
- ).then(() => re()).catch((D) => Y.error(Fe(D, "Could not add the owner back")))
1110
+ ).then(() => re()).catch((F) => Y.error(Ae(F, "Could not add the owner back")))
1080
1111
  }
1081
1112
  });
1082
1113
  },
1083
- onError: (a) => Y.error(Fe(a, "Failed to remove owner"))
1114
+ onError: (a) => Y.error(Ae(a, "Failed to remove owner"))
1084
1115
  }), de = (a) => {
1085
- var D, M;
1086
- const m = ((D = a.first_name) == null ? void 0 : D[0]) ?? "", N = ((M = a.last_name) == null ? void 0 : M[0]) ?? "";
1116
+ var F, M;
1117
+ const m = ((F = a.first_name) == null ? void 0 : F[0]) ?? "", N = ((M = a.last_name) == null ? void 0 : M[0]) ?? "";
1087
1118
  return (`${m}${N}`.trim() || a.email[0] || "?").toUpperCase();
1088
1119
  }, J = (a) => {
1089
1120
  var m;
@@ -1092,7 +1123,7 @@ function ur({
1092
1123
  return /* @__PURE__ */ i("div", { children: [
1093
1124
  /* @__PURE__ */ i("div", { className: "mb-3 flex items-center justify-between", children: [
1094
1125
  /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
1095
- /* @__PURE__ */ n(At, { className: "h-3.5 w-3.5" }),
1126
+ /* @__PURE__ */ n(Ot, { className: "h-3.5 w-3.5" }),
1096
1127
  "Owners",
1097
1128
  L || q ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : ee ? null : /* @__PURE__ */ i("span", { className: "text-slate-300", children: [
1098
1129
  "(",
@@ -1101,7 +1132,7 @@ function ur({
1101
1132
  ] })
1102
1133
  ] }),
1103
1134
  /* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
1104
- s && /* @__PURE__ */ n(In, { collection: t, itemId: String(e) }),
1135
+ s && /* @__PURE__ */ n(Kn, { collection: t, itemId: String(e) }),
1105
1136
  !f && x && /* @__PURE__ */ i(
1106
1137
  "button",
1107
1138
  {
@@ -1109,7 +1140,7 @@ function ur({
1109
1140
  onClick: () => _(!0),
1110
1141
  className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
1111
1142
  children: [
1112
- /* @__PURE__ */ n(Sn, { className: "h-3 w-3" }),
1143
+ /* @__PURE__ */ n(Cn, { className: "h-3 w-3" }),
1113
1144
  "Add"
1114
1145
  ]
1115
1146
  }
@@ -1122,7 +1153,7 @@ function ur({
1122
1153
  ] }) : ee ? /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1123
1154
  l ? "Back with" : "With",
1124
1155
  " ",
1125
- /* @__PURE__ */ n(Kt, { userId: ee.id, children: /* @__PURE__ */ n(
1156
+ /* @__PURE__ */ n(Qt, { userId: ee.id, children: /* @__PURE__ */ n(
1126
1157
  "button",
1127
1158
  {
1128
1159
  type: "button",
@@ -1133,21 +1164,21 @@ function ur({
1133
1164
  ) })
1134
1165
  ] }) : g === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ i("div", { className: "space-y-px", children: [
1135
1166
  Q.map((a) => {
1136
- var D, M;
1137
- const m = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, N = (`${((D = a.first_name) == null ? void 0 : D[0]) ?? ""}${((M = a.last_name) == null ? void 0 : M[0]) ?? ""}`.trim() || a.email[0] || "?").toUpperCase();
1167
+ var F, M;
1168
+ const m = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, N = (`${((F = a.first_name) == null ? void 0 : F[0]) ?? ""}${((M = a.last_name) == null ? void 0 : M[0]) ?? ""}`.trim() || a.email[0] || "?").toUpperCase();
1138
1169
  return /* @__PURE__ */ i(
1139
1170
  "div",
1140
1171
  {
1141
1172
  className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1142
1173
  children: [
1143
- /* @__PURE__ */ n(Dt, { userId: a.id, name: m, email: a.email, initials: N }),
1174
+ /* @__PURE__ */ n(At, { userId: a.id, name: m, email: a.email, initials: N }),
1144
1175
  (() => {
1145
1176
  const R = X.get(String(a.id).toUpperCase());
1146
1177
  return R ? /* @__PURE__ */ n(
1147
1178
  "span",
1148
1179
  {
1149
1180
  "data-owner-unavailable": R.reason,
1150
- className: ye(
1181
+ className: he(
1151
1182
  "shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",
1152
1183
  R.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1153
1184
  ),
@@ -1175,7 +1206,7 @@ function ur({
1175
1206
  className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1176
1207
  children: [
1177
1208
  /* @__PURE__ */ n(
1178
- Dt,
1209
+ At,
1179
1210
  {
1180
1211
  userId: a.user,
1181
1212
  name: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email,
@@ -1193,7 +1224,7 @@ function ur({
1193
1224
  disabled: C.isPending,
1194
1225
  onClick: () => C.mutate(a),
1195
1226
  className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
1196
- children: /* @__PURE__ */ n(Ot, { className: "h-3 w-3" })
1227
+ children: /* @__PURE__ */ n(Ut, { className: "h-3 w-3" })
1197
1228
  }
1198
1229
  )
1199
1230
  ]
@@ -1203,7 +1234,7 @@ function ur({
1203
1234
  ] }),
1204
1235
  f && /* @__PURE__ */ i("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
1205
1236
  /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
1206
- /* @__PURE__ */ n(cr, { value: v, onChange: y }),
1237
+ /* @__PURE__ */ n(ur, { value: v, onChange: y }),
1207
1238
  b ? /* @__PURE__ */ i(dt, { open: E, onOpenChange: B, children: [
1208
1239
  /* @__PURE__ */ n(ct, { asChild: !0, children: /* @__PURE__ */ i(
1209
1240
  "button",
@@ -1217,18 +1248,18 @@ function ur({
1217
1248
  }
1218
1249
  ) }),
1219
1250
  /* @__PURE__ */ n(ut, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((a) => a.id)].map((a) => {
1220
- var D;
1221
- const m = a === "" ? "All states" : ((D = r.find((M) => M.id === a)) == null ? void 0 : D.label) ?? a;
1251
+ var F;
1252
+ const m = a === "" ? "All states" : ((F = r.find((M) => M.id === a)) == null ? void 0 : F.label) ?? a;
1222
1253
  return /* @__PURE__ */ n(
1223
1254
  "button",
1224
1255
  {
1225
1256
  type: "button",
1226
- className: ye(
1257
+ className: he(
1227
1258
  "flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1228
1259
  $ === a && "font-medium text-slate-800 dark:text-slate-200"
1229
1260
  ),
1230
1261
  onClick: () => {
1231
- A(a), B(!1);
1262
+ D(a), B(!1);
1232
1263
  },
1233
1264
  children: m
1234
1265
  },
@@ -1245,7 +1276,7 @@ function ur({
1245
1276
  variant: "ghost",
1246
1277
  className: "h-7 text-[12px]",
1247
1278
  onClick: () => {
1248
- _(!1), y(""), A("");
1279
+ _(!1), y(""), D("");
1249
1280
  },
1250
1281
  children: "Cancel"
1251
1282
  }
@@ -1265,16 +1296,16 @@ function ur({
1265
1296
  ] })
1266
1297
  ] });
1267
1298
  }
1268
- function hn(t, e, r, s) {
1299
+ function bn(t, e, r, s) {
1269
1300
  if (!t || !(r != null && r.length)) return null;
1270
1301
  const c = new Map(r.map((f) => [String(f.id).toUpperCase(), f])).get(String(t.to_state).toUpperCase()), p = Number(e == null ? void 0 : e.sort);
1271
1302
  if (!c || !Number.isFinite(p) || !(Number(c.sort) > p)) return null;
1272
- const b = Qn(String(t.to_state), r, s);
1303
+ const b = Wn(String(t.to_state), r, s);
1273
1304
  return b && b.skipped.length > 0 ? b : null;
1274
1305
  }
1275
- function bn({ landing: t }) {
1306
+ function gn({ landing: t }) {
1276
1307
  if (!t || t.skipped.length === 0) return null;
1277
- const e = Wn(t);
1308
+ const e = zn(t);
1278
1309
  if (e.length === 1) {
1279
1310
  const r = e[0];
1280
1311
  return /* @__PURE__ */ i(
@@ -1321,7 +1352,7 @@ const Re = {
1321
1352
  suspended: "suspended",
1322
1353
  redacted: "redacted"
1323
1354
  };
1324
- function mr({
1355
+ function pr({
1325
1356
  collection: t,
1326
1357
  item: e,
1327
1358
  states: r,
@@ -1346,7 +1377,7 @@ function mr({
1346
1377
  title: "View approval chain",
1347
1378
  className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
1348
1379
  onClick: (v) => v.stopPropagation(),
1349
- children: /* @__PURE__ */ n(At, { className: "h-3.5 w-3.5" })
1380
+ children: /* @__PURE__ */ n(Ot, { className: "h-3.5 w-3.5" })
1350
1381
  }
1351
1382
  ) }),
1352
1383
  /* @__PURE__ */ i(ut, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
@@ -1359,28 +1390,28 @@ function mr({
1359
1390
  const y = (((K = b[v.id]) == null ? void 0 : K.owners) ?? []).map((x) => ({
1360
1391
  id: x.id,
1361
1392
  name: [x.first_name, x.last_name].filter(Boolean).join(" ") || x.email
1362
- })), $ = v.id === s, A = ((T = b[v.id]) == null ? void 0 : T.skipped) === !0 && !$, E = (((P = b[v.id]) == null ? void 0 : P.skip_reasons) ?? []).filter(Boolean), B = ((L = b[v.id]) == null ? void 0 : L.unavailable) ?? [], H = ((h = b[v.id]) == null ? void 0 : h.blocked) === !0 && !A;
1393
+ })), $ = v.id === s, D = ((T = b[v.id]) == null ? void 0 : T.skipped) === !0 && !$, E = (((P = b[v.id]) == null ? void 0 : P.skip_reasons) ?? []).filter(Boolean), B = ((L = b[v.id]) == null ? void 0 : L.unavailable) ?? [], H = ((h = b[v.id]) == null ? void 0 : h.blocked) === !0 && !D;
1363
1394
  return /* @__PURE__ */ i(
1364
1395
  "div",
1365
1396
  {
1366
- className: ye(
1397
+ className: he(
1367
1398
  "flex items-center gap-3 px-4 py-2.5",
1368
1399
  // Hex-with-alpha rather than bg-nvr-cyan/N — the
1369
1400
  // nvr-cyan token is an opaque var() so Tailwind silently
1370
1401
  // drops opacity modifiers on it. Kept very light so the
1371
1402
  // tint doesn't clash with the state badge's own color.
1372
1403
  $ && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1373
- A && "opacity-60",
1404
+ D && "opacity-60",
1374
1405
  H && "bg-red-50 dark:bg-red-500/10"
1375
1406
  ),
1376
1407
  "data-chain-blocked": H ? "" : void 0,
1377
1408
  children: [
1378
1409
  /* @__PURE__ */ n(Ne, { label: v.label, color: v.color, small: !0 }),
1379
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: A ? (
1410
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: D ? (
1380
1411
  // Radix tooltip with zero delay — native `title` waits on
1381
1412
  // the OS hover timer, and a truncated reason needs its
1382
1413
  // full text the moment the cursor lands on it.
1383
- /* @__PURE__ */ n(Qt, { delayDuration: 0, children: /* @__PURE__ */ i(nt, { children: [
1414
+ /* @__PURE__ */ n(Wt, { delayDuration: 0, children: /* @__PURE__ */ i(nt, { children: [
1384
1415
  /* @__PURE__ */ n(rt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1385
1416
  /* @__PURE__ */ n("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
1386
1417
  E.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: E.join(" · ") })
@@ -1398,19 +1429,19 @@ function mr({
1398
1429
  }
1399
1430
  )
1400
1431
  ] }) })
1401
- ) : /* @__PURE__ */ i(xe, { children: [
1402
- /* @__PURE__ */ n(Ln, { owners: y, max: 10, emptyLabel: "—" }),
1432
+ ) : /* @__PURE__ */ i(ye, { children: [
1433
+ /* @__PURE__ */ n(Bn, { owners: y, max: 10, emptyLabel: "—" }),
1403
1434
  B.map((x) => /* @__PURE__ */ i(
1404
1435
  "span",
1405
1436
  {
1406
- "data-tip": `${x.name} is ${Re[x.reason] ?? x.reason}${x.delegate ? ` — ${x.delegate.name} covers${x.delegate.expires_at ? ` until ${An(x.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1407
- className: ye(
1437
+ "data-tip": `${x.name} is ${Re[x.reason] ?? x.reason}${x.delegate ? ` — ${x.delegate.name} covers${x.delegate.expires_at ? ` until ${On(x.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1438
+ className: he(
1408
1439
  "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
1409
1440
  x.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
1410
1441
  ),
1411
1442
  children: [
1412
1443
  x.name,
1413
- x.delegate ? /* @__PURE__ */ i(xe, { children: [
1444
+ x.delegate ? /* @__PURE__ */ i(ye, { children: [
1414
1445
  " → ",
1415
1446
  x.delegate.name,
1416
1447
  x.delegate.expires_at && /* @__PURE__ */ i("span", { className: "opacity-70", children: [
@@ -1443,7 +1474,7 @@ function mr({
1443
1474
  ] })
1444
1475
  ] });
1445
1476
  }
1446
- function Hr({
1477
+ function Gr({
1447
1478
  collection: t,
1448
1479
  item: e,
1449
1480
  defaultExpanded: r,
@@ -1457,7 +1488,7 @@ function Hr({
1457
1488
  asRole: v
1458
1489
  }) {
1459
1490
  return e === "new" ? null : /* @__PURE__ */ n(
1460
- pr,
1491
+ fr,
1461
1492
  {
1462
1493
  collection: t,
1463
1494
  item: e,
@@ -1474,14 +1505,14 @@ function Hr({
1474
1505
  `${t}:${e}`
1475
1506
  );
1476
1507
  }
1477
- function gn({
1508
+ function xn({
1478
1509
  collection: t,
1479
1510
  item: e,
1480
1511
  omitLines: r
1481
1512
  }) {
1482
1513
  const s = we(), { data: l } = oe({
1483
- queryKey: tn(t, e),
1484
- queryFn: () => nn(s, t, e),
1514
+ queryKey: nn(t, e),
1515
+ queryFn: () => rn(s, t, e),
1485
1516
  staleTime: 3e4,
1486
1517
  retry: !1
1487
1518
  });
@@ -1492,10 +1523,10 @@ function gn({
1492
1523
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
1493
1524
  " ",
1494
1525
  "(",
1495
- tr(l.days_in_state),
1526
+ nr(l.days_in_state),
1496
1527
  "):",
1497
1528
  " ",
1498
- l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ i(xe, { children: [
1529
+ l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ i(ye, { children: [
1499
1530
  c > 0 && /* @__PURE__ */ i("span", { children: [
1500
1531
  c,
1501
1532
  " field",
@@ -1521,18 +1552,18 @@ function gn({
1521
1552
  ] }),
1522
1553
  l.field_changes.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1 space-y-0.5", children: [
1523
1554
  l.field_changes.slice(0, 5).map((f) => {
1524
- const _ = nr(f.old, f.new);
1555
+ const _ = rr(f.old, f.new);
1525
1556
  return /* @__PURE__ */ i(
1526
1557
  "p",
1527
1558
  {
1528
1559
  "data-brief-change": f.field,
1529
1560
  className: "text-[11px] text-slate-500 dark:text-muted-foreground",
1530
1561
  children: [
1531
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: f.label || Fn(f.field) }),
1562
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: f.label || Dn(f.field) }),
1532
1563
  f.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1533
1564
  ":",
1534
1565
  " ",
1535
- _.old !== null && /* @__PURE__ */ i(xe, { children: [
1566
+ _.old !== null && /* @__PURE__ */ i(ye, { children: [
1536
1567
  /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: _.old }),
1537
1568
  /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " → " }),
1538
1569
  /* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
@@ -1570,7 +1601,7 @@ function gn({
1570
1601
  ))
1571
1602
  ] });
1572
1603
  }
1573
- function pr({
1604
+ function fr({
1574
1605
  collection: t,
1575
1606
  item: e,
1576
1607
  defaultExpanded: r,
@@ -1584,12 +1615,12 @@ function pr({
1584
1615
  asRole: v
1585
1616
  }) {
1586
1617
  var gt, xt, yt;
1587
- const y = we(), $ = De(), { isAdmin: A } = Bt(), [E, B] = I(0), H = ne(null);
1618
+ const y = we(), $ = Fe(), { isAdmin: D } = jt(), [E, B] = I(0), H = ne(null);
1588
1619
  fe(() => {
1589
- if (!A) return;
1620
+ if (!D) return;
1590
1621
  const u = (S) => {
1591
- const F = S.detail;
1592
- !F || F.claimed || F.collection !== t || String(F.item) !== String(e) || (F.claimed = !0, q(!0), B((W) => W + 1), setTimeout(
1622
+ const A = S.detail;
1623
+ !A || A.claimed || A.collection !== t || String(A.item) !== String(e) || (A.claimed = !0, q(!0), B((W) => W + 1), setTimeout(
1593
1624
  () => {
1594
1625
  var W;
1595
1626
  return (W = H.current) == null ? void 0 : W.scrollIntoView({ block: "center", behavior: "smooth" });
@@ -1598,21 +1629,21 @@ function pr({
1598
1629
  ));
1599
1630
  };
1600
1631
  return window.addEventListener(Nt, u), () => window.removeEventListener(Nt, u);
1601
- }, [A, t, e]);
1602
- const [K, T] = I(""), [P, L] = I(null), [h, x] = I(!1), [w, q] = I(!1), [o, Q] = I(null), [X, g] = I(null), [k, G] = I([]), se = rn(t, String(e));
1603
- It(t, e, "transition", !!P || !!o);
1604
- const ee = Mn(t, e, "transition"), re = ne(!1);
1632
+ }, [D, t, e]);
1633
+ const [K, T] = I(""), [P, L] = I(null), [h, x] = I(!1), [w, q] = I(!1), [o, Q] = I(null), [X, g] = I(null), [k, G] = I([]), se = an(t, String(e));
1634
+ Kt(t, e, "transition", !!P || !!o);
1635
+ const ee = Rn(t, e, "transition"), re = ne(!1);
1605
1636
  fe(() => {
1606
1637
  !re.current && r !== void 0 && (re.current = !0, q(r));
1607
1638
  }, [r]);
1608
1639
  const z = ne(!1), C = (u) => {
1609
1640
  z.current || (z.current = !0, g(null), j.mutate(u, {
1610
- onSettled: (S, F) => {
1611
- if (F) {
1641
+ onSettled: (S, A) => {
1642
+ if (A) {
1612
1643
  z.current = !1;
1613
1644
  return;
1614
1645
  }
1615
- be().finally(() => {
1646
+ ge().finally(() => {
1616
1647
  z.current = !1;
1617
1648
  });
1618
1649
  }
@@ -1634,8 +1665,8 @@ function pr({
1634
1665
  }
1635
1666
  if (!te) return;
1636
1667
  }
1637
- const S = (ge ?? []).find((te) => te.id === u), F = String((S == null ? void 0 : S.comment_mode) ?? "none"), W = sn(S, (d == null ? void 0 : d.states) ?? [], (Z = d == null ? void 0 : d.instance) == null ? void 0 : Z.current_state);
1638
- if (F !== "optional" && F !== "required") {
1668
+ const S = (xe ?? []).find((te) => te.id === u), A = String((S == null ? void 0 : S.comment_mode) ?? "none"), W = ln(S, (d == null ? void 0 : d.states) ?? [], (Z = d == null ? void 0 : d.instance) == null ? void 0 : Z.current_state);
1669
+ if (A !== "optional" && A !== "required") {
1639
1670
  if (S && !Oe(S, (d == null ? void 0 : d.states) ?? [], (le = d == null ? void 0 : d.instance) == null ? void 0 : le.current_state)) {
1640
1671
  z.current = !0;
1641
1672
  let te = [];
@@ -1657,7 +1688,7 @@ function pr({
1657
1688
  return;
1658
1689
  }
1659
1690
  G([]), L(u);
1660
- }, J = v ? ["pipeline-instance", t, e, v] : ["pipeline-instance", t, e], { settling: he, settle: be } = Zt(J), { data: d, isLoading: _e } = oe({
1691
+ }, J = v ? ["pipeline-instance", t, e, v] : ["pipeline-instance", t, e], { settling: be, settle: ge } = en(J), { data: d, isLoading: _e } = oe({
1661
1692
  queryKey: J,
1662
1693
  queryFn: () => y.request(
1663
1694
  ce(
@@ -1674,7 +1705,7 @@ function pr({
1674
1705
  }
1675
1706
  ),
1676
1707
  staleTime: 1e4
1677
- }), a = en(
1708
+ }), a = tn(
1678
1709
  d ? (d.available_transitions ?? []).map((u) => String(u.id)) : null,
1679
1710
  `${t}:${e}`
1680
1711
  );
@@ -1693,17 +1724,17 @@ function pr({
1693
1724
  ).then((u) => u.data ?? null),
1694
1725
  // Also when a send back is on offer: its target may be a chain step this record skipped.
1695
1726
  // And while a move is being confirmed: the panel names where it really lands.
1696
- enabled: (w || dn(d) || !!P) && !!(d != null && d.instance),
1727
+ enabled: (w || cn(d) || !!P) && !!(d != null && d.instance),
1697
1728
  staleTime: 3e4
1698
- }), D = Ie(() => {
1729
+ }), F = Ie(() => {
1699
1730
  if (!m) return null;
1700
1731
  const u = Object.entries(m);
1701
1732
  return u.length === 0 || u.every(([, S]) => S.on_path === void 0) ? null : new Set(u.filter(([, S]) => S.on_path !== !1).map(([S]) => S));
1702
1733
  }, [m]), M = Ie(() => {
1703
1734
  if (!m) return null;
1704
1735
  const u = /* @__PURE__ */ new Map();
1705
- for (const [S, F] of Object.entries(m))
1706
- F.skipped && u.set(S, F.skip_reasons ?? []);
1736
+ for (const [S, A] of Object.entries(m))
1737
+ A.skipped && u.set(S, A.skip_reasons ?? []);
1707
1738
  return u;
1708
1739
  }, [m]), R = Pe({
1709
1740
  mutationFn: () => y.request(Te(`/pipelines/instance/${t}/${e}/start`, {})),
@@ -1715,36 +1746,36 @@ function pr({
1715
1746
  mutationFn: ({
1716
1747
  transition_id: u,
1717
1748
  comment: S,
1718
- reviewed: F,
1749
+ reviewed: A,
1719
1750
  lock_ack: W
1720
1751
  }) => y.request(
1721
1752
  Te(`/pipelines/instance/${t}/${e}/transition`, {
1722
1753
  transition_id: u,
1723
1754
  comment: S,
1724
- ...F ? { reviewed: !0 } : {},
1755
+ ...A ? { reviewed: !0 } : {},
1725
1756
  ...W ? { lock_ack: !0 } : {}
1726
1757
  })
1727
1758
  ),
1728
1759
  onMutate: (u) => {
1729
1760
  var S;
1730
1761
  return {
1731
- slow: mn(
1762
+ slow: pn(
1732
1763
  (S = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
1733
- (F) => F.id === u.transition_id
1764
+ (A) => A.id === u.transition_id
1734
1765
  )) == null ? void 0 : S.label
1735
1766
  )
1736
1767
  };
1737
1768
  },
1738
- onSuccess: (u, S, F) => {
1739
- $.invalidateQueries({ queryKey: J }), t === "nivaro_addendums" && $.invalidateQueries({ queryKey: ["addendums"] }), Qe($, t, String(e)), Ae($, t, String(e)), pn($, t, String(e)), g(null), T(""), L(null), Q(null), Y.success(un(d, S.transition_id, u), F == null ? void 0 : F.slow.done());
1769
+ onSuccess: (u, S, A) => {
1770
+ $.invalidateQueries({ queryKey: J }), t === "nivaro_addendums" && $.invalidateQueries({ queryKey: ["addendums"] }), Qe($, t, String(e)), De($, t, String(e)), fn($, t, String(e)), g(null), T(""), L(null), Q(null), Y.success(mn(d, S.transition_id, u), A == null ? void 0 : A.slow.done());
1740
1771
  },
1741
- onError: (u, S, F) => {
1772
+ onError: (u, S, A) => {
1742
1773
  var te;
1743
- if (F == null || F.slow.fail(), Gt(u)) {
1774
+ if (A == null || A.slow.fail(), Vt(u)) {
1744
1775
  $.invalidateQueries({ queryKey: J });
1745
1776
  return;
1746
1777
  }
1747
- const W = Yt(u);
1778
+ const W = Jt(u);
1748
1779
  if (W) {
1749
1780
  L(null);
1750
1781
  const ve = ((te = [...(d == null ? void 0 : d.available_transitions) ?? [], ...(d == null ? void 0 : d.all_transitions) ?? []].find(
@@ -1762,7 +1793,7 @@ function pr({
1762
1793
  });
1763
1794
  return;
1764
1795
  }
1765
- const Z = Vt(u);
1796
+ const Z = Xt(u);
1766
1797
  if (Z) {
1767
1798
  Q((ve) => ({
1768
1799
  payload: Z,
@@ -1773,31 +1804,31 @@ function pr({
1773
1804
  return;
1774
1805
  }
1775
1806
  const le = u == null ? void 0 : u.response;
1776
- g(Jt(u, S)), Y.error(Fe(u, "Failed to execute transition"), {
1807
+ g(Zt(u, S)), Y.error(Ae(u, "Failed to execute transition"), {
1777
1808
  duration: 12e3,
1778
1809
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
1779
- ...jt(u, { action: "Transition" }),
1810
+ ...It(u, { action: "Transition" }),
1780
1811
  // #1867: a refusal carries "Why?" — the role, owner or access rule
1781
1812
  // that stopped it, and who can change it.
1782
- ...Wt(u) ? {
1783
- action: zt(y, {
1813
+ ...zt(u) ? {
1814
+ action: Ht(y, {
1784
1815
  collection: t,
1785
1816
  itemId: String(e),
1786
1817
  action: "transition",
1787
1818
  transitionId: S.transition_id
1788
1819
  })
1789
1820
  } : {}
1790
- }), Q(null), L(null), Qe($, t, String(e)), Ae($, t, String(e)), (le == null ? void 0 : le.status) === 409 && $.invalidateQueries({ queryKey: J });
1821
+ }), Q(null), L(null), Qe($, t, String(e)), De($, t, String(e)), (le == null ? void 0 : le.status) === 409 && $.invalidateQueries({ queryKey: J });
1791
1822
  }
1792
1823
  }), ue = ne(de);
1793
1824
  ue.current = de;
1794
1825
  const U = ne((d == null ? void 0 : d.available_transitions) ?? []);
1795
1826
  if (U.current = (d == null ? void 0 : d.available_transitions) ?? [], fe(() => {
1796
1827
  const u = (S) => {
1797
- const F = S.detail;
1798
- if (!F || F.claimed || F.collection !== t || String(F.item) !== String(e)) return;
1799
- F.claimed = !0;
1800
- const W = String(F.transition_id).toUpperCase(), Z = U.current.find((le) => String(le.id).toUpperCase() === W);
1828
+ const A = S.detail;
1829
+ if (!A || A.claimed || A.collection !== t || String(A.item) !== String(e)) return;
1830
+ A.claimed = !0;
1831
+ const W = String(A.transition_id).toUpperCase(), Z = U.current.find((le) => String(le.id).toUpperCase() === W);
1801
1832
  if (!Z) {
1802
1833
  Y.error("That step is not available from where the record is now");
1803
1834
  return;
@@ -1813,20 +1844,20 @@ function pr({
1813
1844
  /* @__PURE__ */ n(ke, { className: "ml-auto h-3.5 w-3.5 rounded" })
1814
1845
  ] }) });
1815
1846
  if (!(d != null && d.binding)) return null;
1816
- const { instance: O, available_transitions: ge, history: Se, states: pe } = d, Ue = new Map((pe ?? []).map((u) => [u.id, u])), Ce = (O == null ? void 0 : O.current_state_obj) ?? null, ie = P ? (ge ?? []).find((u) => u.id === P) : null, xn = ie ? Ue.get(ie.to_state) : null, Ee = hn(ie, Ce, pe, m), ze = (Ee == null ? void 0 : Ee.state) ?? xn, yn = O != null && O.completed_at && ge ? ge.filter(
1847
+ const { instance: O, available_transitions: xe, history: Se, states: pe } = d, Ue = new Map((pe ?? []).map((u) => [u.id, u])), Ce = (O == null ? void 0 : O.current_state_obj) ?? null, ie = P ? (xe ?? []).find((u) => u.id === P) : null, yn = ie ? Ue.get(ie.to_state) : null, Ee = bn(ie, Ce, pe, m), ze = (Ee == null ? void 0 : Ee.state) ?? yn, wn = O != null && O.completed_at && xe ? xe.filter(
1817
1848
  (u) => u.from_state && String(u.from_state).toUpperCase() === String(O.current_state).toUpperCase()
1818
- ) : null, He = O != null && O.completed_at ? yn ?? [] : cn(
1819
- ge ?? [],
1849
+ ) : null, He = O != null && O.completed_at ? wn ?? [] : un(
1850
+ xe ?? [],
1820
1851
  pe ?? [],
1821
1852
  O == null ? void 0 : O.current_state,
1822
1853
  M
1823
1854
  ), pt = He.length > 0, ft = (u, S = !1) => {
1824
- const F = /* @__PURE__ */ new Map();
1855
+ const A = /* @__PURE__ */ new Map();
1825
1856
  for (const W of u) {
1826
- const Z = F.get(W.label) ?? [];
1827
- Z.push(W), F.set(W.label, Z);
1857
+ const Z = A.get(W.label) ?? [];
1858
+ Z.push(W), A.set(W.label, Z);
1828
1859
  }
1829
- return Array.from(F.entries()).map(([W, Z]) => {
1860
+ return Array.from(A.entries()).map(([W, Z]) => {
1830
1861
  var Le, wt;
1831
1862
  const le = ((Le = Z[0]) == null ? void 0 : Le.color) ?? null, te = Z.some((V) => V.id === P), ve = (V) => le ? V ? { backgroundColor: le, borderColor: le } : { borderColor: le, color: le } : void 0;
1832
1863
  if (Z.length === 1) {
@@ -1838,7 +1869,7 @@ function pr({
1838
1869
  variant: te ? "default" : "outline",
1839
1870
  className: `${S ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5 data-[fresh=true]:opacity-60`,
1840
1871
  style: ve(te),
1841
- disabled: j.isPending || he,
1872
+ disabled: j.isPending || be,
1842
1873
  "aria-disabled": a.dimmed(V.id) || void 0,
1843
1874
  "data-fresh": a.dimmed(V.id) || void 0,
1844
1875
  ...a.bind(V.id),
@@ -1861,7 +1892,7 @@ function pr({
1861
1892
  variant: te ? "default" : "outline",
1862
1893
  className: `${S ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
1863
1894
  style: ve(te),
1864
- disabled: j.isPending || he,
1895
+ disabled: j.isPending || be,
1865
1896
  children: [
1866
1897
  W,
1867
1898
  /* @__PURE__ */ n($e, { className: "h-3 w-3" })
@@ -1889,7 +1920,7 @@ function pr({
1889
1920
  ] }, W);
1890
1921
  });
1891
1922
  }, Ge = X ? /* @__PURE__ */ n(
1892
- fn,
1923
+ hn,
1893
1924
  {
1894
1925
  collection: t,
1895
1926
  item: String(e),
@@ -1897,7 +1928,7 @@ function pr({
1897
1928
  onDismiss: () => g(null),
1898
1929
  onFixed: () => C({ transition_id: X.transitionId, comment: X.comment })
1899
1930
  }
1900
- ) : null, ht = sr(Se ?? [], O == null ? void 0 : O.current_state, pe ?? []), bt = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
1931
+ ) : null, ht = ir(Se ?? [], O == null ? void 0 : O.current_state, pe ?? []), bt = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
1901
1932
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
1902
1933
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
1903
1934
  ie && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: ie.label }),
@@ -1907,10 +1938,10 @@ function pr({
1907
1938
  /* @__PURE__ */ n(Ne, { label: ze.label, color: ze.color, small: !0 })
1908
1939
  ] })
1909
1940
  ] }),
1910
- /* @__PURE__ */ n(bn, { landing: Ee }),
1911
- /* @__PURE__ */ n(on, { collection: t, item: String(e), tx: ie }),
1912
- /* @__PURE__ */ n(gn, { collection: t, item: e, omitLines: k }),
1913
- /* @__PURE__ */ n(an, { lines: k }),
1941
+ /* @__PURE__ */ n(gn, { landing: Ee }),
1942
+ /* @__PURE__ */ n(dn, { collection: t, item: String(e), tx: ie }),
1943
+ /* @__PURE__ */ n(xn, { collection: t, item: e, omitLines: k }),
1944
+ /* @__PURE__ */ n(sn, { lines: k }),
1914
1945
  /* @__PURE__ */ n(
1915
1946
  "input",
1916
1947
  {
@@ -1944,7 +1975,7 @@ function pr({
1944
1975
  transition_id: P,
1945
1976
  comment: K.trim() || void 0
1946
1977
  }),
1947
- children: j.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(xe, { children: [
1978
+ children: j.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(ye, { children: [
1948
1979
  /* @__PURE__ */ n("span", { children: k.length > 0 && ie ? `${ie.label} anyway` : "Confirm" }),
1949
1980
  /* @__PURE__ */ n(We, { className: "h-3 w-3" })
1950
1981
  ] })
@@ -1952,7 +1983,7 @@ function pr({
1952
1983
  )
1953
1984
  ] })
1954
1985
  ] });
1955
- return /* @__PURE__ */ i(xe, { children: [
1986
+ return /* @__PURE__ */ i(ye, { children: [
1956
1987
  /* @__PURE__ */ i(
1957
1988
  "div",
1958
1989
  {
@@ -1972,7 +2003,7 @@ function pr({
1972
2003
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
1973
2004
  _ && /* @__PURE__ */ n("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
1974
2005
  Ce && /* @__PURE__ */ n(Ne, { label: Ce.label, color: Ce.color }),
1975
- /* @__PURE__ */ n(ln, { flags: d == null ? void 0 : d.flags }),
2006
+ /* @__PURE__ */ n(on, { flags: d == null ? void 0 : d.flags }),
1976
2007
  (((gt = d == null ? void 0 : d.auto_held) == null ? void 0 : gt.length) ?? 0) > 0 && /* @__PURE__ */ i(
1977
2008
  "span",
1978
2009
  {
@@ -1981,7 +2012,7 @@ function pr({
1981
2012
  `),
1982
2013
  "data-pipeline-auto-held-pill": !0,
1983
2014
  children: [
1984
- /* @__PURE__ */ n(kn, { className: "h-3 w-3 shrink-0" }),
2015
+ /* @__PURE__ */ n(Nn, { className: "h-3 w-3 shrink-0" }),
1985
2016
  "Needs a person"
1986
2017
  ]
1987
2018
  }
@@ -1997,7 +2028,7 @@ function pr({
1997
2028
  "data-pipeline-approving": !0,
1998
2029
  children: [
1999
2030
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
2000
- Rn(ee, "approving")
2031
+ Pn(ee, "approving")
2001
2032
  ]
2002
2033
  }
2003
2034
  )
@@ -2021,7 +2052,7 @@ function pr({
2021
2052
  }
2022
2053
  ),
2023
2054
  l && ((d == null ? void 0 : d.binding) || (d == null ? void 0 : d.instance)) && /* @__PURE__ */ n(
2024
- mr,
2055
+ pr,
2025
2056
  {
2026
2057
  collection: t,
2027
2058
  item: e,
@@ -2033,7 +2064,7 @@ function pr({
2033
2064
  /* @__PURE__ */ n(
2034
2065
  $e,
2035
2066
  {
2036
- className: ye(
2067
+ className: he(
2037
2068
  "h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
2038
2069
  w && "rotate-180"
2039
2070
  )
@@ -2044,9 +2075,9 @@ function pr({
2044
2075
  ),
2045
2076
  !w && P && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: bt }),
2046
2077
  !w && Ge && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ge }),
2047
- ht && !(O != null && O.completed_at) && /* @__PURE__ */ n(ir, { entry: ht }),
2078
+ ht && !(O != null && O.completed_at) && /* @__PURE__ */ n(lr, { entry: ht }),
2048
2079
  w && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2049
- /* @__PURE__ */ n(Xn, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
2080
+ /* @__PURE__ */ n(Yn, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
2050
2081
  f && /* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
2051
2082
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
2052
2083
  /* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
@@ -2066,20 +2097,20 @@ function pr({
2066
2097
  /* @__PURE__ */ n(ke, { className: "ml-2 h-3 w-24" })
2067
2098
  ] })
2068
2099
  ) : /* @__PURE__ */ n(
2069
- or,
2100
+ dr,
2070
2101
  {
2071
2102
  states: pe,
2072
2103
  allTransitions: (d == null ? void 0 : d.all_transitions) ?? [],
2073
- availableTransitions: ge ?? [],
2104
+ availableTransitions: xe ?? [],
2074
2105
  currentStateId: O.current_state,
2075
2106
  history: Se ?? [],
2076
- onPathIds: D,
2107
+ onPathIds: F,
2077
2108
  skippedStates: M
2078
2109
  }
2079
2110
  ),
2080
- (d == null ? void 0 : d.branches) && /* @__PURE__ */ n(Kn, { data: d.branches }),
2111
+ (d == null ? void 0 : d.branches) && /* @__PURE__ */ n(Qn, { data: d.branches }),
2081
2112
  /* @__PURE__ */ n(
2082
- lr,
2113
+ or,
2083
2114
  {
2084
2115
  history: Se ?? [],
2085
2116
  completedAt: O.completed_at
@@ -2087,9 +2118,9 @@ function pr({
2087
2118
  )
2088
2119
  ] }),
2089
2120
  /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2090
- !O.completed_at && /* @__PURE__ */ n(Hn, { collection: t, itemId: String(e) }),
2121
+ !O.completed_at && /* @__PURE__ */ n(Gn, { collection: t, itemId: String(e) }),
2091
2122
  /* @__PURE__ */ n(
2092
- ur,
2123
+ mr,
2093
2124
  {
2094
2125
  collection: t,
2095
2126
  item: e,
@@ -2120,7 +2151,7 @@ function pr({
2120
2151
  /* @__PURE__ */ n(
2121
2152
  $e,
2122
2153
  {
2123
- className: ye(
2154
+ className: he(
2124
2155
  "h-3.5 w-3.5 transition-transform duration-200",
2125
2156
  h && "rotate-180"
2126
2157
  )
@@ -2136,10 +2167,10 @@ function pr({
2136
2167
  ]
2137
2168
  }
2138
2169
  ),
2139
- h && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(dr, { history: Se ?? [] }) })
2170
+ h && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(cr, { history: Se ?? [] }) })
2140
2171
  ] }),
2141
- A && (pe ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: H, children: /* @__PURE__ */ n(
2142
- zn,
2172
+ D && (pe ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: H, children: /* @__PURE__ */ n(
2173
+ Hn,
2143
2174
  {
2144
2175
  collection: t,
2145
2176
  item: e,
@@ -2174,8 +2205,8 @@ function pr({
2174
2205
  ]
2175
2206
  }
2176
2207
  ),
2177
- o && /* @__PURE__ */ n(Et, { fallback: null, children: /* @__PURE__ */ n(
2178
- Ht,
2208
+ o && /* @__PURE__ */ n(Lt, { fallback: null, children: /* @__PURE__ */ n(
2209
+ Gt,
2179
2210
  {
2180
2211
  payload: o.payload,
2181
2212
  transitionId: o.transitionId,
@@ -2197,14 +2228,14 @@ function pr({
2197
2228
  ) })
2198
2229
  ] });
2199
2230
  }
2200
- function Gr({
2231
+ function Vr({
2201
2232
  collection: t,
2202
2233
  item: e,
2203
2234
  onBeforeTransition: r,
2204
2235
  wrap: s = !0
2205
2236
  }) {
2206
2237
  return e === "new" ? null : /* @__PURE__ */ n(
2207
- fr,
2238
+ hr,
2208
2239
  {
2209
2240
  collection: t,
2210
2241
  item: e,
@@ -2213,16 +2244,16 @@ function Gr({
2213
2244
  }
2214
2245
  );
2215
2246
  }
2216
- function fr({
2247
+ function hr({
2217
2248
  collection: t,
2218
2249
  item: e,
2219
2250
  onBeforeTransition: r,
2220
2251
  wrap: s = !0
2221
2252
  }) {
2222
- const l = we(), c = De(), [p, b] = I(""), [f, _] = I(null), [v, y] = I(null), [$, A] = I(null), [E, B] = I([]), H = rn(t, String(e));
2223
- It(t, e, "transition", !!f || !!v);
2224
- const K = ne(null), T = En(K, !s), P = ne(!1), L = (a) => {
2225
- P.current || (P.current = !0, A(null), k.mutate(a, {
2253
+ const l = we(), c = Fe(), [p, b] = I(""), [f, _] = I(null), [v, y] = I(null), [$, D] = I(null), [E, B] = I([]), H = an(t, String(e));
2254
+ Kt(t, e, "transition", !!f || !!v);
2255
+ const K = ne(null), T = Ln(K, !s), P = ne(!1), L = (a) => {
2256
+ P.current || (P.current = !0, D(null), k.mutate(a, {
2226
2257
  onSettled: (m, N) => {
2227
2258
  if (N) {
2228
2259
  P.current = !1;
@@ -2250,7 +2281,7 @@ function fr({
2250
2281
  }
2251
2282
  if (!j) return;
2252
2283
  }
2253
- const m = (ee ?? []).find((j) => j.id === a), N = String((m == null ? void 0 : m.comment_mode) ?? "none"), D = sn(m, (o == null ? void 0 : o.states) ?? [], (M = o == null ? void 0 : o.instance) == null ? void 0 : M.current_state);
2284
+ const m = (ee ?? []).find((j) => j.id === a), N = String((m == null ? void 0 : m.comment_mode) ?? "none"), F = ln(m, (o == null ? void 0 : o.states) ?? [], (M = o == null ? void 0 : o.instance) == null ? void 0 : M.current_state);
2254
2285
  if (N !== "optional" && N !== "required") {
2255
2286
  if (m && !Oe(m, (o == null ? void 0 : o.states) ?? [], (R = o == null ? void 0 : o.instance) == null ? void 0 : R.current_state)) {
2256
2287
  P.current = !0;
@@ -2260,12 +2291,12 @@ function fr({
2260
2291
  } finally {
2261
2292
  P.current = !1;
2262
2293
  }
2263
- if (j.length > 0 || D) {
2294
+ if (j.length > 0 || F) {
2264
2295
  B(j), _(a);
2265
2296
  return;
2266
2297
  }
2267
2298
  }
2268
- if (D) {
2299
+ if (F) {
2269
2300
  B([]), _(a);
2270
2301
  return;
2271
2302
  }
@@ -2273,7 +2304,7 @@ function fr({
2273
2304
  return;
2274
2305
  }
2275
2306
  B([]), _(a);
2276
- }, x = ["pipeline-instance", t, e], { settling: w, settle: q } = Zt(x), { data: o } = oe({
2307
+ }, x = ["pipeline-instance", t, e], { settling: w, settle: q } = en(x), { data: o } = oe({
2277
2308
  queryKey: x,
2278
2309
  queryFn: () => l.request(
2279
2310
  ce(`/pipelines/instance/${t}/${e}`)
@@ -2288,7 +2319,7 @@ function fr({
2288
2319
  }
2289
2320
  ),
2290
2321
  staleTime: 1e4
2291
- }), Q = en(
2322
+ }), Q = tn(
2292
2323
  o ? (o.available_transitions ?? []).map((a) => String(a.id)) : null,
2293
2324
  `${t}:${e}`
2294
2325
  ), { data: X } = oe({
@@ -2297,7 +2328,7 @@ function fr({
2297
2328
  ce(`/pipelines/instance/${t}/${e}/owners/all`)
2298
2329
  ).then((a) => a.data ?? null),
2299
2330
  // Also while a move is being confirmed: the panel names where it really lands.
2300
- enabled: dn(o) || !!f,
2331
+ enabled: cn(o) || !!f,
2301
2332
  staleTime: 3e4
2302
2333
  }), g = Ie(() => {
2303
2334
  if (!X) return null;
@@ -2310,19 +2341,19 @@ function fr({
2310
2341
  transition_id: a,
2311
2342
  comment: m,
2312
2343
  reviewed: N,
2313
- lock_ack: D
2344
+ lock_ack: F
2314
2345
  }) => l.request(
2315
2346
  Te(`/pipelines/instance/${t}/${e}/transition`, {
2316
2347
  transition_id: a,
2317
2348
  comment: m,
2318
2349
  ...N ? { reviewed: !0 } : {},
2319
- ...D ? { lock_ack: !0 } : {}
2350
+ ...F ? { lock_ack: !0 } : {}
2320
2351
  })
2321
2352
  ),
2322
2353
  onMutate: (a) => {
2323
2354
  var m;
2324
2355
  return {
2325
- slow: mn(
2356
+ slow: pn(
2326
2357
  (m = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2327
2358
  (N) => N.id === a.transition_id
2328
2359
  )) == null ? void 0 : m.label
@@ -2330,21 +2361,21 @@ function fr({
2330
2361
  };
2331
2362
  },
2332
2363
  onSuccess: (a, m, N) => {
2333
- c.invalidateQueries({ queryKey: x }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Qe(c, t, String(e)), Ae(c, t, String(e)), pn(c, t, String(e)), A(null), b(""), _(null), y(null), Y.success(un(o, m.transition_id, a), N == null ? void 0 : N.slow.done());
2364
+ c.invalidateQueries({ queryKey: x }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Qe(c, t, String(e)), De(c, t, String(e)), fn(c, t, String(e)), D(null), b(""), _(null), y(null), Y.success(mn(o, m.transition_id, a), N == null ? void 0 : N.slow.done());
2334
2365
  },
2335
2366
  onError: (a, m, N) => {
2336
2367
  var j;
2337
- if (N == null || N.slow.fail(), Gt(a)) {
2368
+ if (N == null || N.slow.fail(), Vt(a)) {
2338
2369
  c.invalidateQueries({ queryKey: x });
2339
2370
  return;
2340
2371
  }
2341
- const D = Yt(a);
2342
- if (D) {
2372
+ const F = Jt(a);
2373
+ if (F) {
2343
2374
  _(null);
2344
2375
  const ue = ((j = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2345
2376
  (U) => U.id === m.transition_id
2346
2377
  )) == null ? void 0 : j.label) ?? "Move";
2347
- Y.warning(D.message, {
2378
+ Y.warning(F.message, {
2348
2379
  id: `nvr-locked-move:${t}:${String(e)}`,
2349
2380
  duration: 2e4,
2350
2381
  action: {
@@ -2356,7 +2387,7 @@ function fr({
2356
2387
  });
2357
2388
  return;
2358
2389
  }
2359
- const M = Vt(a);
2390
+ const M = Xt(a);
2360
2391
  if (M) {
2361
2392
  y((ue) => ({
2362
2393
  payload: M,
@@ -2367,21 +2398,21 @@ function fr({
2367
2398
  return;
2368
2399
  }
2369
2400
  const R = a == null ? void 0 : a.response;
2370
- A(Jt(a, m)), Y.error(Fe(a, "Failed to execute transition"), {
2401
+ D(Zt(a, m)), Y.error(Ae(a, "Failed to execute transition"), {
2371
2402
  duration: 12e3,
2372
2403
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
2373
- ...jt(a, { action: "Transition" }),
2404
+ ...It(a, { action: "Transition" }),
2374
2405
  // #1867: a refusal carries "Why?" — the role, owner or access rule
2375
2406
  // that stopped it, and who can change it.
2376
- ...Wt(a) ? {
2377
- action: zt(l, {
2407
+ ...zt(a) ? {
2408
+ action: Ht(l, {
2378
2409
  collection: t,
2379
2410
  itemId: String(e),
2380
2411
  action: "transition",
2381
2412
  transitionId: m.transition_id
2382
2413
  })
2383
2414
  } : {}
2384
- }), y(null), _(null), Qe(c, t, String(e)), Ae(c, t, String(e)), (R == null ? void 0 : R.status) === 409 && c.invalidateQueries({ queryKey: x });
2415
+ }), y(null), _(null), Qe(c, t, String(e)), De(c, t, String(e)), (R == null ? void 0 : R.status) === 409 && c.invalidateQueries({ queryKey: x });
2385
2416
  }
2386
2417
  }), G = ne(h);
2387
2418
  G.current = h;
@@ -2391,7 +2422,7 @@ function fr({
2391
2422
  const N = m.detail;
2392
2423
  if (!N || N.claimed || N.collection !== t || String(N.item) !== String(e)) return;
2393
2424
  N.claimed = !0;
2394
- const D = String(N.transition_id).toUpperCase(), M = se.current.find((R) => String(R.id).toUpperCase() === D);
2425
+ const F = String(N.transition_id).toUpperCase(), M = se.current.find((R) => String(R.id).toUpperCase() === F);
2395
2426
  if (!M) {
2396
2427
  Y.error("That step is not available from where the record is now");
2397
2428
  return;
@@ -2400,7 +2431,7 @@ function fr({
2400
2431
  };
2401
2432
  return window.addEventListener(Ke, a), () => window.removeEventListener(Ke, a);
2402
2433
  }, [t, e]), !(o != null && o.binding) || !(o != null && o.instance)) return null;
2403
- const ee = cn(
2434
+ const ee = un(
2404
2435
  (o.available_transitions ?? []).filter(
2405
2436
  (a) => !o.instance.completed_at || a.from_state && String(a.from_state).toUpperCase() === String(o.instance.current_state).toUpperCase()
2406
2437
  ),
@@ -2409,21 +2440,21 @@ function fr({
2409
2440
  o.instance.completed_at ? null : g
2410
2441
  );
2411
2442
  if (ee.length === 0) return null;
2412
- const re = new Map((o.states ?? []).map((a) => [a.id, a])), z = o.instance.current_state_obj ?? null, C = f ? ee.find((a) => a.id === f) : null, de = C ? re.get(C.to_state) : null, J = hn(C, z, o.states ?? [], X), he = (J == null ? void 0 : J.state) ?? de, be = /* @__PURE__ */ new Map();
2443
+ const re = new Map((o.states ?? []).map((a) => [a.id, a])), z = o.instance.current_state_obj ?? null, C = f ? ee.find((a) => a.id === f) : null, de = C ? re.get(C.to_state) : null, J = bn(C, z, o.states ?? [], X), be = (J == null ? void 0 : J.state) ?? de, ge = /* @__PURE__ */ new Map();
2413
2444
  for (const a of ee) {
2414
- const m = be.get(a.label) ?? [];
2415
- m.push(a), be.set(a.label, m);
2445
+ const m = ge.get(a.label) ?? [];
2446
+ m.push(a), ge.set(a.label, m);
2416
2447
  }
2417
2448
  const d = (a) => [...a].sort(
2418
2449
  (m, N) => {
2419
- var D, M;
2420
- return (((D = re.get(m.to_state)) == null ? void 0 : D.sort) ?? 999) - (((M = re.get(N.to_state)) == null ? void 0 : M.sort) ?? 999);
2450
+ var F, M;
2451
+ return (((F = re.get(m.to_state)) == null ? void 0 : F.sort) ?? 999) - (((M = re.get(N.to_state)) == null ? void 0 : M.sort) ?? 999);
2421
2452
  }
2422
2453
  ), _e = (() => {
2423
- var N, D, M;
2454
+ var N, F, M;
2424
2455
  const a = (N = K.current) == null ? void 0 : N.getBoundingClientRect();
2425
2456
  if (!a) return 600;
2426
- const m = (M = (D = K.current) == null ? void 0 : D.closest('[role="dialog"]')) == null ? void 0 : M.getBoundingClientRect();
2457
+ const m = (M = (F = K.current) == null ? void 0 : F.closest('[role="dialog"]')) == null ? void 0 : M.getBoundingClientRect();
2427
2458
  return Math.max(260, Math.min(600, a.right - ((m == null ? void 0 : m.left) ?? 0) - 12));
2428
2459
  })();
2429
2460
  return /* @__PURE__ */ i("div", { ref: K, className: "relative", children: [
@@ -2443,9 +2474,9 @@ function fr({
2443
2474
  ]
2444
2475
  }
2445
2476
  ) }),
2446
- /* @__PURE__ */ n(tt, { align: "end", className: "min-w-[200px]", children: Array.from(be.entries()).map(
2447
- ([a, m], N, D) => m.length === 1 ? /* @__PURE__ */ i(St, { children: [
2448
- N > 0 && D[N - 1][1].length > 1 && /* @__PURE__ */ n(Ct, {}),
2477
+ /* @__PURE__ */ n(tt, { align: "end", className: "min-w-[200px]", children: Array.from(ge.entries()).map(
2478
+ ([a, m], N, F) => m.length === 1 ? /* @__PURE__ */ i(St, { children: [
2479
+ N > 0 && F[N - 1][1].length > 1 && /* @__PURE__ */ n(Ct, {}),
2449
2480
  /* @__PURE__ */ i(Be, { onSelect: () => h(m[0].id), children: [
2450
2481
  m[0].color && /* @__PURE__ */ n(
2451
2482
  "span",
@@ -2458,7 +2489,7 @@ function fr({
2458
2489
  ] })
2459
2490
  ] }, a) : /* @__PURE__ */ i(St, { children: [
2460
2491
  N > 0 && /* @__PURE__ */ n(Ct, {}),
2461
- /* @__PURE__ */ n(jn, { className: "text-[11px] text-muted-foreground", children: a }),
2492
+ /* @__PURE__ */ n(In, { className: "text-[11px] text-muted-foreground", children: a }),
2462
2493
  d(m).map((M) => {
2463
2494
  var R;
2464
2495
  return /* @__PURE__ */ i(Be, { onSelect: () => h(M.id), children: [
@@ -2479,15 +2510,15 @@ function fr({
2479
2510
  {
2480
2511
  className: s ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
2481
2512
  children: [
2482
- /* @__PURE__ */ n(ln, { flags: o == null ? void 0 : o.flags }),
2483
- Array.from(be.entries()).map(([a, m]) => {
2513
+ /* @__PURE__ */ n(on, { flags: o == null ? void 0 : o.flags, variant: "inline" }),
2514
+ Array.from(ge.entries()).map(([a, m]) => {
2484
2515
  var j, ue;
2485
2516
  const N = m.some((U) => {
2486
2517
  var O;
2487
2518
  return (((O = U.order_partners) == null ? void 0 : O.length) ?? 0) > 0;
2488
- }), D = N ? null : ((j = m[0]) == null ? void 0 : j.color) ?? null, M = m.some((U) => U.id === f), R = (U) => D ? U ? { backgroundColor: D, borderColor: D } : { borderColor: D, color: D } : void 0;
2519
+ }), F = N ? null : ((j = m[0]) == null ? void 0 : j.color) ?? null, M = m.some((U) => U.id === f), R = (U) => F ? U ? { backgroundColor: F, borderColor: F } : { borderColor: F, color: F } : void 0;
2489
2520
  if (m.length === 1) {
2490
- const U = m[0], O = k.isPending && ((ue = k.variables) == null ? void 0 : ue.transition_id) === U.id, ge = /* @__PURE__ */ i(
2521
+ const U = m[0], O = k.isPending && ((ue = k.variables) == null ? void 0 : ue.transition_id) === U.id, xe = /* @__PURE__ */ i(
2491
2522
  ae,
2492
2523
  {
2493
2524
  size: "sm",
@@ -2502,16 +2533,16 @@ function fr({
2502
2533
  Q.press(U.id) && h(U.id);
2503
2534
  },
2504
2535
  children: [
2505
- O ? /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }) : N && /* @__PURE__ */ n(Ft, { className: "h-3 w-3", "aria-hidden": !0 }),
2536
+ O ? /* @__PURE__ */ n(me, { className: "h-3 w-3 animate-spin" }) : N && /* @__PURE__ */ n(Dt, { className: "h-3 w-3", "aria-hidden": !0 }),
2506
2537
  a
2507
2538
  ]
2508
2539
  },
2509
2540
  a
2510
2541
  );
2511
2542
  return U.pushes && U.pushes > 0 ? /* @__PURE__ */ i("span", { className: "relative inline-flex", children: [
2512
- ge,
2543
+ xe,
2513
2544
  /* @__PURE__ */ n(
2514
- Un,
2545
+ En,
2515
2546
  {
2516
2547
  collection: t,
2517
2548
  itemId: e,
@@ -2520,7 +2551,7 @@ function fr({
2520
2551
  compact: !0
2521
2552
  }
2522
2553
  )
2523
- ] }, a) : ge;
2554
+ ] }, a) : xe;
2524
2555
  }
2525
2556
  return /* @__PURE__ */ i(Ze, { children: [
2526
2557
  /* @__PURE__ */ n(et, { asChild: !0, children: /* @__PURE__ */ i(
@@ -2564,16 +2595,16 @@ function fr({
2564
2595
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
2565
2596
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
2566
2597
  C && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: C.label }),
2567
- z && he && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2598
+ z && be && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2568
2599
  /* @__PURE__ */ n(Ne, { label: z.label, color: z.color, small: !0 }),
2569
2600
  /* @__PURE__ */ n(lt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2570
- /* @__PURE__ */ n(Ne, { label: he.label, color: he.color, small: !0 })
2601
+ /* @__PURE__ */ n(Ne, { label: be.label, color: be.color, small: !0 })
2571
2602
  ] })
2572
2603
  ] }),
2573
- /* @__PURE__ */ n(bn, { landing: J }),
2574
- /* @__PURE__ */ n(on, { collection: t, item: String(e), tx: C }),
2575
- /* @__PURE__ */ n(gn, { collection: t, item: e, omitLines: E }),
2576
- /* @__PURE__ */ n(an, { lines: E }),
2604
+ /* @__PURE__ */ n(gn, { landing: J }),
2605
+ /* @__PURE__ */ n(dn, { collection: t, item: String(e), tx: C }),
2606
+ /* @__PURE__ */ n(xn, { collection: t, item: e, omitLines: E }),
2607
+ /* @__PURE__ */ n(sn, { lines: E }),
2577
2608
  /* @__PURE__ */ n(
2578
2609
  "input",
2579
2610
  {
@@ -2607,7 +2638,7 @@ function fr({
2607
2638
  transition_id: f,
2608
2639
  comment: p.trim() || void 0
2609
2640
  }),
2610
- children: k.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(xe, { children: [
2641
+ children: k.isPending ? /* @__PURE__ */ n(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(ye, { children: [
2611
2642
  /* @__PURE__ */ n("span", { children: E.length > 0 && C ? `${C.label} anyway` : "Confirm" }),
2612
2643
  /* @__PURE__ */ n(We, { className: "h-3 w-3" })
2613
2644
  ] })
@@ -2618,19 +2649,19 @@ function fr({
2618
2649
  }
2619
2650
  ),
2620
2651
  $ && !f && /* @__PURE__ */ n(
2621
- fn,
2652
+ hn,
2622
2653
  {
2623
2654
  collection: t,
2624
2655
  item: String(e),
2625
2656
  offer: $,
2626
2657
  className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
2627
2658
  style: { width: _e },
2628
- onDismiss: () => A(null),
2659
+ onDismiss: () => D(null),
2629
2660
  onFixed: () => L({ transition_id: $.transitionId, comment: $.comment })
2630
2661
  }
2631
2662
  ),
2632
- v && /* @__PURE__ */ n(Et, { fallback: null, children: /* @__PURE__ */ n(
2633
- Ht,
2663
+ v && /* @__PURE__ */ n(Lt, { fallback: null, children: /* @__PURE__ */ n(
2664
+ Gt,
2634
2665
  {
2635
2666
  payload: v.payload,
2636
2667
  transitionId: v.transitionId,
@@ -2655,24 +2686,24 @@ function fr({
2655
2686
  export {
2656
2687
  Me as FRESH_BUTTON_MS,
2657
2688
  qt as FRESH_HOVER_MAX_MS,
2658
- Zn as FreshButtonGuard,
2659
- Hr as PipelinePanel,
2660
- Gr as PipelineTransitionButtons,
2661
- Yn as REFUSAL_FIX_ACTIONS,
2662
- ln as RecordFlagChips,
2663
- ar as SLOW_MOVE_MS,
2664
- sn as asksFirst,
2665
- tr as briefAgeText,
2666
- nr as briefDiffPair,
2689
+ er as FreshButtonGuard,
2690
+ Gr as PipelinePanel,
2691
+ Vr as PipelineTransitionButtons,
2692
+ Jn as REFUSAL_FIX_ACTIONS,
2693
+ on as RecordFlagChips,
2694
+ sr as SLOW_MOVE_MS,
2695
+ ln as asksFirst,
2696
+ nr as briefAgeText,
2697
+ rr as briefDiffPair,
2667
2698
  Mt as briefLineKey,
2668
- er as briefWarnings,
2669
- Gt as isDuplicateTransition,
2670
- sr as latestSendBack,
2671
- Yt as lockedMoveOffer,
2672
- Xt as refusalCode,
2673
- Jt as refusalFixFor,
2674
- mn as slowMoveToast,
2675
- Vt as transitionRequirementsFromError,
2676
- un as transitionToastText,
2677
- cn as withoutSkippedSendBacks
2699
+ tr as briefWarnings,
2700
+ Vt as isDuplicateTransition,
2701
+ ir as latestSendBack,
2702
+ Jt as lockedMoveOffer,
2703
+ Yt as refusalCode,
2704
+ Zt as refusalFixFor,
2705
+ pn as slowMoveToast,
2706
+ Xt as transitionRequirementsFromError,
2707
+ mn as transitionToastText,
2708
+ un as withoutSkippedSendBacks
2678
2709
  };