chordia-ui 3.7.0 → 3.7.2

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 (36) hide show
  1. package/dist/ChatMessage.cjs.js +15 -0
  2. package/dist/ChatMessage.cjs.js.map +1 -0
  3. package/dist/ChatMessage.es.js +915 -0
  4. package/dist/ChatMessage.es.js.map +1 -0
  5. package/dist/SideDrawer.cjs.js +2 -0
  6. package/dist/SideDrawer.cjs.js.map +1 -0
  7. package/dist/SideDrawer.es.js +358 -0
  8. package/dist/SideDrawer.es.js.map +1 -0
  9. package/dist/Toast.cjs.js +2 -2
  10. package/dist/Toast.cjs.js.map +1 -1
  11. package/dist/Toast.es.js +301 -671
  12. package/dist/Toast.es.js.map +1 -1
  13. package/dist/components/UpdatedInteractionDetails.cjs.js +4 -4
  14. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  15. package/dist/components/UpdatedInteractionDetails.es.js +652 -603
  16. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  17. package/dist/components/chat.cjs.js +5 -7
  18. package/dist/components/chat.cjs.js.map +1 -1
  19. package/dist/components/chat.es.js +393 -849
  20. package/dist/components/chat.es.js.map +1 -1
  21. package/dist/components/common.cjs.js +1 -1
  22. package/dist/components/common.es.js +28 -27
  23. package/dist/components/common.es.js.map +1 -1
  24. package/dist/index.cjs.js +1 -1
  25. package/dist/index.es.js +73 -72
  26. package/dist/index.es.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/UpdatedInteractionDetails/UpdatedInteractionContext.jsx +6 -2
  29. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +190 -139
  30. package/src/components/chat/ChartRenderer.jsx +300 -49
  31. package/src/components/common/AskCompass.jsx +91 -87
  32. package/src/components/common/SideDrawer.jsx +7 -3
  33. package/dist/ChartRenderer.cjs.js +0 -3
  34. package/dist/ChartRenderer.cjs.js.map +0 -1
  35. package/dist/ChartRenderer.es.js +0 -304
  36. package/dist/ChartRenderer.es.js.map +0 -1
@@ -1,484 +1,28 @@
1
- import { jsxs as a, jsx as e, Fragment as H } from "react/jsx-runtime";
2
- import N, { useState as C, useRef as $, useEffect as _ } from "react";
3
- import { Wrench as ie, Check as oe, Copy as ae, PanelRightOpen as se, Send as ee, Search as le, MessageSquare as de, Pin as ce, Clock as q, Hash as G, AtSign as pe, Paperclip as ge } from "lucide-react";
4
- import { C as Be } from "../ChartRenderer.es.js";
1
+ import { jsxs as n, jsx as e, Fragment as F } from "react/jsx-runtime";
2
+ import { useState as f, useRef as M, useEffect as A } from "react";
3
+ import { Send as Z, Search as ne, MessageSquare as ie, Pin as oe, Clock as Y, Hash as X, AtSign as ae, Paperclip as se } from "lucide-react";
4
+ import { C as G } from "../ChatMessage.es.js";
5
+ import { a as ke } from "../ChatMessage.es.js";
5
6
  import "recharts";
