@nivaro/react 0.3.139 → 0.3.141

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 (100) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +39 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2702 -2671
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3475 -3458
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/RowPresence.js +83 -76
  23. package/dist/shared/components/SlaRulesView.js +73 -74
  24. package/dist/shared/components/UnseenDot.js +183 -22
  25. package/dist/shared/components/WidgetSlot.js +73 -73
  26. package/dist/shared/components/ai/AiChart.js +36 -32
  27. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  28. package/dist/shared/components/ai/TaskDo.js +87 -87
  29. package/dist/shared/components/ai/answer-formats.js +37 -30
  30. package/dist/shared/components/ai/call-log/format.js +17 -16
  31. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  32. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  33. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  34. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  35. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  36. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  37. package/dist/shared/components/cbv/column-totals.js +53 -51
  38. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  40. package/dist/shared/components/command-center/announce.js +7 -6
  41. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  42. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  43. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  44. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  45. package/dist/shared/components/delivery-analytics/drill.js +32 -32
  46. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  47. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  48. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  49. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  50. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  51. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  52. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  53. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  54. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  55. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  56. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  57. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  58. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  59. package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
  60. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  61. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  62. package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
  63. package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
  64. package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
  65. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  66. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  67. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
  68. package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
  69. package/dist/shared/components/layout-editor/settings/controls.js +98 -90
  70. package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
  71. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  72. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  73. package/dist/shared/components/ops-report/format.js +37 -36
  74. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  75. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  76. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  77. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  78. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  79. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  80. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  81. package/dist/shared/components/profile/DelegationCard.js +13 -12
  82. package/dist/shared/components/profile/PersonActivity.js +48 -48
  83. package/dist/shared/components/profile/PersonExtras.js +107 -107
  84. package/dist/shared/components/profile/PersonWeek.js +9 -9
  85. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  86. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  87. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  88. package/dist/shared/components/queue/QueueWorklist.js +884 -872
  89. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  90. package/dist/shared/components/support/RequestList.js +123 -123
  91. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  92. package/dist/shared/lib/activity-sentence.js +251 -229
  93. package/dist/shared/lib/format-value.js +5 -4
  94. package/dist/shared/lib/layout-resolve.js +64 -48
  95. package/dist/shared/lib/number-format.js +87 -0
  96. package/dist/shared/lib/number-kind.js +133 -0
  97. package/dist/shared/lib/utils.js +24 -20
  98. package/dist/shared/lib/watch-list.js +1 -1
  99. package/dist/shared/lib/widget-value-format.js +26 -12
  100. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { useState as v, useCallback as C } from "react";
