@icanbwell/baileyai-chat-ui 1.0.10 → 1.0.12

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.
@@ -2,26 +2,27 @@ import { n as e, t } from "./safeMarkdownUrl-Bqv6Q4u1.js";
2
2
  import { createContext as n, memo as r, useCallback as i, useContext as a, useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
3
3
  import d from "react-markdown";
4
4
  import f from "remark-gfm";
5
- import * as p from "@radix-ui/react-tooltip";
6
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import * as p from "@radix-ui/react-dropdown-menu";
6
+ import * as m from "@radix-ui/react-tooltip";
7
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
7
8
  //#region src/utils/pseudoToolCalls.ts
8
- var _ = "search_tools|call_tool|function_calls|function_result", v = RegExp(`<(${_})>([\\s\\S]*?)<\\/\\1>`, "g"), y = RegExp(`<(?:${_})>[\\s\\S]*$`), b = /<name>([\s\S]*?)<\/name>/, x = /<arguments>([\s\S]*?)<\/arguments>/, S = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, C = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
9
- function w(e) {
10
- let t = b.exec(e)?.[1]?.trim() || "unknown_tool", n = x.exec(e)?.[1]?.trim();
9
+ var v = "search_tools|call_tool|function_calls|function_result", y = RegExp(`<(${v})>([\\s\\S]*?)<\\/\\1>`, "g"), b = RegExp(`<(?:${v})>[\\s\\S]*$`), x = /<name>([\s\S]*?)<\/name>/, S = /<arguments>([\s\S]*?)<\/arguments>/, C = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, w = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
10
+ function T(e) {
11
+ let t = x.exec(e)?.[1]?.trim() || "unknown_tool", n = S.exec(e)?.[1]?.trim();
11
12
  return n ? {
12
13
  name: t,
13
14
  args: n
14
15
  } : { name: t };
15
16
  }
16
- function T(e) {
17
+ function E(e) {
17
18
  let t = [];
18
- S.lastIndex = 0;
19
+ C.lastIndex = 0;
19
20
  let n;
20
- for (; (n = S.exec(e)) !== null;) {
21
+ for (; (n = C.exec(e)) !== null;) {
21
22
  let [, e, r] = n, i = {};
22
- C.lastIndex = 0;
23
+ w.lastIndex = 0;
23
24
  let a;
24
- for (; (a = C.exec(r)) !== null;) i[a[1]] = a[2].trim();
25
+ for (; (a = w.exec(r)) !== null;) i[a[1]] = a[2].trim();
25
26
  let o = e.trim() || "unknown_tool";
26
27
  t.push(Object.keys(i).length > 0 ? {
27
28
  name: o,
@@ -30,14 +31,14 @@ function T(e) {
30
31
  }
31
32
  return t;
32
33
  }
33
- function E(e, t = {}) {
34
- let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(v, (e, t, n) => (t === "call_tool" ? r.push(w(n)) : t === "search_tools" ? r.push({
34
+ function D(e, t = {}) {
35
+ let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(y, (e, t, n) => (t === "call_tool" ? r.push(T(n)) : t === "search_tools" ? r.push({
35
36
  name: "search_tools",
36
37
  args: n.trim()
37
- }) : t === "function_calls" ? r.push(...T(n)) : r.push({
38
+ }) : t === "function_calls" ? r.push(...E(n)) : r.push({
38
39
  name: "function_result",
39
40
  args: n.trim()
40
- }), "")), a = n ? i.replace(y, "") : i;
41
+ }), "")), a = n ? i.replace(b, "") : i;
41
42
  return r.length === 0 && a === i ? {
42
43
  cleanedText: i,
43
44
  matches: r
@@ -48,7 +49,7 @@ function E(e, t = {}) {
48
49
  }
49
50
  //#endregion
50
51
  //#region src/logic/sse.ts
51
- function D(e) {
52
+ function O(e) {
52
53
  if (!e.startsWith("data: ")) return e;
53
54
  let t = "";
54
55
  for (let n of e.split("\n")) {
@@ -62,7 +63,7 @@ function D(e) {
62
63
  }
63
64
  return t || null;
64
65
  }
65
- function O(e) {
66
+ function k(e) {
66
67
  let t = e.replace(/\r\n/g, "\n").split("\n\n"), n = t.pop() ?? "", r = [], i = !1;
67
68
  for (let e of t) {
68
69
  let t = e.split("\n").filter((e) => e.length > 0), n = "message", a = [];
@@ -87,7 +88,7 @@ function O(e) {
87
88
  message: e
88
89
  });
89
90
  } else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
90
- let e = D(c.delta);
91
+ let e = O(c.delta);
91
92
  e && r.push({
92
93
  type: "response.output_text.delta",
93
94
  delta: e
@@ -105,16 +106,16 @@ function O(e) {
105
106
  }
106
107
  //#endregion
107
108
  //#region src/logic/useBaileyChat.ts
108
- var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, ee = (e, t, n) => {
109
+ var A = 200, j = 15e4, M = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, ee = (e, t, n) => {
109
110
  if (e === 401 || e === 403) return "Bailey isn't reachable with your current login.";
110
111
  let r = `Bailey request failed (status ${e ?? "network error"}).`, i = (n || t || "").trim();
111
- return i ? `${r} ${i.length > k ? `${i.slice(0, k)}…` : i}` : r;
112
- }, M = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: a, firstUserMessagePrefix: s, onAssistantMessageComplete: c, idleTimeoutMs: d = A }) => {
112
+ return i ? `${r} ${i.length > A ? `${i.slice(0, A)}…` : i}` : r;
113
+ }, N = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: a, firstUserMessagePrefix: s, onAssistantMessageComplete: c, idleTimeoutMs: d = j }) => {
113
114
  let [f, p] = u([]), [m, h] = u([]), [g, _] = u(null), [v, y] = u("idle"), [b, x] = u(null), S = l(null), C = l(""), w = l(0), T = l([]);
114
115
  o(() => {
115
116
  T.current = f;
116
117
  }, [f]);
117
- let D = l([]), k = l(/* @__PURE__ */ new Map()), M = l(/* @__PURE__ */ new Map()), N = l(null), P = i(() => {
118
+ let E = l([]), O = l(/* @__PURE__ */ new Map()), A = l(/* @__PURE__ */ new Map()), N = l(null), P = i(() => {
118
119
  N.current !== null && (clearTimeout(N.current), N.current = null);
119
120
  }, []), F = i((e) => {
120
121
  P(), N.current = setTimeout(() => {
@@ -130,13 +131,13 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
130
131
  };
131
132
  if (t.type === "response.output_text.delta") {
132
133
  if (!t.delta) return !1;
133
- let n = k.current.get(e) ?? {
134
+ let n = O.current.get(e) ?? {
134
135
  raw: "",
135
136
  emittedCount: 0
136
137
  };
137
138
  n.raw += t.delta;
138
- let { cleanedText: i, matches: a } = E(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
139
- if (n.emittedCount = a.length, k.current.set(e, n), M.current.set(e, o), p((t) => t.map((t) => t.id === e ? {
139
+ let { cleanedText: i, matches: a } = D(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
140
+ if (n.emittedCount = a.length, O.current.set(e, n), A.current.set(e, o), p((t) => t.map((t) => t.id === e ? {
140
141
  ...t,
141
142
  content: o
142
143
  } : t)), s.length > 0) {
@@ -176,7 +177,22 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
176
177
  turnSentAt: i,
177
178
  output: n.output,
178
179
  isError: n.is_error,
179
- runtimeSeconds: n.runtime_seconds
180
+ runtimeSeconds: n.runtime_seconds,
181
+ structuredOutput: n.structured_output
182
+ }), !0;
183
+ }
184
+ if (n.type === "llm_call") {
185
+ let e = Date.now(), i = w.current;
186
+ return r(t.type === "response.output_item.added" ? {
187
+ kind: "llm_call_start",
188
+ request: n.request ?? [],
189
+ at: e,
190
+ turnSentAt: i
191
+ } : {
192
+ kind: "llm_call_end",
193
+ response: n.output,
194
+ at: e,
195
+ turnSentAt: i
180
196
  }), !0;
181
197
  }
182
198
  return !1;
@@ -190,10 +206,10 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
190
206
  }), !0;
191
207
  if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
192
208
  if (t.type === "response.completed") {
193
- let t = k.current.get(e);
209
+ let t = O.current.get(e);
194
210
  if (t) {
195
- let { cleanedText: n } = E(t.raw, { hideOpenBlock: !1 }), r = n.trim();
196
- r !== M.current.get(e) && (M.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
211
+ let { cleanedText: n } = D(t.raw, { hideOpenBlock: !1 }), r = n.trim();
212
+ r !== A.current.get(e) && (A.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
197
213
  ...t,
198
214
  content: r
199
215
  } : t)));
@@ -216,14 +232,14 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
216
232
  y("streaming"), x(null);
217
233
  let o = Date.now();
218
234
  w.current = o;
219
- let l = j(), u = {
235
+ let l = M(), u = {
220
236
  id: l,
221
237
  role: "assistant",
222
238
  content: "",
223
239
  streaming: !0,
224
240
  createdAt: o
225
241
  };
226
- p((e) => [...e, u]), D.current = [...i, u];
242
+ p((e) => [...e, u]), E.current = [...i, u];
227
243
  let d = i.findIndex((e) => e.role === "user" && !e.hidden), f = i.map((e, t) => t === d && s ? {
228
244
  role: e.role,
229
245
  content: `${s}${e.content}`,
@@ -251,7 +267,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
251
267
  });
252
268
  let m = new AbortController();
253
269
  S.current = m, F(m);
254
- let g = "", v = null, b = !1, C = !1, T = [], E = (e, t) => {
270
+ let g = "", v = null, b = !1, C = !1, T = [], D = (e, t) => {
255
271
  y("error"), x(e);
256
272
  let n = {
257
273
  kind: "error",
@@ -261,7 +277,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
261
277
  ...t
262
278
  };
263
279
  T.push(n), h((e) => [...e, n]);
264
- }, A = (e, t) => {
280
+ }, j = (e, t) => {
265
281
  e.forEach((e) => {
266
282
  if (e.type === "error") {
267
283
  v = e.message;
@@ -290,8 +306,8 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
290
306
  signal: m.signal,
291
307
  onChunk: (e) => {
292
308
  F(m), g += e;
293
- let { events: t, remainder: n, done: r } = O(g);
294
- g = n, A(t, r);
309
+ let { events: t, remainder: n, done: r } = k(g);
310
+ g = n, j(t, r);
295
311
  let i = Date.now();
296
312
  _((e) => e && e.sentAt === o ? {
297
313
  ...e,
@@ -310,30 +326,30 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
310
326
  }
311
327
  });
312
328
  if (g.trim()) {
313
- let { events: e, done: t } = O(`${g}\n\n`);
314
- g = "", A(e, t);
329
+ let { events: e, done: t } = k(`${g}\n\n`);
330
+ g = "", j(e, t);
315
331
  }
316
332
  if (v) {
317
333
  y("error"), x(v);
318
334
  return;
319
335
  }
320
336
  if (i === void 0 || i >= 400) {
321
- E(ee(i, s, u), {
337
+ D(ee(i, s, u), {
322
338
  httpStatus: i,
323
339
  rawBody: s || void 0
324
340
  });
325
341
  return;
326
342
  }
327
343
  if (!b) {
328
- E("Bailey returned an empty response.");
344
+ D("Bailey returned an empty response.");
329
345
  return;
330
346
  }
331
347
  if (!C) {
332
- E("Bailey ran some tools but didn't return an answer. Try asking again.");
348
+ D("Bailey ran some tools but didn't return an answer. Try asking again.");
333
349
  return;
334
350
  }
335
351
  y("idle");
336
- let d = M.current.get(l) ?? "";
352
+ let d = A.current.get(l) ?? "";
337
353
  _((e) => e && e.sentAt === o ? {
338
354
  ...e,
339
355
  response: { content: d }
@@ -346,21 +362,21 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
346
362
  } catch (e) {
347
363
  let t = e;
348
364
  if (t?.name === "TimeoutError") {
349
- E(t.message, { source: "client-timeout" });
365
+ D(t.message, { source: "client-timeout" });
350
366
  return;
351
367
  }
352
368
  if (t?.name === "AbortError") {
353
369
  y("idle");
354
370
  return;
355
371
  }
356
- E(t?.message || "Bailey request failed.");
372
+ D(t?.message || "Bailey request failed.");
357
373
  } finally {
358
374
  P();
359
- let e = M.current.get(l) ?? "";
360
- k.current.delete(l), M.current.delete(l), p((e) => e.flatMap((e) => e.id === l ? e.content ? [{
375
+ let e = A.current.get(l) ?? "";
376
+ O.current.delete(l), A.current.delete(l), p((e) => e.flatMap((e) => e.id === l ? e.content ? [{
361
377
  ...e,
362
378
  streaming: !1
363
- }] : [] : [e])), D.current = D.current.flatMap((t) => t.id === l ? e ? [{
379
+ }] : [] : [e])), E.current = E.current.flatMap((t) => t.id === l ? e ? [{
364
380
  ...t,
365
381
  content: e,
366
382
  streaming: !1
@@ -391,12 +407,12 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
391
407
  if (!t) return;
392
408
  C.current = t;
393
409
  let n = {
394
- id: j(),
410
+ id: M(),
395
411
  role: "user",
396
412
  content: t,
397
413
  createdAt: Date.now()
398
- }, r = [...D.current, n];
399
- D.current = r, R([...T.current, n]), L(r);
414
+ }, r = [...E.current, n];
415
+ E.current = r, R([...T.current, n]), L(r);
400
416
  }, [L, R]),
401
417
  sendHidden: i((e, t) => {
402
418
  if (v === "streaming") return;
@@ -404,14 +420,14 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
404
420
  if (!n) return;
405
421
  C.current = n;
406
422
  let r = t?.trim(), i = {
407
- id: j(),
423
+ id: M(),
408
424
  role: "user",
409
425
  content: n,
410
426
  createdAt: Date.now(),
411
427
  hidden: !0,
412
428
  ...r ? { titleHint: r } : {}
413
- }, a = [...D.current, i];
414
- D.current = a, L(a);
429
+ }, a = [...E.current, i];
430
+ E.current = a, L(a);
415
431
  }, [L, v]),
416
432
  stop: i(() => {
417
433
  S.current?.abort();
@@ -420,8 +436,8 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
420
436
  if (v === "streaming" || !C.current) return;
421
437
  let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
422
438
  R(n);
423
- let r = D.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
424
- D.current = a, L(a);
439
+ let r = E.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
440
+ E.current = a, L(a);
425
441
  }, [
426
442
  L,
427
443
  R,
@@ -432,7 +448,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
432
448
  x(null), y((e) => e === "error" ? "idle" : e);
433
449
  }, []),
434
450
  newChat: i(() => {
435
- S.current?.abort(), R([]), D.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
451
+ S.current?.abort(), R([]), E.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
436
452
  }, [R]),
437
453
  loadMessages: i((e) => {
438
454
  S.current?.abort();
@@ -440,21 +456,21 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
440
456
  ...e,
441
457
  streaming: !1
442
458
  }));
443
- R(t.filter((e) => !e.hidden)), D.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
459
+ R(t.filter((e) => !e.hidden)), E.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
444
460
  }, [R])
445
461
  };
446
462
  };
447
463
  //#endregion
448
464
  //#region src/utils/prompt.ts
449
- function N(...e) {
465
+ function P(...e) {
450
466
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
451
467
  }
452
468
  //#endregion
453
469
  //#region src/utils/toolCalls.ts
454
- var P = "call_tool", F = "a tool";
455
- function I(e, t) {
470
+ var F = "call_tool", I = "a tool";
471
+ function L(e, t) {
456
472
  let n = {
457
- name: e === P ? F : e,
473
+ name: e === F ? I : e,
458
474
  args: null,
459
475
  viaCallTool: !1
460
476
  };
@@ -467,7 +483,7 @@ function I(e, t) {
467
483
  }
468
484
  if (typeof r != "object" || !r) return n;
469
485
  let i = r;
470
- if (e === P) {
486
+ if (e === F) {
471
487
  let e = typeof i.name == "string" ? i.name : void 0;
472
488
  if (!e) return n;
473
489
  let t = i.arguments;
@@ -485,24 +501,24 @@ function I(e, t) {
485
501
  }
486
502
  //#endregion
487
503
  //#region src/utils/table.ts
488
- var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(R).join(""), z = (e) => {
504
+ var R = 5, z = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(z).join(""), B = (e) => {
489
505
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
490
506
  for (let t of e.children ?? []) {
491
- let e = z(t);
507
+ let e = B(t);
492
508
  if (e) return e;
493
509
  }
494
- }, B = (e, t) => (e.children ?? []).find((e) => e.tagName === t), V = (e) => {
495
- let t = R(e), n = z(e);
510
+ }, V = (e, t) => (e.children ?? []).find((e) => e.tagName === t), te = (e) => {
511
+ let t = z(e), n = B(e);
496
512
  return n ? {
497
513
  text: t,
498
514
  href: n
499
515
  } : { text: t };
500
- }, H = (e) => (e.children ?? []).filter((e) => e.type === "element").map(V), U = (e) => {
516
+ }, H = (e) => (e.children ?? []).filter((e) => e.type === "element").map(te), U = (e) => {
501
517
  if (e.tagName !== "table") return null;
502
- let t = B(e, "thead"), n = t && B(t, "tr");
518
+ let t = V(e, "thead"), n = t && V(t, "tr");
503
519
  return {
504
520
  headers: n ? H(n).map((e) => e.text) : [],
505
- rows: (B(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(H)
521
+ rows: (V(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(H)
506
522
  };
507
523
  }, W = (e) => e.length > 5, G = "When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {\"type\": \"bar\" | \"line\" | \"pie\" | \"doughnut\" | \"scatter\", \"title\"?: string, \"data\": {\"labels\": string[], \"datasets\": [{\"label\": string, \"data\": number[]}]}}. For \"scatter\" charts, omit \"labels\" and give each dataset \"data\" as an array of {\"x\": number, \"y\": number} points instead of a number array. \"pie\" and \"doughnut\" charts must have exactly one dataset. Do not include any other fields (no \"options\", no colors) — the app handles styling. Example:\n```chartjs\n{\"type\": \"line\", \"title\": \"BP readings\", \"data\": {\"labels\": [\"Jul 14\", \"Jul 21\", \"Jul 28\"], \"datasets\": [{\"label\": \"Systolic\", \"data\": [120, 118, 122]}]}}\n```", K = [
508
524
  "bar",
@@ -510,7 +526,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
510
526
  "pie",
511
527
  "doughnut",
512
528
  "scatter"
513
- ], q = 8, J = 50, te = 8, ne = 500, re = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", ie = (e) => {
529
+ ], q = 8, ne = 50, re = 8, ie = 500, ae = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", oe = (e) => {
514
530
  let t;
515
531
  try {
516
532
  t = JSON.parse(e);
@@ -529,7 +545,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
529
545
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
530
546
  let o = a.datasets;
531
547
  if (r === "scatter") {
532
- for (let e of o) if (e.data.length < 1 || e.data.length > ne || !e.data.every(re)) return null;
548
+ for (let e of o) if (e.data.length < 1 || e.data.length > ie || !e.data.every(ae)) return null;
533
549
  return {
534
550
  type: r,
535
551
  title: i,
@@ -537,7 +553,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
537
553
  };
538
554
  }
539
555
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
540
- let s = a.labels, c = r === "pie" || r === "doughnut" ? te : J;
556
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? re : ne;
541
557
  if (s.length < 1 || s.length > c) return null;
542
558
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
543
559
  return {
@@ -548,60 +564,69 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
548
564
  datasets: o
549
565
  }
550
566
  };
551
- }, ae = {
567
+ }, se = {
552
568
  tool_start: "Tool start",
553
569
  tool_end: "Tool end",
554
570
  pseudo_tool_call: "Narrated tool call",
571
+ llm_call_start: "LLM call start",
572
+ llm_call_end: "LLM call end",
555
573
  progress: "Progress",
556
574
  info: "Info",
557
575
  error: "Error",
558
576
  raw: "Raw event"
559
577
  };
560
- function Y(e) {
561
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : I(e.name, e.args);
578
+ function J(e) {
579
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : L(e.name, e.args);
562
580
  }
563
- function X(e, t = Y(e)) {
581
+ function Y(e, t = J(e)) {
564
582
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
565
583
  }
566
- function oe(e, t = Y(e)) {
584
+ function ce(e, t = J(e)) {
567
585
  switch (e.kind) {
568
586
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
569
587
  case "tool_end": return `${t.viaCallTool ? `${t.name} (via call_tool)` : t.name}${e.runtimeSeconds === void 0 ? "" : ` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError ? " — failed" : ""}`;
570
588
  case "pseudo_tool_call": return `${e.name} — written as text, not actually called`;
589
+ case "llm_call_start": return `LLM call — ${e.request.length} message${e.request.length === 1 ? "" : "s"}`;
590
+ case "llm_call_end": return "LLM call returned";
571
591
  case "progress": return e.message ? `${e.status} — ${e.message}` : e.status;
572
592
  case "info": return e.message;
573
593
  case "error": return e.httpStatus ? `${e.message} (HTTP ${e.httpStatus})` : e.message;
574
594
  case "raw": return `Unrecognized event: ${e.eventType}`;
575
595
  }
576
596
  }
577
- function se(e, t = Y(e)) {
578
- return e.kind === "tool_start" || e.kind === "tool_end" ? t.args ? JSON.stringify(t.args, null, 2) : e.args ?? null : e.kind === "pseudo_tool_call" ? e.args ?? null : null;
597
+ function le(e, t = J(e)) {
598
+ return e.kind === "tool_start" || e.kind === "tool_end" ? t.args ? JSON.stringify(t.args, null, 2) : e.args ?? null : e.kind === "pseudo_tool_call" ? e.args ?? null : e.kind === "llm_call_start" ? JSON.stringify(e.request, null, 2) : null;
599
+ }
600
+ function ue(e) {
601
+ return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
579
602
  }
580
- function ce(e) {
581
- return e.kind === "tool_end" ? e.output ?? null : null;
603
+ function de(e) {
604
+ return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
582
605
  }
583
- function le(e) {
606
+ function fe(e) {
584
607
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
585
608
  }
586
- function Z(e) {
609
+ function X(e) {
587
610
  switch (e.kind) {
588
- case "tool_start": return `Calling ${I(e.name, e.args).name}...`;
611
+ case "tool_start": return `Calling ${L(e.name, e.args).name}...`;
589
612
  case "tool_end": {
590
- let t = I(e.name, e.args).name;
613
+ let t = L(e.name, e.args).name;
591
614
  return e.isError ? `${t} failed` : `${t} returned`;
592
615
  }
593
616
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
617
+ case "llm_call_start": return "Calling the model...";
618
+ case "llm_call_end": return "Model responded";
594
619
  case "progress": return e.message ?? e.status;
595
620
  case "info": return e.message;
596
621
  case "error": return e.source === "client-timeout" ? `Timed out: ${e.message}` : `Error: ${e.message}`;
597
622
  case "raw": return `Unrecognized event: ${e.eventType}`;
598
623
  }
599
624
  }
600
- function ue(e) {
625
+ function pe(e) {
601
626
  let t = new Date(e);
602
627
  return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}.${String(t.getMilliseconds()).padStart(3, "0")}`;
603
628
  }
604
- function de(e) {
629
+ function me(e) {
605
630
  if (e <= 0) return "+0ms";
606
631
  if (e < 1e3) return `+${Math.round(e)}ms`;
607
632
  let t = e / 1e3;
@@ -609,30 +634,31 @@ function de(e) {
609
634
  let n = Math.floor(t / 60), r = Math.round(t % 60);
610
635
  return `+${n}m${String(r).padStart(2, "0")}s`;
611
636
  }
612
- function fe(e) {
637
+ function he(e) {
613
638
  return e.map((t, n) => {
614
- let r = Y(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
639
+ let r = J(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
615
640
  return {
616
641
  key: `${t.at}-${n}`,
617
642
  kind: t.kind,
618
- toolName: X(t, r),
643
+ toolName: Y(t, r),
619
644
  isToolStart: t.kind === "tool_start",
620
645
  failed: t.kind === "tool_end" && t.isError === !0,
621
- time: ue(t.at),
646
+ time: pe(t.at),
622
647
  gapMs: t.at - i,
623
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ae[t.kind],
624
- summary: oe(t, r),
625
- argsDetail: se(t, r),
626
- outputDetail: ce(t),
627
- rawDetail: le(t)
648
+ label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : se[t.kind],
649
+ summary: ce(t, r),
650
+ argsDetail: le(t, r),
651
+ outputDetail: ue(t),
652
+ structuredOutputDetail: de(t),
653
+ rawDetail: fe(t)
628
654
  };
629
655
  });
630
656
  }
631
- function pe(e) {
632
- let t = e.filter((e) => e.kind === "tool_end"), n = t.filter((e) => e.kind === "tool_end" && e.isError), r = e.filter((e) => e.kind === "error"), i = [];
633
- return t.length > 0 && i.push(`${t.length} tool call${t.length === 1 ? "" : "s"}` + (n.length > 0 ? `, ${n.length} failed` : "")), r.length > 0 && i.push(`${r.length} stream error${r.length === 1 ? "" : "s"}`), i.join(" · ");
657
+ function ge(e) {
658
+ let t = e.filter((e) => e.kind === "tool_end"), n = t.filter((e) => e.kind === "tool_end" && e.isError), r = e.filter((e) => e.kind === "llm_call_end"), i = e.filter((e) => e.kind === "error"), a = [];
659
+ return r.length > 0 && a.push(`${r.length} LLM call${r.length === 1 ? "" : "s"}`), t.length > 0 && a.push(`${t.length} tool call${t.length === 1 ? "" : "s"}` + (n.length > 0 ? `, ${n.length} failed` : "")), i.length > 0 && a.push(`${i.length} stream error${i.length === 1 ? "" : "s"}`), a.join(" · ");
634
660
  }
635
- function me(e) {
661
+ function _e(e) {
636
662
  let t = [];
637
663
  for (let n of e) {
638
664
  let e = t[t.length - 1];
@@ -651,59 +677,59 @@ function me(e) {
651
677
  }
652
678
  return t;
653
679
  }
654
- function he(e) {
680
+ function ve(e) {
655
681
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
656
682
  }
657
- function ge(e, t) {
683
+ function ye(e, t) {
658
684
  return t === void 0 ? [] : e.filter((e) => e.turnSentAt === t && (e.kind === "tool_end" || e.kind === "pseudo_tool_call" || e.kind === "progress")).map((e, t) => ({
659
685
  key: `${e.at}-${t}`,
660
- text: Z(e),
661
- toolName: X(e)
686
+ text: X(e),
687
+ toolName: Y(e)
662
688
  }));
663
689
  }
664
690
  //#endregion
665
691
  //#region src/styles.css?inline
666
- var _e = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-toolbar-row{justify-content:flex-end;align-items:center;gap:calc(var(--spacing) * 3);display:flex}.bailey-new-chat-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-new-chat-button:hover{text-decoration-line:underline}}.bailey-new-chat-button:disabled{cursor:default;opacity:.5;text-decoration-line:none}.bailey-history-button{height:calc(var(--spacing) * 8);width:calc(var(--spacing) * 8);color:var(--color-gray-700);border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-button:hover{background-color:var(--color-gray-100)}}.bailey-history-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}", ve = n(void 0), ye = /:root\s*,\s*:host\s*\{/, be = ".bailey-chat-panel{";
667
- function xe(e) {
668
- let t = e.match(new RegExp(ye, "g"))?.length ?? 0;
692
+ var be = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-leading:initial;--tw-space-y-reverse:0}}}@layer theme{:root,:host{--font-sans:\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-2xl:1rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-thinking-hint{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic}.bailey-streaming-hint{margin-top:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:block}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-activity-line{margin-bottom:calc(var(--spacing) * 2);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}", xe = n(void 0), Se = /:root\s*,\s*:host\s*\{/, Ce = ".bailey-chat-panel{";
693
+ function we(e) {
694
+ let t = e.match(new RegExp(Se, "g"))?.length ?? 0;
669
695
  if (t !== 1) throw Error(`Expected exactly one ":root, :host {" rule in the compiled styles.css, found ${t}. Tailwind likely changed how @theme compiles — update this rewrite (and its sibling, scripts/scope-theme-vars.js) before shipping.`);
670
- return e.replace(ye, be);
696
+ return e.replace(Se, Ce);
671
697
  }
672
- var Se = xe(_e), Ce = "data-source", we = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
673
- function Te(e) {
698
+ var Te = we(be), Z = "data-source", Ee = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
699
+ function De(e) {
674
700
  let t = e.getRootNode();
675
701
  return t instanceof ShadowRoot ? t : document;
676
702
  }
677
- function Ee(e) {
703
+ function Oe(e) {
678
704
  let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
679
- if (n === 0 && !t.querySelector(`style[${Ce}="${we}"]`)) {
705
+ if (n === 0 && !t.querySelector(`style[${Z}="${Ee}"]`)) {
680
706
  let e = document.createElement("style");
681
- e.setAttribute(Ce, we), e.textContent = Se, t.appendChild(e);
707
+ e.setAttribute(Z, Ee), e.textContent = Te, t.appendChild(e);
682
708
  }
683
709
  return Q.set(e, n + 1), () => {
684
710
  let n = (Q.get(e) ?? 1) - 1;
685
- n <= 0 ? (Q.delete(e), t.querySelector(`style[${Ce}="${we}"]`)?.remove()) : Q.set(e, n);
711
+ n <= 0 ? (Q.delete(e), t.querySelector(`style[${Z}="${Ee}"]`)?.remove()) : Q.set(e, n);
686
712
  };
687
713
  }
688
- function De(e, t = !1) {
714
+ function ke(e, t = !1) {
689
715
  let [n, r] = u(null);
690
716
  return s(() => {
691
717
  if (t) return;
692
718
  let n = e.current;
693
719
  if (!n) return;
694
- let i = Te(n);
695
- return r(i), Ee(i);
720
+ let i = De(n);
721
+ return r(i), Oe(i);
696
722
  }, [t, e]), n;
697
723
  }
698
- function Oe(e) {
699
- let t = a(ve), n = t !== void 0, r = De(e, n);
724
+ function Ae(e) {
725
+ let t = a(xe), n = t !== void 0, r = ke(e, n);
700
726
  return n ? t : r;
701
727
  }
702
728
  //#endregion
703
729
  //#region src/ui/markdown.tsx
704
- function ke({ renderTable: t, renderChart: n } = {}) {
730
+ function je({ renderTable: t, renderChart: n } = {}) {
705
731
  return {
706
- a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ h(m, { children: n }) : /* @__PURE__ */ h("a", {
732
+ a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ g(h, { children: n }) : /* @__PURE__ */ g("a", {
707
733
  href: t,
708
734
  target: "_blank",
709
735
  rel: "noopener noreferrer",
@@ -713,41 +739,41 @@ function ke({ renderTable: t, renderChart: n } = {}) {
713
739
  let i = n && U(n);
714
740
  if (i && W(i.rows) && t) {
715
741
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
716
- return /* @__PURE__ */ h(m, { children: t({
742
+ return /* @__PURE__ */ g(h, { children: t({
717
743
  headers: i.headers,
718
744
  rows: n
719
745
  }) });
720
746
  }
721
- return /* @__PURE__ */ h("table", { children: r });
747
+ return /* @__PURE__ */ g("table", { children: r });
722
748
  },
723
749
  pre: ({ children: e }) => {
724
750
  let t = (Array.isArray(e) ? e[0] : e)?.props;
725
751
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
726
- let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
727
- if (r) return /* @__PURE__ */ h(m, { children: n(r) });
752
+ let e = t?.children, r = oe(Array.isArray(e) ? e.join("") : String(e ?? ""));
753
+ if (r) return /* @__PURE__ */ g(h, { children: n(r) });
728
754
  }
729
- return /* @__PURE__ */ h("pre", { children: e });
755
+ return /* @__PURE__ */ g("pre", { children: e });
730
756
  }
731
757
  };
732
758
  }
733
759
  //#endregion
734
760
  //#region src/ui/icons.tsx
735
- function Ae({ className: e }) {
736
- return /* @__PURE__ */ h("svg", {
761
+ function Me({ className: e }) {
762
+ return /* @__PURE__ */ g("svg", {
737
763
  viewBox: "0 0 24 24",
738
764
  fill: "currentColor",
739
765
  className: e,
740
766
  "aria-hidden": "true",
741
- children: /* @__PURE__ */ h("path", { d: "M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z" })
767
+ children: /* @__PURE__ */ g("path", { d: "M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z" })
742
768
  });
743
769
  }
744
- function je({ className: e }) {
745
- return /* @__PURE__ */ h("svg", {
770
+ function Ne({ className: e }) {
771
+ return /* @__PURE__ */ g("svg", {
746
772
  viewBox: "0 0 24 24",
747
773
  fill: "currentColor",
748
774
  className: e,
749
775
  "aria-hidden": "true",
750
- children: /* @__PURE__ */ h("rect", {
776
+ children: /* @__PURE__ */ g("rect", {
751
777
  x: "6",
752
778
  y: "6",
753
779
  width: "12",
@@ -756,8 +782,8 @@ function je({ className: e }) {
756
782
  })
757
783
  });
758
784
  }
759
- function Me({ className: e }) {
760
- return /* @__PURE__ */ g("svg", {
785
+ function Pe({ className: e }) {
786
+ return /* @__PURE__ */ _("svg", {
761
787
  viewBox: "0 0 24 24",
762
788
  fill: "none",
763
789
  stroke: "currentColor",
@@ -766,11 +792,11 @@ function Me({ className: e }) {
766
792
  strokeLinejoin: "round",
767
793
  className: e,
768
794
  "aria-hidden": "true",
769
- children: [/* @__PURE__ */ h("path", { d: "M7 17 17 7" }), /* @__PURE__ */ h("path", { d: "M9 7h8v8" })]
795
+ children: [/* @__PURE__ */ g("path", { d: "M7 17 17 7" }), /* @__PURE__ */ g("path", { d: "M9 7h8v8" })]
770
796
  });
771
797
  }
772
- function Ne({ className: e }) {
773
- return /* @__PURE__ */ g("svg", {
798
+ function Fe({ className: e }) {
799
+ return /* @__PURE__ */ _("svg", {
774
800
  viewBox: "0 0 24 24",
775
801
  fill: "none",
776
802
  stroke: "currentColor",
@@ -779,17 +805,17 @@ function Ne({ className: e }) {
779
805
  strokeLinejoin: "round",
780
806
  className: e,
781
807
  "aria-hidden": "true",
782
- children: [/* @__PURE__ */ h("rect", {
808
+ children: [/* @__PURE__ */ g("rect", {
783
809
  x: "8",
784
810
  y: "8",
785
811
  width: "12",
786
812
  height: "12",
787
813
  rx: "2"
788
- }), /* @__PURE__ */ h("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
814
+ }), /* @__PURE__ */ g("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
789
815
  });
790
816
  }
791
- function Pe({ className: e }) {
792
- return /* @__PURE__ */ h("svg", {
817
+ function Ie({ className: e }) {
818
+ return /* @__PURE__ */ g("svg", {
793
819
  viewBox: "0 0 24 24",
794
820
  fill: "none",
795
821
  stroke: "currentColor",
@@ -798,11 +824,11 @@ function Pe({ className: e }) {
798
824
  strokeLinejoin: "round",
799
825
  className: e,
800
826
  "aria-hidden": "true",
801
- children: /* @__PURE__ */ h("path", { d: "M5 12.5 9.5 17 19 7" })
827
+ children: /* @__PURE__ */ g("path", { d: "M5 12.5 9.5 17 19 7" })
802
828
  });
803
829
  }
804
- function Fe({ className: e }) {
805
- return /* @__PURE__ */ h("svg", {
830
+ function Le({ className: e }) {
831
+ return /* @__PURE__ */ g("svg", {
806
832
  viewBox: "0 0 24 24",
807
833
  fill: "none",
808
834
  stroke: "currentColor",
@@ -811,11 +837,11 @@ function Fe({ className: e }) {
811
837
  strokeLinejoin: "round",
812
838
  className: e,
813
839
  "aria-hidden": "true",
814
- children: /* @__PURE__ */ h("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
840
+ children: /* @__PURE__ */ g("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
815
841
  });
816
842
  }
817
- function Ie({ className: e }) {
818
- return /* @__PURE__ */ g("svg", {
843
+ function Re({ className: e }) {
844
+ return /* @__PURE__ */ _("svg", {
819
845
  viewBox: "0 0 24 24",
820
846
  fill: "none",
821
847
  stroke: "currentColor",
@@ -824,29 +850,67 @@ function Ie({ className: e }) {
824
850
  strokeLinejoin: "round",
825
851
  className: e,
826
852
  "aria-hidden": "true",
827
- children: [/* @__PURE__ */ h("circle", {
853
+ children: [/* @__PURE__ */ g("circle", {
828
854
  cx: "12",
829
855
  cy: "12",
830
856
  r: "9"
831
- }), /* @__PURE__ */ h("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
857
+ }), /* @__PURE__ */ g("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
858
+ });
859
+ }
860
+ function ze({ className: e }) {
861
+ return /* @__PURE__ */ _("svg", {
862
+ viewBox: "0 0 24 24",
863
+ fill: "currentColor",
864
+ className: e,
865
+ "aria-hidden": "true",
866
+ children: [
867
+ /* @__PURE__ */ g("circle", {
868
+ cx: "5",
869
+ cy: "12",
870
+ r: "1.75"
871
+ }),
872
+ /* @__PURE__ */ g("circle", {
873
+ cx: "12",
874
+ cy: "12",
875
+ r: "1.75"
876
+ }),
877
+ /* @__PURE__ */ g("circle", {
878
+ cx: "19",
879
+ cy: "12",
880
+ r: "1.75"
881
+ })
882
+ ]
883
+ });
884
+ }
885
+ function Be({ className: e }) {
886
+ return /* @__PURE__ */ g("svg", {
887
+ viewBox: "0 0 24 24",
888
+ fill: "none",
889
+ stroke: "currentColor",
890
+ strokeWidth: 2,
891
+ strokeLinecap: "round",
892
+ strokeLinejoin: "round",
893
+ className: e,
894
+ "aria-hidden": "true",
895
+ children: /* @__PURE__ */ g("path", { d: "M12 5v14M5 12h14" })
832
896
  });
833
897
  }
834
898
  //#endregion
835
899
  //#region src/ui/CopyMarkdownButton.tsx
836
- var Le = 1500;
837
- function Re({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
838
- let [a, s] = u(!1), [c, d] = u(!1), f = l(null), m = l(null), _ = Oe(m);
900
+ var Ve = 1500;
901
+ function He({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
902
+ let [a, s] = u(!1), [c, d] = u(!1), f = l(null), p = l(null), h = Ae(p);
839
903
  return o(() => () => {
840
904
  f.current !== null && clearTimeout(f.current);
841
- }, []), /* @__PURE__ */ h(p.Provider, {
905
+ }, []), /* @__PURE__ */ g(m.Provider, {
842
906
  delayDuration: 200,
843
- children: /* @__PURE__ */ g(p.Root, {
907
+ children: /* @__PURE__ */ _(m.Root, {
844
908
  open: a || c,
845
909
  onOpenChange: d,
846
- children: [/* @__PURE__ */ h(p.Trigger, {
910
+ children: [/* @__PURE__ */ g(m.Trigger, {
847
911
  asChild: !0,
848
- children: /* @__PURE__ */ h("button", {
849
- ref: m,
912
+ children: /* @__PURE__ */ g("button", {
913
+ ref: p,
850
914
  type: "button",
851
915
  onClick: async () => {
852
916
  try {
@@ -854,18 +918,18 @@ function Re({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
854
918
  } catch {
855
919
  return;
856
920
  }
857
- s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Le);
921
+ s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Ve);
858
922
  },
859
923
  "aria-label": n,
860
924
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
861
- children: h(a ? Pe : Ne, { className: "bailey-copy-icon" })
925
+ children: g(a ? Ie : Fe, { className: "bailey-copy-icon" })
862
926
  })
863
- }), /* @__PURE__ */ h(p.Portal, {
864
- container: _ instanceof ShadowRoot ? _ : void 0,
865
- children: /* @__PURE__ */ g(p.Content, {
927
+ }), /* @__PURE__ */ g(m.Portal, {
928
+ container: h instanceof ShadowRoot ? h : void 0,
929
+ children: /* @__PURE__ */ _(m.Content, {
866
930
  side: "top",
867
931
  className: "bailey-tooltip-content",
868
- children: [a ? i : r, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
932
+ children: [a ? i : r, /* @__PURE__ */ g(m.Arrow, { className: "bailey-tooltip-arrow" })]
869
933
  })
870
934
  })]
871
935
  })
@@ -873,95 +937,101 @@ function Re({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
873
937
  }
874
938
  //#endregion
875
939
  //#region src/ui/BaileyTracePanel.tsx
876
- async function ze(e) {
940
+ async function Ue(e) {
877
941
  try {
878
942
  await navigator.clipboard.writeText(e);
879
943
  } catch {}
880
944
  }
881
- function Be({ text: e, label: t = "Copy" }) {
882
- return /* @__PURE__ */ h("button", {
945
+ function We({ text: e, label: t = "Copy" }) {
946
+ return /* @__PURE__ */ g("button", {
883
947
  type: "button",
884
- onClick: () => ze(e),
948
+ onClick: () => Ue(e),
885
949
  className: "bailey-trace-copy-button",
886
950
  children: t
887
951
  });
888
952
  }
889
- function Ve(e) {
953
+ function Ge(e) {
890
954
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
891
955
  switch (e.kind) {
892
- case "tool_start": return "bailey-trace-chip bailey-trace-chip-info";
893
- case "tool_end": return "bailey-trace-chip bailey-trace-chip-success";
956
+ case "tool_start":
957
+ case "llm_call_start": return "bailey-trace-chip bailey-trace-chip-info";
958
+ case "tool_end":
959
+ case "llm_call_end": return "bailey-trace-chip bailey-trace-chip-success";
894
960
  case "progress": return "bailey-trace-chip bailey-trace-chip-secondary";
895
961
  default: return "bailey-trace-chip bailey-trace-chip-default";
896
962
  }
897
963
  }
898
964
  function $({ label: e, content: t, copyable: n }) {
899
- return /* @__PURE__ */ g("details", {
965
+ return /* @__PURE__ */ _("details", {
900
966
  className: "bailey-trace-disclosure",
901
967
  children: [
902
- /* @__PURE__ */ h("summary", {
968
+ /* @__PURE__ */ g("summary", {
903
969
  className: "bailey-trace-disclosure-summary",
904
970
  children: e
905
971
  }),
906
- n && /* @__PURE__ */ h("div", {
972
+ n && /* @__PURE__ */ g("div", {
907
973
  className: "bailey-trace-disclosure-actions",
908
- children: /* @__PURE__ */ h(Be, { text: t })
974
+ children: /* @__PURE__ */ g(We, { text: t })
909
975
  }),
910
- /* @__PURE__ */ h("pre", {
976
+ /* @__PURE__ */ g("pre", {
911
977
  className: "bailey-trace-disclosure-content",
912
978
  children: t
913
979
  })
914
980
  ]
915
981
  });
916
982
  }
917
- function He({ row: e }) {
918
- return /* @__PURE__ */ g("div", {
983
+ function Ke({ row: e }) {
984
+ return /* @__PURE__ */ _("div", {
919
985
  className: "bailey-trace-row",
920
986
  children: [
921
- /* @__PURE__ */ g("div", {
987
+ /* @__PURE__ */ _("div", {
922
988
  className: "bailey-trace-row-header",
923
989
  children: [
924
- /* @__PURE__ */ h("span", {
990
+ /* @__PURE__ */ g("span", {
925
991
  className: "bailey-trace-row-time",
926
992
  children: e.time
927
993
  }),
928
- /* @__PURE__ */ h("span", {
994
+ /* @__PURE__ */ g("span", {
929
995
  className: "bailey-trace-row-gap",
930
996
  title: "Time since the previous event",
931
- children: de(e.gapMs)
997
+ children: me(e.gapMs)
932
998
  }),
933
- /* @__PURE__ */ h("span", {
934
- className: Ve(e),
999
+ /* @__PURE__ */ g("span", {
1000
+ className: Ge(e),
935
1001
  children: e.label
936
1002
  }),
937
- /* @__PURE__ */ h("span", {
1003
+ /* @__PURE__ */ g("span", {
938
1004
  className: "bailey-trace-row-summary",
939
1005
  children: e.summary
940
1006
  })
941
1007
  ]
942
1008
  }),
943
- e.argsDetail && /* @__PURE__ */ h($, {
944
- label: "args",
1009
+ e.argsDetail && /* @__PURE__ */ g($, {
1010
+ label: e.kind === "llm_call_start" ? "request" : "args",
945
1011
  content: e.argsDetail
946
1012
  }),
947
- e.outputDetail && /* @__PURE__ */ h($, {
948
- label: "output",
1013
+ e.outputDetail && /* @__PURE__ */ g($, {
1014
+ label: e.kind === "llm_call_end" ? "response" : "output",
949
1015
  content: e.outputDetail
950
1016
  }),
951
- e.rawDetail && /* @__PURE__ */ h($, {
1017
+ e.structuredOutputDetail && /* @__PURE__ */ g($, {
1018
+ label: "structured output",
1019
+ content: e.structuredOutputDetail
1020
+ }),
1021
+ e.rawDetail && /* @__PURE__ */ g($, {
952
1022
  label: "raw",
953
1023
  content: e.rawDetail
954
1024
  })
955
1025
  ]
956
1026
  });
957
1027
  }
958
- function Ue(e, t) {
1028
+ function qe(e, t) {
959
1029
  if (e.chunkCount === 0) return "Streamed: no chunks received";
960
1030
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
961
1031
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
962
1032
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
963
1033
  }
964
- function We({ request: e }) {
1034
+ function Je({ request: e }) {
965
1035
  let t = c(() => JSON.stringify({
966
1036
  model: e.model,
967
1037
  instructions: e.systemPrompt,
@@ -970,10 +1040,10 @@ function We({ request: e }) {
970
1040
  tools: e.tools,
971
1041
  toolChoice: e.toolChoice
972
1042
  }, null, 2), [e]);
973
- return /* @__PURE__ */ g("div", {
1043
+ return /* @__PURE__ */ _("div", {
974
1044
  className: "bailey-trace-request-details",
975
1045
  children: [
976
- /* @__PURE__ */ g("span", {
1046
+ /* @__PURE__ */ _("span", {
977
1047
  className: "bailey-trace-request-meta",
978
1048
  children: [
979
1049
  "Last request — ",
@@ -983,26 +1053,26 @@ function We({ request: e }) {
983
1053
  e.requestId ? ` · ${e.requestId}` : ""
984
1054
  ]
985
1055
  }),
986
- /* @__PURE__ */ h("span", {
1056
+ /* @__PURE__ */ g("span", {
987
1057
  className: "bailey-trace-request-meta",
988
- children: Ue(e.streamStats, e.sentAt)
1058
+ children: qe(e.streamStats, e.sentAt)
989
1059
  }),
990
- /* @__PURE__ */ h($, {
1060
+ /* @__PURE__ */ g($, {
991
1061
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
992
1062
  content: e.systemPrompt,
993
1063
  copyable: !0
994
1064
  }),
995
- /* @__PURE__ */ h($, {
1065
+ /* @__PURE__ */ g($, {
996
1066
  label: `Messages (${e.messages.length})`,
997
1067
  content: JSON.stringify(e.messages, null, 2),
998
1068
  copyable: !0
999
1069
  }),
1000
- e.response && /* @__PURE__ */ h($, {
1070
+ e.response && /* @__PURE__ */ g($, {
1001
1071
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1002
1072
  content: e.response.content,
1003
1073
  copyable: !0
1004
1074
  }),
1005
- /* @__PURE__ */ h($, {
1075
+ /* @__PURE__ */ g($, {
1006
1076
  label: "Full payload (JSON)",
1007
1077
  content: t,
1008
1078
  copyable: !0
@@ -1010,43 +1080,43 @@ function We({ request: e }) {
1010
1080
  ]
1011
1081
  });
1012
1082
  }
1013
- function Ge({ events: e, lastRequest: t, onClear: n }) {
1014
- let r = c(() => fe(e), [e]), i = c(() => me(r), [r]), a = c(() => JSON.stringify(e, null, 2), [e]);
1015
- return /* @__PURE__ */ g("div", {
1083
+ function Ye({ events: e, lastRequest: t, onClear: n }) {
1084
+ let r = c(() => he(e), [e]), i = c(() => _e(r), [r]), a = c(() => JSON.stringify(e, null, 2), [e]);
1085
+ return /* @__PURE__ */ _("div", {
1016
1086
  className: "bailey-trace-body",
1017
1087
  children: [
1018
- /* @__PURE__ */ g("div", {
1088
+ /* @__PURE__ */ _("div", {
1019
1089
  className: "bailey-trace-actions-row",
1020
- children: [e.length > 0 && /* @__PURE__ */ h(Be, {
1090
+ children: [e.length > 0 && /* @__PURE__ */ g(We, {
1021
1091
  text: a,
1022
1092
  label: "Copy trace as JSON"
1023
- }), /* @__PURE__ */ h("button", {
1093
+ }), /* @__PURE__ */ g("button", {
1024
1094
  type: "button",
1025
1095
  onClick: n,
1026
1096
  className: "bailey-trace-copy-button",
1027
1097
  children: "Clear"
1028
1098
  })]
1029
1099
  }),
1030
- t && /* @__PURE__ */ h(We, { request: t }),
1031
- /* @__PURE__ */ h("div", {
1100
+ t && /* @__PURE__ */ g(Je, { request: t }),
1101
+ /* @__PURE__ */ g("div", {
1032
1102
  className: "bailey-trace-rows",
1033
1103
  children: i.map((e, t) => {
1034
- if (e.type === "single") return /* @__PURE__ */ h(He, { row: e.row }, e.row.key);
1104
+ if (e.type === "single") return /* @__PURE__ */ g(Ke, { row: e.row }, e.row.key);
1035
1105
  let n = e.rows.filter((e) => e.isToolStart).length;
1036
- if (n <= 1) return /* @__PURE__ */ h("div", {
1106
+ if (n <= 1) return /* @__PURE__ */ g("div", {
1037
1107
  className: "bailey-trace-rows",
1038
- children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
1108
+ children: e.rows.map((e) => /* @__PURE__ */ g(Ke, { row: e }, e.key))
1039
1109
  }, `group-${t}`);
1040
1110
  let r = e.rows.filter((e) => e.failed).length;
1041
- return /* @__PURE__ */ g("details", {
1111
+ return /* @__PURE__ */ _("details", {
1042
1112
  className: "bailey-trace-group",
1043
- children: [/* @__PURE__ */ g("summary", {
1113
+ children: [/* @__PURE__ */ _("summary", {
1044
1114
  className: "bailey-trace-group-summary",
1045
1115
  children: [
1046
- /* @__PURE__ */ h("strong", { children: e.toolName }),
1116
+ /* @__PURE__ */ g("strong", { children: e.toolName }),
1047
1117
  " × ",
1048
1118
  n,
1049
- r > 0 && /* @__PURE__ */ g("span", {
1119
+ r > 0 && /* @__PURE__ */ _("span", {
1050
1120
  className: "bailey-trace-group-failed",
1051
1121
  children: [
1052
1122
  " ",
@@ -1055,9 +1125,9 @@ function Ge({ events: e, lastRequest: t, onClear: n }) {
1055
1125
  ]
1056
1126
  })
1057
1127
  ]
1058
- }), /* @__PURE__ */ h("div", {
1128
+ }), /* @__PURE__ */ g("div", {
1059
1129
  className: "bailey-trace-rows",
1060
- children: e.rows.map((e) => /* @__PURE__ */ h(He, { row: e }, e.key))
1130
+ children: e.rows.map((e) => /* @__PURE__ */ g(Ke, { row: e }, e.key))
1061
1131
  })]
1062
1132
  }, `group-${t}`);
1063
1133
  })
@@ -1065,13 +1135,13 @@ function Ge({ events: e, lastRequest: t, onClear: n }) {
1065
1135
  ]
1066
1136
  });
1067
1137
  }
1068
- function Ke({ events: e, lastRequest: t, onClear: n }) {
1069
- let [r, i] = u(!1), a = c(() => he(e), [e]), o = c(() => pe(e), [e]);
1070
- return e.length === 0 && !t ? null : /* @__PURE__ */ g("div", {
1138
+ function Xe({ events: e, lastRequest: t, onClear: n }) {
1139
+ let [r, i] = u(!1), a = c(() => ve(e), [e]), o = c(() => ge(e), [e]);
1140
+ return e.length === 0 && !t ? null : /* @__PURE__ */ _("div", {
1071
1141
  className: "bailey-trace-panel",
1072
- children: [/* @__PURE__ */ g("div", {
1142
+ children: [/* @__PURE__ */ _("div", {
1073
1143
  className: "bailey-trace-toggle-row",
1074
- children: [/* @__PURE__ */ g("button", {
1144
+ children: [/* @__PURE__ */ _("button", {
1075
1145
  type: "button",
1076
1146
  onClick: () => i((e) => !e),
1077
1147
  "aria-expanded": r,
@@ -1083,11 +1153,11 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1083
1153
  e.length,
1084
1154
  ")"
1085
1155
  ]
1086
- }), o && /* @__PURE__ */ h("span", {
1156
+ }), o && /* @__PURE__ */ g("span", {
1087
1157
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
1088
1158
  children: o
1089
1159
  })]
1090
- }), r && /* @__PURE__ */ h(Ge, {
1160
+ }), r && /* @__PURE__ */ g(Ye, {
1091
1161
  events: e,
1092
1162
  lastRequest: t,
1093
1163
  onClear: n
@@ -1096,8 +1166,8 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1096
1166
  }
1097
1167
  //#endregion
1098
1168
  //#region src/ui/ToolResultImage.tsx
1099
- function qe({ src: e, alt: n, className: r }) {
1100
- return t(e) ? /* @__PURE__ */ h("img", {
1169
+ function Ze({ src: e, alt: n, className: r }) {
1170
+ return t(e) ? /* @__PURE__ */ g("img", {
1101
1171
  src: e,
1102
1172
  alt: n ?? "",
1103
1173
  className: `bailey-tool-result-image${r ? ` ${r}` : ""}`,
@@ -1106,10 +1176,12 @@ function qe({ src: e, alt: n, className: r }) {
1106
1176
  }
1107
1177
  //#endregion
1108
1178
  //#region src/ui/BaileyChatPanel.tsx
1109
- var Je = "How can bailey AI help you today?", Ye = "Reply to bailey AI", Xe = {
1179
+ var Qe = "How can bailey AI help you today?", $e = "Reply to bailey AI", et = {
1110
1180
  newChatButtonText: "New chat",
1111
1181
  newChatAriaLabel: "new chat",
1112
1182
  historyAriaLabel: "conversation history",
1183
+ historyMenuItemText: "Chat history",
1184
+ menuAriaLabel: "more options",
1113
1185
  suggestionsTitle: "Suggested for you",
1114
1186
  emptyStateMessage: "Ask Bailey a question to get started.",
1115
1187
  youLabel: "You",
@@ -1122,44 +1194,44 @@ var Je = "How can bailey AI help you today?", Ye = "Reply to bailey AI", Xe = {
1122
1194
  copyButtonAriaLabel: "copy response as markdown",
1123
1195
  copyButtonTooltipDefault: "Copy as markdown",
1124
1196
  copyButtonTooltipCopied: "Copied!"
1125
- }, Ze = [f], Qe = {
1126
- ...ke(),
1127
- p: ({ children: e }) => /* @__PURE__ */ h(m, { children: e })
1128
- }, $e = r(function({ content: e, components: t }) {
1129
- return /* @__PURE__ */ h("div", {
1197
+ }, tt = [f], nt = {
1198
+ ...je(),
1199
+ p: ({ children: e }) => /* @__PURE__ */ g(h, { children: e })
1200
+ }, rt = r(function({ content: e, components: t }) {
1201
+ return /* @__PURE__ */ g("div", {
1130
1202
  className: "bailey-markdown-content",
1131
- children: /* @__PURE__ */ h(d, {
1132
- remarkPlugins: Ze,
1203
+ children: /* @__PURE__ */ g(d, {
1204
+ remarkPlugins: tt,
1133
1205
  components: t,
1134
1206
  skipHtml: !0,
1135
1207
  children: e
1136
1208
  })
1137
1209
  });
1138
1210
  });
1139
- function et(e, t, n) {
1211
+ function it(e, t, n) {
1140
1212
  if (e !== "streaming") return;
1141
1213
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
1142
- if (r.length !== 0) return Z(r[r.length - 1]);
1214
+ if (r.length !== 0) return X(r[r.length - 1]);
1143
1215
  }
1144
- function tt(e) {
1216
+ function at(e) {
1145
1217
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
1146
1218
  hour: "numeric",
1147
1219
  minute: "2-digit"
1148
1220
  });
1149
1221
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
1150
1222
  }
1151
- function nt({ chat: e, placeholder: t, replyPlaceholder: n = Ye, emptyPlaceholder: r, suggestions: i, onHistoryClick: a, privacyNote: s, resolveActivityIcon: f, className: m, height: _, width: v, hideDeveloperDetails: y = !1, renderMessageActions: b, renderTable: x, renderChart: S, labels: C, formatMessageTime: w }) {
1152
- let { messages: T, traceEvents: E, lastRequest: D, status: O, error: k, send: A, stop: j, retryLast: ee, clearTrace: M, clearError: N, newChat: P } = e, [F, I] = u(""), L = {
1153
- ...Xe,
1154
- ...C
1155
- }, R = w ?? tt, z = l(null), B = De(z), V = l(null), H = l(null), U = l(!0), W = c(() => ke({
1156
- renderTable: x,
1157
- renderChart: S
1158
- }), [x, S]), G = c(() => et(O, E, D), [
1159
- O,
1160
- E,
1161
- D
1162
- ]), K = T.length === 0, q = t ?? (K ? r ?? Je : n);
1223
+ function ot({ chat: e, placeholder: t, replyPlaceholder: n = $e, emptyPlaceholder: r, suggestions: i, onHistoryClick: a, privacyNote: s, resolveActivityIcon: f, className: h, height: v, width: y, hideDeveloperDetails: b = !1, renderMessageActions: x, renderTable: S, renderChart: C, labels: w, formatMessageTime: T }) {
1224
+ let { messages: E, traceEvents: D, lastRequest: O, status: k, error: A, send: j, stop: M, retryLast: ee, clearTrace: N, clearError: P, newChat: F } = e, [I, L] = u(""), R = {
1225
+ ...et,
1226
+ ...w
1227
+ }, z = T ?? at, B = l(null), V = ke(B), te = l(null), H = l(null), U = l(!0), W = c(() => je({
1228
+ renderTable: S,
1229
+ renderChart: C
1230
+ }), [S, C]), G = c(() => it(k, D, O), [
1231
+ k,
1232
+ D,
1233
+ O
1234
+ ]), K = E.length === 0, q = t ?? (K ? r ?? Qe : n);
1163
1235
  o(() => {
1164
1236
  let e = H.current;
1165
1237
  if (!e) return;
@@ -1169,187 +1241,199 @@ function nt({ chat: e, placeholder: t, replyPlaceholder: n = Ye, emptyPlaceholde
1169
1241
  };
1170
1242
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1171
1243
  }, []), o(() => {
1172
- U.current && V.current?.scrollIntoView({
1173
- behavior: O === "streaming" ? "auto" : "smooth",
1244
+ U.current && te.current?.scrollIntoView({
1245
+ behavior: k === "streaming" ? "auto" : "smooth",
1174
1246
  block: "nearest"
1175
1247
  });
1176
- }, [T, O]);
1177
- let J = (e) => {
1178
- U.current = !0, A(e);
1248
+ }, [E, k]);
1249
+ let ne = (e) => {
1250
+ U.current = !0, j(e);
1179
1251
  };
1180
- return /* @__PURE__ */ h(ve.Provider, {
1181
- value: B,
1182
- children: /* @__PURE__ */ h("div", {
1183
- ref: z,
1184
- className: `bailey-chat-panel${m ? ` ${m}` : ""}`,
1185
- style: _ !== void 0 || v !== void 0 ? {
1186
- height: _,
1187
- width: v
1252
+ return /* @__PURE__ */ g(xe.Provider, {
1253
+ value: V,
1254
+ children: /* @__PURE__ */ g("div", {
1255
+ ref: B,
1256
+ className: `bailey-chat-panel${h ? ` ${h}` : ""}`,
1257
+ style: v !== void 0 || y !== void 0 ? {
1258
+ height: v,
1259
+ width: y
1188
1260
  } : void 0,
1189
- children: /* @__PURE__ */ g("div", {
1261
+ children: /* @__PURE__ */ _("div", {
1190
1262
  className: "bailey-chat-panel-inner",
1191
1263
  children: [
1192
- /* @__PURE__ */ g("div", {
1193
- className: "bailey-toolbar-row",
1194
- children: [!K && /* @__PURE__ */ h("button", {
1195
- type: "button",
1196
- onClick: P,
1197
- "aria-label": L.newChatAriaLabel,
1198
- className: "bailey-new-chat-button",
1199
- children: L.newChatButtonText
1200
- }), a && /* @__PURE__ */ h("button", {
1201
- type: "button",
1202
- onClick: a,
1203
- "aria-label": L.historyAriaLabel,
1204
- className: "bailey-history-button",
1205
- children: /* @__PURE__ */ h(Fe, { className: "bailey-history-icon" })
1206
- })]
1207
- }),
1208
- /* @__PURE__ */ g("div", {
1264
+ /* @__PURE__ */ _("div", {
1209
1265
  className: "bailey-chat-transcript",
1210
1266
  ref: H,
1211
1267
  children: [
1212
- K && (i && i.length > 0 ? /* @__PURE__ */ g("div", {
1268
+ K && (i && i.length > 0 ? /* @__PURE__ */ _("div", {
1213
1269
  className: "bailey-suggestions",
1214
- children: [/* @__PURE__ */ h("div", {
1270
+ children: [/* @__PURE__ */ g("div", {
1215
1271
  className: "bailey-suggestions-title",
1216
- children: L.suggestionsTitle
1217
- }), i.map((e, t) => /* @__PURE__ */ g("button", {
1272
+ children: R.suggestionsTitle
1273
+ }), i.map((e, t) => /* @__PURE__ */ _("button", {
1218
1274
  type: "button",
1219
- onClick: () => J(e.value ?? e.label),
1275
+ onClick: () => ne(e.value ?? e.label),
1220
1276
  className: "bailey-suggestion-card",
1221
- children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ h(Me, { className: "bailey-suggestion-icon" })]
1277
+ children: [/* @__PURE__ */ g("span", { children: e.label }), /* @__PURE__ */ g(Pe, { className: "bailey-suggestion-icon" })]
1222
1278
  }, `${e.label}-${t}`))]
1223
- }) : /* @__PURE__ */ h("div", {
1279
+ }) : /* @__PURE__ */ g("div", {
1224
1280
  className: "bailey-empty-state",
1225
- children: L.emptyStateMessage
1281
+ children: R.emptyStateMessage
1226
1282
  })),
1227
- T.map((e, t) => {
1228
- let n = e.role === "assistant" && t === T.length - 1, r = O === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? ge(E, e.createdAt) : [], a = i[i.length - 1];
1229
- return /* @__PURE__ */ h("div", {
1283
+ E.map((e, t) => {
1284
+ let n = e.role === "assistant" && t === E.length - 1, r = k === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? ye(D, e.createdAt) : [], a = i[i.length - 1];
1285
+ return /* @__PURE__ */ g("div", {
1230
1286
  className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
1231
- children: e.role === "user" ? /* @__PURE__ */ g("div", {
1287
+ children: e.role === "user" ? /* @__PURE__ */ _("div", {
1232
1288
  className: "bailey-user-message",
1233
- children: [/* @__PURE__ */ g("div", {
1289
+ children: [/* @__PURE__ */ _("div", {
1234
1290
  className: "bailey-message-meta",
1235
- children: [/* @__PURE__ */ h("span", {
1291
+ children: [/* @__PURE__ */ g("span", {
1236
1292
  className: "bailey-message-meta-name",
1237
- children: L.youLabel
1238
- }), e.createdAt !== void 0 && /* @__PURE__ */ h("span", { children: R(e.createdAt) })]
1239
- }), /* @__PURE__ */ h("div", {
1293
+ children: R.youLabel
1294
+ }), e.createdAt !== void 0 && /* @__PURE__ */ g("span", { children: z(e.createdAt) })]
1295
+ }), /* @__PURE__ */ g("div", {
1240
1296
  className: "bailey-user-bubble",
1241
1297
  children: e.content
1242
1298
  })]
1243
- }) : r ? /* @__PURE__ */ h("div", {
1299
+ }) : r ? /* @__PURE__ */ g("div", {
1244
1300
  className: "bailey-thinking-hint",
1245
- children: G ?? L.thinkingHint
1246
- }) : /* @__PURE__ */ g("div", {
1301
+ children: G ?? R.thinkingHint
1302
+ }) : /* @__PURE__ */ _("div", {
1247
1303
  className: "bailey-assistant-message",
1248
1304
  children: [
1249
- a && /* @__PURE__ */ g("div", {
1305
+ a && /* @__PURE__ */ _("div", {
1250
1306
  className: "bailey-activity-line",
1251
- children: [/* @__PURE__ */ h("span", {
1307
+ children: [/* @__PURE__ */ g("span", {
1252
1308
  className: "bailey-activity-icon",
1253
- children: f?.(a.toolName) ?? /* @__PURE__ */ h(Ie, {})
1254
- }), /* @__PURE__ */ h("span", { children: a.text })]
1309
+ children: f?.(a.toolName) ?? /* @__PURE__ */ g(Re, {})
1310
+ }), /* @__PURE__ */ g("span", { children: a.text })]
1255
1311
  }),
1256
- /* @__PURE__ */ h($e, {
1312
+ /* @__PURE__ */ g(rt, {
1257
1313
  content: e.content,
1258
1314
  components: W
1259
1315
  }),
1260
- e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ h(qe, {
1316
+ e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ g(Ze, {
1261
1317
  src: e.src,
1262
1318
  alt: e.alt
1263
1319
  }, t) : null),
1264
- e.streaming && G && /* @__PURE__ */ h("div", {
1320
+ e.streaming && G && /* @__PURE__ */ g("div", {
1265
1321
  className: "bailey-streaming-hint",
1266
1322
  children: G
1267
1323
  }),
1268
- !e.streaming && /* @__PURE__ */ g("div", {
1324
+ !e.streaming && /* @__PURE__ */ _("div", {
1269
1325
  className: "bailey-message-actions",
1270
- children: [/* @__PURE__ */ h(Re, {
1326
+ children: [/* @__PURE__ */ g(He, {
1271
1327
  markdown: e.content,
1272
- ariaLabel: L.copyButtonAriaLabel,
1273
- tooltipDefaultText: L.copyButtonTooltipDefault,
1274
- tooltipCopiedText: L.copyButtonTooltipCopied
1275
- }), b?.(e)]
1328
+ ariaLabel: R.copyButtonAriaLabel,
1329
+ tooltipDefaultText: R.copyButtonTooltipDefault,
1330
+ tooltipCopiedText: R.copyButtonTooltipCopied
1331
+ }), x?.(e)]
1276
1332
  })
1277
1333
  ]
1278
1334
  })
1279
1335
  }, e.id);
1280
1336
  }),
1281
- /* @__PURE__ */ h("div", { ref: V })
1337
+ /* @__PURE__ */ g("div", { ref: te })
1282
1338
  ]
1283
1339
  }),
1284
- k && /* @__PURE__ */ g("div", {
1340
+ A && /* @__PURE__ */ _("div", {
1285
1341
  className: "bailey-error-banner",
1286
1342
  role: "alert",
1287
- children: [/* @__PURE__ */ h("span", { children: k }), /* @__PURE__ */ g("div", {
1343
+ children: [/* @__PURE__ */ g("span", { children: A }), /* @__PURE__ */ _("div", {
1288
1344
  className: "bailey-error-actions",
1289
- children: [/* @__PURE__ */ h("button", {
1345
+ children: [/* @__PURE__ */ g("button", {
1290
1346
  type: "button",
1291
1347
  onClick: ee,
1292
1348
  className: "bailey-retry-button",
1293
- children: L.retryButtonText
1294
- }), /* @__PURE__ */ h("button", {
1349
+ children: R.retryButtonText
1350
+ }), /* @__PURE__ */ g("button", {
1295
1351
  type: "button",
1296
- onClick: N,
1297
- "aria-label": L.dismissErrorAriaLabel,
1352
+ onClick: P,
1353
+ "aria-label": R.dismissErrorAriaLabel,
1298
1354
  className: "bailey-dismiss-button",
1299
1355
  children: "✕"
1300
1356
  })]
1301
1357
  })]
1302
1358
  }),
1303
- !y && /* @__PURE__ */ h(Ke, {
1304
- events: E,
1305
- lastRequest: D,
1306
- onClear: M
1359
+ !b && /* @__PURE__ */ g(Xe, {
1360
+ events: D,
1361
+ lastRequest: O,
1362
+ onClear: N
1307
1363
  }),
1308
- /* @__PURE__ */ g("form", {
1309
- onSubmit: (e) => {
1310
- e.preventDefault(), !(!F.trim() || O === "streaming") && (J(F), I(""));
1311
- },
1312
- className: "bailey-input-row",
1313
- children: [/* @__PURE__ */ h("input", {
1314
- type: "text",
1315
- placeholder: q,
1316
- "aria-label": q,
1317
- value: F,
1318
- onChange: (e) => I(e.target.value),
1319
- disabled: O === "streaming",
1320
- className: "bailey-input"
1321
- }), O === "streaming" ? /* @__PURE__ */ h(p.Provider, {
1322
- delayDuration: 200,
1323
- children: /* @__PURE__ */ g(p.Root, { children: [/* @__PURE__ */ h(p.Trigger, {
1324
- asChild: !0,
1325
- children: /* @__PURE__ */ h("button", {
1326
- type: "button",
1327
- onClick: j,
1328
- "aria-label": L.stopAriaLabel,
1329
- className: "bailey-stop-button",
1330
- children: /* @__PURE__ */ h(je, { className: "bailey-stop-icon" })
1331
- })
1332
- }), /* @__PURE__ */ h(p.Portal, {
1333
- container: B instanceof ShadowRoot ? B : void 0,
1334
- children: /* @__PURE__ */ g(p.Content, {
1335
- side: "top",
1336
- className: "bailey-tooltip-content",
1337
- children: [L.stopButtonText, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
1338
- })
1339
- })] })
1340
- }) : /* @__PURE__ */ h("button", {
1341
- type: "submit",
1342
- "aria-label": L.sendAriaLabel,
1343
- disabled: !F.trim(),
1344
- className: "bailey-send-button",
1345
- children: /* @__PURE__ */ h(Ae, { className: "bailey-send-icon" })
1346
- })]
1364
+ /* @__PURE__ */ _("div", {
1365
+ className: "bailey-input-area",
1366
+ children: [/* @__PURE__ */ _("form", {
1367
+ onSubmit: (e) => {
1368
+ e.preventDefault(), !(!I.trim() || k === "streaming") && (ne(I), L(""));
1369
+ },
1370
+ className: "bailey-input-row",
1371
+ children: [/* @__PURE__ */ g("input", {
1372
+ type: "text",
1373
+ placeholder: q,
1374
+ "aria-label": q,
1375
+ value: I,
1376
+ onChange: (e) => L(e.target.value),
1377
+ disabled: k === "streaming",
1378
+ className: "bailey-input"
1379
+ }), k === "streaming" ? /* @__PURE__ */ g(m.Provider, {
1380
+ delayDuration: 200,
1381
+ children: /* @__PURE__ */ _(m.Root, { children: [/* @__PURE__ */ g(m.Trigger, {
1382
+ asChild: !0,
1383
+ children: /* @__PURE__ */ g("button", {
1384
+ type: "button",
1385
+ onClick: M,
1386
+ "aria-label": R.stopAriaLabel,
1387
+ className: "bailey-stop-button",
1388
+ children: /* @__PURE__ */ g(Ne, { className: "bailey-stop-icon" })
1389
+ })
1390
+ }), /* @__PURE__ */ g(m.Portal, {
1391
+ container: V instanceof ShadowRoot ? V : void 0,
1392
+ children: /* @__PURE__ */ _(m.Content, {
1393
+ side: "top",
1394
+ className: "bailey-tooltip-content",
1395
+ children: [R.stopButtonText, /* @__PURE__ */ g(m.Arrow, { className: "bailey-tooltip-arrow" })]
1396
+ })
1397
+ })] })
1398
+ }) : /* @__PURE__ */ g("button", {
1399
+ type: "submit",
1400
+ "aria-label": R.sendAriaLabel,
1401
+ disabled: !I.trim(),
1402
+ className: "bailey-send-button",
1403
+ children: /* @__PURE__ */ g(Me, { className: "bailey-send-icon" })
1404
+ })]
1405
+ }), (!K || a) && /* @__PURE__ */ _(p.Root, { children: [/* @__PURE__ */ g(p.Trigger, {
1406
+ asChild: !0,
1407
+ children: /* @__PURE__ */ g("button", {
1408
+ type: "button",
1409
+ "aria-label": R.menuAriaLabel,
1410
+ className: "bailey-menu-button",
1411
+ children: /* @__PURE__ */ g(ze, { className: "bailey-menu-icon" })
1412
+ })
1413
+ }), /* @__PURE__ */ g(p.Portal, {
1414
+ container: V instanceof ShadowRoot ? V : void 0,
1415
+ children: /* @__PURE__ */ _(p.Content, {
1416
+ side: "top",
1417
+ align: "end",
1418
+ sideOffset: 8,
1419
+ className: "bailey-menu-content",
1420
+ children: [!K && /* @__PURE__ */ _(p.Item, {
1421
+ onSelect: () => F(),
1422
+ className: "bailey-menu-item",
1423
+ children: [/* @__PURE__ */ g(Be, { className: "bailey-menu-item-icon" }), R.newChatButtonText]
1424
+ }), a && /* @__PURE__ */ _(p.Item, {
1425
+ onSelect: () => a(),
1426
+ className: "bailey-menu-item",
1427
+ children: [/* @__PURE__ */ g(Le, { className: "bailey-menu-item-icon" }), R.historyMenuItemText]
1428
+ })]
1429
+ })
1430
+ })] })]
1347
1431
  }),
1348
- (K || s?.alwaysVisible) && s && /* @__PURE__ */ h("div", {
1432
+ (K || s?.alwaysVisible) && s && /* @__PURE__ */ g("div", {
1349
1433
  className: "bailey-privacy-note",
1350
- children: /* @__PURE__ */ h(d, {
1351
- remarkPlugins: Ze,
1352
- components: Qe,
1434
+ children: /* @__PURE__ */ g(d, {
1435
+ remarkPlugins: tt,
1436
+ components: nt,
1353
1437
  skipHtml: !0,
1354
1438
  children: s.markdown
1355
1439
  })
@@ -1361,6 +1445,6 @@ function nt({ chat: e, placeholder: t, replyPlaceholder: n = Ye, emptyPlaceholde
1361
1445
  }
1362
1446
  //#endregion
1363
1447
  //#region src/index.ts
1364
- var rt = "0.3.1-pre.2";
1448
+ var st = "0.3.1-pre.2";
1365
1449
  //#endregion
1366
- export { Ie as ActivityIcon, Me as ArrowUpRightIcon, rt as BAILEYAI_CHAT_UI_VERSION, G as BAILEY_CHART_PROMPT_FRAGMENT, L as BAILEY_TABLE_GRID_ROW_THRESHOLD, nt as BaileyChatPanel, Ke as BaileyTracePanel, Re as CopyMarkdownButton, Ae as HeartIcon, ae as TRACE_KIND_LABEL, ke as createBaileyMarkdownComponents, E as extractPseudoToolCalls, U as extractTableData, de as formatTraceGap, ue as formatTraceTime, he as hasTraceFailure, e as isSafeMarkdownUrl, N as joinInstructions, ie as parseBaileyChartSpec, O as parseSseFrames, I as resolveToolCall, W as shouldUseGrid, ge as toActivityLines, fe as toTraceRows, me as toTraceSegments, se as traceEventArgsDetail, Z as traceEventHint, ce as traceEventOutputDetail, le as traceEventRawDetail, oe as traceEventSummary, X as traceEventToolName, pe as traceSummaryLine, M as useBaileyChat };
1450
+ export { Re as ActivityIcon, Pe as ArrowUpRightIcon, st as BAILEYAI_CHAT_UI_VERSION, G as BAILEY_CHART_PROMPT_FRAGMENT, R as BAILEY_TABLE_GRID_ROW_THRESHOLD, ot as BaileyChatPanel, Xe as BaileyTracePanel, He as CopyMarkdownButton, Me as HeartIcon, se as TRACE_KIND_LABEL, je as createBaileyMarkdownComponents, D as extractPseudoToolCalls, U as extractTableData, me as formatTraceGap, pe as formatTraceTime, ve as hasTraceFailure, e as isSafeMarkdownUrl, P as joinInstructions, oe as parseBaileyChartSpec, k as parseSseFrames, L as resolveToolCall, W as shouldUseGrid, ye as toActivityLines, he as toTraceRows, _e as toTraceSegments, le as traceEventArgsDetail, X as traceEventHint, ue as traceEventOutputDetail, fe as traceEventRawDetail, ce as traceEventSummary, Y as traceEventToolName, ge as traceSummaryLine, N as useBaileyChat };