@nivaro/react 0.3.57 → 0.3.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/components/fields/RelationField.js +110 -80
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useRelationOptions.js +1 -0
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +37 -2
  6. package/dist/index.js +523 -520
  7. package/dist/shared/components/CollectionBrowserView.js +2693 -2619
  8. package/dist/shared/components/DataTable.js +538 -495
  9. package/dist/shared/components/ItemEditForm.js +4559 -4386
  10. package/dist/shared/components/PageRenderer.js +537 -508
  11. package/dist/shared/components/ProfileView.js +716 -715
  12. package/dist/shared/components/QueryTable.js +74 -74
  13. package/dist/shared/components/RecordReadView.js +367 -364
  14. package/dist/shared/components/ReportView.js +64 -39
  15. package/dist/shared/components/WidgetSlot.js +543 -520
  16. package/dist/shared/components/alerts/AlertManagerView.js +324 -317
  17. package/dist/shared/components/alerts/types.js +37 -14
  18. package/dist/shared/components/cbv/row-focus.js +19 -0
  19. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  20. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  21. package/dist/shared/components/integrations/console/tone.js +52 -30
  22. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  23. package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
  24. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  25. package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
  26. package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
  27. package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
  28. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  29. package/dist/shared/components/item-edit/PlanGrid.js +973 -894
  30. package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
  31. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  32. package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
  33. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
  34. package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
  35. package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
  36. package/dist/shared/components/item-edit/line-midair.js +82 -75
  37. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  38. package/dist/shared/components/item-edit/related-missing.js +45 -0
  39. package/dist/shared/components/item-edit/save-outcome.js +9 -7
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  41. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  42. package/dist/shared/components/panels/ItemLockBanner.js +213 -211
  43. package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
  44. package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
  45. package/dist/shared/components/panels/RevisionsPanel.js +316 -299
  46. package/dist/shared/components/panels/TaskPanel.js +265 -249
  47. package/dist/shared/components/panels/landing-state.js +27 -0
  48. package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
  49. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  50. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  51. package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
  52. package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
  53. package/dist/shared/components/queue/group-sums.js +27 -0
  54. package/dist/shared/components/queue/live-state-aspect.js +9 -5
  55. package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
  56. package/dist/shared/lib/back-closes.js +25 -0
  57. package/dist/shared/lib/display-prefs.js +60 -52
  58. package/dist/shared/lib/draft-store.js +71 -48
  59. package/dist/shared/lib/expression.js +53 -53
  60. package/dist/shared/lib/form-usage-beacon.js +7 -7
  61. package/dist/shared/lib/list-page-memory.js +63 -0
  62. package/dist/shared/lib/live.js +44 -44
  63. package/dist/shared/lib/money-input.js +45 -0
  64. package/dist/shared/lib/own-writes.js +76 -28
  65. package/dist/shared/lib/request-gate.js +110 -109
  66. package/dist/shared/lib/sanitize-html.js +10 -6
  67. package/dist/shared/lib/staged-row-labels.js +18 -0
  68. package/dist/shared/lib/validation-rules.js +34 -19
  69. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ const s = (i) => String(i ?? "").toUpperCase();
