@nivaro/react 0.3.61 → 0.3.63

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,43 +1,44 @@
1
1
  import { jsxs as t, jsx as e, Fragment as _e } from "react/jsx-runtime";
2
- import { useSensors as Kt, useSensor as Ye, PointerSensor as zt, KeyboardSensor as Bt, DndContext as Qe, closestCenter as We } from "@dnd-kit/core";
3
- import { sortableKeyboardCoordinates as Qt, SortableContext as Ue, verticalListSortingStrategy as He, arrayMove as Ve, useSortable as ct } from "@dnd-kit/sortable";
4
- import { CSS as dt } from "@dnd-kit/utilities";
5
- import { useMutation as M, useQueryClient as ke, useQuery as H } from "@tanstack/react-query";
6
- import { X as ve, ArrowLeft as ma, Check as Ne, Pencil as Te, Download as pa, Plus as ye, Trash2 as Se, ArrowRight as Wt, Zap as ua, PlugZap as ha, Filter as mt, Link2 as Ft, LayoutGrid as xa, Link2Off as fa, ListChecks as Ut, Loader2 as we, GripVertical as pt, Settings as ga, GitFork as ba, ChevronDown as Oe, Search as ut, History as ya, ChevronRight as ht, ExternalLink as va } from "lucide-react";
7
- import { useState as $, useEffect as xe, useContext as Na, useRef as Je, useMemo as wa, createContext as ka } from "react";
8
- import { createPortal as _a } from "react-dom";
9
- import { toast as T } from "sonner";
10
- import { useNivaroClient as Z, useNavigation as Ca } from "../../context.js";
2
+ import { useSensors as Bt, useSensor as Ie, PointerSensor as Qt, KeyboardSensor as Ut, DndContext as We, closestCenter as He } from "@dnd-kit/core";
3
+ import { sortableKeyboardCoordinates as Wt, SortableContext as Ve, verticalListSortingStrategy as Ye, arrayMove as Ge, useSortable as mt } from "@dnd-kit/sortable";
4
+ import { CSS as pt } from "@dnd-kit/utilities";
5
+ import { useMutation as j, useQueryClient as ke, useQuery as H } from "@tanstack/react-query";
6
+ import { X as ve, ArrowLeft as ua, Check as Ne, Pencil as Pe, Download as ha, Plus as ye, Trash2 as Se, ArrowRight as Ht, Zap as xa, PlugZap as fa, Filter as ut, Link2 as Ot, LayoutGrid as ga, Link2Off as ba, ListChecks as Vt, Loader2 as we, GripVertical as ht, Settings as ya, GitFork as va, ChevronDown as Oe, Search as xt, History as Na, ChevronRight as ft, ExternalLink as wa } from "lucide-react";
7
+ import { useState as $, useEffect as xe, useContext as ka, useRef as Ze, useMemo as _a, createContext as Ca } from "react";
8
+ import { createPortal as Sa } from "react-dom";
9
+ import { toast as P } from "sonner";
10
+ import { useNivaroClient as Z, useNavigation as qa } from "../../context.js";
11
11
  import { post as I, get as V, patch as be, del as $e } from "../../lib/commands.js";
12
- import { describeTransition as Sa, sentenceLabelsFromFields as qa } from "../../lib/config-sentences.js";
13
- import { toastError as Et } from "../../lib/error-toast.js";
14
- import { cn as J, formatRelative as $a, titleCase as Fa } from "../../lib/utils.js";
15
- import { ExplainCard as Ea } from "../ai/ExplainButton.js";
16
- import { ConfigHistoryButton as Oa } from "../ConfigHistory.js";
17
- import { ConfigReadBack as Ra } from "../ConfigReadBack.js";
18
- import { PipelineCumulativeFlowCard as Pa } from "../charts/CumulativeFlowChart.js";
19
- import { useCollectionBody as Ta } from "../layout-editor/collection-meta.js";
20
- import { QueryErrorState as Aa } from "../QueryErrorState.js";
21
- import { Term as Ot } from "../Term.js";
12
+ import { describeTransition as $a, sentenceLabelsFromFields as Fa } from "../../lib/config-sentences.js";
13
+ import { toastError as Rt } from "../../lib/error-toast.js";
14
+ import { cn as J, formatRelative as Ea, titleCase as Oa } from "../../lib/utils.js";
15
+ import { ExplainCard as Ra } from "../ai/ExplainButton.js";
16
+ import { ConfigHistoryButton as Ta } from "../ConfigHistory.js";
17
+ import { ConfigReadBack as Pa } from "../ConfigReadBack.js";
18
+ import { PipelineCumulativeFlowCard as Da } from "../charts/CumulativeFlowChart.js";
19
+ import { useCollectionBody as Aa } from "../layout-editor/collection-meta.js";
20
+ import { ConfirmButton as De } from "../profile/primitives.js";
21
+ import { QueryErrorState as La } from "../QueryErrorState.js";
22
+ import { Term as Tt } from "../Term.js";
22
23
  import { Badge as Ce } from "../ui/badge.js";
23
- import { Button as P } from "../ui/button.js";
24
- import { Input as U } from "../ui/input.js";
24
+ import { Button as T } from "../ui/button.js";
25
+ import { Input as W } from "../ui/input.js";
25
26
  import { Label as Y } from "../ui/label.js";
26
- import { Popover as De, PopoverTrigger as Le, PopoverContent as je } from "../ui/popover.js";
27
- import { Select as Da, SelectTrigger as La, SelectValue as ja, SelectContent as Ma, SelectItem as Ka } from "../ui/select.js";
27
+ import { Popover as je, PopoverTrigger as Me, PopoverContent as Ke } from "../ui/popover.js";
28
+ import { Select as ja, SelectTrigger as Ma, SelectValue as Ka, SelectContent as za, SelectItem as Ba } from "../ui/select.js";
28
29
  import { Skeleton as Ae } from "../ui/skeleton.js";
29
30
  import { Switch as Ee } from "../ui/switch.js";
