chordia-ui 3.3.8 → 3.3.9

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 (159) hide show
  1. package/dist/AgentLiftCard.cjs.js.map +1 -1
  2. package/dist/AgentLiftCard.es.js +5 -3
  3. package/dist/AgentLiftCard.es.js.map +1 -1
  4. package/dist/CustomFilterChips.cjs.js.map +1 -1
  5. package/dist/CustomFilterChips.es.js +2 -1
  6. package/dist/CustomFilterChips.es.js.map +1 -1
  7. package/dist/FileUploadingState.cjs.js.map +1 -1
  8. package/dist/FileUploadingState.es.js +16 -10
  9. package/dist/FileUploadingState.es.js.map +1 -1
  10. package/dist/IntegrationCard.cjs.js.map +1 -1
  11. package/dist/IntegrationCard.es.js +3 -3
  12. package/dist/IntegrationCard.es.js.map +1 -1
  13. package/dist/SectionLabel.cjs.js.map +1 -1
  14. package/dist/SectionLabel.es.js.map +1 -1
  15. package/dist/SmallButton.cjs.js.map +1 -1
  16. package/dist/SmallButton.es.js +16 -16
  17. package/dist/SmallButton.es.js.map +1 -1
  18. package/dist/SummarySection.cjs.js.map +1 -1
  19. package/dist/SummarySection.es.js +11 -9
  20. package/dist/SummarySection.es.js.map +1 -1
  21. package/dist/TextInput.cjs.js.map +1 -1
  22. package/dist/TextInput.es.js.map +1 -1
  23. package/dist/Timeline.cjs.js.map +1 -1
  24. package/dist/Timeline.es.js +14 -8
  25. package/dist/Timeline.es.js.map +1 -1
  26. package/dist/Tooltip.cjs.js +1 -1
  27. package/dist/Tooltip.cjs.js.map +1 -1
  28. package/dist/Tooltip.es.js +31 -20
  29. package/dist/Tooltip.es.js.map +1 -1
  30. package/dist/TourGuideTooltip.cjs.js.map +1 -1
  31. package/dist/TourGuideTooltip.es.js +2 -1
  32. package/dist/TourGuideTooltip.es.js.map +1 -1
  33. package/dist/UpdatedInteractionRecording.cjs.js +1 -1
  34. package/dist/UpdatedInteractionRecording.cjs.js.map +1 -1
  35. package/dist/UpdatedInteractionRecording.es.js +79 -97
  36. package/dist/UpdatedInteractionRecording.es.js.map +1 -1
  37. package/dist/UploadInteraction.cjs.js.map +1 -1
  38. package/dist/UploadInteraction.es.js.map +1 -1
  39. package/dist/colors.cjs.js +2 -0
  40. package/dist/colors.cjs.js.map +1 -0
  41. package/dist/colors.es.js +2 -0
  42. package/dist/colors.es.js.map +1 -0
  43. package/dist/components/UpdatedInteractionDetails.cjs.js +10 -1
  44. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  45. package/dist/components/UpdatedInteractionDetails.es.js +1531 -9
  46. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  47. package/dist/components/chat.cjs.js +30 -1
  48. package/dist/components/chat.cjs.js.map +1 -1
  49. package/dist/components/chat.es.js +2222 -7
  50. package/dist/components/chat.es.js.map +1 -1
  51. package/dist/components/common.cjs.js +1 -1
  52. package/dist/components/common.es.js +32 -25
  53. package/dist/components/common.es.js.map +1 -1
  54. package/dist/components/data.cjs.js +1 -1
  55. package/dist/components/data.cjs.js.map +1 -1
  56. package/dist/components/data.es.js +1033 -4
  57. package/dist/components/data.es.js.map +1 -1
  58. package/dist/components/layout.cjs.js +3 -1
  59. package/dist/components/layout.cjs.js.map +1 -1
  60. package/dist/components/layout.es.js +1533 -8
  61. package/dist/components/layout.es.js.map +1 -1
  62. package/dist/components/login.cjs.js +1 -1
  63. package/dist/components/login.es.js +6 -2
  64. package/dist/components/login.es.js.map +1 -1
  65. package/dist/components/media.cjs.js +1 -1
  66. package/dist/components/media.cjs.js.map +1 -1
  67. package/dist/components/media.es.js +220 -6
  68. package/dist/components/media.es.js.map +1 -1
  69. package/dist/components/models.cjs.js +1 -1
  70. package/dist/components/models.cjs.js.map +1 -1
  71. package/dist/components/models.es.js +91 -2
  72. package/dist/components/models.es.js.map +1 -1
  73. package/dist/components/navigation.cjs.js +1 -1
  74. package/dist/components/navigation.cjs.js.map +1 -1
  75. package/dist/components/navigation.es.js +766 -7
  76. package/dist/components/navigation.es.js.map +1 -1
  77. package/dist/components/notifications.cjs.js +1 -1
  78. package/dist/components/notifications.cjs.js.map +1 -1
  79. package/dist/components/notifications.es.js +368 -3
  80. package/dist/components/notifications.es.js.map +1 -1
  81. package/dist/components/onboarding.cjs.js +1 -1
  82. package/dist/components/onboarding.cjs.js.map +1 -1
  83. package/dist/components/onboarding.es.js +985 -7
  84. package/dist/components/onboarding.es.js.map +1 -1
  85. package/dist/components/primitives.cjs.js +1 -1
  86. package/dist/components/primitives.cjs.js.map +1 -1
  87. package/dist/components/primitives.es.js +635 -25
  88. package/dist/components/primitives.es.js.map +1 -1
  89. package/dist/debugger-wc.cjs.js +4 -4
  90. package/dist/debugger-wc.cjs.js.map +1 -1
  91. package/dist/debugger-wc.es.js +15 -11
  92. package/dist/debugger-wc.es.js.map +1 -1
  93. package/dist/index.cjs.js +1 -1
  94. package/dist/index.cjs2.js +2 -49
  95. package/dist/index.cjs2.js.map +1 -1
  96. package/dist/index.cjs3.js +50 -0
  97. package/dist/index.cjs3.js.map +1 -0
  98. package/dist/index.es.js +104 -99
  99. package/dist/index.es.js.map +1 -1
  100. package/dist/index.es2.js +2632 -1776
  101. package/dist/index.es2.js.map +1 -1
  102. package/dist/index.es3.js +1944 -0
  103. package/dist/index.es3.js.map +1 -0
  104. package/dist/pages/interactionDetails.cjs.js +1 -1
  105. package/dist/pages/interactionDetails.cjs.js.map +1 -1
  106. package/dist/pages/interactionDetails.es.js +70 -47
  107. package/dist/pages/interactionDetails.es.js.map +1 -1
  108. package/dist/sortable.esm.cjs.js +1 -1
  109. package/dist/sortable.esm.cjs.js.map +1 -1
  110. package/dist/sortable.esm.es.js +55 -53
  111. package/dist/sortable.esm.es.js.map +1 -1
  112. package/dist/{chordia-ui.css → style.css} +1 -1
  113. package/package.json +1 -1
  114. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +318 -77
  115. package/src/components/UpdatedInteractionDetails/UpdatedInteractionRecording.jsx +7 -17
  116. package/dist/ChartRenderer.cjs.js +0 -31
  117. package/dist/ChartRenderer.cjs.js.map +0 -1
  118. package/dist/ChartRenderer.es.js +0 -2210
  119. package/dist/ChartRenderer.es.js.map +0 -1
  120. package/dist/GettingStarted.cjs.js +0 -2
  121. package/dist/GettingStarted.cjs.js.map +0 -1
  122. package/dist/GettingStarted.es.js +0 -983
  123. package/dist/GettingStarted.es.js.map +0 -1
  124. package/dist/InlineConfirm.cjs.js +0 -2
  125. package/dist/InlineConfirm.cjs.js.map +0 -1
  126. package/dist/InlineConfirm.es.js +0 -618
  127. package/dist/InlineConfirm.es.js.map +0 -1
  128. package/dist/InteractionSummaryCard.cjs.js +0 -2
  129. package/dist/InteractionSummaryCard.cjs.js.map +0 -1
  130. package/dist/InteractionSummaryCard.es.js +0 -216
  131. package/dist/InteractionSummaryCard.es.js.map +0 -1
  132. package/dist/LoginPage.cjs.js +0 -3
  133. package/dist/LoginPage.cjs.js.map +0 -1
  134. package/dist/LoginPage.es.js +0 -2618
  135. package/dist/LoginPage.es.js.map +0 -1
  136. package/dist/NavigationBar.cjs.js +0 -2
  137. package/dist/NavigationBar.cjs.js.map +0 -1
  138. package/dist/NavigationBar.es.js +0 -762
  139. package/dist/NavigationBar.es.js.map +0 -1
  140. package/dist/NotificationPanel.cjs.js +0 -2
  141. package/dist/NotificationPanel.cjs.js.map +0 -1
  142. package/dist/NotificationPanel.es.js +0 -371
  143. package/dist/NotificationPanel.es.js.map +0 -1
  144. package/dist/OverlayPanel.cjs.js +0 -2
  145. package/dist/OverlayPanel.cjs.js.map +0 -1
  146. package/dist/OverlayPanel.es.js +0 -93
  147. package/dist/OverlayPanel.es.js.map +0 -1
  148. package/dist/SplitPane.cjs.js +0 -4
  149. package/dist/SplitPane.cjs.js.map +0 -1
  150. package/dist/SplitPane.es.js +0 -1531
  151. package/dist/SplitPane.es.js.map +0 -1
  152. package/dist/SummaryStatsPanel.cjs.js +0 -2
  153. package/dist/SummaryStatsPanel.cjs.js.map +0 -1
  154. package/dist/SummaryStatsPanel.es.js +0 -1027
  155. package/dist/SummaryStatsPanel.es.js.map +0 -1
  156. package/dist/UpdatedInteractionDetails.cjs.js +0 -11
  157. package/dist/UpdatedInteractionDetails.cjs.js.map +0 -1
  158. package/dist/UpdatedInteractionDetails.es.js +0 -1310
  159. package/dist/UpdatedInteractionDetails.es.js.map +0 -1