3
- import { PieChart as x, Pie as S, Cell as w, Tooltip as f, LineChart as p, CartesianGrid as u, XAxis as b, YAxis as s, Line as L, BarChart as R, Bar as z } from "recharts";
4
- import { cn as K } from "../../lib/utils.js";
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
+ import { useState as v, useCallback as S } from "react";
3
+ import { PieChart as w, Pie as x, Cell as p, Tooltip as h, LineChart as K, CartesianGrid as u, XAxis as b, YAxis as s, Line as L, BarChart as N, Bar as R } from "recharts";
4
+ import { cn as $ } from "../../lib/utils.js";
5
5
  const g = [
6
6
  "#0ea5e9",
7
7
  "#6366f1",
@@ -11,12 +11,16 @@ const g = [
11
11
  "#8b5cf6",
12
12
  "#14b8a6",
13
13
  "#f97316"
14
- ];
15
- function F({ spec: e, onPoint: o }) {
16
- const r = o ? (t) => t != null && o(String(t), e) : void 0, [y, m] = v(0), k = C((t) => {
14
+ ], z = new Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1 });
15
+ function O({ spec: e, onPoint: n }) {
16
+ const i = n ? (t) => t != null && n(String(t), e) : void 0, [y, f] = v(0), k = S((t) => {
17
17
  if (!t) return;
18
- m(t.getBoundingClientRect().width), new ResizeObserver(() => m(t.getBoundingClientRect().width)).observe(t);
19
- }, []), d = e.type === "pie" ? 220 : 200, h = Math.max(240, Math.min(720, y || 400)), i = (t) => Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(t % 1e3 === 0 ? 0 : 1)}k` : t.toLocaleString(), c = {
18
+ f(t.getBoundingClientRect().width), new ResizeObserver(() => f(t.getBoundingClientRect().width)).observe(t);
19
+ }, []), d = e.type === "pie" ? 220 : 200, c = Math.max(240, Math.min(720, y || 400)), o = (t) => {
20
+ if (!Number.isFinite(t)) return String(t);
21
+ const r = Math.abs(t), C = r >= 1e3 ? z.format(r).replace(/K$/, "k") : r.toLocaleString();
22
+ return `${t < 0 ? "-" : ""}${e.unit === "currency" ? "$" : ""}${C}`;
23
+ }, m = {
20
24
  contentStyle: {
21
25
  background: "#0f172a",
22
26
  border: "1px solid #334155",
@@ -27,18 +31,18 @@ function F({ spec: e, onPoint: o }) {
27
31
  itemStyle: { color: "#f8fafc" },
28
32
  labelStyle: { color: "#cbd5e1" }
29
33
  };
30
- return /* @__PURE__ */ n(
34
+ return /* @__PURE__ */ l(
31
35
  "div",
32
36
  {
33
37
  ref: k,
34
38
  "data-ai-chart": e.type,
35
- "data-ai-chart-drill": o ? "" : void 0,
36
- className: K("my-2 w-full", o && "[&_.recharts-wrapper]:cursor-pointer"),
39
+ "data-ai-chart-drill": n ? "" : void 0,
40
+ className: $("my-2 w-full", n && "[&_.recharts-wrapper]:cursor-pointer"),
37
41
  children: [
38
42
  e.title && /* @__PURE__ */ a("div", { className: "mb-1 text-[0.9em] font-medium text-muted-foreground", children: e.title }),
39
- e.type === "pie" ? /* @__PURE__ */ n(x, { width: h, height: d, children: [
43
+ e.type === "pie" ? /* @__PURE__ */ l(w, { width: c, height: d, children: [
40
44
  /* @__PURE__ */ a(
41
- S,
45
+ x,
42
46
  {
43
47
  data: e.data,
44
48
  dataKey: "value",
@@ -46,26 +50,26 @@ function F({ spec: e, onPoint: o }) {
46
50
  cx: "50%",
47
51
  cy: "50%",
48
52
  outerRadius: 80,
49
- label: ({ name: t, percent: l }) => `${t} ${Math.round((l ?? 0) * 100)}%`,
53
+ label: ({ name: t, percent: r }) => `${t} ${Math.round((r ?? 0) * 100)}%`,
50
54
  labelLine: !1,
51
- onClick: r ? (t) => r((t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.name)) : void 0,
52
- children: e.data.map((t, l) => /* @__PURE__ */ a(w, { fill: g[l % g.length] }, t.label))
55
+ onClick: i ? (t) => i((t == null ? void 0 : t.label) ?? (t == null ? void 0 : t.name)) : void 0,
56
+ children: e.data.map((t, r) => /* @__PURE__ */ a(p, { fill: g[r % g.length] }, t.label))
53
57
  }
54
58
  ),
55
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) })
56
- ] }) : e.type === "line" ? /* @__PURE__ */ n(
57
- p,
59
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) })
60
+ ] }) : e.type === "line" ? /* @__PURE__ */ l(
61
+ K,
58
62
  {
59
- width: h,
63
+ width: c,
60
64
  height: d,
61
65
  data: e.data,
62
66
  margin: { left: 4, right: 12 },
63
- onClick: r ? (t) => r(t == null ? void 0 : t.activeLabel) : void 0,
67
+ onClick: i ? (t) => i(t == null ? void 0 : t.activeLabel) : void 0,
64
68
  children: [
65
69
  /* @__PURE__ */ a(u, { strokeDasharray: "3 3", stroke: "currentColor", opacity: 0.12 }),
66
70
  /* @__PURE__ */ a(b, { dataKey: "label", tick: { fontSize: 11 }, interval: "preserveStartEnd" }),
67
- /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: i, width: 44 }),
68
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) }),
71
+ /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: o, width: 44 }),
72
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) }),
69
73
  /* @__PURE__ */ a(
70
74
  L,
71
75
  {
@@ -78,14 +82,14 @@ function F({ spec: e, onPoint: o }) {
78
82
  )
79
83
  ]
80
84
  }
81
- ) : /* @__PURE__ */ n(
82
- R,
85
+ ) : /* @__PURE__ */ l(
86
+ N,
83
87
  {
84
- width: h,
88
+ width: c,
85
89
  height: d,
86
90
  data: e.data,
87
91
  margin: { left: 4, right: 12 },
88
- onClick: r ? (t) => r(t == null ? void 0 : t.activeLabel) : void 0,
92
+ onClick: i ? (t) => i(t == null ? void 0 : t.activeLabel) : void 0,
89
93
  children: [
90
94
  /* @__PURE__ */ a(u, { strokeDasharray: "3 3", stroke: "currentColor", opacity: 0.12 }),
91
95
  /* @__PURE__ */ a(
@@ -99,9 +103,9 @@ function F({ spec: e, onPoint: o }) {
99
103
  height: e.data.length > 8 ? 56 : 30
100
104
  }
101
105
  ),
102
- /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: i, width: 44 }),
103
- /* @__PURE__ */ a(f, { ...c, formatter: (t) => i(Number(t)) }),
104
- /* @__PURE__ */ a(z, { dataKey: "value", fill: "#0ea5e9", radius: [3, 3, 0, 0] })
106
+ /* @__PURE__ */ a(s, { tick: { fontSize: 11 }, tickFormatter: o, width: 44 }),
107
+ /* @__PURE__ */ a(h, { ...m, formatter: (t) => o(Number(t)) }),
108
+ /* @__PURE__ */ a(R, { dataKey: "value", fill: "#0ea5e9", radius: [3, 3, 0, 0] })
105
109
  ]
106
110
  }
107
111
  )
@@ -110,5 +114,5 @@ function F({ spec: e, onPoint: o }) {
110
114
  );
111
115
  }
112
116
  export {
113
- F as AiChart
117
+ O as AiChart
114
118
  };
@@ -1,5 +1,5 @@
1
- import { jsx as a, jsxs as k } from "react/jsx-runtime";
2
- import { useMemo as g, createContext as $, useState as O, useContext as S, Suspense as _, lazy as B } from "react";
1
+ import { jsx as a, jsxs as g } from "react/jsx-runtime";
2
+ import { useMemo as k, createContext as A, useState as O, useContext as S, Suspense as _, lazy as B } from "react";
3
3
  import { useOptionalNivaroClient as I, useNavigation as P } from "../../context.js";
4
4
  import { useGlossary as T, glossarySegments as j } from "../../lib/glossary.js";
5
5
  import { cn as b } from "../../lib/utils.js";
@@ -8,41 +8,48 @@ import { formatsFor as K, rowsOfBlock as R, listOf as F, chartOf as H } from "./
8
8
  import { useGlossaryHref as G, GlossaryMark as D } from "./GlossaryText.js";
9
9
  function U(e) {
10
10
  try {
11
- const n = JSON.parse(e), s = n.type === "line" || n.type === "pie" ? n.type : "bar", t = Array.isArray(n.data) ? n.data.map((r) => ({ label: String((r == null ? void 0 : r.label) ?? ""), value: Number(r == null ? void 0 : r.value) })).filter((r) => r.label && Number.isFinite(r.value)).slice(0, 40) : [];
12
- return t.length < 2 ? null : { type: s, title: typeof n.title == "string" ? n.title : void 0, data: t };
11
+ const t = JSON.parse(e), s = t.type === "line" || t.type === "pie" ? t.type : "bar", n = Array.isArray(t.data) ? t.data.map((i) => ({ label: String((i == null ? void 0 : i.label) ?? ""), value: Number(i == null ? void 0 : i.value) })).filter((i) => i.label && Number.isFinite(i.value)).slice(0, 40) : [];
12
+ if (n.length < 2) return null;
13
+ const l = ["currency", "usd", "$", "money"].includes(String(t.unit ?? "").toLowerCase());
14
+ return {
15
+ type: s,
16
+ title: typeof t.title == "string" ? t.title : void 0,
17
+ data: n,
18
+ ...l ? { unit: "currency" } : {}
19
+ };
13
20
  } catch {
14
21
  return null;
15
22
  }
16
23
  }
17
24
  const y = /^\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
18
- function A(e) {
19
- return e.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((n) => n.trim());
25
+ function C(e) {
26
+ return e.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((t) => t.trim());
20
27
  }
21
28
  function z(e) {
22
29
  return e.split(`
23
- `).flatMap((n) => {
24
- const s = n.trim();
25
- return !s.startsWith("|") || !/\|\s*\|\s*[:-]{2,}/.test(s) && !/\|\s+\|\s*\S/.test(s) ? [n] : (s.match(/\|\s+\|/g) ?? []).length < 1 ? [n] : s.split(/\|\s+(?=\|)/).map((t) => t.trim().endsWith("|") ? t.trim() : `${t.trim()} |`);
30
+ `).flatMap((t) => {
31
+ const s = t.trim();
32
+ return !s.startsWith("|") || !/\|\s*\|\s*[:-]{2,}/.test(s) && !/\|\s+\|\s*\S/.test(s) ? [t] : (s.match(/\|\s+\|/g) ?? []).length < 1 ? [t] : s.split(/\|\s+(?=\|)/).map((n) => n.trim().endsWith("|") ? n.trim() : `${n.trim()} |`);
26
33
  }).join(`
27
34
  `);