2
+ function k(i, u, p) {
3
+ const n = new Map(u.map((t) => [s(t.id), t])).get(s(i));
4
+ if (!n) return null;
5
+ if (!p) return { state: n, skipped: [] };
6
+ const a = (t) => {
7
+ for (const [e, o] of Object.entries(p)) if (s(e) === s(t)) return o;
8
+ }, b = [...u].filter((t) => t.sort != null && Number.isFinite(Number(t.sort))).sort((t, e) => Number(t.sort) - Number(e.sort)), d = [];
9
+ let r = n;
10
+ for (let t = 0; t < u.length; t++) {
11
+ const e = a(r.id);
12
+ if (!(e != null && e.skipped)) break;
13
+ d.push({ state: r, reasons: (e.skip_reasons ?? []).filter(Boolean) });
14
+ const o = b.find(
15
+ (f) => {
16
+ var l;
17
+ return Number(f.sort) > Number(r.sort) && ((l = a(f.id)) == null ? void 0 : l.on_path) !== !1;
18
+ }
19
+ );
20
+ if (!o) return { state: n, skipped: [] };
21
+ r = o;
22
+ }
23
+ return { state: r, skipped: d };
24
+ }
25
+ export {
26
+ k as landingState
27
+ };
@@ -750,8 +750,8 @@ function rs({
750
750
  placeholder: "Field…",
751
751
  onChange: (i) => {
752
752
  const _ = i.path.join(".");
753
- r((F) => ({
754
- ...F,
753
+ r((E) => ({
754
+ ...E,
755
755
  [_]: {
756
756
  type: i.fieldType,
757
757
  relatedCollection: i.relatedCollection
@@ -2012,9 +2012,9 @@ function bs({
2012
2012
  required: i.required
2013
2013
  });
2014
2014
  }, O = (i) => {
2015
- const { active: _, over: F } = i;
2016
- if (!F || _.id === F.id) return;
2017
- const E = x.indexOf(_.id), B = x.indexOf(F.id), j = Ve(x, E, B);
2015
+ const { active: _, over: E } = i;
2016
+ if (!E || _.id === E.id) return;
2017
+ const F = x.indexOf(_.id), B = x.indexOf(E.id), j = Ve(x, F, B);
2018
2018
  o(j), j.forEach((K, W) => {
2019
2019
  var te;
2020
2020
  ((te = l.find((ae) => ae.id === K)) == null ? void 0 : te.sort) !== W && S.mutate({ dimId: K, body: { sort: W } });
@@ -2039,11 +2039,11 @@ function bs({
2039
2039
  relations: (b == null ? void 0 : b.relations) ?? [],
2040
2040
  value: d.field,
2041
2041
  onChange: (_) => {
2042
- const F = _.path.join(".");
2043
- N((E) => ({
2044
- ...E,
2045
- field: F,
2046
- label: E.label || _.pathLabels.join(" → ")
2042
+ const E = _.path.join(".");
2043
+ N((F) => ({
2044
+ ...F,
2045
+ field: E,
2046
+ label: F.label || _.pathLabels.join(" → ")
2047
2047
  }));
2048
2048
  },
2049
2049
  onClear: () => N((_) => ({ ..._, field: "" }))
@@ -2056,7 +2056,7 @@ function bs({
2056
2056
  U,
2057
2057
  {
2058
2058
  value: d.label,
2059
- onChange: (_) => N((F) => ({ ...F, label: _.target.value })),
2059
+ onChange: (_) => N((E) => ({ ...E, label: _.target.value })),
2060
2060
  placeholder: "e.g. Region",
2061
2061
  className: "h-8 text-[13px]"
2062
2062
  }
@@ -2068,7 +2068,7 @@ function bs({
2068
2068
  {
2069
2069
  type: "checkbox",
2070
2070
  checked: d.is_row_axis,
2071
- onChange: (_) => N((F) => ({ ...F, is_row_axis: _.target.checked })),
2071
+ onChange: (_) => N((E) => ({ ...E, is_row_axis: _.target.checked })),
2072
2072
  className: "rounded"
2073
2073
  }
2074
2074
  ),
@@ -2080,7 +2080,7 @@ function bs({
2080
2080
  {
2081
2081
  type: "checkbox",
2082
2082
  checked: d.required,
2083
- onChange: (_) => N((F) => ({ ...F, required: _.target.checked })),
2083
+ onChange: (_) => N((E) => ({ ...E, required: _.target.checked })),
2084
2084
  className: "rounded"
2085
2085
  }
2086
2086
  ),
@@ -2144,10 +2144,10 @@ function bs({
2144
2144
  value: m.field,
2145
2145
  onChange: (i) => {
2146
2146
  const _ = i.path.join(".");
2147
- f((F) => ({
2148
- ...F,
2147
+ f((E) => ({
2148
+ ...E,
2149
2149
  field: _,
2150
- label: F.label || i.pathLabels.join(" → ")
2150
+ label: E.label || i.pathLabels.join(" → ")
2151
2151
  }));
2152
2152
  },
2153
2153
  onClear: () => f((i) => ({ ...i, field: "" }))
@@ -2208,7 +2208,7 @@ function bs({
2208
2208
  ] })
2209
2209
  ] });
2210
2210
  }
2211
- function wn({
2211
+ function kn({
2212
2212
  templateId: a,
2213
2213
  onBack: n,
2214
2214
  onExport: c,
@@ -2217,7 +2217,7 @@ function wn({
2217
2217
  var qt;
2218
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] = $(
2219
2219
  null
2220
- ), [y, i] = $(""), [_, F] = $(""), [E, B] = $(null), [j, K] = $(!1), [W, te] = $([]), ae = Kt(
2220
+ ), [y, i] = $(""), [_, E] = $(""), [F, B] = $(null), [j, K] = $(!1), [W, te] = $([]), ae = Kt(
2221
2221
  Ye(zt),
2222
2222
  Ye(Bt, { coordinateGetter: Qt })
2223
2223
  ), { data: oe } = H({
@@ -2437,7 +2437,7 @@ function wn({
2437
2437
  }), wt = M({
2438
2438
  mutationFn: (s) => l.request(I(`/pipelines/${a}/bind`, s)),
2439
2439
  onSuccess: () => {
2440
- le(), i(""), F(""), T.success("Collection bound");
2440
+ le(), i(""), E(""), T.success("Collection bound");
2441
2441
  },
2442
2442
  onError: () => T.error("Failed to bind collection")
2443
2443
  }), sa = M({
@@ -2686,15 +2686,15 @@ function wn({
2686
2686
  {
2687
2687
  s,
2688
2688
  groups: (Ze == null ? void 0 : Ze[s.id]) ?? [],
2689
- expandedStateId: E,
2690
- onToggleExpand: () => B(E === s.id ? null : s.id),
2689
+ expandedStateId: F,
2690
+ onToggleExpand: () => B(F === s.id ? null : s.id),
2691
2691
  onEdit: () => f(s),
2692
2692
  onDelete: () => {
2693
2693
  confirm(`Delete state "${s.label}"?`) && ea.mutate(s.id);
2694
2694
  }
2695
2695
  }
2696
2696
  ),
2697
- E === 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: [
2697
+ 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
2698
  /* @__PURE__ */ e(
2699
2699
  Ha,
2700
2700
  {
@@ -3249,7 +3249,7 @@ function wn({
3249
3249
  pe,
3250
3250
  {
3251
3251
  value: _,
3252
- onChange: F,
3252
+ onChange: E,
3253
3253
  options: (oe ?? []).map((s) => ({
3254
3254
  value: s.field,
3255
3255
  label: s.field
@@ -3306,13 +3306,13 @@ function wn({
3306
3306
  ] }),
3307
3307
  /* @__PURE__ */ e(za, { templateId: a, states: st, bindings: ue })
3308
3308
  ] }),
3309
- j && /* @__PURE__ */ e(As, { onClose: () => K(!1) }),
3309
+ j && /* @__PURE__ */ e(Ds, { onClose: () => K(!1) }),
3310
3310
  !o.has("simulator") && /* @__PURE__ */ e(qs, { bindings: ue }),
3311
- !o.has("canvas") && /* @__PURE__ */ e(Rs, { templateId: a }),
3312
- !o.has("flow-map") && /* @__PURE__ */ e(Ps, { templateId: a }),
3311
+ !o.has("canvas") && /* @__PURE__ */ e(Ps, { templateId: a }),
3312
+ !o.has("flow-map") && /* @__PURE__ */ e(Ts, { templateId: a }),
3313
3313
  !o.has("cumulative-flow") && /* @__PURE__ */ e(Pa, { templateId: a }),
3314
- !o.has("replay") && /* @__PURE__ */ e(Ts, { templateId: a }),
3315
- !o.has("migration") && /* @__PURE__ */ e(Os, { templateId: a }),
3314
+ !o.has("replay") && /* @__PURE__ */ e(As, { templateId: a }),
3315
+ !o.has("migration") && /* @__PURE__ */ e(Rs, { templateId: a }),
3316
3316
  !o.has("lint") && /* @__PURE__ */ e(Qa, { templateId: a }),
3317
3317
  !o.has("coverage") && /* @__PURE__ */ e(Es, { templateId: a, states: re }),
3318
3318
  !o.has("skip-report") && /* @__PURE__ */ e(Wa, { templateId: a }),
@@ -4392,7 +4392,7 @@ function Es({
4392
4392
  A.set(i, [...A.get(i) ?? [], y]);
4393
4393
  }
4394
4394
  const L = [...A.entries()].sort(
4395
- (y, i) => i[1].reduce((_, F) => _ + F.count, 0) - y[1].reduce((_, F) => _ + F.count, 0)
4395
+ (y, i) => i[1].reduce((_, E) => _ + E.count, 0) - y[1].reduce((_, E) => _ + E.count, 0)
4396
4396
  ), O = (y, i) => /* @__PURE__ */ t(
4397
4397
  "span",
4398
4398
  {
@@ -4432,13 +4432,21 @@ function Es({
4432
4432
  k > 0 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground", children: [
4433
4433
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-500" }),
4434
4434
  /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: k }),
4435
- " unowned record",
4435
+ " record",
4436
4436
  k === 1 ? "" : "s",
4437
- " across",
4437
+ " with no owner group across",
4438
4438
  " ",
4439
4439
  /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: b.length }),
4440
4440
  " combination",
4441
- b.length === 1 ? "" : "s"
4441
+ b.length === 1 ? "" : "s",
4442
+ /* @__PURE__ */ e(
4443
+ "span",
4444
+ {
4445
+ className: "ml-1 text-[11px] font-normal text-slate-500 dark:text-muted-foreground",
4446
+ "data-tip": "Queues may still list an owner for these: when no group covers a step, the record’s creator stands in as a fallback owner.",
4447
+ children: "(the creator may still stand in)"
4448
+ }
4449
+ )
4442
4450
  ] }),
4443
4451
  ((p == null ? void 0 : p.group_seats) ?? 0) > 0 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground", children: [
4444
4452
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-violet-500" }),
@@ -4539,7 +4547,7 @@ function Es({
4539
4547
  ] })
4540
4548
  ] }),
4541
4549
  L.map(([y, i]) => {
4542
- const _ = S.get(y), F = i.reduce((E, B) => E + B.count, 0);
4550
+ const _ = S.get(y), E = i.reduce((F, B) => F + B.count, 0);
4543
4551
  return /* @__PURE__ */ t(
4544
4552
  "div",
4545
4553
  {
@@ -4555,9 +4563,9 @@ function Es({
4555
4563
  ),
4556
4564
  /* @__PURE__ */ e("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-foreground", children: (_ == null ? void 0 : _.label) ?? Jt(y) }),
4557
4565
  /* @__PURE__ */ t("span", { className: "ml-auto text-[11px] tabular-nums text-slate-400", children: [
4558
- F,
4566
+ E,
4559
4567
  " record",
4560
- F === 1 ? "" : "s",
4568
+ E === 1 ? "" : "s",
4561
4569
  " · ",
4562
4570
  i.length,
4563
4571
  " ",
@@ -4565,22 +4573,22 @@ function Es({
4565
4573
  i.length === 1 ? "" : "s"
4566
4574
  ] })
4567
4575
  ] }),
4568
- /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: i.map((E, B) => {
4569
- const j = `${E.state_id}|${JSON.stringify(E.dims)}`;
4576
+ /* @__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)}`;
4570
4578
  return (
4571
4579
  // biome-ignore lint/suspicious/noArrayIndexKey: server-ordered clusters
4572
4580
  /* @__PURE__ */ t("div", { className: "px-3 py-2", children: [
4573
4581
  /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: [
4574
- /* @__PURE__ */ e("span", { className: "w-8 shrink-0 text-[13px] font-semibold tabular-nums text-slate-800 dark:text-foreground", children: E.count }),
4575
- Object.entries(E.dims).filter(([, K]) => K).length > 0 ? Object.entries(E.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" }),
4582
+ /* @__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" }),
4576
4584
  /* @__PURE__ */ t(
4577
4585
  "span",
4578
4586
  {
4579
- className: "ml-auto max-w-[180px] truncate text-[10.5px] text-slate-400",
4580
- "data-tip": E.sample_items.join(", "),
4587
+ className: "ml-auto max-w-[220px] truncate text-[10.5px] text-slate-400",
4588
+ "data-tip": (F.sample_labels ?? F.sample_items).join(", "),
4581
4589
  children: [
4582
4590
  "e.g. ",
4583
- E.sample_items.slice(0, 3).join(", ")
4591
+ (F.sample_labels ?? F.sample_items).slice(0, 3).join(", ")
4584
4592
  ]
4585
4593
  }
4586
4594
  ),
@@ -4597,24 +4605,30 @@ function Es({
4597
4605
  }
4598
4606
  )
4599
4607
  ] }),
4600
- E.reason && /* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed text-slate-600 dark:text-slate-300", children: E.reason }),
4601
- /* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed", children: E.suggestion ? /* @__PURE__ */ t(_e, { children: [
4608
+ F.reason && /* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed text-slate-600 dark:text-slate-300", children: F.reason }),
4609
+ /* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed", children: F.suggestion ? /* @__PURE__ */ t(_e, { children: [
4602
4610
  /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
4603
4611
  "Closest group",
4604
4612
  " "
4605
4613
  ] }),
4606
- /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: E.suggestion.group_label }),
4614
+ /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: F.suggestion.group_label }),
4607
4615
  /* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
4608
4616
  " ",
4609
4617
  "already matches",
4610
4618
  " ",
4611
- Mt(E.suggestion.matched_filters.join(", ")) || "nothing"
4619
+ Mt(
4620
+ F.suggestion.matched_labels,
4621
+ F.suggestion.matched_filters
4622
+ ) || "nothing"
4612
4623
  ] }),
4613
- E.suggestion.mismatched_filters.length > 0 && /* @__PURE__ */ t("span", { className: "text-amber-700 dark:text-amber-400", children: [
4624
+ F.suggestion.mismatched_filters.length > 0 && /* @__PURE__ */ t("span", { className: "text-amber-700 dark:text-amber-400", children: [
4614
4625
  " ",
4615
4626
  "— it misses",
4616
4627
  " ",
4617
- Mt(E.suggestion.mismatched_filters.join(", ")),
4628
+ Mt(
4629
+ F.suggestion.missing_labels,
4630
+ F.suggestion.mismatched_filters
4631
+ ),
4618
4632
  ", so assigning creates a group for this combination"
4619
4633
  ] })
4620
4634
  ] }) : /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1 text-amber-700 dark:text-amber-400", children: [
@@ -4625,7 +4639,7 @@ function Es({
4625
4639
  $s,
4626
4640
  {
4627
4641
  templateId: a,
4628
- cluster: E,
4642
+ cluster: F,
4629
4643
  onDone: () => v(null)
4630
4644
  }
4631
4645
  )
@@ -4668,10 +4682,13 @@ function Xt(a) {
4668
4682
  const c = n[n.length - 1].replace(/s$/i, "");
4669
4683
  return Jt(c);
4670
4684
  }
4671
- function Mt(a) {
4685
+ function Os(a) {
4672
4686
  return a.replace(/[a-z_]+(?:\.[a-z_]+)+/g, (n) => Xt(n));
4673
4687
  }
4674
- function Os({ templateId: a }) {
4688
+ function Mt(a, n) {
4689
+ return Array.isArray(a) && a.length > 0 ? a.join(", ") : Os(n.map((c) => c.replace(/ \(wants \d+\)$/, "")).join(", "));
4690
+ }
4691
+ function Rs({ templateId: a }) {
4675
4692
  const n = Z(), c = ke(), [g, l] = $(""), [x, o] = $(""), [r, h] = $(!1), { data: v } = H({
4676
4693
  queryKey: ["instance-distribution", a],
4677
4694
  queryFn: () => n.request(V(`/pipelines/${a}/instance-distribution`)),
@@ -4788,7 +4805,7 @@ function Os({ templateId: a }) {
4788
4805
  ] })
4789
4806
  ] });
4790
4807
  }
4791
- function Rs({ templateId: a }) {
4808
+ function Ps({ templateId: a }) {
4792
4809
  const n = Z(), [c, g] = $(
4793
4810
  null
4794
4811
  ), [l, x] = $(() => {
@@ -4803,19 +4820,19 @@ function Rs({ templateId: a }) {
4803
4820
  staleTime: 3e4
4804
4821
  }), h = (r == null ? void 0 : r.states) ?? [], v = (r == null ? void 0 : r.transitions) ?? [], u = wa(() => {
4805
4822
  var Me;
4806
- const i = new Map(h.map((Q) => [String(Q.id).toUpperCase(), Q])), _ = /* @__PURE__ */ new Map(), F = h.filter((Q) => Q.is_initial).map((Q) => ({ id: String(Q.id).toUpperCase(), r: 0 })), E = /* @__PURE__ */ new Map();
4823
+ 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();
4807
4824
  for (const Q of v) {
4808
4825
  if (!Q.from_state) continue;
4809
4826
  const X = String(Q.from_state).toUpperCase();
4810
- E.set(X, [...E.get(X) ?? [], String(Q.to_state).toUpperCase()]);
4827
+ F.set(X, [...F.get(X) ?? [], String(Q.to_state).toUpperCase()]);
4811
4828
  }
4812
- for (; F.length > 0; ) {
4813
- const { id: Q, r: X } = F.shift();
4829
+ for (; E.length > 0; ) {
4830
+ const { id: Q, r: X } = E.shift();
4814
4831
  if (!(_.has(Q) && _.get(Q) <= X)) {
4815
4832
  _.has(Q) || _.set(Q, X);
4816
- for (const de of E.get(Q) ?? []) {
4833
+ for (const de of F.get(Q) ?? []) {
4817
4834
  const me = i.get(de);
4818
- !_.has(de) && (((Me = i.get(Q)) == null ? void 0 : Me.sort) ?? 0) <= ((me == null ? void 0 : me.sort) ?? 0) && F.push({ id: de, r: X + 1 });
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 });
4819
4836
  }
4820
4837
  }
4821
4838
  }
@@ -4857,17 +4874,17 @@ function Rs({ templateId: a }) {
4857
4874
  m(i);
4858
4875
  return;
4859
4876
  }
4860
- const F = d(i);
4861
- o.current = { id: i, startX: _.clientX, startY: _.clientY, origX: F.x, origY: F.y }, _.target.setPointerCapture(_.pointerId);
4877
+ const E = d(i);
4878
+ o.current = { id: i, startX: _.clientX, startY: _.clientY, origX: E.x, origY: E.y }, _.target.setPointerCapture(_.pointerId);
4862
4879
  }, S = (i) => {
4863
4880
  if (N) {
4864
- const F = i.currentTarget.getBoundingClientRect();
4865
- b({ x: i.clientX - F.left, y: i.clientY - F.top });
4881
+ const E = i.currentTarget.getBoundingClientRect();
4882
+ b({ x: i.clientX - E.left, y: i.clientY - E.top });
4866
4883
  return;
4867
4884
  }
4868
4885
  const _ = o.current;
4869
- _ && x((F) => ({
4870
- ...F,
4886
+ _ && x((E) => ({
4887
+ ...E,
4871
4888
  [_.id]: {
4872
4889
  x: Math.max(0, _.origX + i.clientX - _.startX),
4873
4890
  y: Math.max(0, _.origY + i.clientY - _.startY)
@@ -4877,8 +4894,8 @@ function Rs({ templateId: a }) {
4877
4894
  if (N) {
4878
4895
  if (f) {
4879
4896
  const i = h.find((_) => {
4880
- const F = String(_.id).toUpperCase(), E = d(F);
4881
- return f.x >= E.x && f.x <= E.x + u.NODE_W && f.y >= E.y && f.y <= E.y + u.NODE_H && F !== N;
4897
+ const E = String(_.id).toUpperCase(), F = d(E);
4898
+ return f.x >= F.x && f.x <= F.x + u.NODE_W && f.y >= F.y && f.y <= F.y + u.NODE_H && E !== N;
4882
4899
  });
4883
4900
  i && w.mutate({ from: N, to: String(i.id) });
4884
4901
  }
@@ -4887,11 +4904,11 @@ function Rs({ templateId: a }) {
4887
4904
  }
4888
4905
  o.current && (o.current = null, x((i) => (localStorage.setItem(`nvr_canvas_${a}`, JSON.stringify(i)), i)));
4889
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) => {
4890
- const F = Array.from(document.querySelectorAll("h3, p, span, button")).find((E) => {
4907
+ const E = Array.from(document.querySelectorAll("h3, p, span, button")).find((F) => {
4891
4908
  var B;
4892
- return ((B = E.textContent) == null ? void 0 : B.trim()) === i;
4909
+ return ((B = F.textContent) == null ? void 0 : B.trim()) === i;
4893
4910
  });
4894
- F == null || F.scrollIntoView({ behavior: "smooth", block: "center" });
4911
+ E == null || E.scrollIntoView({ behavior: "smooth", block: "center" });
4895
4912
  };
4896
4913
  return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
4897
4914
  /* @__PURE__ */ e("h3", { className: "text-[14px] font-semibold text-slate-800 dark:text-foreground", children: "Canvas" }),
@@ -4920,7 +4937,7 @@ function Rs({ templateId: a }) {
4920
4937
  ) }),
4921
4938
  v.map((i) => {
4922
4939
  if (!i.from_state) return null;
4923
- const _ = d(String(i.from_state).toUpperCase()), F = d(String(i.to_state).toUpperCase()), E = _.x + u.NODE_W, B = _.y + u.NODE_H / 2, j = F.x, K = F.y + u.NODE_H / 2, W = j < E, te = W ? Math.max(E, j + u.NODE_W) + 40 : (E + j) / 2, ae = W ? `M ${E} ${B} C ${E + 60} ${B - 40}, ${j - 60} ${K - 40}, ${j} ${K}` : `M ${E} ${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;
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;
4924
4941
  return (
4925
4942
  // biome-ignore lint/a11y/useKeyWithClickEvents: canvas edge, inspect-only
4926
4943
  /* @__PURE__ */ t(
@@ -4944,7 +4961,7 @@ function Rs({ templateId: a }) {
4944
4961
  (i.auto_trigger || ce) && /* @__PURE__ */ t(
4945
4962
  "text",
4946
4963
  {
4947
- x: (E + j) / 2,
4964
+ x: (F + j) / 2,
4948
4965
  y: (B + K) / 2 - 6,
4949
4966
  textAnchor: "middle",
4950
4967
  className: "fill-slate-500 text-[11px]",
@@ -4973,13 +4990,13 @@ function Rs({ templateId: a }) {
4973
4990
  }
4974
4991
  ),
4975
4992
  h.map((i) => {
4976
- const _ = String(i.id).toUpperCase(), F = d(_), E = (c == null ? void 0 : c.kind) === "state" && c.id === String(i.id);
4993
+ const _ = String(i.id).toUpperCase(), E = d(_), F = (c == null ? void 0 : c.kind) === "state" && c.id === String(i.id);
4977
4994
  return (
4978
4995
  // biome-ignore lint/a11y/useKeyWithClickEvents: draggable canvas node
4979
4996
  /* @__PURE__ */ t(
4980
4997
  "g",
4981
4998
  {
4982
- transform: `translate(${F.x}, ${F.y})`,
4999
+ transform: `translate(${E.x}, ${E.y})`,
4983
5000
  onPointerDown: (B) => k(_, B),
4984
5001
  onClick: () => g({ kind: "state", id: String(i.id) }),
4985
5002
  className: "cursor-grab",
@@ -4990,8 +5007,8 @@ function Rs({ templateId: a }) {
4990
5007
  width: u.NODE_W,
4991
5008
  height: u.NODE_H,
4992
5009
  rx: 8,
4993
- strokeWidth: E ? 2 : 1,
4994
- className: E ? "fill-white stroke-nvr-cyan dark:fill-card" : "fill-white stroke-slate-300 dark:fill-card dark:stroke-slate-600"
5010
+ strokeWidth: F ? 2 : 1,
5011
+ className: F ? "fill-white stroke-nvr-cyan dark:fill-card" : "fill-white stroke-slate-300 dark:fill-card dark:stroke-slate-600"
4995
5012
  }
4996
5013
  ),
4997
5014
  /* @__PURE__ */ e("circle", { cx: 14, cy: u.NODE_H / 2, r: 4, fill: i.color ?? "#94a3b8" }),
@@ -5085,7 +5102,7 @@ function Rs({ templateId: a }) {
5085
5102
  ] })
5086
5103
  ] });
5087
5104
  }
5088
- function Ps({ templateId: a }) {
5105
+ function Ts({ templateId: a }) {
5089
5106
  var L, O;
5090
5107
  const n = Z(), [c, g] = $(90), [l, x] = $(null), { data: o } = H({
5091
5108
  queryKey: ["flow-map", a, c],
@@ -5097,18 +5114,18 @@ function Ps({ templateId: a }) {
5097
5114
  for (const y of h)
5098
5115
  u.set(y.from, (u.get(y.from) ?? 0) + y.count), d.set(y.to, (d.get(y.to) ?? 0) + y.count);
5099
5116
  const N = Math.max(360, r.length * 46), m = (y) => {
5100
- const i = r.filter((j) => (y.get(j.id) ?? 0) > 0), _ = [...y.values()].reduce((j, K) => j + K, 0) || 1, F = (i.length + 1) * 8;
5101
- let E = 20;
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;
5118
+ let F = 20;
5102
5119
  const B = /* @__PURE__ */ new Map();
5103
5120
  for (const j of i) {
5104
- const K = Math.max(14, (y.get(j.id) ?? 0) / _ * (N - F - 40));
5105
- B.set(j.id, { y: E, h: K }), E += K + 8;
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;
5106
5123
  }
5107
- return { pos: B, height: E + 20 };
5124
+ return { pos: B, height: F + 20 };
5108
5125
  }, 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) => {
5109
5126
  const i = f.pos.get(y.from), _ = b.pos.get(y.to);
5110
5127
  if (!i || !_) return null;
5111
- const F = y.count / Math.max(1, u.get(y.from) ?? 1), E = y.count / Math.max(1, d.get(y.to) ?? 1), B = Math.max(1.5, i.h * F), j = Math.max(1.5, _.h * E), K = i.y + (w.get(y.from) ?? 0), W = _.y + (k.get(y.to) ?? 0);
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);
5112
5129
  w.set(y.from, (w.get(y.from) ?? 0) + B), k.set(y.to, (k.get(y.to) ?? 0) + j);
5113
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`;
5114
5131
  return { f: y, path: ce };
@@ -5157,7 +5174,7 @@ function Ps({ templateId: a }) {
5157
5174
  ) : null
5158
5175
  ),
5159
5176
  [...f.pos.entries()].map(([y, i]) => {
5160
- var _, F, E;
5177
+ var _, E, F;
5161
5178
  return /* @__PURE__ */ t("g", { children: [
5162
5179
  /* @__PURE__ */ e(
5163
5180
  "rect",
@@ -5179,7 +5196,7 @@ function Ps({ templateId: a }) {
5179
5196
  width: 6,
5180
5197
  height: i.h,
5181
5198
  rx: 2,
5182
- fill: ((F = A.get(y)) == null ? void 0 : F.color) ?? "#94a3b8"
5199
+ fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5183
5200
  }
5184
5201
  ),
5185
5202
  /* @__PURE__ */ e(
@@ -5189,13 +5206,13 @@ function Ps({ templateId: a }) {
5189
5206
  y: i.y + i.h / 2 + 3,
5190
5207
  textAnchor: "end",
5191
5208
  className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
5192
- children: (((E = A.get(y)) == null ? void 0 : E.label) ?? "").slice(0, 32)
5209
+ children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5193
5210
  }
5194
5211
  )
5195
5212
  ] }, `L-${y}`);
5196
5213
  }),
5197
5214
  [...b.pos.entries()].map(([y, i]) => {
5198
- var _, F, E;
5215
+ var _, E, F;
5199
5216
  return /* @__PURE__ */ t("g", { children: [
5200
5217
  /* @__PURE__ */ e(
5201
5218
  "rect",
@@ -5217,7 +5234,7 @@ function Ps({ templateId: a }) {
5217
5234
  width: 6,
5218
5235
  height: i.h,
5219
5236
  rx: 2,
5220
- fill: ((F = A.get(y)) == null ? void 0 : F.color) ?? "#94a3b8"
5237
+ fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
5221
5238
  }
5222
5239
  ),
5223
5240
  /* @__PURE__ */ e(
@@ -5226,7 +5243,7 @@ function Ps({ templateId: a }) {
5226
5243
  x: Pe - ge + 8,
5227
5244
  y: i.y + i.h / 2 + 3,
5228
5245
  className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
5229
- children: (((E = A.get(y)) == null ? void 0 : E.label) ?? "").slice(0, 32)
5246
+ children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
5230
5247
  }
5231
5248
  )
5232
5249
  ] }, `R-${y}`);
@@ -5246,7 +5263,7 @@ function Ps({ templateId: a }) {
5246
5263
  ] })
5247
5264
  ] });
5248
5265
  }
5249
- function Ts({ templateId: a }) {
5266
+ function As({ templateId: a }) {
5250
5267
  const n = Z(), [c, g] = $(90), [l, x] = $(0), [o, r] = $(!1), [h, v] = $(!0), { data: u } = H({
5251
5268
  queryKey: ["pipeline-replay", a, c],
5252
5269
  queryFn: () => n.request(V(`/pipelines/${a}/replay`, { days: c })).then((w) => w.data),
@@ -5376,7 +5393,7 @@ function Ts({ templateId: a }) {
5376
5393
  ] })
5377
5394
  ] });
5378
5395
  }
5379
- function As({ onClose: a }) {
5396
+ function Ds({ onClose: a }) {
5380
5397
  return xe(() => {
5381
5398
  const n = (c) => {
5382
5399
  c.key === "Escape" && a();
@@ -5417,8 +5434,9 @@ function As({ onClose: a }) {
5417
5434
  export {
5418
5435
  ys as AiReviewCard,
5419
5436
  Es as OwnerGapsCard,
5420
- wn as PipelineEditorView,
5437
+ kn as PipelineEditorView,
5421
5438
  qs as PipelineSimulatorCard,
5422
5439
  ws as splitStartNote,
5423
- Gt as splitStartOptions
5440
+ Gt as splitStartOptions,
5441
+ Mt as suggestionList
5424
5442
  };