@icanbwell/baileyai-chat-ui 1.0.11 → 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) {
@@ -205,10 +206,10 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
205
206
  }), !0;
206
207
  if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
207
208
  if (t.type === "response.completed") {
208
- let t = k.current.get(e);
209
+ let t = O.current.get(e);
209
210
  if (t) {
210
- let { cleanedText: n } = E(t.raw, { hideOpenBlock: !1 }), r = n.trim();
211
- 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 ? {
212
213
  ...t,
213
214
  content: r
214
215
  } : t)));
@@ -231,14 +232,14 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
231
232
  y("streaming"), x(null);
232
233
  let o = Date.now();
233
234
  w.current = o;
234
- let l = j(), u = {
235
+ let l = M(), u = {
235
236
  id: l,
236
237
  role: "assistant",
237
238
  content: "",
238
239
  streaming: !0,
239
240
  createdAt: o
240
241
  };
241
- p((e) => [...e, u]), D.current = [...i, u];
242
+ p((e) => [...e, u]), E.current = [...i, u];
242
243
  let d = i.findIndex((e) => e.role === "user" && !e.hidden), f = i.map((e, t) => t === d && s ? {
243
244
  role: e.role,
244
245
  content: `${s}${e.content}`,
@@ -266,7 +267,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
266
267
  });
267
268
  let m = new AbortController();
268
269
  S.current = m, F(m);
269
- 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) => {
270
271
  y("error"), x(e);
271
272
  let n = {
272
273
  kind: "error",
@@ -276,7 +277,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
276
277
  ...t
277
278
  };
278
279
  T.push(n), h((e) => [...e, n]);
279
- }, A = (e, t) => {
280
+ }, j = (e, t) => {
280
281
  e.forEach((e) => {
281
282
  if (e.type === "error") {
282
283
  v = e.message;
@@ -305,8 +306,8 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
305
306
  signal: m.signal,
306
307
  onChunk: (e) => {
307
308
  F(m), g += e;
308
- let { events: t, remainder: n, done: r } = O(g);
309
- g = n, A(t, r);
309
+ let { events: t, remainder: n, done: r } = k(g);
310
+ g = n, j(t, r);
310
311
  let i = Date.now();
311
312
  _((e) => e && e.sentAt === o ? {
312
313
  ...e,
@@ -325,30 +326,30 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
325
326
  }
326
327
  });
327
328
  if (g.trim()) {
328
- let { events: e, done: t } = O(`${g}\n\n`);
329
- g = "", A(e, t);
329
+ let { events: e, done: t } = k(`${g}\n\n`);
330
+ g = "", j(e, t);
330
331
  }
331
332
  if (v) {
332
333
  y("error"), x(v);
333
334
  return;
334
335
  }
335
336
  if (i === void 0 || i >= 400) {
336
- E(ee(i, s, u), {
337
+ D(ee(i, s, u), {
337
338
  httpStatus: i,
338
339
  rawBody: s || void 0
339
340
  });
340
341
  return;
341
342
  }
342
343
  if (!b) {
343
- E("Bailey returned an empty response.");
344
+ D("Bailey returned an empty response.");
344
345
  return;
345
346
  }
346
347
  if (!C) {
347
- 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.");
348
349
  return;
349
350
  }
350
351
  y("idle");
351
- let d = M.current.get(l) ?? "";
352
+ let d = A.current.get(l) ?? "";
352
353
  _((e) => e && e.sentAt === o ? {
353
354
  ...e,
354
355
  response: { content: d }
@@ -361,21 +362,21 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
361
362
  } catch (e) {
362
363
  let t = e;
363
364
  if (t?.name === "TimeoutError") {
364
- E(t.message, { source: "client-timeout" });
365
+ D(t.message, { source: "client-timeout" });
365
366
  return;
366
367
  }
367
368
  if (t?.name === "AbortError") {
368
369
  y("idle");
369
370
  return;
370
371
  }
371
- E(t?.message || "Bailey request failed.");
372
+ D(t?.message || "Bailey request failed.");
372
373
  } finally {
373
374
  P();
374
- let e = M.current.get(l) ?? "";
375
- 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 ? [{
376
377
  ...e,
377
378
  streaming: !1
378
- }] : [] : [e])), D.current = D.current.flatMap((t) => t.id === l ? e ? [{
379
+ }] : [] : [e])), E.current = E.current.flatMap((t) => t.id === l ? e ? [{
379
380
  ...t,
380
381
  content: e,
381
382
  streaming: !1
@@ -406,12 +407,12 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
406
407
  if (!t) return;
407
408
  C.current = t;
408
409
  let n = {
409
- id: j(),
410
+ id: M(),
410
411
  role: "user",
411
412
  content: t,
412
413
  createdAt: Date.now()
413
- }, r = [...D.current, n];
414
- D.current = r, R([...T.current, n]), L(r);
414
+ }, r = [...E.current, n];
415
+ E.current = r, R([...T.current, n]), L(r);
415
416
  }, [L, R]),
416
417
  sendHidden: i((e, t) => {
417
418
  if (v === "streaming") return;
@@ -419,14 +420,14 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
419
420
  if (!n) return;
420
421
  C.current = n;
421
422
  let r = t?.trim(), i = {
422
- id: j(),
423
+ id: M(),
423
424
  role: "user",
424
425
  content: n,
425
426
  createdAt: Date.now(),
426
427
  hidden: !0,
427
428
  ...r ? { titleHint: r } : {}
428
- }, a = [...D.current, i];
429
- D.current = a, L(a);
429
+ }, a = [...E.current, i];
430
+ E.current = a, L(a);
430
431
  }, [L, v]),
431
432
  stop: i(() => {
432
433
  S.current?.abort();
@@ -435,8 +436,8 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
435
436
  if (v === "streaming" || !C.current) return;
436
437
  let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
437
438
  R(n);
438
- let r = D.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
439
- 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);
440
441
  }, [
441
442
  L,
442
443
  R,
@@ -447,7 +448,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
447
448
  x(null), y((e) => e === "error" ? "idle" : e);
448
449
  }, []),
449
450
  newChat: i(() => {
450
- 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 = "";
451
452
  }, [R]),
452
453
  loadMessages: i((e) => {
453
454
  S.current?.abort();
@@ -455,21 +456,21 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
455
456
  ...e,
456
457
  streaming: !1
457
458
  }));
458
- 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 = "";
459
460
  }, [R])
460
461
  };
461
462
  };
462
463
  //#endregion
463
464
  //#region src/utils/prompt.ts
