@icanbwell/baileyai-chat-ui 1.0.11 → 1.0.14

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.
@@ -1,27 +1,28 @@
1
1
  import { n as e, t } from "./safeMarkdownUrl-Bqv6Q4u1.js";
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
- import d from "react-markdown";
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";
2
+ import { Fragment as n, createContext as r, memo as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
+ import f from "react-markdown";
4
+ import p from "remark-gfm";
5
+ import * as m from "@radix-ui/react-dropdown-menu";
6
+ import * as h from "@radix-ui/react-tooltip";
7
+ import { Fragment as g, jsx as _, jsxs as v } 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 y = "search_tools|call_tool|function_calls|function_result", b = RegExp(`<(${y})>([\\s\\S]*?)<\\/\\1>`, "g"), x = RegExp(`<(?:${y})>[\\s\\S]*$`), S = /<name>([\s\S]*?)<\/name>/, C = /<arguments>([\s\S]*?)<\/arguments>/, w = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, T = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
10
+ function E(e) {
11
+ let t = S.exec(e)?.[1]?.trim() || "unknown_tool", n = C.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 D(e) {
17
18
  let t = [];
18
- S.lastIndex = 0;
19
+ w.lastIndex = 0;
19
20
  let n;
20
- for (; (n = S.exec(e)) !== null;) {
21
+ for (; (n = w.exec(e)) !== null;) {
21
22
  let [, e, r] = n, i = {};
22
- C.lastIndex = 0;
23
+ T.lastIndex = 0;
23
24
  let a;
24
- for (; (a = C.exec(r)) !== null;) i[a[1]] = a[2].trim();
25
+ for (; (a = T.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 O(e, t = {}) {
35
+ let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(b, (e, t, n) => (t === "call_tool" ? r.push(E(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(...D(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(x, "") : 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 k(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 A(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 = k(c.delta);
91
92
  e && r.push({
92
93
  type: "response.output_text.delta",
93
94
  delta: e
@@ -105,38 +106,38 @@ 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 j = 200, M = 15e4, N = () => 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 }) => {
113
- 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
- o(() => {
112
+ return i ? `${r} ${i.length > j ? `${i.slice(0, j)}…` : i}` : r;
113
+ }, P = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i, firstUserMessagePrefix: o, onAssistantMessageComplete: c, idleTimeoutMs: l = M }) => {
114
+ let [f, p] = d([]), [m, h] = d([]), [g, _] = d(null), [v, y] = d("idle"), [b, x] = d(null), S = u(null), C = u(""), w = u(0), T = u([]);
115
+ s(() => {
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
- N.current !== null && (clearTimeout(N.current), N.current = null);
119
- }, []), F = i((e) => {
120
- P(), N.current = setTimeout(() => {
118
+ let E = u([]), D = u(/* @__PURE__ */ new Map()), k = u(/* @__PURE__ */ new Map()), j = u(null), P = a(() => {
119
+ j.current !== null && (clearTimeout(j.current), j.current = null);
120
+ }, []), F = a((e) => {
121
+ P(), j.current = setTimeout(() => {
121
122
  e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
122
- }, d);
123
- }, [P, d]);
124
- o(() => () => {
123
+ }, l);
124
+ }, [P, l]);
125
+ s(() => () => {
125
126
  S.current?.abort(), P();
126
127
  }, [P]);
127
- let I = i((e, t, n) => {
128
+ let I = a((e, t, n) => {
128
129
  let r = (e) => {
129
130
  n.push(e), h((t) => [...t, e]);
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 = D.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 } = O(n.raw), o = i.trim(), s = a.slice(n.emittedCount);
140
+ if (n.emittedCount = a.length, D.current.set(e, n), k.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) {
@@ -167,13 +168,17 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
167
168
  name: a,
168
169
  args: n.arguments,
169
170
  at: e,
170
- turnSentAt: i
171
+ turnSentAt: i,
172
+ callId: n.call_id,
173
+ displayName: n.display_name
171
174
  } : {
172
175
  kind: "tool_end",
173
176
  name: a,
174
177
  args: n.arguments,
175
178
  at: e,
176
179
  turnSentAt: i,
180
+ callId: n.call_id,
181
+ displayName: n.display_name,
177
182
  output: n.output,
178
183
  isError: n.is_error,
179
184
  runtimeSeconds: n.runtime_seconds,
@@ -205,43 +210,68 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
205
210
  }), !0;
206
211
  if (t.type === "response.output_text.done" || t.type === "response.created") return !1;
207
212
  if (t.type === "response.completed") {
208
- let t = k.current.get(e);
213
+ let t = D.current.get(e);
209
214
  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 ? {
215
+ let { cleanedText: n } = O(t.raw, { hideOpenBlock: !1 }), r = n.trim();
216
+ r !== k.current.get(e) && (k.current.set(e, r), p((t) => t.map((t) => t.id === e ? {
212
217
  ...t,
213
218
  content: r
214
219
  } : t)));
215
220
  }
216
221
  return !1;
217
222
  }
218
- return t.type === "info" ? (r({
223
+ if (t.type === "info") return r({
219
224
  kind: "info",
220
225
  message: t.message,
221
226
  at: Date.now(),
222
227
  turnSentAt: w.current
223
- }), !0) : (r({
228
+ }), !0;
229
+ if (t.type === "mcp_app") {
230
+ let n = t.resourceUri;
231
+ if (!n) return r({
232
+ kind: "raw",
233
+ eventType: t.type,
234
+ raw: JSON.stringify(t),
235
+ at: Date.now(),
236
+ turnSentAt: w.current
237
+ }), !0;
238
+ let { html: i, title: a, csp: o, permissions: s, prefersBorder: c, displayMode: l } = t;
239
+ return p((t) => t.map((t) => t.id === e ? {
240
+ ...t,
241
+ parts: [...t.parts ?? [], {
242
+ type: "mcp_app",
243
+ html: i,
244
+ title: a,
245
+ resourceUri: n,
246
+ csp: o,
247
+ permissions: s,
248
+ prefersBorder: c,
249
+ displayMode: l
250
+ }]
251
+ } : t)), !0;
252
+ }
253
+ return r({
224
254
  kind: "raw",
225
255
  eventType: t.type,
226
256
  raw: JSON.stringify(t),
227
257
  at: Date.now(),
228
258
  turnSentAt: w.current
229
- }), !0);
230
- }, []), L = i(async (i) => {
259
+ }), !0;
260
+ }, []), L = a(async (a) => {
231
261
  y("streaming"), x(null);
232
- let o = Date.now();
233
- w.current = o;
234
- let l = j(), u = {
262
+ let s = Date.now();
263
+ w.current = s;
264
+ let l = N(), u = {
235
265
  id: l,
236
266
  role: "assistant",
237
267
  content: "",
238
268
  streaming: !0,
239
- createdAt: o
269
+ createdAt: s
240
270
  };
241
- p((e) => [...e, u]), D.current = [...i, u];
242
- let d = i.findIndex((e) => e.role === "user" && !e.hidden), f = i.map((e, t) => t === d && s ? {
271
+ p((e) => [...e, u]), E.current = [...a, u];
272
+ let d = a.findIndex((e) => e.role === "user" && !e.hidden), f = a.map((e, t) => t === d && o ? {
243
273
  role: e.role,
244
- content: `${s}${e.content}`,
274
+ content: `${o}${e.content}`,
245
275
  hidden: e.hidden,
246
276
  titleHint: e.titleHint
247
277
  } : {
@@ -255,9 +285,9 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
255
285
  systemPrompt: n,
256
286
  messages: f,
257
287
  tools: r,
258
- toolChoice: a,
288
+ toolChoice: i,
259
289
  stream: !0,
260
- sentAt: o,
290
+ sentAt: s,
261
291
  streamStats: {
262
292
  chunkCount: 0,
263
293
  firstChunkAt: null,
@@ -266,17 +296,17 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
266
296
  });
267
297
  let m = new AbortController();
268
298
  S.current = m, F(m);
269
- let g = "", v = null, b = !1, C = !1, T = [], E = (e, t) => {
299
+ let g = "", v = null, b = !1, C = !1, T = [], O = (e, t) => {
270
300
  y("error"), x(e);
271
301
  let n = {
272
302
  kind: "error",
273
303
  message: e,
274
304
  at: Date.now(),
275
- turnSentAt: o,
305
+ turnSentAt: s,
276
306
  ...t
277
307
  };
278
308
  T.push(n), h((e) => [...e, n]);
279
- }, A = (e, t) => {
309
+ }, j = (e, t) => {
280
310
  e.forEach((e) => {
281
311
  if (e.type === "error") {
282
312
  v = e.message;
@@ -284,7 +314,7 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
284
314
  kind: "error",
285
315
  message: e.message,
286
316
  at: Date.now(),
287
- turnSentAt: o
317
+ turnSentAt: s
288
318
  };
289
319
  T.push(t), h((e) => [...e, t]);
290
320
  return;
@@ -296,19 +326,19 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
296
326
  } : e));
297
327
  };
298
328
  try {
299
- let { status: i, text: s, errorMessage: u } = await e.streamChat({
329
+ let { status: a, text: o, errorMessage: u } = await e.streamChat({
300
330
  model: t,
301
331
  instructions: n,
302
332
  input: f,
303
333
  tools: r,
304
- toolChoice: a,
334
+ toolChoice: i,
305
335
  signal: m.signal,
306
336
  onChunk: (e) => {
307
337
  F(m), g += e;
308
- let { events: t, remainder: n, done: r } = O(g);
309
- g = n, A(t, r);
338
+ let { events: t, remainder: n, done: r } = A(g);
339
+ g = n, j(t, r);
310
340
  let i = Date.now();
311
- _((e) => e && e.sentAt === o ? {
341
+ _((e) => e && e.sentAt === s ? {
312
342
  ...e,
313
343
  streamStats: {
314
344
  chunkCount: e.streamStats.chunkCount + 1,
@@ -318,38 +348,38 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
318
348
  } : e);
319
349
  },
320
350
  onRequestId: (e) => {
321
- _((t) => t && t.sentAt === o ? {
351
+ _((t) => t && t.sentAt === s ? {
322
352
  ...t,
323
353
  requestId: e
324
354
  } : t);
325
355
  }
326
356
  });
327
357
  if (g.trim()) {
328
- let { events: e, done: t } = O(`${g}\n\n`);
329
- g = "", A(e, t);
358
+ let { events: e, done: t } = A(`${g}\n\n`);
359
+ g = "", j(e, t);
330
360
  }
331
361
  if (v) {
332
362
  y("error"), x(v);
333
363
  return;
334
364
  }
335
- if (i === void 0 || i >= 400) {
336
- E(ee(i, s, u), {
337
- httpStatus: i,
338
- rawBody: s || void 0
365
+ if (a === void 0 || a >= 400) {
366
+ O(ee(a, o, u), {
367
+ httpStatus: a,
368
+ rawBody: o || void 0
339
369
  });
340
370
  return;
341
371
  }
342
372
  if (!b) {
343
- E("Bailey returned an empty response.");
373
+ O("Bailey returned an empty response.");
344
374
  return;
345
375
  }
346
376
  if (!C) {
347
- E("Bailey ran some tools but didn't return an answer. Try asking again.");
377
+ O("Bailey ran some tools but didn't return an answer. Try asking again.");
348
378
  return;
349
379
  }
350
380
  y("idle");
351
- let d = M.current.get(l) ?? "";
352
- _((e) => e && e.sentAt === o ? {
381
+ let d = k.current.get(l) ?? "";
382
+ _((e) => e && e.sentAt === s ? {
353
383
  ...e,
354
384
  response: { content: d }
355
385
  } : e), c && await c({
@@ -361,21 +391,23 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
361
391
  } catch (e) {
362
392
  let t = e;
363
393
  if (t?.name === "TimeoutError") {
364
- E(t.message, { source: "client-timeout" });
394
+ O(t.message, { source: "client-timeout" });
365
395
  return;
366
396
  }
367
397
  if (t?.name === "AbortError") {
368
398
  y("idle");
369
399
  return;
370
400
  }
371
- E(t?.message || "Bailey request failed.");
401
+ O(t?.message || "Bailey request failed.");
372
402
  } finally {
373
403
  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 ? [{
404
+ let e = k.current.get(l) ?? "";
405
+ D.current.delete(l), k.current.delete(l);
406
+ let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
407
+ p((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
376
408
  ...e,
377
409
  streaming: !1
378
- }] : [] : [e])), D.current = D.current.flatMap((t) => t.id === l ? e ? [{
410
+ }] : [] : [e])), E.current = E.current.flatMap((t) => t.id === l ? e ? [{
379
411
  ...t,
380
412
  content: e,
381
413
  streaming: !1
@@ -386,13 +418,13 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
386
418
  t,
387
419
  n,
388
420
  r,
389
- a,
390
- s,
421
+ i,
422
+ o,
391
423
  c,
392
424
  I,
393
425
  F,
394
426
  P
395
- ]), R = i((e) => {
427
+ ]), R = a((e) => {
396
428
  T.current = e, p(e);
397
429
  }, []);
398
430
  return {
@@ -401,75 +433,75 @@ var k = 200, A = 15e4, j = () => typeof crypto < "u" && typeof crypto.randomUUID
401
433
  lastRequest: g,
402
434
  status: v,
403
435
  error: b,
404
- send: i((e) => {
436
+ send: a((e) => {
405
437
  let t = e.trim();
406
438
  if (!t) return;
407
439
  C.current = t;
408
440
  let n = {
409
- id: j(),
441
+ id: N(),
410
442
  role: "user",
411
443
  content: t,
412
444
  createdAt: Date.now()
413
- }, r = [...D.current, n];
414
- D.current = r, R([...T.current, n]), L(r);
445
+ }, r = [...E.current, n];
446
+ E.current = r, R([...T.current, n]), L(r);
415
447
  }, [L, R]),
416
- sendHidden: i((e, t) => {
448
+ sendHidden: a((e, t) => {
417
449
  if (v === "streaming") return;
418
450
  let n = e.trim();
419
451
  if (!n) return;
420
452
  C.current = n;
421
453
  let r = t?.trim(), i = {
422
- id: j(),
454
+ id: N(),
423
455
  role: "user",
424
456
  content: n,
425
457
  createdAt: Date.now(),
426
458
  hidden: !0,
427
459
  ...r ? { titleHint: r } : {}
428
- }, a = [...D.current, i];
429
- D.current = a, L(a);
460
+ }, a = [...E.current, i];
461
+ E.current = a, L(a);
430
462
  }, [L, v]),
431
- stop: i(() => {
463
+ stop: a(() => {
432
464
  S.current?.abort();
433
465
  }, []),
434
- retryLast: i(() => {
466
+ retryLast: a(() => {
435
467
  if (v === "streaming" || !C.current) return;
436
468
  let e = T.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
437
469
  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);
470
+ let r = E.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
471
+ E.current = a, L(a);
440
472
  }, [
441
473
  L,
442
474
  R,
443
475
  v
444
476
  ]),
445
- clearTrace: i(() => h([]), []),
446
- clearError: i(() => {
477
+ clearTrace: a(() => h([]), []),
478
+ clearError: a(() => {
447
479
  x(null), y((e) => e === "error" ? "idle" : e);
448
480
  }, []),
449
- newChat: i(() => {
450
- S.current?.abort(), R([]), D.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
481
+ newChat: a(() => {
482
+ S.current?.abort(), R([]), E.current = [], h([]), _(null), y("idle"), x(null), C.current = "";
451
483
  }, [R]),
452
- loadMessages: i((e) => {
484
+ loadMessages: a((e) => {
453
485
  S.current?.abort();
454
486
  let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
455
487
  ...e,
456
488
  streaming: !1
457
489
  }));
458
- R(t.filter((e) => !e.hidden)), D.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
490
+ R(t.filter((e) => !e.hidden)), E.current = t, h([]), _(null), y("idle"), x(null), C.current = "";
459
491
  }, [R])
460
492
  };
461
493
  };
462
494
  //#endregion
463
495
  //#region src/utils/prompt.ts
464
- function N(...e) {
496
+ function F(...e) {
465
497
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
466
498
  }
467
499
  //#endregion
468
500
  //#region src/utils/toolCalls.ts
469
- var P = "call_tool", F = "a tool";
470
- function I(e, t) {
501
+ var I = "call_tool", L = "a tool";
502
+ function R(e, t) {
471
503
  let n = {
472
- name: e === P ? F : e,
504
+ name: e === I ? L : e,
473
505
  args: null,
474
506
  viaCallTool: !1
475
507
  };
@@ -482,7 +514,7 @@ function I(e, t) {
482
514
  }
483
515
  if (typeof r != "object" || !r) return n;
484
516
  let i = r;
485
- if (e === P) {
517
+ if (e === I) {
486
518
  let e = typeof i.name == "string" ? i.name : void 0;
487
519
  if (!e) return n;
488
520
  let t = i.arguments;
@@ -500,32 +532,32 @@ function I(e, t) {
500
532
  }
501
533
  //#endregion
502
534
  //#region src/utils/table.ts
503
- var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(R).join(""), z = (e) => {
535
+ var z = 5, B = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(B).join(""), V = (e) => {
504
536
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
505
537
  for (let t of e.children ?? []) {
506
- let e = z(t);
538
+ let e = V(t);
507
539
  if (e) return e;
508
540
  }
509
- }, B = (e, t) => (e.children ?? []).find((e) => e.tagName === t), V = (e) => {
510
- let t = R(e), n = z(e);
541
+ }, H = (e, t) => (e.children ?? []).find((e) => e.tagName === t), U = (e) => {
542
+ let t = B(e), n = V(e);
511
543
  return n ? {
512
544
  text: t,
513
545
  href: n
514
546
  } : { text: t };
515
- }, H = (e) => (e.children ?? []).filter((e) => e.type === "element").map(V), U = (e) => {
547
+ }, W = (e) => (e.children ?? []).filter((e) => e.type === "element").map(U), G = (e) => {
516
548
  if (e.tagName !== "table") return null;
517
- let t = B(e, "thead"), n = t && B(t, "tr");
549
+ let t = H(e, "thead"), n = t && H(t, "tr");
518
550
  return {
519
- headers: n ? H(n).map((e) => e.text) : [],
520
- rows: (B(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(H)
551
+ headers: n ? W(n).map((e) => e.text) : [],
552
+ rows: (H(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(W)
521
553
  };
522
- }, 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 = [
554
+ }, K = (e) => e.length > 5, te = "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```", q = [
523
555
  "bar",
524
556
  "line",
525
557
  "pie",
526
558
  "doughnut",
527
559
  "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) => {
560
+ ], J = 8, Y = 50, X = 8, ne = 500, re = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", ie = (e) => {
529
561
  let t;
530
562
  try {
531
563
  t = JSON.parse(e);
@@ -534,13 +566,13 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
534
566
  }
535
567
  if (typeof t != "object" || !t) return null;
536
568
  let n = t;
537
- if (typeof n.type != "string" || !K.includes(n.type)) return null;
569
+ if (typeof n.type != "string" || !q.includes(n.type)) return null;
538
570
  let r = n.type;
539
571
  if (n.title !== void 0 && typeof n.title != "string") return null;
540
572
  let i = n.title;
541
573
  if (typeof n.data != "object" || n.data === null) return null;
542
574
  let a = n.data;
543
- if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > q || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
575
+ if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > J || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
544
576
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
545
577
  let o = a.datasets;
546
578
  if (r === "scatter") {
@@ -552,7 +584,7 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
552
584
  };
553
585
  }
554
586
  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;
587
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? X : Y;
556
588
  if (s.length < 1 || s.length > c) return null;
557
589
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
558
590
  return {
@@ -574,13 +606,13 @@ var L = 5, R = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map
574
606
  error: "Error",
575
607
  raw: "Raw event"
576
608
  };
577
- function Y(e) {
578
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : I(e.name, e.args);
609
+ function Z(e) {
610
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : R(e.name, e.args);
579
611
  }
580
- function X(e, t = Y(e)) {
612
+ function oe(e, t = Z(e)) {
581
613
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
582
614
  }
583
- function oe(e, t = Y(e)) {
615
+ function se(e, t = Z(e)) {
584
616
  switch (e.kind) {
585
617
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
586
618
  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 +625,23 @@ function oe(e, t = Y(e)) {
593
625
  case "raw": return `Unrecognized event: ${e.eventType}`;
594
626
  }
595
627
  }
596
- function se(e, t = Y(e)) {
628
+ function ce(e, t = Z(e)) {
597
629
  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
630
  }
599
- function ce(e) {
631
+ function le(e) {
600
632
  return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
601
633
  }
602
- function le(e) {
634
+ function ue(e) {
603
635
  return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
604
636
  }
605
- function ue(e) {
637
+ function de(e) {
606
638
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
607
639
  }
608
- function Z(e) {
640
+ function fe(e) {
609
641
  switch (e.kind) {
610
- case "tool_start": return `Calling ${I(e.name, e.args).name}...`;
642
+ case "tool_start": return `Calling ${R(e.name, e.args).name}...`;
611
643
  case "tool_end": {
612
- let t = I(e.name, e.args).name;
644
+ let t = R(e.name, e.args).name;
613
645
  return e.isError ? `${t} failed` : `${t} returned`;
614
646
  }
615
647
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -621,11 +653,11 @@ function Z(e) {
621
653
  case "raw": return `Unrecognized event: ${e.eventType}`;
622
654
  }
623
655
  }
624
- function de(e) {
656
+ function pe(e) {
625
657
  let t = new Date(e);
626
658
  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
659
  }
628
- function fe(e) {
660
+ function me(e) {
629
661
  if (e <= 0) return "+0ms";
630
662
  if (e < 1e3) return `+${Math.round(e)}ms`;
631
663
  let t = e / 1e3;
@@ -633,31 +665,31 @@ function fe(e) {
633
665
  let n = Math.floor(t / 60), r = Math.round(t % 60);
634
666
  return `+${n}m${String(r).padStart(2, "0")}s`;
635
667
  }
636
- function pe(e) {
668
+ function he(e) {
637
669
  return e.map((t, n) => {
638
- let r = Y(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
670
+ let r = Z(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
639
671
  return {
640
672
  key: `${t.at}-${n}`,
641
673
  kind: t.kind,
642
- toolName: X(t, r),
674
+ toolName: oe(t, r),
643
675
  isToolStart: t.kind === "tool_start",
644
676
  failed: t.kind === "tool_end" && t.isError === !0,
645
- time: de(t.at),
677
+ time: pe(t.at),
646
678
  gapMs: t.at - i,
647
679
  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)
680
+ summary: se(t, r),
681
+ argsDetail: ce(t, r),
682
+ outputDetail: le(t),
683
+ structuredOutputDetail: ue(t),
684
+ rawDetail: de(t)
653
685
  };
654
686
  });
655
687
  }
656
- function me(e) {
688
+ function ge(e) {
657
689
  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
690
  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
691
  }
660
- function he(e) {
692
+ function _e(e) {
661
693
  let t = [];
662
694
  for (let n of e) {
663
695
  let e = t[t.length - 1];
@@ -676,103 +708,130 @@ function he(e) {
676
708
  }
677
709
  return t;
678
710
  }
679
- function ge(e) {
711
+ function ve(e) {
680
712
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
681
713
  }
682
- function _e(e, t) {
714
+ function ye(e, t) {
683
715
  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
716
  key: `${e.at}-${t}`,
685
- text: Z(e),
686
- toolName: X(e)
717
+ text: fe(e),
718
+ toolName: oe(e)
687
719
  }));
688
720
  }
721
+ function be(e, t) {
722
+ if (t === void 0) return [];
723
+ let n = [];
724
+ for (let r of e) if (r.turnSentAt === t) {
725
+ if (r.kind === "tool_start") {
726
+ let e = R(r.name, r.args).name;
727
+ n.push({
728
+ key: `step-${n.length}`,
729
+ callId: r.callId,
730
+ toolName: e,
731
+ label: r.displayName || e,
732
+ status: "running"
733
+ });
734
+ } else if (r.kind === "tool_end") {
735
+ let e = R(r.name, r.args).name, t = r.isError ? "failed" : "done", i = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
736
+ i ? (i.status = t, i.runtimeSeconds = r.runtimeSeconds, i.label = r.displayName || i.label) : n.push({
737
+ key: `step-${n.length}`,
738
+ callId: r.callId,
739
+ toolName: e,
740
+ label: r.displayName || e,
741
+ status: t,
742
+ runtimeSeconds: r.runtimeSeconds
743
+ });
744
+ }
745
+ }
746
+ return n;
747
+ }
689
748
  //#endregion
690
749
  //#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;
750
+ var xe = "/*! 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;--animate-spin:spin 1s linear infinite;--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-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;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-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom: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)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-failed{color:var(--color-bailey-error)}.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}@keyframes spin{to{transform:rotate(360deg)}}", Se = r(void 0), Ce = /:root\s*,\s*:host\s*\{/, we = ".bailey-chat-panel{";
751
+ function Te(e) {
752
+ let t = e.match(new RegExp(Ce, "g"))?.length ?? 0;
694
753
  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);
754
+ return e.replace(Ce, we);
696
755
  }
697
- var Ce = Se(ve), we = "data-source", Te = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
698
- function Ee(e) {
756
+ var Ee = Te(xe), De = "data-source", Oe = "baileyai-chat-ui", Q = /* @__PURE__ */ new WeakMap();
757
+ function ke(e) {
699
758
  let t = e.getRootNode();
700
759
  return t instanceof ShadowRoot ? t : document;
701
760
  }
702
- function De(e) {
761
+ function Ae(e) {
703
762
  let t = e instanceof ShadowRoot ? e : document.head, n = Q.get(e) ?? 0;
704
- if (n === 0 && !t.querySelector(`style[${we}="${Te}"]`)) {
763
+ if (n === 0 && !t.querySelector(`style[${De}="${Oe}"]`)) {
705
764
  let e = document.createElement("style");
706
- e.setAttribute(we, Te), e.textContent = Ce, t.appendChild(e);
765
+ e.setAttribute(De, Oe), e.textContent = Ee, t.appendChild(e);
707
766
  }
708
767
  return Q.set(e, n + 1), () => {
709
768
  let n = (Q.get(e) ?? 1) - 1;
710
- n <= 0 ? (Q.delete(e), t.querySelector(`style[${we}="${Te}"]`)?.remove()) : Q.set(e, n);
769
+ n <= 0 ? (Q.delete(e), t.querySelector(`style[${De}="${Oe}"]`)?.remove()) : Q.set(e, n);
711
770
  };
712
771
  }
713
- function Oe(e, t = !1) {
714
- let [n, r] = u(null);
715
- return s(() => {
772
+ function je(e, t = !1) {
773
+ let [n, r] = d(null);
774
+ return c(() => {
716
775
  if (t) return;
717
776
  let n = e.current;
718
777
  if (!n) return;
719
- let i = Ee(n);
720
- return r(i), De(i);
778
+ let i = ke(n);
779
+ return r(i), Ae(i);
721
780
  }, [t, e]), n;
722
781
  }
723
- function ke(e) {
724
- let t = a(ye), n = t !== void 0, r = Oe(e, n);
782
+ function Me(e) {
783
+ let t = o(Se), n = t !== void 0, r = je(e, n);
725
784
  return n ? t : r;
726
785
  }
727
786
  //#endregion
728
787
  //#region src/ui/markdown.tsx
729
- function Ae({ renderTable: t, renderChart: n } = {}) {
788
+ function Ne({ renderTable: t, renderChart: n } = {}) {
730
789
  return {
731
- a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ h(m, { children: n }) : /* @__PURE__ */ h("a", {
790
+ a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ _(g, { children: n }) : /* @__PURE__ */ _("a", {
732
791
  href: t,
733
792
  target: "_blank",
734
793
  rel: "noopener noreferrer",
735
794
  children: n
736
795
  }),
737
796
  table: ({ node: n, children: r }) => {
738
- let i = n && U(n);
739
- if (i && W(i.rows) && t) {
797
+ let i = n && G(n);
798
+ if (i && K(i.rows) && t) {
740
799
  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({
800
+ return /* @__PURE__ */ _(g, { children: t({
742
801
  headers: i.headers,
743
802
  rows: n
744
803
  }) });
745
804
  }
746
- return /* @__PURE__ */ h("table", { children: r });
805
+ return /* @__PURE__ */ _("table", { children: r });
747
806
  },
748
807
  pre: ({ children: e }) => {
749
808
  let t = (Array.isArray(e) ? e[0] : e)?.props;
750
809
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
751
810
  let e = t?.children, r = ie(Array.isArray(e) ? e.join("") : String(e ?? ""));
752
- if (r) return /* @__PURE__ */ h(m, { children: n(r) });
811
+ if (r) return /* @__PURE__ */ _(g, { children: n(r) });
753
812
  }
754
- return /* @__PURE__ */ h("pre", { children: e });
813
+ return /* @__PURE__ */ _("pre", { children: e });
755
814
  }
756
815
  };
757
816
  }
758
817
  //#endregion
759
818
  //#region src/ui/icons.tsx
760
- function je({ className: e }) {
761
- return /* @__PURE__ */ h("svg", {
819
+ function Pe({ className: e }) {
820
+ return /* @__PURE__ */ _("svg", {
762
821
  viewBox: "0 0 24 24",
763
822
  fill: "currentColor",
764
823
  className: e,
765
824
  "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" })
825
+ children: /* @__PURE__ */ _("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
826
  });
768
827
  }
769
- function Me({ className: e }) {
770
- return /* @__PURE__ */ h("svg", {
828
+ function Fe({ className: e }) {
829
+ return /* @__PURE__ */ _("svg", {
771
830
  viewBox: "0 0 24 24",
772
831
  fill: "currentColor",
773
832
  className: e,
774
833
  "aria-hidden": "true",
775
- children: /* @__PURE__ */ h("rect", {
834
+ children: /* @__PURE__ */ _("rect", {
776
835
  x: "6",
777
836
  y: "6",
778
837
  width: "12",
@@ -781,8 +840,8 @@ function Me({ className: e }) {
781
840
  })
782
841
  });
783
842
  }
784
- function Ne({ className: e }) {
785
- return /* @__PURE__ */ g("svg", {
843
+ function Ie({ className: e }) {
844
+ return /* @__PURE__ */ v("svg", {
786
845
  viewBox: "0 0 24 24",
787
846
  fill: "none",
788
847
  stroke: "currentColor",
@@ -791,11 +850,11 @@ function Ne({ className: e }) {
791
850
  strokeLinejoin: "round",
792
851
  className: e,
793
852
  "aria-hidden": "true",
794
- children: [/* @__PURE__ */ h("path", { d: "M7 17 17 7" }), /* @__PURE__ */ h("path", { d: "M9 7h8v8" })]
853
+ children: [/* @__PURE__ */ _("path", { d: "M7 17 17 7" }), /* @__PURE__ */ _("path", { d: "M9 7h8v8" })]
795
854
  });
796
855
  }
797
- function Pe({ className: e }) {
798
- return /* @__PURE__ */ g("svg", {
856
+ function Le({ className: e }) {
857
+ return /* @__PURE__ */ v("svg", {
799
858
  viewBox: "0 0 24 24",
800
859
  fill: "none",
801
860
  stroke: "currentColor",
@@ -804,17 +863,17 @@ function Pe({ className: e }) {
804
863
  strokeLinejoin: "round",
805
864
  className: e,
806
865
  "aria-hidden": "true",
807
- children: [/* @__PURE__ */ h("rect", {
866
+ children: [/* @__PURE__ */ _("rect", {
808
867
  x: "8",
809
868
  y: "8",
810
869
  width: "12",
811
870
  height: "12",
812
871
  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" })]
872
+ }), /* @__PURE__ */ _("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
814
873
  });
815
874
  }
816
- function Fe({ className: e }) {
817
- return /* @__PURE__ */ h("svg", {
875
+ function Re({ className: e }) {
876
+ return /* @__PURE__ */ _("svg", {
818
877
  viewBox: "0 0 24 24",
819
878
  fill: "none",
820
879
  stroke: "currentColor",
@@ -823,11 +882,11 @@ function Fe({ className: e }) {
823
882
  strokeLinejoin: "round",
824
883
  className: e,
825
884
  "aria-hidden": "true",
826
- children: /* @__PURE__ */ h("path", { d: "M5 12.5 9.5 17 19 7" })
885
+ children: /* @__PURE__ */ _("path", { d: "M5 12.5 9.5 17 19 7" })
827
886
  });
828
887
  }
829
- function Ie({ className: e }) {
830
- return /* @__PURE__ */ h("svg", {
888
+ function ze({ className: e }) {
889
+ return /* @__PURE__ */ _("svg", {
831
890
  viewBox: "0 0 24 24",
832
891
  fill: "none",
833
892
  stroke: "currentColor",
@@ -836,11 +895,11 @@ function Ie({ className: e }) {
836
895
  strokeLinejoin: "round",
837
896
  className: e,
838
897
  "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" })
898
+ children: /* @__PURE__ */ _("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
840
899
  });
841
900
  }
842
- function Le({ className: e }) {
843
- return /* @__PURE__ */ g("svg", {
901
+ function Be({ className: e }) {
902
+ return /* @__PURE__ */ v("svg", {
844
903
  viewBox: "0 0 24 24",
845
904
  fill: "none",
846
905
  stroke: "currentColor",
@@ -849,29 +908,67 @@ function Le({ className: e }) {
849
908
  strokeLinejoin: "round",
850
909
  className: e,
851
910
  "aria-hidden": "true",
852
- children: [/* @__PURE__ */ h("circle", {
911
+ children: [/* @__PURE__ */ _("circle", {
853
912
  cx: "12",
854
913
  cy: "12",
855
914
  r: "9"
856
- }), /* @__PURE__ */ h("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
915
+ }), /* @__PURE__ */ _("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
916
+ });
917
+ }
918
+ function Ve({ className: e }) {
919
+ return /* @__PURE__ */ v("svg", {
920
+ viewBox: "0 0 24 24",
921
+ fill: "currentColor",
922
+ className: e,
923
+ "aria-hidden": "true",
924
+ children: [
925
+ /* @__PURE__ */ _("circle", {
926
+ cx: "5",
927
+ cy: "12",
928
+ r: "1.75"
929
+ }),
930
+ /* @__PURE__ */ _("circle", {
931
+ cx: "12",
932
+ cy: "12",
933
+ r: "1.75"
934
+ }),
935
+ /* @__PURE__ */ _("circle", {
936
+ cx: "19",
937
+ cy: "12",
938
+ r: "1.75"
939
+ })
940
+ ]
941
+ });
942
+ }
943
+ function He({ className: e }) {
944
+ return /* @__PURE__ */ _("svg", {
945
+ viewBox: "0 0 24 24",
946
+ fill: "none",
947
+ stroke: "currentColor",
948
+ strokeWidth: 2,
949
+ strokeLinecap: "round",
950
+ strokeLinejoin: "round",
951
+ className: e,
952
+ "aria-hidden": "true",
953
+ children: /* @__PURE__ */ _("path", { d: "M12 5v14M5 12h14" })
857
954
  });
858
955
  }
859
956
  //#endregion
860
957
  //#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);
864
- return o(() => () => {
958
+ var Ue = 1500;
959
+ function We({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
960
+ let [a, o] = d(!1), [c, l] = d(!1), f = u(null), p = u(null), m = Me(p);
961
+ return s(() => () => {
865
962
  f.current !== null && clearTimeout(f.current);
866
- }, []), /* @__PURE__ */ h(p.Provider, {
963
+ }, []), /* @__PURE__ */ _(h.Provider, {
867
964
  delayDuration: 200,
868
- children: /* @__PURE__ */ g(p.Root, {
965
+ children: /* @__PURE__ */ v(h.Root, {
869
966
  open: a || c,
870
- onOpenChange: d,
871
- children: [/* @__PURE__ */ h(p.Trigger, {
967
+ onOpenChange: l,
968
+ children: [/* @__PURE__ */ _(h.Trigger, {
872
969
  asChild: !0,
873
- children: /* @__PURE__ */ h("button", {
874
- ref: m,
970
+ children: /* @__PURE__ */ _("button", {
971
+ ref: p,
875
972
  type: "button",
876
973
  onClick: async () => {
877
974
  try {
@@ -879,18 +976,18 @@ function ze({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
879
976
  } catch {
880
977
  return;
881
978
  }
882
- s(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => s(!1), Re);
979
+ o(!0), f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => o(!1), Ue);
883
980
  },
884
981
  "aria-label": n,
885
982
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
886
- children: h(a ? Fe : Pe, { className: "bailey-copy-icon" })
983
+ children: _(a ? Re : Le, { className: "bailey-copy-icon" })
887
984
  })
888
- }), /* @__PURE__ */ h(p.Portal, {
889
- container: _ instanceof ShadowRoot ? _ : void 0,
890
- children: /* @__PURE__ */ g(p.Content, {
985
+ }), /* @__PURE__ */ _(h.Portal, {
986
+ container: m instanceof ShadowRoot ? m : void 0,
987
+ children: /* @__PURE__ */ v(h.Content, {
891
988
  side: "top",
892
989
  className: "bailey-tooltip-content",
893
- children: [a ? i : r, /* @__PURE__ */ h(p.Arrow, { className: "bailey-tooltip-arrow" })]
990
+ children: [a ? i : r, /* @__PURE__ */ _(h.Arrow, { className: "bailey-tooltip-arrow" })]
894
991
  })
895
992
  })]
896
993
  })
@@ -898,20 +995,20 @@ function ze({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
898
995
  }
899
996
  //#endregion
900
997
  //#region src/ui/BaileyTracePanel.tsx
901
- async function Be(e) {
998
+ async function Ge(e) {
902
999
  try {
903
1000
  await navigator.clipboard.writeText(e);
904
1001
  } catch {}
905
1002
  }
906
- function Ve({ text: e, label: t = "Copy" }) {
907
- return /* @__PURE__ */ h("button", {
1003
+ function Ke({ text: e, label: t = "Copy" }) {
1004
+ return /* @__PURE__ */ _("button", {
908
1005
  type: "button",
909
- onClick: () => Be(e),
1006
+ onClick: () => Ge(e),
910
1007
  className: "bailey-trace-copy-button",
911
1008
  children: t
912
1009
  });
913
1010
  }
914
- function He(e) {
1011
+ function qe(e) {
915
1012
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
916
1013
  switch (e.kind) {
917
1014
  case "tool_start":
@@ -923,77 +1020,77 @@ function He(e) {
923
1020
  }
924
1021
  }
925
1022
  function $({ label: e, content: t, copyable: n }) {
926
- return /* @__PURE__ */ g("details", {
1023
+ return /* @__PURE__ */ v("details", {
927
1024
  className: "bailey-trace-disclosure",
928
1025
  children: [
929
- /* @__PURE__ */ h("summary", {
1026
+ /* @__PURE__ */ _("summary", {
930
1027
  className: "bailey-trace-disclosure-summary",
931
1028
  children: e
932
1029
  }),
933
- n && /* @__PURE__ */ h("div", {
1030
+ n && /* @__PURE__ */ _("div", {
934
1031
  className: "bailey-trace-disclosure-actions",
935
- children: /* @__PURE__ */ h(Ve, { text: t })
1032
+ children: /* @__PURE__ */ _(Ke, { text: t })
936
1033
  }),
937
- /* @__PURE__ */ h("pre", {
1034
+ /* @__PURE__ */ _("pre", {
938
1035
  className: "bailey-trace-disclosure-content",
939
1036
  children: t
940
1037
  })
941
1038
  ]
942
1039
  });
943
1040
  }
944
- function Ue({ row: e }) {
945
- return /* @__PURE__ */ g("div", {
1041
+ function Je({ row: e }) {
1042
+ return /* @__PURE__ */ v("div", {
946
1043
  className: "bailey-trace-row",
947
1044
  children: [
948
- /* @__PURE__ */ g("div", {
1045
+ /* @__PURE__ */ v("div", {
949
1046
  className: "bailey-trace-row-header",
950
1047
  children: [
951
- /* @__PURE__ */ h("span", {
1048
+ /* @__PURE__ */ _("span", {
952
1049
  className: "bailey-trace-row-time",
953
1050
  children: e.time
954
1051
  }),
955
- /* @__PURE__ */ h("span", {
1052
+ /* @__PURE__ */ _("span", {
956
1053
  className: "bailey-trace-row-gap",
957
1054
  title: "Time since the previous event",
958
- children: fe(e.gapMs)
1055
+ children: me(e.gapMs)
959
1056
  }),
960
- /* @__PURE__ */ h("span", {
961
- className: He(e),
1057
+ /* @__PURE__ */ _("span", {
1058
+ className: qe(e),
962
1059
  children: e.label
963
1060
  }),
964
- /* @__PURE__ */ h("span", {
1061
+ /* @__PURE__ */ _("span", {
965
1062
  className: "bailey-trace-row-summary",
966
1063
  children: e.summary
967
1064
  })
968
1065
  ]
969
1066
  }),
970
- e.argsDetail && /* @__PURE__ */ h($, {
1067
+ e.argsDetail && /* @__PURE__ */ _($, {
971
1068
  label: e.kind === "llm_call_start" ? "request" : "args",
972
1069
  content: e.argsDetail
973
1070
  }),
974
- e.outputDetail && /* @__PURE__ */ h($, {
1071
+ e.outputDetail && /* @__PURE__ */ _($, {
975
1072
  label: e.kind === "llm_call_end" ? "response" : "output",
976
1073
  content: e.outputDetail
977
1074
  }),
978
- e.structuredOutputDetail && /* @__PURE__ */ h($, {
1075
+ e.structuredOutputDetail && /* @__PURE__ */ _($, {
979
1076
  label: "structured output",
980
1077
  content: e.structuredOutputDetail
981
1078
  }),
982
- e.rawDetail && /* @__PURE__ */ h($, {
1079
+ e.rawDetail && /* @__PURE__ */ _($, {
983
1080
  label: "raw",
984
1081
  content: e.rawDetail
985
1082
  })
986
1083
  ]
987
1084
  });
988
1085
  }
989
- function We(e, t) {
1086
+ function Ye(e, t) {
990
1087
  if (e.chunkCount === 0) return "Streamed: no chunks received";
991
1088
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
992
1089
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
993
1090
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
994
1091
  }
995
- function Ge({ request: e }) {
996
- let t = c(() => JSON.stringify({
1092
+ function Xe({ request: e }) {
1093
+ let t = l(() => JSON.stringify({
997
1094
  model: e.model,
998
1095
  instructions: e.systemPrompt,
999
1096
  input: e.messages,
@@ -1001,10 +1098,10 @@ function Ge({ request: e }) {
1001
1098
  tools: e.tools,
1002
1099
  toolChoice: e.toolChoice
1003
1100
  }, null, 2), [e]);
1004
- return /* @__PURE__ */ g("div", {
1101
+ return /* @__PURE__ */ v("div", {
1005
1102
  className: "bailey-trace-request-details",
1006
1103
  children: [
1007
- /* @__PURE__ */ g("span", {
1104
+ /* @__PURE__ */ v("span", {
1008
1105
  className: "bailey-trace-request-meta",
1009
1106
  children: [
1010
1107
  "Last request — ",
@@ -1014,26 +1111,26 @@ function Ge({ request: e }) {
1014
1111
  e.requestId ? ` · ${e.requestId}` : ""
1015
1112
  ]
1016
1113
  }),
1017
- /* @__PURE__ */ h("span", {
1114
+ /* @__PURE__ */ _("span", {
1018
1115
  className: "bailey-trace-request-meta",
1019
- children: We(e.streamStats, e.sentAt)
1116
+ children: Ye(e.streamStats, e.sentAt)
1020
1117
  }),
1021
- /* @__PURE__ */ h($, {
1118
+ /* @__PURE__ */ _($, {
1022
1119
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
1023
1120
  content: e.systemPrompt,
1024
1121
  copyable: !0
1025
1122
  }),
1026
- /* @__PURE__ */ h($, {
1123
+ /* @__PURE__ */ _($, {
1027
1124
  label: `Messages (${e.messages.length})`,
1028
1125
  content: JSON.stringify(e.messages, null, 2),
1029
1126
  copyable: !0
1030
1127
  }),
1031
- e.response && /* @__PURE__ */ h($, {
1128
+ e.response && /* @__PURE__ */ _($, {
1032
1129
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1033
1130
  content: e.response.content,
1034
1131
  copyable: !0
1035
1132
  }),
1036
- /* @__PURE__ */ h($, {
1133
+ /* @__PURE__ */ _($, {
1037
1134
  label: "Full payload (JSON)",
1038
1135
  content: t,
1039
1136
  copyable: !0
@@ -1041,43 +1138,43 @@ function Ge({ request: e }) {
1041
1138
  ]
1042
1139
  });
1043
1140
  }
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", {
1141
+ function Ze({ events: e, lastRequest: t, onClear: n }) {
1142
+ let r = l(() => he(e), [e]), i = l(() => _e(r), [r]), a = l(() => JSON.stringify(e, null, 2), [e]);
1143
+ return /* @__PURE__ */ v("div", {
1047
1144
  className: "bailey-trace-body",
1048
1145
  children: [
1049
- /* @__PURE__ */ g("div", {
1146
+ /* @__PURE__ */ v("div", {
1050
1147
  className: "bailey-trace-actions-row",
1051
- children: [e.length > 0 && /* @__PURE__ */ h(Ve, {
1148
+ children: [e.length > 0 && /* @__PURE__ */ _(Ke, {
1052
1149
  text: a,
1053
1150
  label: "Copy trace as JSON"
1054
- }), /* @__PURE__ */ h("button", {
1151
+ }), /* @__PURE__ */ _("button", {
1055
1152
  type: "button",
1056
1153
  onClick: n,
1057
1154
  className: "bailey-trace-copy-button",
1058
1155
  children: "Clear"
1059
1156
  })]
1060
1157
  }),
1061
- t && /* @__PURE__ */ h(Ge, { request: t }),
1062
- /* @__PURE__ */ h("div", {
1158
+ t && /* @__PURE__ */ _(Xe, { request: t }),
1159
+ /* @__PURE__ */ _("div", {
1063
1160
  className: "bailey-trace-rows",
1064
1161
  children: i.map((e, t) => {
1065
- if (e.type === "single") return /* @__PURE__ */ h(Ue, { row: e.row }, e.row.key);
1162
+ if (e.type === "single") return /* @__PURE__ */ _(Je, { row: e.row }, e.row.key);
1066
1163
  let n = e.rows.filter((e) => e.isToolStart).length;
1067
- if (n <= 1) return /* @__PURE__ */ h("div", {
1164
+ if (n <= 1) return /* @__PURE__ */ _("div", {
1068
1165
  className: "bailey-trace-rows",
1069
- children: e.rows.map((e) => /* @__PURE__ */ h(Ue, { row: e }, e.key))
1166
+ children: e.rows.map((e) => /* @__PURE__ */ _(Je, { row: e }, e.key))
1070
1167
  }, `group-${t}`);
1071
1168
  let r = e.rows.filter((e) => e.failed).length;
1072
- return /* @__PURE__ */ g("details", {
1169
+ return /* @__PURE__ */ v("details", {
1073
1170
  className: "bailey-trace-group",
1074
- children: [/* @__PURE__ */ g("summary", {
1171
+ children: [/* @__PURE__ */ v("summary", {
1075
1172
  className: "bailey-trace-group-summary",
1076
1173
  children: [
1077
- /* @__PURE__ */ h("strong", { children: e.toolName }),
1174
+ /* @__PURE__ */ _("strong", { children: e.toolName }),
1078
1175
  " × ",
1079
1176
  n,
1080
- r > 0 && /* @__PURE__ */ g("span", {
1177
+ r > 0 && /* @__PURE__ */ v("span", {
1081
1178
  className: "bailey-trace-group-failed",
1082
1179
  children: [
1083
1180
  " ",
@@ -1086,9 +1183,9 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1086
1183
  ]
1087
1184
  })
1088
1185
  ]
1089
- }), /* @__PURE__ */ h("div", {
1186
+ }), /* @__PURE__ */ _("div", {
1090
1187
  className: "bailey-trace-rows",
1091
- children: e.rows.map((e) => /* @__PURE__ */ h(Ue, { row: e }, e.key))
1188
+ children: e.rows.map((e) => /* @__PURE__ */ _(Je, { row: e }, e.key))
1092
1189
  })]
1093
1190
  }, `group-${t}`);
1094
1191
  })
@@ -1096,13 +1193,13 @@ function Ke({ events: e, lastRequest: t, onClear: n }) {
1096
1193
  ]
1097
1194
  });
1098
1195
  }
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", {
1196
+ function Qe({ events: e, lastRequest: t, onClear: n }) {
1197
+ let [r, i] = d(!1), a = l(() => ve(e), [e]), o = l(() => ge(e), [e]);
1198
+ return e.length === 0 && !t ? null : /* @__PURE__ */ v("div", {
1102
1199
  className: "bailey-trace-panel",
1103
- children: [/* @__PURE__ */ g("div", {
1200
+ children: [/* @__PURE__ */ v("div", {
1104
1201
  className: "bailey-trace-toggle-row",
1105
- children: [/* @__PURE__ */ g("button", {
1202
+ children: [/* @__PURE__ */ v("button", {
1106
1203
  type: "button",
1107
1204
  onClick: () => i((e) => !e),
1108
1205
  "aria-expanded": r,
@@ -1114,11 +1211,11 @@ function qe({ events: e, lastRequest: t, onClear: n }) {
1114
1211
  e.length,
1115
1212
  ")"
1116
1213
  ]
1117
- }), o && /* @__PURE__ */ h("span", {
1214
+ }), o && /* @__PURE__ */ _("span", {
1118
1215
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
1119
1216
  children: o
1120
1217
  })]
1121
- }), r && /* @__PURE__ */ h(Ke, {
1218
+ }), r && /* @__PURE__ */ _(Ze, {
1122
1219
  events: e,
1123
1220
  lastRequest: t,
1124
1221
  onClear: n
@@ -1127,8 +1224,8 @@ function qe({ events: e, lastRequest: t, onClear: n }) {
1127
1224
  }
1128
1225
  //#endregion
1129
1226
  //#region src/ui/ToolResultImage.tsx
1130
- function Je({ src: e, alt: n, className: r }) {
1131
- return t(e) ? /* @__PURE__ */ h("img", {
1227
+ function $e({ src: e, alt: n, className: r }) {
1228
+ return t(e) ? /* @__PURE__ */ _("img", {
1132
1229
  src: e,
1133
1230
  alt: n ?? "",
1134
1231
  className: `bailey-tool-result-image${r ? ` ${r}` : ""}`,
@@ -1136,11 +1233,98 @@ function Je({ src: e, alt: n, className: r }) {
1136
1233
  }) : null;
1137
1234
  }
1138
1235
  //#endregion
1236
+ //#region src/utils/safeMcpAppResource.ts
1237
+ var et = /^ui:\/\//, tt = 2097152, nt = /* @__PURE__ */ new Set([
1238
+ "connectDomains",
1239
+ "resourceDomains",
1240
+ "frameDomains",
1241
+ "baseUriDomains"
1242
+ ]), rt = /* @__PURE__ */ new Set([
1243
+ "camera",
1244
+ "microphone",
1245
+ "geolocation",
1246
+ "clipboardWrite"
1247
+ ]), it = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), at = (e) => !(!et.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > tt || !it(e.csp, nt) || !it(e.permissions, rt));
1248
+ //#endregion
1249
+ //#region src/ui/McpAppFrame.tsx
1250
+ function ot({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
1251
+ return at({
1252
+ html: e,
1253
+ resourceUri: n,
1254
+ csp: r,
1255
+ permissions: i
1256
+ }) ? /* @__PURE__ */ _("iframe", {
1257
+ title: t ?? "MCP App",
1258
+ srcDoc: e,
1259
+ sandbox: "allow-scripts",
1260
+ referrerPolicy: "no-referrer",
1261
+ className: `bailey-mcp-app-frame${a ? ` ${a}` : ""}`
1262
+ }) : null;
1263
+ }
1264
+ //#endregion
1265
+ //#region src/ui/BaileyToolSteps.tsx
1266
+ function st({ toolName: e, resolveActivityIcon: t }) {
1267
+ return /* @__PURE__ */ _("span", {
1268
+ className: "bailey-activity-icon",
1269
+ children: t?.(e) ?? /* @__PURE__ */ _(Be, {})
1270
+ });
1271
+ }
1272
+ function ct({ steps: e, resolveActivityIcon: t }) {
1273
+ let n = e.filter((e) => e.status === "running");
1274
+ return n.length === 0 ? null : /* @__PURE__ */ _("div", {
1275
+ className: "bailey-tool-steps-live",
1276
+ role: "status",
1277
+ "aria-live": "polite",
1278
+ children: n.map((e) => /* @__PURE__ */ v("div", {
1279
+ className: "bailey-activity-line",
1280
+ children: [
1281
+ /* @__PURE__ */ _(st, {
1282
+ toolName: e.toolName,
1283
+ resolveActivityIcon: t
1284
+ }),
1285
+ /* @__PURE__ */ _("span", { children: e.label }),
1286
+ /* @__PURE__ */ _("span", {
1287
+ className: "bailey-step-spinner",
1288
+ "aria-hidden": "true"
1289
+ })
1290
+ ]
1291
+ }, e.key))
1292
+ });
1293
+ }
1294
+ function lt({ steps: e, labels: t, resolveActivityIcon: n }) {
1295
+ if (e.length === 0) return null;
1296
+ let r = e.filter((e) => e.status === "failed").length, i = e.length === 1 ? t.toolStepsSummaryOne : t.toolStepsSummaryMany.replace("{count}", String(e.length)), a = r > 0 ? `${i}${t.toolStepsFailedSuffix.replace("{failed}", String(r))}` : i;
1297
+ return /* @__PURE__ */ v("details", {
1298
+ className: "bailey-tool-steps-summary",
1299
+ children: [/* @__PURE__ */ _("summary", { children: a }), /* @__PURE__ */ _("ul", {
1300
+ className: "bailey-tool-steps-list",
1301
+ children: e.map((e) => /* @__PURE__ */ v("li", {
1302
+ className: "bailey-tool-step",
1303
+ children: [
1304
+ /* @__PURE__ */ _(st, {
1305
+ toolName: e.toolName,
1306
+ resolveActivityIcon: n
1307
+ }),
1308
+ /* @__PURE__ */ _("span", { children: e.label }),
1309
+ e.runtimeSeconds !== void 0 && /* @__PURE__ */ _("span", { children: `${e.runtimeSeconds.toFixed(1)}s` }),
1310
+ e.status === "failed" && /* @__PURE__ */ _("span", {
1311
+ className: "bailey-tool-step-failed",
1312
+ children: t.toolStepFailedText
1313
+ }),
1314
+ e.status === "running" && /* @__PURE__ */ _("span", { children: t.toolStepStoppedText })
1315
+ ]
1316
+ }, e.key))
1317
+ })]
1318
+ });
1319
+ }
1320
+ //#endregion
1139
1321
  //#region src/ui/BaileyChatPanel.tsx
1140
- var Ye = "How can bailey AI help you today?", Xe = "Reply to bailey AI", Ze = {
1322
+ var ut = "How can bailey AI help you today?", dt = "Reply to bailey AI", ft = {
1141
1323
  newChatButtonText: "New chat",
1142
1324
  newChatAriaLabel: "new chat",
1143
1325
  historyAriaLabel: "conversation history",
1326
+ historyMenuItemText: "Chat history",
1327
+ menuAriaLabel: "more options",
1144
1328
  suggestionsTitle: "Suggested for you",
1145
1329
  emptyStateMessage: "Ask Bailey a question to get started.",
1146
1330
  youLabel: "You",
@@ -1152,237 +1336,262 @@ var Ye = "How can bailey AI help you today?", Xe = "Reply to bailey AI", Ze = {
1152
1336
  stopAriaLabel: "stop",
1153
1337
  copyButtonAriaLabel: "copy response as markdown",
1154
1338
  copyButtonTooltipDefault: "Copy as markdown",
1155
- 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", {
1339
+ copyButtonTooltipCopied: "Copied!",
1340
+ toolStepsSummaryOne: "Used 1 tool",
1341
+ toolStepsSummaryMany: "Used {count} tools",
1342
+ toolStepsFailedSuffix: ", {failed} failed",
1343
+ toolStepFailedText: "failed",
1344
+ toolStepStoppedText: "stopped",
1345
+ mcpAppDefaultTitle: "MCP App"
1346
+ }, pt = [p], mt = {
1347
+ ...Ne(),
1348
+ p: ({ children: e }) => /* @__PURE__ */ _(g, { children: e })
1349
+ }, ht = i(function({ content: e, components: t }) {
1350
+ return /* @__PURE__ */ _("div", {
1161
1351
  className: "bailey-markdown-content",
1162
- children: /* @__PURE__ */ h(d, {
1163
- remarkPlugins: Qe,
1352
+ children: /* @__PURE__ */ _(f, {
1353
+ remarkPlugins: pt,
1164
1354
  components: t,
1165
1355
  skipHtml: !0,
1166
1356
  children: e
1167
1357
  })
1168
1358
  });
1169
1359
  });
1170
- function tt(e, t, n) {
1360
+ function gt(e, t, n) {
1171
1361
  if (e !== "streaming") return;
1172
1362
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
1173
- if (r.length !== 0) return Z(r[r.length - 1]);
1363
+ if (r.length !== 0) return fe(r[r.length - 1]);
1174
1364
  }
1175
- function nt(e) {
1365
+ function _t(e) {
1176
1366
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
1177
1367
  hour: "numeric",
1178
1368
  minute: "2-digit"
1179
1369
  });
1180
1370
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
1181
1371
  }
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);
1194
- o(() => {
1195
- let e = H.current;
1372
+ function vt({ chat: e, placeholder: t, replyPlaceholder: r = dt, emptyPlaceholder: i, suggestions: a, onHistoryClick: o, privacyNote: c, resolveActivityIcon: p, className: g, height: y, width: b, hideDeveloperDetails: x = !1, renderMessageActions: S, renderTable: C, renderChart: w, renderMcpApp: T, labels: E, formatMessageTime: D }) {
1373
+ let { messages: O, traceEvents: k, lastRequest: A, status: j, error: M, send: N, stop: ee, retryLast: P, clearTrace: F, clearError: I, newChat: L } = e, [R, z] = d(""), B = {
1374
+ ...ft,
1375
+ ...E
1376
+ }, V = D ?? _t, H = u(null), U = je(H), W = u(null), G = u(null), K = u(!0), te = l(() => Ne({
1377
+ renderTable: C,
1378
+ renderChart: w
1379
+ }), [C, w]), q = l(() => gt(j, k, A), [
1380
+ j,
1381
+ k,
1382
+ A
1383
+ ]), J = O.length === 0, Y = t ?? (J ? i ?? ut : r);
1384
+ s(() => {
1385
+ let e = G.current;
1196
1386
  if (!e) return;
1197
1387
  let t = () => {
1198
1388
  let t = e.scrollHeight - e.scrollTop - e.clientHeight;
1199
- U.current = t < 60;
1389
+ K.current = t < 60;
1200
1390
  };
1201
1391
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1202
- }, []), o(() => {
1203
- U.current && V.current?.scrollIntoView({
1204
- behavior: O === "streaming" ? "auto" : "smooth",
1392
+ }, []), s(() => {
1393
+ K.current && W.current?.scrollIntoView({
1394
+ behavior: j === "streaming" ? "auto" : "smooth",
1205
1395
  block: "nearest"
1206
1396
  });
1207
- }, [T, O]);
1208
- let J = (e) => {
1209
- U.current = !0, A(e);
1397
+ }, [O, j]);
1398
+ let X = (e) => {
1399
+ K.current = !0, N(e);
1210
1400
  };
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
1401
+ return /* @__PURE__ */ _(Se.Provider, {
1402
+ value: U,
1403
+ children: /* @__PURE__ */ _("div", {
1404
+ ref: H,
1405
+ className: `bailey-chat-panel${g ? ` ${g}` : ""}`,
1406
+ style: y !== void 0 || b !== void 0 ? {
1407
+ height: y,
1408
+ width: b
1219
1409
  } : void 0,
1220
- children: /* @__PURE__ */ g("div", {
1410
+ children: /* @__PURE__ */ v("div", {
1221
1411
  className: "bailey-chat-panel-inner",
1222
1412
  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", {
1413
+ /* @__PURE__ */ v("div", {
1240
1414
  className: "bailey-chat-transcript",
1241
- ref: H,
1415
+ ref: G,
1242
1416
  children: [
1243
- K && (i && i.length > 0 ? /* @__PURE__ */ g("div", {
1417
+ J && (a && a.length > 0 ? /* @__PURE__ */ v("div", {
1244
1418
  className: "bailey-suggestions",
1245
- children: [/* @__PURE__ */ h("div", {
1419
+ children: [/* @__PURE__ */ _("div", {
1246
1420
  className: "bailey-suggestions-title",
1247
- children: L.suggestionsTitle
1248
- }), i.map((e, t) => /* @__PURE__ */ g("button", {
1421
+ children: B.suggestionsTitle
1422
+ }), a.map((e, t) => /* @__PURE__ */ v("button", {
1249
1423
  type: "button",
1250
- onClick: () => J(e.value ?? e.label),
1424
+ onClick: () => X(e.value ?? e.label),
1251
1425
  className: "bailey-suggestion-card",
1252
- children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ h(Ne, { className: "bailey-suggestion-icon" })]
1426
+ children: [/* @__PURE__ */ _("span", { children: e.label }), /* @__PURE__ */ _(Ie, { className: "bailey-suggestion-icon" })]
1253
1427
  }, `${e.label}-${t}`))]
1254
- }) : /* @__PURE__ */ h("div", {
1428
+ }) : /* @__PURE__ */ _("div", {
1255
1429
  className: "bailey-empty-state",
1256
- children: L.emptyStateMessage
1430
+ children: B.emptyStateMessage
1257
1431
  })),
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", {
1432
+ O.map((e, t) => {
1433
+ let r = e.role === "assistant" && t === O.length - 1, i = j === "streaming" && r && e.content === "", a = e.role === "assistant" ? be(k, e.createdAt) : [], o = a.some((e) => e.status === "running");
1434
+ return /* @__PURE__ */ _("div", {
1261
1435
  className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
1262
- children: e.role === "user" ? /* @__PURE__ */ g("div", {
1436
+ children: e.role === "user" ? /* @__PURE__ */ v("div", {
1263
1437
  className: "bailey-user-message",
1264
- children: [/* @__PURE__ */ g("div", {
1438
+ children: [/* @__PURE__ */ v("div", {
1265
1439
  className: "bailey-message-meta",
1266
- children: [/* @__PURE__ */ h("span", {
1440
+ children: [/* @__PURE__ */ _("span", {
1267
1441
  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", {
1442
+ children: B.youLabel
1443
+ }), e.createdAt !== void 0 && /* @__PURE__ */ _("span", { children: V(e.createdAt) })]
1444
+ }), /* @__PURE__ */ _("div", {
1271
1445
  className: "bailey-user-bubble",
1272
1446
  children: e.content
1273
1447
  })]
1274
- }) : r ? /* @__PURE__ */ h("div", {
1448
+ }) : i ? o ? /* @__PURE__ */ _(ct, {
1449
+ steps: a,
1450
+ resolveActivityIcon: p
1451
+ }) : /* @__PURE__ */ _("div", {
1275
1452
  className: "bailey-thinking-hint",
1276
- children: G ?? L.thinkingHint
1277
- }) : /* @__PURE__ */ g("div", {
1453
+ children: q ?? B.thinkingHint
1454
+ }) : /* @__PURE__ */ v("div", {
1278
1455
  className: "bailey-assistant-message",
1279
1456
  children: [
1280
- a && /* @__PURE__ */ g("div", {
1281
- className: "bailey-activity-line",
1282
- children: [/* @__PURE__ */ h("span", {
1283
- className: "bailey-activity-icon",
1284
- children: f?.(a.toolName) ?? /* @__PURE__ */ h(Le, {})
1285
- }), /* @__PURE__ */ h("span", { children: a.text })]
1457
+ e.streaming ? /* @__PURE__ */ _(ct, {
1458
+ steps: a,
1459
+ resolveActivityIcon: p
1460
+ }) : /* @__PURE__ */ _(lt, {
1461
+ steps: a,
1462
+ labels: B,
1463
+ resolveActivityIcon: p
1286
1464
  }),
1287
- /* @__PURE__ */ h(et, {
1465
+ /* @__PURE__ */ _(ht, {
1288
1466
  content: e.content,
1289
- components: W
1467
+ components: te
1290
1468
  }),
1291
- e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ h(Je, {
1469
+ e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ _($e, {
1292
1470
  src: e.src,
1293
1471
  alt: e.alt
1294
- }, t) : null),
1295
- e.streaming && G && /* @__PURE__ */ h("div", {
1472
+ }, t) : e.type === "mcp_app" ? /* @__PURE__ */ _(n, { children: T ? T(e) : /* @__PURE__ */ _(ot, {
1473
+ ...e,
1474
+ title: e.title ?? B.mcpAppDefaultTitle
1475
+ }) }, t) : null),
1476
+ e.streaming && q && !o && /* @__PURE__ */ _("div", {
1296
1477
  className: "bailey-streaming-hint",
1297
- children: G
1478
+ children: q
1298
1479
  }),
1299
- !e.streaming && /* @__PURE__ */ g("div", {
1480
+ !e.streaming && /* @__PURE__ */ v("div", {
1300
1481
  className: "bailey-message-actions",
1301
- children: [/* @__PURE__ */ h(ze, {
1482
+ children: [/* @__PURE__ */ _(We, {
1302
1483
  markdown: e.content,
1303
- ariaLabel: L.copyButtonAriaLabel,
1304
- tooltipDefaultText: L.copyButtonTooltipDefault,
1305
- tooltipCopiedText: L.copyButtonTooltipCopied
1306
- }), b?.(e)]
1484
+ ariaLabel: B.copyButtonAriaLabel,
1485
+ tooltipDefaultText: B.copyButtonTooltipDefault,
1486
+ tooltipCopiedText: B.copyButtonTooltipCopied
1487
+ }), S?.(e)]
1307
1488
  })
1308
1489
  ]
1309
1490
  })
1310
1491
  }, e.id);
1311
1492
  }),
1312
- /* @__PURE__ */ h("div", { ref: V })
1493
+ /* @__PURE__ */ _("div", { ref: W })
1313
1494
  ]
1314
1495
  }),
1315
- k && /* @__PURE__ */ g("div", {
1496
+ M && /* @__PURE__ */ v("div", {
1316
1497
  className: "bailey-error-banner",
1317
1498
  role: "alert",
1318
- children: [/* @__PURE__ */ h("span", { children: k }), /* @__PURE__ */ g("div", {
1499
+ children: [/* @__PURE__ */ _("span", { children: M }), /* @__PURE__ */ v("div", {
1319
1500
  className: "bailey-error-actions",
1320
- children: [/* @__PURE__ */ h("button", {
1501
+ children: [/* @__PURE__ */ _("button", {
1321
1502
  type: "button",
1322
- onClick: ee,
1503
+ onClick: P,
1323
1504
  className: "bailey-retry-button",
1324
- children: L.retryButtonText
1325
- }), /* @__PURE__ */ h("button", {
1505
+ children: B.retryButtonText
1506
+ }), /* @__PURE__ */ _("button", {
1326
1507
  type: "button",
1327
- onClick: N,
1328
- "aria-label": L.dismissErrorAriaLabel,
1508
+ onClick: I,
1509
+ "aria-label": B.dismissErrorAriaLabel,
1329
1510
  className: "bailey-dismiss-button",
1330
1511
  children: "✕"
1331
1512
  })]
1332
1513
  })]
1333
1514
  }),
1334
- !y && /* @__PURE__ */ h(qe, {
1335
- events: E,
1336
- lastRequest: D,
1337
- onClear: M
1515
+ !x && /* @__PURE__ */ _(Qe, {
1516
+ events: k,
1517
+ lastRequest: A,
1518
+ onClear: F
1338
1519
  }),
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
- })]
1520
+ /* @__PURE__ */ v("div", {
1521
+ className: "bailey-input-area",
1522
+ children: [/* @__PURE__ */ v("form", {
1523
+ onSubmit: (e) => {
1524
+ e.preventDefault(), !(!R.trim() || j === "streaming") && (X(R), z(""));
1525
+ },
1526
+ className: "bailey-input-row",
1527
+ children: [/* @__PURE__ */ _("input", {
1528
+ type: "text",
1529
+ placeholder: Y,
1530
+ "aria-label": Y,
1531
+ value: R,
1532
+ onChange: (e) => z(e.target.value),
1533
+ disabled: j === "streaming",
1534
+ className: "bailey-input"
1535
+ }), j === "streaming" ? /* @__PURE__ */ _(h.Provider, {
1536
+ delayDuration: 200,
1537
+ children: /* @__PURE__ */ v(h.Root, { children: [/* @__PURE__ */ _(h.Trigger, {
1538
+ asChild: !0,
1539
+ children: /* @__PURE__ */ _("button", {
1540
+ type: "button",
1541
+ onClick: ee,
1542
+ "aria-label": B.stopAriaLabel,
1543
+ className: "bailey-stop-button",
1544
+ children: /* @__PURE__ */ _(Fe, { className: "bailey-stop-icon" })
1545
+ })
1546
+ }), /* @__PURE__ */ _(h.Portal, {
1547
+ container: U instanceof ShadowRoot ? U : void 0,
1548
+ children: /* @__PURE__ */ v(h.Content, {
1549
+ side: "top",
1550
+ className: "bailey-tooltip-content",
1551
+ children: [B.stopButtonText, /* @__PURE__ */ _(h.Arrow, { className: "bailey-tooltip-arrow" })]
1552
+ })
1553
+ })] })
1554
+ }) : /* @__PURE__ */ _("button", {
1555
+ type: "submit",
1556
+ "aria-label": B.sendAriaLabel,
1557
+ disabled: !R.trim(),
1558
+ className: "bailey-send-button",
1559
+ children: /* @__PURE__ */ _(Pe, { className: "bailey-send-icon" })
1560
+ })]
1561
+ }), (!J || o) && /* @__PURE__ */ v(m.Root, { children: [/* @__PURE__ */ _(m.Trigger, {
1562
+ asChild: !0,
1563
+ children: /* @__PURE__ */ _("button", {
1564
+ type: "button",
1565
+ "aria-label": B.menuAriaLabel,
1566
+ className: "bailey-menu-button",
1567
+ children: /* @__PURE__ */ _(Ve, { className: "bailey-menu-icon" })
1568
+ })
1569
+ }), /* @__PURE__ */ _(m.Portal, {
1570
+ container: U instanceof ShadowRoot ? U : void 0,
1571
+ children: /* @__PURE__ */ v(m.Content, {
1572
+ side: "top",
1573
+ align: "end",
1574
+ sideOffset: 8,
1575
+ className: "bailey-menu-content",
1576
+ children: [!J && /* @__PURE__ */ v(m.Item, {
1577
+ onSelect: () => L(),
1578
+ className: "bailey-menu-item",
1579
+ children: [/* @__PURE__ */ _(He, { className: "bailey-menu-item-icon" }), B.newChatButtonText]
1580
+ }), o && /* @__PURE__ */ v(m.Item, {
1581
+ onSelect: () => o(),
1582
+ className: "bailey-menu-item",
1583
+ children: [/* @__PURE__ */ _(ze, { className: "bailey-menu-item-icon" }), B.historyMenuItemText]
1584
+ })]
1585
+ })
1586
+ })] })]
1378
1587
  }),
1379
- (K || s?.alwaysVisible) && s && /* @__PURE__ */ h("div", {
1588
+ (J || c?.alwaysVisible) && c && /* @__PURE__ */ _("div", {
1380
1589
  className: "bailey-privacy-note",
1381
- children: /* @__PURE__ */ h(d, {
1382
- remarkPlugins: Qe,
1383
- components: $e,
1590
+ children: /* @__PURE__ */ _(f, {
1591
+ remarkPlugins: pt,
1592
+ components: mt,
1384
1593
  skipHtml: !0,
1385
- children: s.markdown
1594
+ children: c.markdown
1386
1595
  })
1387
1596
  })
1388
1597
  ]
@@ -1392,6 +1601,6 @@ function rt({ chat: e, placeholder: t, replyPlaceholder: n = Xe, emptyPlaceholde
1392
1601
  }
1393
1602
  //#endregion
1394
1603
  //#region src/index.ts
1395
- var it = "0.3.1-pre.2";
1604
+ var yt = "0.3.1-pre.2";
1396
1605
  //#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 };
1606
+ export { Be as ActivityIcon, Ie as ArrowUpRightIcon, yt as BAILEYAI_CHAT_UI_VERSION, te as BAILEY_CHART_PROMPT_FRAGMENT, z as BAILEY_TABLE_GRID_ROW_THRESHOLD, vt as BaileyChatPanel, Qe as BaileyTracePanel, We as CopyMarkdownButton, Pe as HeartIcon, ae as TRACE_KIND_LABEL, Ne as createBaileyMarkdownComponents, O as extractPseudoToolCalls, G as extractTableData, me as formatTraceGap, pe as formatTraceTime, ve as hasTraceFailure, e as isSafeMarkdownUrl, F as joinInstructions, ie as parseBaileyChartSpec, A as parseSseFrames, R as resolveToolCall, K as shouldUseGrid, ye as toActivityLines, be as toToolSteps, he as toTraceRows, _e as toTraceSegments, ce as traceEventArgsDetail, fe as traceEventHint, le as traceEventOutputDetail, de as traceEventRawDetail, se as traceEventSummary, oe as traceEventToolName, ge as traceSummaryLine, P as useBaileyChat };