28
35
  }
29
- function C(e, n = {}) {
30
- const s = n.charts !== !1, t = z(e.replace(/\r\n/g, `
36
+ function $(e, t = {}) {
37
+ const s = t.charts !== !1, n = z(e.replace(/\r\n/g, `
31
38
  `)).split(`
32
- `), r = [];
33
- let l = [];
39
+ `), l = [];
40
+ let i = [];
34
41
  const u = () => {
35
- l.length && r.push({ kind: "p", text: l.join(" ") }), l = [];
42
+ i.length && l.push({ kind: "p", text: i.join(" ") }), i = [];
36
43
  };
37
- for (let i = 0; i < t.length; i++) {
38
- const o = t[i].trim();
44
+ for (let r = 0; r < n.length; r++) {
45
+ const o = n[r].trim();
39
46
  if (o.startsWith("```")) {
40
47
  u();
41
48
  const p = o.slice(3).trim().toLowerCase(), m = [];
42
- for (i++; i < t.length && !t[i].trim().startsWith("```"); ) m.push(t[i++]);
49
+ for (r++; r < n.length && !n[r].trim().startsWith("```"); ) m.push(n[r++]);
43
50
  const v = m.join(`
44
51
  `), N = s && p === "chart" ? U(v) : null;
45
- r.push(N ? { kind: "chart", spec: N } : { kind: "code", text: v });
52
+ l.push(N ? { kind: "chart", spec: N } : { kind: "code", text: v });
46
53
  continue;
47
54
  }
48
55
  if (o === "") {
@@ -51,95 +58,95 @@ function C(e, n = {}) {
51
58
  }
52
59
  const c = /^(#{1,4})\s+(.*)$/.exec(o);
53
60
  if (c) {
54
- u(), r.push({ kind: "h", level: c[1].length, text: c[2] });
61
+ u(), l.push({ kind: "h", level: c[1].length, text: c[2] });
55
62
  continue;
56
63
  }
57
- if (o.startsWith("|") && i + 1 < t.length && y.test(t[i + 1].trim())) {
64
+ if (o.startsWith("|") && r + 1 < n.length && y.test(n[r + 1].trim())) {
58
65
  u();
59
- const p = A(o), m = [];
60
- for (i += 2; i < t.length && t[i].trim().startsWith("|"); )
61
- y.test(t[i].trim()) || m.push(A(t[i])), i++;
62
- i--, r.push({ kind: "table", header: p, rows: m });
66
+ const p = C(o), m = [];
67
+ for (r += 2; r < n.length && n[r].trim().startsWith("|"); )
68
+ y.test(n[r].trim()) || m.push(C(n[r])), r++;
69
+ r--, l.push({ kind: "table", header: p, rows: m });
63
70
  continue;
64
71
  }
65
72
  const d = /^[-*•]\s+(.*)$/.exec(o);
66
73
  if (d) {
67
74
  u();
68
75
  const p = [d[1]];
69
- for (; i + 1 < t.length; ) {
70
- const m = /^[-*•]\s+(.*)$/.exec(t[i + 1].trim());
76
+ for (; r + 1 < n.length; ) {
77
+ const m = /^[-*•]\s+(.*)$/.exec(n[r + 1].trim());
71
78
  if (!m) break;
72
- p.push(m[1]), i++;
79
+ p.push(m[1]), r++;
73
80
  }
74
- r.push({ kind: "ul", items: p });
81
+ l.push({ kind: "ul", items: p });
75
82
  continue;
76
83
  }
77
84
  const x = /^\d+[.)]\s+(.*)$/.exec(o);
78
85
  if (x) {
79
86
  u();
80
87
  const p = [x[1]];
81
- for (; i + 1 < t.length; ) {
82
- const m = /^\d+[.)]\s+(.*)$/.exec(t[i + 1].trim());
88
+ for (; r + 1 < n.length; ) {
89
+ const m = /^\d+[.)]\s+(.*)$/.exec(n[r + 1].trim());
83
90
  if (!m) break;
84
- p.push(m[1]), i++;
91
+ p.push(m[1]), r++;
85
92
  }
86
- r.push({ kind: "ol", items: p });
93
+ l.push({ kind: "ol", items: p });
87
94
  continue;
88
95
  }
89
- l.push(o);
96
+ i.push(o);
90
97
  }
91
- return u(), r;
98
+ return u(), l;
92
99
  }
93
100
  const J = /(\*\*[^*]+\*\*|`[^`]+`|\*[^*]+\*|\[[^\]]+\]\([^)]+\))/g;
94
- function f(e, n = !1, s) {
95
- const t = [];
96
- let r = 0, l = 0;
97
- const u = (h) => n ? /* @__PURE__ */ a(E, { text: h, plain: !0 }, l++) : h, i = (h) => {
101
+ function f(e, t = !1, s) {
102
+ const n = [];
103
+ let l = 0, i = 0;
104
+ const u = (h) => t ? /* @__PURE__ */ a(E, { text: h, plain: !0 }, i++) : h, r = (h) => {
98
105
  if (!(s != null && s.terms.length)) return u(h);
99
106
  const o = j(h, s.terms, { once: s.once });
100
107
  return o.length === 1 && !o[0].term ? u(h) : o.map(
101
108
  (c) => {
102
109
  var d;
103
- return c.term ? /* @__PURE__ */ a(D, { term: c.term, href: (d = s.href) == null ? void 0 : d.call(s, c.term), children: c.text }, l++) : u(c.text);
110
+ return c.term ? /* @__PURE__ */ a(D, { term: c.term, href: (d = s.href) == null ? void 0 : d.call(s, c.term), children: c.text }, i++) : u(c.text);
104
111
  }
105
112
  );
106
113
  };
107
114
  for (const h of e.matchAll(J)) {
108
115
  const o = h.index ?? 0;
109
- o > r && t.push(i(e.slice(r, o)));
116
+ o > l && n.push(r(e.slice(l, o)));
110
117
  const c = h[0];
111
- if (c.startsWith("**")) t.push(/* @__PURE__ */ a("strong", { children: i(c.slice(2, -2)) }, l++));
118
+ if (c.startsWith("**")) n.push(/* @__PURE__ */ a("strong", { children: r(c.slice(2, -2)) }, i++));
112
119
  else if (c.startsWith("`"))
113
- t.push(
120
+ n.push(
114
121
  /* @__PURE__ */ a(
115
122
  "code",
116
123
  {
117
124
  className: "rounded bg-black/[0.06] px-1 py-px font-mono text-[0.92em] dark:bg-white/10",
118
125
  children: c.slice(1, -1)
119
126
  },
120
- l++
127
+ i++
121
128
  )
122
129
  );
123
130
  else if (c.startsWith("[")) {
124
131
  const d = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);
125
- d && Q(d[2]) ? t.push(/* @__PURE__ */ a(Y, { href: d[2], label: d[1] }, l++)) : d && W(d[2]) ? t.push(/* @__PURE__ */ a(q, { href: d[2], label: d[1] }, l++)) : t.push(c);
126
- } else t.push(/* @__PURE__ */ a("em", { children: c.slice(1, -1) }, l++));
127
- r = o + c.length;
132
+ d && Q(d[2]) ? n.push(/* @__PURE__ */ a(Y, { href: d[2], label: d[1] }, i++)) : d && W(d[2]) ? n.push(/* @__PURE__ */ a(q, { href: d[2], label: d[1] }, i++)) : n.push(c);
133
+ } else n.push(/* @__PURE__ */ a("em", { children: c.slice(1, -1) }, i++));
134
+ l = o + c.length;
128
135
  }
129
- return r < e.length && t.push(i(e.slice(r))), t;
136
+ return l < e.length && n.push(r(e.slice(l))), n;
130
137
  }
131
138
  function W(e) {
132
139
  if (!/^https?:\/\/\S+$/i.test(e)) return null;
133
140
  try {
134
- const n = new URL(e);
135
- return n.username || n.password ? null : n.hostname || null;
141
+ const t = new URL(e);
142
+ return t.username || t.password ? null : t.hostname || null;
136
143
  } catch {
137
144
  return null;
138
145
  }
139
146
  }
140
- function q({ href: e, label: n }) {
141
- const s = W(e) ?? "", t = n.trim() === e || n.trim() === s;
142
- return /* @__PURE__ */ k(
147
+ function q({ href: e, label: t }) {
148
+ const s = W(e) ?? "", n = t.trim() === e || t.trim() === s;
149
+ return /* @__PURE__ */ g(
143
150
  "a",
144
151
  {
145
152
  href: e,
@@ -149,8 +156,8 @@ function q({ href: e, label: n }) {
149
156
  rel: "noopener noreferrer nofollow",
150
157
  "data-tip": e,
151
158
  children: [
152
- t ? s : n,
153
- !t && /* @__PURE__ */ k("span", { className: "ml-1 whitespace-nowrap text-[0.85em] opacity-70", children: [
159
+ n ? s : t,
160
+ !n && /* @__PURE__ */ g("span", { className: "ml-1 whitespace-nowrap text-[0.85em] opacity-70", children: [
154
161
  "(",
155
162
  s,
156
163
  " ↗)"
@@ -161,90 +168,90 @@ function q({ href: e, label: n }) {
161
168
  }
162
169
  function Q(e) {
163
170
  if (!/^\/(?![\\/])/.test(e)) return !1;
164
- for (let n = 0; n < e.length; n++) {
165
- const s = e.charCodeAt(n);
171
+ for (let t = 0; t < e.length; t++) {
172
+ const s = e.charCodeAt(t);
166
173
  if (s <= 32 || s === 127 || s === 92) return !1;
167
174
  }
168
175
  return !0;
169
176
  }
170
- function V(e, n) {
171
- return n && n !== "/help-videos" && /^\/help-videos(?=[?#/]|$)/.test(e) ? `${n}${e.slice(12)}` : e;
177
+ function V(e, t) {
178
+ return t && t !== "/help-videos" && /^\/help-videos(?=[?#/]|$)/.test(e) ? `${t}${e.slice(12)}` : e;
172
179
  }
173
- const L = $(!1);
180
+ const L = A(!1);
174
181
  function X(e) {
175
- return e.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (n, s, t) => `[${s.replace(/[[\]]/g, "").trim() || "image"}](${t})`);
182
+ return e.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (t, s, n) => `[${s.replace(/[[\]]/g, "").trim() || "image"}](${n})`);
176
183
  }
177
- function Y({ href: e, label: n }) {
178
- const s = S(L), t = P();
179
- if (s) return /* @__PURE__ */ a("span", { "data-ai-link": "plain", children: n });
180
- const r = V(e, t.helpVideosPath);
184
+ function Y({ href: e, label: t }) {
185
+ const s = S(L), n = P();
186
+ if (s) return /* @__PURE__ */ a("span", { "data-ai-link": "plain", children: t });
187
+ const l = V(e, n.helpVideosPath);
181
188
  return /* @__PURE__ */ a(
182
189
  "a",
183
190
  {
184
- href: r,
191
+ href: l,
185
192
  "data-ai-link": "in-app",
186
193
  className: "underline underline-offset-2",
187
- onClick: (l) => {
188
- l.defaultPrevented || l.button !== 0 || l.metaKey || l.ctrlKey || l.shiftKey || l.altKey || (l.preventDefault(), t.navigate(r));
194
+ onClick: (i) => {
195
+ i.defaultPrevented || i.button !== 0 || i.metaKey || i.ctrlKey || i.shiftKey || i.altKey || (i.preventDefault(), n.navigate(l));
189
196
  },
190
- children: n
197
+ children: t
191
198
  }
192
199
  );
193
200
  }
194
201
  function Z({
195
202
  header: e,
196
- rows: n,
203
+ rows: t,
197
204
  autolink: s
198
205
  }) {
199
- const t = e.length;
200
- return /* @__PURE__ */ k("div", { "data-ai-table": !0, className: "my-1.5", children: [
201
- /* @__PURE__ */ a("ul", { className: "flex flex-col gap-1.5 sm:hidden", children: n.map((r, l) => (
206
+ const n = e.length;
207
+ return /* @__PURE__ */ g("div", { "data-ai-table": !0, className: "my-1.5", children: [
208
+ /* @__PURE__ */ a("ul", { className: "flex flex-col gap-1.5 sm:hidden", children: t.map((l, i) => (
202
209
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
203
- /* @__PURE__ */ k(
210
+ /* @__PURE__ */ g(
204
211
  "li",
205
212
  {
206
213
  className: "rounded-lg border border-black/10 bg-background/60 px-2.5 py-2 dark:border-white/10",
207
214
  children: [
208
- /* @__PURE__ */ a("div", { className: "font-semibold leading-snug", children: f(r[0] ?? "", s) }),
209
- r.slice(1, t).map(
210
- (u, i) => u ? (
215
+ /* @__PURE__ */ a("div", { className: "font-semibold leading-snug", children: f(l[0] ?? "", s) }),
216
+ l.slice(1, n).map(
217
+ (u, r) => u ? (
211
218
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
212
- /* @__PURE__ */ k(
219
+ /* @__PURE__ */ g(
213
220
  "div",
214
221
  {
215
222
  className: "mt-1 grid grid-cols-[minmax(0,34%)_1fr] gap-2 text-[0.94em] leading-snug",
216
223
  children: [
217
- /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: e[i + 1] }),
224
+ /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: e[r + 1] }),
218
225
  /* @__PURE__ */ a("span", { className: "min-w-0 break-words", children: f(u, s) })
219
226
  ]
220
227
  },
221
- i
228
+ r
222
229
  )
223
230
  ) : null
224
231
  )
225
232
  ]
226
233
  },
227
- l
234
+ i
228
235
  )
229
236
  )) }),
230
- /* @__PURE__ */ a("div", { className: "hidden overflow-x-auto sm:block", children: /* @__PURE__ */ k("table", { className: "w-auto min-w-[50%] text-left", children: [
231
- /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { className: "border-b border-black/10 text-[0.85em] uppercase tracking-wide text-muted-foreground dark:border-white/10", children: e.map((r, l) => (
237
+ /* @__PURE__ */ a("div", { className: "hidden overflow-x-auto sm:block", children: /* @__PURE__ */ g("table", { className: "w-auto min-w-[50%] text-left", children: [
238
+ /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { className: "border-b border-black/10 text-[0.85em] uppercase tracking-wide text-muted-foreground dark:border-white/10", children: e.map((l, i) => (
232
239
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
233
- /* @__PURE__ */ a("th", { className: "py-1 pr-4 font-medium", children: f(r) }, l)
240
+ /* @__PURE__ */ a("th", { className: "py-1 pr-4 font-medium", children: f(l) }, i)
234
241
  )) }) }),
235
- /* @__PURE__ */ a("tbody", { className: "divide-y divide-black/5 dark:divide-white/10", children: n.map((r, l) => (
242
+ /* @__PURE__ */ a("tbody", { className: "divide-y divide-black/5 dark:divide-white/10", children: t.map((l, i) => (
236
243
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
237
- /* @__PURE__ */ a("tr", { className: "align-top", children: e.map((u, i) => (
244
+ /* @__PURE__ */ a("tr", { className: "align-top", children: e.map((u, r) => (
238
245
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
239
- /* @__PURE__ */ a("td", { className: "max-w-[28rem] py-1 pr-4", children: f(r[i] ?? "", s) }, i)
240
- )) }, l)
246
+ /* @__PURE__ */ a("td", { className: "max-w-[28rem] py-1 pr-4", children: f(l[r] ?? "", s) }, r)
247
+ )) }, i)
241
248
  )) })
242
249
  ] }) })
243
250
  ] });
244
251
  }
245
252
  const ee = B(() => import("./AiChart.js").then((e) => ({ default: e.AiChart })));
246
253
  function te({ spec: e }) {
247
- const n = S(M);
254
+ const t = S(M);
248
255
  return /* @__PURE__ */ a(
249
256
  _,
250
257
  {
@@ -256,86 +263,86 @@ function te({ spec: e }) {
256
263
  style: { height: e.type === "pie" ? 220 : 200 }
257
264
  }
258
265
  ),
259
- children: /* @__PURE__ */ a(ee, { spec: e, onPoint: n })
266
+ children: /* @__PURE__ */ a(ee, { spec: e, onPoint: t })
260
267
  }
261
268
  );
262
269
  }
263
- function w({ b: e, link: n, gl: s }) {
270
+ function w({ b: e, link: t, gl: s }) {
264
271
  switch (e.kind) {
265
272
  case "h":
266
- return /* @__PURE__ */ a("p", { className: b("font-semibold", e.level <= 2 ? "text-[1.05em]" : ""), children: f(e.text, n, s) });
273
+ return /* @__PURE__ */ a("p", { className: b("font-semibold", e.level <= 2 ? "text-[1.05em]" : ""), children: f(e.text, t, s) });
267
274
  case "ul":
268
- return /* @__PURE__ */ a("ul", { className: "list-disc space-y-0.5 pl-5", children: e.items.map((t, r) => (
275
+ return /* @__PURE__ */ a("ul", { className: "list-disc space-y-0.5 pl-5", children: e.items.map((n, l) => (
269
276
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
270
- /* @__PURE__ */ a("li", { children: f(t, n, s) }, r)
277
+ /* @__PURE__ */ a("li", { children: f(n, t, s) }, l)
271
278
  )) });
272
279
  case "ol":
273
- return /* @__PURE__ */ a("ol", { className: "list-decimal space-y-0.5 pl-5", children: e.items.map((t, r) => (
280
+ return /* @__PURE__ */ a("ol", { className: "list-decimal space-y-0.5 pl-5", children: e.items.map((n, l) => (
274
281
  // biome-ignore lint/suspicious/noArrayIndexKey: static content
275
- /* @__PURE__ */ a("li", { children: f(t, n, s) }, r)
282
+ /* @__PURE__ */ a("li", { children: f(n, t, s) }, l)
276
283
  )) });
277
284
  case "code":
278
285
  return /* @__PURE__ */ a("pre", { className: "overflow-x-auto rounded-md bg-black/[0.05] p-2 font-mono text-[0.9em] dark:bg-white/10", children: e.text });
279
286
  case "table":
280
- return /* @__PURE__ */ a(Z, { header: e.header, rows: e.rows, autolink: n });
287
+ return /* @__PURE__ */ a(Z, { header: e.header, rows: e.rows, autolink: t });
281
288
  case "chart":
282
289
  return /* @__PURE__ */ a(te, { spec: e.spec });
283
290
  default:
284
- return /* @__PURE__ */ a("p", { children: f(e.text, n, s) });
291
+ return /* @__PURE__ */ a("p", { children: f(e.text, t, s) });
285
292
  }
286
293
  }
287
294
  const ne = { table: "Table", chart: "Chart", list: "List" };
288
- function re({ b: e, link: n, gl: s }) {
289
- const t = g(() => K(e), [e]), [r, l] = O(t[0]), u = g(() => {
290
- if (r === t[0]) return e;
291
- const i = R(e);
292
- if (!i) return e;
293
- if (r === "table") return { kind: "table", header: i.header, rows: i.rows };
294
- if (r === "list") return { kind: "ul", items: F(i) };
295
- const h = H(i);
295
+ function re({ b: e, link: t, gl: s }) {
296
+ const n = k(() => K(e), [e]), [l, i] = O(n[0]), u = k(() => {
297
+ if (l === n[0]) return e;
298
+ const r = R(e);
299
+ if (!r) return e;
300
+ if (l === "table") return { kind: "table", header: r.header, rows: r.rows };
301
+ if (l === "list") return { kind: "ul", items: F(r) };
302
+ const h = H(r);
296
303
  return h ? { kind: "chart", spec: h } : e;
297
- }, [e, r, t]);
298
- return t.length < 2 ? /* @__PURE__ */ a(w, { b: e, link: n, gl: s }) : /* @__PURE__ */ k("div", { "data-ai-switchable": r, children: [
299
- /* @__PURE__ */ a("fieldset", { className: "mb-0.5 flex min-w-0 justify-end gap-0.5", "aria-label": "Show as", children: t.map((i) => /* @__PURE__ */ a(
304
+ }, [e, l, n]);
305
+ return n.length < 2 ? /* @__PURE__ */ a(w, { b: e, link: t, gl: s }) : /* @__PURE__ */ g("div", { "data-ai-switchable": l, children: [
306
+ /* @__PURE__ */ a("fieldset", { className: "mb-0.5 flex min-w-0 justify-end gap-0.5", "aria-label": "Show as", children: n.map((r) => /* @__PURE__ */ a(
300
307
  "button",
301
308
  {
302
309
  type: "button",
303
- onClick: () => l(i),
304
- "aria-pressed": i === r,
305
- "data-ai-format": i,
310
+ onClick: () => i(r),
311
+ "aria-pressed": r === l,
312
+ "data-ai-format": r,
306
313
  className: b(
307
314
  "rounded px-1.5 py-px text-[10.5px] font-medium transition-colors",
308
- i === r ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"
315
+ r === l ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"
309
316
  ),
310
- children: ne[i]
317
+ children: ne[r]
311
318
  },
312
- i
319
+ r
313
320
  )) }),
314
- /* @__PURE__ */ a(w, { b: u, link: n, gl: s })
321
+ /* @__PURE__ */ a(w, { b: u, link: t, gl: s })
315
322
  ] });
316
323
  }
317
- const M = $(void 0);
324
+ const M = A(void 0);
318
325
  function me({
319
326
  content: e,
320
- className: n,
327
+ className: t,
321
328
  autolink: s,
322
- switchable: t,
323
- onChartPoint: r,
324
- mirrored: l
329
+ switchable: n,
330
+ onChartPoint: l,
331
+ mirrored: i
325
332
  }) {
326
- const u = g(
327
- () => l ? C(X(e), { charts: !1 }) : C(e),
328
- [e, l]
329
- ), i = I(), h = l ? !1 : s ?? i != null, o = T(), c = G(), d = o.length ? { terms: o, once: /* @__PURE__ */ new Set(), href: c } : void 0;
330
- return /* @__PURE__ */ a(L.Provider, { value: !!l, children: /* @__PURE__ */ a(M.Provider, { value: r, children: /* @__PURE__ */ a(
333
+ const u = k(
334
+ () => i ? $(X(e), { charts: !1 }) : $(e),
335
+ [e, i]
336
+ ), r = I(), h = i ? !1 : s ?? r != null, o = T(), c = G(), d = o.length ? { terms: o, once: /* @__PURE__ */ new Set(), href: c } : void 0;
337
+ return /* @__PURE__ */ a(L.Provider, { value: !!i, children: /* @__PURE__ */ a(M.Provider, { value: l, children: /* @__PURE__ */ a(
331
338
  "div",
332
339
  {
333
340
  "data-ai-markdown": !0,
334
- "data-ai-mirrored": l ? "" : void 0,
335
- className: b("space-y-1.5 [&_strong]:font-semibold", n),
341
+ "data-ai-mirrored": i ? "" : void 0,
342
+ className: b("space-y-1.5 [&_strong]:font-semibold", t),
336
343
  children: u.map((x, p) => {
337
344
  const m = `${x.kind}-${p}`;
338
- return t && !l && ie.has(x.kind) ? /* @__PURE__ */ a(re, { b: x, link: h, gl: d }, m) : /* @__PURE__ */ a(w, { b: x, link: h, gl: d }, m);
345
+ return n && !i && ie.has(x.kind) ? /* @__PURE__ */ a(re, { b: x, link: h, gl: d }, m) : /* @__PURE__ */ a(w, { b: x, link: h, gl: d }, m);
339
346
  })
340
347
  }
341
348
  ) }) });
@@ -347,7 +354,7 @@ export {
347
354
  V as inAppHref,
348
355
  Q as isSafeAppPath,
349
356
  X as mirroredMarkdown,
350
- C as parseAiMarkdown,
357
+ $ as parseAiMarkdown,
351
358
  U as parseChartSpec,
352
359
  f as renderInline
353
360
  };