6
- const ue = ({ content: b, onCodeBlockClick: k, onFilePathClick: S }) => {
7
- const [B, s] = C(/* @__PURE__ */ new Set()), R = async (o, i) => {
8
- try {
9
- await navigator.clipboard.writeText(o), s((t) => /* @__PURE__ */ new Set([...t, i])), setTimeout(() => {
10
- s((t) => {
11
- const r = new Set(t);
12
- return r.delete(i), r;
13
- });
14
- }, 2e3);
15
- } catch (t) {
16
- console.error("Failed to copy text:", t);
17
- }
18
- }, E = (o, i, t) => {
19
- const r = B.has(t);
20
- return /* @__PURE__ */ a(
21
- "div",
22
- {
23
- style: {
24
- position: "relative",
25
- marginBottom: "16px",
26
- borderRadius: "8px",
27
- background: "var(--ink, #1E2125)",
28
- border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
29
- overflow: "hidden"
30
- },
31
- children: [
32
- /* @__PURE__ */ a("div", { style: {
33
- display: "flex",
34
- justifyContent: "space-between",
35
- alignItems: "center",
36
- padding: "8px 12px",
37
- background: "rgba(255,255,255,0.05)",
38
- borderBottom: "1px solid rgba(255,255,255,0.1)"
39
- }, children: [
40
- /* @__PURE__ */ e("span", { style: {
41
- fontSize: "11px",
42
- color: "rgba(255,255,255,0.7)",
43
- fontFamily: "var(--font-mono, monospace)",
44
- textTransform: "uppercase",
45
- letterSpacing: "0.05em"
46
- }, children: i || "code" }),
47
- /* @__PURE__ */ a(
48
- "button",
49
- {
50
- onClick: () => R(o, t),
51
- style: {
52
- background: "none",
53
- border: "none",
54
- color: "rgba(255,255,255,0.7)",
55
- cursor: "pointer",
56
- padding: "4px",
57
- borderRadius: "4px",
58
- display: "flex",
59
- alignItems: "center",
60
- gap: "4px",
61
- fontSize: "11px",
62
- transition: "all 0.15s ease"
63
- },
64
- onMouseEnter: (d) => {
65
- d.target.style.background = "rgba(255,255,255,0.1)", d.target.style.color = "rgba(255,255,255,0.9)";
66
- },
67
- onMouseLeave: (d) => {
68
- d.target.style.background = "none", d.target.style.color = "rgba(255,255,255,0.7)";
69
- },
70
- children: [
71
- r ? /* @__PURE__ */ e(oe, { size: 12 }) : /* @__PURE__ */ e(ae, { size: 12 }),
72
- r ? "Copied!" : "Copy"
73
- ]
74
- }
75
- ),
76
- k && /* @__PURE__ */ a(
77
- "button",
78
- {
79
- onClick: () => k({ code: o, language: i }),
80
- style: {
81
- background: "none",
82
- border: "none",
83
- color: "rgba(255,255,255,0.7)",
84
- cursor: "pointer",
85
- padding: "4px",
86
- borderRadius: "4px",
87
- display: "flex",
88
- alignItems: "center",
89
- gap: "4px",
90
- fontSize: "11px",
91
- transition: "all 0.15s ease"
92
- },
93
- onMouseEnter: (d) => {
94
- d.currentTarget.style.background = "rgba(255,255,255,0.1)", d.currentTarget.style.color = "rgba(255,255,255,0.9)";
95
- },
96
- onMouseLeave: (d) => {
97
- d.currentTarget.style.background = "none", d.currentTarget.style.color = "rgba(255,255,255,0.7)";
98
- },
99
- children: [
100
- /* @__PURE__ */ e(se, { size: 12 }),
101
- "Canvas"
102
- ]
103
- }
104
- )
105
- ] }),
106
- /* @__PURE__ */ e("pre", { style: {
107
- margin: 0,
108
- padding: "12px",
109
- fontFamily: "var(--font-mono, monospace)",
110
- fontSize: "13px",
111
- lineHeight: 1.4,
112
- color: "rgba(255,255,255,0.95)",
113
- overflow: "auto",
114
- whiteSpace: "pre-wrap",
115
- wordBreak: "break-word"
116
- }, children: o })
117
- ]
118
- },
119
- t
120
- );
121
- }, T = (o) => {
122
- const i = [], t = o.split(`
123
- `);
124
- let r = 0, d = 0;
125
- for (; r < t.length; ) {
126
- const p = t[r];
127
- if (p.trim().startsWith("```")) {
128
- const l = p.trim().slice(3);
129
- let f = [];
130
- for (r++; r < t.length && !t[r].trim().startsWith("```"); )
131
- f.push(t[r]), r++;
132
- r < t.length && r++, i.push(E(f.join(`
133
- `), l, `code-${d++}`));
134
- continue;
135
- }
136
- if (p.startsWith("#")) {
137
- const l = p.match(/^#+/)[0].length, f = p.slice(l).trim(), w = l === 1 ? "h2" : l === 2 ? "h3" : l === 3 ? "h4" : "h5";
138
- i.push(
139
- N.createElement(w, {
140
- key: `header-${r}`,
141
- style: {
142
- fontSize: l === 1 ? "18px" : l === 2 ? "16px" : "14px",
143
- fontWeight: 720,
144
- color: "var(--text-strong, rgba(30,33,37,0.92))",
145
- marginTop: i.length > 0 ? "20px" : "0",
146
- marginBottom: "8px",
147
- lineHeight: 1.3
148
- }
149
- }, f)
150
- ), r++;
151
- continue;
152
- }
153
- if (p.trim() === "---" || p.trim() === "***") {
154
- i.push(
155
- /* @__PURE__ */ e("hr", { style: {
156
- border: "none",
157
- borderTop: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
158
- margin: "16px 0"
159
- } }, `hr-${r}`)
160
- ), r++;
161
- continue;
162
- }
163
- if (p.match(/^(\s*)([-*+]|\d+\.)\s/)) {
164
- const l = [], f = /^\s*\d+\./.test(p);
165
- for (; r < t.length && (t[r].match(/^(\s*)([-*+]|\d+\.)\s/) || t[r].trim() === ""); ) {
166
- if (t[r].trim() !== "") {
167
- const m = t[r].match(/^(\s*)([-*+]|\d+\.)\s(.*)$/);
168
- m && l.push(m[3]);
169
- }
170
- r++;
171
- }
172
- const w = f ? "ol" : "ul";
173
- i.push(
174
- N.createElement(w, {
175
- key: `list-${r}`,
176
- style: {
177
- margin: "8px 0",
178
- paddingLeft: "20px",
179
- color: "var(--text-strong, rgba(30,33,37,0.92))"
180
- }
181
- }, l.map(
182
- (m, n) => N.createElement("li", {
183
- key: `item-${n}`,
184
- style: { marginBottom: "4px" }
185
- }, g(m))
186
- ))
187
- );
188
- continue;
189
- }
190
- if (p.trim().startsWith("|") && p.trim().endsWith("|")) {
191
- const l = [];
192
- for (; r < t.length && t[r].trim().startsWith("|") && t[r].trim().endsWith("|"); )
193
- l.push(t[r]), r++;
194
- if (l.length >= 2) {
195
- const f = (v) => v.trim().slice(1, -1).split("|").map((M) => M.trim()), w = f(l[0]), m = (v) => f(v).every((M) => /^[-:]+$/.test(M)), n = l.length >= 2 && m(l[1]), u = n ? 2 : 1, z = n ? f(l[1]).map((v) => v.startsWith(":") && v.endsWith(":") ? "center" : v.endsWith(":") ? "right" : "left") : w.map(() => "left"), x = {
196
- padding: "6px 12px",
197
- borderBottom: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
198
- fontSize: "13px",
199
- lineHeight: 1.5,
200
- color: "var(--text-strong, rgba(30,33,37,0.92))",
201
- // Override the chat bubble's inherited `word-break: break-word`
202
- // so cells size to natural min-content; the wrapper's
203
- // overflow-x: auto handles wide tables via horizontal scroll
204
- // instead of collapsing columns char-by-char on long URLs.
205
- wordBreak: "normal",
206
- overflowWrap: "normal"
207
- };
208
- i.push(
209
- /* @__PURE__ */ e("div", { style: { overflowX: "auto", margin: "8px 0" }, children: /* @__PURE__ */ a("table", { style: {
210
- borderCollapse: "collapse",
211
- width: "100%",
212
- border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
213
- borderRadius: "6px",
214
- overflow: "hidden"
215
- }, children: [
216
- n && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { style: { background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))" }, children: w.map((v, M) => /* @__PURE__ */ e("th", { style: { ...x, fontWeight: 660, textAlign: z[M] || "left", whiteSpace: "nowrap" }, children: g(v) }, M)) }) }),
217
- /* @__PURE__ */ e("tbody", { children: (n ? l.slice(u) : l).map((v, M) => /* @__PURE__ */ e("tr", { style: { background: M % 2 === 1 ? "var(--hover-warm-subtle, rgba(231,212,162,0.04))" : "transparent" }, children: f(v).map((L, A) => /* @__PURE__ */ e("td", { style: { ...x, textAlign: z[A] || "left" }, children: g(L) }, A)) }, M)) })
218
- ] }) }, `table-${r}`)
219
- );
220
- }
221
- continue;
222
- }
223
- if (p.trim()) {
224
- const l = [];
225
- for (; r < t.length && t[r].trim() && !t[r].match(/^(#|```|---|\*\*\*|(\s*)([-*+]|\d+\.)\s)/) && !(t[r].trim().startsWith("|") && t[r].trim().endsWith("|")); )
226
- l.push(t[r]), r++;
227
- l.length > 0 && i.push(
228
- /* @__PURE__ */ e("p", { style: {
229
- margin: "8px 0",
230
- lineHeight: 1.6,
231
- color: "var(--text-strong, rgba(30,33,37,0.92))"
232
- }, children: g(l.join(" ")) }, `p-${r}`)
233
- );
234
- } else
235
- r++;
236
- }
237
- return i;
238
- }, h = (o) => {
239
- const i = [];
240
- let t = o, r = 0;
241
- for (; t.length > 0; ) {
242
- if (S) {
243
- const m = 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|$))/);
244
- if (m) {
245
- const n = m[1];
246
- i.push(
247
- /* @__PURE__ */ e(
248
- "span",
249
- {
250
- onClick: () => S(n),
251
- style: {
252
- color: "var(--rail-discovery, #5E88B0)",
253
- textDecoration: "underline",
254
- textDecorationStyle: "dotted",
255
- textUnderlineOffset: "2px",
256
- cursor: "pointer",
257
- fontFamily: "var(--font-mono, monospace)",
258
- fontSize: "13px",
259
- transition: "all 0.15s ease",
260
- ":hover": {
261
- background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
262
- textDecoration: "underline",
263
- textDecorationStyle: "solid"
264
- }
265
- },
266
- onMouseEnter: (u) => {
267
- u.target.style.background = "var(--hover-warm-subtle, rgba(231,212,162,0.08))", u.target.style.textDecorationStyle = "solid";
268
- },
269
- onMouseLeave: (u) => {
270
- u.target.style.background = "none", u.target.style.textDecorationStyle = "dotted";
271
- },
272
- children: n
273
- },
274
- `file-path-${r++}`
275
- )
276
- ), t = t.slice(m[0].length);
277
- continue;
278
- }
279
- }
280
- const d = t.match(/^`([^`]+)`/);
281
- if (d) {
282
- i.push(
283
- /* @__PURE__ */ e("code", { style: {
284
- background: "var(--hover-warm-subtle, rgba(231,212,162,0.08))",
285
- border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
286
- borderRadius: "3px",
287
- padding: "2px 4px",
288
- fontFamily: "var(--font-mono, monospace)",
289
- fontSize: "12px",
290
- color: "var(--text-strong, rgba(30,33,37,0.92))"
291
- }, children: d[1] }, `inline-code-${r++}`)
292
- ), t = t.slice(d[0].length);
293
- continue;
294
- }
295
- const p = t.match(/^\*\*([^*]+)\*\*/);
296
- if (p) {
297
- i.push(
298
- /* @__PURE__ */ e("strong", { style: {
299
- fontWeight: 720,
300
- color: "var(--text-strong, rgba(30,33,37,0.92))"
301
- }, children: p[1] }, `bold-${r++}`)
302
- ), t = t.slice(p[0].length);
303
- continue;
304
- }
305
- const l = t.match(/^\*([^*]+)\*/);
306
- if (l) {
307
- i.push(
308
- /* @__PURE__ */ e("em", { style: {
309
- fontStyle: "italic",
310
- color: "var(--text-strong, rgba(30,33,37,0.92))"
311
- }, children: l[1] }, `italic-${r++}`)
312
- ), t = t.slice(l[0].length);
313
- continue;
314
- }
315
- const f = t.match(/^\[([^\]]+)\]\(([^)]+)\)/);
316
- if (f) {
317
- const m = f[1], n = f[2], u = m === "View", z = {
318
- display: "inline-flex",
319
- alignItems: "center",
320
- padding: "3px 10px",
321
- background: "var(--rail-discovery, #5E88B0)",
322
- color: "#fff",
323
- textDecoration: "none",
324
- borderRadius: "4px",
325
- fontSize: "12px",
326
- fontWeight: 600,
327
- whiteSpace: "nowrap",
328
- cursor: "pointer"
329
- }, x = {
330
- color: "var(--rail-discovery, #5E88B0)",
331
- textDecoration: "underline",
332
- textUnderlineOffset: "2px"
333
- };
334
- i.push(
335
- /* @__PURE__ */ e(
336
- "a",
337
- {
338
- href: n,
339
- target: "_blank",
340
- rel: "noopener noreferrer",
341
- style: u ? z : x,
342
- children: m
343
- },
344
- `link-${r++}`
345
- )
346
- ), t = t.slice(f[0].length);
347
- continue;
348
- }
349
- const w = t.search(/[`*\[]/);
350
- if (w === -1) {
351
- i.push(t);
352
- break;
353
- } else
354
- w === 0 ? (i.push(t[0]), t = t.slice(1)) : (i.push(t.slice(0, w)), t = t.slice(w));
355
- }
356
- return i.length === 1 && typeof i[0] == "string" ? i[0] : i;
357
- }, g = (o) => h(o);
358
- return /* @__PURE__ */ e("div", { children: T(b) });
359
- };
360
- function Z({
361
- role: b,
362
- content: k,
363
- html: S,
364
- timestamp: B,
365
- toolBadges: s,
366
- isStreaming: R,
367
- onCodeBlockClick: E,
368
- onFilePathClick: T
369
- }) {
370
- const h = b === "user";
371
- return /* @__PURE__ */ a(
372
- "div",
373
- {
374
- style: {
375
- display: "flex",
376
- flexDirection: "column",
377
- alignItems: h ? "flex-end" : "flex-start",
378
- marginBottom: "16px",
379
- maxWidth: "100%"
380
- },
381
- children: [
382
- /* @__PURE__ */ a(
383
- "div",
384
- {
385
- style: {
386
- fontSize: "var(--text-sm, 11px)",
387
- color: "var(--text-faint, rgba(30,33,37,0.36))",
388
- marginBottom: "6px",
389
- fontWeight: 650,
390
- letterSpacing: "0.02em"
391
- },
392
- children: [
393
- h ? "You" : "Chordia",
394
- R && !h && /* @__PURE__ */ e("span", { style: { marginLeft: "6px", color: "var(--rail-purple, #9B7AA8)" }, children: "●" })
395
- ]
396
- }
397
- ),
398
- s && s.length > 0 && /* @__PURE__ */ e("div", { style: {
399
- marginBottom: "8px",
400
- display: "flex",
401
- flexWrap: "wrap",
402
- gap: "4px",
403
- maxWidth: "75%"
404
- }, children: s.map((g, o) => /* @__PURE__ */ a(
405
- "span",
406
- {
407
- style: {
408
- display: "inline-block",
409
- fontSize: "11px",
410
- padding: "2px 8px",
411
- borderRadius: "6px",
412
- background: "var(--paper-elevated, rgba(255,255,255,0.82))",
413
- border: `1px solid ${g.pending ? "var(--rail-discovery, #5A8CC0)" : g.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"}`,
414
- color: g.pending ? "var(--rail-discovery, #5A8CC0)" : g.success !== !1 ? "var(--state-present, #5CB85C)" : "var(--rail-signal-churn, #C98A5A)"
415
- },
416
- children: [
417
- /* @__PURE__ */ e(ie, { size: 10, style: { marginRight: 3, verticalAlign: "middle" } }),
418
- g.name,
419
- g.pending ? "..." : g.success !== !1 ? " ✓" : " ✗"
420
- ]
421
- },
422
- g.id || o
423
- )) }),
424
- /* @__PURE__ */ e(
425
- "div",
426
- {
427
- style: {
428
- maxWidth: "75%",
429
- padding: "12px 16px",
430
- borderRadius: "var(--radius-lg, 12px)",
431
- background: h ? "var(--card-customer, rgba(94,136,176,0.08))" : "var(--paper-elevated, rgba(255,255,255,0.82))",
432
- border: h ? "1px solid var(--border-subtle, rgba(52,58,64,0.08))" : "1px solid var(--border, rgba(52,58,64,0.12))",
433
- fontSize: "var(--text-base, 14px)",
434
- lineHeight: 1.6,
435
- color: "var(--text-strong, rgba(30,33,37,0.92))",
436
- wordBreak: "break-word"
437
- },
438
- children: S ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: S } }) : h ? (
439
- // User messages stay plain text
440
- /* @__PURE__ */ e("div", { style: { whiteSpace: "pre-wrap" }, children: k })
441
- ) : (
442
- // Assistant messages get markdown rendering
443
- /* @__PURE__ */ e(ue, { content: k || "", onCodeBlockClick: E, onFilePathClick: T })
444
- )
445
- }
446
- ),
447
- B && /* @__PURE__ */ e(
448
- "div",
449
- {
450
- style: {
451
- fontSize: "var(--text-xs-plus, 10.5px)",
452
- color: "var(--text-faint, rgba(30,33,37,0.36))",
453
- marginTop: "4px",
454
- fontFamily: "var(--font-mono, monospace)"
455
- },
456
- children: B
457
- }
458
- )
459
- ]
460
- }
461
- );
462
- }
463
- function xe({
464
- phase: b = "thinking",
465
- toolSteps: k = [],
7
+ function le({
8
+ phase: x = "thinking",
9
+ toolSteps: w = [],
466
10
  label: S,
467
- elapsedMs: B,
468
- compact: s = !1
11
+ elapsedMs: C,
12
+ compact: i = !1
469
13
  }) {
470
- const R = (t) => {
471
- if (!t || t < 1e3)
14
+ const T = (s) => {
15
+ if (!s || s < 1e3)
472
16
  return null;
473
- const r = Math.floor(t / 1e3);
474
- if (r < 60)
475
- return `${r}s`;
476
- const d = Math.floor(r / 60), p = r % 60;
477
- return p > 0 ? `${d}m ${p}s` : `${d}m`;
478
- }, E = () => {
17
+ const l = Math.floor(s / 1e3);
18
+ if (l < 60)
19
+ return `${l}s`;
20
+ const d = Math.floor(l / 60), g = l % 60;
21
+ return g > 0 ? `${d}m ${g}s` : `${d}m`;
22
+ }, R = () => {
479
23
  if (S)
480
24
  return S;
481
- switch (b) {
25
+ switch (x) {
482
26
  case "thinking":
483
27
  return "Thinking...";
484
28
  case "tool":
@@ -488,22 +32,22 @@ function xe({
488
32
  default:
489
33
  return "Thinking...";
490
34
  }
491
- }, T = (t, r) => {
35
+ }, k = (s, l) => {
492
36
  const d = () => {
493
- const l = {
494
- width: s ? "4px" : "6px",
495
- height: s ? "4px" : "6px",
37
+ const y = {
38
+ width: i ? "4px" : "6px",
39
+ height: i ? "4px" : "6px",
496
40
  borderRadius: "50%",
497
41
  display: "inline-block",
498
- marginRight: s ? "6px" : "8px"
42
+ marginRight: i ? "6px" : "8px"
499
43
  };
500
- switch (t.status) {
44
+ switch (s.status) {
501
45
  case "active":
502
46
  return /* @__PURE__ */ e(
503
47
  "span",
504
48
  {
505
49
  style: {
506
- ...l,
50
+ ...y,
507
51
  backgroundColor: "var(--rail-purple, #9B7AA8)",
508
52
  animation: "pulse 1.2s ease-in-out infinite"
509
53
  }
@@ -514,7 +58,7 @@ function xe({
514
58
  "span",
515
59
  {
516
60
  style: {
517
- ...l,
61
+ ...y,
518
62
  backgroundColor: "var(--text-xfaint, rgba(30,33,37,0.28))"
519
63
  }
520
64
  }
@@ -524,7 +68,7 @@ function xe({
524
68
  "span",
525
69
  {
526
70
  style: {
527
- ...l,
71
+ ...y,
528
72
  backgroundColor: "var(--rail-compliance, #C98A5A)"
529
73
  }
530
74
  }
@@ -534,56 +78,56 @@ function xe({
534
78
  "span",
535
79
  {
536
80
  style: {
537
- ...l,
81
+ ...y,
538
82
  backgroundColor: "var(--text-xfaint, rgba(30,33,37,0.28))"
539
83
  }
540
84
  }
541
85
  );
542
86
  }
543
- }, p = () => {
544
- switch (t.status) {
87
+ }, g = () => {
88
+ switch (s.status) {
545
89
  case "done":
546
90
  return /* @__PURE__ */ e("span", { style: {
547
91
  color: "var(--text-faint, rgba(30,33,37,0.36))",
548
- fontSize: s ? "9px" : "var(--text-xs-plus, 10.5px)"
92
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
549
93
  }, children: "✓" });
550
94
  case "error":
551
95
  return /* @__PURE__ */ e("span", { style: {
552
96
  color: "var(--rail-compliance, #C98A5A)",
553
- fontSize: s ? "9px" : "var(--text-xs-plus, 10.5px)"
97
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)"
554
98
  }, children: "failed" });
555
99
  default:
556
100
  return null;
557
101
  }
558
102
  };
559
- return /* @__PURE__ */ a(
103
+ return /* @__PURE__ */ n(
560
104
  "div",
561
105
  {
562
106
  style: {
563
107
  display: "flex",
564
108
  alignItems: "center",
565
109
  justifyContent: "space-between",
566
- marginBottom: s ? "2px" : "4px"
110
+ marginBottom: i ? "2px" : "4px"
567
111
  },
568
112
  children: [
569
- /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center" }, children: [
113
+ /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center" }, children: [
570
114
  d(),
571
115
  /* @__PURE__ */ e("span", { style: {
572
116
  fontFamily: "var(--font-mono)",
573
- fontSize: s ? "9px" : "var(--text-xs-plus, 10.5px)",
117
+ fontSize: i ? "9px" : "var(--text-xs-plus, 10.5px)",
574
118
  color: "var(--text-muted)"
575
- }, children: t.name })
119
+ }, children: s.name })
576
120
  ] }),
577
- p()
121
+ g()
578
122
  ]
579
123
  },
580
- r
124
+ l
581
125
  );
582
- }, h = () => /* @__PURE__ */ e("div", { style: {
126
+ }, m = () => /* @__PURE__ */ e("div", { style: {
583
127
  width: "100%",
584
- height: s ? "2px" : "3px",
128
+ height: i ? "2px" : "3px",
585
129
  backgroundColor: "var(--border-subtle, rgba(52,58,64,0.08))",
586
- borderRadius: s ? "2px" : "3px",
130
+ borderRadius: i ? "2px" : "3px",
587
131
  overflow: "hidden",
588
132
  position: "relative"
589
133
  }, children: /* @__PURE__ */ e("div", { style: {
@@ -594,21 +138,21 @@ function xe({
594
138
  bottom: 0,
595
139
  background: "linear-gradient(90deg, transparent 0%, rgba(155,122,168,0.3) 50%, transparent 100%)",
596
140
  animation: "shimmer 2s linear infinite"
597
- } }) }), g = () => /* @__PURE__ */ e("span", { style: {
598
- width: s ? "4px" : "6px",
599
- height: s ? "10px" : "14px",
141
+ } }) }), c = () => /* @__PURE__ */ e("span", { style: {
142
+ width: i ? "4px" : "6px",
143
+ height: i ? "10px" : "14px",
600
144
  backgroundColor: "var(--rail-purple, #9B7AA8)",
601
145
  borderRadius: "1px",
602
146
  display: "inline-block",
603
147
  marginLeft: "2px",
604
148
  animation: "cursorBlink 0.8s ease-in-out infinite"
605
- } }), o = E(), i = R(B);
606
- return /* @__PURE__ */ a("div", { style: {
607
- borderLeft: `${s ? "3px" : "4px"} solid var(--rail-purple, #9B7AA8)`,
149
+ } }), r = R(), a = T(C);
150
+ return /* @__PURE__ */ n("div", { style: {
151
+ borderLeft: `${i ? "3px" : "4px"} solid var(--rail-purple, #9B7AA8)`,
608
152
  backgroundColor: "var(--card-assistant, rgba(155,122,168,0.06))",
609
153
  border: "1px solid var(--border-subtle, rgba(52,58,64,0.08))",
610
- borderRadius: s ? "8px" : "10px",
611
- padding: s ? "8px 10px 8px 12px" : "10px 14px 10px 18px"
154
+ borderRadius: i ? "8px" : "10px",
155
+ padding: i ? "8px 10px 8px 12px" : "10px 14px 10px 18px"
612
156
  }, children: [
613
157
  /* @__PURE__ */ e("style", { children: `
614
158
  @keyframes shimmer {
@@ -626,7 +170,7 @@ function xe({
626
170
  50% { opacity: 1; }
627
171
  }
628
172
  ` }),
629
- !s && /* @__PURE__ */ e("div", { style: {
173
+ !i && /* @__PURE__ */ e("div", { style: {
630
174
  fontSize: "var(--text-xs-plus, 10.5px)",
631
175
  fontWeight: 650,
632
176
  textTransform: "uppercase",
@@ -634,127 +178,127 @@ function xe({
634
178
  color: "var(--text-faint, rgba(30,33,37,0.36))",
635
179
  marginBottom: "8px"
636
180
  }, children: "AI ASSISTANT" }),
637
- b === "thinking" && /* @__PURE__ */ a("div", { children: [
638
- /* @__PURE__ */ a("div", { style: {
181
+ x === "thinking" && /* @__PURE__ */ n("div", { children: [
182
+ /* @__PURE__ */ n("div", { style: {
639
183
  color: "var(--text-muted)",
640
184
  fontWeight: 400,
641
- fontSize: s ? "11px" : "13px",
642
- marginBottom: s ? "4px" : "8px",
185
+ fontSize: i ? "11px" : "13px",
186
+ marginBottom: i ? "4px" : "8px",
643
187
  display: "flex",
644
188
  alignItems: "center",
645
189
  gap: "6px"
646
190
  }, children: [
647
- o,
648
- i && /* @__PURE__ */ e("span", { style: {
649
- fontSize: s ? "9px" : "10px",
191
+ r,
192
+ a && /* @__PURE__ */ e("span", { style: {
193
+ fontSize: i ? "9px" : "10px",
650
194
  color: "var(--text-faint, rgba(30,33,37,0.36))",
651
195
  fontFamily: "var(--font-mono, monospace)"
652
- }, children: i })
196
+ }, children: a })
653
197
  ] }),
654
- h()
198
+ m()
655
199
  ] }),
656
- b === "tool" && /* @__PURE__ */ a("div", { children: [
657
- o && /* @__PURE__ */ a("div", { style: {
200
+ x === "tool" && /* @__PURE__ */ n("div", { children: [
201
+ r && /* @__PURE__ */ n("div", { style: {
658
202
  color: "var(--text-muted)",
659
203
  fontWeight: 400,
660
- fontSize: s ? "11px" : "13px",
661
- marginBottom: s ? "4px" : "8px",
204
+ fontSize: i ? "11px" : "13px",
205
+ marginBottom: i ? "4px" : "8px",
662
206
  display: "flex",
663
207
  alignItems: "center",
664
208
  gap: "6px"
665
209
  }, children: [
666
- o,
667
- i && /* @__PURE__ */ e("span", { style: {
668
- fontSize: s ? "9px" : "10px",
210
+ r,
211
+ a && /* @__PURE__ */ e("span", { style: {
212
+ fontSize: i ? "9px" : "10px",
669
213
  color: "var(--text-faint, rgba(30,33,37,0.36))",
670
214
  fontFamily: "var(--font-mono, monospace)"
671
- }, children: i })
215
+ }, children: a })
672
216
  ] }),
673
- /* @__PURE__ */ e("div", { style: { marginBottom: s ? "4px" : "8px" }, children: k.map((t, r) => T(t, r)) }),
674
- h()
217
+ /* @__PURE__ */ e("div", { style: { marginBottom: i ? "4px" : "8px" }, children: w.map((s, l) => k(s, l)) }),
218
+ m()
675
219
  ] }),
676
- b === "responding" && /* @__PURE__ */ a("div", { style: {
220
+ x === "responding" && /* @__PURE__ */ n("div", { style: {
677
221
  color: "var(--text-muted)",
678
222
  fontWeight: 400,
679
- fontSize: s ? "11px" : "13px",
223
+ fontSize: i ? "11px" : "13px",
680
224
  display: "flex",
681
225
  alignItems: "center",
682
226
  gap: "6px"
683
227
  }, children: [
684
- /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center" }, children: [
685
- o,
686
- g()
228
+ /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center" }, children: [
229
+ r,
230
+ c()
687
231
  ] }),
688
- i && /* @__PURE__ */ e("span", { style: {
689
- fontSize: s ? "9px" : "10px",
232
+ a && /* @__PURE__ */ e("span", { style: {
233
+ fontSize: i ? "9px" : "10px",
690
234
  color: "var(--text-faint, rgba(30,33,37,0.36))",
691
235
  fontFamily: "var(--font-mono, monospace)"
692
- }, children: i })
236
+ }, children: a })
693
237
  ] })
694
238
  ] });
695
239
  }
696
- const he = { error: (...b) => console.warn("toast.error:", ...b) };
697
- function we({
698
- initialMessages: b = [],
699
- onSendMessage: k,
240
+ const de = { error: (...x) => console.warn("toast.error:", ...x) };
241
+ function he({
242
+ initialMessages: x = [],
243
+ onSendMessage: w,
700
244
  onStreamMessage: S,
701
245
  // NEW: streaming version of onSendMessage
702
- onMessagesChange: B,
246
+ onMessagesChange: C,
703
247
  // NEW: callback when messages array changes
704
- onCodeBlockClick: s,
248
+ onCodeBlockClick: i,
705
249
  // callback when "Canvas" button clicked on a code block: ({ code, language }) => void
706
- placeholder: R = "Ask a question about this interaction...",
707
- title: E = "Chat with Chordia"
250
+ placeholder: T = "Ask a question about this interaction...",
251
+ title: R = "Chat with Chordia"
708
252
  }) {
709
- const [T, h] = C(b || []), [g, o] = C(""), [i, t] = C(!1), [r, d] = C(!1), [p, l] = C(null), [f, w] = C("thinking"), [m, n] = C(null), [u, z] = C(0), x = $(null), v = $(null), M = $(null), L = $(null), A = $(null), [j, P] = C(!1), [K, V] = C(0);
710
- _(() => {
711
- var c;
712
- (c = x.current) == null || c.scrollIntoView({ behavior: "smooth" });
713
- }, [T, i]), _(() => {
714
- v.current && (v.current.style.height = "auto", v.current.style.height = `${Math.min(
715
- v.current.scrollHeight,
253
+ const [k, m] = f(x || []), [c, r] = f(""), [a, s] = f(!1), [l, d] = f(!1), [g, y] = f(null), [H, E] = f("thinking"), [D, t] = f(null), [h, z] = f(0), u = M(null), B = M(null), U = M(null), P = M(null), W = M(null), [_, $] = f(!1), [K, q] = f(0);
254
+ A(() => {
255
+ var o;
256
+ (o = u.current) == null || o.scrollIntoView({ behavior: "smooth" });
257
+ }, [k, a]), A(() => {
258
+ B.current && (B.current.style.height = "auto", B.current.style.height = `${Math.min(
259
+ B.current.scrollHeight,
716
260
  120
717
261
  )}px`);
718
- }, [g]), _(() => {
719
- if (B) {
720
- const c = [...T];
721
- p && c.push(p), B(c);
262
+ }, [c]), A(() => {
263
+ if (C) {
264
+ const o = [...k];
265
+ g && o.push(g), C(o);
722
266
  }
723
- }, [T, p, B]), _(() => {
724
- let c;
725
- return i && m && (c = setInterval(() => {
726
- if (z(Date.now() - m), A.current) {
727
- const I = (Date.now() - A.current) / 1e3;
728
- I >= 3 ? (P(!0), V(Math.floor(I))) : P(!1);
267
+ }, [k, g, C]), A(() => {
268
+ let o;
269
+ return a && D && (o = setInterval(() => {
270
+ if (z(Date.now() - D), W.current) {
271
+ const b = (Date.now() - W.current) / 1e3;
272
+ b >= 3 ? ($(!0), q(Math.floor(b))) : $(!1);
729
273
  }
730
- }, 500)), () => c && clearInterval(c);
731
- }, [i, m]);
732
- const X = () => {
733
- t(!1), d(!1), l(null), L.current = null, w("thinking"), P(!1), V(0), A.current = null, n(null), z(0), M.current && (M.current.abort(), M.current = null);
734
- }, te = (c) => {
735
- if (c.startsWith("data: ")) {
736
- const I = c.slice(6);
737
- if (I === "[DONE]")
274
+ }, 500)), () => o && clearInterval(o);
275
+ }, [a, D]);
276
+ const V = () => {
277
+ s(!1), d(!1), y(null), P.current = null, E("thinking"), $(!1), q(0), W.current = null, t(null), z(0), U.current && (U.current.abort(), U.current = null);
278
+ }, ee = (o) => {
279
+ if (o.startsWith("data: ")) {
280
+ const b = o.slice(6);
281
+ if (b === "[DONE]")
738
282
  return { type: "done" };
739
283
  try {
740
- return { type: "data", data: JSON.parse(I) };
284
+ return { type: "data", data: JSON.parse(b) };
741
285
  } catch {
742
286
  return null;
743
287
  }
744
288
  }
745
289
  return null;
746
- }, re = (c) => {
747
- var D, y;
748
- if (!((y = (D = c.choices) == null ? void 0 : D[0]) != null && y.delta))
290
+ }, te = (o) => {
291
+ var I, p;
292
+ if (!((p = (I = o.choices) == null ? void 0 : I[0]) != null && p.delta))
749
293
  return;
750
- A.current = Date.now(), P(!1);
751
- const I = c.choices[0].delta;
752
- if (I.tool_calls || I.tool_results) {
753
- w("tool");
294
+ W.current = Date.now(), $(!1);
295
+ const b = o.choices[0].delta;
296
+ if (b.tool_calls || b.tool_results) {
297
+ E("tool");
754
298
  return;
755
299
  }
756
- I.content !== void 0 && (w("responding"), l((W) => {
757
- const F = W || {
300
+ b.content !== void 0 && (E("responding"), y((v) => {
301
+ const L = v || {
758
302
  id: Date.now().toString(),
759
303
  role: "assistant",
760
304
  content: "",
@@ -763,59 +307,59 @@ function we({
763
307
  minute: "2-digit"
764
308
  }),
765
309
  isStreaming: !0
766
- }, U = {
767
- ...F,
768
- content: (F.content || "") + (I.content || "")
310
+ }, j = {
311
+ ...L,
312
+ content: (L.content || "") + (b.content || "")
769
313
  };
770
- return L.current = U, U;
314
+ return P.current = j, j;
771
315
  }));
772
- }, O = async (c) => {
773
- const I = c.getReader(), D = new TextDecoder();
774
- let y = "";
316
+ }, O = async (o) => {
317
+ const b = o.getReader(), I = new TextDecoder();
318
+ let p = "";
775
319
  try {
776
320
  for (; ; ) {
777
- const { done: W, value: F } = await I.read();
778
- if (W)
321
+ const { done: v, value: L } = await b.read();
322
+ if (v)
779
323
  break;
780
- y += D.decode(F, { stream: !0 });
781
- const U = y.split(`
324
+ p += I.decode(L, { stream: !0 });
325
+ const j = p.split(`
782
326
  `);
783
- y = U.pop() || "";
784
- for (const Q of U)
327
+ p = j.pop() || "";
328
+ for (const Q of j)
785
329
  if (Q.trim()) {
786
- const Y = te(Q);
787
- if (Y) {
788
- if (Y.type === "done")
330
+ const N = ee(Q);
331
+ if (N) {
332
+ if (N.type === "done")
789
333
  return;
790
- Y.type === "data" && re(Y.data);
334
+ N.type === "data" && te(N.data);
791
335
  }
792
336
  }
793
337
  }
794
338
  } finally {
795
- I.releaseLock();
339
+ b.releaseLock();
796
340
  }
797
341
  }, J = async () => {
798
- if (!g.trim() || r)
342
+ if (!c.trim() || l)
799
343
  return;
800
- const c = g.trim(), I = {
344
+ const o = c.trim(), b = {
801
345
  id: Date.now().toString(),
802
346
  role: "user",
803
- content: c,
347
+ content: o,
804
348
  timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
805
349
  hour: "2-digit",
806
350
  minute: "2-digit"
807
351
  })
808
- }, D = [...T, I];
809
- h(D), o(""), t(!0), d(!0), w("thinking"), n(Date.now()), A.current = Date.now(), M.current = new AbortController();
352
+ }, I = [...k, b];
353
+ m(I), r(""), s(!0), d(!0), E("thinking"), t(Date.now()), W.current = Date.now(), U.current = new AbortController();
810
354
  try {
811
- let y;
355
+ let p;
812
356
  if (S)
813
- y = await S(c, D);
814
- else if (k)
815
- y = await k(c, D);
357
+ p = await S(o, I);
358
+ else if (w)
359
+ p = await w(o, I);
816
360
  else {
817
361
  setTimeout(() => {
818
- const W = {
362
+ const v = {
819
363
  id: (Date.now() + 1).toString(),
820
364
  role: "assistant",
821
365
  content: "This is a demonstration response. In a real implementation, this would connect to your LLM backend.",
@@ -824,31 +368,31 @@ function we({
824
368
  minute: "2-digit"
825
369
  })
826
370
  };
827
- h((F) => [...F, W]), X();
371
+ m((L) => [...L, v]), V();
828
372
  }, 1e3);
829
373
  return;
830
374
  }
831
- if (y instanceof ReadableStream)
832
- await O(y);
833
- else if (y instanceof Response && y.body)
834
- await O(y.body);
835
- else if (y && typeof y.then == "function") {
836
- const W = await y;
837
- W instanceof ReadableStream ? await O(W) : W instanceof Response && W.body && await O(W.body);
375
+ if (p instanceof ReadableStream)
376
+ await O(p);
377
+ else if (p instanceof Response && p.body)
378
+ await O(p.body);
379
+ else if (p && typeof p.then == "function") {
380
+ const v = await p;
381
+ v instanceof ReadableStream ? await O(v) : v instanceof Response && v.body && await O(v.body);
838
382
  }
839
- L.current && h((W) => [...W, {
840
- ...L.current,
383
+ P.current && m((v) => [...v, {
384
+ ...P.current,
841
385
  isStreaming: !1
842
386
  }]);
843
- } catch (y) {
844
- y.name !== "AbortError" && (he.error("Failed to send message"), console.error("Stream error:", y));
387
+ } catch (p) {
388
+ p.name !== "AbortError" && (de.error("Failed to send message"), console.error("Stream error:", p));
845
389
  } finally {
846
- X();
390
+ V();
847
391
  }
848
- }, ne = (c) => {
849
- c.key === "Enter" && !c.shiftKey && (c.preventDefault(), J());
392
+ }, re = (o) => {
393
+ o.key === "Enter" && !o.shiftKey && (o.preventDefault(), J());
850
394
  };
851
- return /* @__PURE__ */ a(
395
+ return /* @__PURE__ */ n(
852
396
  "div",
853
397
  {
854
398
  style: {
@@ -861,7 +405,7 @@ function we({
861
405
  overflow: "hidden"
862
406
  },
863
407
  children: [
864
- E ? /* @__PURE__ */ a(
408
+ R ? /* @__PURE__ */ n(
865
409
  "div",
866
410
  {
867
411
  style: {
@@ -879,7 +423,7 @@ function we({
879
423
  letterSpacing: "-0.01em",
880
424
  color: "var(--text-strong, rgba(30,33,37,0.92))"
881
425
  },
882
- children: E
426
+ children: R
883
427
  }
884
428
  ),
885
429
  /* @__PURE__ */ e(
@@ -907,7 +451,7 @@ function we({
907
451
  display: "flex",
908
452
  flexDirection: "column"
909
453
  },
910
- children: T.length === 0 ? /* @__PURE__ */ e(
454
+ children: k.length === 0 ? /* @__PURE__ */ e(
911
455
  "div",
912
456
  {
913
457
  style: {
@@ -922,44 +466,44 @@ function we({
922
466
  },
923
467
  children: "No messages yet. Start a conversation by asking a question below."
924
468
  }
925
- ) : /* @__PURE__ */ a(H, { children: [
926
- T.map((c) => /* @__PURE__ */ e(
927
- Z,
469
+ ) : /* @__PURE__ */ n(F, { children: [
470
+ k.map((o) => /* @__PURE__ */ e(
471
+ G,
928
472
  {
929
- role: c.role,
930
- content: c.content,
931
- html: c.html,
932
- timestamp: c.timestamp,
933
- toolBadges: c.toolBadges,
934
- isStreaming: c.isStreaming,
935
- onCodeBlockClick: s
473
+ role: o.role,
474
+ content: o.content,
475
+ html: o.html,
476
+ timestamp: o.timestamp,
477
+ toolBadges: o.toolBadges,
478
+ isStreaming: o.isStreaming,
479
+ onCodeBlockClick: i
936
480
  },
937
- c.id
481
+ o.id
938
482
  )),
939
- p && /* @__PURE__ */ e(
940
- Z,
483
+ g && /* @__PURE__ */ e(
484
+ G,
941
485
  {
942
- role: p.role,
943
- content: p.content,
944
- timestamp: p.timestamp,
486
+ role: g.role,
487
+ content: g.content,
488
+ timestamp: g.timestamp,
945
489
  isStreaming: !0,
946
- onCodeBlockClick: s
490
+ onCodeBlockClick: i
947
491
  },
948
- p.id
492
+ g.id
949
493
  ),
950
- i && (!p || j) && /* @__PURE__ */ e("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ e(
951
- xe,
494
+ a && (!g || _) && /* @__PURE__ */ e("div", { style: { marginBottom: "16px" }, children: /* @__PURE__ */ e(
495
+ le,
952
496
  {
953
- phase: j ? "tool" : f,
954
- elapsedMs: u,
955
- label: j && K >= 30 ? "Compacting conversation — trimming context to stay sharp..." : j && K >= 10 ? "Running background tasks..." : j ? "Still working..." : void 0
497
+ phase: _ ? "tool" : H,
498
+ elapsedMs: h,
499
+ label: _ && K >= 30 ? "Compacting conversation — trimming context to stay sharp..." : _ && K >= 10 ? "Running background tasks..." : _ ? "Still working..." : void 0
956
500
  }
957
501
  ) }),
958
- /* @__PURE__ */ e("div", { ref: x })
502
+ /* @__PURE__ */ e("div", { ref: u })
959
503
  ] })
960
504
  }
961
505
  ),
962
- /* @__PURE__ */ a(
506
+ /* @__PURE__ */ n(
963
507
  "div",
964
508
  {
965
509
  style: {
@@ -968,7 +512,7 @@ function we({
968
512
  background: "var(--paper-elevated, rgba(255,255,255,0.82))"
969
513
  },
970
514
  children: [
971
- /* @__PURE__ */ a(
515
+ /* @__PURE__ */ n(
972
516
  "div",
973
517
  {
974
518
  style: {
@@ -980,13 +524,13 @@ function we({
980
524
  /* @__PURE__ */ e(
981
525
  "textarea",
982
526
  {
983
- ref: v,
984
- value: g,
985
- onChange: (c) => o(c.target.value),
986
- onKeyDown: ne,
987
- placeholder: R,
527
+ ref: B,
528
+ value: c,
529
+ onChange: (o) => r(o.target.value),
530
+ onKeyDown: re,
531
+ placeholder: T,
988
532
  rows: 1,
989
- disabled: r,
533
+ disabled: l,
990
534
  style: {
991
535
  flex: 1,
992
536
  padding: "10px 14px",
@@ -1002,14 +546,14 @@ function we({
1002
546
  fontFamily: "inherit",
1003
547
  minHeight: "42px",
1004
548
  maxHeight: "120px",
1005
- opacity: r ? 0.6 : 1,
1006
- cursor: r ? "not-allowed" : "text"
549
+ opacity: l ? 0.6 : 1,
550
+ cursor: l ? "not-allowed" : "text"
1007
551
  },
1008
- onFocus: (c) => {
1009
- r || (c.target.style.borderColor = "rgba(94, 136, 176, 0.35)");
552
+ onFocus: (o) => {
553
+ l || (o.target.style.borderColor = "rgba(94, 136, 176, 0.35)");
1010
554
  },
1011
- onBlur: (c) => {
1012
- c.target.style.borderColor = "rgba(52, 58, 64, 0.18)";
555
+ onBlur: (o) => {
556
+ o.target.style.borderColor = "rgba(52, 58, 64, 0.18)";
1013
557
  }
1014
558
  }
1015
559
  ),
@@ -1017,14 +561,14 @@ function we({
1017
561
  "button",
1018
562
  {
1019
563
  onClick: J,
1020
- disabled: !g.trim() || r,
564
+ disabled: !c.trim() || l,
1021
565
  style: {
1022
566
  padding: "10px 16px",
1023
- background: g.trim() && !r ? "var(--Base-Strong, #0B0B0B)" : "#ECEEF2",
1024
- color: g.trim() && !r ? "white" : "var(--text-base)",
567
+ background: c.trim() && !l ? "var(--Base-Strong, #0B0B0B)" : "#ECEEF2",
568
+ color: c.trim() && !l ? "white" : "var(--text-base)",
1025
569
  border: "none",
1026
570
  borderRadius: "var(--radius-md, 8px)",
1027
- cursor: g.trim() && !r ? "pointer" : "not-allowed",
571
+ cursor: c.trim() && !l ? "pointer" : "not-allowed",
1028
572
  display: "flex",
1029
573
  alignItems: "center",
1030
574
  gap: "6px",
@@ -1033,7 +577,7 @@ function we({
1033
577
  transition: "all 0.15s ease",
1034
578
  height: "42px"
1035
579
  },
1036
- children: r ? /* @__PURE__ */ a(H, { children: [
580
+ children: l ? /* @__PURE__ */ n(F, { children: [
1037
581
  /* @__PURE__ */ e("style", { children: `
1038
582
  @keyframes buttonSpin {
1039
583
  from { transform: rotate(0deg); }
@@ -1054,8 +598,8 @@ function we({
1054
598
  }
1055
599
  ),
1056
600
  "Sending..."
1057
- ] }) : /* @__PURE__ */ a(H, { children: [
1058
- /* @__PURE__ */ e(ee, { size: 16 }),
601
+ ] }) : /* @__PURE__ */ n(F, { children: [
602
+ /* @__PURE__ */ e(Z, { size: 16 }),
1059
603
  "Send"
1060
604
  ] })
1061
605
  }
@@ -1081,32 +625,32 @@ function we({
1081
625
  }
1082
626
  );
1083
627
  }
1084
- function ke({
1085
- threads: b = [],
1086
- activeThreadId: k,
628
+ function me({
629
+ threads: x = [],
630
+ activeThreadId: w,
1087
631
  onSelectThread: S,
1088
- onNewChat: B,
1089
- loading: s = !1
632
+ onNewChat: C,
633
+ loading: i = !1
1090
634
  }) {
1091
- const [R, E] = C(""), h = [...b.filter((o) => {
1092
- if (!R)
635
+ const [T, R] = f(""), m = [...x.filter((r) => {
636
+ if (!T)
1093
637
  return !0;
1094
- const i = R.toLowerCase();
1095
- return (o.title || "").toLowerCase().includes(i) || (o.last_message_preview || "").toLowerCase().includes(i);
1096
- })].sort((o, i) => {
1097
- if (o.pinned && !i.pinned)
638
+ const a = T.toLowerCase();
639
+ return (r.title || "").toLowerCase().includes(a) || (r.last_message_preview || "").toLowerCase().includes(a);
640
+ })].sort((r, a) => {
641
+ if (r.pinned && !a.pinned)
1098
642
  return -1;
1099
- if (!o.pinned && i.pinned)
643
+ if (!r.pinned && a.pinned)
1100
644
  return 1;
1101
- const t = new Date(o.updated_at || o.created_at || 0).getTime();
1102
- return new Date(i.updated_at || i.created_at || 0).getTime() - t;
1103
- }), g = (o) => {
1104
- if (!o)
645
+ const s = new Date(r.updated_at || r.created_at || 0).getTime();
646
+ return new Date(a.updated_at || a.created_at || 0).getTime() - s;
647
+ }), c = (r) => {
648
+ if (!r)
1105
649
  return "";
1106
- const i = new Date(o), r = (/* @__PURE__ */ new Date()).getTime() - i.getTime(), d = Math.floor(r / 864e5);
1107
- return d === 0 ? i.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : d === 1 ? "Yesterday" : d < 7 ? i.toLocaleDateString("en-US", { weekday: "short" }) : i.toLocaleDateString("en-US", { month: "short", day: "numeric" });
650
+ const a = new Date(r), l = (/* @__PURE__ */ new Date()).getTime() - a.getTime(), d = Math.floor(l / 864e5);
651
+ return d === 0 ? a.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : d === 1 ? "Yesterday" : d < 7 ? a.toLocaleDateString("en-US", { weekday: "short" }) : a.toLocaleDateString("en-US", { month: "short", day: "numeric" });
1108
652
  };
1109
- return /* @__PURE__ */ a(
653
+ return /* @__PURE__ */ n(
1110
654
  "div",
1111
655
  {
1112
656
  style: {
@@ -1118,7 +662,7 @@ function ke({
1118
662
  overflow: "hidden"
1119
663
  },
1120
664
  children: [
1121
- /* @__PURE__ */ a(
665
+ /* @__PURE__ */ n(
1122
666
  "div",
1123
667
  {
1124
668
  style: {
@@ -1127,7 +671,7 @@ function ke({
1127
671
  flexShrink: 0
1128
672
  },
1129
673
  children: [
1130
- /* @__PURE__ */ a(
674
+ /* @__PURE__ */ n(
1131
675
  "div",
1132
676
  {
1133
677
  style: {
@@ -1148,10 +692,10 @@ function ke({
1148
692
  children: "Threads"
1149
693
  }
1150
694
  ),
1151
- B && /* @__PURE__ */ e(
695
+ C && /* @__PURE__ */ e(
1152
696
  "button",
1153
697
  {
1154
- onClick: B,
698
+ onClick: C,
1155
699
  style: {
1156
700
  padding: "4px 10px",
1157
701
  fontSize: "11px",
@@ -1163,11 +707,11 @@ function ke({
1163
707
  cursor: "pointer",
1164
708
  transition: "all 0.15s ease"
1165
709
  },
1166
- onMouseEnter: (o) => {
1167
- o.currentTarget.style.background = "#ECEEF2";
710
+ onMouseEnter: (r) => {
711
+ r.currentTarget.style.background = "#ECEEF2";
1168
712
  },
1169
- onMouseLeave: (o) => {
1170
- o.currentTarget.style.background = "rgba(94, 136, 176, 0.08)";
713
+ onMouseLeave: (r) => {
714
+ r.currentTarget.style.background = "rgba(94, 136, 176, 0.08)";
1171
715
  },
1172
716
  children: "+ New"
1173
717
  }
@@ -1175,9 +719,9 @@ function ke({
1175
719
  ]
1176
720
  }
1177
721
  ),
1178
- /* @__PURE__ */ a("div", { style: { position: "relative" }, children: [
722
+ /* @__PURE__ */ n("div", { style: { position: "relative" }, children: [
1179
723
  /* @__PURE__ */ e(
1180
- le,
724
+ ne,
1181
725
  {
1182
726
  size: 13,
1183
727
  style: {
@@ -1194,8 +738,8 @@ function ke({
1194
738
  "input",
1195
739
  {
1196
740
  type: "text",
1197
- value: R,
1198
- onChange: (o) => E(o.target.value),
741
+ value: T,
742
+ onChange: (r) => R(r.target.value),
1199
743
  placeholder: "Search threads...",
1200
744
  style: {
1201
745
  width: "100%",
@@ -1209,11 +753,11 @@ function ke({
1209
753
  transition: "border-color 0.15s ease",
1210
754
  boxSizing: "border-box"
1211
755
  },
1212
- onFocus: (o) => {
1213
- o.target.style.borderColor = "rgba(94, 136, 176, 0.35)";
756
+ onFocus: (r) => {
757
+ r.target.style.borderColor = "rgba(94, 136, 176, 0.35)";
1214
758
  },
1215
- onBlur: (o) => {
1216
- o.target.style.borderColor = "rgba(52, 58, 64, 0.12)";
759
+ onBlur: (r) => {
760
+ r.target.style.borderColor = "rgba(52, 58, 64, 0.12)";
1217
761
  }
1218
762
  }
1219
763
  )
@@ -1221,7 +765,7 @@ function ke({
1221
765
  ]
1222
766
  }
1223
767
  ),
1224
- /* @__PURE__ */ e("div", { style: { flex: 1, overflowY: "auto", padding: "4px 6px" }, children: s ? /* @__PURE__ */ e(
768
+ /* @__PURE__ */ e("div", { style: { flex: 1, overflowY: "auto", padding: "4px 6px" }, children: i ? /* @__PURE__ */ e(
1225
769
  "div",
1226
770
  {
1227
771
  style: {
@@ -1232,7 +776,7 @@ function ke({
1232
776
  },
1233
777
  children: "Loading threads..."
1234
778
  }
1235
- ) : h.length === 0 ? /* @__PURE__ */ e(
779
+ ) : m.length === 0 ? /* @__PURE__ */ e(
1236
780
  "div",
1237
781
  {
1238
782
  style: {
@@ -1241,37 +785,37 @@ function ke({
1241
785
  color: "var(--text-faint, rgba(30,33,37,0.36))",
1242
786
  fontSize: "12px"
1243
787
  },
1244
- children: R ? "No threads found" : "No threads yet"
788
+ children: T ? "No threads found" : "No threads yet"
1245
789
  }
1246
- ) : h.map((o) => {
1247
- const i = o.id === k;
1248
- return /* @__PURE__ */ a(
790
+ ) : m.map((r) => {
791
+ const a = r.id === w;
792
+ return /* @__PURE__ */ n(
1249
793
  "div",
1250
794
  {
1251
- onClick: () => S == null ? void 0 : S(o.id),
795
+ onClick: () => S == null ? void 0 : S(r.id),
1252
796
  style: {
1253
797
  padding: "10px 10px",
1254
798
  marginBottom: "2px",
1255
799
  borderRadius: "6px",
1256
- background: i ? "rgba(94, 136, 176, 0.10)" : "transparent",
1257
- border: i ? "1px solid rgba(94, 136, 176, 0.15)" : "1px solid transparent",
800
+ background: a ? "rgba(94, 136, 176, 0.10)" : "transparent",
801
+ border: a ? "1px solid rgba(94, 136, 176, 0.15)" : "1px solid transparent",
1258
802
  cursor: "pointer",
1259
803
  transition: "all 0.12s ease"
1260
804
  },
1261
- onMouseEnter: (t) => {
1262
- i || (t.currentTarget.style.background = "rgba(0,0,0,0.03)");
805
+ onMouseEnter: (s) => {
806
+ a || (s.currentTarget.style.background = "rgba(0,0,0,0.03)");
1263
807
  },
1264
- onMouseLeave: (t) => {
1265
- i || (t.currentTarget.style.background = "transparent");
808
+ onMouseLeave: (s) => {
809
+ a || (s.currentTarget.style.background = "transparent");
1266
810
  },
1267
811
  children: [
1268
- /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginBottom: "4px" }, children: [
812
+ /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginBottom: "4px" }, children: [
1269
813
  /* @__PURE__ */ e(
1270
- de,
814
+ ie,
1271
815
  {
1272
816
  size: 12,
1273
817
  style: {
1274
- color: i ? "var(--rail-discovery, #5E88B0)" : "var(--text-faint, rgba(30,33,37,0.36))",
818
+ color: a ? "var(--rail-discovery, #5E88B0)" : "var(--text-faint, rgba(30,33,37,0.36))",
1275
819
  flexShrink: 0
1276
820
  }
1277
821
  }
@@ -1282,18 +826,18 @@ function ke({
1282
826
  style: {
1283
827
  flex: 1,
1284
828
  fontSize: "12px",
1285
- fontWeight: i ? 650 : 550,
1286
- color: i ? "var(--text-ink, rgba(30,33,37,0.92))" : "var(--text-base, rgba(30,33,37,0.78))",
829
+ fontWeight: a ? 650 : 550,
830
+ color: a ? "var(--text-ink, rgba(30,33,37,0.92))" : "var(--text-base, rgba(30,33,37,0.78))",
1287
831
  overflow: "hidden",
1288
832
  textOverflow: "ellipsis",
1289
833
  whiteSpace: "nowrap"
1290
834
  },
1291
- children: o.title || "Untitled thread"
835
+ children: r.title || "Untitled thread"
1292
836
  }
1293
837
  ),
1294
- o.pinned && /* @__PURE__ */ e(ce, { size: 10, style: { color: "var(--rail-discovery, #5E88B0)", flexShrink: 0 } })
838
+ r.pinned && /* @__PURE__ */ e(oe, { size: 10, style: { color: "var(--rail-discovery, #5E88B0)", flexShrink: 0 } })
1295
839
  ] }),
1296
- o.last_message_preview && /* @__PURE__ */ e(
840
+ r.last_message_preview && /* @__PURE__ */ e(
1297
841
  "div",
1298
842
  {
1299
843
  style: {
@@ -1305,10 +849,10 @@ function ke({
1305
849
  marginLeft: "18px",
1306
850
  marginBottom: "4px"
1307
851
  },
1308
- children: o.last_message_preview
852
+ children: r.last_message_preview
1309
853
  }
1310
854
  ),
1311
- /* @__PURE__ */ a(
855
+ /* @__PURE__ */ n(
1312
856
  "div",
1313
857
  {
1314
858
  style: {
@@ -1320,14 +864,14 @@ function ke({
1320
864
  color: "var(--text-faint, rgba(30,33,37,0.36))"
1321
865
  },
1322
866
  children: [
1323
- /* @__PURE__ */ e(q, { size: 9 }),
1324
- /* @__PURE__ */ e("span", { children: g(o.updated_at || o.created_at) }),
1325
- o.message_count != null && /* @__PURE__ */ a(H, { children: [
867
+ /* @__PURE__ */ e(Y, { size: 9 }),
868
+ /* @__PURE__ */ e("span", { children: c(r.updated_at || r.created_at) }),
869
+ r.message_count != null && /* @__PURE__ */ n(F, { children: [
1326
870
  /* @__PURE__ */ e("span", { children: "·" }),
1327
- /* @__PURE__ */ a("span", { children: [
1328
- o.message_count,
871
+ /* @__PURE__ */ n("span", { children: [
872
+ r.message_count,
1329
873
  " msg",
1330
- o.message_count !== 1 ? "s" : ""
874
+ r.message_count !== 1 ? "s" : ""
1331
875
  ] })
1332
876
  ] })
1333
877
  ]
@@ -1335,74 +879,74 @@ function ke({
1335
879
  )
1336
880
  ]
1337
881
  },
1338
- o.id
882
+ r.id
1339
883
  );
1340
884
  }) })
1341
885
  ]
1342
886
  }
1343
887
  );
1344
888
  }
1345
- const fe = { error: (...b) => console.warn("toast.error:", ...b) }, be = () => ({ userData: { name: "User", email: "" } });
1346
- function Ce({
1347
- sessionTitle: b,
1348
- messages: k,
889
+ const pe = { error: (...x) => console.warn("toast.error:", ...x) }, ce = () => ({ userData: { name: "User", email: "" } });
890
+ function ye({
891
+ sessionTitle: x,
892
+ messages: w,
1349
893
  onSendMessage: S,
1350
- currentUser: B
894
+ currentUser: C
1351
895
  }) {
1352
- var m;
1353
- const [s, R] = C(""), [E, T] = C(!1), [h, g] = C(k || []), [o, i] = C(!1), [t, r] = C(!1), { userData: d } = be(), p = $(null), l = B || {
896
+ var D;
897
+ const [i, T] = f(""), [R, k] = f(!1), [m, c] = f(w || []), [r, a] = f(!1), [s, l] = f(!1), { userData: d } = ce(), g = M(null), y = C || {
1354
898
  name: (d == null ? void 0 : d.name) || "You",
1355
- initials: ((m = d == null ? void 0 : d.name) == null ? void 0 : m.split(" ").map((n) => n[0]).join("").toUpperCase()) || "YO",
899
+ initials: ((D = d == null ? void 0 : d.name) == null ? void 0 : D.split(" ").map((t) => t[0]).join("").toUpperCase()) || "YO",
1356
900
  color: "#6B7C93"
1357
901
  };
1358
- _(() => {
1359
- g(k || []);
1360
- }, [k]), _(() => {
1361
- p.current && p.current.scrollIntoView({ behavior: "smooth" });
1362
- }, [h]);
1363
- const f = async () => {
1364
- if (!s.trim())
902
+ A(() => {
903
+ c(w || []);
904
+ }, [w]), A(() => {
905
+ g.current && g.current.scrollIntoView({ behavior: "smooth" });
906
+ }, [m]);
907
+ const H = async () => {
908
+ if (!i.trim())
1365
909
  return;
1366
- const n = s.trim();
1367
- R(""), r(!0);
1368
- const u = {
910
+ const t = i.trim();
911
+ T(""), l(!0);
912
+ const h = {
1369
913
  id: `temp-${Date.now()}`,
1370
914
  author: {
1371
- name: l.name,
915
+ name: y.name,
1372
916
  role: (d == null ? void 0 : d.role) || "",
1373
- initials: l.initials,
1374
- color: l.color
917
+ initials: y.initials,
918
+ color: y.color
1375
919
  },
1376
- content: n,
920
+ content: t,
1377
921
  timestamp: "Just now",
1378
922
  type: "comment",
1379
923
  isOptimistic: !0
1380
924
  };
1381
- if (g((z) => [...z, u]), S) {
925
+ if (c((z) => [...z, h]), S) {
1382
926
  try {
1383
- await S(n), g(
927
+ await S(t), c(
1384
928
  (z) => z.map(
1385
- (x) => x.id === u.id ? { ...x, isOptimistic: !1 } : x
929
+ (u) => u.id === h.id ? { ...u, isOptimistic: !1 } : u
1386
930
  )
1387
931
  );
1388
932
  } catch {
1389
- g((x) => x.filter((v) => v.id !== u.id)), fe.error("Failed to send message");
933
+ c((u) => u.filter((B) => B.id !== h.id)), pe.error("Failed to send message");
1390
934
  } finally {
1391
- r(!1);
935
+ l(!1);
1392
936
  }
1393
937
  return;
1394
938
  }
1395
939
  setTimeout(() => {
1396
- g(
940
+ c(
1397
941
  (z) => z.map(
1398
- (x) => x.id === u.id ? { ...x, isOptimistic: !1 } : x
942
+ (u) => u.id === h.id ? { ...u, isOptimistic: !1 } : u
1399
943
  )
1400
- ), r(!1);
944
+ ), l(!1);
1401
945
  }, 500);
1402
- }, w = (n) => {
1403
- n.key === "Enter" && !n.shiftKey && (n.preventDefault(), f());
946
+ }, E = (t) => {
947
+ t.key === "Enter" && !t.shiftKey && (t.preventDefault(), H());
1404
948
  };
1405
- return /* @__PURE__ */ a(
949
+ return /* @__PURE__ */ n(
1406
950
  "div",
1407
951
  {
1408
952
  style: {
@@ -1415,7 +959,7 @@ function Ce({
1415
959
  overflow: "hidden"
1416
960
  },
1417
961
  children: [
1418
- b && /* @__PURE__ */ a(
962
+ x && /* @__PURE__ */ n(
1419
963
  "div",
1420
964
  {
1421
965
  style: {
@@ -1436,7 +980,7 @@ function Ce({
1436
980
  children: "Session Discussion"
1437
981
  }
1438
982
  ),
1439
- b && /* @__PURE__ */ e(
983
+ x && /* @__PURE__ */ e(
1440
984
  "div",
1441
985
  {
1442
986
  style: {
@@ -1446,13 +990,13 @@ function Ce({
1446
990
  alignItems: "center",
1447
991
  gap: "8px"
1448
992
  },
1449
- children: /* @__PURE__ */ e("span", { children: b })
993
+ children: /* @__PURE__ */ e("span", { children: x })
1450
994
  }
1451
995
  )
1452
996
  ]
1453
997
  }
1454
998
  ),
1455
- /* @__PURE__ */ a(
999
+ /* @__PURE__ */ n(
1456
1000
  "div",
1457
1001
  {
1458
1002
  style: {
@@ -1464,7 +1008,7 @@ function Ce({
1464
1008
  gap: "16px"
1465
1009
  },
1466
1010
  children: [
1467
- o ? /* @__PURE__ */ e(
1011
+ r ? /* @__PURE__ */ e(
1468
1012
  "div",
1469
1013
  {
1470
1014
  style: {
@@ -1476,7 +1020,7 @@ function Ce({
1476
1020
  },
1477
1021
  children: "Loading messages..."
1478
1022
  }
1479
- ) : h.length === 0 ? /* @__PURE__ */ e(
1023
+ ) : m.length === 0 ? /* @__PURE__ */ e(
1480
1024
  "div",
1481
1025
  {
1482
1026
  style: {
@@ -1488,23 +1032,23 @@ function Ce({
1488
1032
  },
1489
1033
  children: "No messages yet. Start the conversation!"
1490
1034
  }
1491
- ) : h.map((n) => /* @__PURE__ */ a(
1035
+ ) : m.map((t) => /* @__PURE__ */ n(
1492
1036
  "div",
1493
1037
  {
1494
1038
  style: {
1495
1039
  display: "flex",
1496
1040
  gap: "12px",
1497
- opacity: n.type === "system" ? 0.75 : 1
1041
+ opacity: t.type === "system" ? 0.75 : 1
1498
1042
  },
1499
1043
  children: [
1500
- n.type !== "system" && /* @__PURE__ */ e(
1044
+ t.type !== "system" && /* @__PURE__ */ e(
1501
1045
  "div",
1502
1046
  {
1503
1047
  style: {
1504
1048
  width: "32px",
1505
1049
  height: "32px",
1506
1050
  borderRadius: "8px",
1507
- background: n.author.color,
1051
+ background: t.author.color,
1508
1052
  color: "white",
1509
1053
  display: "flex",
1510
1054
  alignItems: "center",
@@ -1514,10 +1058,10 @@ function Ce({
1514
1058
  flexShrink: 0,
1515
1059
  opacity: 0.9
1516
1060
  },
1517
- children: n.author.initials
1061
+ children: t.author.initials
1518
1062
  }
1519
1063
  ),
1520
- n.type === "system" && /* @__PURE__ */ e(
1064
+ t.type === "system" && /* @__PURE__ */ e(
1521
1065
  "div",
1522
1066
  {
1523
1067
  style: {
@@ -1533,11 +1077,11 @@ function Ce({
1533
1077
  fontWeight: 650,
1534
1078
  flexShrink: 0
1535
1079
  },
1536
- children: /* @__PURE__ */ e(q, { size: 14 })
1080
+ children: /* @__PURE__ */ e(Y, { size: 14 })
1537
1081
  }
1538
1082
  ),
1539
- /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
1540
- /* @__PURE__ */ a(
1083
+ /* @__PURE__ */ n("div", { style: { flex: 1, minWidth: 0 }, children: [
1084
+ /* @__PURE__ */ n(
1541
1085
  "div",
1542
1086
  {
1543
1087
  style: {
@@ -1555,7 +1099,7 @@ function Ce({
1555
1099
  fontWeight: 650,
1556
1100
  color: "var(--text-base, rgba(30,33,37,0.78))"
1557
1101
  },
1558
- children: n.author.name
1102
+ children: t.author.name
1559
1103
  }
1560
1104
  ),
1561
1105
  /* @__PURE__ */ e(
@@ -1566,10 +1110,10 @@ function Ce({
1566
1110
  color: "var(--text-faint, rgba(30,33,37,0.36))",
1567
1111
  fontFamily: "var(--font-mono, monospace)"
1568
1112
  },
1569
- children: n.timestamp
1113
+ children: t.timestamp
1570
1114
  }
1571
1115
  ),
1572
- n.author.role && /* @__PURE__ */ e(
1116
+ t.author.role && /* @__PURE__ */ e(
1573
1117
  "span",
1574
1118
  {
1575
1119
  style: {
@@ -1582,10 +1126,10 @@ function Ce({
1582
1126
  letterSpacing: "0.04em",
1583
1127
  fontWeight: 600
1584
1128
  },
1585
- children: n.author.role
1129
+ children: t.author.role
1586
1130
  }
1587
1131
  ),
1588
- n.isEdited && /* @__PURE__ */ e(
1132
+ t.isEdited && /* @__PURE__ */ e(
1589
1133
  "span",
1590
1134
  {
1591
1135
  style: {
@@ -1606,12 +1150,12 @@ function Ce({
1606
1150
  fontSize: "var(--text-md, 13px)",
1607
1151
  color: "var(--text-base, rgba(30,33,37,0.78))",
1608
1152
  lineHeight: 1.5,
1609
- marginBottom: n.references ? "8px" : 0
1153
+ marginBottom: t.references ? "8px" : 0
1610
1154
  },
1611
- children: n.content
1155
+ children: t.content
1612
1156
  }
1613
1157
  ),
1614
- n.references && n.references.length > 0 && /* @__PURE__ */ e(
1158
+ t.references && t.references.length > 0 && /* @__PURE__ */ e(
1615
1159
  "div",
1616
1160
  {
1617
1161
  style: {
@@ -1620,7 +1164,7 @@ function Ce({
1620
1164
  gap: "6px",
1621
1165
  marginTop: "8px"
1622
1166
  },
1623
- children: n.references.map((u, z) => /* @__PURE__ */ a(
1167
+ children: t.references.map((h, z) => /* @__PURE__ */ n(
1624
1168
  "button",
1625
1169
  {
1626
1170
  type: "button",
@@ -1630,7 +1174,7 @@ function Ce({
1630
1174
  borderRadius: "6px",
1631
1175
  border: "1px solid rgba(52, 58, 64, 0.16)",
1632
1176
  background: "rgba(255, 255, 255, 0.7)",
1633
- color: u.type === "condition" ? "rgba(94, 136, 176, 0.85)" : u.type === "observation" ? "rgba(107, 123, 147, 0.85)" : u.type === "timestamp" ? "rgba(184, 156, 106, 0.85)" : "rgba(30, 33, 37, 0.65)",
1177
+ color: h.type === "condition" ? "rgba(94, 136, 176, 0.85)" : h.type === "observation" ? "rgba(107, 123, 147, 0.85)" : h.type === "timestamp" ? "rgba(184, 156, 106, 0.85)" : "rgba(30, 33, 37, 0.65)",
1634
1178
  cursor: "pointer",
1635
1179
  display: "inline-flex",
1636
1180
  alignItems: "center",
@@ -1638,16 +1182,16 @@ function Ce({
1638
1182
  transition: "all 0.15s ease",
1639
1183
  fontWeight: 550
1640
1184
  },
1641
- onMouseEnter: (x) => {
1642
- x.currentTarget.style.background = "rgba(255, 255, 255, 0.95)", x.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.24)";
1185
+ onMouseEnter: (u) => {
1186
+ u.currentTarget.style.background = "rgba(255, 255, 255, 0.95)", u.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.24)";
1643
1187
  },
1644
- onMouseLeave: (x) => {
1645
- x.currentTarget.style.background = "rgba(255, 255, 255, 0.7)", x.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.16)";
1188
+ onMouseLeave: (u) => {
1189
+ u.currentTarget.style.background = "rgba(255, 255, 255, 0.7)", u.currentTarget.style.borderColor = "rgba(52, 58, 64, 0.16)";
1646
1190
  },
1647
1191
  children: [
1648
- u.type === "timestamp" && /* @__PURE__ */ e(q, { size: 12 }),
1649
- (u.type === "condition" || u.type === "observation") && /* @__PURE__ */ e(G, { size: 12 }),
1650
- u.label
1192
+ h.type === "timestamp" && /* @__PURE__ */ e(Y, { size: 12 }),
1193
+ (h.type === "condition" || h.type === "observation") && /* @__PURE__ */ e(X, { size: 12 }),
1194
+ h.label
1651
1195
  ]
1652
1196
  },
1653
1197
  z
@@ -1657,13 +1201,13 @@ function Ce({
1657
1201
  ] })
1658
1202
  ]
1659
1203
  },
1660
- n.id
1204
+ t.id
1661
1205
  )),
1662
- /* @__PURE__ */ e("div", { ref: p })
1206
+ /* @__PURE__ */ e("div", { ref: g })
1663
1207
  ]
1664
1208
  }
1665
1209
  ),
1666
- /* @__PURE__ */ a(
1210
+ /* @__PURE__ */ n(
1667
1211
  "div",
1668
1212
  {
1669
1213
  style: {
@@ -1672,7 +1216,7 @@ function Ce({
1672
1216
  background: "var(--paper-elevated, rgba(255,255,255,0.82))"
1673
1217
  },
1674
1218
  children: [
1675
- /* @__PURE__ */ a(
1219
+ /* @__PURE__ */ n(
1676
1220
  "div",
1677
1221
  {
1678
1222
  style: {
@@ -1688,7 +1232,7 @@ function Ce({
1688
1232
  width: "32px",
1689
1233
  height: "32px",
1690
1234
  borderRadius: "var(--radius-md, 8px)",
1691
- background: l.color,
1235
+ background: y.color,
1692
1236
  color: "white",
1693
1237
  display: "flex",
1694
1238
  alignItems: "center",
@@ -1698,10 +1242,10 @@ function Ce({
1698
1242
  flexShrink: 0,
1699
1243
  opacity: 0.9
1700
1244
  },
1701
- children: l.initials
1245
+ children: y.initials
1702
1246
  }
1703
1247
  ),
1704
- /* @__PURE__ */ a(
1248
+ /* @__PURE__ */ n(
1705
1249
  "div",
1706
1250
  {
1707
1251
  style: {
@@ -1714,11 +1258,11 @@ function Ce({
1714
1258
  /* @__PURE__ */ e(
1715
1259
  "textarea",
1716
1260
  {
1717
- value: s,
1718
- onChange: (n) => R(n.target.value),
1719
- onKeyDown: w,
1720
- onFocus: () => T(!0),
1721
- onBlur: () => T(!1),
1261
+ value: i,
1262
+ onChange: (t) => T(t.target.value),
1263
+ onKeyDown: E,
1264
+ onFocus: () => k(!0),
1265
+ onBlur: () => k(!1),
1722
1266
  placeholder: "Add a comment...",
1723
1267
  style: {
1724
1268
  width: "100%",
@@ -1728,7 +1272,7 @@ function Ce({
1728
1272
  fontSize: "var(--text-md, 13px)",
1729
1273
  color: "var(--text-base, rgba(30,33,37,0.78))",
1730
1274
  background: "white",
1731
- border: `1px solid ${E ? "rgba(94, 136, 176, 0.35)" : "rgba(52, 58, 64, 0.16)"}`,
1275
+ border: `1px solid ${R ? "rgba(94, 136, 176, 0.35)" : "rgba(52, 58, 64, 0.16)"}`,
1732
1276
  borderRadius: "var(--radius-md, 8px)",
1733
1277
  resize: "vertical",
1734
1278
  outline: "none",
@@ -1738,7 +1282,7 @@ function Ce({
1738
1282
  }
1739
1283
  }
1740
1284
  ),
1741
- /* @__PURE__ */ a(
1285
+ /* @__PURE__ */ n(
1742
1286
  "div",
1743
1287
  {
1744
1288
  style: {
@@ -1747,7 +1291,7 @@ function Ce({
1747
1291
  justifyContent: "space-between"
1748
1292
  },
1749
1293
  children: [
1750
- /* @__PURE__ */ a("div", { style: { display: "flex", gap: "4px" }, children: [
1294
+ /* @__PURE__ */ n("div", { style: { display: "flex", gap: "4px" }, children: [
1751
1295
  /* @__PURE__ */ e(
1752
1296
  "button",
1753
1297
  {
@@ -1763,14 +1307,14 @@ function Ce({
1763
1307
  alignItems: "center",
1764
1308
  transition: "all 0.15s ease"
1765
1309
  },
1766
- onMouseEnter: (n) => {
1767
- n.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", n.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1310
+ onMouseEnter: (t) => {
1311
+ t.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", t.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1768
1312
  },
1769
- onMouseLeave: (n) => {
1770
- n.currentTarget.style.background = "transparent", n.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1313
+ onMouseLeave: (t) => {
1314
+ t.currentTarget.style.background = "transparent", t.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1771
1315
  },
1772
1316
  title: "Mention user",
1773
- children: /* @__PURE__ */ e(pe, { size: 16 })
1317
+ children: /* @__PURE__ */ e(ae, { size: 16 })
1774
1318
  }
1775
1319
  ),
1776
1320
  /* @__PURE__ */ e(
@@ -1788,14 +1332,14 @@ function Ce({
1788
1332
  alignItems: "center",
1789
1333
  transition: "all 0.15s ease"
1790
1334
  },
1791
- onMouseEnter: (n) => {
1792
- n.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", n.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1335
+ onMouseEnter: (t) => {
1336
+ t.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", t.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1793
1337
  },
1794
- onMouseLeave: (n) => {
1795
- n.currentTarget.style.background = "transparent", n.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1338
+ onMouseLeave: (t) => {
1339
+ t.currentTarget.style.background = "transparent", t.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1796
1340
  },
1797
1341
  title: "Reference condition",
1798
- children: /* @__PURE__ */ e(G, { size: 16 })
1342
+ children: /* @__PURE__ */ e(X, { size: 16 })
1799
1343
  }
1800
1344
  ),
1801
1345
  /* @__PURE__ */ e(
@@ -1813,14 +1357,14 @@ function Ce({
1813
1357
  alignItems: "center",
1814
1358
  transition: "all 0.15s ease"
1815
1359
  },
1816
- onMouseEnter: (n) => {
1817
- n.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", n.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1360
+ onMouseEnter: (t) => {
1361
+ t.currentTarget.style.background = "rgba(30, 33, 37, 0.06)", t.currentTarget.style.color = "rgba(30, 33, 37, 0.75)";
1818
1362
  },
1819
- onMouseLeave: (n) => {
1820
- n.currentTarget.style.background = "transparent", n.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1363
+ onMouseLeave: (t) => {
1364
+ t.currentTarget.style.background = "transparent", t.currentTarget.style.color = "rgba(30, 33, 37, 0.52)";
1821
1365
  },
1822
1366
  title: "Attach file",
1823
- children: /* @__PURE__ */ e(ge, { size: 16 })
1367
+ children: /* @__PURE__ */ e(se, { size: 16 })
1824
1368
  }
1825
1369
  )
1826
1370
  ] }),
@@ -1828,29 +1372,29 @@ function Ce({
1828
1372
  "button",
1829
1373
  {
1830
1374
  type: "button",
1831
- onClick: f,
1832
- disabled: !s.trim() || t,
1375
+ onClick: H,
1376
+ disabled: !i.trim() || s,
1833
1377
  style: {
1834
1378
  padding: "6px 12px",
1835
- background: s.trim() && !t ? "rgba(94, 136, 176, 0.85)" : "var(--border-subtle, rgba(52,58,64,0.08))",
1379
+ background: i.trim() && !s ? "rgba(94, 136, 176, 0.85)" : "var(--border-subtle, rgba(52,58,64,0.08))",
1836
1380
  border: "none",
1837
1381
  borderRadius: "6px",
1838
- color: s.trim() && !t ? "white" : "var(--text-faint, rgba(30,33,37,0.36))",
1382
+ color: i.trim() && !s ? "white" : "var(--text-faint, rgba(30,33,37,0.36))",
1839
1383
  fontSize: "var(--text-sm, 11px)",
1840
1384
  fontWeight: 600,
1841
- cursor: s.trim() && !t ? "pointer" : "not-allowed",
1385
+ cursor: i.trim() && !s ? "pointer" : "not-allowed",
1842
1386
  display: "flex",
1843
1387
  alignItems: "center",
1844
1388
  gap: "6px",
1845
1389
  transition: "all 0.15s ease"
1846
1390
  },
1847
- onMouseEnter: (n) => {
1848
- s.trim() && !t && (n.currentTarget.style.background = "rgba(94, 136, 176, 1)");
1391
+ onMouseEnter: (t) => {
1392
+ i.trim() && !s && (t.currentTarget.style.background = "rgba(94, 136, 176, 1)");
1849
1393
  },
1850
- onMouseLeave: (n) => {
1851
- s.trim() && !t && (n.currentTarget.style.background = "rgba(94, 136, 176, 0.85)");
1394
+ onMouseLeave: (t) => {
1395
+ i.trim() && !s && (t.currentTarget.style.background = "rgba(94, 136, 176, 0.85)");
1852
1396
  },
1853
- children: t ? /* @__PURE__ */ a(H, { children: [
1397
+ children: s ? /* @__PURE__ */ n(F, { children: [
1854
1398
  /* @__PURE__ */ e("style", { children: `
1855
1399
  @keyframes messageSpin {
1856
1400
  from { transform: rotate(0deg); }
@@ -1871,8 +1415,8 @@ function Ce({
1871
1415
  }
1872
1416
  ),
1873
1417
  "Sending..."
1874
- ] }) : /* @__PURE__ */ a(H, { children: [
1875
- /* @__PURE__ */ e(ee, { size: 14 }),
1418
+ ] }) : /* @__PURE__ */ n(F, { children: [
1419
+ /* @__PURE__ */ e(Z, { size: 14 }),
1876
1420
  "Send"
1877
1421
  ] })
1878
1422
  }
@@ -1886,7 +1430,7 @@ function Ce({
1886
1430
  ]
1887
1431
  }
1888
1432
  ),
1889
- /* @__PURE__ */ a(
1433
+ /* @__PURE__ */ n(
1890
1434
  "div",
1891
1435
  {
1892
1436
  style: {
@@ -1941,11 +1485,11 @@ function Ce({
1941
1485
  );
1942
1486
  }
1943
1487
  export {
1944
- Be as ChartRenderer,
1945
- ke as ChatHistoryPanel,
1946
- we as ChatInterface,
1947
- Z as ChatMessage,
1948
- Ce as MessageThread,
1949
- xe as ThinkingIndicator
1488
+ ke as ChartRenderer,
1489
+ me as ChatHistoryPanel,
1490
+ he as ChatInterface,
1491
+ G as ChatMessage,
1492
+ ye as MessageThread,
1493
+ le as ThinkingIndicator
1950
1494
  };
1951
1495
  //# sourceMappingURL=chat.es.js.map