464
- function N(...e) {
465
+ function P(...e) {
465
466
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
466
467
  }
467
468
  //#endregion
468
469
  //#region src/utils/toolCalls.ts
469
- var P = "call_tool", F = "a tool";
470
- function I(e, t) {
470
+ var F = "call_tool", I = "a tool";
471
+ function L(e, t) {
471
472
  let n = {
472
- name: e === P ? F : e,
473
+ name: e === F ? I : e,
473
474
  args: null,
474
475
  viaCallTool: !1
475
476
  };
@@ -482,7 +483,7 @@ function I(e, t) {
482
483
  }
483
484
  if (typeof r != "object" || !r) return n;
484
485
  let i = r;
485
- if (e === P) {
486
+ if (e === F) {
486
487
  let e = typeof i.name == "string" ? i.name : void 0;
487
488
  if (!e) return n;
488
489
  let t = i.arguments;
@@ -500,24 +501,24 @@ function I(e, t) {
500
501
  }
501
502
  //#endregion
502
503
  //#region src/utils/table.ts
503
- 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) => {
504
505
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
505
506
  for (let t of e.children ?? []) {
506
- let e = z(t);
507
+ let e = B(t);
507
508
  if (e) return e;
508
509
  }
509
- }, B = (e, t) => (e.children ?? []).find((e) => e.tagName === t), V = (e) => {
510
- 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);
511
512
  return n ? {
512
513
  text: t,
513
514
  href: n
514
515
  } : { text: t };
515
- }, 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) => {
516
517
  if (e.tagName !== "table") return null;
517
- let t = B(e, "thead"), n = t && B(t, "tr");
518
+ let t = V(e, "thead"), n = t && V(t, "tr");
518
519
  return {
519
520
  headers: n ? H(n).map((e) => e.text) : [],
520
- 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)
521
522
  };
522
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 = [
523
524
  "bar",
@@ -525,7 +526,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
525
526
  "pie",
526
527
  "doughnut",
527
528
  "scatter"
528
- ], 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) => {
529
530
  let t;
530
531
  try {
531
532
  t = JSON.parse(e);
@@ -544,7 +545,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
544
545
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
545
546
  let o = a.datasets;
546
547
  if (r === "scatter") {
547
- 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;
548
549
  return {
549
550
  type: r,
550
551
  title: i,
@@ -552,7 +553,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
552
553
  };
553
554
  }
554
555
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
555
- let s = a.labels, c = r === "pie" || r === "doughnut" ? te : J;
556
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? re : ne;
556
557
  if (s.length < 1 || s.length > c) return null;
557
558
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
558
559
  return {
@@ -563,7 +564,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
563
564
  datasets: o
564
565
  }
565
566
  };
566
- }, ae = {
567
+ }, se = {
567
568
  tool_start: "Tool start",
568
569
  tool_end: "Tool end",
569
570
  pseudo_tool_call: "Narrated tool call",
@@ -574,13 +575,13 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
574
575
  error: "Error",
575
576
  raw: "Raw event"
576
577
  };
577
- function Y(e) {
578
- 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);
579
580
  }