@@ -1,10 +1,2225 @@
1
- import { C as s, a as r, b as t, c as h, M as n, T as C } from "../ChartRenderer.es.js";
1
+ import { jsxs as s, jsx as e, Fragment as J } from "react/jsx-runtime";
2
+ import de, { useState as M, useRef as Y, useEffect as G, useCallback as xe } from "react";
3
+ import { Wrench as ve, Check as Se, Copy as we, PanelRightOpen as ke, Send as ye, Search as Ce, MessageSquare as ze, Pin as Te, Clock as ge, Hash as he, AtSign as Be, Paperclip as Re } from "lucide-react";
4
+ import { ResponsiveContainer as Z, PieChart as Ae, Pie as Le, Cell as ce, Tooltip as ee, AreaChart as Ie, CartesianGrid as ne, XAxis as oe, YAxis as ie, Legend as ae, Area as Me, LineChart as De, Line as Ee, BarChart as fe, Bar as me } from "recharts";
5
+ const We = ({ content: h, onCodeBlockClick: b, onFilePathClick: m }) => {
6
+ const [y, i] = M(/* @__PURE__ */ new Set()), v = async (o, n) => {
7
+ try {
8
+ await navigator.clipboard.writeText(o), i((t) => /* @__PURE__ */ new Set([...t, n])), setTimeout(() => {
9
+ i((t) => {
10
+ const r = new Set(t);
11
+ return r.delete(n), r;
12
+ });
13
+ }, 2e3);
14
+ } catch (t) {
15
+ console.error("Failed to copy text:", t);
16
+ }
17
+ }, L = (o, n, t) => {
18
+ const r = y.has(t);
19
+ return /* @__PURE__ */ s(
20
+ "div",
21
+ {
22
+ style: {
23
+ position: "relative",
24
+ marginBottom: "16px",
25
+ borderRadius: "8px",
26
+ background: "var(--ink, #1E2125)",
27
+ border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
28
+ overflow: "hidden"
29
+ },
30
+ children: [
31
+ /* @__PURE__ */ s("div", { style: {
32
+ display: "flex",
33
+ justifyContent: "space-between",
34
+ alignItems: "center",
35
+ padding: "8px 12px",
36
+ background: "rgba(255,255,255,0.05)",
37
+ borderBottom: "1px solid rgba(255,255,255,0.1)"
38
+ }, children: [
39
+ /* @__PURE__ */ e("span", { style: {
40
+ fontSize: "11px",
41
+ color: "rgba(255,255,255,0.7)",
42
+ fontFamily: "var(--font-mono, monospace)",
43
+ textTransform: "uppercase",
44
+ letterSpacing: "0.05em"
45
+ }, children: n || "code" }),
46
+ /* @__PURE__ */ s(
47
+ "button",
48
+ {
49
+ onClick: () => v(o, t),
50
+ style: {
51
+ background: "none",
52
+ border: "none",
53
+ color: "rgba(255,255,255,0.7)",
54
+ cursor: "pointer",
55
+ padding: "4px",
56
+ borderRadius: "4px",
57
+ display: "flex",
58
+ alignItems: "center",
59
+ gap: "4px",
60
+ fontSize: "11px",
61
+ transition: "all 0.15s ease"
62
+ },
63
+ onMouseEnter: (c) => {
64
+ c.target.style.background = "rgba(255,255,255,0.1)", c.target.style.color = "rgba(255,255,255,0.9)";
65
+ },
66
+ onMouseLeave: (c) => {
67
+ c.target.style.background = "none", c.target.style.color = "rgba(255,255,255,0.7)";
68
+ },
69
+ children: [
70
+ r ? /* @__PURE__ */ e(Se, { size: 12 }) : /* @__PURE__ */ e(we, { size: 12 }),
71
+ r ? "Copied!" : "Copy"
72
+ ]
73
+ }
74
+ ),
75
+ b && /* @__PURE__ */ s(
76
+ "button",
77
+ {
78
+ onClick: () => b({ code: o, language: n }),
79
+ style: {
80
+ background: "none",
81
+ border: "none",
82
+ color: "rgba(255,255,255,0.7)",
83
+ cursor: "pointer",
84
+ padding: "4px",
85
+ borderRadius: "4px",
86
+ display: "flex",
87
+ alignItems: "center",
88
+ gap: "4px",
89
+ fontSize: "11px",
90
+ transition: "all 0.15s ease"
91
+ },
92
+ onMouseEnter: (c) => {
93
+ c.currentTarget.style.background = "rgba(255,255,255,0.1)", c.currentTarget.style.color = "rgba(255,255,255,0.9)";
94
+ },
95
+ onMouseLeave: (c) => {
96
+ c.currentTarget.style.background = "none", c.currentTarget.style.color = "rgba(255,255,255,0.7)";
97
+ },
98
+ children: [
99
+ /* @__PURE__ */ e(ke, { size: 12 }),
100
+ "Canvas"
101
+ ]
102
+ }
103
+ )
104
+ ] }),
105
+ /* @__PURE__ */ e("pre", { style: {
106
+ margin: 0,
107
+ padding: "12px",
108
+ fontFamily: "var(--font-mono, monospace)",
109
+ fontSize: "13px",
110
+ lineHeight: 1.4,
111
+ color: "rgba(255,255,255,0.95)",
112
+ overflow: "auto",
113
+ whiteSpace: "pre-wrap",
114
+ wordBreak: "break-word"
115
+ }, children: o })
116
+ ]
117
+ },
118
+ t
119
+ );
120
+ }, k = (o) => {
121
+ const n = [], t = o.split(`
122
+ `);
123
+ let r = 0, c = 0;
124
+ for (; r < t.length; ) {
125
+ const g = t[r];
126
+ if (g.trim().startsWith("```")) {
127
+ const p = g.trim().slice(3);
128
+ let C = [];
129
+ for (r++; r < t.length && !t[r].trim().startsWith("```"); )
130
+ C.push(t[r]), r++;
131
+ r < t.length && r++, n.push(L(C.join(`
132
+ `), p, `code-${c++}`));
133
+ continue;
134
+ }
135
+ if (g.startsWith("#")) {
136
+ const p = g.match(/^#+/)[0].length, C = g.slice(p).trim(), z = p === 1 ? "h2" : p === 2 ? "h3" : p === 3 ? "h4" : "h5";
137
+ n.push(
138
+ de.createElement(z, {
139
+ key: `header-${r}`,
140
+ style: {
141
+ fontSize: p === 1 ? "18px" : p === 2 ? "16px" : "14px",
142
+ fontWeight: 720,
143
+ color: "var(--text-strong, rgba(30,33,37,0.92))",
144
+ marginTop: n.length > 0 ? "20px" : "0",
145
+ marginBottom: "8px",
146
+ lineHeight: 1.3
147
+ }
148
+ }, C)
149
+ ), r++;
150
+ continue;
151
+ }
152
+ if (g.trim() === "---" || g.trim() === "***") {
153
+ n.push(
154
+ /* @__PURE__ */ e("hr", { style: {
155
+ border: "none",
156
+ borderTop: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
157
+ margin: "16px 0"
158
+ } }, `hr-${r}`)
159
+ ), r++;
160
+ continue;
161
+ }
162
+ if (g.match(/^(\s*)([-*+]|\d+\.)\s/)) {
163
+ const p = [], C = /^\s*\d+\./.test(g);
164
+ for (; r < t.length && (t[r].match(/^(\s*)([-*+]|\d+\.)\s/) || t[r].trim() === ""); ) {
165
+ if (t[r].trim() !== "") {
166
+ const B = t[r].match(/^(\s*)([-*+]|\d+\.)\s(.*)$/);
167
+ B && p.push(B[3]);
168
+ }
169
+ r++;
170
+ }
171
+ const z = C ? "ol" : "ul";
172
+ n.push(
173
+ de.createElement(z, {
174
+ key: `list-${r}`,
175
+ style: {
176
+ margin: "8px 0",
177
+ paddingLeft: "20px",
178
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
179
+ }
180
+ }, p.map(
181
+ (B, a) => de.createElement("li", {
182
+ key: `item-${a}`,
183
+ style: { marginBottom: "4px" }
184
+ }, d(B))
185
+ ))
186
+ );
187
+ continue;
188
+ }
189
+ if (g.trim().startsWith("|") && g.trim().endsWith("|")) {
190
+ const p = [];
191
+ for (; r < t.length && t[r].trim().startsWith("|") && t[r].trim().endsWith("|"); )
192
+ p.push(t[r]), r++;
193
+ if (p.length >= 2) {
194
+ const C = (l) => l.trim().slice(1, -1).split("|").map((x) => x.trim()), z = C(p[0]), B = (l) => C(l).every((x) => /^[-:]+$/.test(x)), a = p.length >= 2 && B(p[1]), w = a ? 2 : 1, D = a ? C(p[1]).map((l) => l.startsWith(":") && l.endsWith(":") ? "center" : l.endsWith(":") ? "right" : "left") : z.map(() => "left"), T = {
195
+ padding: "6px 12px",
196
+ borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
197
+ fontSize: "13px",
198
+ lineHeight: 1.5,
199
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
200
+ };
201
+ n.push(
202
+ /* @__PURE__ */ e("div", { style: { overflowX: "auto", margin: "8px 0" }, children: /* @__PURE__ */ s("table", { style: {
203
+ borderCollapse: "collapse",
204
+ width: "100%",
205
+ border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
206
+ borderRadius: "6px",
207
+ overflow: "hidden"
208
+ }, children: [
209
+ a && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { style: { background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))" }, children: z.map((l, x) => /* @__PURE__ */ e("th", { style: { ...T, fontWeight: 660, textAlign: D[x] || "left", whiteSpace: "nowrap" }, children: d(l) }, x)) }) }),
210
+ /* @__PURE__ */ e("tbody", { children: (a ? p.slice(w) : p).map((l, x) => /* @__PURE__ */ e("tr", { style: { background: x % 2 === 1 ? "var(--hover-warm-subtle, rgba(231,212,162,0.04))" : "transparent" }, children: C(l).map((I, S) => /* @__PURE__ */ e("td", { style: { ...T, textAlign: D[S] || "left" }, children: d(I) }, S)) }, x)) })
211
+ ] }) }, `table-${r}`)
212
+ );
213
+ }
214
+ continue;
215
+ }
216
+ if (g.trim()) {
217
+ const p = [];
218
+ for (; r < t.length && t[r].trim() && !t[r].match(/^(#|```|---|\*\*\*|(\s*)([-*+]|\d+\.)\s)/) && !(t[r].trim().startsWith("|") && t[r].trim().endsWith("|")); )
219
+ p.push(t[r]), r++;
220
+ p.length > 0 && n.push(
221
+ /* @__PURE__ */ e("p", { style: {
222
+ margin: "8px 0",
223
+ lineHeight: 1.6,
224
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
225
+ }, children: d(p.join(" ")) }, `p-${r}`)
226
+ );
227
+ } else
228
+ r++;
229
+ }
230
+ return n;
231
+ }, f = (o) => {
232
+ const n = [];
233
+ let t = o, r = 0;
234
+ for (; t.length > 0; ) {
235
+ if (m) {
236
+ const B = t.match(/^([^\s`*\[]+(?:\/src\/|\/components\/|\/packages\/)[^\s`*\[]*|[^\s`*\[]*\.(ts|tsx|js|jsx|py|css|scss|sass|json|md|yaml|yml|html|xml|sh|sql|go|rs|php|java|c|cpp|h|hpp)(?:\b|$))/);
237
+ if (B) {
238
+ const a = B[1];
239
+ n.push(
240
+ /* @__PURE__ */ e(
241
+ "span",
242
+ {
243
+ onClick: () => m(a),
244
+ style: {
245
+ color: "var(--rail-discovery, #5E88B0)",
246
+ textDecoration: "underline",
247
+ textDecorationStyle: "dotted",
248
+ textUnderlineOffset: "2px",
249
+ cursor: "pointer",
250
+ fontFamily: "var(--font-mono, monospace)",
251
+ fontSize: "13px",
252
+ transition: "all 0.15s ease",
253
+ ":hover": {
254
+ background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
255
+ textDecoration: "underline",
256
+ textDecorationStyle: "solid"
257
+ }
258
+ },
259
+ onMouseEnter: (w) => {
260
+ w.target.style.background = "var(--hover-warm-subtle, rgba(231,212,162,0.08))", w.target.style.textDecorationStyle = "solid";
261
+ },
262
+ onMouseLeave: (w) => {
263
+ w.target.style.background = "none", w.target.style.textDecorationStyle = "dotted";
264
+ },
265
+ children: a
266
+ },
267
+ `file-path-${r++}`
268
+ )
269
+ ), t = t.slice(B[0].length);
270
+ continue;
271
+ }
272
+ }
273
+ const c = t.match(/^`([^`]+)`/);
274
+ if (c) {
275
+ n.push(
276
+ /* @__PURE__ */ e("code", { style: {
277
+ background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
278
+ border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
279
+ borderRadius: "3px",
280
+ padding: "2px 4px",
281
+ fontFamily: "var(--font-mono, monospace)",
282
+ fontSize: "12px",
283
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
284
+ }, children: c[1] }, `inline-code-${r++}`)
285
+ ), t = t.slice(c[0].length);
286
+ continue;
287
+ }
288
+ const g = t.match(/^\*\*([^*]+)\*\*/);
289
+ if (g) {
290
+ n.push(
291
+ /* @__PURE__ */ e("strong", { style: {
292
+ fontWeight: 720,
293
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
294
+ }, children: g[1] }, `bold-${r++}`)
295
+ ), t = t.slice(g[0].length);
296
+ continue;
297
+ }
298
+ const p = t.match(/^\*([^*]+)\*/);
299
+ if (p) {
300
+ n.push(
301
+ /* @__PURE__ */ e("em", { style: {
302
+ fontStyle: "italic",
303
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
304
+ }, children: p[1] }, `italic-${r++}`)
305
+ ), t = t.slice(p[0].length);
306
+ continue;
307
+ }
308
+ const C = t.match(/^\[([^\]]+)\]\(([^)]+)\)/);
309
+ if (C) {
310
+ n.push(
311
+ /* @__PURE__ */ e(
312
+ "a",
313
+ {
314
+ href: C[2],
315
+ target: "_blank",
316
+ rel: "noopener noreferrer",
317
+ style: {
318
+ color: "var(--rail-discovery, #5E88B0)",
319
+ textDecoration: "underline",
320
+ textUnderlineOffset: "2px"
321
+ },
322
+ children: C[1]
323
+ },
324
+ `link-${r++}`
325
+ )
326
+ ), t = t.slice(C[0].length);
327
+ continue;
328
+ }
329
+ const z = t.search(/[`*\[]/);
330
+ if (z === -1) {
331
+ n.push(t);
332
+ break;
333
+ } else
334
+ z === 0 ? (n.push(t[0]), t = t.slice(1)) : (n.push(t.slice(0, z)), t = t.slice(z));
335
+ }
336
+ return n.length === 1 && typeof n[0] == "string" ? n[0] : n;
337
+ }, d = (o) => f(o);
338
+ return /* @__PURE__ */ e("div", { children: k(h) });
339
+ };
340
+ function be({
341
+ role: h,
342
+ content: b,
343
+ html: m,
344
+ timestamp: y,
345
+ toolBadges: i,
346
+ isStreaming: v,
347
+ onCodeBlockClick: L,
348
+ onFilePathClick: k
349
+ }) {
350
+ const f = h === "user";
351
+ return /* @__PURE__ */ s(
352
+ "div",
353
+ {
354
+ style: {
355
+ display: "flex",
356
+ flexDirection: "column",
357
+ alignItems: f ? "flex-end" : "flex-start",
358
+ marginBottom: "16px",
359
+ maxWidth: "100%"
360
+ },
361
+ children: [
362
+ /* @__PURE__ */ s(
363
+ "div",
364
+ {
365
+ style: {
366
+ fontSize: "var(--text-sm, 11px)",
367
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
368
+ marginBottom: "6px",
369
+ fontWeight: 650,
370
+ letterSpacing: "0.02em"
371
+ },
372
+ children: [
373
+ f ? "You" : "Chordia",
374
+ v && !f && /* @__PURE__ */ e("span", { style: { marginLeft: "6px", color: "var(--rail-purple, #9B7AA8)" }, children: "●" })
375
+ ]
376
+ }
377
+ ),
378
+ i && i.length > 0 && /* @__PURE__ */ e("div", { style: {
379
+ marginBottom: "8px",
380
+ display: "flex",
381
+ flexWrap: "wrap",
382
+ gap: "4px",
383
+ maxWidth: "75%"
384
+ }, children: i.map((d, o) => /* @__PURE__ */ s(
385
+ "span",
386
+ {
387
+ style: {
388
+ display: "inline-block",
389
+ fontSize: "11px",
390
+ padding: "2px 8px",
391
+ borderRadius: "6px",
392
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))",
393
+ border: `1px solid ${d.pending ? "var(--rail-discovery, #5A8CC0)" : d.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"}`,
394
+ color: d.pending ? "var(--rail-discovery, #5A8CC0)" : d.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"
395
+ },
396
+ children: [
397
+ /* @__PURE__ */ e(ve, { size: 10, style: { marginRight: 3, verticalAlign: "middle" } }),
398
+ d.name,
399
+ d.pending ? "..." : d.success !== !1 ? " ✓" : " ✗"
400
+ ]
401
+ },
402
+ d.id || o
403
+ )) }),
404
+ /* @__PURE__ */ e(
405
+ "div",
406
+ {
407
+ style: {
408
+ maxWidth: "75%",
409
+ padding: "12px 16px",
410
+ borderRadius: "var(--radius-lg, 12px)",
411
+ background: f ? "var(--card-customer, rgba(94,136,176,0.08))" : "var(--paper-elevated, rgba(255,255,255,0.82))",
412
+ border: f ? "1px solid var(--border-subtle, rgba(52,58,64,0.08))" : "1px solid var(--border, rgba(52,58,64,0.12))",
413
+ fontSize: "var(--text-base, 14px)",
414
+ lineHeight: 1.6,
415
+ color: "var(--text-strong, rgba(30,33,37,0.92))",
416
+ wordBreak: "break-word"
417
+ },
418
+ children: m ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: m } }) : f ? (
419
+ // User messages stay plain text
420
+ /* @__PURE__ */ e("div", { style: { whiteSpace: "pre-wrap" }, children: b })
421
+ ) : (
422
+ // Assistant messages get markdown rendering
423
+ /* @__PURE__ */ e(We, { content: b || "", onCodeBlockClick: L, onFilePathClick: k })
424
+ )
425
+ }
426
+ ),
427
+ y && /* @__PURE__ */ e(
428
+ "div",
429
+ {
430
+ style: {
431
+ fontSize: "var(--text-xs-plus, 10.5px)",
432
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
433
+ marginTop: "4px",
434
+ fontFamily: "var(--font-mono, monospace)"
435
+ },
436
+ children: y
437
+ }
438
+ )
439
+ ]
440
+ }
441
+ );
442
+ }
443
+ function Fe({
444
+ phase: h = "thinking",
445
+ toolSteps: b = [],
446
+ label: m,
447
+ elapsedMs: y,
448
+ compact: i = !1
449
+ }) {
450
+ const v = (t) => {
451
+ if (!t || t < 1e3)
452
+ return null;
453
+ const r = Math.floor(t / 1e3);
454
+ if (r < 60)
455
+ return `${r}s`;
456
+ const c = Math.floor(r / 60), g = r % 60;
457
+ return g > 0 ? `${c}m ${g}s` : `${c}m`;
458
+ }, L = () => {
459
+ if (m)
460
+ return m;
461
+ switch (h) {
462
+ case "thinking":
463
+ return "Thinking...";
464
+ case "tool":
465
+ return null;
466
+ case "responding":
467
+ return "Responding...";
468
+ default:
469
+ return "Thinking...";
470
+ }
471
+ }, k = (t, r) => {
472
+ const c = () => {
473
+ const p = {
474
+ width: i ? "4px" : "6px",
475
+ height: i ? "4px" : "6px",
476
+ borderRadius: "50%",
477
+ display: "inline-block",
478
+ marginRight: i ? "6px" : "8px"
479
+ };
480
+ switch (t.status) {
481
+ case "active":
482
+ return /* @__PURE__ */ e(
483
+ "span",
484
+ {
485
+ style: {
486
+ ...p,
487
+ backgroundColor: "var(--rail-purple, #9B7AA8)",
488
+ animation: "pulse 1.2s ease-in-out infinite"
489
+ }
490
+ }
491
+ );
492
+ case "done":
493
+ return /* @__PURE__ */ e(
494
+ "span",
495
+ {
496
+ style: {
497
+ ...p,
498
+ backgroundColor: "var(--text-xfaint, rgba(30,33,37,0.28))"
499
+ }
500
+ }
501
+ );
502
+ case "error":
503
+ return /* @__PURE__ */ e(
504
+ "span",
505
+ {
506
+ style: {
507
+ ...p,
508
+ backgroundColor: "var(--rail-compliance, #C98A5A)"
509
+ }
510
+ }
511
+ );
512
+ default:
513
+ return /* @__PURE__ */ e(
514
+ "span",
515
+ {
516
+ style: {
517
+ ...p,
518
+ backgroundColor: "var(--text-xfaint, rgba(30,33,37,0.28))"
519
+ }
520
+ }
521
+ );
522
+ }
523
+ }, g = () => {
524
+ switch (t.status) {
525
+ case "done":
526
+ return /* @__PURE__ */ e("span", { style: {
527
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
528
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
529
+ }, children: "✓" });
530
+ case "error":
531
+ return /* @__PURE__ */ e("span", { style: {
532
+ color: "var(--rail-compliance, #C98A5A)",
533
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
534
+ }, children: "failed" });
535
+ default:
536
+ return null;
537
+ }
538
+ };
539
+ return /* @__PURE__ */ s(
540
+ "div",
541
+ {
542
+ style: {
543
+ display: "flex",
544
+ alignItems: "center",
545
+ justifyContent: "space-between",
546
+ marginBottom: i ? "2px" : "4px"
547
+ },
548
+ children: [
549
+ /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center" }, children: [
550
+ c(),
551
+ /* @__PURE__ */ e("span", { style: {
552
+ fontFamily: "var(--font-mono)",
553
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)",
554
+ color: "var(--text-muted)"
555
+ }, children: t.name })
556
+ ] }),
557
+ g()
558
+ ]
559
+ },
560
+ r
561
+ );
562
+ }, f = () => /* @__PURE__ */ e("div", { style: {
563
+ width: "100%",
564
+ height: i ? "2px" : "3px",
565
+ backgroundColor: "var(--border-subtle, rgba(52,58,64,0.08))",
566
+ borderRadius: i ? "2px" : "3px",
567
+ overflow: "hidden",
568
+ position: "relative"
569
+ }, children: /* @__PURE__ */ e("div", { style: {
570
+ position: "absolute",
571
+ top: 0,
572
+ left: 0,
573
+ right: 0,
574
+ bottom: 0,
575
+ background: "linear-gradient(90deg, transparent 0%, rgba(155,122,168,0.3) 50%, transparent 100%)",
576
+ animation: "shimmer 2s linear infinite"
577
+ } }) }), d = () => /* @__PURE__ */ e("span", { style: {
578
+ width: i ? "4px" : "6px",
579
+ height: i ? "10px" : "14px",
580
+ backgroundColor: "var(--rail-purple, #9B7AA8)",
581
+ borderRadius: "1px",
582
+ display: "inline-block",
583
+ marginLeft: "2px",
584
+ animation: "cursorBlink 0.8s ease-in-out infinite"
585
+ } }), o = L(), n = v(y);
586
+ return /* @__PURE__ */ s("div", { style: {
587
+ borderLeft: `${i ? "3px" : "4px"} solid var(--rail-purple, #9B7AA8)`,
588
+ backgroundColor: "var(--card-assistant, rgba(155,122,168,0.06))",
589
+ border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
590
+ borderRadius: i ? "8px" : "10px",
591
+ padding: i ? "8px 10px 8px 12px" : "10px 14px 10px 18px"
592
+ }, children: [
593
+ /* @__PURE__ */ e("style", { children: `
594
+ @keyframes shimmer {
595
+ 0% { transform: translateX(-100%); }
596
+ 100% { transform: translateX(200%); }
597
+ }
598
+
599
+ @keyframes pulse {
600
+ 0%, 100% { opacity: 0.4; }
601
+ 50% { opacity: 1.0; }
602
+ }
603
+
604
+ @keyframes cursorBlink {
605
+ 0%, 100% { opacity: 0; }
606
+ 50% { opacity: 1; }
607
+ }
608
+ ` }),
609
+ !i && /* @__PURE__ */ e("div", { style: {
610
+ fontSize: "var(--text-xs-plus, 10.5px)",
611
+ fontWeight: 650,
612
+ textTransform: "uppercase",
613
+ letterSpacing: "var(--tracking-label, 0.16em)",
614
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
615
+ marginBottom: "8px"
616
+ }, children: "AI ASSISTANT" }),
617
+ h === "thinking" && /* @__PURE__ */ s("div", { children: [
618
+ /* @__PURE__ */ s("div", { style: {
619
+ color: "var(--text-muted)",
620
+ fontWeight: 400,
621
+ fontSize: i ? "11px" : "13px",
622
+ marginBottom: i ? "4px" : "8px",
623
+ display: "flex",
624
+ alignItems: "center",
625
+ gap: "6px"
626
+ }, children: [
627
+ o,
628
+ n && /* @__PURE__ */ e("span", { style: {
629
+ fontSize: i ? "9px" : "10px",
630
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
631
+ fontFamily: "var(--font-mono, monospace)"
632
+ }, children: n })
633
+ ] }),
634
+ f()
635
+ ] }),
636
+ h === "tool" && /* @__PURE__ */ s("div", { children: [
637
+ o && /* @__PURE__ */ s("div", { style: {
638
+ color: "var(--text-muted)",
639
+ fontWeight: 400,
640
+ fontSize: i ? "11px" : "13px",
641
+ marginBottom: i ? "4px" : "8px",
642
+ display: "flex",
643
+ alignItems: "center",
644
+ gap: "6px"
645
+ }, children: [
646
+ o,
647
+ n && /* @__PURE__ */ e("span", { style: {
648
+ fontSize: i ? "9px" : "10px",
649
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
650
+ fontFamily: "var(--font-mono, monospace)"
651
+ }, children: n })
652
+ ] }),
653
+ /* @__PURE__ */ e("div", { style: { marginBottom: i ? "4px" : "8px" }, children: b.map((t, r) => k(t, r)) }),
654
+ f()
655
+ ] }),
656
+ h === "responding" && /* @__PURE__ */ s("div", { style: {
657
+ color: "var(--text-muted)",
658
+ fontWeight: 400,
659
+ fontSize: i ? "11px" : "13px",
660
+ display: "flex",
661
+ alignItems: "center",
662
+ gap: "6px"
663
+ }, children: [
664
+ /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center" }, children: [
665
+ o,
666
+ d()
667
+ ] }),
668
+ n && /* @__PURE__ */ e("span", { style: {
669
+ fontSize: i ? "9px" : "10px",
670
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
671
+ fontFamily: "var(--font-mono, monospace)"
672
+ }, children: n })
673
+ ] })
674
+ ] });
675
+ }
676
+ const _e = { error: (...h) => console.warn("toast.error:", ...h) };
677
+ function qe({
678
+ initialMessages: h = [],
679
+ onSendMessage: b,
680
+ onStreamMessage: m,
681
+ // NEW: streaming version of onSendMessage
682
+ onMessagesChange: y,
683
+ // NEW: callback when messages array changes
684
+ onCodeBlockClick: i,
685
+ // callback when "Canvas" button clicked on a code block: ({ code, language }) => void
686
+ placeholder: v = "Ask a question about this interaction...",
687
+ title: L = "Chat with Chordia"
688
+ }) {
689
+ const [k, f] = M(h || []), [d, o] = M(""), [n, t] = M(!1), [r, c] = M(!1), [g, p] = M(null), [C, z] = M("thinking"), [B, a] = M(null), [w, D] = M(0), T = Y(null), l = Y(null), x = Y(null), I = Y(null), S = Y(null), [E, _] = M(!1), [H, X] = M(0);
690
+ G(() => {
691
+ var u;
692
+ (u = T.current) == null || u.scrollIntoView({ behavior: "smooth" });
693
+ }, [k, n]), G(() => {
694
+ l.current && (l.current.style.height = "auto", l.current.style.height = `${Math.min(
695
+ l.current.scrollHeight,
696
+ 120
697
+ )}px`);
698
+ }, [d]), G(() => {
699
+ if (y) {
700
+ const u = [...k];
701
+ g && u.push(g), y(u);
702
+ }
703
+ }, [k, g, y]), G(() => {
704
+ let u;
705
+ return n && B && (u = setInterval(() => {
706
+ if (D(Date.now() - B), S.current) {
707
+ const W = (Date.now() - S.current) / 1e3;
708
+ W >= 3 ? (_(!0), X(Math.floor(W))) : _(!1);
709
+ }
710
+ }, 500)), () => u && clearInterval(u);
711
+ }, [n, B]);
712
+ const P = () => {
713
+ t(!1), c(!1), p(null), I.current = null, z("thinking"), _(!1), X(0), S.current = null, a(null), D(0), x.current && (x.current.abort(), x.current = null);
714
+ }, N = (u) => {
715
+ if (u.startsWith("data: ")) {
716
+ const W = u.slice(6);
717
+ if (W === "[DONE]")
718
+ return { type: "done" };
719
+ try {
720
+ return { type: "data", data: JSON.parse(W) };
721
+ } catch {
722
+ return null;
723
+ }
724
+ }
725
+ return null;
726
+ }, q = (u) => {
727
+ var j, R;
728
+ if (!((R = (j = u.choices) == null ? void 0 : j[0]) != null && R.delta))
729
+ return;
730
+ S.current = Date.now(), _(!1);
731
+ const W = u.choices[0].delta;
732
+ if (W.tool_calls || W.tool_results) {
733
+ z("tool");
734
+ return;
735
+ }
736
+ W.content !== void 0 && (z("responding"), p((F) => {
737
+ const V = F || {
738
+ id: Date.now().toString(),
739
+ role: "assistant",
740
+ content: "",
741
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
742
+ hour: "2-digit",
743
+ minute: "2-digit"
744
+ }),
745
+ isStreaming: !0
746
+ }, Q = {
747
+ ...V,
748
+ content: (V.content || "") + (W.content || "")
749
+ };
750
+ return I.current = Q, Q;
751
+ }));
752
+ }, U = async (u) => {
753
+ const W = u.getReader(), j = new TextDecoder();
754
+ let R = "";
755
+ try {
756
+ for (; ; ) {
757
+ const { done: F, value: V } = await W.read();
758
+ if (F)
759
+ break;
760
+ R += j.decode(V, { stream: !0 });
761
+ const Q = R.split(`
762
+ `);
763
+ R = Q.pop() || "";
764
+ for (const ue of Q)
765
+ if (ue.trim()) {
766
+ const re = N(ue);
767
+ if (re) {
768
+ if (re.type === "done")
769
+ return;
770
+ re.type === "data" && q(re.data);
771
+ }
772
+ }
773
+ }
774
+ } finally {
775
+ W.releaseLock();
776
+ }
777
+ }, K = async () => {
778
+ if (!d.trim() || r)
779
+ return;
780
+ const u = d.trim(), W = {
781
+ id: Date.now().toString(),
782
+ role: "user",
783
+ content: u,
784
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
785
+ hour: "2-digit",
786
+ minute: "2-digit"
787
+ })
788
+ }, j = [...k, W];
789
+ f(j), o(""), t(!0), c(!0), z("thinking"), a(Date.now()), S.current = Date.now(), x.current = new AbortController();
790
+ try {
791
+ let R;
792
+ if (m)
793
+ R = await m(u, j);
794
+ else if (b)
795
+ R = await b(u, j);
796
+ else {
797
+ setTimeout(() => {
798
+ const F = {
799
+ id: (Date.now() + 1).toString(),
800
+ role: "assistant",
801
+ content: "This is a demonstration response. In a real implementation, this would connect to your LLM backend.",
802
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
803
+ hour: "2-digit",
804
+ minute: "2-digit"
805
+ })
806
+ };
807
+ f((V) => [...V, F]), P();
808
+ }, 1e3);
809
+ return;
810
+ }
811
+ if (R instanceof ReadableStream)
812
+ await U(R);
813
+ else if (R instanceof Response && R.body)
814
+ await U(R.body);
815
+ else if (R && typeof R.then == "function") {
816
+ const F = await R;
817
+ F instanceof ReadableStream ? await U(F) : F instanceof Response && F.body && await U(F.body);
818
+ }
819
+ I.current && f((F) => [...F, {
820
+ ...I.current,
821
+ isStreaming: !1
822
+ }]);
823
+ } catch (R) {
824
+ R.name !== "AbortError" && (_e.error("Failed to send message"), console.error("Stream error:", R));
825
+ } finally {
826
+ P();
827
+ }
828
+ }, $ = (u) => {
829
+ u.key === "Enter" && !u.shiftKey && (u.preventDefault(), K());
830
+ };
831
+ return /* @__PURE__ */ s(
832
+ "div",
833
+ {
834
+ style: {
835
+ display: "flex",
836
+ flexDirection: "column",
837
+ height: "100%",
838
+ border: "1px solid var(--border, rgba(52,58,64,0.12))",
839
+ borderRadius: "var(--radius-lg, 12px)",
840
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))",
841
+ overflow: "hidden"
842
+ },
843
+ children: [
844
+ L ? /* @__PURE__ */ s(
845
+ "div",
846
+ {
847
+ style: {
848
+ padding: "16px 20px",
849
+ borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
850
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))"
851
+ },
852
+ children: [
853
+ /* @__PURE__ */ e(
854
+ "div",
855
+ {
856
+ style: {
857
+ fontSize: "var(--text-lg, 16px)",
858
+ fontWeight: 720,
859
+ letterSpacing: "-0.01em",
860
+ color: "var(--text-strong, rgba(30,33,37,0.92))"
861
+ },
862
+ children: L
863
+ }
864
+ ),
865
+ /* @__PURE__ */ e(
866
+ "div",
867
+ {
868
+ style: {
869
+ fontSize: "var(--text-sm, 11px)",
870
+ color: "var(--text-muted, rgba(30,33,37,0.56))",
871
+ marginTop: "2px"
872
+ },
873
+ children: "Ask questions, get insights from analyzed interactions"
874
+ }
875
+ )
876
+ ]
877
+ }
878
+ ) : null,
879
+ /* @__PURE__ */ e(
880
+ "div",
881
+ {
882
+ style: {
883
+ flex: 1,
884
+ minHeight: 0,
885
+ overflowY: "auto",
886
+ padding: "20px",
887
+ display: "flex",
888
+ flexDirection: "column"
889
+ },
890
+ children: k.length === 0 ? /* @__PURE__ */ e(
891
+ "div",
892
+ {
893
+ style: {
894
+ flex: 1,
895
+ display: "flex",
896
+ alignItems: "center",
897
+ justifyContent: "center",
898
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
899
+ fontSize: "var(--text-md, 13px)",
900
+ textAlign: "center",
901
+ padding: "40px"
902
+ },
903
+ children: "No messages yet. Start a conversation by asking a question below."
904
+ }
905
+ ) : /* @__PURE__ */ s(J, { children: [
906
+ k.map((u) => /* @__PURE__ */ e(
907
+ be,
908
+ {
909
+ role: u.role,
910
+ content: u.content,
911
+ html: u.html,
912
+ timestamp: u.timestamp,
913
+ toolBadges: u.toolBadges,
914
+ isStreaming: u.isStreaming,
915
+ onCodeBlockClick: i
916
+ },
917
+ u.id
918
+ )),
919
+ g && /* @__PURE__ */ e(
920
+ be,
921
+ {
922
+ role: g.role,
923
+ content: g.content,
924
+ timestamp: g.timestamp,
925
+ isStreaming: !0,
926
+ onCodeBlockClick: i
927
+ },
928
+ g.id
929
+ ),
930
+ n && (!g || E) && /* @__PURE__ */ e("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ e(
931
+ Fe,
932
+ {
933
+ phase: E ? "tool" : C,
934
+ elapsedMs: w,
935
+ label: E && H >= 30 ? "Compacting conversation — trimming context to stay sharp..." : E && H >= 10 ? "Running background tasks..." : E ? "Still working..." : void 0
936
+ }
937
+ ) }),
938
+ /* @__PURE__ */ e("div", { ref: T })
939
+ ] })
940
+ }
941
+ ),
942
+ /* @__PURE__ */ s(
943
+ "div",
944
+ {
945
+ style: {
946
+ borderTop: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
947
+ padding: "16px 20px",
948
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))"
949
+ },
950
+ children: [
951
+ /* @__PURE__ */ s(
952
+ "div",
953
+ {
954
+ style: {
955
+ display: "flex",
956
+ gap: "12px",
957
+ alignItems: "flex-end"
958
+ },
959
+ children: [
960
+ /* @__PURE__ */ e(
961
+ "textarea",
962
+ {
963
+ ref: l,
964
+ value: d,
965
+ onChange: (u) => o(u.target.value),
966
+ onKeyDown: $,
967
+ placeholder: v,
968
+ rows: 1,
969
+ disabled: r,
970
+ style: {
971
+ flex: 1,
972
+ padding: "10px 14px",
973
+ fontSize: "var(--text-base, 14px)",
974
+ lineHeight: 1.5,
975
+ color: "var(--text-strong, rgba(30,33,37,0.92))",
976
+ background: "rgba(255, 255, 255, 0.95)",
977
+ border: "1px solid rgba(52, 58, 64, 0.18)",
978
+ borderRadius: "var(--radius-md, 8px)",
979
+ resize: "none",
980
+ outline: "none",
981
+ transition: "border-color 0.15s ease",
982
+ fontFamily: "inherit",
983
+ minHeight: "42px",
984
+ maxHeight: "120px",
985
+ opacity: r ? 0.6 : 1,
986
+ cursor: r ? "not-allowed" : "text"
987
+ },
988
+ onFocus: (u) => {
989
+ r || (u.target.style.borderColor = "rgba(94, 136, 176, 0.35)");
990
+ },
991
+ onBlur: (u) => {
992
+ u.target.style.borderColor = "rgba(52, 58, 64, 0.18)";
993
+ }
994
+ }
995
+ ),
996
+ /* @__PURE__ */ e(
997
+ "button",
998
+ {
999
+ onClick: K,
1000
+ disabled: !d.trim() || r,
1001
+ style: {
1002
+ padding: "10px 16px",
1003
+ background: d.trim() && !r ? "var(--Base-Strong, #0B0B0B)" : "#ECEEF2",
1004
+ color: d.trim() && !r ? "white" : "var(--text-base)",
1005
+ border: "none",
1006
+ borderRadius: "var(--radius-md, 8px)",
1007
+ cursor: d.trim() && !r ? "pointer" : "not-allowed",
1008
+ display: "flex",
1009
+ alignItems: "center",
1010
+ gap: "6px",
1011
+ fontSize: "var(--text-md, 13px)",
1012
+ fontWeight: 650,
1013
+ transition: "all 0.15s ease",
1014
+ height: "42px"
1015
+ },
1016
+ children: r ? /* @__PURE__ */ s(J, { children: [
1017
+ /* @__PURE__ */ e("style", { children: `
1018
+ @keyframes buttonSpin {
1019
+ from { transform: rotate(0deg); }
1020
+ to { transform: rotate(360deg); }
1021
+ }
1022
+ ` }),
1023
+ /* @__PURE__ */ e(
1024
+ "div",
1025
+ {
1026
+ style: {
1027
+ width: "14px",
1028
+ height: "14px",
1029
+ border: "2px solid rgba(255, 255, 255, 0.3)",
1030
+ borderTopColor: "white",
1031
+ borderRadius: "50%",
1032
+ animation: "buttonSpin 0.6s linear infinite"
1033
+ }
1034
+ }
1035
+ ),
1036
+ "Sending..."
1037
+ ] }) : /* @__PURE__ */ s(J, { children: [
1038
+ /* @__PURE__ */ e(ye, { size: 16 }),
1039
+ "Send"
1040
+ ] })
1041
+ }
1042
+ )
1043
+ ]
1044
+ }
1045
+ ),
1046
+ /* @__PURE__ */ e(
1047
+ "div",
1048
+ {
1049
+ style: {
1050
+ fontSize: "var(--text-sm, 11px)",
1051
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1052
+ marginTop: "8px"
1053
+ },
1054
+ children: "Press Enter to send, Shift+Enter for new line"
1055
+ }
1056
+ )
1057
+ ]
1058
+ }
1059
+ )
1060
+ ]
1061
+ }
1062
+ );
1063
+ }
1064
+ function Ve({
1065
+ threads: h = [],
1066
+ activeThreadId: b,
1067
+ onSelectThread: m,
1068
+ onNewChat: y,
1069
+ loading: i = !1
1070
+ }) {
1071
+ const [v, L] = M(""), f = [...h.filter((o) => {
1072
+ if (!v)
1073
+ return !0;
1074
+ const n = v.toLowerCase();
1075
+ return (o.title || "").toLowerCase().includes(n) || (o.last_message_preview || "").toLowerCase().includes(n);
1076
+ })].sort((o, n) => {
1077
+ if (o.pinned && !n.pinned)
1078
+ return -1;
1079
+ if (!o.pinned && n.pinned)
1080
+ return 1;
1081
+ const t = new Date(o.updated_at || o.created_at || 0).getTime();
1082
+ return new Date(n.updated_at || n.created_at || 0).getTime() - t;
1083
+ }), d = (o) => {
1084
+ if (!o)
1085
+ return "";
1086
+ const n = new Date(o), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), c = Math.floor(r / 864e5);
1087
+ return c === 0 ? n.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : c === 1 ? "Yesterday" : c < 7 ? n.toLocaleDateString("en-US", { weekday: "short" }) : n.toLocaleDateString("en-US", { month: "short", day: "numeric" });
1088
+ };
1089
+ return /* @__PURE__ */ s(
1090
+ "div",
1091
+ {
1092
+ style: {
1093
+ display: "flex",
1094
+ flexDirection: "column",
1095
+ height: "100%",
1096
+ background: "var(--paper, rgba(255,255,255,0.95))",
1097
+ borderRight: "1px solid var(--border, rgba(52,58,64,0.12))",
1098
+ overflow: "hidden"
1099
+ },
1100
+ children: [
1101
+ /* @__PURE__ */ s(
1102
+ "div",
1103
+ {
1104
+ style: {
1105
+ padding: "12px 14px",
1106
+ borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
1107
+ flexShrink: 0
1108
+ },
1109
+ children: [
1110
+ /* @__PURE__ */ s(
1111
+ "div",
1112
+ {
1113
+ style: {
1114
+ display: "flex",
1115
+ justifyContent: "space-between",
1116
+ alignItems: "center",
1117
+ marginBottom: "10px"
1118
+ },
1119
+ children: [
1120
+ /* @__PURE__ */ e(
1121
+ "div",
1122
+ {
1123
+ style: {
1124
+ fontSize: "13px",
1125
+ fontWeight: 650,
1126
+ color: "var(--text-ink, rgba(30,33,37,0.92))"
1127
+ },
1128
+ children: "Threads"
1129
+ }
1130
+ ),
1131
+ y && /* @__PURE__ */ e(
1132
+ "button",
1133
+ {
1134
+ onClick: y,
1135
+ style: {
1136
+ padding: "4px 10px",
1137
+ fontSize: "11px",
1138
+ fontWeight: 600,
1139
+ color: "var(--Base-Strong, #0B0B0B)",
1140
+ background: "#ECEEF2",
1141
+ border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
1142
+ borderRadius: "6px",
1143
+ cursor: "pointer",
1144
+ transition: "all 0.15s ease"
1145
+ },
1146
+ onMouseEnter: (o) => {
1147
+ o.currentTarget.style.background = "#ECEEF2";
1148
+ },
1149
+ onMouseLeave: (o) => {
1150
+ o.currentTarget.style.background = "rgba(94, 136, 176, 0.08)";
1151
+ },
1152
+ children: "+ New"
1153
+ }
1154
+ )
1155
+ ]
1156
+ }
1157
+ ),
1158
+ /* @__PURE__ */ s("div", { style: { position: "relative" }, children: [
1159
+ /* @__PURE__ */ e(
1160
+ Ce,
1161
+ {
1162
+ size: 13,
1163
+ style: {
1164
+ position: "absolute",
1165
+ left: "10px",
1166
+ top: "50%",
1167
+ transform: "translateY(-50%)",
1168
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1169
+ pointerEvents: "none"
1170
+ }
1171
+ }
1172
+ ),
1173
+ /* @__PURE__ */ e(
1174
+ "input",
1175
+ {
1176
+ type: "text",
1177
+ value: v,
1178
+ onChange: (o) => L(o.target.value),
1179
+ placeholder: "Search threads...",
1180
+ style: {
1181
+ width: "100%",
1182
+ padding: "7px 10px 7px 32px",
1183
+ fontSize: "12px",
1184
+ color: "var(--text-ink, rgba(30,33,37,0.92))",
1185
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))",
1186
+ border: "1px solid var(--border, rgba(52,58,64,0.12))",
1187
+ borderRadius: "6px",
1188
+ outline: "none",
1189
+ transition: "border-color 0.15s ease",
1190
+ boxSizing: "border-box"
1191
+ },
1192
+ onFocus: (o) => {
1193
+ o.target.style.borderColor = "rgba(94, 136, 176, 0.35)";
1194
+ },
1195
+ onBlur: (o) => {
1196
+ o.target.style.borderColor = "rgba(52, 58, 64, 0.12)";
1197
+ }
1198
+ }
1199
+ )
1200
+ ] })
1201
+ ]
1202
+ }
1203
+ ),
1204
+ /* @__PURE__ */ e("div", { style: { flex: 1, overflowY: "auto", padding: "4px 6px" }, children: i ? /* @__PURE__ */ e(
1205
+ "div",
1206
+ {
1207
+ style: {
1208
+ padding: "30px 16px",
1209
+ textAlign: "center",
1210
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1211
+ fontSize: "12px"
1212
+ },
1213
+ children: "Loading threads..."
1214
+ }
1215
+ ) : f.length === 0 ? /* @__PURE__ */ e(
1216
+ "div",
1217
+ {
1218
+ style: {
1219
+ padding: "30px 16px",
1220
+ textAlign: "center",
1221
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1222
+ fontSize: "12px"
1223
+ },
1224
+ children: v ? "No threads found" : "No threads yet"
1225
+ }
1226
+ ) : f.map((o) => {
1227
+ const n = o.id === b;
1228
+ return /* @__PURE__ */ s(
1229
+ "div",
1230
+ {
1231
+ onClick: () => m == null ? void 0 : m(o.id),
1232
+ style: {
1233
+ padding: "10px 10px",
1234
+ marginBottom: "2px",
1235
+ borderRadius: "6px",
1236
+ background: n ? "rgba(94, 136, 176, 0.10)" : "transparent",
1237
+ border: n ? "1px solid rgba(94, 136, 176, 0.15)" : "1px solid transparent",
1238
+ cursor: "pointer",
1239
+ transition: "all 0.12s ease"
1240
+ },
1241
+ onMouseEnter: (t) => {
1242
+ n || (t.currentTarget.style.background = "rgba(0,0,0,0.03)");
1243
+ },
1244
+ onMouseLeave: (t) => {
1245
+ n || (t.currentTarget.style.background = "transparent");
1246
+ },
1247
+ children: [
1248
+ /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginBottom: "4px" }, children: [
1249
+ /* @__PURE__ */ e(
1250
+ ze,
1251
+ {
1252
+ size: 12,
1253
+ style: {
1254
+ color: n ? "var(--rail-discovery, #5E88B0)" : "var(--text-faint, rgba(30,33,37,0.36))",
1255
+ flexShrink: 0
1256
+ }
1257
+ }
1258
+ ),
1259
+ /* @__PURE__ */ e(
1260
+ "div",
1261
+ {
1262
+ style: {
1263
+ flex: 1,
1264
+ fontSize: "12px",
1265
+ fontWeight: n ? 650 : 550,
1266
+ color: n ? "var(--text-ink, rgba(30,33,37,0.92))" : "var(--text-base, rgba(30,33,37,0.78))",
1267
+ overflow: "hidden",
1268
+ textOverflow: "ellipsis",
1269
+ whiteSpace: "nowrap"
1270
+ },
1271
+ children: o.title || "Untitled thread"
1272
+ }
1273
+ ),
1274
+ o.pinned && /* @__PURE__ */ e(Te, { size: 10, style: { color: "var(--rail-discovery, #5E88B0)", flexShrink: 0 } })
1275
+ ] }),
1276
+ o.last_message_preview && /* @__PURE__ */ e(
1277
+ "div",
1278
+ {
1279
+ style: {
1280
+ fontSize: "11px",
1281
+ color: "var(--text-muted, rgba(30,33,37,0.56))",
1282
+ overflow: "hidden",
1283
+ textOverflow: "ellipsis",
1284
+ whiteSpace: "nowrap",
1285
+ marginLeft: "18px",
1286
+ marginBottom: "4px"
1287
+ },
1288
+ children: o.last_message_preview
1289
+ }
1290
+ ),
1291
+ /* @__PURE__ */ s(
1292
+ "div",
1293
+ {
1294
+ style: {
1295
+ display: "flex",
1296
+ alignItems: "center",
1297
+ gap: "6px",
1298
+ marginLeft: "18px",
1299
+ fontSize: "10px",
1300
+ color: "var(--text-faint, rgba(30,33,37,0.36))"
1301
+ },
1302
+ children: [
1303
+ /* @__PURE__ */ e(ge, { size: 9 }),
1304
+ /* @__PURE__ */ e("span", { children: d(o.updated_at || o.created_at) }),
1305
+ o.message_count != null && /* @__PURE__ */ s(J, { children: [
1306
+ /* @__PURE__ */ e("span", { children: "·" }),
1307
+ /* @__PURE__ */ s("span", { children: [
1308
+ o.message_count,
1309
+ " msg",
1310
+ o.message_count !== 1 ? "s" : ""
1311
+ ] })
1312
+ ] })
1313
+ ]
1314
+ }
1315
+ )
1316
+ ]
1317
+ },
1318
+ o.id
1319
+ );
1320
+ }) })
1321
+ ]
1322
+ }
1323
+ );
1324
+ }
1325
+ const $e = { error: (...h) => console.warn("toast.error:", ...h) }, je = () => ({ userData: { name: "User", email: "" } });
1326
+ function Ge({
1327
+ sessionTitle: h,
1328
+ messages: b,
1329
+ onSendMessage: m,
1330
+ currentUser: y
1331
+ }) {
1332
+ var B;
1333
+ const [i, v] = M(""), [L, k] = M(!1), [f, d] = M(b || []), [o, n] = M(!1), [t, r] = M(!1), { userData: c } = je(), g = Y(null), p = y || {
1334
+ name: (c == null ? void 0 : c.name) || "You",
1335
+ initials: ((B = c == null ? void 0 : c.name) == null ? void 0 : B.split(" ").map((a) => a[0]).join("").toUpperCase()) || "YO",
1336
+ color: "#6B7C93"
1337
+ };
1338
+ G(() => {
1339
+ d(b || []);
1340
+ }, [b]), G(() => {
1341
+ g.current && g.current.scrollIntoView({ behavior: "smooth" });
1342
+ }, [f]);
1343
+ const C = async () => {
1344
+ if (!i.trim())
1345
+ return;
1346
+ const a = i.trim();
1347
+ v(""), r(!0);
1348
+ const w = {
1349
+ id: `temp-${Date.now()}`,
1350
+ author: {
1351
+ name: p.name,
1352
+ role: (c == null ? void 0 : c.role) || "",
1353
+ initials: p.initials,
1354
+ color: p.color
1355
+ },
1356
+ content: a,
1357
+ timestamp: "Just now",
1358
+ type: "comment",
1359
+ isOptimistic: !0
1360
+ };
1361
+ if (d((D) => [...D, w]), m) {
1362
+ try {
1363
+ await m(a), d(
1364
+ (D) => D.map(
1365
+ (T) => T.id === w.id ? { ...T, isOptimistic: !1 } : T
1366
+ )
1367
+ );
1368
+ } catch {
1369
+ d((T) => T.filter((l) => l.id !== w.id)), $e.error("Failed to send message");
1370
+ } finally {
1371
+ r(!1);
1372
+ }
1373
+ return;
1374
+ }
1375
+ setTimeout(() => {
1376
+ d(
1377
+ (D) => D.map(
1378
+ (T) => T.id === w.id ? { ...T, isOptimistic: !1 } : T
1379
+ )
1380
+ ), r(!1);
1381
+ }, 500);
1382
+ }, z = (a) => {
1383
+ a.key === "Enter" && !a.shiftKey && (a.preventDefault(), C());
1384
+ };
1385
+ return /* @__PURE__ */ s(
1386
+ "div",
1387
+ {
1388
+ style: {
1389
+ display: "flex",
1390
+ flexDirection: "column",
1391
+ height: "100%",
1392
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))",
1393
+ border: "1px solid var(--border, rgba(52,58,64,0.12))",
1394
+ borderRadius: "var(--radius-lg, 12px)",
1395
+ overflow: "hidden"
1396
+ },
1397
+ children: [
1398
+ h && /* @__PURE__ */ s(
1399
+ "div",
1400
+ {
1401
+ style: {
1402
+ padding: "14px 16px",
1403
+ borderBottom: "1px solid var(--border, rgba(52,58,64,0.12))",
1404
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))"
1405
+ },
1406
+ children: [
1407
+ /* @__PURE__ */ e(
1408
+ "div",
1409
+ {
1410
+ style: {
1411
+ fontSize: "var(--text-md, 13px)",
1412
+ fontWeight: 680,
1413
+ color: "var(--text-strong, rgba(30,33,37,0.92))",
1414
+ marginBottom: "3px"
1415
+ },
1416
+ children: "Session Discussion"
1417
+ }
1418
+ ),
1419
+ h && /* @__PURE__ */ e(
1420
+ "div",
1421
+ {
1422
+ style: {
1423
+ fontSize: "var(--text-sm, 11px)",
1424
+ color: "var(--text-muted, rgba(30,33,37,0.56))",
1425
+ display: "flex",
1426
+ alignItems: "center",
1427
+ gap: "8px"
1428
+ },
1429
+ children: /* @__PURE__ */ e("span", { children: h })
1430
+ }
1431
+ )
1432
+ ]
1433
+ }
1434
+ ),
1435
+ /* @__PURE__ */ s(
1436
+ "div",
1437
+ {
1438
+ style: {
1439
+ flex: 1,
1440
+ overflowY: "auto",
1441
+ padding: "16px",
1442
+ display: "flex",
1443
+ flexDirection: "column",
1444
+ gap: "16px"
1445
+ },
1446
+ children: [
1447
+ o ? /* @__PURE__ */ e(
1448
+ "div",
1449
+ {
1450
+ style: {
1451
+ display: "flex",
1452
+ alignItems: "center",
1453
+ justifyContent: "center",
1454
+ padding: "40px",
1455
+ color: "var(--text-faint, rgba(30,33,37,0.36))"
1456
+ },
1457
+ children: "Loading messages..."
1458
+ }
1459
+ ) : f.length === 0 ? /* @__PURE__ */ e(
1460
+ "div",
1461
+ {
1462
+ style: {
1463
+ display: "flex",
1464
+ alignItems: "center",
1465
+ justifyContent: "center",
1466
+ padding: "40px",
1467
+ color: "var(--text-faint, rgba(30,33,37,0.36))"
1468
+ },
1469
+ children: "No messages yet. Start the conversation!"
1470
+ }
1471
+ ) : f.map((a) => /* @__PURE__ */ s(
1472
+ "div",
1473
+ {
1474
+ style: {
1475
+ display: "flex",
1476
+ gap: "12px",
1477
+ opacity: a.type === "system" ? 0.75 : 1
1478
+ },
1479
+ children: [
1480
+ a.type !== "system" && /* @__PURE__ */ e(
1481
+ "div",
1482
+ {
1483
+ style: {
1484
+ width: "32px",
1485
+ height: "32px",
1486
+ borderRadius: "8px",
1487
+ background: a.author.color,
1488
+ color: "white",
1489
+ display: "flex",
1490
+ alignItems: "center",
1491
+ justifyContent: "center",
1492
+ fontSize: "11px",
1493
+ fontWeight: 650,
1494
+ flexShrink: 0,
1495
+ opacity: 0.9
1496
+ },
1497
+ children: a.author.initials
1498
+ }
1499
+ ),
1500
+ a.type === "system" && /* @__PURE__ */ e(
1501
+ "div",
1502
+ {
1503
+ style: {
1504
+ width: "32px",
1505
+ height: "32px",
1506
+ borderRadius: "8px",
1507
+ background: "rgba(30, 33, 37, 0.08)",
1508
+ color: "rgba(30, 33, 37, 0.52)",
1509
+ display: "flex",
1510
+ alignItems: "center",
1511
+ justifyContent: "center",
1512
+ fontSize: "11px",
1513
+ fontWeight: 650,
1514
+ flexShrink: 0
1515
+ },
1516
+ children: /* @__PURE__ */ e(ge, { size: 14 })
1517
+ }
1518
+ ),
1519
+ /* @__PURE__ */ s("div", { style: { flex: 1, minWidth: 0 }, children: [
1520
+ /* @__PURE__ */ s(
1521
+ "div",
1522
+ {
1523
+ style: {
1524
+ display: "flex",
1525
+ alignItems: "baseline",
1526
+ gap: "8px",
1527
+ marginBottom: "4px"
1528
+ },
1529
+ children: [
1530
+ /* @__PURE__ */ e(
1531
+ "span",
1532
+ {
1533
+ style: {
1534
+ fontSize: "var(--text-sm, 11px)",
1535
+ fontWeight: 650,
1536
+ color: "var(--text-base, rgba(30,33,37,0.78))"
1537
+ },
1538
+ children: a.author.name
1539
+ }
1540
+ ),
1541
+ /* @__PURE__ */ e(
1542
+ "span",
1543
+ {
1544
+ style: {
1545
+ fontSize: "var(--text-sm, 11px)",
1546
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1547
+ fontFamily: "var(--font-mono, monospace)"
1548
+ },
1549
+ children: a.timestamp
1550
+ }
1551
+ ),
1552
+ a.author.role && /* @__PURE__ */ e(
1553
+ "span",
1554
+ {
1555
+ style: {
1556
+ fontSize: "var(--text-xs, 10px)",
1557
+ color: "var(--text-muted, rgba(30,33,37,0.56))",
1558
+ background: "rgba(30, 33, 37, 0.06)",
1559
+ padding: "2px 6px",
1560
+ borderRadius: "4px",
1561
+ textTransform: "uppercase",
1562
+ letterSpacing: "0.04em",
1563
+ fontWeight: 600
1564
+ },
1565
+ children: a.author.role
1566
+ }
1567
+ ),
1568
+ a.isEdited && /* @__PURE__ */ e(
1569
+ "span",
1570
+ {
1571
+ style: {
1572
+ fontSize: "var(--text-xs, 10px)",
1573
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1574
+ fontStyle: "italic"
1575
+ },
1576
+ children: "(edited)"
1577
+ }
1578
+ )
1579
+ ]
1580
+ }
1581
+ ),
1582
+ /* @__PURE__ */ e(
1583
+ "div",
1584
+ {
1585
+ style: {
1586
+ fontSize: "var(--text-md, 13px)",
1587
+ color: "var(--text-base, rgba(30,33,37,0.78))",
1588
+ lineHeight: 1.5,
1589
+ marginBottom: a.references ? "8px" : 0
1590
+ },
1591
+ children: a.content
1592
+ }
1593
+ ),
1594
+ a.references && a.references.length > 0 && /* @__PURE__ */ e(
1595
+ "div",
1596
+ {
1597
+ style: {
1598
+ display: "flex",
1599
+ flexWrap: "wrap",
1600
+ gap: "6px",
1601
+ marginTop: "8px"
1602
+ },
1603
+ children: a.references.map((w, D) => /* @__PURE__ */ s(
1604
+ "button",
1605
+ {
1606
+ type: "button",
1607
+ style: {
1608
+ fontSize: "11px",
1609
+ padding: "4px 8px",
1610
+ borderRadius: "6px",
1611
+ border: "1px solid rgba(52, 58, 64, 0.16)",
1612
+ background: "rgba(255, 255, 255, 0.7)",
1613
+ color: w.type === "condition" ? "rgba(94, 136, 176, 0.85)" : w.type === "observation" ? "rgba(107, 123, 147, 0.85)" : w.type === "timestamp" ? "rgba(184, 156, 106, 0.85)" : "rgba(30, 33, 37, 0.65)",
1614
+ cursor: "pointer",
1615
+ display: "inline-flex",
1616
+ alignItems: "center",
1617
+ gap: "4px",
1618
+ transition: "all 0.15s ease",
1619
+ fontWeight: 550
1620
+ },
1621
+ onMouseEnter: (T) => {
1622
+ T.currentTarget.style.background = "rgba(255, 255, 255, 0.95)", T.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.24)";
1623
+ },
1624
+ onMouseLeave: (T) => {
1625
+ T.currentTarget.style.background = "rgba(255, 255, 255, 0.7)", T.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.16)";
1626
+ },
1627
+ children: [
1628
+ w.type === "timestamp" && /* @__PURE__ */ e(ge, { size: 12 }),
1629
+ (w.type === "condition" || w.type === "observation") && /* @__PURE__ */ e(he, { size: 12 }),
1630
+ w.label
1631
+ ]
1632
+ },
1633
+ D
1634
+ ))
1635
+ }
1636
+ )
1637
+ ] })
1638
+ ]
1639
+ },
1640
+ a.id
1641
+ )),
1642
+ /* @__PURE__ */ e("div", { ref: g })
1643
+ ]
1644
+ }
1645
+ ),
1646
+ /* @__PURE__ */ s(
1647
+ "div",
1648
+ {
1649
+ style: {
1650
+ padding: "12px",
1651
+ borderTop: "1px solid var(--border, rgba(52,58,64,0.12))",
1652
+ background: "var(--paper-elevated, rgba(255,255,255,0.82))"
1653
+ },
1654
+ children: [
1655
+ /* @__PURE__ */ s(
1656
+ "div",
1657
+ {
1658
+ style: {
1659
+ display: "flex",
1660
+ gap: "8px",
1661
+ alignItems: "flex-end"
1662
+ },
1663
+ children: [
1664
+ /* @__PURE__ */ e(
1665
+ "div",
1666
+ {
1667
+ style: {
1668
+ width: "32px",
1669
+ height: "32px",
1670
+ borderRadius: "var(--radius-md, 8px)",
1671
+ background: p.color,
1672
+ color: "white",
1673
+ display: "flex",
1674
+ alignItems: "center",
1675
+ justifyContent: "center",
1676
+ fontSize: "var(--text-sm, 11px)",
1677
+ fontWeight: 650,
1678
+ flexShrink: 0,
1679
+ opacity: 0.9
1680
+ },
1681
+ children: p.initials
1682
+ }
1683
+ ),
1684
+ /* @__PURE__ */ s(
1685
+ "div",
1686
+ {
1687
+ style: {
1688
+ flex: 1,
1689
+ display: "flex",
1690
+ flexDirection: "column",
1691
+ gap: "8px"
1692
+ },
1693
+ children: [
1694
+ /* @__PURE__ */ e(
1695
+ "textarea",
1696
+ {
1697
+ value: i,
1698
+ onChange: (a) => v(a.target.value),
1699
+ onKeyDown: z,
1700
+ onFocus: () => k(!0),
1701
+ onBlur: () => k(!1),
1702
+ placeholder: "Add a comment...",
1703
+ style: {
1704
+ width: "100%",
1705
+ minHeight: "38px",
1706
+ maxHeight: "120px",
1707
+ padding: "8px 12px",
1708
+ fontSize: "var(--text-md, 13px)",
1709
+ color: "var(--text-base, rgba(30,33,37,0.78))",
1710
+ background: "white",
1711
+ border: `1px solid ${L ? "rgba(94, 136, 176, 0.35)" : "rgba(52, 58, 64, 0.16)"}`,
1712
+ borderRadius: "var(--radius-md, 8px)",
1713
+ resize: "vertical",
1714
+ outline: "none",
1715
+ transition: "border-color 0.15s ease",
1716
+ fontFamily: "inherit",
1717
+ lineHeight: 1.5
1718
+ }
1719
+ }
1720
+ ),
1721
+ /* @__PURE__ */ s(
1722
+ "div",
1723
+ {
1724
+ style: {
1725
+ display: "flex",
1726
+ alignItems: "center",
1727
+ justifyContent: "space-between"
1728
+ },
1729
+ children: [
1730
+ /* @__PURE__ */ s("div", { style: { display: "flex", gap: "4px" }, children: [
1731
+ /* @__PURE__ */ e(
1732
+ "button",
1733
+ {
1734
+ type: "button",
1735
+ style: {
1736
+ padding: "6px",
1737
+ background: "transparent",
1738
+ border: "none",
1739
+ borderRadius: "6px",
1740
+ color: "rgba(30, 33, 37, 0.52)",
1741
+ cursor: "pointer",
1742
+ display: "flex",
1743
+ alignItems: "center",
1744
+ transition: "all 0.15s ease"
1745
+ },
1746
+ onMouseEnter: (a) => {
1747
+ a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1748
+ },
1749
+ onMouseLeave: (a) => {
1750
+ a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1751
+ },
1752
+ title: "Mention user",
1753
+ children: /* @__PURE__ */ e(Be, { size: 16 })
1754
+ }
1755
+ ),
1756
+ /* @__PURE__ */ e(
1757
+ "button",
1758
+ {
1759
+ type: "button",
1760
+ style: {
1761
+ padding: "6px",
1762
+ background: "transparent",
1763
+ border: "none",
1764
+ borderRadius: "6px",
1765
+ color: "rgba(30, 33, 37, 0.52)",
1766
+ cursor: "pointer",
1767
+ display: "flex",
1768
+ alignItems: "center",
1769
+ transition: "all 0.15s ease"
1770
+ },
1771
+ onMouseEnter: (a) => {
1772
+ a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1773
+ },
1774
+ onMouseLeave: (a) => {
1775
+ a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1776
+ },
1777
+ title: "Reference condition",
1778
+ children: /* @__PURE__ */ e(he, { size: 16 })
1779
+ }
1780
+ ),
1781
+ /* @__PURE__ */ e(
1782
+ "button",
1783
+ {
1784
+ type: "button",
1785
+ style: {
1786
+ padding: "6px",
1787
+ background: "transparent",
1788
+ border: "none",
1789
+ borderRadius: "6px",
1790
+ color: "rgba(30, 33, 37, 0.52)",
1791
+ cursor: "pointer",
1792
+ display: "flex",
1793
+ alignItems: "center",
1794
+ transition: "all 0.15s ease"
1795
+ },
1796
+ onMouseEnter: (a) => {
1797
+ a.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", a.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1798
+ },
1799
+ onMouseLeave: (a) => {
1800
+ a.currentTarget.style.background = "transparent", a.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1801
+ },
1802
+ title: "Attach file",
1803
+ children: /* @__PURE__ */ e(Re, { size: 16 })
1804
+ }
1805
+ )
1806
+ ] }),
1807
+ /* @__PURE__ */ e(
1808
+ "button",
1809
+ {
1810
+ type: "button",
1811
+ onClick: C,
1812
+ disabled: !i.trim() || t,
1813
+ style: {
1814
+ padding: "6px 12px",
1815
+ background: i.trim() && !t ? "rgba(94, 136, 176, 0.85)" : "var(--border-subtle, rgba(52,58,64,0.08))",
1816
+ border: "none",
1817
+ borderRadius: "6px",
1818
+ color: i.trim() && !t ? "white" : "var(--text-faint, rgba(30,33,37,0.36))",
1819
+ fontSize: "var(--text-sm, 11px)",
1820
+ fontWeight: 600,
1821
+ cursor: i.trim() && !t ? "pointer" : "not-allowed",
1822
+ display: "flex",
1823
+ alignItems: "center",
1824
+ gap: "6px",
1825
+ transition: "all 0.15s ease"
1826
+ },
1827
+ onMouseEnter: (a) => {
1828
+ i.trim() && !t && (a.currentTarget.style.background = "rgba(94, 136, 176, 1)");
1829
+ },
1830
+ onMouseLeave: (a) => {
1831
+ i.trim() && !t && (a.currentTarget.style.background = "rgba(94, 136, 176, 0.85)");
1832
+ },
1833
+ children: t ? /* @__PURE__ */ s(J, { children: [
1834
+ /* @__PURE__ */ e("style", { children: `
1835
+ @keyframes messageSpin {
1836
+ from { transform: rotate(0deg); }
1837
+ to { transform: rotate(360deg); }
1838
+ }
1839
+ ` }),
1840
+ /* @__PURE__ */ e(
1841
+ "div",
1842
+ {
1843
+ style: {
1844
+ width: "14px",
1845
+ height: "14px",
1846
+ border: "2px solid rgba(255, 255, 255, 0.3)",
1847
+ borderTopColor: "white",
1848
+ borderRadius: "50%",
1849
+ animation: "messageSpin 0.6s linear infinite"
1850
+ }
1851
+ }
1852
+ ),
1853
+ "Sending..."
1854
+ ] }) : /* @__PURE__ */ s(J, { children: [
1855
+ /* @__PURE__ */ e(ye, { size: 14 }),
1856
+ "Send"
1857
+ ] })
1858
+ }
1859
+ )
1860
+ ]
1861
+ }
1862
+ )
1863
+ ]
1864
+ }
1865
+ )
1866
+ ]
1867
+ }
1868
+ ),
1869
+ /* @__PURE__ */ s(
1870
+ "div",
1871
+ {
1872
+ style: {
1873
+ marginTop: "8px",
1874
+ fontSize: "var(--text-sm, 11px)",
1875
+ color: "var(--text-faint, rgba(30,33,37,0.36))",
1876
+ lineHeight: 1.4
1877
+ },
1878
+ children: [
1879
+ /* @__PURE__ */ e("strong", { children: "Tip:" }),
1880
+ " Use",
1881
+ " ",
1882
+ /* @__PURE__ */ e(
1883
+ "code",
1884
+ {
1885
+ style: {
1886
+ background: "rgba(30, 33, 37, 0.06)",
1887
+ padding: "2px 4px",
1888
+ borderRadius: "3px",
1889
+ fontFamily: "var(--font-mono, monospace)",
1890
+ fontSize: "var(--text-xs, 10px)"
1891
+ },
1892
+ children: "@"
1893
+ }
1894
+ ),
1895
+ " ",
1896
+ "to mention teammates,",
1897
+ " ",
1898
+ /* @__PURE__ */ e(
1899
+ "code",
1900
+ {
1901
+ style: {
1902
+ background: "rgba(30, 33, 37, 0.06)",
1903
+ padding: "2px 4px",
1904
+ borderRadius: "3px",
1905
+ fontFamily: "var(--font-mono, monospace)",
1906
+ fontSize: "var(--text-xs, 10px)"
1907
+ },
1908
+ children: "#"
1909
+ }
1910
+ ),
1911
+ " ",
1912
+ "to reference conditions"
1913
+ ]
1914
+ }
1915
+ )
1916
+ ]
1917
+ }
1918
+ )
1919
+ ]
1920
+ }
1921
+ );
1922
+ }
1923
+ const A = [
1924
+ "#5E88B0",
1925
+ // rail-discovery / rail-blue
1926
+ "#9B7AA8",
1927
+ // rail-purple / rail-tone
1928
+ "#C98A5A",
1929
+ // rail-compliance / rail-orange
1930
+ "#7BA89D",
1931
+ // rail-signal-upsell (teal-green)
1932
+ "#D17B6B",
1933
+ // rail-coral / rail-signal-churn
1934
+ "#6B7C93",
1935
+ // rail-slate / rail-outcome
1936
+ "#9B8E6F",
1937
+ // rail-olive / rail-signal-satisfaction
1938
+ "#8A9BAF",
1939
+ // rail-quality
1940
+ "#B8976A",
1941
+ // rail-teal (warm gold)
1942
+ "#A8C76B"
1943
+ // green accent (complementary)
1944
+ ], pe = { fill: "var(--text-muted, #666)", fontSize: 12 }, O = { stroke: "var(--border, #e0e0e0)" }, se = "var(--border, #e0e0e0)", te = {
1945
+ contentStyle: {
1946
+ backgroundColor: "var(--paper-elevated, #fff)",
1947
+ border: "1px solid var(--border, #e0e0e0)",
1948
+ borderRadius: "var(--radius-sm, 4px)",
1949
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
1950
+ color: "var(--text-ink, #1e2125)"
1951
+ },
1952
+ labelStyle: { color: "var(--text-strong, #1e2125)" }
1953
+ }, le = { color: "var(--text-ink, #1e2125)", fontSize: "12px" }, Pe = (h, b) => {
1954
+ if (!h)
1955
+ return !1;
1956
+ const m = h.toLowerCase();
1957
+ return b.filter((i) => String(i).toLowerCase().includes(m)).length < b.length * 0.5;
1958
+ }, Ue = async (h, b) => {
1959
+ const m = h.querySelector("svg");
1960
+ if (!m)
1961
+ return;
1962
+ const y = m.cloneNode(!0), i = m.clientWidth || 600, v = m.clientHeight || 300;
1963
+ y.setAttribute("width", i), y.setAttribute("height", v), y.setAttribute("xmlns", "http://www.w3.org/2000/svg");
1964
+ const L = document.createElement("style");
1965
+ L.textContent = 'text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }', y.insertBefore(L, y.firstChild);
1966
+ const k = new XMLSerializer().serializeToString(y), f = new Blob([k], { type: "image/svg+xml;charset=utf-8" }), d = URL.createObjectURL(f), o = new Image();
1967
+ o.onload = () => {
1968
+ const n = document.createElement("canvas"), t = 2;
1969
+ n.width = i * t, n.height = v * t;
1970
+ const r = n.getContext("2d");
1971
+ r.fillStyle = "#ffffff", r.fillRect(0, 0, n.width, n.height), r.scale(t, t), r.drawImage(o, 0, 0, i, v), URL.revokeObjectURL(d);
1972
+ const c = document.createElement("a");
1973
+ c.download = `${(b || "chart").replace(/[^a-z0-9]+/gi, "_")}.png`, c.href = n.toDataURL("image/png"), c.click();
1974
+ }, o.src = d;
1975
+ }, He = (h, b) => {
1976
+ const m = ["", ...h.map((v) => v.name)].join(","), y = b.map((v) => {
1977
+ const L = h.map((k) => {
1978
+ const f = k.data.find((d) => d.x === v);
1979
+ return f ? f.y : "";
1980
+ });
1981
+ return [v, ...L].join(",");
1982
+ }), i = [m, ...y].join(`
1983
+ `);
1984
+ navigator.clipboard.writeText(i);
1985
+ }, Oe = ({ onDownload: h, onCopy: b, copied: m }) => /* @__PURE__ */ s("div", { style: {
1986
+ display: "flex",
1987
+ gap: 6,
1988
+ justifyContent: "flex-end",
1989
+ marginBottom: 8,
1990
+ opacity: 0.7,
1991
+ transition: "opacity 0.15s"
1992
+ }, children: [
1993
+ /* @__PURE__ */ e("button", { onClick: b, title: "Copy data as CSV", style: {
1994
+ background: "none",
1995
+ border: "1px solid var(--border, #e0e0e0)",
1996
+ borderRadius: "var(--radius-sm, 4px)",
1997
+ padding: "3px 8px",
1998
+ fontSize: 11,
1999
+ color: "var(--text-muted, #666)",
2000
+ cursor: "pointer",
2001
+ display: "flex",
2002
+ alignItems: "center",
2003
+ gap: 4
2004
+ }, children: m ? "✓ Copied" : "📋 CSV" }),
2005
+ /* @__PURE__ */ e("button", { onClick: h, title: "Download as PNG", style: {
2006
+ background: "none",
2007
+ border: "1px solid var(--border, #e0e0e0)",
2008
+ borderRadius: "var(--radius-sm, 4px)",
2009
+ padding: "3px 8px",
2010
+ fontSize: 11,
2011
+ color: "var(--text-muted, #666)",
2012
+ cursor: "pointer",
2013
+ display: "flex",
2014
+ alignItems: "center",
2015
+ gap: 4
2016
+ }, children: "📥 PNG" })
2017
+ ] }), Je = ({ chartType: h, title: b, xLabel: m, yLabel: y, series: i }) => {
2018
+ const v = Y(null), [L, k] = de.useState(!1);
2019
+ if (!i || i.length === 0)
2020
+ return null;
2021
+ const f = [...new Set(i.flatMap((l) => l.data.map((x) => x.x)))], d = f.map((l) => {
2022
+ const x = { x: l };
2023
+ return i.forEach((I) => {
2024
+ const S = I.data.find((E) => E.x === l);
2025
+ x[I.name] = S ? S.y : null;
2026
+ }), x;
2027
+ }), o = i.map((l) => l.name), n = o.length === 1, t = Pe(m, f), r = t ? 20 : 5, g = Math.max(...f.map((l) => String(l).length)) > 12 || f.length > 8, p = {
2028
+ background: "var(--paper-elevated, #fff)",
2029
+ border: "1px solid var(--border, #e0e0e0)",
2030
+ borderRadius: "var(--radius-md, 8px)",
2031
+ padding: "16px",
2032
+ marginBottom: "16px"
2033
+ }, C = {
2034
+ color: "var(--text-strong, #1e2125)",
2035
+ fontSize: "14px",
2036
+ fontWeight: "600",
2037
+ marginBottom: "12px"
2038
+ }, z = {
2039
+ dataKey: "x",
2040
+ tick: g ? { fill: "var(--text-muted, #666)", fontSize: 11, angle: -35, textAnchor: "end" } : pe,
2041
+ axisLine: O,
2042
+ tickLine: O,
2043
+ ...t ? {
2044
+ label: { value: m, position: "insideBottom", offset: -10, style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } }
2045
+ } : {}
2046
+ }, B = {
2047
+ tick: pe,
2048
+ axisLine: O,
2049
+ tickLine: O,
2050
+ ...y ? {
2051
+ label: { value: y, angle: -90, position: "insideLeft", style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } }
2052
+ } : {}
2053
+ }, a = () => {
2054
+ switch (h) {
2055
+ case "bar":
2056
+ return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(fe, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
2057
+ /* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
2058
+ /* @__PURE__ */ e(oe, { ...z }),
2059
+ /* @__PURE__ */ e(ie, { ...B }),
2060
+ /* @__PURE__ */ e(ee, { ...te }),
2061
+ !n && /* @__PURE__ */ e(ae, { wrapperStyle: le }),
2062
+ o.map((l, x) => /* @__PURE__ */ e(me, { dataKey: l, fill: A[x % A.length], radius: [2, 2, 0, 0], children: n && d.map((I, S) => /* @__PURE__ */ e(ce, { fill: A[S % A.length] }, S)) }, l))
2063
+ ] }) });
2064
+ case "horizontal_bar":
2065
+ return /* @__PURE__ */ e(Z, { width: "100%", height: Math.max(300, d.length * 40), children: /* @__PURE__ */ s(fe, { data: d, layout: "vertical", margin: { top: 5, right: 30, left: 100, bottom: 5 }, children: [
2066
+ /* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
2067
+ /* @__PURE__ */ e(
2068
+ oe,
2069
+ {
2070
+ type: "number",
2071
+ tick: pe,
2072
+ axisLine: O,
2073
+ tickLine: O,
2074
+ ...y ? { label: { value: y, position: "insideBottom", offset: -5, style: { textAnchor: "middle", fill: "var(--text-muted, #666)" } } } : {}
2075
+ }
2076
+ ),
2077
+ /* @__PURE__ */ e(ie, { type: "category", dataKey: "x", tick: { fill: "var(--text-muted, #666)", fontSize: 11 }, width: 90, axisLine: O, tickLine: O }),
2078
+ /* @__PURE__ */ e(ee, { ...te }),
2079
+ !n && /* @__PURE__ */ e(ae, { wrapperStyle: le }),
2080
+ o.map((l, x) => /* @__PURE__ */ e(me, { dataKey: l, fill: A[x % A.length], radius: [0, 2, 2, 0], children: n && d.map((I, S) => /* @__PURE__ */ e(ce, { fill: A[S % A.length] }, S)) }, l))
2081
+ ] }) });
2082
+ case "line":
2083
+ return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(De, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
2084
+ /* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
2085
+ /* @__PURE__ */ e(oe, { ...z }),
2086
+ /* @__PURE__ */ e(ie, { ...B }),
2087
+ /* @__PURE__ */ e(ee, { ...te }),
2088
+ /* @__PURE__ */ e(ae, { wrapperStyle: le }),
2089
+ o.map((l, x) => /* @__PURE__ */ e(
2090
+ Ee,
2091
+ {
2092
+ type: "monotone",
2093
+ dataKey: l,
2094
+ stroke: A[x % A.length],
2095
+ strokeWidth: 2,
2096
+ dot: { r: 4, fill: A[x % A.length] },
2097
+ activeDot: { r: 6, fill: A[x % A.length] }
2098
+ },
2099
+ l
2100
+ ))
2101
+ ] }) });
2102
+ case "area":
2103
+ return /* @__PURE__ */ e(Z, { width: "100%", height: 300, children: /* @__PURE__ */ s(Ie, { data: d, margin: { top: 5, right: 30, left: 20, bottom: g ? 40 : r }, children: [
2104
+ /* @__PURE__ */ e(ne, { strokeDasharray: "3 3", stroke: se }),
2105
+ /* @__PURE__ */ e(oe, { ...z }),
2106
+ /* @__PURE__ */ e(ie, { ...B }),
2107
+ /* @__PURE__ */ e(ee, { ...te }),
2108
+ /* @__PURE__ */ e(ae, { wrapperStyle: le }),
2109
+ o.map((l, x) => /* @__PURE__ */ e(
2110
+ Me,
2111
+ {
2112
+ type: "monotone",
2113
+ dataKey: l,
2114
+ stroke: A[x % A.length],
2115
+ strokeWidth: 2,
2116
+ fill: A[x % A.length],
2117
+ fillOpacity: 0.15
2118
+ },
2119
+ l
2120
+ ))
2121
+ ] }) });
2122
+ case "pie": {
2123
+ const l = i[0].data.map((S, E) => ({
2124
+ name: S.x,
2125
+ value: S.y,
2126
+ fill: A[E % A.length]
2127
+ })), x = Math.PI / 180;
2128
+ return /* @__PURE__ */ e(Z, { width: "100%", height: 320, children: /* @__PURE__ */ s(Ae, { children: [
2129
+ /* @__PURE__ */ e(
2130
+ Le,
2131
+ {
2132
+ data: l,
2133
+ cx: "50%",
2134
+ cy: "50%",
2135
+ outerRadius: 100,
2136
+ dataKey: "value",
2137
+ label: ({ cx: S, cy: E, midAngle: _, innerRadius: H, outerRadius: X, percent: P, name: N }) => {
2138
+ const q = X + 20, U = S + q * Math.cos(-_ * x), K = E + q * Math.sin(-_ * x);
2139
+ return P < 0.04 ? null : /* @__PURE__ */ s(
2140
+ "text",
2141
+ {
2142
+ x: U,
2143
+ y: K,
2144
+ fill: "var(--text-ink, #1e2125)",
2145
+ fontSize: 11,
2146
+ textAnchor: U > S ? "start" : "end",
2147
+ dominantBaseline: "central",
2148
+ children: [
2149
+ N,
2150
+ " (",
2151
+ (P * 100).toFixed(0),
2152
+ "%)"
2153
+ ]
2154
+ }
2155
+ );
2156
+ },
2157
+ labelLine: { stroke: "var(--text-muted, #666)" },
2158
+ children: l.map((S, E) => /* @__PURE__ */ e(ce, { fill: S.fill }, E))
2159
+ }
2160
+ ),
2161
+ /* @__PURE__ */ e(ee, { ...te })
2162
+ ] }) });
2163
+ }
2164
+ case "metric": {
2165
+ const l = i[0], x = l.data[0], I = l.data.length > 1 ? l.data[1] : null, S = x.y, E = x.x || "", _ = I !== null, H = _ ? S - I.y : 0, X = _ && I.y !== 0 ? H / Math.abs(I.y) * 100 : 0, P = H > 0, N = H < 0, q = P ? "#7BA89D" : N ? "#D17B6B" : "var(--text-muted, #666)", U = P ? "↑" : N ? "↓" : "→", K = ($) => Number.isInteger($) && Math.abs($) >= 1e3 ? $.toLocaleString() : typeof $ == "number" ? $ % 1 === 0 ? $.toString() : $.toFixed($ < 10 ? 2 : 1) : String($);
2166
+ return /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "baseline", gap: 12, padding: "8px 0" }, children: [
2167
+ /* @__PURE__ */ e("div", { style: {
2168
+ fontSize: "36px",
2169
+ fontWeight: 700,
2170
+ lineHeight: 1,
2171
+ color: "var(--text-strong, #1e2125)",
2172
+ fontVariantNumeric: "tabular-nums"
2173
+ }, children: K(S) }),
2174
+ E && /* @__PURE__ */ e("div", { style: { fontSize: "14px", color: "var(--text-muted, #666)", fontWeight: 500 }, children: E }),
2175
+ _ && /* @__PURE__ */ s("div", { style: {
2176
+ display: "flex",
2177
+ alignItems: "center",
2178
+ gap: 4,
2179
+ fontSize: "13px",
2180
+ fontWeight: 600,
2181
+ color: q,
2182
+ background: P ? "rgba(123,168,157,0.12)" : N ? "rgba(209,123,107,0.12)" : "rgba(128,128,128,0.08)",
2183
+ padding: "3px 8px",
2184
+ borderRadius: "var(--radius-sm, 4px)"
2185
+ }, children: [
2186
+ /* @__PURE__ */ e("span", { children: U }),
2187
+ /* @__PURE__ */ s("span", { children: [
2188
+ K(Math.abs(H)),
2189
+ " (",
2190
+ Math.abs(X).toFixed(1),
2191
+ "%)"
2192
+ ] })
2193
+ ] }),
2194
+ _ && /* @__PURE__ */ s("div", { style: { fontSize: "11px", color: "var(--text-faint, #999)" }, children: [
2195
+ "vs ",
2196
+ I.x || "previous"
2197
+ ] })
2198
+ ] });
2199
+ }
2200
+ default:
2201
+ return /* @__PURE__ */ s("div", { style: { color: "var(--text-muted)", fontSize: 12, padding: 8 }, children: [
2202
+ "Unsupported chart type: ",
2203
+ h
2204
+ ] });
2205
+ }
2206
+ }, w = xe(() => {
2207
+ v.current && Ue(v.current, b);
2208
+ }, [b]), D = xe(() => {
2209
+ He(i, f), k(!0), setTimeout(() => k(!1), 2e3);
2210
+ }, [i, f]);
2211
+ return /* @__PURE__ */ s("div", { style: p, children: [
2212
+ b && /* @__PURE__ */ e("div", { style: C, children: b }),
2213
+ h !== "metric" && /* @__PURE__ */ e(Oe, { onDownload: w, onCopy: D, copied: L }),
2214
+ /* @__PURE__ */ e("div", { ref: v, children: a() })
2215
+ ] });
2216
+ };
2
2217
  export {
3
- s as ChartRenderer,
4
- r as ChatHistoryPanel,
5
- t as ChatInterface,
6
- h as ChatMessage,
7
- n as MessageThread,
8
- C as ThinkingIndicator
2218
+ Je as ChartRenderer,
2219
+ Ve as ChatHistoryPanel,
2220
+ qe as ChatInterface,
2221
+ be as ChatMessage,
2222
+ Ge as MessageThread,
2223
+ Fe as ThinkingIndicator
9
2224
  };
10
2225
  //# sourceMappingURL=chat.es.js.map