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