30
- import { Textarea as Ht } from "../ui/textarea.js";
31
- import { FieldPicker as ot } from "./FieldPicker.js";
32
- import { OwnerMatrix as za } from "./OwnerMatrix.js";
33
- import { OwnerMatrixVersionsCard as Ba } from "./OwnerMatrixVersionsCard.js";
34
- import { TemplateLintCard as Qa, SkipReportCard as Wa } from "./PipelineHealthCards.js";
35
- import { PipelineSkipCriteria as Ua } from "./PipelineSkipCriteria.js";
36
- import { PipelineStateOwners as Ha } from "./PipelineStateOwners.js";
37
- import { findM2ORelation as Va, extractTemplateFields as Ya, renderDisplayTemplate as lt } from "./relations.js";
38
- import { TeamsView as Ga } from "./TeamsView.js";
39
- import { useScopeDimensions as Ia, rankTeamForFilters as Ja, tierOrder as Rt } from "./teamScopes.js";
40
- const Vt = "rgb(var(--nvr-cyan-rgb, 0 206 255))";
31
+ import { Textarea as Yt } from "../ui/textarea.js";
32
+ import { FieldPicker as dt } from "./FieldPicker.js";
33
+ import { OwnerMatrix as Qa } from "./OwnerMatrix.js";
34
+ import { OwnerMatrixVersionsCard as Ua } from "./OwnerMatrixVersionsCard.js";
35
+ import { TemplateLintCard as Wa, SkipReportCard as Ha } from "./PipelineHealthCards.js";
36
+ import { PipelineSkipCriteria as Va } from "./PipelineSkipCriteria.js";
37
+ import { PipelineStateOwners as Ya } from "./PipelineStateOwners.js";
38
+ import { findM2ORelation as Ga, extractTemplateFields as Ia, renderDisplayTemplate as it } from "./relations.js";
39
+ import { TeamsView as Ja } from "./TeamsView.js";
40
+ import { useScopeDimensions as Xa, rankTeamForFilters as Za, tierOrder as Pt } from "./teamScopes.js";
41
+ const Gt = "rgb(var(--nvr-cyan-rgb, 0 206 255))", Le = "rounded bg-red-50 px-1.5 text-[11px] font-semibold text-red-700 hover:text-red-700 dark:bg-red-500/10 dark:text-red-400";
41
42
  function pe({
42
43
  value: a,
43
44
  onChange: n,
@@ -47,7 +48,7 @@ function pe({
47
48
  className: x
48
49
  }) {
49
50
  var m;
50
- const [o, r] = $(!1), [h, v] = $(""), u = Je(null);
51
+ const [o, r] = $(!1), [h, v] = $(""), u = Ze(null);
51
52
  xe(() => {
52
53
  o ? setTimeout(() => {
53
54
  var f;
@@ -55,9 +56,9 @@ function pe({
55
56
  }, 50) : v("");
56
57
  }, [o]);
57
58
  const d = h.trim() ? c.filter((f) => f.label.toLowerCase().includes(h.toLowerCase())) : c, N = a ? ((m = c.find((f) => f.value === a)) == null ? void 0 : m.label) ?? a : null;
58
- return /* @__PURE__ */ t(De, { open: o, onOpenChange: r, children: [
59
+ return /* @__PURE__ */ t(je, { open: o, onOpenChange: r, children: [
59
60
  /* @__PURE__ */ t("div", { className: J("relative flex h-8 w-full", x), children: [
60
- /* @__PURE__ */ e(Le, { asChild: !0, children: /* @__PURE__ */ t(
61
+ /* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ t(
61
62
  "button",
62
63
  {
63
64
  type: "button",
@@ -80,9 +81,9 @@ function pe({
80
81
  }
81
82
  )
82
83
  ] }),
83
- /* @__PURE__ */ t(je, { align: "start", className: "w-56 p-0", sideOffset: 4, children: [
84
+ /* @__PURE__ */ t(Ke, { align: "start", className: "w-56 p-0", sideOffset: 4, children: [
84
85
  /* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "relative", children: [
85
- /* @__PURE__ */ e(ut, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
86
+ /* @__PURE__ */ e(xt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
86
87
  /* @__PURE__ */ e(
87
88
  "input",
88
89
  {
@@ -134,14 +135,14 @@ function pe({
134
135
  ] })
135
136
  ] });
136
137
  }
137
- function Xa({
138
+ function es({
138
139
  values: a,
139
140
  onChange: n,
140
141
  options: c,
141
142
  placeholder: g = "Select states…"
142
143
  }) {
143
144
  var N;
144
- const [l, x] = $(!1), [o, r] = $(""), h = Je(null);
145
+ const [l, x] = $(!1), [o, r] = $(""), h = Ze(null);
145
146
  xe(() => {
146
147
  l ? setTimeout(() => {
147
148
  var m;
@@ -153,9 +154,9 @@ function Xa({
153
154
  n(a.includes(m) ? a.filter((f) => f !== m) : [...a, m]);
154
155
  }
155
156
  const d = a.length === 0 ? null : a.length === 1 ? ((N = c.find((m) => m.value === a[0])) == null ? void 0 : N.label) ?? a[0] : `${a.length} states`;
156
- return /* @__PURE__ */ t(De, { open: l, onOpenChange: x, children: [
157
+ return /* @__PURE__ */ t(je, { open: l, onOpenChange: x, children: [
157
158
  /* @__PURE__ */ t("div", { className: "relative flex h-8 w-full", children: [
158
- /* @__PURE__ */ e(Le, { asChild: !0, children: /* @__PURE__ */ t(
159
+ /* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ t(
159
160
  "button",
160
161
  {
161
162
  type: "button",
@@ -178,9 +179,9 @@ function Xa({
178
179
  }
179
180
  )
180
181
  ] }),
181
- /* @__PURE__ */ t(je, { align: "start", className: "w-56 p-0", sideOffset: 4, children: [
182
+ /* @__PURE__ */ t(Ke, { align: "start", className: "w-56 p-0", sideOffset: 4, children: [
182
183
  /* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "relative", children: [
183
- /* @__PURE__ */ e(ut, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
184
+ /* @__PURE__ */ e(xt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
184
185
  /* @__PURE__ */ e(
185
186
  "input",
186
187
  {
@@ -219,7 +220,7 @@ function Xa({
219
220
  ] })
220
221
  ] });
221
222
  }
222
- const Za = [
223
+ const ts = [
223
224
  "#6b7280",
224
225
  "#ef4444",
225
226
  "#f97316",
@@ -230,7 +231,7 @@ const Za = [
230
231
  "#8b5cf6",
231
232
  "#ec4899"
232
233
  ];
233
- function Ge({
234
+ function Je({
234
235
  value: a,
235
236
  onChange: n
236
237
  }) {
@@ -247,7 +248,7 @@ function Ge({
247
248
  title: "No color"
248
249
  }
249
250
  ),
250
- Za.map((c) => /* @__PURE__ */ e(
251
+ ts.map((c) => /* @__PURE__ */ e(
251
252
  "button",
252
253
  {
253
254
  type: "button",
@@ -263,7 +264,7 @@ function Ge({
263
264
  ))
264
265
  ] });
265
266
  }
266
- function Pt({ state: a, small: n }) {
267
+ function Dt({ state: a, small: n }) {
267
268
  return /* @__PURE__ */ t(
268
269
  "span",
269
270
  {
@@ -281,7 +282,7 @@ function Pt({ state: a, small: n }) {
281
282
  }
282
283
  );
283
284
  }
284
- function Tt({
285
+ function At({
285
286
  initial: a,
286
287
  onSave: n,
287
288
  onCancel: c,
@@ -305,7 +306,7 @@ function Tt({
305
306
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
306
307
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Label" }),
307
308
  /* @__PURE__ */ e(
308
- U,
309
+ W,
309
310
  {
310
311
  value: l.label,
311
312
  onChange: (r) => {
@@ -323,7 +324,7 @@ function Tt({
323
324
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
324
325
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Key" }),
325
326
  /* @__PURE__ */ e(
326
- U,
327
+ W,
327
328
  {
328
329
  value: l.key,
329
330
  onChange: (r) => o("key", r.target.value),
@@ -349,7 +350,7 @@ function Tt({
349
350
  ] }),
350
351
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
351
352
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Color" }),
352
- /* @__PURE__ */ e(Ge, { value: l.color, onChange: (r) => o("color", r) })
353
+ /* @__PURE__ */ e(Je, { value: l.color, onChange: (r) => o("color", r) })
353
354
  ] }),
354
355
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
355
356
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Help text" }),
@@ -455,9 +456,9 @@ function Tt({
455
456
  ] }, r.value)) })
456
457
  ] }),
457
458
  /* @__PURE__ */ t("div", { className: "flex gap-2 justify-end", children: [
458
- /* @__PURE__ */ e(P, { type: "button", variant: "outline", size: "sm", onClick: c, children: "Cancel" }),
459
+ /* @__PURE__ */ e(T, { type: "button", variant: "outline", size: "sm", onClick: c, children: "Cancel" }),
459
460
  /* @__PURE__ */ e(
460
- P,
461
+ T,
461
462
  {
462
463
  type: "button",
463
464
  size: "sm",
@@ -469,19 +470,19 @@ function Tt({
469
470
  ] })
470
471
  ] });
471
472
  }
472
- function At(a) {
473
+ function Lt(a) {
473
474
  return !a || a.length === 0 ? "" : [...a].sort(
474
475
  (n, c) => `${n.field}${n.op}${String(n.value)}`.localeCompare(`${c.field}${c.op}${String(c.value)}`)
475
476
  ).map((n) => `${n.field}:${n.op}:${String(n.value ?? "")}`).join("|");
476
477
  }
477
- function Dt(a) {
478
+ function jt(a) {
478
479
  const n = /* @__PURE__ */ new Map();
479
480
  for (const g of a) {
480
481
  n.has(g.label) || n.set(g.label, { label: g.label, color: g.color, routes: [], minSort: g.sort });
481
482
  const l = n.get(g.label);
482
483
  l.minSort = Math.min(l.minSort, g.sort);
483
- const x = At(g.condition_rules), o = l.routes.find(
484
- (r) => r.from_state === g.from_state && At(r.condition_rules) === x
484
+ const x = Lt(g.condition_rules), o = l.routes.find(
485
+ (r) => r.from_state === g.from_state && Lt(r.condition_rules) === x
485
486
  );
486
487
  o ? (o.ids.push(g.id), o.to_states.push(g.to_state), o.minSort = Math.min(o.minSort, g.sort)) : l.routes.push({
487
488
  ids: [g.id],
@@ -506,17 +507,17 @@ function Dt(a) {
506
507
  for (const g of c) g.routes.sort((l, x) => l.minSort - x.minSort);
507
508
  return c;
508
509
  }
509
- const Yt = ka(null);
510
- function Lt({ id: a, children: n }) {
511
- const { attributes: c, listeners: g, setNodeRef: l, transform: x, transition: o, isDragging: r } = ct({
510
+ const It = Ca(null);
511
+ function Mt({ id: a, children: n }) {
512
+ const { attributes: c, listeners: g, setNodeRef: l, transform: x, transition: o, isDragging: r } = mt({
512
513
  id: a
513
514
  });
514
- return /* @__PURE__ */ e(Yt.Provider, { value: { listeners: g, attributes: c }, children: /* @__PURE__ */ e(
515
+ return /* @__PURE__ */ e(It.Provider, { value: { listeners: g, attributes: c }, children: /* @__PURE__ */ e(
515
516
  "div",
516
517
  {
517
518
  ref: l,
518
519
  style: {
519
- transform: dt.Transform.toString(x),
520
+ transform: pt.Transform.toString(x),
520
521
  transition: o,
521
522
  opacity: r ? 0.4 : 1
522
523
  },
@@ -524,8 +525,8 @@ function Lt({ id: a, children: n }) {
524
525
  }
525
526
  ) });
526
527
  }
527
- function jt() {
528
- const a = Na(Yt);
528
+ function Kt() {
529
+ const a = ka(It);
529
530
  return /* @__PURE__ */ e(
530
531
  "button",
531
532
  {
@@ -534,19 +535,19 @@ function jt() {
534
535
  ...a == null ? void 0 : a.attributes,
535
536
  className: "cursor-grab touch-none text-slate-300 hover:text-slate-400 shrink-0",
536
537
  tabIndex: -1,
537
- children: /* @__PURE__ */ e(pt, { className: "h-3.5 w-3.5" })
538
+ children: /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" })
538
539
  }
539
540
  );
540
541
  }
541
- function es(a) {
542
+ function as(a) {
542
543
  return a ? Array.isArray(a) ? a.map(String).filter(Boolean) : typeof a == "string" && a.trim() ? [a] : [] : [];
543
544
  }
544
- function ts({
545
+ function ss({
545
546
  relatedCollection: a,
546
547
  value: n,
547
548
  onChange: c
548
549
  }) {
549
- const g = Z(), [l, x] = $(!1), [o, r] = $(""), h = Je(null);
550
+ const g = Z(), [l, x] = $(!1), [o, r] = $(""), h = Ze(null);
550
551
  xe(() => {
551
552
  l ? setTimeout(() => {
552
553
  var O;
@@ -559,7 +560,7 @@ function ts({
559
560
  staleTime: 6e4,
560
561
  enabled: !!a
561
562
  }), u = ((v == null ? void 0 : v.fields) ?? []).map((O) => O.field), d = (v == null ? void 0 : v.display_template) ?? null, N = ["name", "title", "label", "display_name", "subject", "email", "slug"], m = [
562
- .../* @__PURE__ */ new Set(["id", ...Ya(d), ...N])
563
+ .../* @__PURE__ */ new Set(["id", ...Ia(d), ...N])
563
564
  ], f = u.length ? m.filter((O) => O === "id" || u.includes(O)).join(",") : "id", { data: b, isLoading: p, isError: w } = H({
564
565
  queryKey: ["relation-picker-items", a, f],
565
566
  queryFn: () => g.request(
@@ -573,7 +574,7 @@ function ts({
573
574
  });
574
575
  if (w)
575
576
  return /* @__PURE__ */ e(
576
- U,
577
+ W,
577
578
  {
578
579
  type: "text",
579
580
  value: n.join(", "),
@@ -587,16 +588,16 @@ function ts({
587
588
  const k = b ?? [];
588
589
  function S(O) {
589
590
  const y = k.find((i) => String(i.id) === O);
590
- return y ? lt(d, y) : O;
591
+ return y ? it(d, y) : O;
591
592
  }
592
- function A(O) {
593
+ function D(O) {
593
594
  c(n.includes(O) ? n.filter((y) => y !== O) : [...n, O]);
594
595
  }
595
- const L = o ? k.filter(
596
- (O) => lt(d, O).toLowerCase().includes(o.toLowerCase())
596
+ const A = o ? k.filter(
597
+ (O) => it(d, O).toLowerCase().includes(o.toLowerCase())
597
598
  ) : k;
598
- return /* @__PURE__ */ t(De, { open: l, onOpenChange: x, children: [
599
- /* @__PURE__ */ e("div", { className: "relative w-full", children: /* @__PURE__ */ e(Le, { asChild: !0, children: /* @__PURE__ */ t(
599
+ return /* @__PURE__ */ t(je, { open: l, onOpenChange: x, children: [
600
+ /* @__PURE__ */ e("div", { className: "relative w-full", children: /* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ t(
600
601
  "button",
601
602
  {
602
603
  type: "button",
@@ -617,10 +618,10 @@ function ts({
617
618
  role: "button",
618
619
  tabIndex: 0,
619
620
  onClick: (y) => {
620
- y.stopPropagation(), A(O);
621
+ y.stopPropagation(), D(O);
621
622
  },
622
623
  onKeyDown: (y) => {
623
- (y.key === "Enter" || y.key === " ") && (y.stopPropagation(), A(O));
624
+ (y.key === "Enter" || y.key === " ") && (y.stopPropagation(), D(O));
624
625
  },
625
626
  className: "cursor-pointer text-nvr-navy/50 hover:text-red-500",
626
627
  children: "×"
@@ -634,9 +635,9 @@ function ts({
634
635
  ]
635
636
  }
636
637
  ) }) }),
637
- /* @__PURE__ */ t(je, { align: "start", className: "w-64 p-0", sideOffset: 4, children: [
638
+ /* @__PURE__ */ t(Ke, { align: "start", className: "w-64 p-0", sideOffset: 4, children: [
638
639
  /* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "relative", children: [
639
- /* @__PURE__ */ e(ut, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
640
+ /* @__PURE__ */ e(xt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
640
641
  /* @__PURE__ */ e(
641
642
  "input",
642
643
  {
@@ -651,13 +652,13 @@ function ts({
651
652
  /* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children: p ? /* @__PURE__ */ t("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
652
653
  /* @__PURE__ */ e(we, { className: "h-3.5 w-3.5 animate-spin" }),
653
654
  "Loading…"
654
- ] }) : L.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : L.map((O) => {
655
- const y = lt(d, O), i = String(O.id), _ = n.includes(i);
655
+ ] }) : A.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : A.map((O) => {
656
+ const y = it(d, O), i = String(O.id), _ = n.includes(i);
656
657
  return /* @__PURE__ */ t(
657
658
  "button",
658
659
  {
659
660
  type: "button",
660
- onClick: () => A(i),
661
+ onClick: () => D(i),
661
662
  className: `flex w-full items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-slate-50 ${_ ? "font-medium text-slate-800" : "text-slate-600"}`,
662
663
  children: [
663
664
  /* @__PURE__ */ e(
@@ -675,7 +676,7 @@ function ts({
675
676
  ] })
676
677
  ] });
677
678
  }
678
- const as = [
679
+ const ns = [
679
680
  { value: "eq", label: "equals" },
680
681
  { value: "neq", label: "not equals" },
681
682
  { value: "gt", label: "greater than" },
@@ -685,8 +686,8 @@ const as = [
685
686
  { value: "contains", label: "contains" },
686
687
  { value: "null", label: "is empty" },
687
688
  { value: "nnull", label: "is not empty" }
688
- ], ss = /* @__PURE__ */ new Set(["integer", "bigInteger", "float", "decimal", "number"]), ns = /* @__PURE__ */ new Set(["date", "dateTime", "datetime", "timestamp"]), ls = /* @__PURE__ */ new Set(["boolean"]);
689
- function rs({
689
+ ], ls = /* @__PURE__ */ new Set(["integer", "bigInteger", "float", "decimal", "number"]), rs = /* @__PURE__ */ new Set(["date", "dateTime", "datetime", "timestamp"]), is = /* @__PURE__ */ new Set(["boolean"]);
690
+ function os({
690
691
  rules: a,
691
692
  onChange: n,
692
693
  collection: c
@@ -704,7 +705,7 @@ function rs({
704
705
  if (!p.includes(".")) {
705
706
  const w = v.find((k) => k.field === p);
706
707
  if (w) {
707
- const k = Va(u, c ?? "", p);
708
+ const k = Ga(u, c ?? "", p);
708
709
  return { type: w.type, relatedCollection: (k == null ? void 0 : k.one_collection) ?? void 0 };
709
710
  }
710
711
  }
@@ -712,7 +713,7 @@ function rs({
712
713
  }
713
714
  const N = (p, w) => n(a.map((k, S) => S === p ? { ...k, ...w } : k)), m = (p) => n(a.filter((w, k) => k !== p));
714
715
  function f(p) {
715
- return p ? p.split(".").map(Fa).join(" → ") : "";
716
+ return p ? p.split(".").map(Oa).join(" → ") : "";
716
717
  }
717
718
  return /* @__PURE__ */ t("div", { className: "space-y-2 border-t border-slate-200 pt-3", children: [
718
719
  /* @__PURE__ */ t(
@@ -722,8 +723,8 @@ function rs({
722
723
  onClick: () => x((p) => !p),
723
724
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
724
725
  children: [
725
- l ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
726
- /* @__PURE__ */ e(mt, { className: "h-3 w-3" }),
726
+ l ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" }),
727
+ /* @__PURE__ */ e(ut, { className: "h-3 w-3" }),
727
728
  "Conditions ",
728
729
  /* @__PURE__ */ e("span", { className: "font-normal text-slate-400", children: "(optional)" }),
729
730
  a.length > 0 && /* @__PURE__ */ e("span", { className: "rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy", children: a.length })
@@ -733,14 +734,14 @@ function rs({
733
734
  l && /* @__PURE__ */ t("div", { className: "space-y-2", children: [
734
735
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 leading-snug", children: "Transition is only offered when all conditions match the record — use two transitions with opposite conditions to branch." }),
735
736
  a.map((p, w) => {
736
- const k = p.op === "null" || p.op === "nnull", S = d(p.field), A = ss.has(S.type), L = ns.has(S.type), O = ls.has(S.type), y = !!S.relatedCollection;
737
+ const k = p.op === "null" || p.op === "nnull", S = d(p.field), D = ls.has(S.type), A = rs.has(S.type), O = is.has(S.type), y = !!S.relatedCollection;
737
738
  return /* @__PURE__ */ t(
738
739
  "div",
739
740
  {
740
741
  className: "flex flex-wrap items-center gap-2 rounded-lg border border-slate-200 bg-white p-2",
741
742
  children: [
742
743
  /* @__PURE__ */ e("div", { className: "flex-1 min-w-[160px]", children: /* @__PURE__ */ e(
743
- ot,
744
+ dt,
744
745
  {
745
746
  collection: c ?? "",
746
747
  fields: v,
@@ -766,15 +767,15 @@ function rs({
766
767
  {
767
768
  value: p.op,
768
769
  onChange: (i) => N(w, { op: i || "eq" }),
769
- options: as.map((i) => ({ value: i.value, label: i.label })),
770
+ options: ns.map((i) => ({ value: i.value, label: i.label })),
770
771
  placeholder: "Operator…"
771
772
  }
772
773
  ) }),
773
774
  !k && /* @__PURE__ */ e("div", { className: "flex-1 min-w-[120px]", children: y ? /* @__PURE__ */ e(
774
- ts,
775
+ ss,
775
776
  {
776
777
  relatedCollection: S.relatedCollection,
777
- value: es(p.value),
778
+ value: as(p.value),
778
779
  onChange: (i) => N(w, { value: i.length === 1 ? i[0] : i })
779
780
  }
780
781
  ) : O ? /* @__PURE__ */ e(
@@ -788,8 +789,8 @@ function rs({
788
789
  ],
789
790
  placeholder: "Yes / No…"
790
791
  }
791
- ) : L ? /* @__PURE__ */ e(
792
- U,
792
+ ) : A ? /* @__PURE__ */ e(
793
+ W,
793
794
  {
794
795
  type: S.type === "date" ? "date" : "datetime-local",
795
796
  value: String(p.value ?? ""),
@@ -797,9 +798,9 @@ function rs({
797
798
  className: "h-8 text-[12px]"
798
799
  }
799
800
  ) : /* @__PURE__ */ e(
800
- U,
801
+ W,
801
802
  {
802
- type: A ? "number" : "text",
803
+ type: D ? "number" : "text",
803
804
  value: String(p.value ?? ""),
804
805
  onChange: (i) => N(w, { value: i.target.value }),
805
806
  placeholder: "Value",
@@ -821,7 +822,7 @@ function rs({
821
822
  );
822
823
  }),
823
824
  /* @__PURE__ */ t(
824
- P,
825
+ T,
825
826
  {
826
827
  type: "button",
827
828
  size: "sm",
@@ -837,7 +838,7 @@ function rs({
837
838
  ] })
838
839
  ] });
839
840
  }
840
- function is({
841
+ function cs({
841
842
  requirement: a,
842
843
  childRelations: n,
843
844
  onChange: c,
@@ -915,7 +916,7 @@ function is({
915
916
  ),
916
917
  /* @__PURE__ */ e("span", { className: "flex-1 text-[12px] text-slate-700", children: m.field }),
917
918
  f && /* @__PURE__ */ e(
918
- U,
919
+ W,
919
920
  {
920
921
  value: ((b = a.labels) == null ? void 0 : b[m.field]) ?? "",
921
922
  onChange: (p) => u(m.field, p.target.value),
@@ -949,7 +950,7 @@ function is({
949
950
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
950
951
  /* @__PURE__ */ e(Y, { className: "text-[11px]", children: "Dialog Title" }),
951
952
  /* @__PURE__ */ e(
952
- U,
953
+ W,
953
954
  {
954
955
  value: a.title ?? "",
955
956
  onChange: (m) => c({ title: m.target.value.trim() ? m.target.value : void 0 }),
@@ -960,7 +961,7 @@ function is({
960
961
  ] })
961
962
  ] });
962
963
  }
963
- function os({
964
+ function ds({
964
965
  requirements: a,
965
966
  onChange: n,
966
967
  collection: c
@@ -980,8 +981,8 @@ function os({
980
981
  onClick: () => x((d) => !d),
981
982
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
982
983
  children: [
983
- l ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
984
- /* @__PURE__ */ e(Ut, { className: "h-3 w-3" }),
984
+ l ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" }),
985
+ /* @__PURE__ */ e(Vt, { className: "h-3 w-3" }),
985
986
  "Requirements ",
986
987
  /* @__PURE__ */ e("span", { className: "font-normal text-slate-400", children: "(optional)" }),
987
988
  a.length > 0 && /* @__PURE__ */ e("span", { className: "rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy", children: a.length })
@@ -991,7 +992,7 @@ function os({
991
992
  l && /* @__PURE__ */ t("div", { className: "space-y-2", children: [
992
993
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 leading-snug", children: "Block this transition until every row of a child relation has the listed fields filled in. Prompts the user with a fill-in dialog when rows are incomplete." }),
993
994
  a.map((d, N) => /* @__PURE__ */ e(
994
- is,
995
+ cs,
995
996
  {
996
997
  requirement: d,
997
998
  childRelations: h,
@@ -1001,7 +1002,7 @@ function os({
1001
1002
  N
1002
1003
  )),
1003
1004
  /* @__PURE__ */ t(
1004
- P,
1005
+ T,
1005
1006
  {
1006
1007
  type: "button",
1007
1008
  size: "sm",
@@ -1033,7 +1034,7 @@ function Fe({
1033
1034
  return /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1034
1035
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: a }),
1035
1036
  /* @__PURE__ */ e(
1036
- Ht,
1037
+ Yt,
1037
1038
  {
1038
1039
  value: x,
1039
1040
  onChange: (v) => {
@@ -1060,16 +1061,16 @@ function Fe({
1060
1061
  r && /* @__PURE__ */ e("p", { className: "text-[10.5px] text-red-500", children: "Invalid JSON — not saved yet." })
1061
1062
  ] });
1062
1063
  }
1063
- const rt = "__custom__";
1064
- function cs(a) {
1064
+ const ot = "__custom__";
1065
+ function ms(a) {
1065
1066
  return a.status === "live" ? `Live v${a.published_version ?? "?"}` : a.status === "draft" ? "Draft changes" : "Not published";
1066
1067
  }
1067
- function ds({
1068
+ function ps({
1068
1069
  externalApi: a,
1069
1070
  value: n,
1070
1071
  onChange: c
1071
1072
  }) {
1072
- const g = Z(), l = Ca(), x = a.trim(), { data: o } = H({
1073
+ const g = Z(), l = qa(), x = a.trim(), { data: o } = H({
1073
1074
  queryKey: ["payload-templates", "list", x],
1074
1075
  queryFn: () => g.request(
1075
1076
  V(`/payload-templates?external_api=${encodeURIComponent(x)}`)
@@ -1080,10 +1081,10 @@ function ds({
1080
1081
  queryFn: () => g.request(V("/external-apis")).then((m) => m.data ?? []),
1081
1082
  enabled: !!n
1082
1083
  }), h = [
1083
- { value: rt, label: "Custom (inline Liquid)" },
1084
+ { value: ot, label: "Custom (inline Liquid)" },
1084
1085
  ...(o ?? []).map((m) => ({
1085
1086
  value: m.key,
1086
- label: `${m.label} · ${cs(m)}`
1087
+ label: `${m.label} · ${ms(m)}`
1087
1088
  }))
1088
1089
  ], v = (r ?? []).find((m) => m.name === x || String(m.id) === x), u = v ? String(v.id) : x, d = n ? `/external-apis/${encodeURIComponent(u)}/payloads/${encodeURIComponent(n)}` : null, N = d ? l.consoleUrl ? l.consoleUrl(d) : d : null;
1089
1090
  return /* @__PURE__ */ t("div", { className: "space-y-1", children: [
@@ -1092,8 +1093,8 @@ function ds({
1092
1093
  /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(
1093
1094
  pe,
1094
1095
  {
1095
- value: n ?? rt,
1096
- onChange: (m) => c(m === rt ? void 0 : m),
1096
+ value: n ?? ot,
1097
+ onChange: (m) => c(m === ot ? void 0 : m),
1097
1098
  options: h,
1098
1099
  placeholder: x ? "Custom (inline Liquid)" : "Enter an external API first"
1099
1100
  }
@@ -1105,7 +1106,7 @@ function ds({
1105
1106
  onClick: () => l.navigate(N),
1106
1107
  className: "flex shrink-0 items-center gap-1 text-[11px] text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200",
1107
1108
  children: [
1108
- /* @__PURE__ */ e(va, { className: "h-3 w-3" }),
1109
+ /* @__PURE__ */ e(wa, { className: "h-3 w-3" }),
1109
1110
  "Open template"
1110
1111
  ]
1111
1112
  }
@@ -1113,7 +1114,7 @@ function ds({
1113
1114
  ] })
1114
1115
  ] });
1115
1116
  }
1116
- function ms({
1117
+ function us({
1117
1118
  actions: a,
1118
1119
  onChange: n
1119
1120
  }) {
@@ -1126,7 +1127,7 @@ function ms({
1126
1127
  onClick: () => g((o) => !o),
1127
1128
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
1128
1129
  children: [
1129
- c ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
1130
+ c ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ft, { className: "h-3.5 w-3.5" }),
1130
1131
  "Actions",
1131
1132
  a.length > 0 && /* @__PURE__ */ e("span", { className: "rounded-full bg-teal-100 px-1.5 py-0.5 text-[10px] font-medium text-teal-700", children: a.length })
1132
1133
  ]
@@ -1178,7 +1179,7 @@ function ms({
1178
1179
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1179
1180
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "External API (name or id)" }),
1180
1181
  /* @__PURE__ */ e(
1181
- U,
1182
+ W,
1182
1183
  {
1183
1184
  value: String(o.external_api ?? ""),
1184
1185
  onChange: (h) => l(r, { external_api: h.target.value }),
@@ -1190,7 +1191,7 @@ function ms({
1190
1191
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1191
1192
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Endpoint path" }),
1192
1193
  /* @__PURE__ */ e(
1193
- U,
1194
+ W,
1194
1195
  {
1195
1196
  value: o.endpoint_path ?? "",
1196
1197
  onChange: (h) => l(r, { endpoint_path: h.target.value }),
@@ -1202,7 +1203,7 @@ function ms({
1202
1203
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1203
1204
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Method" }),
1204
1205
  /* @__PURE__ */ e(
1205
- U,
1206
+ W,
1206
1207
  {
1207
1208
  value: o.method ?? "",
1208
1209
  onChange: (h) => l(r, { method: h.target.value || void 0 }),
@@ -1214,7 +1215,7 @@ function ms({
1214
1215
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1215
1216
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Skip when context key empty" }),
1216
1217
  /* @__PURE__ */ e(
1217
- U,
1218
+ W,
1218
1219
  {
1219
1220
  value: o.skip_when_empty ?? "",
1220
1221
  onChange: (h) => l(r, { skip_when_empty: h.target.value || void 0 }),
@@ -1228,7 +1229,7 @@ function ms({
1228
1229
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1229
1230
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Target collection" }),
1230
1231
  /* @__PURE__ */ e(
1231
- U,
1232
+ W,
1232
1233
  {
1233
1234
  value: o.target_collection ?? "",
1234
1235
  onChange: (h) => l(r, { target_collection: h.target.value }),
@@ -1240,7 +1241,7 @@ function ms({
1240
1241
  /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1241
1242
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Link field (FK writeback)" }),
1242
1243
  /* @__PURE__ */ e(
1243
- U,
1244
+ W,
1244
1245
  {
1245
1246
  value: o.link_field ?? "",
1246
1247
  onChange: (h) => l(r, { link_field: h.target.value || void 0 }),
@@ -1251,7 +1252,7 @@ function ms({
1251
1252
  ] })
1252
1253
  ] }),
1253
1254
  o.type === "erp_submit" && /* @__PURE__ */ e(
1254
- ds,
1255
+ ps,
1255
1256
  {
1256
1257
  externalApi: String(o.external_api ?? ""),
1257
1258
  value: o.payload_template_key,
@@ -1261,7 +1262,7 @@ function ms({
1261
1262
  !(o.type === "erp_submit" && o.payload_template_key) && /* @__PURE__ */ t("div", { className: "space-y-1", children: [
1262
1263
  /* @__PURE__ */ e("span", { className: "text-[10.5px] uppercase tracking-wide text-slate-400", children: "Payload template (Liquid — must render to valid JSON)" }),
1263
1264
  /* @__PURE__ */ e(
1264
- Ht,
1265
+ Yt,
1265
1266
  {
1266
1267
  value: o.payload_template ?? "",
1267
1268
  onChange: (h) => l(r, { payload_template: h.target.value }),
@@ -1335,7 +1336,7 @@ function ms({
1335
1336
  r
1336
1337
  )),
1337
1338
  /* @__PURE__ */ t(
1338
- P,
1339
+ T,
1339
1340
  {
1340
1341
  type: "button",
1341
1342
  size: "sm",
@@ -1351,7 +1352,7 @@ function ms({
1351
1352
  ] })
1352
1353
  ] });
1353
1354
  }
1354
- function it({
1355
+ function ct({
1355
1356
  initial: a,
1356
1357
  states: n,
1357
1358
  collection: c,
@@ -1376,15 +1377,15 @@ function it({
1376
1377
  notify_text: a.notify_text ?? null,
1377
1378
  comment_mode: a.comment_mode ?? "none",
1378
1379
  actions: a.actions ?? null
1379
- }), v = (b, p) => h((w) => ({ ...w, [b]: p })), u = (b) => b.collection.trim() !== "" && b.fk_field.trim() !== "" && b.fields.length > 0, d = (r.requirements ?? []).every(u), N = r.to_states.length > 0 && r.label.trim() && d, { data: m } = Ta(c, {
1380
+ }), v = (b, p) => h((w) => ({ ...w, [b]: p })), u = (b) => b.collection.trim() !== "" && b.fk_field.trim() !== "" && b.fields.length > 0, d = (r.requirements ?? []).every(u), N = r.to_states.length > 0 && r.label.trim() && d, { data: m } = Aa(c, {
1380
1381
  select: (b) => Array.isArray(b == null ? void 0 : b.fields) ? b.fields : []
1381
- }), f = Sa(
1382
+ }), f = $a(
1382
1383
  {
1383
1384
  ...r,
1384
1385
  condition_rules: (r.condition_rules ?? []).filter((b) => b.field.trim()),
1385
1386
  requirements: (r.requirements ?? []).filter(u)
1386
1387
  },
1387
- qa(m ?? [], [], c, {
1388
+ Fa(m ?? [], [], c, {
1388
1389
  states: Object.fromEntries(n.map((b) => [b.id, b.label]))
1389
1390
  })
1390
1391
  );
@@ -1395,7 +1396,7 @@ function it({
1395
1396
  ] }) : /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
1396
1397
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Button Label" }),
1397
1398
  /* @__PURE__ */ e(
1398
- U,
1399
+ W,
1399
1400
  {
1400
1401
  value: r.label,
1401
1402
  onChange: (b) => v("label", b.target.value),
@@ -1422,7 +1423,7 @@ function it({
1422
1423
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: r.to_previous ? "Fallback state" : `To State${r.to_states.length !== 1 ? "s" : ""}` }),
1423
1424
  r.to_previous && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "The real target is the record's previous state — this only applies when history can't answer (the record started in this state, or the prior state was removed)." }),
1424
1425
  /* @__PURE__ */ e(
1425
- Xa,
1426
+ es,
1426
1427
  {
1427
1428
  values: r.to_states,
1428
1429
  onChange: (b) => v("to_states", b),
@@ -1460,10 +1461,10 @@ function it({
1460
1461
  ] }),
1461
1462
  !g && /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
1462
1463
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Color" }),
1463
- /* @__PURE__ */ e(Ge, { value: r.color, onChange: (b) => v("color", b) })
1464
+ /* @__PURE__ */ e(Je, { value: r.color, onChange: (b) => v("color", b) })
1464
1465
  ] }),
1465
1466
  /* @__PURE__ */ e(
1466
- rs,
1467
+ os,
1467
1468
  {
1468
1469
  rules: r.condition_rules ?? [],
1469
1470
  onChange: (b) => v("condition_rules", b),
@@ -1471,7 +1472,7 @@ function it({
1471
1472
  }
1472
1473
  ),
1473
1474
  /* @__PURE__ */ e(
1474
- os,
1475
+ ds,
1475
1476
  {
1476
1477
  requirements: r.requirements ?? [],
1477
1478
  onChange: (b) => v("requirements", b.length > 0 ? b : null),
@@ -1479,7 +1480,7 @@ function it({
1479
1480
  }
1480
1481
  ),
1481
1482
  /* @__PURE__ */ e(
1482
- ms,
1483
+ us,
1483
1484
  {
1484
1485
  actions: r.actions ?? [],
1485
1486
  onChange: (b) => v("actions", b.length > 0 ? b : null)
@@ -1586,11 +1587,11 @@ function it({
1586
1587
  ] }),
1587
1588
  /* @__PURE__ */ e(Ee, { checked: r.to_previous, onCheckedChange: (b) => v("to_previous", b) })
1588
1589
  ] }),
1589
- /* @__PURE__ */ e(Ra, { kind: "transition", sentences: f }),
1590
+ /* @__PURE__ */ e(Pa, { kind: "transition", sentences: f }),
1590
1591
  /* @__PURE__ */ t("div", { className: "flex gap-2 justify-end", children: [
1591
- /* @__PURE__ */ e(P, { type: "button", variant: "outline", size: "sm", onClick: x, children: "Cancel" }),
1592
+ /* @__PURE__ */ e(T, { type: "button", variant: "outline", size: "sm", onClick: x, children: "Cancel" }),
1592
1593
  /* @__PURE__ */ e(
1593
- P,
1594
+ T,
1594
1595
  {
1595
1596
  type: "button",
1596
1597
  size: "sm",
@@ -1609,19 +1610,19 @@ function it({
1609
1610
  ] })
1610
1611
  ] });
1611
1612
  }
1612
- function ps(a) {
1613
+ function hs(a) {
1613
1614
  var g, l;
1614
1615
  const n = ((g = a.first_name) == null ? void 0 : g[0]) ?? "", c = ((l = a.last_name) == null ? void 0 : l[0]) ?? "";
1615
1616
  return (n + c).toUpperCase() || a.email[0].toUpperCase();
1616
1617
  }
1617
- function us(a) {
1618
+ function xs(a) {
1618
1619
  const n = a.filter((l) => !l.filters || l.filters.length === 0), c = /* @__PURE__ */ new Set(), g = [];
1619
1620
  for (const l of n)
1620
1621
  for (const x of l.users)
1621
1622
  c.has(x.user) || (c.add(x.user), g.push(x));
1622
1623
  return g;
1623
1624
  }
1624
- function hs({
1625
+ function fs({
1625
1626
  users: a,
1626
1627
  filteredCount: n
1627
1628
  }) {
@@ -1634,7 +1635,7 @@ function hs({
1634
1635
  {
1635
1636
  title: `${l.first_name ?? ""} ${l.last_name ?? ""}`.trim() || l.email,
1636
1637
  className: "h-5 w-5 rounded-full bg-nvr-cyan/20 border border-white flex items-center justify-center text-[9px] font-semibold text-nvr-cyan",
1637
- children: ps(l)
1638
+ children: hs(l)
1638
1639
  },
1639
1640
  l.user
1640
1641
  )),
@@ -1657,7 +1658,7 @@ function hs({
1657
1658
  )
1658
1659
  ] });
1659
1660
  }
1660
- function xs({
1661
+ function gs({
1661
1662
  s: a,
1662
1663
  groups: n,
1663
1664
  expandedStateId: c,
@@ -1665,7 +1666,7 @@ function xs({
1665
1666
  onEdit: l,
1666
1667
  onDelete: x
1667
1668
  }) {
1668
- const { attributes: o, listeners: r, setNodeRef: h, transform: v, transition: u, isDragging: d } = ct({
1669
+ const { attributes: o, listeners: r, setNodeRef: h, transform: v, transition: u, isDragging: d } = mt({
1669
1670
  id: a.id
1670
1671
  });
1671
1672
  return /* @__PURE__ */ e(
@@ -1673,7 +1674,7 @@ function xs({
1673
1674
  {
1674
1675
  ref: h,
1675
1676
  style: {
1676
- transform: dt.Transform.toString(v),
1677
+ transform: pt.Transform.toString(v),
1677
1678
  transition: u,
1678
1679
  opacity: d ? 0.4 : 1
1679
1680
  },
@@ -1686,7 +1687,7 @@ function xs({
1686
1687
  ...r,
1687
1688
  className: "cursor-grab touch-none text-slate-300 hover:text-slate-400 transition-colors shrink-0",
1688
1689
  tabIndex: -1,
1689
- children: /* @__PURE__ */ e(pt, { className: "h-3.5 w-3.5" })
1690
+ children: /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" })
1690
1691
  }
1691
1692
  ),
1692
1693
  /* @__PURE__ */ e(
@@ -1704,13 +1705,13 @@ function xs({
1704
1705
  a.lock_record && /* @__PURE__ */ e(Ce, { variant: "outline", className: "text-[10px] h-4 px-1", children: "locked" })
1705
1706
  ] }) }),
1706
1707
  /* @__PURE__ */ e(
1707
- hs,
1708
+ fs,
1708
1709
  {
1709
- users: us(n),
1710
+ users: xs(n),
1710
1711
  filteredCount: n.filter((N) => N.filters && N.filters.length > 0).length
1711
1712
  }
1712
1713
  ),
1713
- /* @__PURE__ */ t("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
1714
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 [&:has([data-armed])]:opacity-100 transition-opacity shrink-0", children: [
1714
1715
  /* @__PURE__ */ e(
1715
1716
  "button",
1716
1717
  {
@@ -1718,7 +1719,7 @@ function xs({
1718
1719
  onClick: g,
1719
1720
  className: "rounded p-1 text-slate-400 hover:text-slate-700",
1720
1721
  title: "Configure owners & skip",
1721
- children: /* @__PURE__ */ e(ga, { className: "h-3.5 w-3.5" })
1722
+ children: /* @__PURE__ */ e(ya, { className: "h-3.5 w-3.5" })
1722
1723
  }
1723
1724
  ),
1724
1725
  /* @__PURE__ */ e(
@@ -1727,15 +1728,18 @@ function xs({
1727
1728
  type: "button",
1728
1729
  onClick: l,
1729
1730
  className: "rounded p-1 text-slate-400 hover:text-slate-700",
1730
- children: /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" })
1731
+ children: /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" })
1731
1732
  }
1732
1733
  ),
1733
1734
  /* @__PURE__ */ e(
1734
- "button",
1735
+ De,
1735
1736
  {
1736
- type: "button",
1737
- onClick: x,
1737
+ onConfirm: x,
1738
+ title: "Delete state",
1739
+ confirmLabel: "Delete?",
1740
+ confirmTitle: `Delete state "${a.label}"?`,
1738
1741
  className: "rounded p-1 text-slate-400 hover:text-red-500",
1742
+ armedClassName: Le,
1739
1743
  children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
1740
1744
  }
1741
1745
  )
@@ -1744,7 +1748,7 @@ function xs({
1744
1748
  }
1745
1749
  );
1746
1750
  }
1747
- function fs({
1751
+ function bs({
1748
1752
  d: a,
1749
1753
  siblings: n,
1750
1754
  onSave: c,
@@ -1755,8 +1759,8 @@ function fs({
1755
1759
  l && r(a.cascade ?? []);
1756
1760
  }, [l, a.cascade]);
1757
1761
  const h = n.filter((v) => v.id !== a.id && !v.is_row_axis);
1758
- return /* @__PURE__ */ t(De, { open: l, onOpenChange: x, children: [
1759
- /* @__PURE__ */ e(Le, { asChild: !0, children: /* @__PURE__ */ e(
1762
+ return /* @__PURE__ */ t(je, { open: l, onOpenChange: x, children: [
1763
+ /* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ e(
1760
1764
  "button",
1761
1765
  {
1762
1766
  type: "button",
@@ -1765,10 +1769,10 @@ function fs({
1765
1769
  "rounded p-1 transition-colors",
1766
1770
  (a.cascade ?? []).length > 0 ? "text-nvr-cyan hover:text-nvr-cyan-dark" : "text-slate-400 hover:text-slate-700"
1767
1771
  ),
1768
- children: /* @__PURE__ */ e(mt, { className: "h-3.5 w-3.5" })
1772
+ children: /* @__PURE__ */ e(ut, { className: "h-3.5 w-3.5" })
1769
1773
  }
1770
1774
  ) }),
1771
- /* @__PURE__ */ t(je, { align: "end", className: "w-[380px] p-3", sideOffset: 4, children: [
1775
+ /* @__PURE__ */ t(Ke, { align: "end", className: "w-[380px] p-3", sideOffset: 4, children: [
1772
1776
  /* @__PURE__ */ t("p", { className: "text-[12px] font-semibold text-slate-800 dark:text-foreground", children: [
1773
1777
  "Cascade ",
1774
1778
  a.label
@@ -1807,7 +1811,7 @@ function fs({
1807
1811
  /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
1808
1812
  /* @__PURE__ */ e("span", { className: "w-14 shrink-0 text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Filter" }),
1809
1813
  /* @__PURE__ */ e(
1810
- U,
1814
+ W,
1811
1815
  {
1812
1816
  value: v.filter,
1813
1817
  onChange: (d) => r(
@@ -1848,7 +1852,7 @@ function fs({
1848
1852
  ] }),
1849
1853
  /* @__PURE__ */ t("div", { className: "mt-2 flex justify-end gap-1.5", children: [
1850
1854
  /* @__PURE__ */ e(
1851
- P,
1855
+ T,
1852
1856
  {
1853
1857
  size: "sm",
1854
1858
  variant: "ghost",
@@ -1858,7 +1862,7 @@ function fs({
1858
1862
  }
1859
1863
  ),
1860
1864
  /* @__PURE__ */ e(
1861
- P,
1865
+ T,
1862
1866
  {
1863
1867
  size: "sm",
1864
1868
  className: "h-6 px-2.5 text-[11px]",
@@ -1873,7 +1877,7 @@ function fs({
1873
1877
  ] })
1874
1878
  ] });
1875
1879
  }
1876
- function gs({
1880
+ function ys({
1877
1881
  d: a,
1878
1882
  siblings: n,
1879
1883
  onEdit: c,
@@ -1881,7 +1885,7 @@ function gs({
1881
1885
  onSaveCascade: l,
1882
1886
  cascadeSaving: x
1883
1887
  }) {
1884
- const { attributes: o, listeners: r, setNodeRef: h, transform: v, transition: u, isDragging: d } = ct({
1888
+ const { attributes: o, listeners: r, setNodeRef: h, transform: v, transition: u, isDragging: d } = mt({
1885
1889
  id: a.id
1886
1890
  });
1887
1891
  return /* @__PURE__ */ t(
@@ -1889,7 +1893,7 @@ function gs({
1889
1893
  {
1890
1894
  ref: h,
1891
1895
  style: {
1892
- transform: dt.Transform.toString(v),
1896
+ transform: pt.Transform.toString(v),
1893
1897
  transition: u,
1894
1898
  opacity: d ? 0.4 : 1
1895
1899
  },
@@ -1903,7 +1907,7 @@ function gs({
1903
1907
  ...r,
1904
1908
  className: "cursor-grab touch-none text-slate-300 hover:text-slate-400 transition-colors",
1905
1909
  tabIndex: -1,
1906
- children: /* @__PURE__ */ e(pt, { className: "h-3.5 w-3.5" })
1910
+ children: /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" })
1907
1911
  }
1908
1912
  ),
1909
1913
  /* @__PURE__ */ t("div", { className: "flex-1 min-w-0 flex items-center gap-3 flex-wrap", children: [
@@ -1926,7 +1930,7 @@ function gs({
1926
1930
  ] }),
1927
1931
  /* @__PURE__ */ t("div", { className: "flex items-center gap-1 shrink-0", children: [
1928
1932
  /* @__PURE__ */ e(
1929
- fs,
1933
+ bs,
1930
1934
  {
1931
1935
  d: a,
1932
1936
  siblings: n,
@@ -1940,15 +1944,18 @@ function gs({
1940
1944
  type: "button",
1941
1945
  onClick: c,
1942
1946
  className: "rounded p-1 text-slate-400 hover:text-slate-700 transition-colors",
1943
- children: /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" })
1947
+ children: /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" })
1944
1948
  }
1945
1949
  ),
1946
1950
  /* @__PURE__ */ e(
1947
- "button",
1951
+ De,
1948
1952
  {
1949
- type: "button",
1950
- onClick: g,
1953
+ onConfirm: g,
1954
+ title: "Delete dimension",
1955
+ confirmLabel: "Delete?",
1956
+ confirmTitle: `Delete dimension "${a.label}"?`,
1951
1957
  className: "rounded p-1 text-slate-400 hover:text-red-500 transition-colors",
1958
+ armedClassName: Le,
1952
1959
  children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
1953
1960
  }
1954
1961
  )
@@ -1957,7 +1964,7 @@ function gs({
1957
1964
  }
1958
1965
  );
1959
1966
  }
1960
- function bs({
1967
+ function vs({
1961
1968
  binding: a,
1962
1969
  templateId: n
1963
1970
  }) {
@@ -1966,9 +1973,9 @@ function bs({
1966
1973
  xe(() => {
1967
1974
  o(l.map((i) => i.id));
1968
1975
  }, [l]);
1969
- const r = x.map((i) => l.find((_) => _.id === i)).filter(Boolean), h = Kt(
1970
- Ye(zt),
1971
- Ye(Bt, { coordinateGetter: Qt })
1976
+ const r = x.map((i) => l.find((_) => _.id === i)).filter(Boolean), h = Bt(
1977
+ Ie(Qt),
1978
+ Ie(Ut, { coordinateGetter: Wt })
1972
1979
  ), [v, u] = $(null), [d, N] = $({
1973
1980
  field: "",
1974
1981
  label: "",
@@ -1985,25 +1992,25 @@ function bs({
1985
1992
  queryKey: ["collection-meta", a.collection],
1986
1993
  queryFn: () => c.request(V(`/collections/${a.collection}`)).then((i) => i.data),
1987
1994
  enabled: !!a.collection
1988
- }), p = ((y = b == null ? void 0 : b.fields) == null ? void 0 : y.filter((i) => !i.hidden)) ?? [], w = () => g.invalidateQueries({ queryKey: ["pipeline-template", n] }), k = M({
1995
+ }), p = ((y = b == null ? void 0 : b.fields) == null ? void 0 : y.filter((i) => !i.hidden)) ?? [], w = () => g.invalidateQueries({ queryKey: ["pipeline-template", n] }), k = j({
1989
1996
  mutationFn: (i) => c.request(I(`/pipelines/bindings/${a.id}/dimensions`, i)),
1990
1997
  onSuccess: () => {
1991
- w(), f({ field: "", label: "", sort: 0, is_row_axis: !1, required: !1 }), T.success("Dimension added");
1998
+ w(), f({ field: "", label: "", sort: 0, is_row_axis: !1, required: !1 }), P.success("Dimension added");
1992
1999
  },
1993
- onError: () => T.error("Failed to add dimension")
1994
- }), S = M({
2000
+ onError: () => P.error("Failed to add dimension")
2001
+ }), S = j({
1995
2002
  mutationFn: ({ dimId: i, body: _ }) => c.request(be(`/pipelines/dimensions/${i}`, _)),
1996
2003
  onSuccess: () => {
1997
- w(), u(null), T.success("Dimension updated");
2004
+ w(), u(null), P.success("Dimension updated");
1998
2005
  },
1999
- onError: () => T.error("Failed to update dimension")
2000
- }), A = M({
2006
+ onError: () => P.error("Failed to update dimension")
2007
+ }), D = j({
2001
2008
  mutationFn: (i) => c.request($e(`/pipelines/dimensions/${i}`)),
2002
2009
  onSuccess: () => {
2003
- w(), T.success("Dimension deleted");
2010
+ w(), P.success("Dimension deleted");
2004
2011
  },
2005
- onError: () => T.error("Failed to delete dimension")
2006
- }), L = (i) => {
2012
+ onError: () => P.error("Failed to delete dimension")
2013
+ }), A = (i) => {
2007
2014
  u(i.id), N({
2008
2015
  field: i.field,
2009
2016
  label: i.label,
@@ -2014,15 +2021,15 @@ function bs({
2014
2021
  }, O = (i) => {
2015
2022
  const { active: _, over: E } = i;
2016
2023
  if (!E || _.id === E.id) return;
2017
- const F = x.indexOf(_.id), B = x.indexOf(E.id), j = Ve(x, F, B);
2018
- o(j), j.forEach((K, W) => {
2024
+ const F = x.indexOf(_.id), B = x.indexOf(E.id), L = Ge(x, F, B);
2025
+ o(L), L.forEach((M, U) => {
2019
2026
  var te;
2020
- ((te = l.find((ae) => ae.id === K)) == null ? void 0 : te.sort) !== W && S.mutate({ dimId: K, body: { sort: W } });
2027
+ ((te = l.find((ae) => ae.id === M)) == null ? void 0 : te.sort) !== U && S.mutate({ dimId: M, body: { sort: U } });
2021
2028
  });
2022
2029
  };
2023
2030
  return /* @__PURE__ */ t("div", { className: "border-t border-slate-100 bg-slate-50/50 px-4 pt-3 pb-4 space-y-3 rounded-b-lg", children: [
2024
2031
  l.length === 0 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400 py-0.5", children: "No dimensions — add one below." }),
2025
- l.length > 0 && /* @__PURE__ */ e(Qe, { sensors: h, collisionDetection: We, onDragEnd: O, children: /* @__PURE__ */ e(Ue, { items: x, strategy: He, children: /* @__PURE__ */ e("div", { className: "space-y-1.5", children: r.map(
2032
+ l.length > 0 && /* @__PURE__ */ e(We, { sensors: h, collisionDetection: He, onDragEnd: O, children: /* @__PURE__ */ e(Ve, { items: x, strategy: Ye, children: /* @__PURE__ */ e("div", { className: "space-y-1.5", children: r.map(
2026
2033
  (i) => v === i.id ? /* @__PURE__ */ t(
2027
2034
  "div",
2028
2035
  {
@@ -2032,7 +2039,7 @@ function bs({
2032
2039
  /* @__PURE__ */ t("div", { className: "space-y-1.5 flex-1 min-w-[160px]", children: [
2033
2040
  /* @__PURE__ */ e(Y, { className: "text-[11px] text-slate-500", children: "Field" }),
2034
2041
  /* @__PURE__ */ e(
2035
- ot,
2042
+ dt,
2036
2043
  {
2037
2044
  collection: a.collection,
2038
2045
  fields: p,
@@ -2053,7 +2060,7 @@ function bs({
2053
2060
  /* @__PURE__ */ t("div", { className: "space-y-1.5 flex-1 min-w-[100px]", children: [
2054
2061
  /* @__PURE__ */ e(Y, { className: "text-[11px] text-slate-500", children: "Label" }),
2055
2062
  /* @__PURE__ */ e(
2056
- U,
2063
+ W,
2057
2064
  {
2058
2065
  value: d.label,
2059
2066
  onChange: (_) => N((E) => ({ ...E, label: _.target.value })),
@@ -2089,7 +2096,7 @@ function bs({
2089
2096
  ] }),
2090
2097
  /* @__PURE__ */ t("div", { className: "flex justify-end gap-2", children: [
2091
2098
  /* @__PURE__ */ e(
2092
- P,
2099
+ T,
2093
2100
  {
2094
2101
  type: "button",
2095
2102
  variant: "ghost",
@@ -2100,7 +2107,7 @@ function bs({
2100
2107
  }
2101
2108
  ),
2102
2109
  /* @__PURE__ */ e(
2103
- P,
2110
+ T,
2104
2111
  {
2105
2112
  type: "button",
2106
2113
  size: "sm",
@@ -2115,14 +2122,12 @@ function bs({
2115
2122
  },
2116
2123
  i.id
2117
2124
  ) : /* @__PURE__ */ e(
2118
- gs,
2125
+ ys,
2119
2126
  {
2120
2127
  d: i,
2121
2128
  siblings: r,
2122
- onEdit: () => L(i),
2123
- onDelete: () => {
2124
- confirm(`Delete dimension "${i.label}"?`) && A.mutate(i.id);
2125
- },
2129
+ onEdit: () => A(i),
2130
+ onDelete: () => D.mutate(i.id),
2126
2131
  onSaveCascade: (_) => S.mutate({
2127
2132
  dimId: i.id,
2128
2133
  body: { cascade: _ }
@@ -2136,7 +2141,7 @@ function bs({
2136
2141
  /* @__PURE__ */ t("div", { className: "space-y-1.5 flex-1 min-w-[160px]", children: [
2137
2142
  /* @__PURE__ */ e(Y, { className: "text-[11px] text-slate-500", children: "Field" }),
2138
2143
  /* @__PURE__ */ e(
2139
- ot,
2144
+ dt,
2140
2145
  {
2141
2146
  collection: a.collection,
2142
2147
  fields: p,
@@ -2157,7 +2162,7 @@ function bs({
2157
2162
  /* @__PURE__ */ t("div", { className: "space-y-1.5 flex-1 min-w-[100px]", children: [
2158
2163
  /* @__PURE__ */ e(Y, { className: "text-[11px] text-slate-500", children: "Label" }),
2159
2164
  /* @__PURE__ */ e(
2160
- U,
2165
+ W,
2161
2166
  {
2162
2167
  value: m.label,
2163
2168
  onChange: (i) => f((_) => ({ ..._, label: i.target.value })),
@@ -2191,7 +2196,7 @@ function bs({
2191
2196
  "Required"
2192
2197
  ] }),
2193
2198
  /* @__PURE__ */ t(
2194
- P,
2199
+ T,
2195
2200
  {
2196
2201
  type: "button",
2197
2202
  size: "sm",
@@ -2208,18 +2213,18 @@ function bs({
2208
2213
  ] })
2209
2214
  ] });
2210
2215
  }
2211
- function kn({
2216
+ function Sn({
2212
2217
  templateId: a,
2213
2218
  onBack: n,
2214
2219
  onExport: c,
2215
2220
  hidden: g
2216
2221
  }) {
2217
- var qt;
2218
- const l = Z(), x = ke(), o = new Set(g ?? []), [r, h] = $(!1), [v, u] = $(""), [d, N] = $(!1), [m, f] = $(null), [b, p] = $(!1), [w, k] = $(null), [S, A] = $(null), [L, O] = $(
2222
+ var Ft;
2223
+ const l = Z(), x = ke(), o = new Set(g ?? []), [r, h] = $(!1), [v, u] = $(""), [d, N] = $(!1), [m, f] = $(null), [b, p] = $(!1), [w, k] = $(null), [S, D] = $(null), [A, O] = $(
2219
2224
  null
2220
- ), [y, i] = $(""), [_, E] = $(""), [F, B] = $(null), [j, K] = $(!1), [W, te] = $([]), ae = Kt(
2221
- Ye(zt),
2222
- Ye(Bt, { coordinateGetter: Qt })
2225
+ ), [y, i] = $(""), [_, E] = $(""), [F, B] = $(null), [L, M] = $(!1), [U, te] = $([]), ae = Bt(
2226
+ Ie(Qt),
2227
+ Ie(Ut, { coordinateGetter: Wt })
2223
2228
  ), { data: oe } = H({
2224
2229
  queryKey: ["collection-fields", y],
2225
2230
  queryFn: () => l.request(V(`/collections/${y}`)).then((s) => {
@@ -2227,9 +2232,9 @@ function kn({
2227
2232
  return (((C = s.data) == null ? void 0 : C.fields) ?? []).filter((R) => !R.hidden);
2228
2233
  }),
2229
2234
  enabled: !!y
2230
- }), [ce, Xe] = $(null), {
2235
+ }), [ce, et] = $(null), {
2231
2236
  data: z,
2232
- isLoading: Me,
2237
+ isLoading: ze,
2233
2238
  isError: Q,
2234
2239
  error: X,
2235
2240
  refetch: de
@@ -2237,54 +2242,54 @@ function kn({
2237
2242
  queryKey: ["pipeline-template", a],
2238
2243
  queryFn: () => l.request(V(`/pipelines/${a}`)).then((s) => s.data),
2239
2244
  enabled: !!a
2240
- }), [me, xt] = $([]), [Ke, ft] = $({});
2245
+ }), [me, gt] = $([]), [Be, bt] = $({});
2241
2246
  xe(() => {
2242
2247
  const s = (z == null ? void 0 : z.states) ?? [];
2243
2248
  te(s.map((C) => C.id));
2244
2249
  }, [z == null ? void 0 : z.states]), xe(() => {
2245
- const s = Dt((z == null ? void 0 : z.transitions) ?? []);
2246
- xt(s.map((C) => C.label)), ft(
2250
+ const s = jt((z == null ? void 0 : z.transitions) ?? []);
2251
+ gt(s.map((C) => C.label)), bt(
2247
2252
  Object.fromEntries(s.map((C) => [C.label, C.routes.map((R) => R.ids[0])]))
2248
2253
  );
2249
2254
  }, [z == null ? void 0 : z.transitions]);
2250
- const { data: Zt } = H({
2255
+ const { data: ta } = H({
2251
2256
  queryKey: ["collections", "tables_only"],
2252
2257
  queryFn: () => l.request(V("/collections?tables_only=true")).then((s) => s.data)
2253
- }), { data: Ze } = H({
2258
+ }), { data: tt } = H({
2254
2259
  queryKey: ["pipeline-all-owner-groups", a],
2255
2260
  queryFn: () => l.request(V(`/pipelines/${a}/owner-groups`)).then((s) => s.data),
2256
2261
  enabled: !!a
2257
2262
  }), le = () => {
2258
2263
  x.invalidateQueries({ queryKey: ["pipeline-template", a] }), x.invalidateQueries({ queryKey: ["pipeline-templates"] }), x.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", a] });
2259
- }, et = M({
2264
+ }, at = j({
2260
2265
  mutationFn: (s) => l.request(be(`/pipelines/${a}`, s)),
2261
2266
  onSuccess: () => {
2262
2267
  le(), h(!1);
2263
2268
  },
2264
- onError: () => T.error("Failed to update pipeline")
2265
- }), gt = M({
2269
+ onError: () => P.error("Failed to update pipeline")
2270
+ }), yt = j({
2266
2271
  mutationFn: (s) => l.request(I(`/pipelines/${a}/states`, s)),
2267
2272
  onSuccess: () => {
2268
2273
  le(), N(!1);
2269
2274
  },
2270
- onError: () => T.error("Failed to add state")
2271
- }), tt = M({
2275
+ onError: () => P.error("Failed to add state")
2276
+ }), st = j({
2272
2277
  mutationFn: ({ stateId: s, body: C }) => l.request(be(`/pipelines/states/${s}`, C)),
2273
2278
  onSuccess: () => {
2274
2279
  le(), f(null);
2275
2280
  },
2276
- onError: () => T.error("Failed to update state")
2277
- }), ea = M({
2281
+ onError: () => P.error("Failed to update state")
2282
+ }), aa = j({
2278
2283
  mutationFn: (s) => l.request($e(`/pipelines/states/${s}`)),
2279
2284
  onSuccess: () => {
2280
- le(), T.success("State deleted");
2285
+ le(), P.success("State deleted");
2281
2286
  },
2282
2287
  onError: (s) => {
2283
2288
  var R;
2284
2289
  const C = ((R = s == null ? void 0 : s.response) == null ? void 0 : R.error) ?? (s == null ? void 0 : s.message);
2285
- T.error(C || "Failed to delete state", { duration: 9e3 });
2290
+ P.error(C || "Failed to delete state", { duration: 9e3 });
2286
2291
  }
2287
- }), bt = M({
2292
+ }), vt = j({
2288
2293
  mutationFn: async (s) => {
2289
2294
  const C = {
2290
2295
  from_state: s.from_state,
@@ -2310,8 +2315,8 @@ function kn({
2310
2315
  onSuccess: () => {
2311
2316
  le(), p(!1);
2312
2317
  },
2313
- onError: () => T.error("Failed to add transition")
2314
- }), yt = M({
2318
+ onError: () => P.error("Failed to add transition")
2319
+ }), Nt = j({
2315
2320
  mutationFn: async ({
2316
2321
  labelGroup: s,
2317
2322
  data: C
@@ -2341,12 +2346,12 @@ function kn({
2341
2346
  onSuccess: () => {
2342
2347
  le(), k(null);
2343
2348
  },
2344
- onError: () => T.error("Failed to add route")
2345
- }), vt = M({
2349
+ onError: () => P.error("Failed to add route")
2350
+ }), wt = j({
2346
2351
  mutationFn: async ({ route: s, data: C }) => {
2347
2352
  const R = /* @__PURE__ */ new Map();
2348
- s.to_states.forEach((q, D) => {
2349
- R.set(q, s.ids[D]);
2353
+ s.to_states.forEach((q, K) => {
2354
+ R.set(q, s.ids[K]);
2350
2355
  });
2351
2356
  const G = new Set(C.to_states), ee = {
2352
2357
  from_state: C.from_state,
@@ -2365,8 +2370,8 @@ function kn({
2365
2370
  actions: C.actions
2366
2371
  };
2367
2372
  for (const q of C.to_states) {
2368
- const D = R.get(q);
2369
- D ? await l.request(be(`/pipelines/transitions/${D}`, { ...ee, to_state: q })) : await l.request(
2373
+ const K = R.get(q);
2374
+ K ? await l.request(be(`/pipelines/transitions/${K}`, { ...ee, to_state: q })) : await l.request(
2370
2375
  I(`/pipelines/${a}/transitions`, {
2371
2376
  ...ee,
2372
2377
  group_label: null,
@@ -2375,38 +2380,38 @@ function kn({
2375
2380
  })
2376
2381
  );
2377
2382
  }
2378
- for (const [q, D] of R)
2379
- G.has(q) || await l.request($e(`/pipelines/transitions/${D}`));
2383
+ for (const [q, K] of R)
2384
+ G.has(q) || await l.request($e(`/pipelines/transitions/${K}`));
2380
2385
  },
2381
2386
  onSuccess: () => {
2382
2387
  le(), O(null);
2383
2388
  },
2384
2389
  onError: (s) => {
2385
- Et(s, "Failed to update route");
2390
+ Rt(s, "Failed to update route");
2386
2391
  }
2387
- }), Nt = M({
2392
+ }), kt = j({
2388
2393
  mutationFn: async (s) => {
2389
2394
  for (const C of s) await l.request($e(`/pipelines/transitions/${C}`));
2390
2395
  },
2391
2396
  onSuccess: () => {
2392
- le(), T.success("Deleted");
2397
+ le(), P.success("Deleted");
2393
2398
  },
2394
- onError: () => T.error("Failed to delete")
2395
- }), ta = M({
2399
+ onError: () => P.error("Failed to delete")
2400
+ }), sa = j({
2396
2401
  mutationFn: async (s) => {
2397
2402
  for (const { id: C, sort: R } of s)
2398
2403
  await l.request(be(`/pipelines/transitions/${C}`, { sort: R }));
2399
2404
  },
2400
2405
  onSuccess: () => le(),
2401
- onError: () => T.error("Failed to reorder")
2402
- }), aa = M({
2406
+ onError: () => P.error("Failed to reorder")
2407
+ }), na = j({
2403
2408
  mutationFn: async ({ ids: s, color: C }) => {
2404
2409
  for (const R of s)
2405
2410
  await l.request(be(`/pipelines/transitions/${R}`, { color: C }));
2406
2411
  },
2407
2412
  onSuccess: () => le(),
2408
- onError: () => T.error("Failed to update color")
2409
- }), [qe, ze] = $(null), Re = M({
2413
+ onError: () => P.error("Failed to update color")
2414
+ }), [qe, Qe] = $(null), Re = j({
2410
2415
  mutationFn: async ({
2411
2416
  from: s,
2412
2417
  label: C,
@@ -2423,92 +2428,92 @@ function kn({
2423
2428
  },
2424
2429
  onSuccess: (s, { label: C }) => {
2425
2430
  if ("pending" in s && s.pending) {
2426
- ze(s.pending);
2431
+ Qe(s.pending);
2427
2432
  return;
2428
2433
  }
2429
2434
  const R = "done" in s ? s.done.filter((G) => G.rewritten).length : 0;
2430
- le(), A(null), ze(null), T.success(
2435
+ le(), D(null), Qe(null), P.success(
2431
2436
  R ? `Renamed to "${C}" · ${R} reference${R === 1 ? "" : "s"} updated` : `Renamed to "${C}"`
2432
2437
  );
2433
2438
  },
2434
2439
  onError: (s) => {
2435
- Et(s, "Failed to rename");
2440
+ Rt(s, "Failed to rename");
2436
2441
  }
2437
- }), wt = M({
2442
+ }), _t = j({
2438
2443
  mutationFn: (s) => l.request(I(`/pipelines/${a}/bind`, s)),
2439
2444
  onSuccess: () => {
2440
- le(), i(""), E(""), T.success("Collection bound");
2445
+ le(), i(""), E(""), P.success("Collection bound");
2441
2446
  },
2442
- onError: () => T.error("Failed to bind collection")
2443
- }), sa = M({
2447
+ onError: () => P.error("Failed to bind collection")
2448
+ }), la = j({
2444
2449
  mutationFn: (s) => l.request($e(`/pipelines/bindings/${s}`)),
2445
2450
  onSuccess: () => {
2446
- le(), T.success("Collection unbound");
2451
+ le(), P.success("Collection unbound");
2447
2452
  },
2448
- onError: () => T.error("Failed to unbind")
2449
- }), at = M({
2453
+ onError: () => P.error("Failed to unbind")
2454
+ }), nt = j({
2450
2455
  mutationFn: ({
2451
2456
  bindingId: s,
2452
2457
  body: C
2453
2458
  }) => l.request(be(`/pipelines/bindings/${s}`, C)),
2454
2459
  onSuccess: () => le(),
2455
- onError: () => T.error("Failed to update binding")
2460
+ onError: () => P.error("Failed to update binding")
2456
2461
  });
2457
2462
  if (Q && !z)
2458
2463
  return /* @__PURE__ */ e(
2459
- Aa,
2464
+ La,
2460
2465
  {
2461
2466
  error: X,
2462
2467
  what: "this pipeline",
2463
2468
  onRetry: () => void de()
2464
2469
  }
2465
2470
  );
2466
- if (Me || !z)
2471
+ if (ze || !z)
2467
2472
  return /* @__PURE__ */ t("div", { className: "p-8 space-y-4", children: [
2468
2473
  /* @__PURE__ */ e(Ae, { className: "h-8 w-64" }),
2469
2474
  /* @__PURE__ */ e(Ae, { className: "h-48 rounded-xl" }),
2470
2475
  /* @__PURE__ */ e(Ae, { className: "h-48 rounded-xl" })
2471
2476
  ] });
2472
- const re = z.states ?? [], kt = z.transitions ?? [], ue = z.bindings ?? [], na = Zt ?? [], st = W.length > 0 ? W.map((s) => re.find((C) => C.id === s)).filter(Boolean) : re, _t = new Map(re.map((s) => [s.id, s])), nt = new Map(Dt(kt).map((s) => [s.label, s])), Ct = me.map((s) => nt.get(s)).filter((s) => !!s);
2473
- function St(s, C, R) {
2477
+ const re = z.states ?? [], Ct = z.transitions ?? [], ue = z.bindings ?? [], ra = ta ?? [], lt = U.length > 0 ? U.map((s) => re.find((C) => C.id === s)).filter(Boolean) : re, St = new Map(re.map((s) => [s.id, s])), rt = new Map(jt(Ct).map((s) => [s.label, s])), qt = me.map((s) => rt.get(s)).filter((s) => !!s);
2478
+ function $t(s, C, R) {
2474
2479
  const G = [];
2475
2480
  let ee = 0;
2476
2481
  for (const q of s) {
2477
- const D = R.get(q);
2478
- if (D)
2482
+ const K = R.get(q);
2483
+ if (K)
2479
2484
  for (const se of C[q] ?? []) {
2480
- const fe = D.routes.find((he) => he.ids[0] === se);
2485
+ const fe = K.routes.find((he) => he.ids[0] === se);
2481
2486
  if (fe) {
2482
2487
  for (const he of fe.ids) G.push({ id: he, sort: ee });
2483
2488
  ee++;
2484
2489
  }
2485
2490
  }
2486
2491
  }
2487
- ta.mutate(G);
2492
+ sa.mutate(G);
2488
2493
  }
2489
- function la(s) {
2494
+ function ia(s) {
2490
2495
  const { active: C, over: R } = s;
2491
2496
  if (!R || C.id === R.id) return;
2492
- const G = Ve(
2497
+ const G = Ge(
2493
2498
  me,
2494
2499
  me.indexOf(C.id),
2495
2500
  me.indexOf(R.id)
2496
2501
  );
2497
- xt(G), St(G, Ke, nt);
2502
+ gt(G), $t(G, Be, rt);
2498
2503
  }
2499
- function ra(s, C) {
2504
+ function oa(s, C) {
2500
2505
  const { active: R, over: G } = C;
2501
2506
  if (!G || R.id === G.id) return;
2502
- const ee = Ke[s] ?? [], q = Ve(ee, ee.indexOf(R.id), ee.indexOf(G.id)), D = { ...Ke, [s]: q };
2503
- ft(D), St(me, D, nt);
2507
+ const ee = Be[s] ?? [], q = Ge(ee, ee.indexOf(R.id), ee.indexOf(G.id)), K = { ...Be, [s]: q };
2508
+ bt(K), $t(me, K, rt);
2504
2509
  }
2505
- const ia = ue.some((s) => (s.dimensions ?? []).length > 0), oa = new Set(ue.map((s) => s.collection)), ca = na.filter((s) => !oa.has(s.collection)), da = (s) => {
2510
+ const ca = ue.some((s) => (s.dimensions ?? []).length > 0), da = new Set(ue.map((s) => s.collection)), ma = ra.filter((s) => !da.has(s.collection)), pa = (s) => {
2506
2511
  const { active: C, over: R } = s;
2507
2512
  if (!R || C.id === R.id) return;
2508
- const G = W.indexOf(C.id), ee = W.indexOf(R.id), q = Ve(W, G, ee);
2509
- te(q), q.forEach((D, se) => {
2513
+ const G = U.indexOf(C.id), ee = U.indexOf(R.id), q = Ge(U, G, ee);
2514
+ te(q), q.forEach((K, se) => {
2510
2515
  var fe;
2511
- ((fe = re.find((he) => he.id === D)) == null ? void 0 : fe.sort) !== se && tt.mutate({ stateId: D, body: { sort: se } });
2516
+ ((fe = re.find((he) => he.id === K)) == null ? void 0 : fe.sort) !== se && st.mutate({ stateId: K, body: { sort: se } });
2512
2517
  });
2513
2518
  };
2514
2519
  return /* @__PURE__ */ t(_e, { children: [
@@ -2522,7 +2527,7 @@ function kn({
2522
2527
  onClick: n,
2523
2528
  className: "flex items-center gap-1 text-slate-400 transition-colors hover:text-slate-700",
2524
2529
  children: [
2525
- /* @__PURE__ */ e(ma, { className: "h-3.5 w-3.5" }),
2530
+ /* @__PURE__ */ e(ua, { className: "h-3.5 w-3.5" }),
2526
2531
  "Pipelines"
2527
2532
  ]
2528
2533
  }
@@ -2534,11 +2539,11 @@ function kn({
2534
2539
  {
2535
2540
  className: "flex items-center gap-1.5",
2536
2541
  onSubmit: (s) => {
2537
- s.preventDefault(), v.trim() && et.mutate({ name: v.trim() });
2542
+ s.preventDefault(), v.trim() && at.mutate({ name: v.trim() });
2538
2543
  },
2539
2544
  children: [
2540
2545
  /* @__PURE__ */ e(
2541
- U,
2546
+ W,
2542
2547
  {
2543
2548
  autoFocus: !0,
2544
2549
  value: v,
@@ -2546,9 +2551,9 @@ function kn({
2546
2551
  className: "h-7 text-[13px] w-48"
2547
2552
  }
2548
2553
  ),
2549
- /* @__PURE__ */ e(P, { type: "submit", size: "sm", variant: "ghost", className: "h-7 px-1.5", children: /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) }),
2554
+ /* @__PURE__ */ e(T, { type: "submit", size: "sm", variant: "ghost", className: "h-7 px-1.5", children: /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) }),
2550
2555
  /* @__PURE__ */ e(
2551
- P,
2556
+ T,
2552
2557
  {
2553
2558
  type: "button",
2554
2559
  size: "sm",
@@ -2570,14 +2575,14 @@ function kn({
2570
2575
  },
2571
2576
  children: [
2572
2577
  z.name,
2573
- /* @__PURE__ */ e(Te, { className: "h-3 w-3 text-slate-400" })
2578
+ /* @__PURE__ */ e(Pe, { className: "h-3 w-3 text-slate-400" })
2574
2579
  ]
2575
2580
  }
2576
2581
  )
2577
2582
  ] }),
2578
2583
  /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
2579
2584
  !o.has("history") && /* @__PURE__ */ e(
2580
- Oa,
2585
+ Ta,
2581
2586
  {
2582
2587
  collection: "nivaro_workflow_templates",
2583
2588
  item: a,
@@ -2585,7 +2590,7 @@ function kn({
2585
2590
  }
2586
2591
  ),
2587
2592
  c && /* @__PURE__ */ t(
2588
- P,
2593
+ T,
2589
2594
  {
2590
2595
  size: "sm",
2591
2596
  variant: "outline",
@@ -2593,11 +2598,11 @@ function kn({
2593
2598
  try {
2594
2599
  await c();
2595
2600
  } catch {
2596
- T.error("Export failed");
2601
+ P.error("Export failed");
2597
2602
  }
2598
2603
  },
2599
2604
  children: [
2600
- /* @__PURE__ */ e(pa, { className: "mr-1.5 h-3.5 w-3.5" }),
2605
+ /* @__PURE__ */ e(ha, { className: "mr-1.5 h-3.5 w-3.5" }),
2601
2606
  " Export"
2602
2607
  ]
2603
2608
  }
@@ -2609,14 +2614,14 @@ function kn({
2609
2614
  /* @__PURE__ */ t("div", { className: "flex-1 space-y-1.5 min-w-0", children: [
2610
2615
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Description" }),
2611
2616
  /* @__PURE__ */ e(
2612
- U,
2617
+ W,
2613
2618
  {
2614
2619
  defaultValue: z.description ?? "",
2615
2620
  placeholder: "What does this pipeline govern?",
2616
2621
  className: "text-[13px]",
2617
2622
  onBlur: (s) => {
2618
2623
  const C = s.target.value.trim() || null;
2619
- C !== z.description && et.mutate({ description: C });
2624
+ C !== z.description && at.mutate({ description: C });
2620
2625
  }
2621
2626
  }
2622
2627
  )
@@ -2624,16 +2629,16 @@ function kn({
2624
2629
  /* @__PURE__ */ t("div", { className: "shrink-0 space-y-1.5", children: [
2625
2630
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Accent color" }),
2626
2631
  /* @__PURE__ */ e(
2627
- Ge,
2632
+ Je,
2628
2633
  {
2629
2634
  value: z.color,
2630
- onChange: (s) => et.mutate({ color: s })
2635
+ onChange: (s) => at.mutate({ color: s })
2631
2636
  }
2632
2637
  )
2633
2638
  ] })
2634
2639
  ] }),
2635
2640
  /* @__PURE__ */ e(
2636
- Ea,
2641
+ Ra,
2637
2642
  {
2638
2643
  kind: "config",
2639
2644
  params: { type: "pipeline", id: a },
@@ -2649,7 +2654,7 @@ function kn({
2649
2654
  /* @__PURE__ */ e("span", { className: "mt-0.5 block max-w-[72ch] text-[12px] font-normal text-slate-500", children: "The stages a record moves through, in order. Each can carry skip rules and stage-track visibility." })
2650
2655
  ] }),
2651
2656
  !d && /* @__PURE__ */ t(
2652
- P,
2657
+ T,
2653
2658
  {
2654
2659
  size: "sm",
2655
2660
  variant: "outline",
@@ -2664,39 +2669,37 @@ function kn({
2664
2669
  ] }),
2665
2670
  re.length === 0 && !d && /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-400", children: "No states yet. States define the stages a record can be in." }),
2666
2671
  /* @__PURE__ */ e(
2667
- Qe,
2672
+ We,
2668
2673
  {
2669
2674
  sensors: ae,
2670
- collisionDetection: We,
2671
- onDragEnd: da,
2672
- children: /* @__PURE__ */ e(Ue, { items: W, strategy: He, children: /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2673
- st.map((s) => {
2675
+ collisionDetection: He,
2676
+ onDragEnd: pa,
2677
+ children: /* @__PURE__ */ e(Ve, { items: U, strategy: Ye, children: /* @__PURE__ */ t("div", { className: "space-y-2", children: [
2678
+ lt.map((s) => {
2674
2679
  var C, R;
2675
2680
  return /* @__PURE__ */ t("div", { children: [
2676
2681
  (m == null ? void 0 : m.id) === s.id ? /* @__PURE__ */ e(
2677
- Tt,
2682
+ At,
2678
2683
  {
2679
2684
  initial: s,
2680
- saving: tt.isPending,
2681
- onSave: (G) => tt.mutate({ stateId: s.id, body: G }),
2685
+ saving: st.isPending,
2686
+ onSave: (G) => st.mutate({ stateId: s.id, body: G }),
2682
2687
  onCancel: () => f(null)
2683
2688
  }
2684
2689
  ) : /* @__PURE__ */ e(
2685
- xs,
2690
+ gs,
2686
2691
  {
2687
2692
  s,
2688
- groups: (Ze == null ? void 0 : Ze[s.id]) ?? [],
2693
+ groups: (tt == null ? void 0 : tt[s.id]) ?? [],
2689
2694
  expandedStateId: F,
2690
2695
  onToggleExpand: () => B(F === s.id ? null : s.id),
2691
2696
  onEdit: () => f(s),
2692
- onDelete: () => {
2693
- confirm(`Delete state "${s.label}"?`) && ea.mutate(s.id);
2694
- }
2697
+ onDelete: () => aa.mutate(s.id)
2695
2698
  }
2696
2699
  ),
2697
2700
  F === s.id && (m == null ? void 0 : m.id) !== s.id && /* @__PURE__ */ t("div", { className: "ml-4 mb-2 mt-2 rounded-xl border border-slate-200 bg-slate-50 p-4 space-y-4", children: [
2698
2701
  /* @__PURE__ */ e(
2699
- Ha,
2702
+ Ya,
2700
2703
  {
2701
2704
  stateId: s.id,
2702
2705
  stateName: s.label,
@@ -2705,7 +2708,7 @@ function kn({
2705
2708
  }
2706
2709
  ),
2707
2710
  /* @__PURE__ */ e("div", { className: "border-t border-slate-200 pt-4", children: /* @__PURE__ */ e(
2708
- Ua,
2711
+ Va,
2709
2712
  {
2710
2713
  stateId: s.id,
2711
2714
  stateName: s.label,
@@ -2718,11 +2721,11 @@ function kn({
2718
2721
  ] }, s.id);
2719
2722
  }),
2720
2723
  d && /* @__PURE__ */ e(
2721
- Tt,
2724
+ At,
2722
2725
  {
2723
2726
  initial: {},
2724
- saving: gt.isPending,
2725
- onSave: (s) => gt.mutate({ ...s, sort: re.length }),
2727
+ saving: yt.isPending,
2728
+ onSave: (s) => yt.mutate({ ...s, sort: re.length }),
2726
2729
  onCancel: () => N(!1)
2727
2730
  }
2728
2731
  )
@@ -2734,11 +2737,11 @@ function kn({
2734
2737
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
2735
2738
  /* @__PURE__ */ t("h2", { className: "text-[13px] font-semibold text-slate-800", children: [
2736
2739
  "Transitions",
2737
- /* @__PURE__ */ e("span", { className: "ml-2 font-mono text-[11px] font-normal text-slate-400", children: kt.length }),
2740
+ /* @__PURE__ */ e("span", { className: "ml-2 font-mono text-[11px] font-normal text-slate-400", children: Ct.length }),
2738
2741
  /* @__PURE__ */ e("span", { className: "mt-0.5 block max-w-[72ch] text-[12px] font-normal text-slate-500", children: "The allowed moves between states — who may take them, the conditions that gate them, and the actions they fire." })
2739
2742
  ] }),
2740
2743
  !b && /* @__PURE__ */ t(
2741
- P,
2744
+ T,
2742
2745
  {
2743
2746
  size: "sm",
2744
2747
  variant: "outline",
@@ -2755,19 +2758,19 @@ function kn({
2755
2758
  re.length < 2 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Add at least 2 states before defining transitions." }),
2756
2759
  /* @__PURE__ */ t("div", { className: "space-y-3", children: [
2757
2760
  /* @__PURE__ */ e(
2758
- Qe,
2761
+ We,
2759
2762
  {
2760
2763
  sensors: ae,
2761
- collisionDetection: We,
2762
- onDragEnd: la,
2763
- children: /* @__PURE__ */ e(Ue, { items: me, strategy: He, children: Ct.map((s) => {
2764
+ collisionDetection: He,
2765
+ onDragEnd: ia,
2766
+ children: /* @__PURE__ */ e(Ve, { items: me, strategy: Ye, children: qt.map((s) => {
2764
2767
  var ee;
2765
- const C = new Map(s.routes.map((q) => [q.ids[0], q])), R = Ke[s.label] ?? s.routes.map((q) => q.ids[0]), G = R.map((q) => C.get(q)).filter((q) => !!q);
2766
- return /* @__PURE__ */ e(Lt, { id: s.label, children: /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white", children: [
2768
+ const C = new Map(s.routes.map((q) => [q.ids[0], q])), R = Be[s.label] ?? s.routes.map((q) => q.ids[0]), G = R.map((q) => C.get(q)).filter((q) => !!q);
2769
+ return /* @__PURE__ */ e(Mt, { id: s.label, children: /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white", children: [
2767
2770
  /* @__PURE__ */ t("div", { className: "group/hdr flex items-center gap-2.5 border-b border-slate-100 bg-slate-50/60 px-3 py-2", children: [
2768
- /* @__PURE__ */ e(jt, {}),
2769
- /* @__PURE__ */ t(De, { children: [
2770
- /* @__PURE__ */ e(Le, { asChild: !0, children: /* @__PURE__ */ e(
2771
+ /* @__PURE__ */ e(Kt, {}),
2772
+ /* @__PURE__ */ t(je, { children: [
2773
+ /* @__PURE__ */ e(Me, { asChild: !0, children: /* @__PURE__ */ e(
2771
2774
  "button",
2772
2775
  {
2773
2776
  type: "button",
@@ -2777,7 +2780,7 @@ function kn({
2777
2780
  }
2778
2781
  ) }),
2779
2782
  /* @__PURE__ */ t(
2780
- je,
2783
+ Ke,
2781
2784
  {
2782
2785
  align: "start",
2783
2786
  className: "w-auto p-3",
@@ -2785,12 +2788,12 @@ function kn({
2785
2788
  children: [
2786
2789
  /* @__PURE__ */ e("p", { className: "mb-2 text-[11px] font-medium text-slate-500", children: "Group color" }),
2787
2790
  /* @__PURE__ */ e(
2788
- Ge,
2791
+ Je,
2789
2792
  {
2790
2793
  value: s.color,
2791
2794
  onChange: (q) => {
2792
- const D = s.routes.flatMap((se) => se.ids);
2793
- aa.mutate({ ids: D, color: q });
2795
+ const K = s.routes.flatMap((se) => se.ids);
2796
+ na.mutate({ ids: K, color: q });
2794
2797
  }
2795
2798
  }
2796
2799
  )
@@ -2799,9 +2802,9 @@ function kn({
2799
2802
  )
2800
2803
  ] }),
2801
2804
  (S == null ? void 0 : S.from) === s.label ? (() => {
2802
- const q = S.value, D = q.trim(), se = D !== s.label && Ct.some((ie) => ie.label === D), fe = D.length > 0 && D !== s.label && !se, he = () => {
2803
- !fe || Re.isPending || (qe && qe.to !== D && ze(null), Re.mutate({ from: s.label, label: D }));
2804
- }, ne = (qe == null ? void 0 : qe.from) === s.label && qe.to === D ? qe.references : null;
2805
+ const q = S.value, K = q.trim(), se = K !== s.label && qt.some((ie) => ie.label === K), fe = K.length > 0 && K !== s.label && !se, he = () => {
2806
+ !fe || Re.isPending || (qe && qe.to !== K && Qe(null), Re.mutate({ from: s.label, label: K }));
2807
+ }, ne = (qe == null ? void 0 : qe.from) === s.label && qe.to === K ? qe.references : null;
2805
2808
  return /* @__PURE__ */ t(
2806
2809
  "div",
2807
2810
  {
@@ -2809,16 +2812,16 @@ function kn({
2809
2812
  "data-transition-rename": s.label,
2810
2813
  children: [
2811
2814
  /* @__PURE__ */ e(
2812
- U,
2815
+ W,
2813
2816
  {
2814
2817
  autoFocus: !0,
2815
2818
  value: q,
2816
- onChange: (ie) => A({
2819
+ onChange: (ie) => D({
2817
2820
  from: s.label,
2818
2821
  value: ie.target.value
2819
2822
  }),
2820
2823
  onKeyDown: (ie) => {
2821
- ie.key === "Enter" && (ie.preventDefault(), he()), ie.key === "Escape" && A(null);
2824
+ ie.key === "Enter" && (ie.preventDefault(), he()), ie.key === "Escape" && D(null);
2822
2825
  },
2823
2826
  "aria-label": "Button label",
2824
2827
  className: "h-7 max-w-[260px] text-[13px] font-semibold"
@@ -2841,7 +2844,7 @@ function kn({
2841
2844
  {
2842
2845
  type: "button",
2843
2846
  onClick: () => {
2844
- A(null), ze(null);
2847
+ D(null), Qe(null);
2845
2848
  },
2846
2849
  title: "Cancel (Esc)",
2847
2850
  className: "rounded p-1 text-slate-400 hover:bg-slate-100",
@@ -2863,7 +2866,7 @@ function kn({
2863
2866
  "“",
2864
2867
  s.label,
2865
2868
  "” — they will be updated to “",
2866
- D,
2869
+ K,
2867
2870
  "”:"
2868
2871
  ] }),
2869
2872
  /* @__PURE__ */ e("ul", { className: "mt-1 list-disc pl-4", children: ne.map((ie) => /* @__PURE__ */ e("li", { children: ie.description }, `${ie.kind}:${ie.id}`)) }),
@@ -2873,7 +2876,7 @@ function kn({
2873
2876
  type: "button",
2874
2877
  onClick: () => Re.mutate({
2875
2878
  from: s.label,
2876
- label: D,
2879
+ label: K,
2877
2880
  confirmed: !0
2878
2881
  }),
2879
2882
  disabled: Re.isPending,
@@ -2897,11 +2900,11 @@ function kn({
2897
2900
  "button",
2898
2901
  {
2899
2902
  type: "button",
2900
- onClick: () => A({ from: s.label, value: s.label }),
2903
+ onClick: () => D({ from: s.label, value: s.label }),
2901
2904
  title: "Rename this button",
2902
2905
  "aria-label": `Rename ${s.label}`,
2903
2906
  className: "rounded p-1 text-slate-300 opacity-0 hover:text-slate-600 group-hover/hdr:opacity-100 transition-opacity",
2904
- children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
2907
+ children: /* @__PURE__ */ e(Pe, { className: "h-3 w-3" })
2905
2908
  }
2906
2909
  ),
2907
2910
  /* @__PURE__ */ e("span", { className: "flex-1" })
@@ -2924,38 +2927,38 @@ function kn({
2924
2927
  }
2925
2928
  ),
2926
2929
  /* @__PURE__ */ e(
2927
- "button",
2930
+ De,
2928
2931
  {
2929
- type: "button",
2930
- onClick: () => {
2931
- const q = s.routes.flatMap((D) => D.ids);
2932
- confirm(`Delete all routes for "${s.label}"?`) && Nt.mutate(q);
2933
- },
2932
+ onConfirm: () => kt.mutate(s.routes.flatMap((q) => q.ids)),
2933
+ title: "Delete all routes",
2934
+ confirmLabel: "Delete all?",
2935
+ confirmTitle: `Delete all routes for "${s.label}"?`,
2934
2936
  className: "rounded p-1 text-slate-300 opacity-0 hover:text-red-500 group-hover/hdr:opacity-100 transition-opacity",
2937
+ armedClassName: J(Le, "opacity-100"),
2935
2938
  children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
2936
2939
  }
2937
2940
  )
2938
2941
  ] }),
2939
2942
  /* @__PURE__ */ e(
2940
- Qe,
2943
+ We,
2941
2944
  {
2942
2945
  sensors: ae,
2943
- collisionDetection: We,
2944
- onDragEnd: (q) => ra(s.label, q),
2946
+ collisionDetection: He,
2947
+ onDragEnd: (q) => oa(s.label, q),
2945
2948
  children: /* @__PURE__ */ e(
2946
- Ue,
2949
+ Ve,
2947
2950
  {
2948
2951
  items: R,
2949
- strategy: He,
2952
+ strategy: Ye,
2950
2953
  children: G.map((q) => {
2951
2954
  var he;
2952
- const D = `${s.label}|${q.from_state ?? "_any_"}|${q.ids[0]}`, se = q.from_state ? _t.get(q.from_state) : null;
2953
- return (L == null ? void 0 : L.label) === s.label && L.route.ids[0] === q.ids[0] ? /* @__PURE__ */ e(
2955
+ const K = `${s.label}|${q.from_state ?? "_any_"}|${q.ids[0]}`, se = q.from_state ? St.get(q.from_state) : null;
2956
+ return (A == null ? void 0 : A.label) === s.label && A.route.ids[0] === q.ids[0] ? /* @__PURE__ */ e(
2954
2957
  "div",
2955
2958
  {
2956
2959
  className: "border-b border-slate-100 last:border-0 p-3",
2957
2960
  children: /* @__PURE__ */ e(
2958
- it,
2961
+ ct,
2959
2962
  {
2960
2963
  initial: {
2961
2964
  from_state: q.from_state,
@@ -2980,23 +2983,23 @@ function kn({
2980
2983
  fixedLabel: s.label,
2981
2984
  states: re,
2982
2985
  collection: (he = ue[0]) == null ? void 0 : he.collection,
2983
- saving: vt.isPending,
2984
- onSave: (ne) => vt.mutate({ route: q, data: ne }),
2986
+ saving: wt.isPending,
2987
+ onSave: (ne) => wt.mutate({ route: q, data: ne }),
2985
2988
  onCancel: () => O(null)
2986
2989
  }
2987
2990
  )
2988
2991
  },
2989
- D
2990
- ) : /* @__PURE__ */ e(Lt, { id: q.ids[0], children: /* @__PURE__ */ t("div", { className: "group/row flex items-center gap-2 border-b border-slate-100 px-3 py-2 last:border-0 hover:bg-slate-50", children: [
2991
- /* @__PURE__ */ e(jt, {}),
2992
+ K
2993
+ ) : /* @__PURE__ */ e(Mt, { id: q.ids[0], children: /* @__PURE__ */ t("div", { className: "group/row flex items-center gap-2 border-b border-slate-100 px-3 py-2 last:border-0 hover:bg-slate-50", children: [
2994
+ /* @__PURE__ */ e(Kt, {}),
2992
2995
  /* @__PURE__ */ t("div", { className: "flex flex-1 min-w-0 flex-wrap items-center gap-1.5 text-[12px]", children: [
2993
- se ? /* @__PURE__ */ e(Pt, { state: se }) : /* @__PURE__ */ e("span", { className: "italic text-slate-400 text-[11px]", children: "any state" }),
2994
- /* @__PURE__ */ e(Wt, { className: "h-3 w-3 text-slate-300 shrink-0" }),
2996
+ se ? /* @__PURE__ */ e(Dt, { state: se }) : /* @__PURE__ */ e("span", { className: "italic text-slate-400 text-[11px]", children: "any state" }),
2997
+ /* @__PURE__ */ e(Ht, { className: "h-3 w-3 text-slate-300 shrink-0" }),
2995
2998
  q.to_states.map((ne, ie) => {
2996
- const $t = _t.get(ne);
2997
- return $t ? /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
2999
+ const Et = St.get(ne);
3000
+ return Et ? /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
2998
3001
  ie > 0 && /* @__PURE__ */ e("span", { className: "text-slate-300", children: "·" }),
2999
- /* @__PURE__ */ e(Pt, { state: $t, small: !0 })
3002
+ /* @__PURE__ */ e(Dt, { state: Et, small: !0 })
3000
3003
  ] }, ne) : null;
3001
3004
  }),
3002
3005
  q.auto_trigger && /* @__PURE__ */ t(
@@ -3005,7 +3008,7 @@ function kn({
3005
3008
  className: "ml-1 inline-flex items-center gap-1 rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",
3006
3009
  title: "Automatic — fired by the engine when conditions match; hidden from users",
3007
3010
  children: [
3008
- /* @__PURE__ */ e(ua, { className: "h-2.5 w-2.5" }),
3011
+ /* @__PURE__ */ e(xa, { className: "h-2.5 w-2.5" }),
3009
3012
  "Auto"
3010
3013
  ]
3011
3014
  }
@@ -3042,7 +3045,7 @@ function kn({
3042
3045
  className: "ml-1 inline-flex items-center gap-1 rounded-full bg-teal-100 px-1.5 py-0.5 text-[10px] font-semibold text-teal-700 dark:bg-teal-900/30 dark:text-teal-400",
3043
3046
  title: "Transition actions run after this transition lands",
3044
3047
  children: [
3045
- /* @__PURE__ */ e(ha, { className: "h-2.5 w-2.5" }),
3048
+ /* @__PURE__ */ e(fa, { className: "h-2.5 w-2.5" }),
3046
3049
  (q.actions ?? []).length
3047
3050
  ]
3048
3051
  }
@@ -3055,49 +3058,50 @@ function kn({
3055
3058
  (ne) => `${ne.field} ${ne.op} ${String(ne.value ?? "")}`
3056
3059
  ).join(" AND "),
3057
3060
  children: [
3058
- /* @__PURE__ */ e(mt, { className: "h-2.5 w-2.5" }),
3061
+ /* @__PURE__ */ e(ut, { className: "h-2.5 w-2.5" }),
3059
3062
  (q.condition_rules ?? []).length
3060
3063
  ]
3061
3064
  }
3062
3065
  )
3063
3066
  ] }),
3064
- /* @__PURE__ */ t("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100", children: [
3067
+ /* @__PURE__ */ t("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100 [&:has([data-armed])]:opacity-100", children: [
3065
3068
  /* @__PURE__ */ e(
3066
3069
  "button",
3067
3070
  {
3068
3071
  type: "button",
3069
3072
  onClick: () => O({ label: s.label, route: q }),
3070
3073
  className: "rounded p-1 text-slate-400 hover:text-slate-700",
3071
- children: /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" })
3074
+ children: /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" })
3072
3075
  }
3073
3076
  ),
3074
3077
  /* @__PURE__ */ e(
3075
- "button",
3078
+ De,
3076
3079
  {
3077
- type: "button",
3078
- onClick: () => {
3079
- confirm("Delete this route?") && Nt.mutate(q.ids);
3080
- },
3080
+ onConfirm: () => kt.mutate(q.ids),
3081
+ title: "Delete route",
3082
+ confirmLabel: "Delete?",
3083
+ confirmTitle: "Delete this route?",
3081
3084
  className: "rounded p-1 text-slate-400 hover:text-red-500",
3085
+ armedClassName: Le,
3082
3086
  children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
3083
3087
  }
3084
3088
  )
3085
3089
  ] })
3086
- ] }) }, D);
3090
+ ] }) }, K);
3087
3091
  })
3088
3092
  }
3089
3093
  )
3090
3094
  }
3091
3095
  ),
3092
3096
  w === s.label && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 p-3", children: /* @__PURE__ */ e(
3093
- it,
3097
+ ct,
3094
3098
  {
3095
3099
  initial: { color: s.color },
3096
3100
  fixedLabel: s.label,
3097
3101
  states: re,
3098
3102
  collection: (ee = ue[0]) == null ? void 0 : ee.collection,
3099
- saving: yt.isPending,
3100
- onSave: (q) => yt.mutate({ labelGroup: s, data: q }),
3103
+ saving: Nt.isPending,
3104
+ onSave: (q) => Nt.mutate({ labelGroup: s, data: q }),
3101
3105
  onCancel: () => k(null)
3102
3106
  }
3103
3107
  ) })
@@ -3106,20 +3110,20 @@ function kn({
3106
3110
  }
3107
3111
  ),
3108
3112
  b && /* @__PURE__ */ e(
3109
- it,
3113
+ ct,
3110
3114
  {
3111
3115
  initial: {},
3112
3116
  states: re,
3113
- collection: (qt = ue[0]) == null ? void 0 : qt.collection,
3114
- saving: bt.isPending,
3115
- onSave: (s) => bt.mutate(s),
3117
+ collection: (Ft = ue[0]) == null ? void 0 : Ft.collection,
3118
+ saving: vt.isPending,
3119
+ onSave: (s) => vt.mutate(s),
3116
3120
  onCancel: () => p(!1)
3117
3121
  }
3118
3122
  )
3119
3123
  ] })
3120
3124
  ] })
3121
3125
  ] }),
3122
- !o.has("branches") && /* @__PURE__ */ e(Ss, { templateId: a, states: st }),
3126
+ !o.has("branches") && /* @__PURE__ */ e($s, { templateId: a, states: lt }),
3123
3127
  !o.has("bindings") && /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4", children: [
3124
3128
  /* @__PURE__ */ t("h2", { className: "text-[13px] font-semibold text-slate-800", children: [
3125
3129
  "Applied to Collections",
@@ -3129,7 +3133,7 @@ function kn({
3129
3133
  var C;
3130
3134
  return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white", children: [
3131
3135
  /* @__PURE__ */ t("div", { className: "flex items-center gap-3 px-4 py-3", children: [
3132
- /* @__PURE__ */ e("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-slate-100", children: /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5 text-slate-500" }) }),
3136
+ /* @__PURE__ */ e("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-slate-100", children: /* @__PURE__ */ e(Ot, { className: "h-3.5 w-3.5 text-slate-500" }) }),
3133
3137
  /* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: [
3134
3138
  /* @__PURE__ */ e("span", { className: "font-mono text-[13px] font-medium text-slate-800", children: s.collection }),
3135
3139
  s.state_field && /* @__PURE__ */ t("div", { className: "mt-0.5 text-[11px] text-slate-400", children: [
@@ -3144,7 +3148,7 @@ function kn({
3144
3148
  {
3145
3149
  type: "checkbox",
3146
3150
  checked: !!s.auto_start,
3147
- onChange: (R) => at.mutate({
3151
+ onChange: (R) => nt.mutate({
3148
3152
  bindingId: s.id,
3149
3153
  body: {
3150
3154
  auto_start: R.target.checked,
@@ -3159,10 +3163,10 @@ function kn({
3159
3163
  /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
3160
3164
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Owner fallback:" }),
3161
3165
  /* @__PURE__ */ e(
3162
- ks,
3166
+ Cs,
3163
3167
  {
3164
3168
  value: s.owner_fallback_field ?? "",
3165
- onCommit: (R) => at.mutate({
3169
+ onCommit: (R) => nt.mutate({
3166
3170
  bindingId: s.id,
3167
3171
  body: { owner_fallback_field: R || null }
3168
3172
  })
@@ -3175,7 +3179,7 @@ function kn({
3175
3179
  pe,
3176
3180
  {
3177
3181
  value: s.auto_start_state ?? "",
3178
- onChange: (R) => at.mutate({
3182
+ onChange: (R) => nt.mutate({
3179
3183
  bindingId: s.id,
3180
3184
  body: { auto_start: !0, auto_start_state: R || null }
3181
3185
  }),
@@ -3196,15 +3200,15 @@ function kn({
3196
3200
  "button",
3197
3201
  {
3198
3202
  type: "button",
3199
- onClick: () => Xe(ce === s.id ? null : s.id),
3203
+ onClick: () => et(ce === s.id ? null : s.id),
3200
3204
  className: J(
3201
3205
  "flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[12px] font-medium transition-colors",
3202
3206
  ce === s.id ? "bg-nvr-cyan/10 text-nvr-cyan" : "text-slate-500 hover:bg-slate-100 hover:text-slate-700"
3203
3207
  ),
3204
3208
  "aria-label": "Configure matrix dimensions",
3205
3209
  children: [
3206
- /* @__PURE__ */ e(xa, { className: "h-3.5 w-3.5" }),
3207
- /* @__PURE__ */ e(Ot, { id: "dimension", children: "Dimensions" }),
3210
+ /* @__PURE__ */ e(ga, { className: "h-3.5 w-3.5" }),
3211
+ /* @__PURE__ */ e(Tt, { id: "dimension", children: "Dimensions" }),
3208
3212
  (s.dimensions ?? []).length > 0 && /* @__PURE__ */ t("span", { className: "font-mono text-[10px] opacity-70", children: [
3209
3213
  "(",
3210
3214
  (C = s.dimensions) == null ? void 0 : C.length,
@@ -3214,20 +3218,20 @@ function kn({
3214
3218
  }
3215
3219
  ),
3216
3220
  /* @__PURE__ */ e(
3217
- "button",
3221
+ De,
3218
3222
  {
3219
- type: "button",
3220
- onClick: () => {
3221
- confirm(`Unbind "${s.collection}"?`) && sa.mutate(s.id);
3222
- },
3223
- className: "rounded p-1.5 text-slate-400 hover:text-red-500 transition-colors",
3223
+ onConfirm: () => la.mutate(s.id),
3224
3224
  title: "Unbind collection",
3225
- children: /* @__PURE__ */ e(fa, { className: "h-3.5 w-3.5" })
3225
+ confirmLabel: "Unbind?",
3226
+ confirmTitle: `Unbind "${s.collection}"?`,
3227
+ className: "rounded p-1.5 text-slate-400 hover:text-red-500 transition-colors",
3228
+ armedClassName: Le,
3229
+ children: /* @__PURE__ */ e(ba, { className: "h-3.5 w-3.5" })
3226
3230
  }
3227
3231
  )
3228
3232
  ] })
3229
3233
  ] }),
3230
- ce === s.id && /* @__PURE__ */ e(bs, { binding: s, templateId: a })
3234
+ ce === s.id && /* @__PURE__ */ e(vs, { binding: s, templateId: a })
3231
3235
  ] }, s.id);
3232
3236
  }) }),
3233
3237
  /* @__PURE__ */ t("div", { className: "space-y-2 pt-2", children: [
@@ -3237,7 +3241,7 @@ function kn({
3237
3241
  {
3238
3242
  value: y,
3239
3243
  onChange: i,
3240
- options: ca.map((s) => ({
3244
+ options: ma.map((s) => ({
3241
3245
  value: s.collection,
3242
3246
  label: s.display_name ?? s.collection
3243
3247
  })),
@@ -3260,19 +3264,19 @@ function kn({
3260
3264
  }
3261
3265
  ),
3262
3266
  /* @__PURE__ */ t(
3263
- P,
3267
+ T,
3264
3268
  {
3265
3269
  type: "button",
3266
3270
  size: "sm",
3267
3271
  variant: "outline",
3268
3272
  className: "shrink-0 gap-1.5",
3269
- disabled: !y || wt.isPending,
3270
- onClick: () => wt.mutate({
3273
+ disabled: !y || _t.isPending,
3274
+ onClick: () => _t.mutate({
3271
3275
  collection: y,
3272
3276
  state_field: _.trim() || void 0
3273
3277
  }),
3274
3278
  children: [
3275
- /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5" }),
3279
+ /* @__PURE__ */ e(Ot, { className: "h-3.5 w-3.5" }),
3276
3280
  "Bind"
3277
3281
  ]
3278
3282
  }
@@ -3284,55 +3288,55 @@ function kn({
3284
3288
  ] })
3285
3289
  ] })
3286
3290
  ] }),
3287
- !o.has("matrix") && ia && /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4", children: [
3291
+ !o.has("matrix") && ca && /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4", children: [
3288
3292
  /* @__PURE__ */ t("div", { className: "flex items-start justify-between gap-4", children: [
3289
3293
  /* @__PURE__ */ t("h2", { className: "text-[13px] font-semibold text-slate-800", children: [
3290
- /* @__PURE__ */ e(Ot, { id: "owner-matrix", children: "Owner Matrix" }),
3294
+ /* @__PURE__ */ e(Tt, { id: "owner-matrix", children: "Owner Matrix" }),
3291
3295
  /* @__PURE__ */ e("span", { className: "mt-0.5 block max-w-[72ch] text-[12px] font-normal text-slate-500", children: "Who is responsible in each state, per dimension value. Records resolve their owners from this grid automatically — notifications, queues, and SLAs follow it." })
3292
3296
  ] }),
3293
3297
  /* @__PURE__ */ t(
3294
- P,
3298
+ T,
3295
3299
  {
3296
3300
  size: "sm",
3297
3301
  variant: "outline",
3298
3302
  className: "h-7 shrink-0 gap-1.5 text-[12px]",
3299
- onClick: () => K(!0),
3303
+ onClick: () => M(!0),
3300
3304
  children: [
3301
- /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" }),
3305
+ /* @__PURE__ */ e(Vt, { className: "h-3.5 w-3.5" }),
3302
3306
  " Manage teams"
3303
3307
  ]
3304
3308
  }
3305
3309
  )
3306
3310
  ] }),
3307
- /* @__PURE__ */ e(za, { templateId: a, states: st, bindings: ue })
3311
+ /* @__PURE__ */ e(Qa, { templateId: a, states: lt, bindings: ue })
3308
3312
  ] }),
3309
- j && /* @__PURE__ */ e(Ds, { onClose: () => K(!1) }),
3310
- !o.has("simulator") && /* @__PURE__ */ e(qs, { bindings: ue }),
3311
- !o.has("canvas") && /* @__PURE__ */ e(Ps, { templateId: a }),
3312
- !o.has("flow-map") && /* @__PURE__ */ e(Ts, { templateId: a }),
3313
- !o.has("cumulative-flow") && /* @__PURE__ */ e(Pa, { templateId: a }),
3314
- !o.has("replay") && /* @__PURE__ */ e(As, { templateId: a }),
3315
- !o.has("migration") && /* @__PURE__ */ e(Rs, { templateId: a }),
3316
- !o.has("lint") && /* @__PURE__ */ e(Qa, { templateId: a }),
3317
- !o.has("coverage") && /* @__PURE__ */ e(Es, { templateId: a, states: re }),
3318
- !o.has("skip-report") && /* @__PURE__ */ e(Wa, { templateId: a }),
3319
- !o.has("ai-review") && /* @__PURE__ */ e(ys, { templateId: a }),
3320
- !o.has("versions") && /* @__PURE__ */ e(vs, { templateId: a }),
3321
- !o.has("matrix-versions") && /* @__PURE__ */ e(Ba, { templateId: a })
3313
+ L && /* @__PURE__ */ e(js, { onClose: () => M(!1) }),
3314
+ !o.has("simulator") && /* @__PURE__ */ e(Fs, { bindings: ue }),
3315
+ !o.has("canvas") && /* @__PURE__ */ e(Ds, { templateId: a }),
3316
+ !o.has("flow-map") && /* @__PURE__ */ e(As, { templateId: a }),
3317
+ !o.has("cumulative-flow") && /* @__PURE__ */ e(Da, { templateId: a }),
3318
+ !o.has("replay") && /* @__PURE__ */ e(Ls, { templateId: a }),
3319
+ !o.has("migration") && /* @__PURE__ */ e(Ps, { templateId: a }),
3320
+ !o.has("lint") && /* @__PURE__ */ e(Wa, { templateId: a }),
3321
+ !o.has("coverage") && /* @__PURE__ */ e(Rs, { templateId: a, states: re }),
3322
+ !o.has("skip-report") && /* @__PURE__ */ e(Ha, { templateId: a }),
3323
+ !o.has("ai-review") && /* @__PURE__ */ e(Ns, { templateId: a }),
3324
+ !o.has("versions") && /* @__PURE__ */ e(ws, { templateId: a }),
3325
+ !o.has("matrix-versions") && /* @__PURE__ */ e(Ua, { templateId: a })
3322
3326
  ] })
3323
3327
  ] });
3324
3328
  }
3325
- function ys({ templateId: a }) {
3329
+ function Ns({ templateId: a }) {
3326
3330
  const n = Z(), [c, g] = $(
3327
3331
  null
3328
- ), l = M({
3332
+ ), l = j({
3329
3333
  mutationFn: () => n.request(
3330
3334
  I(`/pipelines/${a}/ai-review`)
3331
3335
  ).then((x) => x.data),
3332
3336
  onSuccess: g,
3333
3337
  onError: (x) => {
3334
3338
  var o;
3335
- return T.error(
3339
+ return P.error(
3336
3340
  ((o = x == null ? void 0 : x.response) == null ? void 0 : o.error) ?? (x == null ? void 0 : x.message) ?? "Review failed"
3337
3341
  );
3338
3342
  }
@@ -3344,7 +3348,7 @@ function ys({ templateId: a }) {
3344
3348
  /* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[72ch] text-[12px] text-slate-500", children: "Structure analysis (unreachable states, dead ends, missing send-backs, unowned states) plus an AI critique of the state graph." })
3345
3349
  ] }),
3346
3350
  /* @__PURE__ */ e(
3347
- P,
3351
+ T,
3348
3352
  {
3349
3353
  type: "button",
3350
3354
  size: "sm",
@@ -3365,7 +3369,7 @@ function ys({ templateId: a }) {
3365
3369
  ] })
3366
3370
  ] });
3367
3371
  }
3368
- function vs({ templateId: a }) {
3372
+ function ws({ templateId: a }) {
3369
3373
  const n = Z(), c = ke(), [g, l] = $(null), [x, o] = $(null), { data: r, isFetching: h } = H({
3370
3374
  queryKey: ["pipeline-version-diff", a, x],
3371
3375
  queryFn: () => n.request(V(`/pipelines/${a}/versions/${x}/diff`)).then((N) => N.data),
@@ -3373,21 +3377,21 @@ function vs({ templateId: a }) {
3373
3377
  }), { data: v, isLoading: u } = H({
3374
3378
  queryKey: ["pipeline-versions", a],
3375
3379
  queryFn: () => n.request(V(`/pipelines/${a}/versions`)).then((N) => N.data)
3376
- }), d = M({
3380
+ }), d = j({
3377
3381
  mutationFn: (N) => n.request(I(`/pipelines/${a}/versions/${N}/restore`)),
3378
3382
  onSuccess: (N) => {
3379
3383
  var f, b;
3380
3384
  l(null);
3381
3385
  const m = ((b = (f = N == null ? void 0 : N.data) == null ? void 0 : f.transitions) == null ? void 0 : b.kept_in_history) ?? 0;
3382
- T.success(
3386
+ P.success(
3383
3387
  m > 0 ? `Version restored — ${m} extra transition(s) kept (referenced by history)` : "Version restored"
3384
3388
  ), c.invalidateQueries({ queryKey: ["pipeline", a] }), c.invalidateQueries({ queryKey: ["pipeline-versions", a] });
3385
3389
  },
3386
- onError: () => T.error("Failed to restore version")
3390
+ onError: () => P.error("Failed to restore version")
3387
3391
  });
3388
3392
  return /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-3", children: [
3389
3393
  /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
3390
- /* @__PURE__ */ e(ya, { className: "h-4 w-4 text-slate-400" }),
3394
+ /* @__PURE__ */ e(Na, { className: "h-4 w-4 text-slate-400" }),
3391
3395
  /* @__PURE__ */ e("h2", { className: "text-[13px] font-semibold text-slate-800", children: "Config versions" }),
3392
3396
  v && v.length > 0 && /* @__PURE__ */ e("span", { className: "ml-auto rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-500 dark:bg-muted dark:text-muted-foreground", children: v.length })
3393
3397
  ] }),
@@ -3405,10 +3409,10 @@ function vs({ templateId: a }) {
3405
3409
  N.note ?? "—",
3406
3410
  (m = N.created_by_name) != null && m.trim() ? ` · ${N.created_by_name}` : ""
3407
3411
  ] }),
3408
- /* @__PURE__ */ e("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: $a(N.created_at) }),
3412
+ /* @__PURE__ */ e("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: Ea(N.created_at) }),
3409
3413
  g === N.id ? /* @__PURE__ */ t("span", { className: "flex shrink-0 items-center gap-1.5", children: [
3410
3414
  /* @__PURE__ */ e(
3411
- P,
3415
+ T,
3412
3416
  {
3413
3417
  size: "sm",
3414
3418
  variant: "destructive",
@@ -3419,7 +3423,7 @@ function vs({ templateId: a }) {
3419
3423
  }
3420
3424
  ),
3421
3425
  /* @__PURE__ */ e(
3422
- P,
3426
+ T,
3423
3427
  {
3424
3428
  size: "sm",
3425
3429
  variant: "outline",
@@ -3450,16 +3454,16 @@ function vs({ templateId: a }) {
3450
3454
  ] })
3451
3455
  ] }, N.id);
3452
3456
  }) }),
3453
- x != null && /* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-3 dark:border-border dark:bg-muted/30", children: h ? /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-400", children: "Comparing…" }) : r ? /* @__PURE__ */ e(Ns, { fromVersion: r.from_version, to: r.to, diff: r.diff }) : /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-400", children: "Could not load the diff." }) }),
3457
+ x != null && /* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-3 dark:border-border dark:bg-muted/30", children: h ? /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-400", children: "Comparing…" }) : r ? /* @__PURE__ */ e(ks, { fromVersion: r.from_version, to: r.to, diff: r.diff }) : /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-400", children: "Could not load the diff." }) }),
3454
3458
  /* @__PURE__ */ e("p", { className: "text-[10.5px] text-slate-400", children: "Restore snapshots the current config first, then upserts states/transitions/bindings by id — states are never deleted, and transitions with execution history are kept." })
3455
3459
  ] });
3456
3460
  }
3457
- function Be(a) {
3461
+ function Ue(a) {
3458
3462
  if (a == null || a === "") return "(empty)";
3459
3463
  const n = typeof a == "string" ? a : JSON.stringify(a);
3460
3464
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
3461
3465
  }
3462
- function Ns({
3466
+ function ks({
3463
3467
  fromVersion: a,
3464
3468
  to: n,
3465
3469
  diff: c
@@ -3487,10 +3491,10 @@ function Ns({
3487
3491
  /* @__PURE__ */ e("span", { className: "font-mono", children: x.field }),
3488
3492
  ":",
3489
3493
  " ",
3490
- /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: Be(x.from) }),
3494
+ /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: Ue(x.from) }),
3491
3495
  " ",
3492
3496
  "→ ",
3493
- /* @__PURE__ */ e("span", { className: "text-emerald-700 dark:text-emerald-400", children: Be(x.to) })
3497
+ /* @__PURE__ */ e("span", { className: "text-emerald-700 dark:text-emerald-400", children: Ue(x.to) })
3494
3498
  ]
3495
3499
  },
3496
3500
  x.field
@@ -3530,11 +3534,11 @@ function Ns({
3530
3534
  /* @__PURE__ */ e("span", { className: "font-mono", children: h.field }),
3531
3535
  ":",
3532
3536
  " ",
3533
- /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: Be(h.from) }),
3537
+ /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: Ue(h.from) }),
3534
3538
  " ",
3535
3539
  "→",
3536
3540
  " ",
3537
- /* @__PURE__ */ e("span", { className: "text-emerald-700 dark:text-emerald-400", children: Be(h.to) })
3541
+ /* @__PURE__ */ e("span", { className: "text-emerald-700 dark:text-emerald-400", children: Ue(h.to) })
3538
3542
  ]
3539
3543
  },
3540
3544
  h.field
@@ -3544,13 +3548,13 @@ function Ns({
3544
3548
  )
3545
3549
  ] });
3546
3550
  }
3547
- function Gt(a, n) {
3551
+ function Jt(a, n) {
3548
3552
  return a.filter((c) => !c.is_terminal && !n.includes(c.key)).map((c) => ({ value: c.key, label: c.label }));
3549
3553
  }
3550
- function ws(a) {
3554
+ function _s(a) {
3551
3555
  return a ? `Runs only while the record is in ${a}, by that step's owners or an administrator.` : "No starting step: only an administrator can run this split.";
3552
3556
  }
3553
- function Ie({
3557
+ function Xe({
3554
3558
  state: a,
3555
3559
  selected: n,
3556
3560
  onClick: c
@@ -3566,7 +3570,7 @@ function Ie({
3566
3570
  a.label
3567
3571
  ] }) : /* @__PURE__ */ e("span", { className: g, style: l, children: a.label });
3568
3572
  }
3569
- function ks({ value: a, onCommit: n }) {
3573
+ function Cs({ value: a, onCommit: n }) {
3570
3574
  const [c, g] = $(a);
3571
3575
  return xe(() => g(a), [a]), /* @__PURE__ */ e(
3572
3576
  "input",
@@ -3585,7 +3589,7 @@ function ks({ value: a, onCommit: n }) {
3585
3589
  }
3586
3590
  );
3587
3591
  }
3588
- function _s({
3592
+ function Ss({
3589
3593
  states: a,
3590
3594
  saving: n,
3591
3595
  onSave: c,
@@ -3599,7 +3603,7 @@ function _s({
3599
3603
  /* @__PURE__ */ t("div", { className: "space-y-1.5", children: [
3600
3604
  /* @__PURE__ */ e(Y, { className: "text-[12px]", children: "Label" }),
3601
3605
  /* @__PURE__ */ e(
3602
- U,
3606
+ W,
3603
3607
  {
3604
3608
  value: l,
3605
3609
  onChange: (p) => x(p.target.value),
@@ -3618,7 +3622,7 @@ function _s({
3618
3622
  {
3619
3623
  value: u,
3620
3624
  onChange: d,
3621
- options: Gt(a, o),
3625
+ options: Jt(a, o),
3622
3626
  noneLabel: "No starting step",
3623
3627
  placeholder: "No starting step",
3624
3628
  className: "max-w-xs"
@@ -3631,7 +3635,7 @@ function _s({
3631
3635
  "text-[11px]",
3632
3636
  u ? "text-slate-500" : "text-amber-700 dark:text-amber-400"
3633
3637
  ),
3634
- children: ws(m)
3638
+ children: _s(m)
3635
3639
  }
3636
3640
  )
3637
3641
  ] }),
@@ -3641,7 +3645,7 @@ function _s({
3641
3645
  /* @__PURE__ */ e("span", { className: "ml-1.5 font-normal text-slate-400", children: "(pick 2 or more — the record enters ALL of them at once)" })
3642
3646
  ] }),
3643
3647
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: a.map((p) => /* @__PURE__ */ e(
3644
- Ie,
3648
+ Xe,
3645
3649
  {
3646
3650
  state: p,
3647
3651
  selected: o.includes(p.key),
@@ -3656,7 +3660,7 @@ function _s({
3656
3660
  /* @__PURE__ */ e("span", { className: "ml-1.5 font-normal text-slate-400", children: "(auto-entered when every branch reaches a terminal state)" })
3657
3661
  ] }),
3658
3662
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: a.filter((p) => !o.includes(p.key)).map((p) => /* @__PURE__ */ e(
3659
- Ie,
3663
+ Xe,
3660
3664
  {
3661
3665
  state: p,
3662
3666
  selected: h === p.key,
@@ -3666,9 +3670,9 @@ function _s({
3666
3670
  )) })
3667
3671
  ] }),
3668
3672
  /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-2", children: [
3669
- /* @__PURE__ */ e(P, { type: "button", size: "sm", variant: "ghost", className: "text-[12px]", onClick: g, children: "Cancel" }),
3673
+ /* @__PURE__ */ e(T, { type: "button", size: "sm", variant: "ghost", className: "text-[12px]", onClick: g, children: "Cancel" }),
3670
3674
  /* @__PURE__ */ e(
3671
- P,
3675
+ T,
3672
3676
  {
3673
3677
  type: "button",
3674
3678
  size: "sm",
@@ -3686,7 +3690,7 @@ function _s({
3686
3690
  ] })
3687
3691
  ] });
3688
3692
  }
3689
- function Cs({
3693
+ function qs({
3690
3694
  split: a,
3691
3695
  states: n,
3692
3696
  saving: c,
@@ -3702,7 +3706,7 @@ function Cs({
3702
3706
  onChange: (o) => {
3703
3707
  o !== l && g(o || null);
3704
3708
  },
3705
- options: Gt(n, a.branch_states),
3709
+ options: Jt(n, a.branch_states),
3706
3710
  noneLabel: "No starting step",
3707
3711
  placeholder: "No starting step",
3708
3712
  className: "h-7 w-56"
@@ -3725,54 +3729,54 @@ function Cs({
3725
3729
  )
3726
3730
  ] });
3727
3731
  }
3728
- function Ss({
3732
+ function $s({
3729
3733
  templateId: a,
3730
3734
  states: n
3731
3735
  }) {
3732
3736
  const c = Z(), g = ke(), [l, x] = $(!1), [o, r] = $(null), h = ["workflow-splits", a], { data: v } = H({
3733
3737
  queryKey: h,
3734
3738
  queryFn: () => c.request(V(`/workflows/templates/${a}/splits`)).then((f) => f.data)
3735
- }), u = () => g.invalidateQueries({ queryKey: h }), d = M({
3739
+ }), u = () => g.invalidateQueries({ queryKey: h }), d = j({
3736
3740
  mutationFn: (f) => c.request(I(`/workflows/templates/${a}/splits`, f)),
3737
3741
  onSuccess: () => {
3738
- u(), x(!1), T.success("Split created");
3742
+ u(), x(!1), P.success("Split created");
3739
3743
  },
3740
3744
  onError: (f) => {
3741
3745
  var p;
3742
3746
  const b = ((p = f == null ? void 0 : f.response) == null ? void 0 : p.error) ?? (f == null ? void 0 : f.message);
3743
- T.error(b ?? "Failed to create split");
3747
+ P.error(b ?? "Failed to create split");
3744
3748
  }
3745
- }), N = M({
3749
+ }), N = j({
3746
3750
  mutationFn: ({ splitId: f, from: b }) => c.request(
3747
3751
  be(`/workflows/templates/${a}/splits/${f}`, { from_state: b })
3748
3752
  ),
3749
3753
  onSuccess: () => {
3750
- u(), T.success("Starting step saved");
3754
+ u(), P.success("Starting step saved");
3751
3755
  },
3752
3756
  onError: (f) => {
3753
3757
  var p;
3754
3758
  const b = ((p = f == null ? void 0 : f.response) == null ? void 0 : p.error) ?? (f == null ? void 0 : f.message);
3755
- T.error(b ?? "Failed to save the starting step");
3759
+ P.error(b ?? "Failed to save the starting step");
3756
3760
  }
3757
- }), m = M({
3761
+ }), m = j({
3758
3762
  mutationFn: (f) => c.request($e(`/workflows/templates/${a}/splits/${f}`)),
3759
3763
  onSuccess: () => {
3760
- u(), r(null), T.success("Split deleted");
3764
+ u(), r(null), P.success("Split deleted");
3761
3765
  },
3762
- onError: () => T.error("Failed to delete split")
3766
+ onError: () => P.error("Failed to delete split")
3763
3767
  });
3764
3768
  return /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4", children: [
3765
3769
  /* @__PURE__ */ t("div", { className: "flex items-start justify-between gap-4", children: [
3766
3770
  /* @__PURE__ */ t("h2", { className: "flex-1 text-[13px] font-semibold text-slate-800", children: [
3767
3771
  /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: [
3768
- /* @__PURE__ */ e(ba, { className: "h-4 w-4 text-slate-400" }),
3772
+ /* @__PURE__ */ e(va, { className: "h-4 w-4 text-slate-400" }),
3769
3773
  "Parallel Branches",
3770
3774
  /* @__PURE__ */ e("span", { className: "font-mono text-[11px] font-normal text-slate-400", children: (v == null ? void 0 : v.length) ?? 0 })
3771
3775
  ] }),
3772
3776
  /* @__PURE__ */ e("span", { className: "mt-0.5 block max-w-[72ch] text-[12px] font-normal text-slate-500", children: `A split sends one record into several states at the same time — each branch keeps its own owners and SLA clock. When every branch reaches a terminal state, the record auto-joins into the join state. Splits appear as a "Split" action on bound records while the record is in the split's starting step; a split with no starting step can only be run by an administrator.` })
3773
3777
  ] }),
3774
3778
  !l && /* @__PURE__ */ t(
3775
- P,
3779
+ T,
3776
3780
  {
3777
3781
  size: "sm",
3778
3782
  variant: "outline",
@@ -3798,7 +3802,7 @@ function Ss({
3798
3802
  /* @__PURE__ */ t("div", { className: "min-w-0 flex-1 space-y-1.5", children: [
3799
3803
  /* @__PURE__ */ e("p", { className: "text-[12px] font-medium text-slate-700", children: f.label }),
3800
3804
  /* @__PURE__ */ e(
3801
- Cs,
3805
+ qs,
3802
3806
  {
3803
3807
  split: f,
3804
3808
  states: n,
@@ -3807,15 +3811,15 @@ function Ss({
3807
3811
  }
3808
3812
  ),
3809
3813
  /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: [
3810
- f.branch_state_objs.map((p) => /* @__PURE__ */ e(Ie, { state: p }, p.id)),
3811
- /* @__PURE__ */ e(Wt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
3812
- f.join_state_obj ? /* @__PURE__ */ e(Ie, { state: f.join_state_obj }) : /* @__PURE__ */ e("span", { className: "text-[12px] italic text-slate-400", children: "missing join state" })
3814
+ f.branch_state_objs.map((p) => /* @__PURE__ */ e(Xe, { state: p }, p.id)),
3815
+ /* @__PURE__ */ e(Ht, { className: "h-3 w-3 shrink-0 text-slate-300" }),
3816
+ f.join_state_obj ? /* @__PURE__ */ e(Xe, { state: f.join_state_obj }) : /* @__PURE__ */ e("span", { className: "text-[12px] italic text-slate-400", children: "missing join state" })
3813
3817
  ] })
3814
3818
  ] }),
3815
3819
  o === f.id ? /* @__PURE__ */ t("div", { className: "flex shrink-0 items-center gap-2", children: [
3816
3820
  /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500", children: "Delete?" }),
3817
3821
  /* @__PURE__ */ e(
3818
- P,
3822
+ T,
3819
3823
  {
3820
3824
  size: "sm",
3821
3825
  variant: "destructive",
@@ -3826,7 +3830,7 @@ function Ss({
3826
3830
  }
3827
3831
  ),
3828
3832
  /* @__PURE__ */ e(
3829
- P,
3833
+ T,
3830
3834
  {
3831
3835
  size: "sm",
3832
3836
  variant: "ghost",
@@ -3850,7 +3854,7 @@ function Ss({
3850
3854
  );
3851
3855
  }),
3852
3856
  l && /* @__PURE__ */ e(
3853
- _s,
3857
+ Ss,
3854
3858
  {
3855
3859
  states: n,
3856
3860
  saving: d.isPending,
@@ -3860,11 +3864,11 @@ function Ss({
3860
3864
  )
3861
3865
  ] });
3862
3866
  }
3863
- function qs({ bindings: a }) {
3867
+ function Fs({ bindings: a }) {
3864
3868
  var v;
3865
- const n = Z(), [c, g] = $(""), [l, x] = $(""), o = l || ((v = a[0]) == null ? void 0 : v.collection) || "", r = M({
3869
+ const n = Z(), [c, g] = $(""), [l, x] = $(""), o = l || ((v = a[0]) == null ? void 0 : v.collection) || "", r = j({
3866
3870
  mutationFn: () => n.request(I("/pipelines/simulate", { collection: o, item_id: c.trim() })).then((u) => u.data),
3867
- onError: () => T.error("Simulation failed")
3871
+ onError: () => P.error("Simulation failed")
3868
3872
  }), h = r.data;
3869
3873
  return a.length === 0 ? null : /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4", children: [
3870
3874
  /* @__PURE__ */ t("div", { children: [
@@ -3894,7 +3898,7 @@ function qs({ bindings: a }) {
3894
3898
  a.length === 1 ? ` (${o})` : ""
3895
3899
  ] }),
3896
3900
  /* @__PURE__ */ e(
3897
- U,
3901
+ W,
3898
3902
  {
3899
3903
  value: c,
3900
3904
  onChange: (u) => g(u.target.value),
@@ -3906,7 +3910,7 @@ function qs({ bindings: a }) {
3906
3910
  }
3907
3911
  )
3908
3912
  ] }),
3909
- /* @__PURE__ */ e(P, { size: "sm", disabled: !c.trim() || r.isPending, onClick: () => r.mutate(), children: r.isPending ? "Running…" : "Simulate" })
3913
+ /* @__PURE__ */ e(T, { size: "sm", disabled: !c.trim() || r.isPending, onClick: () => r.mutate(), children: r.isPending ? "Running…" : "Simulate" })
3910
3914
  ] }),
3911
3915
  r.isSuccess && h === null && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No pipeline binding or instance for this record." }),
3912
3916
  h && /* @__PURE__ */ t("div", { className: "space-y-4", children: [
@@ -3975,8 +3979,8 @@ function qs({ bindings: a }) {
3975
3979
  ] })
3976
3980
  ] });
3977
3981
  }
3978
- const Pe = 900, ge = 230;
3979
- function It({
3982
+ const Te = 900, ge = 230;
3983
+ function Xt({
3980
3984
  selected: a,
3981
3985
  onChange: n
3982
3986
  }) {
@@ -4011,7 +4015,7 @@ function It({
4011
4015
  d.id
4012
4016
  )) }),
4013
4017
  /* @__PURE__ */ e(
4014
- U,
4018
+ W,
4015
4019
  {
4016
4020
  value: g,
4017
4021
  onChange: (d) => l(d.target.value),
@@ -4055,27 +4059,27 @@ function It({
4055
4059
  ] })
4056
4060
  ] });
4057
4061
  }
4058
- function $s({
4062
+ function Es({
4059
4063
  templateId: a,
4060
4064
  cluster: n,
4061
4065
  onDone: c
4062
4066
  }) {
4063
4067
  var w, k;
4064
- const g = Z(), l = ke(), x = !!((w = n.suggestion) != null && w.group_id) && n.suggestion.mismatched_filters.length === 0, o = Object.values(n.dims).filter(Boolean).join(" · ") || "New group", [r, h] = $(o), [v, u] = $([]), [d, N] = $([]), m = Ia(), { data: f } = H({
4068
+ const g = Z(), l = ke(), x = !!((w = n.suggestion) != null && w.group_id) && n.suggestion.mismatched_filters.length === 0, o = Object.values(n.dims).filter(Boolean).join(" · ") || "New group", [r, h] = $(o), [v, u] = $([]), [d, N] = $([]), m = Xa(), { data: f } = H({
4065
4069
  queryKey: ["user-groups-teams"],
4066
4070
  queryFn: () => g.request(V("/user-groups")).then((S) => S.data),
4067
4071
  staleTime: 6e4
4068
4072
  }), b = (f ?? []).map((S) => ({
4069
4073
  ...S,
4070
- rank: Ja(S.scopes, n.filters, m, n.collection)
4074
+ rank: Za(S.scopes, n.filters, m, n.collection)
4071
4075
  })).sort(
4072
- (S, A) => Rt(S.rank.tier) - Rt(A.rank.tier) || S.name.localeCompare(A.name, void 0, { sensitivity: "base" })
4073
- ), p = M({
4076
+ (S, D) => Pt(S.rank.tier) - Pt(D.rank.tier) || S.name.localeCompare(D.name, void 0, { sensitivity: "base" })
4077
+ ), p = j({
4074
4078
  mutationFn: async () => {
4075
- var A;
4076
- let S = x ? String((A = n.suggestion) == null ? void 0 : A.group_id) : null;
4079
+ var D;
4080
+ let S = x ? String((D = n.suggestion) == null ? void 0 : D.group_id) : null;
4077
4081
  if (!S) {
4078
- const L = await g.request(
4082
+ const A = await g.request(
4079
4083
  I(`/pipelines/states/${n.state_id}/owner-groups`, {
4080
4084
  name: r.trim() || o,
4081
4085
  filters: n.filters,
@@ -4084,24 +4088,24 @@ function $s({
4084
4088
  priority: 0
4085
4089
  })
4086
4090
  );
4087
- S = String(L.data.id);
4091
+ S = String(A.data.id);
4088
4092
  }
4089
- for (const L of d)
4090
- await g.request(I(`/pipelines/owner-groups/${S}/teams`, { team_id: L }));
4091
- for (const L of v)
4092
- await g.request(I(`/pipelines/owner-groups/${S}/users`, { user: L.id }));
4093
+ for (const A of d)
4094
+ await g.request(I(`/pipelines/owner-groups/${S}/teams`, { team_id: A }));
4095
+ for (const A of v)
4096
+ await g.request(I(`/pipelines/owner-groups/${S}/users`, { user: A.id }));
4093
4097
  return v.length + d.length;
4094
4098
  },
4095
4099
  onSuccess: (S) => {
4096
- var A;
4097
- T.success(
4098
- x ? `Added ${S} owner${S === 1 ? "" : "s"} to ${(A = n.suggestion) == null ? void 0 : A.group_label}` : `Created "${r.trim() || o}" with ${S} owner${S === 1 ? "" : "s"}`
4100
+ var D;
4101
+ P.success(
4102
+ x ? `Added ${S} owner${S === 1 ? "" : "s"} to ${(D = n.suggestion) == null ? void 0 : D.group_label}` : `Created "${r.trim() || o}" with ${S} owner${S === 1 ? "" : "s"}`
4099
4103
  ), l.invalidateQueries({ queryKey: ["owner-gaps", a] }), l.invalidateQueries({ queryKey: ["owner-lint", a] }), l.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", a] }), c();
4100
4104
  },
4101
4105
  onError: (S) => {
4102
- var A;
4103
- return T.error(
4104
- ((A = S == null ? void 0 : S.response) == null ? void 0 : A.error) ?? "Assignment failed",
4106
+ var D;
4107
+ return P.error(
4108
+ ((D = S == null ? void 0 : S.response) == null ? void 0 : D.error) ?? "Assignment failed",
4105
4109
  { duration: 9e3 }
4106
4110
  );
4107
4111
  }
@@ -4114,7 +4118,7 @@ function $s({
4114
4118
  ] }) : /* @__PURE__ */ t("div", { className: "space-y-1", children: [
4115
4119
  /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: "Creates a group scoped to exactly this combination, with the people you pick." }),
4116
4120
  /* @__PURE__ */ e(
4117
- U,
4121
+ W,
4118
4122
  {
4119
4123
  value: r,
4120
4124
  onChange: (S) => h(S.target.value),
@@ -4126,16 +4130,16 @@ function $s({
4126
4130
  b.length > 0 && /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1", children: [
4127
4131
  /* @__PURE__ */ e("span", { className: "mr-0.5 text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Teams" }),
4128
4132
  b.map((S) => {
4129
- const A = d.includes(S.id);
4133
+ const D = d.includes(S.id);
4130
4134
  return /* @__PURE__ */ t(
4131
4135
  "button",
4132
4136
  {
4133
4137
  type: "button",
4134
4138
  "data-tip": S.rank.tier === "out" ? `Outside this combination — ${S.rank.mismatches.join("; ")}. Picking it is an override.` : S.rank.tier === "suggested" ? "Scoped to this combination" : void 0,
4135
- onClick: () => N(A ? d.filter((L) => L !== S.id) : [...d, S.id]),
4139
+ onClick: () => N(D ? d.filter((A) => A !== S.id) : [...d, S.id]),
4136
4140
  className: J(
4137
4141
  "inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] transition-colors",
4138
- A ? "border-violet-300 bg-violet-100 font-medium text-violet-700 dark:border-violet-500/40 dark:bg-violet-500/15 dark:text-violet-300" : S.rank.tier === "out" ? "border-amber-200 text-amber-700 hover:bg-amber-50 dark:border-amber-500/30 dark:text-amber-400 dark:hover:bg-amber-500/10" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300"
4142
+ D ? "border-violet-300 bg-violet-100 font-medium text-violet-700 dark:border-violet-500/40 dark:bg-violet-500/15 dark:text-violet-300" : S.rank.tier === "out" ? "border-amber-200 text-amber-700 hover:bg-amber-50 dark:border-amber-500/30 dark:text-amber-400 dark:hover:bg-amber-500/10" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300"
4139
4143
  ),
4140
4144
  children: [
4141
4145
  S.rank.tier === "suggested" && /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-emerald-500" }),
@@ -4147,11 +4151,11 @@ function $s({
4147
4151
  );
4148
4152
  })
4149
4153
  ] }),
4150
- /* @__PURE__ */ e(It, { selected: v, onChange: u }),
4154
+ /* @__PURE__ */ e(Xt, { selected: v, onChange: u }),
4151
4155
  /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-1.5", children: [
4152
- /* @__PURE__ */ e(P, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: c, children: "Cancel" }),
4156
+ /* @__PURE__ */ e(T, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: c, children: "Cancel" }),
4153
4157
  /* @__PURE__ */ e(
4154
- P,
4158
+ T,
4155
4159
  {
4156
4160
  size: "sm",
4157
4161
  className: "h-6 px-2.5 text-[11px]",
@@ -4163,17 +4167,17 @@ function $s({
4163
4167
  ] })
4164
4168
  ] });
4165
4169
  }
4166
- function Fs({ templateId: a, finding: n }) {
4170
+ function Os({ templateId: a, finding: n }) {
4167
4171
  const c = Z(), g = ke(), [l, x] = $(
4168
4172
  "idle"
4169
4173
  ), [o, r] = $([]), h = (p) => {
4170
- T.success(p), x("idle"), r([]), g.invalidateQueries({ queryKey: ["owner-lint", a] }), g.invalidateQueries({ queryKey: ["owner-gaps", a] }), g.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", a] });
4174
+ P.success(p), x("idle"), r([]), g.invalidateQueries({ queryKey: ["owner-lint", a] }), g.invalidateQueries({ queryKey: ["owner-gaps", a] }), g.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", a] });
4171
4175
  }, v = (p) => {
4172
4176
  var w;
4173
- return T.error(((w = p == null ? void 0 : p.response) == null ? void 0 : w.error) ?? "Action failed", {
4177
+ return P.error(((w = p == null ? void 0 : p.response) == null ? void 0 : w.error) ?? "Action failed", {
4174
4178
  duration: 9e3
4175
4179
  });
4176
- }, u = M({
4180
+ }, u = j({
4177
4181
  mutationFn: () => c.request(
4178
4182
  I(`/pipelines/owner-groups/${n.group_id}/merge-into`, {
4179
4183
  target_group_id: n.other_group_id
@@ -4181,11 +4185,11 @@ function Fs({ templateId: a, finding: n }) {
4181
4185
  ),
4182
4186
  onSuccess: (p) => h(`Merged into ${n.other_group_name} — ${p.data.moved} member(s) moved`),
4183
4187
  onError: v
4184
- }), d = M({
4188
+ }), d = j({
4185
4189
  mutationFn: () => c.request($e(`/pipelines/owner-groups/${n.group_id}`)),
4186
4190
  onSuccess: () => h(`Deleted ${n.group_name}`),
4187
4191
  onError: v
4188
- }), N = M({
4192
+ }), N = j({
4189
4193
  mutationFn: async () => {
4190
4194
  for (const p of o)
4191
4195
  await c.request(
@@ -4195,7 +4199,7 @@ function Fs({ templateId: a, finding: n }) {
4195
4199
  },
4196
4200
  onSuccess: (p) => h(`Added ${p} ${p === 1 ? "person" : "people"} to ${n.group_name}`),
4197
4201
  onError: v
4198
- }), m = M({
4202
+ }), m = j({
4199
4203
  mutationFn: () => c.request(
4200
4204
  be(`/pipelines/owner-groups/${n.group_id}`, {
4201
4205
  filters: (n.group_filters ?? []).filter((p) => p.field !== n.dead_field)
@@ -4232,7 +4236,7 @@ function Fs({ templateId: a, finding: n }) {
4232
4236
  ] }),
4233
4237
  l === "idle" && /* @__PURE__ */ t("span", { className: "flex shrink-0 items-center gap-1", children: [
4234
4238
  n.type === "duplicate" && n.other_group_id && /* @__PURE__ */ e(
4235
- P,
4239
+ T,
4236
4240
  {
4237
4241
  size: "sm",
4238
4242
  variant: "outline",
@@ -4244,7 +4248,7 @@ function Fs({ templateId: a, finding: n }) {
4244
4248
  ),
4245
4249
  n.type === "empty" && /* @__PURE__ */ t(_e, { children: [
4246
4250
  /* @__PURE__ */ e(
4247
- P,
4251
+ T,
4248
4252
  {
4249
4253
  size: "sm",
4250
4254
  variant: "outline",
@@ -4255,7 +4259,7 @@ function Fs({ templateId: a, finding: n }) {
4255
4259
  }
4256
4260
  ),
4257
4261
  /* @__PURE__ */ e(
4258
- P,
4262
+ T,
4259
4263
  {
4260
4264
  size: "sm",
4261
4265
  variant: "outline",
@@ -4267,7 +4271,7 @@ function Fs({ templateId: a, finding: n }) {
4267
4271
  )
4268
4272
  ] }),
4269
4273
  n.type === "unknown_field" && n.dead_field && n.group_filters && /* @__PURE__ */ e(
4270
- P,
4274
+ T,
4271
4275
  {
4272
4276
  size: "sm",
4273
4277
  variant: "outline",
@@ -4284,7 +4288,7 @@ function Fs({ templateId: a, finding: n }) {
4284
4288
  n.other_group_name,
4285
4289
  "” and delete this group?",
4286
4290
  /* @__PURE__ */ e(
4287
- P,
4291
+ T,
4288
4292
  {
4289
4293
  size: "sm",
4290
4294
  className: "h-6 px-2 text-[11px]",
@@ -4294,7 +4298,7 @@ function Fs({ templateId: a, finding: n }) {
4294
4298
  }
4295
4299
  ),
4296
4300
  /* @__PURE__ */ e(
4297
- P,
4301
+ T,
4298
4302
  {
4299
4303
  size: "sm",
4300
4304
  variant: "ghost",
@@ -4309,7 +4313,7 @@ function Fs({ templateId: a, finding: n }) {
4309
4313
  n.group_name,
4310
4314
  "”? It has no members, so nothing loses coverage.",
4311
4315
  /* @__PURE__ */ e(
4312
- P,
4316
+ T,
4313
4317
  {
4314
4318
  size: "sm",
4315
4319
  variant: "destructive",
@@ -4320,7 +4324,7 @@ function Fs({ templateId: a, finding: n }) {
4320
4324
  }
4321
4325
  ),
4322
4326
  /* @__PURE__ */ e(
4323
- P,
4327
+ T,
4324
4328
  {
4325
4329
  size: "sm",
4326
4330
  variant: "ghost",
@@ -4331,10 +4335,10 @@ function Fs({ templateId: a, finding: n }) {
4331
4335
  )
4332
4336
  ] }),
4333
4337
  l === "add-member" && /* @__PURE__ */ t("div", { className: "mt-2 ml-2 space-y-2 rounded-md border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
4334
- /* @__PURE__ */ e(It, { selected: o, onChange: r }),
4338
+ /* @__PURE__ */ e(Xt, { selected: o, onChange: r }),
4335
4339
  /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-1.5", children: [
4336
4340
  /* @__PURE__ */ e(
4337
- P,
4341
+ T,
4338
4342
  {
4339
4343
  size: "sm",
4340
4344
  variant: "ghost",
@@ -4346,7 +4350,7 @@ function Fs({ templateId: a, finding: n }) {
4346
4350
  }
4347
4351
  ),
4348
4352
  /* @__PURE__ */ e(
4349
- P,
4353
+ T,
4350
4354
  {
4351
4355
  size: "sm",
4352
4356
  className: "h-6 px-2.5 text-[11px]",
@@ -4359,7 +4363,7 @@ function Fs({ templateId: a, finding: n }) {
4359
4363
  ] })
4360
4364
  ] });
4361
4365
  }
4362
- function Es({
4366
+ function Rs({
4363
4367
  templateId: a,
4364
4368
  states: n
4365
4369
  }) {
@@ -4375,30 +4379,30 @@ function Es({
4375
4379
  ).then((y) => y.data),
4376
4380
  enabled: l,
4377
4381
  staleTime: 5 * 6e4
4378
- }), f = M({
4382
+ }), f = j({
4379
4383
  mutationFn: (y) => c.request(I(`/pipelines/${a}/owner-cleanup`, y ? { user_id: y } : {})),
4380
4384
  onSuccess: (y) => {
4381
4385
  const i = y.data;
4382
- T.success(
4386
+ P.success(
4383
4387
  `Removed ${i.group_members_removed} seat(s) and ${i.instance_owners_removed} record owner(s)`
4384
4388
  ), g.invalidateQueries({ queryKey: ["owner-gaps", a] }), g.invalidateQueries({ queryKey: ["owner-lint", a] }), g.invalidateQueries({ queryKey: ["owner-groups", a] }), g.invalidateQueries({ queryKey: ["pipeline-all-owner-groups", a] });
4385
4389
  },
4386
- onError: () => T.error("Cleanup failed")
4390
+ onError: () => P.error("Cleanup failed")
4387
4391
  }), b = (u == null ? void 0 : u.clusters) ?? [], p = u == null ? void 0 : u.dead_seats, w = ((m == null ? void 0 : m.findings) ?? []).filter((y) => y.type !== "inactive_member"), k = b.reduce((y, i) => y + i.count, 0), S = new Map(
4388
4392
  n.map((y) => [y.key, { label: y.label, color: y.color ?? null }])
4389
- ), A = /* @__PURE__ */ new Map();
4393
+ ), D = /* @__PURE__ */ new Map();
4390
4394
  for (const y of b) {
4391
4395
  const i = y.state_key ?? "(unknown state)";
4392
- A.set(i, [...A.get(i) ?? [], y]);
4396
+ D.set(i, [...D.get(i) ?? [], y]);
4393
4397
  }
4394
- const L = [...A.entries()].sort(
4398
+ const A = [...D.entries()].sort(
4395
4399
  (y, i) => i[1].reduce((_, E) => _ + E.count, 0) - y[1].reduce((_, E) => _ + E.count, 0)
4396
4400
  ), O = (y, i) => /* @__PURE__ */ t(
4397
4401
  "span",
4398
4402
  {
4399
4403
  className: "inline-flex items-baseline gap-1 rounded border border-slate-200 bg-slate-50 px-1.5 py-px text-[10.5px] dark:border-border dark:bg-muted/40",
4400
4404
  children: [
4401
- /* @__PURE__ */ e("span", { className: "text-slate-400", children: Xt(y) }),
4405
+ /* @__PURE__ */ e("span", { className: "text-slate-400", children: ea(y) }),
4402
4406
  /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: i })
4403
4407
  ]
4404
4408
  },
@@ -4411,7 +4415,7 @@ function Es({
4411
4415
  /* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[68ch] text-[12px] text-slate-500 dark:text-muted-foreground", children: "Who actually covers this pipeline — open records resolving nobody, seats held by people who can no longer act, and hygiene problems in the matrix itself. Every finding is fixable in place." })
4412
4416
  ] }),
4413
4417
  /* @__PURE__ */ e(
4414
- P,
4418
+ T,
4415
4419
  {
4416
4420
  size: "sm",
4417
4421
  variant: "outline",
@@ -4469,7 +4473,7 @@ function Es({
4469
4473
  o ? /* @__PURE__ */ t("span", { className: "ml-auto flex items-center gap-1.5", children: [
4470
4474
  /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: "Remove all of them from every group and open record?" }),
4471
4475
  /* @__PURE__ */ e(
4472
- P,
4476
+ T,
4473
4477
  {
4474
4478
  size: "sm",
4475
4479
  className: "h-6 bg-violet-600 px-2 text-[11px] text-white hover:bg-violet-700",
@@ -4481,7 +4485,7 @@ function Es({
4481
4485
  }
4482
4486
  ),
4483
4487
  /* @__PURE__ */ e(
4484
- P,
4488
+ T,
4485
4489
  {
4486
4490
  size: "sm",
4487
4491
  variant: "ghost",
@@ -4491,7 +4495,7 @@ function Es({
4491
4495
  }
4492
4496
  )
4493
4497
  ] }) : /* @__PURE__ */ e(
4494
- P,
4498
+ T,
4495
4499
  {
4496
4500
  size: "sm",
4497
4501
  variant: "outline",
@@ -4546,7 +4550,7 @@ function Es({
4546
4550
  ] })
4547
4551
  ] })
4548
4552
  ] }),
4549
- L.map(([y, i]) => {
4553
+ A.map(([y, i]) => {
4550
4554
  const _ = S.get(y), E = i.reduce((F, B) => F + B.count, 0);
4551
4555
  return /* @__PURE__ */ t(
4552
4556
  "div",
@@ -4561,7 +4565,7 @@ function Es({
4561
4565
  style: { backgroundColor: (_ == null ? void 0 : _.color) ?? "#94a3b8" }
4562
4566
  }
4563
4567
  ),
4564
- /* @__PURE__ */ e("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-foreground", children: (_ == null ? void 0 : _.label) ?? Jt(y) }),
4568
+ /* @__PURE__ */ e("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-foreground", children: (_ == null ? void 0 : _.label) ?? Zt(y) }),
4565
4569
  /* @__PURE__ */ t("span", { className: "ml-auto text-[11px] tabular-nums text-slate-400", children: [
4566
4570
  E,
4567
4571
  " record",
@@ -4574,13 +4578,13 @@ function Es({
4574
4578
  ] })
4575
4579
  ] }),
4576
4580
  /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: i.map((F, B) => {
4577
- const j = `${F.state_id}|${JSON.stringify(F.dims)}`;
4581
+ const L = `${F.state_id}|${JSON.stringify(F.dims)}`;
4578
4582
  return (
4579
4583
  // biome-ignore lint/suspicious/noArrayIndexKey: server-ordered clusters
4580
4584
  /* @__PURE__ */ t("div", { className: "px-3 py-2", children: [
4581
4585
  /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: [
4582
4586
  /* @__PURE__ */ e("span", { className: "w-8 shrink-0 text-[13px] font-semibold tabular-nums text-slate-800 dark:text-foreground", children: F.count }),
4583
- Object.entries(F.dims).filter(([, K]) => K).length > 0 ? Object.entries(F.dims).filter(([, K]) => K).map(([K, W]) => O(K, W)) : /* @__PURE__ */ e("span", { className: "text-[11px] italic text-slate-400", children: "no dimension values resolved" }),
4587
+ Object.entries(F.dims).filter(([, M]) => M).length > 0 ? Object.entries(F.dims).filter(([, M]) => M).map(([M, U]) => O(M, U)) : /* @__PURE__ */ e("span", { className: "text-[11px] italic text-slate-400", children: "no dimension values resolved" }),
4584
4588
  /* @__PURE__ */ t(
4585
4589
  "span",
4586
4590
  {
@@ -4593,13 +4597,13 @@ function Es({
4593
4597
  }
4594
4598
  ),
4595
4599
  /* @__PURE__ */ e(
4596
- P,
4600
+ T,
4597
4601
  {
4598
4602
  size: "sm",
4599
4603
  variant: "outline",
4600
4604
  className: "h-6 shrink-0 px-2 text-[11px]",
4601
4605
  onClick: () => v(
4602
- h === j ? null : j
4606
+ h === L ? null : L
4603
4607
  ),
4604
4608
  children: "Assign owners…"
4605
4609
  }
@@ -4616,7 +4620,7 @@ function Es({
4616
4620
  " ",
4617
4621
  "already matches",
4618
4622
  " ",
4619
- Mt(
4623
+ zt(
4620
4624
  F.suggestion.matched_labels,
4621
4625
  F.suggestion.matched_filters
4622
4626
  ) || "nothing"
@@ -4625,7 +4629,7 @@ function Es({
4625
4629
  " ",
4626
4630
  "— it misses",
4627
4631
  " ",
4628
- Mt(
4632
+ zt(
4629
4633
  F.suggestion.missing_labels,
4630
4634
  F.suggestion.mismatched_filters
4631
4635
  ),
@@ -4635,8 +4639,8 @@ function Es({
4635
4639
  /* @__PURE__ */ e("span", { className: "rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold uppercase dark:bg-amber-500/15", children: "no match" }),
4636
4640
  "No group comes close — assigning creates one for this combination."
4637
4641
  ] }) }),
4638
- h === j && /* @__PURE__ */ e(
4639
- $s,
4642
+ h === L && /* @__PURE__ */ e(
4643
+ Es,
4640
4644
  {
4641
4645
  templateId: a,
4642
4646
  cluster: F,
@@ -4666,29 +4670,29 @@ function Es({
4666
4670
  ] }),
4667
4671
  /* @__PURE__ */ e("div", { className: "max-h-96 divide-y divide-slate-100 overflow-y-auto px-3 dark:divide-border/60", children: w.map((y, i) => (
4668
4672
  // biome-ignore lint/suspicious/noArrayIndexKey: findings are positional
4669
- /* @__PURE__ */ e(Fs, { templateId: a, finding: y }, i)
4673
+ /* @__PURE__ */ e(Os, { templateId: a, finding: y }, i)
4670
4674
  )) })
4671
4675
  ] })
4672
4676
  ] })
4673
4677
  ] });
4674
4678
  }
4675
- function Jt(a) {
4679
+ function Zt(a) {
4676
4680
  return a.replace(/[_-]+/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
4677
4681
  }
4678
- function Xt(a) {
4682
+ function ea(a) {
4679
4683
  const n = a.split(".");
4680
4684
  for (; n.length > 1 && /^((short_)?name|label|key|id|.*_id)$/i.test(n[n.length - 1]); )
4681
4685
  n.pop();
4682
4686
  const c = n[n.length - 1].replace(/s$/i, "");
4683
- return Jt(c);
4687
+ return Zt(c);
4684
4688
  }
4685
- function Os(a) {
4686
- return a.replace(/[a-z_]+(?:\.[a-z_]+)+/g, (n) => Xt(n));
4689
+ function Ts(a) {
4690
+ return a.replace(/[a-z_]+(?:\.[a-z_]+)+/g, (n) => ea(n));
4687
4691
  }
4688
- function Mt(a, n) {
4689
- return Array.isArray(a) && a.length > 0 ? a.join(", ") : Os(n.map((c) => c.replace(/ \(wants \d+\)$/, "")).join(", "));
4692
+ function zt(a, n) {
4693
+ return Array.isArray(a) && a.length > 0 ? a.join(", ") : Ts(n.map((c) => c.replace(/ \(wants \d+\)$/, "")).join(", "));
4690
4694
  }
4691
- function Rs({ templateId: a }) {
4695
+ function Ps({ templateId: a }) {
4692
4696
  const n = Z(), c = ke(), [g, l] = $(""), [x, o] = $(""), [r, h] = $(!1), { data: v } = H({
4693
4697
  queryKey: ["instance-distribution", a],
4694
4698
  queryFn: () => n.request(V(`/pipelines/${a}/instance-distribution`)),
@@ -4698,18 +4702,18 @@ function Rs({ templateId: a }) {
4698
4702
  queryFn: () => n.request(
4699
4703
  V(`/pipelines/${a}/bindings`)
4700
4704
  )
4701
- }), b = ((f == null ? void 0 : f.data) ?? []).map((k) => k.collection), p = M({
4705
+ }), b = ((f == null ? void 0 : f.data) ?? []).map((k) => k.collection), p = j({
4702
4706
  mutationFn: (k) => n.request(
4703
4707
  I(`/pipelines/${a}/start-missing`, { collection: k })
4704
4708
  ),
4705
4709
  onSuccess: (k) => {
4706
- T.success(`${k.data.started} instance(s) started`), c.invalidateQueries({ queryKey: ["instance-distribution", a] });
4710
+ P.success(`${k.data.started} instance(s) started`), c.invalidateQueries({ queryKey: ["instance-distribution", a] });
4707
4711
  },
4708
4712
  onError: (k) => {
4709
4713
  var S;
4710
- return T.error(((S = k.response) == null ? void 0 : S.error) ?? "Start failed");
4714
+ return P.error(((S = k.response) == null ? void 0 : S.error) ?? "Start failed");
4711
4715
  }
4712
- }), w = M({
4716
+ }), w = j({
4713
4717
  mutationFn: () => n.request(
4714
4718
  I(`/pipelines/${a}/migrate-instances`, {
4715
4719
  from_state: g,
@@ -4717,11 +4721,11 @@ function Rs({ templateId: a }) {
4717
4721
  })
4718
4722
  ),
4719
4723
  onSuccess: (k) => {
4720
- T.success(`${k.data.migrated} instance(s) migrated`), h(!1), l(""), o(""), c.invalidateQueries({ queryKey: ["instance-distribution", a] });
4724
+ P.success(`${k.data.migrated} instance(s) migrated`), h(!1), l(""), o(""), c.invalidateQueries({ queryKey: ["instance-distribution", a] });
4721
4725
  },
4722
4726
  onError: (k) => {
4723
4727
  var S;
4724
- return T.error(((S = k.response) == null ? void 0 : S.error) ?? "Migration failed");
4728
+ return P.error(((S = k.response) == null ? void 0 : S.error) ?? "Migration failed");
4725
4729
  }
4726
4730
  });
4727
4731
  return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
@@ -4772,18 +4776,18 @@ function Rs({ templateId: a }) {
4772
4776
  m,
4773
4777
  " instance(s) to"
4774
4778
  ] }),
4775
- /* @__PURE__ */ t(Da, { value: x || void 0, onValueChange: o, children: [
4776
- /* @__PURE__ */ e(La, { className: "h-8 w-[220px] text-[12.5px]", children: /* @__PURE__ */ e(ja, { placeholder: "Pick a state…" }) }),
4777
- /* @__PURE__ */ e(Ma, { children: d.filter((k) => String(k.id) !== g).map((k) => /* @__PURE__ */ e(Ka, { value: k.id, children: k.label }, k.id)) })
4779
+ /* @__PURE__ */ t(ja, { value: x || void 0, onValueChange: o, children: [
4780
+ /* @__PURE__ */ e(Ma, { className: "h-8 w-[220px] text-[12.5px]", children: /* @__PURE__ */ e(Ka, { placeholder: "Pick a state…" }) }),
4781
+ /* @__PURE__ */ e(za, { children: d.filter((k) => String(k.id) !== g).map((k) => /* @__PURE__ */ e(Ba, { value: k.id, children: k.label }, k.id)) })
4778
4782
  ] }),
4779
- x && !r && /* @__PURE__ */ e(P, { size: "sm", className: "h-8 text-[12.5px]", onClick: () => h(!0), children: "Migrate…" }),
4783
+ x && !r && /* @__PURE__ */ e(T, { size: "sm", className: "h-8 text-[12.5px]", onClick: () => h(!0), children: "Migrate…" }),
4780
4784
  x && r && /* @__PURE__ */ t("span", { className: "flex items-center gap-2 rounded-md border border-amber-300 bg-amber-50 px-2.5 py-1 dark:border-amber-500/40 dark:bg-amber-400/10", children: [
4781
4785
  /* @__PURE__ */ t("span", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
4782
4786
  m,
4783
4787
  " record(s) will move, each with a history entry. Sure?"
4784
4788
  ] }),
4785
4789
  /* @__PURE__ */ e(
4786
- P,
4790
+ T,
4787
4791
  {
4788
4792
  size: "sm",
4789
4793
  className: "h-6 text-[11.5px]",
@@ -4805,7 +4809,7 @@ function Rs({ templateId: a }) {
4805
4809
  ] })
4806
4810
  ] });
4807
4811
  }
4808
- function Ps({ templateId: a }) {
4812
+ function Ds({ templateId: a }) {
4809
4813
  const n = Z(), [c, g] = $(
4810
4814
  null
4811
4815
  ), [l, x] = $(() => {
@@ -4814,12 +4818,12 @@ function Ps({ templateId: a }) {
4814
4818
  } catch {
4815
4819
  return {};
4816
4820
  }
4817
- }), o = Je(null), { data: r } = H({
4821
+ }), o = Ze(null), { data: r } = H({
4818
4822
  queryKey: ["pipeline-canvas", a],
4819
4823
  queryFn: () => n.request(V(`/pipelines/${a}`)).then((i) => i.data),
4820
4824
  staleTime: 3e4
4821
- }), h = (r == null ? void 0 : r.states) ?? [], v = (r == null ? void 0 : r.transitions) ?? [], u = wa(() => {
4822
- var Me;
4825
+ }), h = (r == null ? void 0 : r.states) ?? [], v = (r == null ? void 0 : r.transitions) ?? [], u = _a(() => {
4826
+ var ze;
4823
4827
  const i = new Map(h.map((Q) => [String(Q.id).toUpperCase(), Q])), _ = /* @__PURE__ */ new Map(), E = h.filter((Q) => Q.is_initial).map((Q) => ({ id: String(Q.id).toUpperCase(), r: 0 })), F = /* @__PURE__ */ new Map();
4824
4828
  for (const Q of v) {
4825
4829
  if (!Q.from_state) continue;
@@ -4832,7 +4836,7 @@ function Ps({ templateId: a }) {
4832
4836
  _.has(Q) || _.set(Q, X);
4833
4837
  for (const de of F.get(Q) ?? []) {
4834
4838
  const me = i.get(de);
4835
- !_.has(de) && (((Me = i.get(Q)) == null ? void 0 : Me.sort) ?? 0) <= ((me == null ? void 0 : me.sort) ?? 0) && E.push({ id: de, r: X + 1 });
4839
+ !_.has(de) && (((ze = i.get(Q)) == null ? void 0 : ze.sort) ?? 0) <= ((me == null ? void 0 : me.sort) ?? 0) && E.push({ id: de, r: X + 1 });
4836
4840
  }
4837
4841
  }
4838
4842
  }
@@ -4841,20 +4845,20 @@ function Ps({ templateId: a }) {
4841
4845
  const X = String(Q.id).toUpperCase();
4842
4846
  _.has(X) || _.set(X, ++B);
4843
4847
  }
4844
- const j = /* @__PURE__ */ new Map();
4848
+ const L = /* @__PURE__ */ new Map();
4845
4849
  for (const Q of [...h].sort((X, de) => X.sort - de.sort)) {
4846
4850
  const X = String(Q.id).toUpperCase(), de = _.get(X) ?? 0;
4847
- j.set(de, [...j.get(de) ?? [], X]);
4851
+ L.set(de, [...L.get(de) ?? [], X]);
4848
4852
  }
4849
- const K = 168, W = 44, te = 70, ae = 18, oe = /* @__PURE__ */ new Map();
4853
+ const M = 168, U = 44, te = 70, ae = 18, oe = /* @__PURE__ */ new Map();
4850
4854
  let ce = 1;
4851
- for (const [Q, X] of j)
4855
+ for (const [Q, X] of L)
4852
4856
  ce = Math.max(ce, X.length), X.forEach((de, me) => {
4853
- oe.set(de, { x: 20 + Q * (K + te), y: 20 + me * (W + ae) });
4857
+ oe.set(de, { x: 20 + Q * (M + te), y: 20 + me * (U + ae) });
4854
4858
  });
4855
- const Xe = 60 + (Math.max(0, ...j.keys()) + 1) * (K + te), z = 60 + ce * (W + ae);
4856
- return { pos: oe, width: Xe, height: z, NODE_W: K, NODE_H: W };
4857
- }, [h, v]), d = (i) => l[i] ?? u.pos.get(i) ?? { x: 20, y: 20 }, [N, m] = $(null), [f, b] = $(null), p = ke(), w = M({
4859
+ const et = 60 + (Math.max(0, ...L.keys()) + 1) * (M + te), z = 60 + ce * (U + ae);
4860
+ return { pos: oe, width: et, height: z, NODE_W: M, NODE_H: U };
4861
+ }, [h, v]), d = (i) => l[i] ?? u.pos.get(i) ?? { x: 20, y: 20 }, [N, m] = $(null), [f, b] = $(null), p = ke(), w = j({
4858
4862
  mutationFn: (i) => n.request(
4859
4863
  I(`/pipelines/${a}/transitions`, {
4860
4864
  from_state: i.from,
@@ -4863,11 +4867,11 @@ function Ps({ templateId: a }) {
4863
4867
  })
4864
4868
  ),
4865
4869
  onSuccess: () => {
4866
- T.success("Transition created — configure it in the Transitions list"), p.invalidateQueries({ queryKey: ["pipeline-canvas", a] }), p.invalidateQueries({ queryKey: ["pipeline", a] });
4870
+ P.success("Transition created — configure it in the Transitions list"), p.invalidateQueries({ queryKey: ["pipeline-canvas", a] }), p.invalidateQueries({ queryKey: ["pipeline", a] });
4867
4871
  },
4868
4872
  onError: (i) => {
4869
4873
  var _;
4870
- return T.error(((_ = i.response) == null ? void 0 : _.error) ?? "Create failed");
4874
+ return P.error(((_ = i.response) == null ? void 0 : _.error) ?? "Create failed");
4871
4875
  }
4872
4876
  }), k = (i, _) => {
4873
4877
  if (_.shiftKey) {
@@ -4890,7 +4894,7 @@ function Ps({ templateId: a }) {
4890
4894
  y: Math.max(0, _.origY + i.clientY - _.startY)
4891
4895
  }
4892
4896
  }));
4893
- }, A = () => {
4897
+ }, D = () => {
4894
4898
  if (N) {
4895
4899
  if (f) {
4896
4900
  const i = h.find((_) => {
@@ -4903,7 +4907,7 @@ function Ps({ templateId: a }) {
4903
4907
  return;
4904
4908
  }
4905
4909
  o.current && (o.current = null, x((i) => (localStorage.setItem(`nvr_canvas_${a}`, JSON.stringify(i)), i)));
4906
- }, L = (c == null ? void 0 : c.kind) === "state" ? h.find((i) => String(i.id) === c.id) : null, O = (c == null ? void 0 : c.kind) === "transition" ? v.find((i) => String(i.id) === c.id) : null, y = (i) => {
4910
+ }, A = (c == null ? void 0 : c.kind) === "state" ? h.find((i) => String(i.id) === c.id) : null, O = (c == null ? void 0 : c.kind) === "transition" ? v.find((i) => String(i.id) === c.id) : null, y = (i) => {
4907
4911
  const E = Array.from(document.querySelectorAll("h3, p, span, button")).find((F) => {
4908
4912
  var B;
4909
4913
  return ((B = F.textContent) == null ? void 0 : B.trim()) === i;
@@ -4919,7 +4923,7 @@ function Ps({ templateId: a }) {
4919
4923
  width: Math.max(u.width, 600),
4920
4924
  height: Math.max(u.height, 200),
4921
4925
  onPointerMove: S,
4922
- onPointerUp: A,
4926
+ onPointerUp: D,
4923
4927
  role: "img",
4924
4928
  "aria-label": "Workflow state machine",
4925
4929
  children: [
@@ -4937,7 +4941,7 @@ function Ps({ templateId: a }) {
4937
4941
  ) }),
4938
4942
  v.map((i) => {
4939
4943
  if (!i.from_state) return null;
4940
- const _ = d(String(i.from_state).toUpperCase()), E = d(String(i.to_state).toUpperCase()), F = _.x + u.NODE_W, B = _.y + u.NODE_H / 2, j = E.x, K = E.y + u.NODE_H / 2, W = j < F, te = W ? Math.max(F, j + u.NODE_W) + 40 : (F + j) / 2, ae = W ? `M ${F} ${B} C ${F + 60} ${B - 40}, ${j - 60} ${K - 40}, ${j} ${K}` : `M ${F} ${B} C ${te} ${B}, ${te} ${K}, ${j} ${K}`, oe = (c == null ? void 0 : c.kind) === "transition" && c.id === String(i.id), ce = Array.isArray(i.condition_rules) ? i.condition_rules.length > 0 : !!i.condition_rules;
4944
+ const _ = d(String(i.from_state).toUpperCase()), E = d(String(i.to_state).toUpperCase()), F = _.x + u.NODE_W, B = _.y + u.NODE_H / 2, L = E.x, M = E.y + u.NODE_H / 2, U = L < F, te = U ? Math.max(F, L + u.NODE_W) + 40 : (F + L) / 2, ae = U ? `M ${F} ${B} C ${F + 60} ${B - 40}, ${L - 60} ${M - 40}, ${L} ${M}` : `M ${F} ${B} C ${te} ${B}, ${te} ${M}, ${L} ${M}`, oe = (c == null ? void 0 : c.kind) === "transition" && c.id === String(i.id), ce = Array.isArray(i.condition_rules) ? i.condition_rules.length > 0 : !!i.condition_rules;
4941
4945
  return (
4942
4946
  // biome-ignore lint/a11y/useKeyWithClickEvents: canvas edge, inspect-only
4943
4947
  /* @__PURE__ */ t(
@@ -4954,15 +4958,15 @@ function Ps({ templateId: a }) {
4954
4958
  fill: "none",
4955
4959
  strokeWidth: oe ? 2.5 : 1.5,
4956
4960
  markerEnd: "url(#cv-arrow)",
4957
- className: oe ? "stroke-nvr-cyan" : W ? "stroke-amber-400" : "stroke-slate-300 dark:stroke-slate-600",
4961
+ className: oe ? "stroke-nvr-cyan" : U ? "stroke-amber-400" : "stroke-slate-300 dark:stroke-slate-600",
4958
4962
  strokeDasharray: i.auto_trigger ? "5 3" : void 0
4959
4963
  }
4960
4964
  ),
4961
4965
  (i.auto_trigger || ce) && /* @__PURE__ */ t(
4962
4966
  "text",
4963
4967
  {
4964
- x: (F + j) / 2,
4965
- y: (B + K) / 2 - 6,
4968
+ x: (F + L) / 2,
4969
+ y: (B + M) / 2 - 6,
4966
4970
  textAnchor: "middle",
4967
4971
  className: "fill-slate-500 text-[11px]",
4968
4972
  children: [
@@ -4984,7 +4988,7 @@ function Ps({ templateId: a }) {
4984
4988
  y1: d(N).y + u.NODE_H / 2,
4985
4989
  x2: f.x,
4986
4990
  y2: f.y,
4987
- stroke: Vt,
4991
+ stroke: Gt,
4988
4992
  strokeWidth: 2,
4989
4993
  strokeDasharray: "5 4"
4990
4994
  }
@@ -5050,24 +5054,24 @@ function Ps({ templateId: a }) {
5050
5054
  ]
5051
5055
  }
5052
5056
  ) }),
5053
- (L || O) && /* @__PURE__ */ t("div", { className: "mt-2 flex flex-wrap items-center gap-3 rounded-md border border-slate-100 px-3 py-2 text-[12.5px] dark:border-border", children: [
5054
- L && /* @__PURE__ */ t(_e, { children: [
5055
- /* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-foreground", children: L.label }),
5057
+ (A || O) && /* @__PURE__ */ t("div", { className: "mt-2 flex flex-wrap items-center gap-3 rounded-md border border-slate-100 px-3 py-2 text-[12.5px] dark:border-border", children: [
5058
+ A && /* @__PURE__ */ t(_e, { children: [
5059
+ /* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-foreground", children: A.label }),
5056
5060
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: [
5057
5061
  "key: ",
5058
- L.key
5062
+ A.key
5059
5063
  ] }),
5060
5064
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: [
5061
- v.filter((i) => String(i.from_state) === String(L.id)).length,
5065
+ v.filter((i) => String(i.from_state) === String(A.id)).length,
5062
5066
  " out · ",
5063
- v.filter((i) => String(i.to_state) === String(L.id)).length,
5067
+ v.filter((i) => String(i.to_state) === String(A.id)).length,
5064
5068
  " in"
5065
5069
  ] }),
5066
5070
  /* @__PURE__ */ e(
5067
5071
  "button",
5068
5072
  {
5069
5073
  type: "button",
5070
- onClick: () => y(L.label),
5074
+ onClick: () => y(A.label),
5071
5075
  className: "text-nvr-cyan underline decoration-dotted underline-offset-2",
5072
5076
  children: "Edit in the States list ↑"
5073
5077
  }
@@ -5102,8 +5106,8 @@ function Ps({ templateId: a }) {
5102
5106
  ] })
5103
5107
  ] });
5104
5108
  }
5105
- function Ts({ templateId: a }) {
5106
- var L, O;
5109
+ function As({ templateId: a }) {
5110
+ var A, O;
5107
5111
  const n = Z(), [c, g] = $(90), [l, x] = $(null), { data: o } = H({
5108
5112
  queryKey: ["flow-map", a, c],
5109
5113
  queryFn: () => n.request(
@@ -5114,22 +5118,22 @@ function Ts({ templateId: a }) {
5114
5118
  for (const y of h)
5115
5119
  u.set(y.from, (u.get(y.from) ?? 0) + y.count), d.set(y.to, (d.get(y.to) ?? 0) + y.count);
5116
5120
  const N = Math.max(360, r.length * 46), m = (y) => {
5117
- const i = r.filter((j) => (y.get(j.id) ?? 0) > 0), _ = [...y.values()].reduce((j, K) => j + K, 0) || 1, E = (i.length + 1) * 8;
5121
+ const i = r.filter((L) => (y.get(L.id) ?? 0) > 0), _ = [...y.values()].reduce((L, M) => L + M, 0) || 1, E = (i.length + 1) * 8;
5118
5122
  let F = 20;
5119
5123
  const B = /* @__PURE__ */ new Map();
5120
- for (const j of i) {
5121
- const K = Math.max(14, (y.get(j.id) ?? 0) / _ * (N - E - 40));
5122
- B.set(j.id, { y: F, h: K }), F += K + 8;
5124
+ for (const L of i) {
5125
+ const M = Math.max(14, (y.get(L.id) ?? 0) / _ * (N - E - 40));
5126
+ B.set(L.id, { y: F, h: M }), F += M + 8;
5123
5127
  }
5124
5128
  return { pos: B, height: F + 20 };
5125
5129
  }, f = m(u), b = m(d), p = Math.max(f.height, b.height, 380), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), S = h.map((y) => {
5126
5130
  const i = f.pos.get(y.from), _ = b.pos.get(y.to);
5127
5131
  if (!i || !_) return null;
5128
- const E = y.count / Math.max(1, u.get(y.from) ?? 1), F = y.count / Math.max(1, d.get(y.to) ?? 1), B = Math.max(1.5, i.h * E), j = Math.max(1.5, _.h * F), K = i.y + (w.get(y.from) ?? 0), W = _.y + (k.get(y.to) ?? 0);
5129
- w.set(y.from, (w.get(y.from) ?? 0) + B), k.set(y.to, (k.get(y.to) ?? 0) + j);
5130
- const te = ge + 8, ae = Pe - ge - 8, oe = (te + ae) / 2, ce = `M ${te} ${K} C ${oe} ${K}, ${oe} ${W}, ${ae} ${W} L ${ae} ${W + j} C ${oe} ${W + j}, ${oe} ${K + B}, ${te} ${K + B} Z`;
5132
+ const E = y.count / Math.max(1, u.get(y.from) ?? 1), F = y.count / Math.max(1, d.get(y.to) ?? 1), B = Math.max(1.5, i.h * E), L = Math.max(1.5, _.h * F), M = i.y + (w.get(y.from) ?? 0), U = _.y + (k.get(y.to) ?? 0);
5133
+ w.set(y.from, (w.get(y.from) ?? 0) + B), k.set(y.to, (k.get(y.to) ?? 0) + L);
5134
+ const te = ge + 8, ae = Te - ge - 8, oe = (te + ae) / 2, ce = `M ${te} ${M} C ${oe} ${M}, ${oe} ${U}, ${ae} ${U} L ${ae} ${U + L} C ${oe} ${U + L}, ${oe} ${M + B}, ${te} ${M + B} Z`;
5131
5135
  return { f: y, path: ce };
5132
- }), A = new Map(r.map((y) => [y.id, y]));
5136
+ }), D = new Map(r.map((y) => [y.id, y]));
5133
5137
  return r.length === 0 ? null : /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4 dark:border-border dark:bg-card", children: [
5134
5138
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
5135
5139
  /* @__PURE__ */ t("div", { children: [
@@ -5158,14 +5162,14 @@ function Ts({ templateId: a }) {
5158
5162
  y
5159
5163
  )) })
5160
5164
  ] }),
5161
- /* @__PURE__ */ t("svg", { viewBox: `0 0 ${Pe} ${p}`, className: "w-full select-none", children: [
5165
+ /* @__PURE__ */ t("svg", { viewBox: `0 0 ${Te} ${p}`, className: "w-full select-none", children: [
5162
5166
  /* @__PURE__ */ e("title", { children: "Transition flow map" }),
5163
5167
  S.map(
5164
5168
  (y, i) => y ? /* @__PURE__ */ e(
5165
5169
  "path",
5166
5170
  {
5167
5171
  d: y.path,
5168
- fill: y.f.back ? "#ef4444" : Vt,
5172
+ fill: y.f.back ? "#ef4444" : Gt,
5169
5173
  opacity: l === null ? y.f.back ? 0.45 : 0.3 : l === y.f ? 0.75 : 0.08,
5170
5174
  onMouseEnter: () => x(y.f),
5171
5175
  onMouseLeave: () => x(null)
@@ -5184,7 +5188,7 @@ function Ts({ templateId: a }) {
5184
5188
  width: ge,
5185
5189
  height: i.h,
5186
5190
  rx: 4,
5187
- fill: ((_ = A.get(y)) == null ? void 0 : _.color) ?? "#94a3b8",
5191
+ fill: ((_ = D.get(y)) == null ? void 0 : _.color) ?? "#94a3b8",
5188
5192
  opacity: 0.15
5189
5193
  }
5190
5194
  ),
@@ -5196,7 +5200,7 @@ function Ts({ templateId: a }) {
5196
5200
  width: 6,
5197
5201
  height: i.h,
5198
5202
  rx: 2,
5199
- fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5203
+ fill: ((E = D.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5200
5204
  }
5201
5205
  ),
5202
5206
  /* @__PURE__ */ e(
@@ -5206,7 +5210,7 @@ function Ts({ templateId: a }) {
5206
5210
  y: i.y + i.h / 2 + 3,
5207
5211
  textAnchor: "end",
5208
5212
  className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
5209
- children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5213
+ children: (((F = D.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5210
5214
  }
5211
5215
  )
5212
5216
  ] }, `L-${y}`);
@@ -5217,43 +5221,43 @@ function Ts({ templateId: a }) {
5217
5221
  /* @__PURE__ */ e(
5218
5222
  "rect",
5219
5223
  {
5220
- x: Pe - ge,
5224
+ x: Te - ge,
5221
5225
  y: i.y,
5222
5226
  width: ge,
5223
5227
  height: i.h,
5224
5228
  rx: 4,
5225
- fill: ((_ = A.get(y)) == null ? void 0 : _.color) ?? "#94a3b8",
5229
+ fill: ((_ = D.get(y)) == null ? void 0 : _.color) ?? "#94a3b8",
5226
5230
  opacity: 0.15
5227
5231
  }
5228
5232
  ),
5229
5233
  /* @__PURE__ */ e(
5230
5234
  "rect",
5231
5235
  {
5232
- x: Pe - ge - 6,
5236
+ x: Te - ge - 6,
5233
5237
  y: i.y,
5234
5238
  width: 6,
5235
5239
  height: i.h,
5236
5240
  rx: 2,
5237
- fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5241
+ fill: ((E = D.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5238
5242
  }
5239
5243
  ),
5240
5244
  /* @__PURE__ */ e(
5241
5245
  "text",
5242
5246
  {
5243
- x: Pe - ge + 8,
5247
+ x: Te - ge + 8,
5244
5248
  y: i.y + i.h / 2 + 3,
5245
5249
  className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
5246
- children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5250
+ children: (((F = D.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5247
5251
  }
5248
5252
  )
5249
5253
  ] }, `R-${y}`);
5250
5254
  })
5251
5255
  ] }),
5252
5256
  l && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-600", children: [
5253
- /* @__PURE__ */ e("strong", { children: (L = A.get(l.from)) == null ? void 0 : L.label }),
5257
+ /* @__PURE__ */ e("strong", { children: (A = D.get(l.from)) == null ? void 0 : A.label }),
5254
5258
  " →",
5255
5259
  " ",
5256
- /* @__PURE__ */ e("strong", { children: (O = A.get(l.to)) == null ? void 0 : O.label }),
5260
+ /* @__PURE__ */ e("strong", { children: (O = D.get(l.to)) == null ? void 0 : O.label }),
5257
5261
  ": ",
5258
5262
  l.count.toLocaleString(),
5259
5263
  " ",
@@ -5263,7 +5267,7 @@ function Ts({ templateId: a }) {
5263
5267
  ] })
5264
5268
  ] });
5265
5269
  }
5266
- function As({ templateId: a }) {
5270
+ function Ls({ templateId: a }) {
5267
5271
  const n = Z(), [c, g] = $(90), [l, x] = $(0), [o, r] = $(!1), [h, v] = $(!0), { data: u } = H({
5268
5272
  queryKey: ["pipeline-replay", a, c],
5269
5273
  queryFn: () => n.request(V(`/pipelines/${a}/replay`, { days: c })).then((w) => w.data),
@@ -5361,7 +5365,7 @@ function As({ templateId: a }) {
5361
5365
  }) }),
5362
5366
  /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
5363
5367
  /* @__PURE__ */ e(
5364
- P,
5368
+ T,
5365
5369
  {
5366
5370
  size: "sm",
5367
5371
  variant: "outline",
@@ -5393,13 +5397,13 @@ function As({ templateId: a }) {
5393
5397
  ] })
5394
5398
  ] });
5395
5399
  }
5396
- function Ds({ onClose: a }) {
5400
+ function js({ onClose: a }) {
5397
5401
  return xe(() => {
5398
5402
  const n = (c) => {
5399
5403
  c.key === "Escape" && a();
5400
5404
  };
5401
5405
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
5402
- }, [a]), _a(
5406
+ }, [a]), Sa(
5403
5407
  /* @__PURE__ */ t("div", { className: "fixed inset-0 z-[120]", children: [
5404
5408
  /* @__PURE__ */ e(
5405
5409
  "button",
@@ -5425,18 +5429,18 @@ function Ds({ onClose: a }) {
5425
5429
  }
5426
5430
  )
5427
5431
  ] }),
5428
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Ga, { compact: !0 }) })
5432
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Ja, { compact: !0 }) })
5429
5433
  ] })
5430
5434
  ] }),
5431
5435
  document.body
5432
5436
  );
5433
5437
  }
5434
5438
  export {
5435
- ys as AiReviewCard,
5436
- Es as OwnerGapsCard,
5437
- kn as PipelineEditorView,
5438
- qs as PipelineSimulatorCard,
5439
- ws as splitStartNote,
5440
- Gt as splitStartOptions,
5441
- Mt as suggestionList
5439
+ Ns as AiReviewCard,
5440
+ Rs as OwnerGapsCard,
5441
+ Sn as PipelineEditorView,
5442
+ Fs as PipelineSimulatorCard,
5443
+ _s as splitStartNote,
5444
+ Jt as splitStartOptions,
5445
+ zt as suggestionList
5442
5446
  };