580
- function X(e, t = Y(e)) {
581
+ function Y(e, t = J(e)) {
581
582
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
582
583
  }
583
- function oe(e, t = Y(e)) {
584
+ function ce(e, t = J(e)) {
584
585
  switch (e.kind) {
585
586
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
586
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" : ""}`;
@@ -593,23 +594,23 @@ function oe(e, t = Y(e)) {
593
594
  case "raw": return `Unrecognized event: ${e.eventType}`;
594
595
  }
595
596
  }
596
- function se(e, t = Y(e)) {
597
+ function le(e, t = J(e)) {
597
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;
598
599
  }
599
- function ce(e) {
600
+ function ue(e) {
600
601
  return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
601
602
  }
602
- function le(e) {
603
+ function de(e) {
603
604
  return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
604
605
  }
605
- function ue(e) {
606
+ function fe(e) {
606
607
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
607
608
  }
608
- function Z(e) {
609
+ function X(e) {
609
610
  switch (e.kind) {
610
- case "tool_start": return `Calling ${I(e.name, e.args).name}...`;
611
+ case "tool_start": return `Calling ${L(e.name, e.args).name}...`;
611
612
  case "tool_end": {
612
- let t = I(e.name, e.args).name;
613
+ let t = L(e.name, e.args).name;
613
614
  return e.isError ? `${t} failed` : `${t} returned`;
614
615
  }
615
616
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -621,11 +622,11 @@ function Z(e) {
621
622
  case "raw": return `Unrecognized event: ${e.eventType}`;
622
623
  }
623
624
  }
624
- function de(e) {
625
+ function pe(e) {
625
626
  let t = new Date(e);
626
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")}`;
627
628
  }
628
- function fe(e) {
629
+ function me(e) {
629
630
  if (e <= 0) return "+0ms";
630
631
  if (e < 1e3) return `+${Math.round(e)}ms`;
631
632
  let t = e / 1e3;
@@ -633,31 +634,31 @@ function fe(e) {
633
634
  let n = Math.floor(t / 60), r = Math.round(t % 60);
634
635
  return `+${n}m${String(r).padStart(2, "0")}s`;
635
636
  }
636
- function pe(e) {
637
+ function he(e) {
637
638
  return e.map((t, n) => {
638
- 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;
639
640
  return {
640
641
  key: `${t.at}-${n}`,
641
642
  kind: t.kind,
642
- toolName: X(t, r),
643
+ toolName: Y(t, r),
643
644
  isToolStart: t.kind === "tool_start",
644
645
  failed: t.kind === "tool_end" && t.isError === !0,
645
- time: de(t.at),
646
+ time: pe(t.at),
646
647
  gapMs: t.at - i,
647
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : ae[t.kind],
648
- summary: oe(t, r),
649
- argsDetail: se(t, r),
650
- outputDetail: ce(t),
651
- structuredOutputDetail: le(t),
652
- rawDetail: ue(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)
653
654
  };
654
655
  });
655
656
  }
656
- function me(e) {
657
+ function ge(e) {
657
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 = [];
658
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(" · ");
659
660
  }
660
- function he(e) {
661
+ function _e(e) {
661
662
  let t = [];
662
663
  for (let n of e) {
663
664
  let e = t[t.length - 1];
@@ -676,59 +677,59 @@ function he(e) {
676
677
  }
677
678
  return t;
678
679
  }
679
- function ge(e) {
680
+ function ve(e) {
680
681
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
681
682
  }
682
- function _e(e, t) {
683
+ function ye(e, t) {
683
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) => ({
684
685
  key: `${e.at}-${t}`,
685
- text: Z(e),
686
- toolName: X(e)
686
+ text: X(e),
687
+ toolName: Y(e)
687
688
  }));
688
689
  }
689
690
  //#endregion
690
691
  //#region src/styles.css?inline
691
- var ve = "/*! 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}", ye = n(void 0), be = /:root\s*,\s*:host\s*\{/, xe = ".bailey-chat-panel{";
692
- function Se(e) {
693
- let t = e.match(new RegExp(be, "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;
694
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.`);
695
- return e.replace(be, xe);
696
+ return e.replace(Se, Ce);
696
697
  }
697
- var Ce = Se(ve), we = "data-source", Te = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
698
- function Ee(e) {
698
+ var Te = we(be), Z = "data-source", Ee = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
699
+ function De(e) {
699
700
  let t = e.getRootNode();
700
701
  return t instanceof ShadowRoot ? t : document;
701
702
  }
702
- function De(e) {
703
+ function Oe(e) {
703
704
  let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
704
- if (n === 0 && !t.querySelector(`style[${we}="${Te}"]`)) {
705
+ if (n === 0 && !t.querySelector(`style[${Z}="${Ee}"]`)) {
705
706
  let e = document.createElement("style");
706
- e.setAttribute(we, Te), e.textContent = Ce, t.appendChild(e);
707
+ e.setAttribute(Z, Ee), e.textContent = Te, t.appendChild(e);
707
708
  }
708
709
  return Q.set(e, n + 1), () => {
709
710
  let n = (Q.get(e) ?? 1) - 1;
710
- n <= 0 ? (Q.delete(e), t.querySelector(`style[${we}="${Te}"]`)?.remove()) : Q.set(e, n);
711
+ n <= 0 ? (Q.delete(e), t.querySelector(`style[${Z}="${Ee}"]`)?.remove()) : Q.set(e, n);
711
712
  };
712
713
  }
713
- function Oe(e, t = !1) {
714
+ function ke(e, t = !1) {
714
715
  let [n, r] = u(null);
715
716
  return s(() => {
716
717
  if (t) return;
717
718
  let n = e.current;
718
719
  if (!n) return;
719
- let i = Ee(n);
720
- return r(i), De(i);
720
+ let i = De(n);
721
+ return r(i), Oe(i);
721
722
  }, [t, e]), n;
722
723
  }
723
- function ke(e) {
724
- let t = a(ye), n = t !== void 0, r = Oe(e, n);
724
+ function Ae(e) {
725
+ let t = a(xe), n = t !== void 0, r = ke(e, n);
725
726
  return n ? t : r;
726
727
  }
727
728
  //#endregion
728
729
  //#region src/ui/markdown.tsx
729
- function Ae({ renderTable: t, renderChart: n } = {}) {
730
+ function je({ renderTable: t, renderChart: n } = {}) {
730
731
  return {
731
- 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", {
732
733
  href: t,
733
734
  target: "_blank",
734
735
  rel: "noopener noreferrer",
@@ -738,41 +739,41 @@ function Ae({ renderTable: t, renderChart: n } = {}) {
738
739
  let i = n && U(n);
739
740
  if (i && W(i.rows) && t) {
740
741
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
741
- return /* @__PURE__ */ h(m, { children: t({
742
+ return /* @__PURE__ */ g(h, { children: t({
742
743
  headers: i.headers,
743
744
  rows: n
744
745
  }) });
745
746
  }
746
- return /* @__PURE__ */ h("table", { children: r });
747
+ return /* @__PURE__ */ g("table", { children: r });
747
748
  },
748
749
  pre: ({ children: e }) => {
749
750
  let t = (Array.isArray(e) ? e[0] : e)?.props;
750
751
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
751
- let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
752
- 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) });
753
754
  }
754
- return /* @__PURE__ */ h("pre", { children: e });
755
+ return /* @__PURE__ */ g("pre", { children: e });
755
756
  }
756
757
  };
757
758
  }
758
759
  //#endregion
759
760
  //#region src/ui/icons.tsx
760
- function je({ className: e }) {
761
- return /* @__PURE__ */ h("svg", {
761
+ function Me({ className: e }) {
762
+ return /* @__PURE__ */ g("svg", {
762
763
  viewBox: "0 0 24 24",
763
764
  fill: "currentColor",
764
765
  className: e,
765
766
  "aria-hidden": "true",
766
- 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" })
767
768
  });
768
769
  }
769
- function Me({ className: e }) {
770
- return /* @__PURE__ */ h("svg", {
770
+ function Ne({ className: e }) {
771
+ return /* @__PURE__ */ g("svg", {
771
772
  viewBox: "0 0 24 24",
772
773
  fill: "currentColor",
773
774
  className: e,
774
775
  "aria-hidden": "true",
775
- children: /* @__PURE__ */ h("rect", {
776
+ children: /* @__PURE__ */ g("rect", {
776
777
  x: "6",
777
778
  y: "6",
778
779
  width: "12",
@@ -781,8 +782,8 @@ function Me({ className: e }) {
781
782
  })
782
783
  });
783
784
  }
784
- function Ne({ className: e }) {
785
- return /* @__PURE__ */ g("svg", {
785
+ function Pe({ className: e }) {
786
+ return /* @__PURE__ */ _("svg", {
786
787
  viewBox: "0 0 24 24",
787
788
  fill: "none",
788
789
  stroke: "currentColor",
@@ -791,11 +792,11 @@ function Ne({ className: e }) {
791
792
  strokeLinejoin: "round",
792
793
  className: e,
793
794
  "aria-hidden": "true",
794
- 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" })]
795
796
  });
796
797
  }
797
- function Pe({ className: e }) {
798
- return /* @__PURE__ */ g("svg", {
798
+ function Fe({ className: e }) {
799
+ return /* @__PURE__ */ _("svg", {
799
800
  viewBox: "0 0 24 24",
800
801
  fill: "none",
801
802
  stroke: "currentColor",
@@ -804,17 +805,17 @@ function Pe({ className: e }) {
804
805
  strokeLinejoin: "round",
805
806
  className: e,
806
807
  "aria-hidden": "true",
807
- children: [/* @__PURE__ */ h("rect", {
808
+ children: [/* @__PURE__ */ g("rect", {
808
809
  x: "8",
809
810
  y: "8",
810
811
  width: "12",
811
812
  height: "12",
812
813
  rx: "2"
813
- }), /* @__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" })]
814
815
  });
815
816
  }
816
- function Fe({ className: e }) {
817
- return /* @__PURE__ */ h("svg", {
817
+ function Ie({ className: e }) {
818
+ return /* @__PURE__ */ g("svg", {
818
819
  viewBox: "0 0 24 24",
819
820
  fill: "none",
820
821
  stroke: "currentColor",
@@ -823,11 +824,11 @@ function Fe({ className: e }) {
823
824
  strokeLinejoin: "round",
824
825
  className: e,
825
826
  "aria-hidden": "true",
826
- 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" })
827
828
  });
828
829
  }
829
- function Ie({ className: e }) {
830
- return /* @__PURE__ */ h("svg", {
830
+ function Le({ className: e }) {
831
+ return /* @__PURE__ */ g("svg", {
831
832
  viewBox: "0 0 24 24",
832
833
  fill: "none",
833
834
  stroke: "currentColor",
@@ -836,11 +837,11 @@ function Ie({ className: e }) {
836
837
  strokeLinejoin: "round",
837
838
  className: e,
838
839
  "aria-hidden": "true",
839
- 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" })
840
841
  });
841
842
  }
842
- function Le({ className: e }) {
843
- return /* @__PURE__ */ g("svg", {
843
+ function Re({ className: e }) {
844
+ return /* @__PURE__ */ _("svg", {
844
845
  viewBox: "0 0 24 24",
845
846
  fill: "none",
846
847
  stroke: "currentColor",
@@ -849,29 +850,67 @@ function Le({ className: e }) {
849
850
  strokeLinejoin: "round",
850
851
  className: e,
851
852
  "aria-hidden": "true",
852
- children: [/* @__PURE__ */ h("circle", {
853
+ children: [/* @__PURE__ */ g("circle", {
853
854
  cx: "12",
854
855
  cy: "12",
855
856
  r: "9"
856
- }), /* @__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" })
857
896
  });
858
897
  }
859
898
  //#endregion
860
899
  //#region src/ui/CopyMarkdownButton.tsx
861
- var Re = 1500;
862
- function ze({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
863
- let [a, s] = u(!1), [c, d] = u(!1), f = l(null), m = l(null), _ = ke(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);
864
903
  return o(() => () => {
865
904
  f.current !== null && clearTimeout(f.current);
866
- }, []), /* @__PURE__ */ h(p.Provider, {
905
+ }, []), /* @__PURE__ */ g(m.Provider, {
867
906
  delayDuration: 200,
868
- children: /* @__PURE__ */ g(p.Root, {
907
+ children: /* @__PURE__ */ _(m.Root, {
869
908
  open: a || c,
870
909
  onOpenChange: d,
871
- children: [/* @__PURE__ */ h(p.Trigger, {
910
+ children: [/* @__PURE__ */ g(m.Trigger, {
872
911
  asChild: !0,
873
- children: /* @__PURE__ */ h("button", {
874
- ref: m,
912
+ children: /* @__PURE__ */ g("button", {
913
+ ref: p,
875
914
  type: "button",
876
915
  onClick: async () => {
877
916
  try {
@@ -879,18 +918,18 @@ function ze({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
879
918
  } catch {
880
919
  return;
881
920
  }
882
- s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Re);
921
+ s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Ve);
883
922
  },
884
923
  "aria-label": n,
885
924
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
886
- children: h(a ? Fe : Pe, { className: "bailey-copy-icon" })
925
+ children: g(a ? Ie : Fe, { className: "bailey-copy-icon" })
887
926
  })
888
- }), /* @__PURE__ */ h(p.Portal, {
889
- container: _ instanceof ShadowRoot ? _ : void 0,
890
- children: /* @__PURE__ */ g(p.Content, {
927
+ }), /* @__PURE__ */ g(m.Portal, {
928
+ container: h instanceof ShadowRoot ? h : void 0,
929
+ children: /* @__PURE__ */ _(m.Content, {
891
930
  side: "top",
892
931
  className: "bailey-tooltip-content",
893
- 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" })]
894
933
  })
895
934
  })]
896
935
  })
@@ -898,20 +937,20 @@ function ze({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
898
937
  }
899
938
  //#endregion
900
939
  //#region src/ui/BaileyTracePanel.tsx
901
- async function Be(e) {
940
+ async function Ue(e) {
902
941
  try {
903
942
  await navigator.clipboard.writeText(e);
904
943
  } catch {}
905
944
  }
906
- function Ve({ text: e, label: t = "Copy" }) {
907
- return /* @__PURE__ */ h("button", {
945
+ function We({ text: e, label: t = "Copy" }) {
946
+ return /* @__PURE__ */ g("button", {
908
947
  type: "button",
909
- onClick: () => Be(e),
948
+ onClick: () => Ue(e),
910
949
  className: "bailey-trace-copy-button",
911
950
  children: t
912
951
  });
913
952
  }
914
- function He(e) {
953
+ function Ge(e) {
915
954
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
916
955
  switch (e.kind) {
917
956
  case "tool_start":
@@ -923,76 +962,76 @@ function He(e) {
923
962
  }
924
963
  }
925
964
  function $({ label: e, content: t, copyable: n }) {
926
- return /* @__PURE__ */ g("details", {
965
+ return /* @__PURE__ */ _("details", {
927
966
  className: "bailey-trace-disclosure",
928
967
  children: [
929
- /* @__PURE__ */ h("summary", {
968
+ /* @__PURE__ */ g("summary", {
930
969
  className: "bailey-trace-disclosure-summary",
931
970
  children: e
932
971
  }),
933
- n && /* @__PURE__ */ h("div", {
972
+ n && /* @__PURE__ */ g("div", {
934
973
  className: "bailey-trace-disclosure-actions",
935
- children: /* @__PURE__ */ h(Ve, { text: t })
974
+ children: /* @__PURE__ */ g(We, { text: t })
936
975
  }),
937
- /* @__PURE__ */ h("pre", {
976
+ /* @__PURE__ */ g("pre", {
938
977
  className: "bailey-trace-disclosure-content",
939
978
  children: t
940
979
  })
941
980
  ]
942
981
  });
943
982
  }
944
- function Ue({ row: e }) {
945
- return /* @__PURE__ */ g("div", {
983
+ function Ke({ row: e }) {
984
+ return /* @__PURE__ */ _("div", {
946
985
  className: "bailey-trace-row",
947
986
  children: [
948
- /* @__PURE__ */ g("div", {
987
+ /* @__PURE__ */ _("div", {
949
988
  className: "bailey-trace-row-header",
950
989
  children: [
951
- /* @__PURE__ */ h("span", {
990
+ /* @__PURE__ */ g("span", {
952
991
  className: "bailey-trace-row-time",
953
992
  children: e.time
954
993
  }),
955
- /* @__PURE__ */ h("span", {
994
+ /* @__PURE__ */ g("span", {
956
995
  className: "bailey-trace-row-gap",
957
996
  title: "Time since the previous event",
958
- children: fe(e.gapMs)
997
+ children: me(e.gapMs)
959
998
  }),
960
- /* @__PURE__ */ h("span", {
961
- className: He(e),
999
+ /* @__PURE__ */ g("span", {
1000
+ className: Ge(e),
962
1001
  children: e.label
963
1002
  }),
964
- /* @__PURE__ */ h("span", {
1003
+ /* @__PURE__ */ g("span", {
965
1004
  className: "bailey-trace-row-summary",
966
1005
  children: e.summary
967
1006
  })
968
1007
  ]
969
1008
  }),
970
- e.argsDetail && /* @__PURE__ */ h($, {
1009
+ e.argsDetail && /* @__PURE__ */ g($, {
971
1010
  label: e.kind === "llm_call_start" ? "request" : "args",
972
1011
  content: e.argsDetail
973
1012
  }),
974
- e.outputDetail && /* @__PURE__ */ h($, {
1013
+ e.outputDetail && /* @__PURE__ */ g($, {
975
1014
  label: e.kind === "llm_call_end" ? "response" : "output",
976
1015
  content: e.outputDetail
977
1016
  }),
978
- e.structuredOutputDetail && /* @__PURE__ */ h($, {
1017
+ e.structuredOutputDetail && /* @__PURE__ */ g($, {
979
1018
  label: "structured output",
980
1019
  content: e.structuredOutputDetail
981
1020
  }),
982
- e.rawDetail && /* @__PURE__ */ h($, {
1021
+ e.rawDetail && /* @__PURE__ */ g($, {
983
1022
  label: "raw",
984
1023
  content: e.rawDetail
985
1024
  })
986
1025
  ]
987
1026
  });
988
1027
  }
989
- function We(e, t) {
1028
+ function qe(e, t) {
990
1029
  if (e.chunkCount === 0) return "Streamed: no chunks received";
991
1030
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
992
1031
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
993
1032
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
994
1033
  }
995
- function Ge({ request: e }) {
1034
+ function Je({ request: e }) {
996
1035
  let t = c(() => JSON.stringify({
997
1036
  model: e.model,
998
1037
  instructions: e.systemPrompt,
@@ -1001,10 +1040,10 @@ function Ge({ request: e }) {
1001
1040
  tools: e.tools,
1002
1041
  toolChoice: e.toolChoice
1003
1042
  }, null, 2), [e]);
1004
- return /* @__PURE__ */ g("div", {
1043
+ return /* @__PURE__ */ _("div", {
1005
1044
  className: "bailey-trace-request-details",
1006
1045
  children: [
1007
- /* @__PURE__ */ g("span", {
1046
+ /* @__PURE__ */ _("span", {
1008
1047
  className: "bailey-trace-request-meta",
1009
1048
  children: [
1010
1049
  "Last request — ",
@@ -1014,26 +1053,26 @@ function Ge({ request: e }) {
1014
1053
  e.requestId ? ` · ${e.requestId}` : ""
1015
1054
  ]
1016
1055
  }),
1017
- /* @__PURE__ */ h("span", {
1056
+ /* @__PURE__ */ g("span", {
1018
1057
  className: "bailey-trace-request-meta",
1019
- children: We(e.streamStats, e.sentAt)
1058
+ children: qe(e.streamStats, e.sentAt)
1020
1059
  }),
1021
- /* @__PURE__ */ h($, {
1060
+ /* @__PURE__ */ g($, {
1022
1061
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
1023
1062
  content: e.systemPrompt,
1024
1063
  copyable: !0
1025
1064
  }),
1026
- /* @__PURE__ */ h($, {
1065
+ /* @__PURE__ */ g($, {
1027
1066
  label: `Messages (${e.messages.length})`,
1028
1067
  content: JSON.stringify(e.messages, null, 2),
1029
1068
  copyable: !0
1030
1069
  }),
1031
- e.response && /* @__PURE__ */ h($, {
1070
+ e.response && /* @__PURE__ */ g($, {
1032
1071
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1033
1072
  content: e.response.content,
1034
1073
  copyable: !0
1035
1074
  }),
1036
- /* @__PURE__ */ h($, {
1075
+ /* @__PURE__ */ g($, {
1037
1076
  label: "Full payload (JSON)",
1038
1077
  content: t,
1039
1078
  copyable: !0
@@ -1041,43 +1080,43 @@ function Ge({ request: e }) {
1041
1080
  ]
1042
1081
  });
1043
1082
  }
1044
- function Ke({ events: e, lastRequest: t, onClear: n }) {
1045
- let r = c(() => pe(e), [e]), i = c(() => he(r), [r]), a = c(() => JSON.stringify(e, null, 2), [e]);
1046
- 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", {
1047
1086
  className: "bailey-trace-body",
1048
1087
  children: [
1049
- /* @__PURE__ */ g("div", {
1088
+ /* @__PURE__ */ _("div", {
1050
1089
  className: "bailey-trace-actions-row",
1051
- children: [e.length > 0 && /* @__PURE__ */ h(Ve, {
1090
+ children: [e.length > 0 && /* @__PURE__ */ g(We, {
1052
1091
  text: a,
1053
1092
  label: "Copy trace as JSON"
1054
- }), /* @__PURE__ */ h("button", {
1093
+ }), /* @__PURE__ */ g("button", {
1055
1094
  type: "button",
1056
1095
  onClick: n,
1057
1096
  className: "bailey-trace-copy-button",
1058
1097
  children: "Clear"
1059
1098
  })]
1060
1099
  }),
1061
- t && /* @__PURE__ */ h(Ge, { request: t }),
1062
- /* @__PURE__ */ h("div", {
1100
+ t && /* @__PURE__ */ g(Je, { request: t }),
1101
+ /* @__PURE__ */ g("div", {
1063
1102
  className: "bailey-trace-rows",
1064
1103
  children: i.map((e, t) => {
1065
- if (e.type === "single") return /* @__PURE__ */ h(Ue, { row: e.row }, e.row.key);
1104
+ if (e.type === "single") return /* @__PURE__ */ g(Ke, { row: e.row }, e.row.key);
1066
1105
  let n = e.rows.filter((e) => e.isToolStart).length;
1067
- if (n <= 1) return /* @__PURE__ */ h("div", {
1106
+ if (n <= 1) return /* @__PURE__ */ g("div", {
1068
1107
  className: "bailey-trace-rows",
1069
- children: e.rows.map((e) => /* @__PURE__ */ h(Ue, { row: e }, e.key))
1108
+ children: e.rows.map((e) => /* @__PURE__ */ g(Ke, { row: e }, e.key))
1070
1109
  }, `group-${t}`);
1071
1110
  let r = e.rows.filter((e) => e.failed).length;
1072
- return /* @__PURE__ */ g("details", {
1111
+ return /* @__PURE__ */ _("details", {
1073
1112
  className: "bailey-trace-group",
1074
- children: [/* @__PURE__ */ g("summary", {
1113
+ children: [/* @__PURE__ */ _("summary", {
1075
1114
  className: "bailey-trace-group-summary",
1076
1115
  children: [
1077
- /* @__PURE__ */ h("strong", { children: e.toolName }),
1116
+ /* @__PURE__ */ g("strong", { children: e.toolName }),
1078
1117
  " × ",
1079
1118
  n,
1080
- r > 0 && /* @__PURE__ */ g("span", {
1119
+ r > 0 && /* @__PURE__ */ _("span", {
1081
1120
  className: "bailey-trace-group-failed",
1082
1121
  children: [
1083
1122
  " ",
@@ -1086,9 +1125,9 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1086
1125
  ]
1087
1126
  })
1088
1127
  ]
1089
- }), /* @__PURE__ */ h("div", {
1128
+ }), /* @__PURE__ */ g("div", {
1090
1129
  className: "bailey-trace-rows",
1091
- children: e.rows.map((e) => /* @__PURE__ */ h(Ue, { row: e }, e.key))
1130
+ children: e.rows.map((e) => /* @__PURE__ */ g(Ke, { row: e }, e.key))
1092
1131
  })]
1093
1132
  }, `group-${t}`);
1094
1133
  })
@@ -1096,13 +1135,13 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1096
1135
  ]
1097
1136
  });
1098
1137
  }
1099
- function qe({ events: e, lastRequest: t, onClear: n }) {
1100
- let [r, i] = u(!1), a = c(() => ge(e), [e]), o = c(() => me(e), [e]);
1101
- 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", {
1102
1141
  className: "bailey-trace-panel",
1103
- children: [/* @__PURE__ */ g("div", {
1142
+ children: [/* @__PURE__ */ _("div", {
1104
1143
  className: "bailey-trace-toggle-row",
1105
- children: [/* @__PURE__ */ g("button", {
1144
+ children: [/* @__PURE__ */ _("button", {
1106
1145
  type: "button",
1107
1146
  onClick: () => i((e) => !e),
1108
1147
  "aria-expanded": r,
@@ -1114,11 +1153,11 @@ function qe({ events: e, lastRequest: t, onClear: n }) {
1114
1153
  e.length,
1115
1154
  ")"
1116
1155
  ]
1117
- }), o && /* @__PURE__ */ h("span", {
1156
+ }), o && /* @__PURE__ */ g("span", {
1118
1157
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
1119
1158
  children: o
1120
1159
  })]
1121
- }), r && /* @__PURE__ */ h(Ke, {
1160
+ }), r && /* @__PURE__ */ g(Ye, {
1122
1161
  events: e,
1123
1162
  lastRequest: t,
1124
1163
  onClear: n
@@ -1127,8 +1166,8 @@ function qe({ events: e, lastRequest: t, onClear: n }) {
1127
1166
  }
1128
1167
  //#endregion
1129
1168
  //#region src/ui/ToolResultImage.tsx
1130
- function Je({ src: e, alt: n, className: r }) {
1131
- return t(e) ? /* @__PURE__ */ h("img", {
1169
+ function Ze({ src: e, alt: n, className: r }) {
1170
+ return t(e) ? /* @__PURE__ */ g("img", {
1132
1171
  src: e,
1133
1172
  alt: n ?? "",
1134
1173
  className: `bailey-tool-result-image${r ? ` ${r}` : ""}`,
@@ -1137,10 +1176,12 @@ function Je({ src: e, alt: n, className: r }) {
1137
1176
  }
1138
1177
  //#endregion
1139
1178
  //#region src/ui/BaileyChatPanel.tsx
1140
- var Ye = "How can bailey AI help you today?", Xe = "Reply to bailey AI", Ze = {
1179
+ var Qe = "How can bailey AI help you today?", $e = "Reply to bailey AI", et = {
1141
1180
  newChatButtonText: "New chat",
1142
1181
  newChatAriaLabel: "new chat",
1143
1182
  historyAriaLabel: "conversation history",
1183
+ historyMenuItemText: "Chat history",
1184
+ menuAriaLabel: "more options",
1144
1185
  suggestionsTitle: "Suggested for you",
1145
1186
  emptyStateMessage: "Ask Bailey a question to get started.",
1146
1187
  youLabel: "You",
@@ -1153,44 +1194,44 @@ var Ye = "How can bailey AI help you today?", Xe = "Reply to bailey AI", Ze = {
1153
1194
  copyButtonAriaLabel: "copy response as markdown",
1154
1195
  copyButtonTooltipDefault: "Copy as markdown",
1155
1196
  copyButtonTooltipCopied: "Copied!"
1156
- }, Qe = [f], $e = {
1157
- ...Ae(),
1158
- p: ({ children: e }) => /* @__PURE__ */ h(m, { children: e })
1159
- }, et = r(function({ content: e, components: t }) {
1160
- 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", {
1161
1202
  className: "bailey-markdown-content",
1162
- children: /* @__PURE__ */ h(d, {
1163
- remarkPlugins: Qe,
1203
+ children: /* @__PURE__ */ g(d, {
1204
+ remarkPlugins: tt,
1164
1205
  components: t,
1165
1206
  skipHtml: !0,
1166
1207
  children: e
1167
1208
  })
1168
1209
  });
1169
1210
  });
1170
- function tt(e, t, n) {
1211
+ function it(e, t, n) {
1171
1212
  if (e !== "streaming") return;
1172
1213
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
1173
- if (r.length !== 0) return Z(r[r.length - 1]);
1214
+ if (r.length !== 0) return X(r[r.length - 1]);
1174
1215
  }
1175
- function nt(e) {
1216
+ function at(e) {
1176
1217
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
1177
1218
  hour: "numeric",
1178
1219
  minute: "2-digit"
1179
1220
  });
1180
1221
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
1181
1222
  }
1182
- function rt({ chat: e, placeholder: t, replyPlaceholder: n = Xe, 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 }) {
1183
- 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 = {
1184
- ...Ze,
1185
- ...C
1186
- }, R = w ?? nt, z = l(null), B = Oe(z), V = l(null), H = l(null), U = l(!0), W = c(() => Ae({
1187
- renderTable: x,
1188
- renderChart: S
1189
- }), [x, S]), G = c(() => tt(O, E, D), [
1190
- O,
1191
- E,
1192
- D
1193
- ]), K = T.length === 0, q = t ?? (K ? r ?? Ye : 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);
1194
1235
  o(() => {
1195
1236
  let e = H.current;
1196
1237
  if (!e) return;
@@ -1200,187 +1241,199 @@ function rt({ chat: e, placeholder: t, replyPlaceholder: n = Xe, emptyPlaceholde
1200
1241
  };
1201
1242
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1202
1243
  }, []), o(() => {
1203
- U.current && V.current?.scrollIntoView({
1204
- behavior: O === "streaming" ? "auto" : "smooth",
1244
+ U.current && te.current?.scrollIntoView({
1245
+ behavior: k === "streaming" ? "auto" : "smooth",
1205
1246
  block: "nearest"
1206
1247
  });
1207
- }, [T, O]);
1208
- let J = (e) => {
1209
- U.current = !0, A(e);
1248
+ }, [E, k]);
1249
+ let ne = (e) => {
1250
+ U.current = !0, j(e);
1210
1251
  };
1211
- return /* @__PURE__ */ h(ye.Provider, {
1212
- value: B,
1213
- children: /* @__PURE__ */ h("div", {
1214
- ref: z,
1215
- className: `bailey-chat-panel${m ? ` ${m}` : ""}`,
1216
- style: _ !== void 0 || v !== void 0 ? {
1217
- height: _,
1218
- 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
1219
1260
  } : void 0,
1220
- children: /* @__PURE__ */ g("div", {
1261
+ children: /* @__PURE__ */ _("div", {
1221
1262
  className: "bailey-chat-panel-inner",
1222
1263
  children: [
1223
- /* @__PURE__ */ g("div", {
1224
- className: "bailey-toolbar-row",
1225
- children: [!K && /* @__PURE__ */ h("button", {
1226
- type: "button",
1227
- onClick: P,
1228
- "aria-label": L.newChatAriaLabel,
1229
- className: "bailey-new-chat-button",
1230
- children: L.newChatButtonText
1231
- }), a && /* @__PURE__ */ h("button", {
1232
- type: "button",
1233
- onClick: a,
1234
- "aria-label": L.historyAriaLabel,
1235
- className: "bailey-history-button",
1236
- children: /* @__PURE__ */ h(Ie, { className: "bailey-history-icon" })
1237
- })]
1238
- }),
1239
- /* @__PURE__ */ g("div", {
1264
+ /* @__PURE__ */ _("div", {
1240
1265
  className: "bailey-chat-transcript",
1241
1266
  ref: H,
1242
1267
  children: [
1243
- K && (i && i.length > 0 ? /* @__PURE__ */ g("div", {
1268
+ K && (i && i.length > 0 ? /* @__PURE__ */ _("div", {
1244
1269
  className: "bailey-suggestions",
1245
- children: [/* @__PURE__ */ h("div", {
1270
+ children: [/* @__PURE__ */ g("div", {
1246
1271
  className: "bailey-suggestions-title",
1247
- children: L.suggestionsTitle
1248
- }), i.map((e, t) => /* @__PURE__ */ g("button", {
1272
+ children: R.suggestionsTitle
1273
+ }), i.map((e, t) => /* @__PURE__ */ _("button", {
1249
1274
  type: "button",
1250
- onClick: () => J(e.value ?? e.label),
1275
+ onClick: () => ne(e.value ?? e.label),
1251
1276
  className: "bailey-suggestion-card",
1252
- children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ h(Ne, { className: "bailey-suggestion-icon" })]
1277
+ children: [/* @__PURE__ */ g("span", { children: e.label }), /* @__PURE__ */ g(Pe, { className: "bailey-suggestion-icon" })]
1253
1278
  }, `${e.label}-${t}`))]
1254
- }) : /* @__PURE__ */ h("div", {
1279
+ }) : /* @__PURE__ */ g("div", {
1255
1280
  className: "bailey-empty-state",
1256
- children: L.emptyStateMessage
1281
+ children: R.emptyStateMessage
1257
1282
  })),
1258
- T.map((e, t) => {
1259
- let n = e.role === "assistant" && t === T.length - 1, r = O === "streaming" && n && e.content === "", i = e.role === "assistant" && !r ? _e(E, e.createdAt) : [], a = i[i.length - 1];
1260
- 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", {
1261
1286
  className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
1262
- children: e.role === "user" ? /* @__PURE__ */ g("div", {
1287
+ children: e.role === "user" ? /* @__PURE__ */ _("div", {
1263
1288
  className: "bailey-user-message",
1264
- children: [/* @__PURE__ */ g("div", {
1289
+ children: [/* @__PURE__ */ _("div", {
1265
1290
  className: "bailey-message-meta",
1266
- children: [/* @__PURE__ */ h("span", {
1291
+ children: [/* @__PURE__ */ g("span", {
1267
1292
  className: "bailey-message-meta-name",
1268
- children: L.youLabel
1269
- }), e.createdAt !== void 0 && /* @__PURE__ */ h("span", { children: R(e.createdAt) })]
1270
- }), /* @__PURE__ */ h("div", {
1293
+ children: R.youLabel
1294
+ }), e.createdAt !== void 0 && /* @__PURE__ */ g("span", { children: z(e.createdAt) })]
1295
+ }), /* @__PURE__ */ g("div", {
1271
1296
  className: "bailey-user-bubble",
1272
1297
  children: e.content
1273
1298
  })]
1274
- }) : r ? /* @__PURE__ */ h("div", {
1299
+ }) : r ? /* @__PURE__ */ g("div", {
1275
1300
  className: "bailey-thinking-hint",
1276
- children: G ?? L.thinkingHint
1277
- }) : /* @__PURE__ */ g("div", {
1301
+ children: G ?? R.thinkingHint
1302
+ }) : /* @__PURE__ */ _("div", {
1278
1303
  className: "bailey-assistant-message",
1279
1304
  children: [
1280
- a && /* @__PURE__ */ g("div", {
1305
+ a && /* @__PURE__ */ _("div", {
1281
1306
  className: "bailey-activity-line",
1282
- children: [/* @__PURE__ */ h("span", {
1307
+ children: [/* @__PURE__ */ g("span", {
1283
1308
  className: "bailey-activity-icon",
1284
- children: f?.(a.toolName) ?? /* @__PURE__ */ h(Le, {})
1285
- }), /* @__PURE__ */ h("span", { children: a.text })]
1309
+ children: f?.(a.toolName) ?? /* @__PURE__ */ g(Re, {})
1310
+ }), /* @__PURE__ */ g("span", { children: a.text })]
1286
1311
  }),
1287
- /* @__PURE__ */ h(et, {
1312
+ /* @__PURE__ */ g(rt, {
1288
1313
  content: e.content,
1289
1314
  components: W
1290
1315
  }),
1291
- e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ h(Je, {
1316
+ e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ g(Ze, {
1292
1317
  src: e.src,
1293
1318
  alt: e.alt
1294
1319
  }, t) : null),
1295
- e.streaming && G && /* @__PURE__ */ h("div", {
1320
+ e.streaming && G && /* @__PURE__ */ g("div", {
1296
1321
  className: "bailey-streaming-hint",
1297
1322
  children: G
1298
1323
  }),
1299
- !e.streaming && /* @__PURE__ */ g("div", {
1324
+ !e.streaming && /* @__PURE__ */ _("div", {
1300
1325
  className: "bailey-message-actions",
1301
- children: [/* @__PURE__ */ h(ze, {
1326
+ children: [/* @__PURE__ */ g(He, {
1302
1327
  markdown: e.content,
1303
- ariaLabel: L.copyButtonAriaLabel,
1304
- tooltipDefaultText: L.copyButtonTooltipDefault,
1305
- tooltipCopiedText: L.copyButtonTooltipCopied
1306
- }), b?.(e)]
1328
+ ariaLabel: R.copyButtonAriaLabel,
1329
+ tooltipDefaultText: R.copyButtonTooltipDefault,
1330
+ tooltipCopiedText: R.copyButtonTooltipCopied
1331
+ }), x?.(e)]
1307
1332
  })
1308
1333
  ]
1309
1334
  })
1310
1335
  }, e.id);
1311
1336
  }),
1312
- /* @__PURE__ */ h("div", { ref: V })
1337
+ /* @__PURE__ */ g("div", { ref: te })
1313
1338
  ]
1314
1339
  }),
1315
- k && /* @__PURE__ */ g("div", {
1340
+ A && /* @__PURE__ */ _("div", {
1316
1341
  className: "bailey-error-banner",
1317
1342
  role: "alert",
1318
- children: [/* @__PURE__ */ h("span", { children: k }), /* @__PURE__ */ g("div", {
1343
+ children: [/* @__PURE__ */ g("span", { children: A }), /* @__PURE__ */ _("div", {
1319
1344
  className: "bailey-error-actions",
1320
- children: [/* @__PURE__ */ h("button", {
1345
+ children: [/* @__PURE__ */ g("button", {
1321
1346
  type: "button",
1322
1347
  onClick: ee,
1323
1348
  className: "bailey-retry-button",
1324
- children: L.retryButtonText
1325
- }), /* @__PURE__ */ h("button", {
1349
+ children: R.retryButtonText
1350
+ }), /* @__PURE__ */ g("button", {
1326
1351
  type: "button",
1327
- onClick: N,
1328
- "aria-label": L.dismissErrorAriaLabel,
1352
+ onClick: P,
1353
+ "aria-label": R.dismissErrorAriaLabel,
1329
1354
  className: "bailey-dismiss-button",
1330
1355
  children: "✕"
1331
1356
  })]
1332
1357
  })]
1333
1358
  }),
1334
- !y && /* @__PURE__ */ h(qe, {
1335
- events: E,
1336
- lastRequest: D,
1337
- onClear: M
1359
+ !b && /* @__PURE__ */ g(Xe, {
1360
+ events: D,
1361
+ lastRequest: O,
1362
+ onClear: N
1338
1363
  }),
1339
- /* @__PURE__ */ g("form", {
1340
- onSubmit: (e) => {
1341
- e.preventDefault(), !(!F.trim() || O === "streaming") && (J(F), I(""));
1342
- },
1343
- className: "bailey-input-row",
1344
- children: [/* @__PURE__ */ h("input", {
1345
- type: "text",
1346
- placeholder: q,
1347
- "aria-label": q,
1348
- value: F,
1349
- onChange: (e) => I(e.target.value),
1350
- disabled: O === "streaming",
1351
- className: "bailey-input"
1352
- }), O === "streaming" ? /* @__PURE__ */ h(p.Provider, {
1353
- delayDuration: 200,
1354
- children: /* @__PURE__ */ g(p.Root, { children: [/* @__PURE__ */ h(p.Trigger, {
1355
- asChild: !0,
1356
- children: /* @__PURE__ */ h("button", {
1357
- type: "button",
1358
- onClick: j,
1359
- "aria-label": L.stopAriaLabel,
1360
- className: "bailey-stop-button",
1361
- children: /* @__PURE__ */ h(Me, { className: "bailey-stop-icon" })
1362
- })
1363
- }), /* @__PURE__ */ h(p.Portal, {
1364
- container: B instanceof ShadowRoot ? B : void 0,
1365
- children: /* @__PURE__ */ g(p.Content, {
1366
- side: "top",
1367
- className: "bailey-tooltip-content",
1368
- children: [L.stopButtonText, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
1369
- })
1370
- })] })
1371
- }) : /* @__PURE__ */ h("button", {
1372
- type: "submit",
1373
- "aria-label": L.sendAriaLabel,
1374
- disabled: !F.trim(),
1375
- className: "bailey-send-button",
1376
- children: /* @__PURE__ */ h(je, { className: "bailey-send-icon" })
1377
- })]
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
+ })] })]
1378
1431
  }),
1379
- (K || s?.alwaysVisible) && s && /* @__PURE__ */ h("div", {
1432
+ (K || s?.alwaysVisible) && s && /* @__PURE__ */ g("div", {
1380
1433
  className: "bailey-privacy-note",
1381
- children: /* @__PURE__ */ h(d, {
1382
- remarkPlugins: Qe,
1383
- components: $e,
1434
+ children: /* @__PURE__ */ g(d, {
1435
+ remarkPlugins: tt,
1436
+ components: nt,
1384
1437
  skipHtml: !0,
1385
1438
  children: s.markdown
1386
1439
  })
@@ -1392,6 +1445,6 @@ function rt({ chat: e, placeholder: t, replyPlaceholder: n = Xe, emptyPlaceholde
1392
1445
  }
1393
1446
  //#endregion
1394
1447
  //#region src/index.ts
1395
- var it = "0.3.1-pre.2";
1448
+ var st = "0.3.1-pre.2";
1396
1449
  //#endregion
1397
- export { Le as ActivityIcon, Ne as ArrowUpRightIcon, it as BAILEYAI_CHAT_UI_VERSION, G as BAILEY_CHART_PROMPT_FRAGMENT, L as BAILEY_TABLE_GRID_ROW_THRESHOLD, rt as BaileyChatPanel, qe as BaileyTracePanel, ze as CopyMarkdownButton, je as HeartIcon, ae as TRACE_KIND_LABEL, Ae as createBaileyMarkdownComponents, E as extractPseudoToolCalls, U as extractTableData, fe as formatTraceGap, de as formatTraceTime, ge as hasTraceFailure, e as isSafeMarkdownUrl, N as joinInstructions, ie as parseBaileyChartSpec, O as parseSseFrames, I as resolveToolCall, W as shouldUseGrid, _e as toActivityLines, pe as toTraceRows, he as toTraceSegments, se as traceEventArgsDetail, Z as traceEventHint, ce as traceEventOutputDetail, ue as traceEventRawDetail, oe as traceEventSummary, X as traceEventToolName, me 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 };