@icanbwell/baileyai-chat-ui 1.0.17 → 1.0.18

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.
@@ -6,23 +6,23 @@ import * as h from "@radix-ui/react-dropdown-menu";
6
6
  import * as g from "@radix-ui/react-tooltip";
7
7
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
8
8
  //#region src/utils/pseudoToolCalls.ts
9
- var b = "search_tools|call_tool|function_calls|function_result", x = RegExp(`<(${b})>([\\s\\S]*?)<\\/\\1>`, "g"), S = RegExp(`<(?:${b})>[\\s\\S]*$`), C = /<name>([\s\S]*?)<\/name>/, w = /<arguments>([\s\S]*?)<\/arguments>/, T = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, E = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
10
- function D(e) {
11
- let t = C.exec(e)?.[1]?.trim() || "unknown_tool", n = w.exec(e)?.[1]?.trim();
9
+ var b = "search_tools|call_tool|function_calls|function_result", ee = RegExp(`<(${b})>([\\s\\S]*?)<\\/\\1>`, "g"), x = RegExp(`<(?:${b})>[\\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();
12
12
  return n ? {
13
13
  name: t,
14
14
  args: n
15
15
  } : { name: t };
16
16
  }
17
- function O(e) {
17
+ function D(e) {
18
18
  let t = [];
19
- T.lastIndex = 0;
19
+ w.lastIndex = 0;
20
20
  let n;
21
- for (; (n = T.exec(e)) !== null;) {
21
+ for (; (n = w.exec(e)) !== null;) {
22
22
  let [, e, r] = n, i = {};
23
- E.lastIndex = 0;
23
+ T.lastIndex = 0;
24
24
  let a;
25
- for (; (a = E.exec(r)) !== null;) i[a[1]] = a[2].trim();
25
+ for (; (a = T.exec(r)) !== null;) i[a[1]] = a[2].trim();
26
26
  let o = e.trim() || "unknown_tool";
27
27
  t.push(Object.keys(i).length > 0 ? {
28
28
  name: o,
@@ -31,14 +31,14 @@ function O(e) {
31
31
  }
32
32
  return t;
33
33
  }
34
- function k(e, t = {}) {
35
- let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(x, (e, t, n) => (t === "call_tool" ? r.push(D(n)) : t === "search_tools" ? r.push({
34
+ function O(e, t = {}) {
35
+ let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(ee, (e, t, n) => (t === "call_tool" ? r.push(E(n)) : t === "search_tools" ? r.push({
36
36
  name: "search_tools",
37
37
  args: n.trim()
38
- }) : t === "function_calls" ? r.push(...O(n)) : r.push({
38
+ }) : t === "function_calls" ? r.push(...D(n)) : r.push({
39
39
  name: "function_result",
40
40
  args: n.trim()
41
- }), "")), a = n ? i.replace(S, "") : i;
41
+ }), "")), a = n ? i.replace(x, "") : i;
42
42
  return r.length === 0 && a === i ? {
43
43
  cleanedText: i,
44
44
  matches: r
@@ -49,7 +49,7 @@ function k(e, t = {}) {
49
49
  }
50
50
  //#endregion
51
51
  //#region src/logic/sse.ts
52
- function ee(e) {
52
+ function k(e) {
53
53
  if (!e.startsWith("data: ")) return e;
54
54
  let t = "";
55
55
  for (let n of e.split("\n")) {
@@ -88,7 +88,7 @@ function A(e) {
88
88
  message: e
89
89
  });
90
90
  } else if (c?.type === "response.output_text.delta" && typeof c.delta == "string") {
91
- let e = ee(c.delta);
91
+ let e = k(c.delta);
92
92
  e && r.push({
93
93
  type: "response.output_text.delta",
94
94
  delta: e
@@ -184,22 +184,25 @@ function le(e, t, n) {
184
184
  return;
185
185
  }
186
186
  }
187
- function ue(e, t, n, r) {
187
+ function ue(e, t) {
188
+ t.signal.aborted || typeof e != "string" || (t.historyStatus = e);
189
+ }
190
+ function de(e, t, n, r) {
188
191
  try {
189
192
  e?.set(t, n);
190
193
  } catch (e) {
191
194
  r(e, "write");
192
195
  }
193
196
  }
194
- function de(e, t, n) {
197
+ function R(e, t, n) {
195
198
  try {
196
199
  e?.remove(t);
197
200
  } catch (e) {
198
201
  n(e, "remove");
199
202
  }
200
203
  }
201
- var R = (e, t) => t ? `${e}:${t}` : e;
202
- function z(e) {
204
+ var z = (e, t) => t ? `${e}:${t}` : e;
205
+ function fe(e) {
203
206
  let { seed: t, sub: n, storage: r, key: i, report: a } = e;
204
207
  if (!n) return t || le(r, i, a);
205
208
  if (t && re({
@@ -212,11 +215,11 @@ function z(e) {
212
215
  conversationId: o,
213
216
  sub: n
214
217
  })) return o;
215
- de(r, i, a);
218
+ R(r, i, a);
216
219
  }
217
220
  }
218
221
  var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i, firstUserMessagePrefix: o, onAssistantMessageComplete: c, idleTimeoutMs: l = L, client: p, conversationId: m, sub: h, storage: g, storageKey: _ = ie, sendFullTranscript: v = !1, onStorageError: y, onContextLoss: b }) => {
219
- let [x, S] = f([]), [C, w] = f([]), [T, E] = f(null), [D, O] = f("idle"), [ee, j] = f(null), M = h !== void 0 && h.trim() === "", N = M ? void 0 : h?.trim() || void 0, P = u(() => ae(), []), F = M ? null : g === void 0 ? P : g || null, I = d(y), le = d(b);
222
+ let [ee, x] = f([]), [S, C] = f([]), [w, T] = f(null), [E, D] = f("idle"), [k, j] = f(null), M = h !== void 0 && h.trim() === "", N = M ? void 0 : h?.trim() || void 0, P = u(() => ae(), []), F = M ? null : g === void 0 ? P : g || null, I = d(y), le = d(b);
220
223
  s(() => {
221
224
  I.current = y, le.current = b;
222
225
  }, [y, b]);
@@ -224,11 +227,11 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
224
227
  try {
225
228
  I.current?.(e, t);
226
229
  } catch {}
227
- }, []), V = (e) => z({
230
+ }, []), V = (e) => fe({
228
231
  seed: m,
229
232
  sub: N,
230
233
  storage: F,
231
- key: R(_, N),
234
+ key: z(_, N),
232
235
  report: e
233
236
  }), [H] = f(() => {
234
237
  let e = [];
@@ -239,24 +242,24 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
239
242
  })),
240
243
  errors: e
241
244
  };
242
- }), [U, W] = f(H.id), [fe, G] = f(H.errors.length > 0), K = a((e, t) => {
243
- G(!0), B(e, t);
245
+ }), [pe, U] = f(H.id), [me, he] = f(H.errors.length > 0), W = a((e, t) => {
246
+ he(!0), B(e, t);
244
247
  }, [B]);
245
248
  s(() => {
246
249
  H.errors.forEach(({ error: e, operation: t }) => B(e, t));
247
250
  }, [H, B]), s(() => {
248
251
  M && B(/* @__PURE__ */ Error("sub is blank"), "key");
249
252
  }, [M, B]);
250
- let q = d(U), J = d({
253
+ let G = d(pe), K = d({
251
254
  storage: F,
252
- key: R(_, N),
255
+ key: z(_, N),
253
256
  sub: N,
254
257
  sendFullTranscript: v
255
258
  });
256
259
  s(() => {
257
- J.current = {
260
+ K.current = {
258
261
  storage: F,
259
- key: R(_, N),
262
+ key: z(_, N),
260
263
  sub: N,
261
264
  sendFullTranscript: v
262
265
  };
@@ -266,54 +269,54 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
266
269
  N,
267
270
  v
268
271
  ]);
269
- let pe = g === !1 ? "off" : fe || M ? "degraded" : "ok", [me, he] = f(!1), [ge, Y] = f("idle"), [_e, ve] = f(!1), X = d(0), Z = d(null), ye = d(null), Q = d(!1), be = a(() => {
270
- X.current += 1, Z.current?.abort(), Z.current = null, ye.current = null, Q.current = !1, ve(!1), Y("idle");
271
- }, []), xe = d(p);
272
+ let ge = g === !1 ? "off" : me || M ? "degraded" : "ok", [_e, ve] = f(!1), [ye, q] = f("idle"), [be, xe] = f(!1), J = d(0), Y = d(null), X = d(null), Se = d(!1), Z = a(() => {
273
+ J.current += 1, Y.current?.abort(), Y.current = null, X.current = null, Se.current = !1, xe(!1), q("idle");
274
+ }, []), Ce = d(p);
272
275
  s(() => {
273
- xe.current = p;
274
- }, [p]), s(() => () => Z.current?.abort(), []);
275
- let Se = d(null), Ce = d(""), we = d(0), Te = d([]);
276
+ Ce.current = p;
277
+ }, [p]), s(() => () => Y.current?.abort(), []);
278
+ let we = d(null), Te = d(""), Ee = d(0), De = d([]);
276
279
  s(() => {
277
- Te.current = x;
278
- }, [x]);
279
- let $ = d([]), Ee = d(/* @__PURE__ */ new Map()), De = d(/* @__PURE__ */ new Map()), Oe = d(null), ke = a(() => {
280
- Oe.current !== null && (clearTimeout(Oe.current), Oe.current = null);
281
- }, []), Ae = a((e) => {
282
- ke(), Oe.current = setTimeout(() => {
280
+ De.current = ee;
281
+ }, [ee]);
282
+ let Q = d([]), Oe = d(/* @__PURE__ */ new Map()), ke = d(/* @__PURE__ */ new Map()), Ae = d(null), $ = a(() => {
283
+ Ae.current !== null && (clearTimeout(Ae.current), Ae.current = null);
284
+ }, []), je = a((e) => {
285
+ $(), Ae.current = setTimeout(() => {
283
286
  e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
284
287
  }, l);
285
- }, [ke, l]);
288
+ }, [$, l]);
286
289
  s(() => () => {
287
- Se.current?.abort(), ke();
288
- }, [ke]);
289
- let je = a(({ reportedId: e, source: t, turn: n }) => {
290
+ we.current?.abort(), $();
291
+ }, [$]);
292
+ let Me = a(({ reportedId: e, source: t, turn: n }) => {
290
293
  if (n.signal.aborted || typeof e != "string" || !e) return;
291
294
  if (t === "event") n.reportedId = e, n.reportedFromEvent = !0;
292
295
  else if (!n.reportedFromEvent) n.reportedId = e;
293
296
  else return;
294
- if (n.heldId || e === q.current) return;
295
- let { sub: r, storage: i, key: a } = J.current;
297
+ if (n.heldId || e === G.current) return;
298
+ let { sub: r, storage: i, key: a } = K.current;
296
299
  r && !re({
297
300
  conversationId: e,
298
301
  sub: r
299
- }) || (q.current = e, W(e), ue(i, a, e, K));
300
- }, [K]), Me = a((e, t, n, r) => {
302
+ }) || (G.current = e, U(e), de(i, a, e, W));
303
+ }, [W]), Ne = a((e, t, n, r) => {
301
304
  let i = (e) => {
302
- n.push(e), w((t) => [...t, e]);
305
+ n.push(e), C((t) => [...t, e]);
303
306
  };
304
307
  if (t.type === "response.output_text.delta") {
305
308
  if (!t.delta) return !1;
306
- let n = Ee.current.get(e) ?? {
309
+ let n = Oe.current.get(e) ?? {
307
310
  raw: "",
308
311
  emittedCount: 0
309
312
  };
310
313
  n.raw += t.delta;
311
- let { cleanedText: r, matches: a } = k(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
312
- if (n.emittedCount = a.length, Ee.current.set(e, n), De.current.set(e, o), S((t) => t.map((t) => t.id === e ? {
314
+ let { cleanedText: r, matches: a } = O(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
315
+ if (n.emittedCount = a.length, Oe.current.set(e, n), ke.current.set(e, o), x((t) => t.map((t) => t.id === e ? {
313
316
  ...t,
314
317
  content: o
315
318
  } : t)), s.length > 0) {
316
- let e = Date.now(), t = we.current;
319
+ let e = Date.now(), t = Ee.current;
317
320
  s.forEach((n) => i({
318
321
  kind: "pseudo_tool_call",
319
322
  name: n.name,
@@ -326,7 +329,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
326
329
  }
327
330
  if (t.type === "response.output_item.added" || t.type === "response.output_item.done") {
328
331
  let n = t.item;
329
- if (n.type === "output_image") return n.image_url && S((t) => t.map((t) => t.id === e ? {
332
+ if (n.type === "output_image") return n.image_url && x((t) => t.map((t) => t.id === e ? {
330
333
  ...t,
331
334
  parts: [...t.parts ?? [], {
332
335
  type: "image",
@@ -334,7 +337,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
334
337
  }]
335
338
  } : t)), !0;
336
339
  if (n.type === "function_call" || n.type === "mcp_call") {
337
- let e = Date.now(), r = we.current, a = n.name || "unknown_tool";
340
+ let e = Date.now(), r = Ee.current, a = n.name || "unknown_tool";
338
341
  return i(t.type === "response.output_item.added" ? {
339
342
  kind: "tool_start",
340
343
  name: a,
@@ -358,7 +361,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
358
361
  }), !0;
359
362
  }
360
363
  if (n.type === "llm_call") {
361
- let e = Date.now(), r = we.current;
364
+ let e = Date.now(), r = Ee.current;
362
365
  return i(t.type === "response.output_item.added" ? {
363
366
  kind: "llm_call_start",
364
367
  request: n.request ?? [],
@@ -378,29 +381,29 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
378
381
  status: t.status,
379
382
  message: t.message,
380
383
  at: Date.now(),
381
- turnSentAt: we.current
384
+ turnSentAt: Ee.current
382
385
  }), !0;
383
386
  if (t.type === "response.output_text.done") return !1;
384
- if (t.type === "response.created") return je({
387
+ if (t.type === "response.created") return Me({
385
388
  reportedId: t.response?.conversation?.id,
386
389
  source: "event",
387
390
  turn: r
388
- }), !1;
391
+ }), ue(t.response?.conversation?.history_status, r), !1;
389
392
  if (t.type === "response.completed") {
390
- je({
393
+ Me({
391
394
  reportedId: t.response?.conversation?.id,
392
395
  source: "event",
393
396
  turn: r
394
- });
397
+ }), ue(t.response?.conversation?.history_status, r);
395
398
  let n = typeof t.message_id == "string" && t.message_id ? t.message_id : void 0;
396
- n && S((t) => t.map((t) => t.id === e ? {
399
+ n && x((t) => t.map((t) => t.id === e ? {
397
400
  ...t,
398
401
  serverMessageId: n
399
402
  } : t));
400
- let i = Ee.current.get(e);
403
+ let i = Oe.current.get(e);
401
404
  if (i) {
402
- let { cleanedText: t } = k(i.raw, { hideOpenBlock: !1 }), n = t.trim();
403
- n !== De.current.get(e) && (De.current.set(e, n), S((t) => t.map((t) => t.id === e ? {
405
+ let { cleanedText: t } = O(i.raw, { hideOpenBlock: !1 }), n = t.trim();
406
+ n !== ke.current.get(e) && (ke.current.set(e, n), x((t) => t.map((t) => t.id === e ? {
404
407
  ...t,
405
408
  content: n
406
409
  } : t)));
@@ -411,7 +414,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
411
414
  kind: "info",
412
415
  message: t.message,
413
416
  at: Date.now(),
414
- turnSentAt: we.current
417
+ turnSentAt: Ee.current
415
418
  }), !0;
416
419
  if (t.type === "mcp_app") {
417
420
  let n = t.resourceUri;
@@ -420,10 +423,10 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
420
423
  eventType: t.type,
421
424
  raw: JSON.stringify(t),
422
425
  at: Date.now(),
423
- turnSentAt: we.current
426
+ turnSentAt: Ee.current
424
427
  }), !0;
425
428
  let { html: r, title: a, csp: o, permissions: s, prefersBorder: c, displayMode: l } = t;
426
- return S((t) => t.map((t) => t.id === e ? {
429
+ return x((t) => t.map((t) => t.id === e ? {
427
430
  ...t,
428
431
  parts: [...t.parts ?? [], {
429
432
  type: "mcp_app",
@@ -442,12 +445,12 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
442
445
  eventType: t.type,
443
446
  raw: JSON.stringify(t),
444
447
  at: Date.now(),
445
- turnSentAt: we.current
448
+ turnSentAt: Ee.current
446
449
  }), !0;
447
- }, [je]), Ne = a(async (a) => {
448
- O("streaming"), j(null), he(!1);
450
+ }, [Me]), Pe = a(async (a) => {
451
+ D("streaming"), j(null), ve(!1);
449
452
  let s = Date.now();
450
- we.current = s;
453
+ Ee.current = s;
451
454
  let l = se(), u = {
452
455
  id: l,
453
456
  role: "assistant",
@@ -455,7 +458,7 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
455
458
  streaming: !0,
456
459
  createdAt: s
457
460
  };
458
- S((e) => [...e, u]), $.current = [...a, u];
461
+ x((e) => [...e, u]), Q.current = [...a, u];
459
462
  let d = a.findIndex((e) => e.role === "user" && !e.hidden), f = a.map((e, t) => t === d && o ? {
460
463
  role: e.role,
461
464
  content: `${o}${e.content}`,
@@ -466,8 +469,8 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
466
469
  content: e.content,
467
470
  hidden: e.hidden,
468
471
  titleHint: e.titleHint
469
- }), { sendFullTranscript: p } = J.current, m = p ? void 0 : q.current, h = m ? f.slice(-1) : f;
470
- E({
472
+ }), { sendFullTranscript: p } = K.current, m = p ? void 0 : G.current, h = m ? f.slice(-1) : f;
473
+ T({
471
474
  model: t,
472
475
  systemPrompt: n,
473
476
  messages: h,
@@ -482,12 +485,12 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
482
485
  }
483
486
  });
484
487
  let g = new AbortController();
485
- Se.current = g, Ae(g);
488
+ we.current = g, je(g);
486
489
  let _ = {
487
490
  signal: g.signal,
488
491
  heldId: m
489
- }, v = "", y = null, b = !1, x = !1, C = !1, T = [], D = (e, t) => {
490
- O("error"), j(e);
492
+ }, v = "", y = null, b = !1, ee = !1, S = !1, w = [], E = (e, t) => {
493
+ D("error"), j(e);
491
494
  let n = {
492
495
  kind: "error",
493
496
  message: e,
@@ -495,8 +498,8 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
495
498
  turnSentAt: s,
496
499
  ...t
497
500
  };
498
- T.push(n), w((e) => [...e, n]);
499
- }, k = (e, t) => {
501
+ w.push(n), C((e) => [...e, n]);
502
+ }, O = (e, t) => {
500
503
  e.forEach((e) => {
501
504
  if (e.type === "error") {
502
505
  y = e.message;
@@ -506,11 +509,11 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
506
509
  at: Date.now(),
507
510
  turnSentAt: s
508
511
  };
509
- T.push(t), w((e) => [...e, t]);
512
+ w.push(t), C((e) => [...e, t]);
510
513
  return;
511
514
  }
512
- e.type === "response.output_text.delta" && e.delta && (C = !0), Me(l, e, T, _) && (x = !0);
513
- }), t && (b = !0, S((e) => e.map((e) => e.id === l ? {
515
+ e.type === "response.output_text.delta" && e.delta && (S = !0), Ne(l, e, w, _) && (ee = !0);
516
+ }), t && (b = !0, x((e) => e.map((e) => e.id === l ? {
514
517
  ...e,
515
518
  streaming: !1
516
519
  } : e)));
@@ -523,18 +526,18 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
523
526
  tools: r,
524
527
  toolChoice: i,
525
528
  ...m ? { conversationId: m } : {},
526
- onConversationId: (e) => je({
529
+ onConversationId: (e) => Me({
527
530
  reportedId: e,
528
531
  source: "header",
529
532
  turn: _
530
533
  }),
531
534
  signal: g.signal,
532
535
  onChunk: (e) => {
533
- Ae(g), v += e;
536
+ je(g), v += e;
534
537
  let { events: t, remainder: n, done: r } = A(v);
535
- v = n, k(t, r);
538
+ v = n, O(t, r);
536
539
  let i = Date.now();
537
- E((e) => e && e.sentAt === s ? {
540
+ T((e) => e && e.sentAt === s ? {
538
541
  ...e,
539
542
  streamStats: {
540
543
  chunkCount: e.streamStats.chunkCount + 1,
@@ -544,13 +547,13 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
544
547
  } : e);
545
548
  },
546
549
  onRequestId: (e) => {
547
- E((t) => t && t.sentAt === s ? {
550
+ T((t) => t && t.sentAt === s ? {
548
551
  ...t,
549
552
  requestId: e
550
553
  } : t);
551
554
  },
552
555
  onMessageId: (e) => {
553
- typeof e == "string" && e && S((t) => t.map((t) => t.id === l ? {
556
+ typeof e == "string" && e && x((t) => t.map((t) => t.id === l ? {
554
557
  ...t,
555
558
  serverMessageId: e
556
559
  } : t));
@@ -558,72 +561,73 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
558
561
  });
559
562
  if (v.trim()) {
560
563
  let { events: e, done: t } = A(`${v}\n\n`);
561
- v = "", k(e, t);
564
+ v = "", O(e, t);
562
565
  }
563
566
  if (y) {
564
- O("error"), j(y);
567
+ D("error"), j(y);
565
568
  return;
566
569
  }
567
570
  if (d && !b) {
568
- D("The connection was interrupted before the answer finished. Try again.");
571
+ E("The connection was interrupted before the answer finished. Try again.");
569
572
  return;
570
573
  }
571
574
  if (a === void 0 || a >= 400) {
572
- D(ce(a, o, u), {
575
+ E(ce(a, o, u), {
573
576
  httpStatus: a,
574
577
  rawBody: o || void 0
575
578
  });
576
579
  return;
577
580
  }
578
- let f = _.reportedId;
579
- if (m && f !== m) {
580
- q.current = void 0, W(void 0), de(J.current.storage, J.current.key, K), be(), he(!0);
581
+ let f = _.reportedId, p = f !== m, C = _.historyStatus === "failed" || _.historyStatus === "empty";
582
+ if (m && !_.signal.aborted && (p || C)) {
583
+ G.current = void 0, U(void 0), R(K.current.storage, K.current.key, W), Z(), ve(!0);
581
584
  try {
582
585
  le.current?.({
583
586
  sentId: m,
584
- ...f ? { reportedId: f } : {}
587
+ ...f ? { reportedId: f } : {},
588
+ reason: p ? "id" : "history"
585
589
  });
586
590
  } catch {}
587
591
  }
588
- if (!x) {
589
- D("Bailey returned an empty response.");
592
+ if (!ee) {
593
+ E("Bailey returned an empty response.");
590
594
  return;
591
595
  }
592
- if (!C) {
593
- D("Bailey ran some tools but didn't return an answer. Try asking again.");
596
+ if (!S) {
597
+ E("Bailey ran some tools but didn't return an answer. Try asking again.");
594
598
  return;
595
599
  }
596
- O("idle");
597
- let p = De.current.get(l) ?? "";
598
- E((e) => e && e.sentAt === s ? {
600
+ D("idle");
601
+ let k = ke.current.get(l) ?? "";
602
+ T((e) => e && e.sentAt === s ? {
599
603
  ...e,
600
- response: { content: p }
604
+ response: { content: k }
601
605
  } : e), c && await c({
602
606
  id: l,
603
607
  role: "assistant",
604
- content: p,
608
+ content: k,
605
609
  streaming: !1
606
- }, T);
610
+ }, w);
607
611
  } catch (e) {
608
612
  let t = e;
609
613
  if (t?.name === "TimeoutError") {
610
- D(t.message, { source: "client-timeout" });
614
+ E(t.message, { source: "client-timeout" });
611
615
  return;
612
616
  }
613
617
  if (t?.name === "AbortError") {
614
- O("idle");
618
+ D("idle");
615
619
  return;
616
620
  }
617
- D(t?.message || "Bailey request failed.");
621
+ E(t?.message || "Bailey request failed.");
618
622
  } finally {
619
- ke();
620
- let e = De.current.get(l) ?? "";
621
- Ee.current.delete(l), De.current.delete(l);
622
- let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
623
- S((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
623
+ $();
624
+ let e = ke.current.get(l) ?? "";
625
+ Oe.current.delete(l), ke.current.delete(l);
626
+ let t = w.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
627
+ x((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
624
628
  ...e,
625
629
  streaming: !1
626
- }] : [] : [e])), $.current = $.current.flatMap((t) => t.id === l ? e ? [{
630
+ }] : [] : [e])), Q.current = Q.current.flatMap((t) => t.id === l ? e ? [{
627
631
  ...t,
628
632
  content: e,
629
633
  streaming: !1
@@ -637,30 +641,30 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
637
641
  i,
638
642
  o,
639
643
  c,
644
+ Ne,
640
645
  Me,
641
646
  je,
642
- Ae,
643
- ke,
644
- K,
645
- be
646
- ]), Pe = a((e) => {
647
- Te.current = e, S(e);
648
- }, []), Fe = a((e) => {
647
+ $,
648
+ W,
649
+ Z
650
+ ]), Fe = a((e) => {
651
+ De.current = e, x(e);
652
+ }, []), Ie = a((e) => {
649
653
  let t = e.trim();
650
654
  if (!t) return;
651
- Ce.current = t;
655
+ Te.current = t;
652
656
  let n = {
653
657
  id: se(),
654
658
  role: "user",
655
659
  content: t,
656
660
  createdAt: Date.now()
657
- }, r = [...$.current, n];
658
- $.current = r, Pe([...Te.current, n]), Ne(r);
659
- }, [Ne, Pe]), Ie = a((e, t) => {
660
- if (D === "streaming") return;
661
+ }, r = [...Q.current, n];
662
+ Q.current = r, Fe([...De.current, n]), Pe(r);
663
+ }, [Pe, Fe]), Le = a((e, t) => {
664
+ if (E === "streaming") return;
661
665
  let n = e.trim();
662
666
  if (!n) return;
663
- Ce.current = n;
667
+ Te.current = n;
664
668
  let r = t?.trim(), i = {
665
669
  id: se(),
666
670
  role: "user",
@@ -668,98 +672,98 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
668
672
  createdAt: Date.now(),
669
673
  hidden: !0,
670
674
  ...r ? { titleHint: r } : {}
671
- }, a = [...$.current, i];
672
- $.current = a, Ne(a);
673
- }, [Ne, D]), Le = a(() => {
674
- Se.current?.abort();
675
- }, []), Re = a(() => {
676
- if (D === "streaming" || !Ce.current) return;
677
- let e = Te.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
678
- Pe(n);
679
- let r = $.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
680
- $.current = a, Ne(a);
675
+ }, a = [...Q.current, i];
676
+ Q.current = a, Pe(a);
677
+ }, [Pe, E]), Re = a(() => {
678
+ we.current?.abort();
679
+ }, []), ze = a(() => {
680
+ if (E === "streaming" || !Te.current) return;
681
+ let e = De.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
682
+ Fe(n);
683
+ let r = Q.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
684
+ Q.current = a, Pe(a);
681
685
  }, [
682
- Ne,
683
686
  Pe,
684
- D
685
- ]), ze = a(() => w([]), []), Be = a(() => {
686
- j(null), O((e) => e === "error" ? "idle" : e);
687
- }, []), Ve = a(() => {
688
- Se.current?.abort(), be(), he(!1), Pe([]), $.current = [], w([]), E(null), O("idle"), j(null), Ce.current = "";
689
- }, [be, Pe]), He = a(() => {
690
- Ve(), q.current = void 0, W(void 0), de(J.current.storage, J.current.key, K);
691
- }, [Ve, K]), Ue = d(N);
687
+ Fe,
688
+ E
689
+ ]), Be = a(() => C([]), []), Ve = a(() => {
690
+ j(null), D((e) => e === "error" ? "idle" : e);
691
+ }, []), He = a(() => {
692
+ we.current?.abort(), Z(), ve(!1), Fe([]), Q.current = [], C([]), T(null), D("idle"), j(null), Te.current = "";
693
+ }, [Z, Fe]), Ue = a(() => {
694
+ He(), G.current = void 0, U(void 0), R(K.current.storage, K.current.key, W);
695
+ }, [He, W]), We = d(N);
692
696
  s(() => {
693
- let e = Ue.current;
697
+ let e = We.current;
694
698
  if (e === N) return;
695
- Ue.current = N, e !== void 0 && Ve();
696
- let t = V(K);
697
- q.current = t, W(t);
699
+ We.current = N, e !== void 0 && He();
700
+ let t = V(W);
701
+ G.current = t, U(t);
698
702
  }, [N]);
699
- let We = a((e) => {
700
- Se.current?.abort();
703
+ let Ge = a((e) => {
704
+ we.current?.abort();
701
705
  let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
702
706
  ...e,
703
707
  streaming: !1
704
708
  }));
705
- Pe(t.filter((e) => !e.hidden)), $.current = t, w([]), E(null), O("idle"), j(null), Ce.current = "";
706
- }, [Pe]), Ge = a((e) => {
707
- be(), We(e);
708
- }, [be, We]), Ke = a((e) => {
709
- q.current = e, W(e), ue(J.current.storage, J.current.key, e, K), he(!1);
710
- }, [K]), qe = a((e) => {
709
+ Fe(t.filter((e) => !e.hidden)), Q.current = t, C([]), T(null), D("idle"), j(null), Te.current = "";
710
+ }, [Fe]), Ke = a((e) => {
711
+ Z(), Ge(e);
712
+ }, [Z, Ge]), qe = a((e) => {
713
+ G.current = e, U(e), de(K.current.storage, K.current.key, e, W), ve(!1);
714
+ }, [W]), Je = a((e) => {
711
715
  let t = e.hasMoreBefore && e.nextBeforeAbsoluteIndex !== null;
712
- ye.current = t ? e.nextBeforeAbsoluteIndex : null, ve(t);
716
+ X.current = t ? e.nextBeforeAbsoluteIndex : null, xe(t);
713
717
  }, []);
714
718
  return {
715
- conversationId: U,
716
- persistence: pe,
717
- contextLost: me,
718
- messages: x,
719
- traceEvents: C,
720
- lastRequest: T,
721
- status: D,
722
- error: ee,
723
- send: Fe,
724
- sendHidden: Ie,
725
- stop: Le,
726
- retryLast: Re,
727
- clearTrace: ze,
728
- clearError: Be,
729
- newChat: He,
730
- loadMessages: Ge,
719
+ conversationId: pe,
720
+ persistence: ge,
721
+ contextLost: _e,
722
+ messages: ee,
723
+ traceEvents: S,
724
+ lastRequest: w,
725
+ status: E,
726
+ error: k,
727
+ send: Ie,
728
+ sendHidden: Le,
729
+ stop: Re,
730
+ retryLast: ze,
731
+ clearTrace: Be,
732
+ clearError: Ve,
733
+ newChat: Ue,
734
+ loadMessages: Ke,
731
735
  loadConversation: a(async ({ conversationId: e }) => {
732
- let t = xe.current, { sub: n } = J.current, r = !!e && (!n || re({
736
+ let t = Ce.current, { sub: n } = K.current, r = !!e && (!n || re({
733
737
  conversationId: e,
734
738
  sub: n
735
739
  }));
736
- if (!t || !r) throw Y("error"), Error(t ? "invalid conversation id" : "no client");
737
- Se.current?.abort(), be();
738
- let i = X.current, a = new AbortController();
739
- Z.current = a, Y("loading");
740
+ if (!t || !r) throw q("error"), Error(t ? "invalid conversation id" : "no client");
741
+ we.current?.abort(), Z();
742
+ let i = J.current, a = new AbortController();
743
+ Y.current = a, q("loading");
740
744
  try {
741
745
  let n = await t.getConversation({
742
746
  conversationId: e,
743
747
  limit: oe,
744
748
  signal: a.signal
745
749
  });
746
- if (i !== X.current) return;
747
- We(te({ messages: n.messages })), Ke(e), qe(n), Y("idle");
750
+ if (i !== J.current) return;
751
+ Ge(te({ messages: n.messages })), qe(e), Je(n), q("idle");
748
752
  } catch (e) {
749
- if (i !== X.current) return;
750
- throw Y("error"), e;
753
+ if (i !== J.current) return;
754
+ throw q("error"), e;
751
755
  }
752
756
  }, [
757
+ Je,
758
+ Z,
753
759
  qe,
754
- be,
755
- Ke,
756
- We
760
+ Ge
757
761
  ]),
758
762
  loadEarlier: a(async () => {
759
- let e = xe.current, t = q.current, n = ye.current;
760
- if (!e || !t || n === null || Q.current) return;
761
- let r = X.current, i = new AbortController();
762
- Z.current = i, Q.current = !0, Y("loading");
763
+ let e = Ce.current, t = G.current, n = X.current;
764
+ if (!e || !t || n === null || Se.current) return;
765
+ let r = J.current, i = new AbortController();
766
+ Y.current = i, Se.current = !0, q("loading");
763
767
  try {
764
768
  let a = await e.getConversation({
765
769
  conversationId: t,
@@ -767,27 +771,27 @@ var B = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
767
771
  beforeAbsoluteIndex: n,
768
772
  signal: i.signal
769
773
  });
770
- if (r !== X.current) return;
774
+ if (r !== J.current) return;
771
775
  let o = te({ messages: a.messages });
772
- $.current = ne({
773
- current: $.current,
776
+ Q.current = ne({
777
+ current: Q.current,
774
778
  earlier: o
775
- }), S((e) => {
779
+ }), x((e) => {
776
780
  let t = ne({
777
781
  current: e,
778
782
  earlier: o
779
783
  });
780
- return Te.current = t, t;
781
- }), qe(a), Y("idle");
784
+ return De.current = t, t;
785
+ }), Je(a), q("idle");
782
786
  } catch (e) {
783
- if (r !== X.current) return;
784
- throw Y("error"), e;
787
+ if (r !== J.current) return;
788
+ throw q("error"), e;
785
789
  } finally {
786
- r === X.current && (Q.current = !1);
790
+ r === J.current && (Se.current = !1);
787
791
  }
788
- }, [qe]),
789
- hasEarlier: _e,
790
- historyStatus: ge
792
+ }, [Je]),
793
+ hasEarlier: be,
794
+ historyStatus: ye
791
795
  };
792
796
  }, V = class extends Error {
793
797
  status;
@@ -805,16 +809,16 @@ function H(e) {
805
809
  default: return "Bailey request failed (network error)";
806
810
  }
807
811
  }
808
- var U = class extends Error {
812
+ var pe = class extends Error {
809
813
  operation;
810
814
  constructor(e) {
811
815
  super(`Bailey cleanup failed (${e.operation})`), this.name = "BaileyCleanupError", this.operation = e.operation;
812
816
  }
813
- }, W = (e) => e instanceof V ? e : new V({
817
+ }, U = (e) => e instanceof V ? e : new V({
814
818
  status: 0,
815
819
  kind: "network"
816
820
  });
817
- function fe(e) {
821
+ function me(e) {
818
822
  let { pageSize: t, enabled: n = !0 } = e, [r, i] = f([]), [o, c] = f(n ? "loading" : "idle"), [l, u] = f(null), [p, m] = f(null), h = d(e.client), g = d([]);
819
823
  s(() => {
820
824
  h.current = e.client, g.current = r;
@@ -837,15 +841,15 @@ function fe(e) {
837
841
  }), _.current = r.nextCursor, m(r.nextCursor), u(null), c("idle");
838
842
  } catch (e) {
839
843
  if (n.signal.aborted) return;
840
- u(W(e)), c("error");
844
+ u(U(e)), c("error");
841
845
  }
842
846
  }, [t]);
843
847
  s(() => {
844
848
  if (n) return y("replace"), () => v.current?.abort();
845
849
  }, [n, y]);
846
- let b = a(() => y("replace"), [y]), x = a(async () => {
850
+ let b = a(() => y("replace"), [y]), ee = a(async () => {
847
851
  _.current !== null && await y("append");
848
- }, [y]), S = a(async ({ conversationId: e }) => {
852
+ }, [y]), x = a(async ({ conversationId: e }) => {
849
853
  let t = g.current.findIndex((t) => t.conversationId === e), n = t === -1 ? void 0 : {
850
854
  row: g.current[t],
851
855
  index: t
@@ -869,74 +873,86 @@ function fe(e) {
869
873
  error: l,
870
874
  hasMore: p !== null,
871
875
  refresh: b,
872
- loadMore: x,
873
- remove: S
876
+ loadMore: ee,
877
+ remove: x
874
878
  };
875
879
  }
876
880
  //#endregion
877
881
  //#region src/client/routes.ts
878
- function G(e) {
882
+ function he(e) {
879
883
  return e.replace(/\/+$/, "");
880
884
  }
881
- function K(e, t) {
885
+ function W(e, t) {
882
886
  let n = new URLSearchParams();
883
887
  for (let [e, r] of Object.entries(t)) r !== void 0 && n.set(e, String(r));
884
888
  let r = n.toString();
885
889
  return r ? `${e}?${r}` : e;
886
890
  }
887
- var q = {
891
+ var G = {
888
892
  responses(e) {
889
- return `${G(e)}/responses`;
893
+ return `${he(e)}/responses`;
890
894
  },
891
895
  conversations(e, t) {
892
- return K(`${G(e)}/conversations`, {
896
+ return W(`${he(e)}/conversations`, {
893
897
  limit: t.limit,
894
898
  cursor: t.cursor
895
899
  });
896
900
  },
897
901
  conversation(e, t, n) {
898
- return K(`${G(e)}/conversations/${encodeURIComponent(t)}`, {
902
+ return W(`${he(e)}/conversations/${encodeURIComponent(t)}`, {
899
903
  limit: n.limit,
900
904
  before_absolute_index: n.beforeAbsoluteIndex
901
905
  });
902
906
  },
903
907
  feedback(e, t, n) {
904
- return `${G(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
908
+ return `${he(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
905
909
  }
906
- }, J = 3e4, pe = 155e3, me = "x-chat-id", he = "header", ge = "body", Y = "x-request-id", _e = "x-conversation-id", ve = "x-message-id", X = (e) => e && typeof e == "object" ? e : {}, Z = (e, t = "") => typeof e == "string" ? e : t, ye = (e, t = 0) => typeof e == "number" ? e : t;
907
- function Q(e) {
908
- let t = X(e);
910
+ };
911
+ //#endregion
912
+ //#region src/client/createBaileyClient.ts
913
+ function K(e) {
909
914
  return {
910
- conversationId: Z(t.conversation_id),
915
+ status: void 0,
916
+ text: "",
917
+ errorMessage: "Request failed",
918
+ errorKind: "network",
919
+ ...e ? { errorCause: e.cause } : {}
920
+ };
921
+ }
922
+ var ge = 3e4, _e = 155e3, ve = "x-chat-id", ye = "header", q = "body", be = "x-request-id", xe = "x-conversation-id", J = "x-message-id", Y = (e) => e && typeof e == "object" ? e : {}, X = (e, t = "") => typeof e == "string" ? e : t, Se = (e, t = 0) => typeof e == "number" ? e : t;
923
+ function Z(e) {
924
+ let t = Y(e);
925
+ return {
926
+ conversationId: X(t.conversation_id),
911
927
  title: typeof t.title == "string" ? t.title : null,
912
- status: Z(t.status),
913
- messageCount: ye(t.message_count),
914
- createdAt: Z(t.created_at),
915
- updatedAt: Z(t.updated_at)
928
+ status: X(t.status),
929
+ messageCount: Se(t.message_count),
930
+ createdAt: X(t.created_at),
931
+ updatedAt: X(t.updated_at)
916
932
  };
917
933
  }
918
- function be(e) {
934
+ function Ce(e) {
919
935
  if (!e || typeof e != "object") return null;
920
- let t = X(e);
936
+ let t = Y(e);
921
937
  return {
922
- rating: Z(t.rating),
938
+ rating: X(t.rating),
923
939
  reasonCodes: Array.isArray(t.reason_codes) ? t.reason_codes.filter((e) => typeof e == "string") : [],
924
940
  comment: typeof t.comment == "string" ? t.comment : null,
925
941
  ...typeof t.updated_at == "string" ? { updatedAt: t.updated_at } : {}
926
942
  };
927
943
  }
928
- function xe(e) {
929
- let t = X(e);
944
+ function we(e) {
945
+ let t = Y(e);
930
946
  return {
931
- messageId: Z(t.message_id),
932
- role: Z(t.role),
933
- content: Z(t.content),
947
+ messageId: X(t.message_id),
948
+ role: X(t.role),
949
+ content: X(t.content),
934
950
  hidden: t.hidden === !0,
935
- createdAt: Z(t.created_at),
936
- feedback: be(t.feedback)
951
+ createdAt: X(t.created_at),
952
+ feedback: Ce(t.feedback)
937
953
  };
938
954
  }
939
- function Se(e) {
955
+ function Te(e) {
940
956
  let t = new AbortController(), n = !1, r = setTimeout(() => {
941
957
  n = !0, t.abort();
942
958
  }, e.timeoutMs), i = () => t.abort(e.caller?.reason);
@@ -948,7 +964,7 @@ function Se(e) {
948
964
  }
949
965
  };
950
966
  }
951
- function Ce(e) {
967
+ function Ee(e) {
952
968
  return e.timedOut() ? new V({
953
969
  status: 0,
954
970
  kind: "timeout",
@@ -958,20 +974,20 @@ function Ce(e) {
958
974
  kind: "aborted"
959
975
  });
960
976
  }
961
- function we(e) {
962
- let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? J, a = e.idleTimeoutMs ?? pe, o = e.conversationVia ?? he;
963
- if (o !== he && o !== ge) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
977
+ function De(e) {
978
+ let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? ge, a = e.idleTimeoutMs ?? _e, o = e.conversationVia ?? ye;
979
+ if (o !== ye && o !== q) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
964
980
  let s = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
965
981
  function c(t) {
966
982
  try {
967
- e.onCleanupError?.(new U({ operation: t }));
983
+ e.onCleanupError?.(new pe({ operation: t }));
968
984
  } catch {}
969
985
  }
970
986
  function l(e) {
971
987
  e.kind === "http" && (e.status === 401 || e.status === 403) && r?.(e);
972
988
  }
973
989
  async function u(e) {
974
- let t = Se({
990
+ let t = Te({
975
991
  caller: e.signal,
976
992
  timeoutMs: i
977
993
  });
@@ -988,7 +1004,7 @@ function we(e) {
988
1004
  kind: "network"
989
1005
  });
990
1006
  }
991
- if (t.signal.aborted) throw Ce(t);
1007
+ if (t.signal.aborted) throw Ee(t);
992
1008
  e.body !== void 0 && (r["Content-Type"] = "application/json");
993
1009
  let i;
994
1010
  try {
@@ -999,7 +1015,7 @@ function we(e) {
999
1015
  signal: t.signal
1000
1016
  });
1001
1017
  } catch (e) {
1002
- throw t.signal.aborted ? Ce(t) : new V({
1018
+ throw t.signal.aborted ? Ee(t) : new V({
1003
1019
  status: 0,
1004
1020
  kind: "network",
1005
1021
  cause: e
@@ -1025,7 +1041,7 @@ function we(e) {
1025
1041
  return t;
1026
1042
  } catch (n) {
1027
1043
  if (n instanceof V) throw n;
1028
- if (t.timedOut() || t.signal.aborted) throw Ce(t);
1044
+ if (t.timedOut() || t.signal.aborted) throw Ee(t);
1029
1045
  if (e.requireJsonBody) throw new V({
1030
1046
  status: i.status,
1031
1047
  kind: "invalid-response"
@@ -1056,14 +1072,10 @@ function we(e) {
1056
1072
  ...await n()
1057
1073
  };
1058
1074
  } catch {
1059
- return {
1060
- status: void 0,
1061
- text: "",
1062
- errorMessage: "Request failed"
1063
- };
1075
+ return K();
1064
1076
  }
1065
1077
  if (r.signal.aborted) throw r.signal.reason;
1066
- i["Content-Type"] = "application/json", e.conversationId && o === he && (i[me] = e.conversationId);
1078
+ i["Content-Type"] = "application/json", e.conversationId && o === ye && (i[ve] = e.conversationId);
1067
1079
  let a = e.input[e.input.length - 1], u = {
1068
1080
  ...a?.hidden === !0 ? { hidden: !0 } : {},
1069
1081
  ...a?.titleHint ? { title_hint: a.titleHint } : {}
@@ -1077,26 +1089,22 @@ function we(e) {
1077
1089
  stream: !0,
1078
1090
  ...Object.keys(u).length > 0 ? { metadata: u } : {}
1079
1091
  };
1080
- e.conversationId && o === ge && (f.conversation = e.conversationId), e.tools.length > 0 && (f.tools = e.tools), e.toolChoice && (f.tool_choice = e.toolChoice);
1092
+ e.conversationId && o === q && (f.conversation = e.conversationId), e.tools.length > 0 && (f.tools = e.tools), e.toolChoice && (f.tool_choice = e.toolChoice);
1081
1093
  let p;
1082
1094
  try {
1083
- p = await s(q.responses(t), {
1095
+ p = await s(G.responses(t), {
1084
1096
  method: "POST",
1085
1097
  headers: i,
1086
1098
  body: JSON.stringify(f),
1087
1099
  signal: r.signal
1088
1100
  });
1089
- } catch {
1101
+ } catch (e) {
1090
1102
  if (r.signal.aborted) throw r.signal.reason;
1091
- return {
1092
- status: void 0,
1093
- text: "",
1094
- errorMessage: "Request failed"
1095
- };
1103
+ return K({ cause: e });
1096
1104
  }
1097
- let m = p.headers.get(Y);
1105
+ let m = p.headers.get(be);
1098
1106
  m && e.onRequestId?.(m);
1099
- let h = p.headers.get(ve);
1107
+ let h = p.headers.get(J);
1100
1108
  if (h && e.onMessageId?.(h), !p.ok) {
1101
1109
  l(new V({
1102
1110
  status: p.status,
@@ -1108,7 +1116,7 @@ function we(e) {
1108
1116
  text: e
1109
1117
  };
1110
1118
  }
1111
- let g = p.headers.get(_e);
1119
+ let g = p.headers.get(xe);
1112
1120
  if (g && e.onConversationId?.(g), !p.body) return {
1113
1121
  status: p.status,
1114
1122
  text: ""
@@ -1119,7 +1127,11 @@ function we(e) {
1119
1127
  for (;;) {
1120
1128
  let { done: t, value: n } = await _.read();
1121
1129
  if (r.signal.aborted) throw r.signal.reason;
1122
- if (t) break;
1130
+ if (t) {
1131
+ let t = v.decode();
1132
+ t && e.onChunk(t);
1133
+ break;
1134
+ }
1123
1135
  d(), e.onChunk(v.decode(n, { stream: !0 }));
1124
1136
  }
1125
1137
  } catch {
@@ -1141,21 +1153,21 @@ function we(e) {
1141
1153
  }
1142
1154
  },
1143
1155
  async listConversations(e = {}) {
1144
- let n = X(await u({
1156
+ let n = Y(await u({
1145
1157
  method: "GET",
1146
- url: q.conversations(t, e),
1158
+ url: G.conversations(t, e),
1147
1159
  signal: e.signal,
1148
1160
  requireJsonBody: !0
1149
1161
  }));
1150
1162
  return {
1151
- conversations: Array.isArray(n.conversations) ? n.conversations.map(Q).filter((e) => e.conversationId !== "") : [],
1163
+ conversations: Array.isArray(n.conversations) ? n.conversations.map(Z).filter((e) => e.conversationId !== "") : [],
1152
1164
  nextCursor: typeof n.next_cursor == "string" ? n.next_cursor : null
1153
1165
  };
1154
1166
  },
1155
1167
  async getConversation(e) {
1156
- let n = X(await u({
1168
+ let n = Y(await u({
1157
1169
  method: "GET",
1158
- url: q.conversation(t, e.conversationId, e),
1170
+ url: G.conversation(t, e.conversationId, e),
1159
1171
  signal: e.signal,
1160
1172
  requireJsonBody: !0
1161
1173
  }));
@@ -1164,8 +1176,8 @@ function we(e) {
1164
1176
  kind: "invalid-response"
1165
1177
  });
1166
1178
  return {
1167
- conversation: Q(n.conversation),
1168
- messages: Array.isArray(n.messages) ? n.messages.map(xe) : [],
1179
+ conversation: Z(n.conversation),
1180
+ messages: Array.isArray(n.messages) ? n.messages.map(we) : [],
1169
1181
  hasMoreBefore: n.has_more_before === !0,
1170
1182
  nextBeforeAbsoluteIndex: typeof n.next_before_absolute_index == "number" ? n.next_before_absolute_index : null
1171
1183
  };
@@ -1173,14 +1185,14 @@ function we(e) {
1173
1185
  async deleteConversation(e) {
1174
1186
  await u({
1175
1187
  method: "DELETE",
1176
- url: q.conversation(t, e.conversationId, {}),
1188
+ url: G.conversation(t, e.conversationId, {}),
1177
1189
  signal: e.signal
1178
1190
  });
1179
1191
  },
1180
1192
  async submitFeedback(e) {
1181
1193
  await u({
1182
1194
  method: "PUT",
1183
- url: q.feedback(t, e.conversationId, e.messageId),
1195
+ url: G.feedback(t, e.conversationId, e.messageId),
1184
1196
  body: {
1185
1197
  rating: e.rating,
1186
1198
  ...e.reasonCodes ? { reason_codes: e.reasonCodes } : {},
@@ -1192,7 +1204,7 @@ function we(e) {
1192
1204
  async clearFeedback(e) {
1193
1205
  await u({
1194
1206
  method: "DELETE",
1195
- url: q.feedback(t, e.conversationId, e.messageId),
1207
+ url: G.feedback(t, e.conversationId, e.messageId),
1196
1208
  signal: e.signal
1197
1209
  });
1198
1210
  }
@@ -1200,7 +1212,7 @@ function we(e) {
1200
1212
  }
1201
1213
  //#endregion
1202
1214
  //#region src/client/feedbackHandlers.ts
1203
- function Te(e) {
1215
+ function Q(e) {
1204
1216
  let { client: t, getConversationId: n } = e, r = () => {
1205
1217
  let e = n();
1206
1218
  if (!e) throw Error("no conversation id");
@@ -1228,15 +1240,15 @@ function Te(e) {
1228
1240
  }
1229
1241
  //#endregion
1230
1242
  //#region src/utils/prompt.ts
1231
- function $(...e) {
1243
+ function Oe(...e) {
1232
1244
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
1233
1245
  }
1234
1246
  //#endregion
1235
1247
  //#region src/utils/toolCalls.ts
1236
- var Ee = "call_tool", De = "a tool";
1237
- function Oe(e, t) {
1248
+ var ke = "call_tool", Ae = "a tool";
1249
+ function $(e, t) {
1238
1250
  let n = {
1239
- name: e === Ee ? De : e,
1251
+ name: e === ke ? Ae : e,
1240
1252
  args: null,
1241
1253
  viaCallTool: !1
1242
1254
  };
@@ -1249,7 +1261,7 @@ function Oe(e, t) {
1249
1261
  }
1250
1262
  if (typeof r != "object" || !r) return n;
1251
1263
  let i = r;
1252
- if (e === Ee) {
1264
+ if (e === ke) {
1253
1265
  let e = typeof i.name == "string" ? i.name : void 0;
1254
1266
  if (!e) return n;
1255
1267
  let t = i.arguments;
@@ -1267,32 +1279,32 @@ function Oe(e, t) {
1267
1279
  }
1268
1280
  //#endregion
1269
1281
  //#region src/utils/table.ts
1270
- var ke = 5, Ae = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Ae).join(""), je = (e) => {
1282
+ var je = 5, Me = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Me).join(""), Ne = (e) => {
1271
1283
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
1272
1284
  for (let t of e.children ?? []) {
1273
- let e = je(t);
1285
+ let e = Ne(t);
1274
1286
  if (e) return e;
1275
1287
  }
1276
- }, Me = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Ne = (e) => {
1277
- let t = Ae(e), n = je(e);
1288
+ }, Pe = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Fe = (e) => {
1289
+ let t = Me(e), n = Ne(e);
1278
1290
  return n ? {
1279
1291
  text: t,
1280
1292
  href: n
1281
1293
  } : { text: t };
1282
- }, Pe = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Ne), Fe = (e) => {
1294
+ }, Ie = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Fe), Le = (e) => {
1283
1295
  if (e.tagName !== "table") return null;
1284
- let t = Me(e, "thead"), n = t && Me(t, "tr");
1296
+ let t = Pe(e, "thead"), n = t && Pe(t, "tr");
1285
1297
  return {
1286
- headers: n ? Pe(n).map((e) => e.text) : [],
1287
- rows: (Me(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Pe)
1298
+ headers: n ? Ie(n).map((e) => e.text) : [],
1299
+ rows: (Pe(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Ie)
1288
1300
  };
1289
- }, Ie = (e) => e.length > 5, Le = "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```", Re = [
1301
+ }, Re = (e) => e.length > 5, ze = "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```", Be = [
1290
1302
  "bar",
1291
1303
  "line",
1292
1304
  "pie",
1293
1305
  "doughnut",
1294
1306
  "scatter"
1295
- ], ze = 8, Be = 50, Ve = 8, He = 500, Ue = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", We = (e) => {
1307
+ ], Ve = 8, He = 50, Ue = 8, We = 500, Ge = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Ke = (e) => {
1296
1308
  let t;
1297
1309
  try {
1298
1310
  t = JSON.parse(e);
@@ -1301,17 +1313,17 @@ var ke = 5, Ae = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1301
1313
  }
1302
1314
  if (typeof t != "object" || !t) return null;
1303
1315
  let n = t;
1304
- if (typeof n.type != "string" || !Re.includes(n.type)) return null;
1316
+ if (typeof n.type != "string" || !Be.includes(n.type)) return null;
1305
1317
  let r = n.type;
1306
1318
  if (n.title !== void 0 && typeof n.title != "string") return null;
1307
1319
  let i = n.title;
1308
1320
  if (typeof n.data != "object" || n.data === null) return null;
1309
1321
  let a = n.data;
1310
- if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > ze || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
1322
+ if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ve || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
1311
1323
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
1312
1324
  let o = a.datasets;
1313
1325
  if (r === "scatter") {
1314
- for (let e of o) if (e.data.length < 1 || e.data.length > He || !e.data.every(Ue)) return null;
1326
+ for (let e of o) if (e.data.length < 1 || e.data.length > We || !e.data.every(Ge)) return null;
1315
1327
  return {
1316
1328
  type: r,
1317
1329
  title: i,
@@ -1319,7 +1331,7 @@ var ke = 5, Ae = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1319
1331
  };
1320
1332
  }
1321
1333
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
1322
- let s = a.labels, c = r === "pie" || r === "doughnut" ? Ve : Be;
1334
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? Ue : He;
1323
1335
  if (s.length < 1 || s.length > c) return null;
1324
1336
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
1325
1337
  return {
@@ -1330,7 +1342,7 @@ var ke = 5, Ae = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1330
1342
  datasets: o
1331
1343
  }
1332
1344
  };
1333
- }, Ge = {
1345
+ }, qe = {
1334
1346
  tool_start: "Tool start",
1335
1347
  tool_end: "Tool end",
1336
1348
  pseudo_tool_call: "Narrated tool call",
@@ -1341,13 +1353,13 @@ var ke = 5, Ae = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1341
1353
  error: "Error",
1342
1354
  raw: "Raw event"
1343
1355
  };
1344
- function Ke(e) {
1345
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : Oe(e.name, e.args);
1356
+ function Je(e) {
1357
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : $(e.name, e.args);
1346
1358
  }
1347
- function qe(e, t = Ke(e)) {
1359
+ function Ye(e, t = Je(e)) {
1348
1360
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
1349
1361
  }
1350
- function Je(e, t = Ke(e)) {
1362
+ function Xe(e, t = Je(e)) {
1351
1363
  switch (e.kind) {
1352
1364
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
1353
1365
  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" : ""}`;
@@ -1360,23 +1372,23 @@ function Je(e, t = Ke(e)) {
1360
1372
  case "raw": return `Unrecognized event: ${e.eventType}`;
1361
1373
  }
1362
1374
  }
1363
- function Ye(e, t = Ke(e)) {
1375
+ function Ze(e, t = Je(e)) {
1364
1376
  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;
1365
1377
  }
1366
- function Xe(e) {
1378
+ function Qe(e) {
1367
1379
  return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
1368
1380
  }
1369
- function Ze(e) {
1381
+ function $e(e) {
1370
1382
  return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
1371
1383
  }
1372
- function Qe(e) {
1384
+ function et(e) {
1373
1385
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
1374
1386
  }
1375
- function $e(e) {
1387
+ function tt(e) {
1376
1388
  switch (e.kind) {
1377
- case "tool_start": return `Calling ${Oe(e.name, e.args).name}...`;
1389
+ case "tool_start": return `Calling ${$(e.name, e.args).name}...`;
1378
1390
  case "tool_end": {
1379
- let t = Oe(e.name, e.args).name;
1391
+ let t = $(e.name, e.args).name;
1380
1392
  return e.isError ? `${t} failed` : `${t} returned`;
1381
1393
  }
1382
1394
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -1388,11 +1400,11 @@ function $e(e) {
1388
1400
  case "raw": return `Unrecognized event: ${e.eventType}`;
1389
1401
  }
1390
1402
  }
1391
- function et(e) {
1403
+ function nt(e) {
1392
1404
  let t = new Date(e);
1393
1405
  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")}`;
1394
1406
  }
1395
- function tt(e) {
1407
+ function rt(e) {
1396
1408
  if (e <= 0) return "+0ms";
1397
1409
  if (e < 1e3) return `+${Math.round(e)}ms`;
1398
1410
  let t = e / 1e3;
@@ -1400,31 +1412,31 @@ function tt(e) {
1400
1412
  let n = Math.floor(t / 60), r = Math.round(t % 60);
1401
1413
  return `+${n}m${String(r).padStart(2, "0")}s`;
1402
1414
  }
1403
- function nt(e) {
1415
+ function it(e) {
1404
1416
  return e.map((t, n) => {
1405
- let r = Ke(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1417
+ let r = Je(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1406
1418
  return {
1407
1419
  key: `${t.at}-${n}`,
1408
1420
  kind: t.kind,
1409
- toolName: qe(t, r),
1421
+ toolName: Ye(t, r),
1410
1422
  isToolStart: t.kind === "tool_start",
1411
1423
  failed: t.kind === "tool_end" && t.isError === !0,
1412
- time: et(t.at),
1424
+ time: nt(t.at),
1413
1425
  gapMs: t.at - i,
1414
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Ge[t.kind],
1415
- summary: Je(t, r),
1416
- argsDetail: Ye(t, r),
1417
- outputDetail: Xe(t),
1418
- structuredOutputDetail: Ze(t),
1419
- rawDetail: Qe(t)
1426
+ label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : qe[t.kind],
1427
+ summary: Xe(t, r),
1428
+ argsDetail: Ze(t, r),
1429
+ outputDetail: Qe(t),
1430
+ structuredOutputDetail: $e(t),
1431
+ rawDetail: et(t)
1420
1432
  };
1421
1433
  });
1422
1434
  }
1423
- function rt(e) {
1435
+ function at(e) {
1424
1436
  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 = [];
1425
1437
  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(" · ");
1426
1438
  }
1427
- function it(e) {
1439
+ function ot(e) {
1428
1440
  let t = [];
1429
1441
  for (let n of e) {
1430
1442
  let e = t[t.length - 1];
@@ -1443,22 +1455,22 @@ function it(e) {
1443
1455
  }
1444
1456
  return t;
1445
1457
  }
1446
- function at(e) {
1458
+ function st(e) {
1447
1459
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
1448
1460
  }
1449
- function ot(e, t) {
1461
+ function ct(e, t) {
1450
1462
  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) => ({
1451
1463
  key: `${e.at}-${t}`,
1452
- text: $e(e),
1453
- toolName: qe(e)
1464
+ text: tt(e),
1465
+ toolName: Ye(e)
1454
1466
  }));
1455
1467
  }
1456
- function st(e, t) {
1468
+ function lt(e, t) {
1457
1469
  if (t === void 0) return [];
1458
1470
  let n = [];
1459
1471
  for (let r of e) if (r.turnSentAt === t) {
1460
1472
  if (r.kind === "tool_start") {
1461
- let e = Oe(r.name, r.args).name;
1473
+ let e = $(r.name, r.args).name;
1462
1474
  n.push({
1463
1475
  key: `step-${n.length}`,
1464
1476
  callId: r.callId,
@@ -1467,7 +1479,7 @@ function st(e, t) {
1467
1479
  status: "running"
1468
1480
  });
1469
1481
  } else if (r.kind === "tool_end") {
1470
- let e = Oe(r.name, r.args).name, t = r.isError ? "failed" : "done", i = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
1482
+ let e = $(r.name, r.args).name, t = r.isError ? "failed" : "done", i = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
1471
1483
  i ? (i.status = t, i.runtimeSeconds = r.runtimeSeconds, i.label = r.displayName || i.label) : n.push({
1472
1484
  key: `step-${n.length}`,
1473
1485
  callId: r.callId,
@@ -1482,45 +1494,45 @@ function st(e, t) {
1482
1494
  }
1483
1495
  //#endregion
1484
1496
  //#region src/styles.css?inline
1485
- var ct = "/*! 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;--tw-outline-style:solid}}}@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-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--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-xl:.75rem;--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;position:relative}.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);flex-wrap:wrap;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-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{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)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);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;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);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}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{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);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);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) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);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) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);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) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;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);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:\"·\";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block: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-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-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,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@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}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}", lt = r(void 0), ut = /:root\s*,\s*:host\s*\{/, dt = ".bailey-chat-panel{";
1486
- function ft(e) {
1487
- let t = e.match(new RegExp(ut, "g"))?.length ?? 0;
1497
+ var ut = "/*! 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;--tw-outline-style:solid}}}@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-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--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-xl:.75rem;--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;position:relative}.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);flex-wrap:wrap;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-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{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)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);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;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);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}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{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);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);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) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);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) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);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) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;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);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:\"·\";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block: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-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-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,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@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}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}", dt = r(void 0), ft = /:root\s*,\s*:host\s*\{/, pt = ".bailey-chat-panel{";
1498
+ function mt(e) {
1499
+ let t = e.match(new RegExp(ft, "g"))?.length ?? 0;
1488
1500
  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.`);
1489
- return e.replace(ut, dt);
1501
+ return e.replace(ft, pt);
1490
1502
  }
1491
- var pt = ft(ct), mt = "data-source", ht = "baileyai-chat-ui", gt = /* @__PURE__ */ new WeakMap();
1492
- function _t(e) {
1503
+ var ht = mt(ut), gt = "data-source", _t = "baileyai-chat-ui", vt = /* @__PURE__ */ new WeakMap();
1504
+ function yt(e) {
1493
1505
  let t = e.getRootNode();
1494
1506
  return t instanceof ShadowRoot ? t : document;
1495
1507
  }
1496
- function vt(e) {
1497
- let t = e instanceof ShadowRoot ? e : document.head, n = gt.get(e) ?? 0;
1498
- if (n === 0 && !t.querySelector(`style[${mt}="${ht}"]`)) {
1508
+ function bt(e) {
1509
+ let t = e instanceof ShadowRoot ? e : document.head, n = vt.get(e) ?? 0;
1510
+ if (n === 0 && !t.querySelector(`style[${gt}="${_t}"]`)) {
1499
1511
  let e = document.createElement("style");
1500
- e.setAttribute(mt, ht), e.textContent = pt, t.appendChild(e);
1512
+ e.setAttribute(gt, _t), e.textContent = ht, t.appendChild(e);
1501
1513
  }
1502
- return gt.set(e, n + 1), () => {
1503
- let n = (gt.get(e) ?? 1) - 1;
1504
- n <= 0 ? (gt.delete(e), t.querySelector(`style[${mt}="${ht}"]`)?.remove()) : gt.set(e, n);
1514
+ return vt.set(e, n + 1), () => {
1515
+ let n = (vt.get(e) ?? 1) - 1;
1516
+ n <= 0 ? (vt.delete(e), t.querySelector(`style[${gt}="${_t}"]`)?.remove()) : vt.set(e, n);
1505
1517
  };
1506
1518
  }
1507
- function yt(e, t = !1) {
1519
+ function xt(e, t = !1) {
1508
1520
  let [n, r] = f(null);
1509
1521
  return l(() => {
1510
1522
  if (t) return;
1511
1523
  let n = e.current;
1512
1524
  if (!n) return;
1513
- let i = _t(n);
1514
- return r(i), vt(i);
1525
+ let i = yt(n);
1526
+ return r(i), bt(i);
1515
1527
  }, [t, e]), n;
1516
1528
  }
1517
- function bt(e) {
1518
- let t = o(lt), n = t !== void 0, r = yt(e, n);
1529
+ function St(e) {
1530
+ let t = o(dt), n = t !== void 0, r = xt(e, n);
1519
1531
  return n ? t : r;
1520
1532
  }
1521
1533
  //#endregion
1522
1534
  //#region src/ui/markdown.tsx
1523
- function xt({ renderTable: t, renderChart: n } = {}) {
1535
+ function Ct({ renderTable: t, renderChart: n } = {}) {
1524
1536
  return {
1525
1537
  a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ v(_, { children: n }) : /* @__PURE__ */ v("a", {
1526
1538
  href: t,
@@ -1529,8 +1541,8 @@ function xt({ renderTable: t, renderChart: n } = {}) {
1529
1541
  children: n
1530
1542
  }),
1531
1543
  table: ({ node: n, children: r }) => {
1532
- let i = n && Fe(n);
1533
- if (i && Ie(i.rows) && t) {
1544
+ let i = n && Le(n);
1545
+ if (i && Re(i.rows) && t) {
1534
1546
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
1535
1547
  return /* @__PURE__ */ v(_, { children: t({
1536
1548
  headers: i.headers,
@@ -1542,7 +1554,7 @@ function xt({ renderTable: t, renderChart: n } = {}) {
1542
1554
  pre: ({ children: e }) => {
1543
1555
  let t = (Array.isArray(e) ? e[0] : e)?.props;
1544
1556
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
1545
- let e = t?.children, r = We(Array.isArray(e) ? e.join("") : String(e ?? ""));
1557
+ let e = t?.children, r = Ke(Array.isArray(e) ? e.join("") : String(e ?? ""));
1546
1558
  if (r) return /* @__PURE__ */ v(_, { children: n(r) });
1547
1559
  }
1548
1560
  return /* @__PURE__ */ v("pre", { children: e });
@@ -1551,7 +1563,7 @@ function xt({ renderTable: t, renderChart: n } = {}) {
1551
1563
  }
1552
1564
  //#endregion
1553
1565
  //#region src/ui/icons.tsx
1554
- function St({ className: e }) {
1566
+ function wt({ className: e }) {
1555
1567
  return /* @__PURE__ */ v("svg", {
1556
1568
  viewBox: "0 0 24 24",
1557
1569
  fill: "currentColor",
@@ -1560,7 +1572,7 @@ function St({ className: e }) {
1560
1572
  children: /* @__PURE__ */ v("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" })
1561
1573
  });
1562
1574
  }
1563
- function Ct({ className: e }) {
1575
+ function Tt({ className: e }) {
1564
1576
  return /* @__PURE__ */ v("svg", {
1565
1577
  viewBox: "0 0 24 24",
1566
1578
  fill: "currentColor",
@@ -1575,7 +1587,7 @@ function Ct({ className: e }) {
1575
1587
  })
1576
1588
  });
1577
1589
  }
1578
- function wt({ className: e }) {
1590
+ function Et({ className: e }) {
1579
1591
  return /* @__PURE__ */ y("svg", {
1580
1592
  viewBox: "0 0 24 24",
1581
1593
  fill: "none",
@@ -1588,7 +1600,7 @@ function wt({ className: e }) {
1588
1600
  children: [/* @__PURE__ */ v("path", { d: "M7 17 17 7" }), /* @__PURE__ */ v("path", { d: "M9 7h8v8" })]
1589
1601
  });
1590
1602
  }
1591
- function Tt({ className: e }) {
1603
+ function Dt({ className: e }) {
1592
1604
  return /* @__PURE__ */ y("svg", {
1593
1605
  viewBox: "0 0 24 24",
1594
1606
  fill: "none",
@@ -1607,7 +1619,7 @@ function Tt({ className: e }) {
1607
1619
  }), /* @__PURE__ */ v("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
1608
1620
  });
1609
1621
  }
1610
- function Et({ className: e }) {
1622
+ function Ot({ className: e }) {
1611
1623
  return /* @__PURE__ */ v("svg", {
1612
1624
  viewBox: "0 0 24 24",
1613
1625
  fill: "none",
@@ -1620,7 +1632,7 @@ function Et({ className: e }) {
1620
1632
  children: /* @__PURE__ */ v("path", { d: "M5 12.5 9.5 17 19 7" })
1621
1633
  });
1622
1634
  }
1623
- function Dt({ className: e }) {
1635
+ function kt({ className: e }) {
1624
1636
  return /* @__PURE__ */ v("svg", {
1625
1637
  viewBox: "0 0 24 24",
1626
1638
  fill: "none",
@@ -1633,7 +1645,7 @@ function Dt({ className: e }) {
1633
1645
  children: /* @__PURE__ */ v("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
1634
1646
  });
1635
1647
  }
1636
- function Ot({ className: e }) {
1648
+ function At({ className: e }) {
1637
1649
  return /* @__PURE__ */ y("svg", {
1638
1650
  viewBox: "0 0 24 24",
1639
1651
  fill: "none",
@@ -1650,7 +1662,7 @@ function Ot({ className: e }) {
1650
1662
  }), /* @__PURE__ */ v("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
1651
1663
  });
1652
1664
  }
1653
- function kt({ className: e }) {
1665
+ function jt({ className: e }) {
1654
1666
  return /* @__PURE__ */ y("svg", {
1655
1667
  viewBox: "0 0 24 24",
1656
1668
  fill: "currentColor",
@@ -1675,7 +1687,7 @@ function kt({ className: e }) {
1675
1687
  ]
1676
1688
  });
1677
1689
  }
1678
- function At({ className: e }) {
1690
+ function Mt({ className: e }) {
1679
1691
  return /* @__PURE__ */ v("svg", {
1680
1692
  viewBox: "0 0 24 24",
1681
1693
  fill: "none",
@@ -1688,8 +1700,8 @@ function At({ className: e }) {
1688
1700
  children: /* @__PURE__ */ v("path", { d: "M12 5v14M5 12h14" })
1689
1701
  });
1690
1702
  }
1691
- var jt = "M7 11v9H4v-9h3zm0 0 4-8c1.7 0 2.7 1.3 2.4 3L13 9h5.5a2 2 0 0 1 2 2.4l-1.3 6.8A2 2 0 0 1 17.2 20H7", Mt = "M17 13V4h3v9h-3zm0 0-4 8c-1.7 0-2.7-1.3-2.4-3L11 15H5.5a2 2 0 0 1-2-2.4l1.3-6.8A2 2 0 0 1 6.8 4H17";
1692
- function Nt({ className: e, filled: t = !1 }) {
1703
+ var Nt = "M7 11v9H4v-9h3zm0 0 4-8c1.7 0 2.7 1.3 2.4 3L13 9h5.5a2 2 0 0 1 2 2.4l-1.3 6.8A2 2 0 0 1 17.2 20H7", Pt = "M17 13V4h3v9h-3zm0 0-4 8c-1.7 0-2.7-1.3-2.4-3L11 15H5.5a2 2 0 0 1-2-2.4l1.3-6.8A2 2 0 0 1 6.8 4H17";
1704
+ function Ft({ className: e, filled: t = !1 }) {
1693
1705
  return /* @__PURE__ */ v("svg", {
1694
1706
  viewBox: "0 0 24 24",
1695
1707
  fill: t ? "currentColor" : "none",
@@ -1698,10 +1710,10 @@ function Nt({ className: e, filled: t = !1 }) {
1698
1710
  strokeLinejoin: "round",
1699
1711
  className: e,
1700
1712
  "aria-hidden": "true",
1701
- children: /* @__PURE__ */ v("path", { d: jt })
1713
+ children: /* @__PURE__ */ v("path", { d: Nt })
1702
1714
  });
1703
1715
  }
1704
- function Pt({ className: e, filled: t = !1 }) {
1716
+ function It({ className: e, filled: t = !1 }) {
1705
1717
  return /* @__PURE__ */ v("svg", {
1706
1718
  viewBox: "0 0 24 24",
1707
1719
  fill: t ? "currentColor" : "none",
@@ -1710,10 +1722,10 @@ function Pt({ className: e, filled: t = !1 }) {
1710
1722
  strokeLinejoin: "round",
1711
1723
  className: e,
1712
1724
  "aria-hidden": "true",
1713
- children: /* @__PURE__ */ v("path", { d: Mt })
1725
+ children: /* @__PURE__ */ v("path", { d: Pt })
1714
1726
  });
1715
1727
  }
1716
- function Ft({ className: e }) {
1728
+ function Lt({ className: e }) {
1717
1729
  return /* @__PURE__ */ v("svg", {
1718
1730
  viewBox: "0 0 24 24",
1719
1731
  fill: "none",
@@ -1726,7 +1738,7 @@ function Ft({ className: e }) {
1726
1738
  children: /* @__PURE__ */ v("path", { d: "M15 6l-6 6 6 6" })
1727
1739
  });
1728
1740
  }
1729
- function It({ className: e }) {
1741
+ function Rt({ className: e }) {
1730
1742
  return /* @__PURE__ */ v("svg", {
1731
1743
  viewBox: "0 0 24 24",
1732
1744
  fill: "none",
@@ -1739,7 +1751,7 @@ function It({ className: e }) {
1739
1751
  children: /* @__PURE__ */ v("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3" })
1740
1752
  });
1741
1753
  }
1742
- function Lt({ className: e }) {
1754
+ function zt({ className: e }) {
1743
1755
  return /* @__PURE__ */ y("svg", {
1744
1756
  viewBox: "0 0 24 24",
1745
1757
  fill: "none",
@@ -1758,9 +1770,9 @@ function Lt({ className: e }) {
1758
1770
  }
1759
1771
  //#endregion
1760
1772
  //#region src/ui/CopyMarkdownButton.tsx
1761
- var Rt = 1500;
1762
- function zt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
1763
- let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = bt(p);
1773
+ var Bt = 1500;
1774
+ function Vt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
1775
+ let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = St(p);
1764
1776
  return s(() => () => {
1765
1777
  u.current !== null && clearTimeout(u.current);
1766
1778
  }, []), /* @__PURE__ */ v(g.Provider, {
@@ -1779,11 +1791,11 @@ function zt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1779
1791
  } catch {
1780
1792
  return;
1781
1793
  }
1782
- o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Rt);
1794
+ o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Bt);
1783
1795
  },
1784
1796
  "aria-label": n,
1785
1797
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
1786
- children: v(a ? Et : Tt, { className: "bailey-copy-icon" })
1798
+ children: v(a ? Ot : Dt, { className: "bailey-copy-icon" })
1787
1799
  })
1788
1800
  }), /* @__PURE__ */ v(g.Portal, {
1789
1801
  container: m instanceof ShadowRoot ? m : void 0,
@@ -1798,20 +1810,20 @@ function zt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1798
1810
  }
1799
1811
  //#endregion
1800
1812
  //#region src/ui/BaileyTracePanel.tsx
1801
- async function Bt(e) {
1813
+ async function Ht(e) {
1802
1814
  try {
1803
1815
  await navigator.clipboard.writeText(e);
1804
1816
  } catch {}
1805
1817
  }
1806
- function Vt({ text: e, label: t = "Copy" }) {
1818
+ function Ut({ text: e, label: t = "Copy" }) {
1807
1819
  return /* @__PURE__ */ v("button", {
1808
1820
  type: "button",
1809
- onClick: () => Bt(e),
1821
+ onClick: () => Ht(e),
1810
1822
  className: "bailey-trace-copy-button",
1811
1823
  children: t
1812
1824
  });
1813
1825
  }
1814
- function Ht(e) {
1826
+ function Wt(e) {
1815
1827
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
1816
1828
  switch (e.kind) {
1817
1829
  case "tool_start":
@@ -1822,7 +1834,7 @@ function Ht(e) {
1822
1834
  default: return "bailey-trace-chip bailey-trace-chip-default";
1823
1835
  }
1824
1836
  }
1825
- function Ut({ label: e, content: t, copyable: n }) {
1837
+ function Gt({ label: e, content: t, copyable: n }) {
1826
1838
  return /* @__PURE__ */ y("details", {
1827
1839
  className: "bailey-trace-disclosure",
1828
1840
  children: [
@@ -1832,7 +1844,7 @@ function Ut({ label: e, content: t, copyable: n }) {
1832
1844
  }),
1833
1845
  n && /* @__PURE__ */ v("div", {
1834
1846
  className: "bailey-trace-disclosure-actions",
1835
- children: /* @__PURE__ */ v(Vt, { text: t })
1847
+ children: /* @__PURE__ */ v(Ut, { text: t })
1836
1848
  }),
1837
1849
  /* @__PURE__ */ v("pre", {
1838
1850
  className: "bailey-trace-disclosure-content",
@@ -1841,7 +1853,7 @@ function Ut({ label: e, content: t, copyable: n }) {
1841
1853
  ]
1842
1854
  });
1843
1855
  }
1844
- function Wt({ row: e }) {
1856
+ function Kt({ row: e }) {
1845
1857
  return /* @__PURE__ */ y("div", {
1846
1858
  className: "bailey-trace-row",
1847
1859
  children: [
@@ -1855,10 +1867,10 @@ function Wt({ row: e }) {
1855
1867
  /* @__PURE__ */ v("span", {
1856
1868
  className: "bailey-trace-row-gap",
1857
1869
  title: "Time since the previous event",
1858
- children: tt(e.gapMs)
1870
+ children: rt(e.gapMs)
1859
1871
  }),
1860
1872
  /* @__PURE__ */ v("span", {
1861
- className: Ht(e),
1873
+ className: Wt(e),
1862
1874
  children: e.label
1863
1875
  }),
1864
1876
  /* @__PURE__ */ v("span", {
@@ -1867,32 +1879,32 @@ function Wt({ row: e }) {
1867
1879
  })
1868
1880
  ]
1869
1881
  }),
1870
- e.argsDetail && /* @__PURE__ */ v(Ut, {
1882
+ e.argsDetail && /* @__PURE__ */ v(Gt, {
1871
1883
  label: e.kind === "llm_call_start" ? "request" : "args",
1872
1884
  content: e.argsDetail
1873
1885
  }),
1874
- e.outputDetail && /* @__PURE__ */ v(Ut, {
1886
+ e.outputDetail && /* @__PURE__ */ v(Gt, {
1875
1887
  label: e.kind === "llm_call_end" ? "response" : "output",
1876
1888
  content: e.outputDetail
1877
1889
  }),
1878
- e.structuredOutputDetail && /* @__PURE__ */ v(Ut, {
1890
+ e.structuredOutputDetail && /* @__PURE__ */ v(Gt, {
1879
1891
  label: "structured output",
1880
1892
  content: e.structuredOutputDetail
1881
1893
  }),
1882
- e.rawDetail && /* @__PURE__ */ v(Ut, {
1894
+ e.rawDetail && /* @__PURE__ */ v(Gt, {
1883
1895
  label: "raw",
1884
1896
  content: e.rawDetail
1885
1897
  })
1886
1898
  ]
1887
1899
  });
1888
1900
  }
1889
- function Gt(e, t) {
1901
+ function qt(e, t) {
1890
1902
  if (e.chunkCount === 0) return "Streamed: no chunks received";
1891
1903
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
1892
1904
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
1893
1905
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
1894
1906
  }
1895
- function Kt({ request: e }) {
1907
+ function Jt({ request: e }) {
1896
1908
  let t = u(() => JSON.stringify({
1897
1909
  model: e.model,
1898
1910
  instructions: e.systemPrompt,
@@ -1916,24 +1928,24 @@ function Kt({ request: e }) {
1916
1928
  }),
1917
1929
  /* @__PURE__ */ v("span", {
1918
1930
  className: "bailey-trace-request-meta",
1919
- children: Gt(e.streamStats, e.sentAt)
1931
+ children: qt(e.streamStats, e.sentAt)
1920
1932
  }),
1921
- /* @__PURE__ */ v(Ut, {
1933
+ /* @__PURE__ */ v(Gt, {
1922
1934
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
1923
1935
  content: e.systemPrompt,
1924
1936
  copyable: !0
1925
1937
  }),
1926
- /* @__PURE__ */ v(Ut, {
1938
+ /* @__PURE__ */ v(Gt, {
1927
1939
  label: `Messages (${e.messages.length})`,
1928
1940
  content: JSON.stringify(e.messages, null, 2),
1929
1941
  copyable: !0
1930
1942
  }),
1931
- e.response && /* @__PURE__ */ v(Ut, {
1943
+ e.response && /* @__PURE__ */ v(Gt, {
1932
1944
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1933
1945
  content: e.response.content,
1934
1946
  copyable: !0
1935
1947
  }),
1936
- /* @__PURE__ */ v(Ut, {
1948
+ /* @__PURE__ */ v(Gt, {
1937
1949
  label: "Full payload (JSON)",
1938
1950
  content: t,
1939
1951
  copyable: !0
@@ -1941,14 +1953,14 @@ function Kt({ request: e }) {
1941
1953
  ]
1942
1954
  });
1943
1955
  }
1944
- function qt({ events: e, lastRequest: t, onClear: n }) {
1945
- let r = u(() => nt(e), [e]), i = u(() => it(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
1956
+ function Yt({ events: e, lastRequest: t, onClear: n }) {
1957
+ let r = u(() => it(e), [e]), i = u(() => ot(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
1946
1958
  return /* @__PURE__ */ y("div", {
1947
1959
  className: "bailey-trace-body",
1948
1960
  children: [
1949
1961
  /* @__PURE__ */ y("div", {
1950
1962
  className: "bailey-trace-actions-row",
1951
- children: [e.length > 0 && /* @__PURE__ */ v(Vt, {
1963
+ children: [e.length > 0 && /* @__PURE__ */ v(Ut, {
1952
1964
  text: a,
1953
1965
  label: "Copy trace as JSON"
1954
1966
  }), /* @__PURE__ */ v("button", {
@@ -1958,15 +1970,15 @@ function qt({ events: e, lastRequest: t, onClear: n }) {
1958
1970
  children: "Clear"
1959
1971
  })]
1960
1972
  }),
1961
- t && /* @__PURE__ */ v(Kt, { request: t }),
1973
+ t && /* @__PURE__ */ v(Jt, { request: t }),
1962
1974
  /* @__PURE__ */ v("div", {
1963
1975
  className: "bailey-trace-rows",
1964
1976
  children: i.map((e, t) => {
1965
- if (e.type === "single") return /* @__PURE__ */ v(Wt, { row: e.row }, e.row.key);
1977
+ if (e.type === "single") return /* @__PURE__ */ v(Kt, { row: e.row }, e.row.key);
1966
1978
  let n = e.rows.filter((e) => e.isToolStart).length;
1967
1979
  if (n <= 1) return /* @__PURE__ */ v("div", {
1968
1980
  className: "bailey-trace-rows",
1969
- children: e.rows.map((e) => /* @__PURE__ */ v(Wt, { row: e }, e.key))
1981
+ children: e.rows.map((e) => /* @__PURE__ */ v(Kt, { row: e }, e.key))
1970
1982
  }, `group-${t}`);
1971
1983
  let r = e.rows.filter((e) => e.failed).length;
1972
1984
  return /* @__PURE__ */ y("details", {
@@ -1988,7 +2000,7 @@ function qt({ events: e, lastRequest: t, onClear: n }) {
1988
2000
  ]
1989
2001
  }), /* @__PURE__ */ v("div", {
1990
2002
  className: "bailey-trace-rows",
1991
- children: e.rows.map((e) => /* @__PURE__ */ v(Wt, { row: e }, e.key))
2003
+ children: e.rows.map((e) => /* @__PURE__ */ v(Kt, { row: e }, e.key))
1992
2004
  })]
1993
2005
  }, `group-${t}`);
1994
2006
  })
@@ -1996,8 +2008,8 @@ function qt({ events: e, lastRequest: t, onClear: n }) {
1996
2008
  ]
1997
2009
  });
1998
2010
  }
1999
- function Jt({ events: e, lastRequest: t, onClear: n }) {
2000
- let [r, i] = f(!1), a = u(() => at(e), [e]), o = u(() => rt(e), [e]);
2011
+ function Xt({ events: e, lastRequest: t, onClear: n }) {
2012
+ let [r, i] = f(!1), a = u(() => st(e), [e]), o = u(() => at(e), [e]);
2001
2013
  return e.length === 0 && !t ? null : /* @__PURE__ */ y("div", {
2002
2014
  className: "bailey-trace-panel",
2003
2015
  children: [/* @__PURE__ */ y("div", {
@@ -2018,7 +2030,7 @@ function Jt({ events: e, lastRequest: t, onClear: n }) {
2018
2030
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
2019
2031
  children: o
2020
2032
  })]
2021
- }), r && /* @__PURE__ */ v(qt, {
2033
+ }), r && /* @__PURE__ */ v(Yt, {
2022
2034
  events: e,
2023
2035
  lastRequest: t,
2024
2036
  onClear: n
@@ -2027,7 +2039,7 @@ function Jt({ events: e, lastRequest: t, onClear: n }) {
2027
2039
  }
2028
2040
  //#endregion
2029
2041
  //#region src/ui/ToolResultImage.tsx
2030
- function Yt({ src: e, alt: n, className: r }) {
2042
+ function Zt({ src: e, alt: n, className: r }) {
2031
2043
  return t(e) ? /* @__PURE__ */ v("img", {
2032
2044
  src: e,
2033
2045
  alt: n ?? "",
@@ -2037,21 +2049,21 @@ function Yt({ src: e, alt: n, className: r }) {
2037
2049
  }
2038
2050
  //#endregion
2039
2051
  //#region src/utils/safeMcpAppResource.ts
2040
- var Xt = /^ui:\/\//, Zt = 2097152, Qt = /* @__PURE__ */ new Set([
2052
+ var Qt = /^ui:\/\//, $t = 2097152, en = /* @__PURE__ */ new Set([
2041
2053
  "connectDomains",
2042
2054
  "resourceDomains",
2043
2055
  "frameDomains",
2044
2056
  "baseUriDomains"
2045
- ]), $t = /* @__PURE__ */ new Set([
2057
+ ]), tn = /* @__PURE__ */ new Set([
2046
2058
  "camera",
2047
2059
  "microphone",
2048
2060
  "geolocation",
2049
2061
  "clipboardWrite"
2050
- ]), en = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), tn = (e) => !(!Xt.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > Zt || !en(e.csp, Qt) || !en(e.permissions, $t));
2062
+ ]), nn = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), rn = (e) => !(!Qt.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > $t || !nn(e.csp, en) || !nn(e.permissions, tn));
2051
2063
  //#endregion
2052
2064
  //#region src/ui/McpAppFrame.tsx
2053
- function nn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2054
- return tn({
2065
+ function an({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2066
+ return rn({
2055
2067
  html: e,
2056
2068
  resourceUri: n,
2057
2069
  csp: r,
@@ -2066,14 +2078,14 @@ function nn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, classNa
2066
2078
  }
2067
2079
  //#endregion
2068
2080
  //#region src/ui/BaileyToolSteps.tsx
2069
- function rn({ toolName: e, resolveActivityIcon: t }) {
2081
+ function on({ toolName: e, resolveActivityIcon: t }) {
2070
2082
  let n = t?.(e);
2071
2083
  return n === 0 || n && n !== !0 ? /* @__PURE__ */ v("span", {
2072
2084
  className: "bailey-activity-icon",
2073
2085
  children: n
2074
2086
  }) : null;
2075
2087
  }
2076
- function an({ steps: e, resolveActivityIcon: t }) {
2088
+ function sn({ steps: e, resolveActivityIcon: t }) {
2077
2089
  let n = e.filter((e) => e.status === "running");
2078
2090
  return n.length === 0 ? null : /* @__PURE__ */ v("div", {
2079
2091
  className: "bailey-tool-steps-live",
@@ -2082,7 +2094,7 @@ function an({ steps: e, resolveActivityIcon: t }) {
2082
2094
  children: n.map((e) => /* @__PURE__ */ y("div", {
2083
2095
  className: "bailey-activity-line",
2084
2096
  children: [
2085
- /* @__PURE__ */ v(rn, {
2097
+ /* @__PURE__ */ v(on, {
2086
2098
  toolName: e.toolName,
2087
2099
  resolveActivityIcon: t
2088
2100
  }),
@@ -2095,7 +2107,7 @@ function an({ steps: e, resolveActivityIcon: t }) {
2095
2107
  }, e.key))
2096
2108
  });
2097
2109
  }
2098
- function on({ steps: e, labels: t, resolveActivityIcon: n }) {
2110
+ function cn({ steps: e, labels: t, resolveActivityIcon: n }) {
2099
2111
  if (e.length === 0) return null;
2100
2112
  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;
2101
2113
  return /* @__PURE__ */ y("details", {
@@ -2105,7 +2117,7 @@ function on({ steps: e, labels: t, resolveActivityIcon: n }) {
2105
2117
  children: e.map((e) => /* @__PURE__ */ y("li", {
2106
2118
  className: "bailey-tool-step",
2107
2119
  children: [
2108
- /* @__PURE__ */ v(rn, {
2120
+ /* @__PURE__ */ v(on, {
2109
2121
  toolName: e.toolName,
2110
2122
  resolveActivityIcon: n
2111
2123
  }),
@@ -2123,29 +2135,29 @@ function on({ steps: e, labels: t, resolveActivityIcon: n }) {
2123
2135
  }
2124
2136
  //#endregion
2125
2137
  //#region src/utils/relativeTime.ts
2126
- var sn = /(Z|[+-]\d{2}:?\d{2})$/i, cn = 60, ln = 3600, un = 24 * ln, dn = 30 * un * 1e3;
2127
- function fn(e) {
2128
- return e ? Date.parse(sn.test(e) ? e : `${e}Z`) : NaN;
2138
+ var ln = /(Z|[+-]\d{2}:?\d{2})$/i, un = 60, dn = 3600, fn = 24 * dn, pn = 30 * fn * 1e3;
2139
+ function mn(e) {
2140
+ return e ? Date.parse(ln.test(e) ? e : `${e}Z`) : NaN;
2129
2141
  }
2130
- function pn(e) {
2131
- let t = fn(e.iso);
2142
+ function hn(e) {
2143
+ let t = mn(e.iso);
2132
2144
  if (Number.isNaN(t)) return "";
2133
2145
  let n = e.now ?? Date.now(), r = Math.max(0, n - t);
2134
2146
  if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return e.justNowText ?? "";
2135
- if (r >= dn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2147
+ if (r >= pn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2136
2148
  let i = r / 1e3, a = new Intl.RelativeTimeFormat(e.locale, { numeric: "auto" });
2137
- return i < cn ? a.format(0, "second") : i < ln ? a.format(-Math.floor(i / cn), "minute") : i < un ? a.format(-Math.floor(i / ln), "hour") : a.format(-Math.floor(i / un), "day");
2149
+ return i < un ? a.format(0, "second") : i < dn ? a.format(-Math.floor(i / un), "minute") : i < fn ? a.format(-Math.floor(i / dn), "hour") : a.format(-Math.floor(i / fn), "day");
2138
2150
  }
2139
2151
  //#endregion
2140
2152
  //#region src/ui/BaileyHistoryDrawer.tsx
2141
- function mn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2142
- let s = fe({
2153
+ function gn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2154
+ let s = me({
2143
2155
  client: e,
2144
2156
  pageSize: t
2145
2157
  }), { loadConversation: c, newChat: l } = n, u = a((e) => c ? c(e) : Promise.reject(/* @__PURE__ */ Error("no loadConversation")), [c]), d = a(() => {
2146
2158
  l(), o({ restoreFocusTo: "input" });
2147
2159
  }, [l, o]);
2148
- return /* @__PURE__ */ v(_n, {
2160
+ return /* @__PURE__ */ v(yn, {
2149
2161
  conversations: s,
2150
2162
  activeConversationId: n.conversationId,
2151
2163
  selectStatus: n.historyStatus,
@@ -2157,15 +2169,15 @@ function mn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o
2157
2169
  locale: i
2158
2170
  });
2159
2171
  }
2160
- var hn = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), gn = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
2161
- function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
2162
- let { conversations: m, status: h, error: g, hasMore: b, refresh: x, loadMore: S, remove: C } = e, w = c(), T = c(), E = d(null), D = d(null), O = d(null), k = d(/* @__PURE__ */ new Map()), ee = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [M, N] = f(null), [te, P] = f(null), [ne, re] = f(0), [ie, ae] = f(!1), [F, I] = f(!1), [oe, L] = f(!1), se = u ?? (typeof navigator < "u" ? navigator.language : void 0);
2172
+ var _n = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), vn = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
2173
+ function yn({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
2174
+ let { conversations: m, status: h, error: g, hasMore: b, refresh: ee, loadMore: x, remove: S } = e, C = c(), w = c(), T = d(null), E = d(null), D = d(null), O = d(/* @__PURE__ */ new Map()), k = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [M, N] = f(null), [te, P] = f(null), [ne, re] = f(0), [ie, ae] = f(!1), [F, I] = f(!1), [oe, L] = f(!1), se = u ?? (typeof navigator < "u" ? navigator.language : void 0);
2163
2175
  s(() => {
2164
- E.current?.focus();
2176
+ T.current?.focus();
2165
2177
  }, []), s(() => {
2166
2178
  let e = A.current;
2167
2179
  if (!e) return;
2168
- let t = e.kind === "select" ? k.current.get(e.id) : e.kind === "delete" ? ee.current.get(e.id) : e.kind === "cancel" ? O.current : D.current;
2180
+ let t = e.kind === "select" ? O.current.get(e.id) : e.kind === "delete" ? k.current.get(e.id) : e.kind === "cancel" ? D.current : E.current;
2169
2181
  t && (t.focus(), A.current = null);
2170
2182
  }), s(() => {
2171
2183
  let e = j.current;
@@ -2179,7 +2191,7 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2179
2191
  m
2180
2192
  ]);
2181
2193
  let ce = () => {
2182
- j.current = m.length, S();
2194
+ j.current = m.length, x();
2183
2195
  }, le = (e) => {
2184
2196
  A.current = {
2185
2197
  kind: "delete",
@@ -2216,7 +2228,7 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2216
2228
  id: r.conversationId
2217
2229
  } : { kind: "newChat" }, N(null), P(null), ae(!1), re((e) => e + 1);
2218
2230
  try {
2219
- await C({ conversationId: e }), ae(!0), e === t && i?.();
2231
+ await S({ conversationId: e }), ae(!0), e === t && i?.();
2220
2232
  } catch {
2221
2233
  A.current = {
2222
2234
  kind: "delete",
@@ -2225,10 +2237,10 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2225
2237
  } finally {
2226
2238
  re((e) => e - 1);
2227
2239
  }
2228
- }, z = h === "loading" && m.length === 0, B = h === "error" && m.length === 0, V = h === "error" && m.length > 0 && b, H = h === "loading" && m.length > 0, U = F || n === "loading", W = z ? l.historyLoadingText : ne > 0 ? l.historyDeletingText : ie ? l.historyDeletedText : m.length > 0 ? hn(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", fe = z || ne > 0;
2240
+ }, z = h === "loading" && m.length === 0, fe = h === "error" && m.length === 0, B = h === "error" && m.length > 0 && b, V = h === "loading" && m.length > 0, H = F || n === "loading", pe = z ? l.historyLoadingText : ne > 0 ? l.historyDeletingText : ie ? l.historyDeletedText : m.length > 0 ? _n(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", U = z || ne > 0;
2229
2241
  return /* @__PURE__ */ y("section", {
2230
2242
  role: "region",
2231
- "aria-labelledby": w,
2243
+ "aria-labelledby": C,
2232
2244
  className: "bailey-history-drawer",
2233
2245
  onKeyDown: ue,
2234
2246
  children: [
@@ -2240,23 +2252,23 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2240
2252
  className: "bailey-history-icon-button",
2241
2253
  "aria-label": l.historyBackAriaLabel,
2242
2254
  onClick: () => o({ restoreFocusTo: "menu" }),
2243
- children: /* @__PURE__ */ v(Ft, { className: "bailey-history-icon" })
2255
+ children: /* @__PURE__ */ v(Lt, { className: "bailey-history-icon" })
2244
2256
  }),
2245
2257
  /* @__PURE__ */ v("h3", {
2246
- id: w,
2247
- ref: E,
2258
+ id: C,
2259
+ ref: T,
2248
2260
  tabIndex: -1,
2249
2261
  className: "bailey-history-heading",
2250
2262
  children: l.historyTitle
2251
2263
  }),
2252
2264
  /* @__PURE__ */ y("button", {
2253
- ref: D,
2265
+ ref: E,
2254
2266
  type: "button",
2255
2267
  className: "bailey-history-button bailey-history-new-chat",
2256
2268
  "aria-label": l.newChatButtonText,
2257
2269
  disabled: z,
2258
2270
  onClick: a,
2259
- children: [/* @__PURE__ */ v(At, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2271
+ children: [/* @__PURE__ */ v(Mt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2260
2272
  className: "bailey-history-new-chat-text",
2261
2273
  children: l.newChatButtonText
2262
2274
  })]
@@ -2276,25 +2288,25 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2276
2288
  /* @__PURE__ */ v("div", { className: "bailey-history-skeleton" })
2277
2289
  ]
2278
2290
  }),
2279
- B && /* @__PURE__ */ y("div", {
2291
+ fe && /* @__PURE__ */ y("div", {
2280
2292
  role: "alert",
2281
2293
  className: "bailey-history-state bailey-history-state-error",
2282
2294
  children: [
2283
- /* @__PURE__ */ v(Lt, { className: "bailey-history-state-icon" }),
2284
- /* @__PURE__ */ v("strong", { children: gn(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
2285
- /* @__PURE__ */ v("span", { children: gn(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
2295
+ /* @__PURE__ */ v(zt, { className: "bailey-history-state-icon" }),
2296
+ /* @__PURE__ */ v("strong", { children: vn(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
2297
+ /* @__PURE__ */ v("span", { children: vn(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
2286
2298
  /* @__PURE__ */ v("button", {
2287
2299
  type: "button",
2288
2300
  className: "bailey-history-button bailey-history-button-primary",
2289
- onClick: () => void x(),
2301
+ onClick: () => void ee(),
2290
2302
  children: l.retryButtonText
2291
2303
  })
2292
2304
  ]
2293
2305
  }),
2294
- !z && !B && m.length === 0 && /* @__PURE__ */ y("div", {
2306
+ !z && !fe && m.length === 0 && /* @__PURE__ */ y("div", {
2295
2307
  className: "bailey-history-state",
2296
2308
  children: [
2297
- /* @__PURE__ */ v(Dt, { className: "bailey-history-state-icon" }),
2309
+ /* @__PURE__ */ v(kt, { className: "bailey-history-state-icon" }),
2298
2310
  /* @__PURE__ */ v("strong", { children: l.historyEmptyTitle }),
2299
2311
  /* @__PURE__ */ v("span", { children: l.historyEmptyDescription }),
2300
2312
  /* @__PURE__ */ v("button", {
@@ -2313,11 +2325,11 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2313
2325
  className: "bailey-history-row bailey-history-row-confirming",
2314
2326
  children: /* @__PURE__ */ y("div", {
2315
2327
  role: "group",
2316
- "aria-labelledby": T,
2328
+ "aria-labelledby": w,
2317
2329
  className: "bailey-history-confirm",
2318
2330
  children: [
2319
2331
  /* @__PURE__ */ v("span", {
2320
- id: T,
2332
+ id: w,
2321
2333
  className: "bailey-history-confirm-question",
2322
2334
  children: l.historyDeleteConfirmQuestion
2323
2335
  }),
@@ -2332,7 +2344,7 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2332
2344
  children: l.historyDeleteConfirmText
2333
2345
  }),
2334
2346
  /* @__PURE__ */ v("button", {
2335
- ref: O,
2347
+ ref: D,
2336
2348
  type: "button",
2337
2349
  className: "bailey-history-button",
2338
2350
  onClick: () => le(n),
@@ -2341,25 +2353,25 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2341
2353
  ]
2342
2354
  })
2343
2355
  }, n);
2344
- let a = pn({
2356
+ let a = hn({
2345
2357
  iso: e.updatedAt,
2346
2358
  locale: se,
2347
2359
  now: p?.(),
2348
2360
  justNowText: l.historyJustNowText
2349
- }), o = hn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = te === n;
2361
+ }), o = _n(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = te === n;
2350
2362
  return /* @__PURE__ */ y("li", {
2351
2363
  className: `bailey-history-row${i ? " bailey-history-row-active" : ""}${s ? " bailey-history-row-failed" : ""}`,
2352
2364
  children: [
2353
2365
  /* @__PURE__ */ y("button", {
2354
2366
  type: "button",
2355
2367
  ref: (e) => {
2356
- e ? k.current.set(n, e) : k.current.delete(n);
2368
+ e ? O.current.set(n, e) : O.current.delete(n);
2357
2369
  },
2358
2370
  className: "bailey-history-select",
2359
2371
  "aria-current": i ? "true" : void 0,
2360
- "aria-disabled": U || void 0,
2372
+ "aria-disabled": H || void 0,
2361
2373
  onClick: () => {
2362
- U || de(n);
2374
+ H || de(n);
2363
2375
  },
2364
2376
  children: [/* @__PURE__ */ v("span", {
2365
2377
  className: "bailey-history-row-title",
@@ -2385,20 +2397,20 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2385
2397
  /* @__PURE__ */ v("button", {
2386
2398
  type: "button",
2387
2399
  ref: (e) => {
2388
- e ? ee.current.set(n, e) : ee.current.delete(n);
2400
+ e ? k.current.set(n, e) : k.current.delete(n);
2389
2401
  },
2390
2402
  className: "bailey-history-icon-button bailey-history-delete",
2391
- "aria-label": hn(l.historyDeleteAriaLabel, { title: r }),
2403
+ "aria-label": _n(l.historyDeleteAriaLabel, { title: r }),
2392
2404
  onClick: () => {
2393
2405
  P(null), ae(!1), A.current = { kind: "cancel" }, N(n);
2394
2406
  },
2395
- children: /* @__PURE__ */ v(It, { className: "bailey-history-icon" })
2407
+ children: /* @__PURE__ */ v(Rt, { className: "bailey-history-icon" })
2396
2408
  }),
2397
2409
  s && /* @__PURE__ */ y("div", {
2398
2410
  role: "alert",
2399
2411
  className: "bailey-history-row-error",
2400
2412
  children: [
2401
- /* @__PURE__ */ v(Lt, { className: "bailey-history-icon-small" }),
2413
+ /* @__PURE__ */ v(zt, { className: "bailey-history-icon-small" }),
2402
2414
  /* @__PURE__ */ v("span", { children: l.historyDeleteFailedText }),
2403
2415
  /* @__PURE__ */ v("button", {
2404
2416
  type: "button",
@@ -2425,7 +2437,7 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2425
2437
  }),
2426
2438
  b && m.length > 0 && /* @__PURE__ */ v("div", {
2427
2439
  className: "bailey-history-more",
2428
- children: V ? /* @__PURE__ */ y("div", {
2440
+ children: B ? /* @__PURE__ */ y("div", {
2429
2441
  role: "alert",
2430
2442
  className: "bailey-history-inline-error",
2431
2443
  children: [/* @__PURE__ */ v("span", { children: l.historyLoadMoreErrorText }), /* @__PURE__ */ v("button", {
@@ -2437,12 +2449,12 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2437
2449
  }) : /* @__PURE__ */ y("button", {
2438
2450
  type: "button",
2439
2451
  className: "bailey-history-button",
2440
- disabled: H,
2452
+ disabled: V,
2441
2453
  onClick: ce,
2442
- children: [H && /* @__PURE__ */ v("span", {
2454
+ children: [V && /* @__PURE__ */ v("span", {
2443
2455
  className: "bailey-history-spinner",
2444
2456
  "aria-hidden": "true"
2445
- }), H ? l.historyLoadingMoreText : l.historyLoadMoreText]
2457
+ }), V ? l.historyLoadingMoreText : l.historyLoadMoreText]
2446
2458
  })
2447
2459
  })
2448
2460
  ]
@@ -2451,17 +2463,17 @@ function _n({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2451
2463
  role: "status",
2452
2464
  "aria-live": "polite",
2453
2465
  className: "bailey-history-status",
2454
- children: [fe && /* @__PURE__ */ v("span", {
2466
+ children: [U && /* @__PURE__ */ v("span", {
2455
2467
  className: "bailey-history-spinner",
2456
2468
  "aria-hidden": "true"
2457
- }), W]
2469
+ }), pe]
2458
2470
  })
2459
2471
  ]
2460
2472
  });
2461
2473
  }
2462
2474
  //#endregion
2463
2475
  //#region src/ui/historyLabels.ts
2464
- var vn = {
2476
+ var bn = {
2465
2477
  newChatButtonText: "New chat",
2466
2478
  retryButtonText: "Retry",
2467
2479
  historyTitle: "Chat history",
@@ -2494,8 +2506,8 @@ var vn = {
2494
2506
  historyDeleteRetryText: "Try again",
2495
2507
  historyDeleteDismissText: "Dismiss",
2496
2508
  historyJustNowText: "just now"
2497
- }, yn = "How can bailey AI help you today?", bn = "Reply to bailey AI", xn = {
2498
- ...vn,
2509
+ }, xn = "How can bailey AI help you today?", Sn = "Reply to bailey AI", Cn = {
2510
+ ...bn,
2499
2511
  newChatButtonText: "New chat",
2500
2512
  newChatAriaLabel: "new chat",
2501
2513
  historyAriaLabel: "conversation history",
@@ -2521,96 +2533,96 @@ var vn = {
2521
2533
  mcpAppDefaultTitle: "MCP App",
2522
2534
  loadEarlierButtonText: "Load earlier messages",
2523
2535
  loadEarlierErrorText: "Couldn't load earlier messages."
2524
- }, Sn = [m], Cn = {
2525
- ...xt(),
2536
+ }, wn = [m], Tn = {
2537
+ ...Ct(),
2526
2538
  p: ({ children: e }) => /* @__PURE__ */ v(_, { children: e })
2527
- }, wn = i(function({ content: e, components: t }) {
2539
+ }, En = i(function({ content: e, components: t }) {
2528
2540
  return /* @__PURE__ */ v("div", {
2529
2541
  className: "bailey-markdown-content",
2530
2542
  children: /* @__PURE__ */ v(p, {
2531
- remarkPlugins: Sn,
2543
+ remarkPlugins: wn,
2532
2544
  components: t,
2533
2545
  skipHtml: !0,
2534
2546
  children: e
2535
2547
  })
2536
2548
  });
2537
2549
  });
2538
- function Tn(e, t, n) {
2550
+ function Dn(e, t, n) {
2539
2551
  if (e !== "streaming") return;
2540
2552
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
2541
2553
  return r[r.length - 1];
2542
2554
  }
2543
- function En(e) {
2544
- if (!(!e || e.kind === "tool_end")) return $e(e);
2555
+ function On(e) {
2556
+ if (!(!e || e.kind === "tool_end")) return tt(e);
2545
2557
  }
2546
- function Dn(e) {
2558
+ function kn(e) {
2547
2559
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
2548
2560
  hour: "numeric",
2549
2561
  minute: "2-digit"
2550
2562
  });
2551
2563
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
2552
2564
  }
2553
- function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholder: i, suggestions: o, onHistoryClick: c, history: l, locale: m, privacyNote: _, resolveActivityIcon: b, className: x, height: S, width: C, hideDeveloperDetails: w = !1, renderMessageActions: T, renderTable: E, renderChart: D, renderMcpApp: O, labels: k, formatMessageTime: ee }) {
2565
+ function An({ chat: e, placeholder: t, replyPlaceholder: r = Sn, emptyPlaceholder: i, suggestions: o, onHistoryClick: c, history: l, locale: m, privacyNote: _, resolveActivityIcon: b, className: ee, height: x, width: S, hideDeveloperDetails: C = !1, renderMessageActions: w, renderTable: T, renderChart: E, renderMcpApp: D, labels: O, formatMessageTime: k }) {
2554
2566
  let { messages: A, traceEvents: j, lastRequest: M, status: N, error: te, send: P, stop: ne, retryLast: re, clearTrace: ie, clearError: ae, newChat: F } = e, [I, oe] = f(""), L = {
2555
- ...xn,
2556
- ...k
2557
- }, se = ee ?? Dn, ce = d(null), le = d(null), ue = d(null), de = d(null), [R, z] = f(!1), B = d(null), V = d(!1), H = !!c || !!l, U = yt(ce), W = d(null), fe = d(null), G = d(!0), K = u(() => xt({
2558
- renderTable: E,
2559
- renderChart: D
2560
- }), [E, D]), q = u(() => Tn(N, j, M), [
2567
+ ...Cn,
2568
+ ...O
2569
+ }, se = k ?? kn, ce = d(null), le = d(null), ue = d(null), de = d(null), [R, z] = f(!1), fe = d(null), B = d(!1), V = !!c || !!l, H = xt(ce), pe = d(null), U = d(null), me = d(!0), he = u(() => Ct({
2570
+ renderTable: T,
2571
+ renderChart: E
2572
+ }), [T, E]), W = u(() => Dn(N, j, M), [
2561
2573
  N,
2562
2574
  j,
2563
2575
  M
2564
- ]), J = En(q), pe = q?.kind === "tool_end" ? q.at : void 0, me = A[A.length - 1]?.content.length ?? 0, [he, ge] = f(null), Y = he;
2565
- pe !== void 0 && he?.at !== pe && (Y = {
2566
- at: pe,
2567
- length: me
2568
- }, ge(Y));
2569
- let _e = pe !== void 0 && Y?.at === pe && me <= Y.length, ve = J ?? (_e ? L.thinkingHint : void 0), X = A.length === 0, Z = t ?? (X ? i ?? yn : r);
2576
+ ]), G = On(W), K = W?.kind === "tool_end" ? W.at : void 0, ge = A[A.length - 1]?.content.length ?? 0, [_e, ve] = f(null), ye = _e;
2577
+ K !== void 0 && _e?.at !== K && (ye = {
2578
+ at: K,
2579
+ length: ge
2580
+ }, ve(ye));
2581
+ let q = K !== void 0 && ye?.at === K && ge <= ye.length, be = G ?? (q ? L.thinkingHint : void 0), xe = A.length === 0, J = t ?? (xe ? i ?? xn : r);
2570
2582
  s(() => {
2571
- let e = fe.current;
2583
+ let e = U.current;
2572
2584
  if (!e) return;
2573
2585
  let t = () => {
2574
2586
  let t = e.scrollHeight - e.scrollTop - e.clientHeight;
2575
- G.current = t < 60;
2587
+ me.current = t < 60;
2576
2588
  };
2577
2589
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
2578
2590
  }, []), s(() => {
2579
- G.current && W.current?.scrollIntoView({
2591
+ me.current && pe.current?.scrollIntoView({
2580
2592
  behavior: N === "streaming" ? "auto" : "smooth",
2581
2593
  block: "nearest"
2582
2594
  });
2583
2595
  }, [A, N]);
2584
- let ye = (e) => {
2585
- G.current = !0, P(e);
2586
- }, Q = d(null), be = () => {
2587
- let t = fe.current;
2588
- G.current = !1, Q.current = t ? {
2596
+ let Y = (e) => {
2597
+ me.current = !0, P(e);
2598
+ }, X = d(null), Se = () => {
2599
+ let t = U.current;
2600
+ me.current = !1, X.current = t ? {
2589
2601
  height: t.scrollHeight,
2590
2602
  top: t.scrollTop
2591
2603
  } : null, e.loadEarlier?.().catch(() => {
2592
- Q.current = null;
2604
+ X.current = null;
2593
2605
  });
2594
2606
  };
2595
2607
  s(() => {
2596
- let e = Q.current, t = fe.current;
2597
- !e || !t || t.scrollHeight === e.height || (t.scrollTop = e.top + (t.scrollHeight - e.height), Q.current = null);
2608
+ let e = X.current, t = U.current;
2609
+ !e || !t || t.scrollHeight === e.height || (t.scrollTop = e.top + (t.scrollHeight - e.height), X.current = null);
2598
2610
  }, [A]), s(() => {
2599
2611
  le.current?.toggleAttribute("inert", R);
2600
2612
  }, [R]), s(() => {
2601
- R || !B.current || ((B.current === "input" ? ue.current : de.current)?.focus(), B.current = null);
2613
+ R || !fe.current || ((fe.current === "input" ? ue.current : de.current)?.focus(), fe.current = null);
2602
2614
  }, [R]);
2603
- let xe = a((e) => {
2604
- B.current = e.restoreFocusTo, z(!1);
2615
+ let Z = a((e) => {
2616
+ fe.current = e.restoreFocusTo, z(!1);
2605
2617
  }, []);
2606
- return /* @__PURE__ */ v(lt.Provider, {
2607
- value: U,
2618
+ return /* @__PURE__ */ v(dt.Provider, {
2619
+ value: H,
2608
2620
  children: /* @__PURE__ */ y("div", {
2609
2621
  ref: ce,
2610
- className: `bailey-chat-panel${x ? ` ${x}` : ""}`,
2611
- style: S !== void 0 || C !== void 0 ? {
2612
- height: S,
2613
- width: C
2622
+ className: `bailey-chat-panel${ee ? ` ${ee}` : ""}`,
2623
+ style: x !== void 0 || S !== void 0 ? {
2624
+ height: x,
2625
+ width: S
2614
2626
  } : void 0,
2615
2627
  children: [/* @__PURE__ */ y("div", {
2616
2628
  className: "bailey-chat-panel-inner",
@@ -2618,7 +2630,7 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2618
2630
  children: [
2619
2631
  /* @__PURE__ */ y("div", {
2620
2632
  className: "bailey-chat-transcript",
2621
- ref: fe,
2633
+ ref: U,
2622
2634
  children: [
2623
2635
  e.hasEarlier && e.loadEarlier && /* @__PURE__ */ y("div", {
2624
2636
  className: "bailey-load-earlier",
@@ -2626,7 +2638,7 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2626
2638
  type: "button",
2627
2639
  className: "bailey-load-earlier-button",
2628
2640
  disabled: e.historyStatus === "loading",
2629
- onClick: be,
2641
+ onClick: Se,
2630
2642
  children: L.loadEarlierButtonText
2631
2643
  }), e.historyStatus === "error" && /* @__PURE__ */ v("div", {
2632
2644
  role: "alert",
@@ -2634,23 +2646,23 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2634
2646
  children: L.loadEarlierErrorText
2635
2647
  })]
2636
2648
  }),
2637
- X && (o && o.length > 0 ? /* @__PURE__ */ y("div", {
2649
+ xe && (o && o.length > 0 ? /* @__PURE__ */ y("div", {
2638
2650
  className: "bailey-suggestions",
2639
2651
  children: [/* @__PURE__ */ v("div", {
2640
2652
  className: "bailey-suggestions-title",
2641
2653
  children: L.suggestionsTitle
2642
2654
  }), o.map((e, t) => /* @__PURE__ */ y("button", {
2643
2655
  type: "button",
2644
- onClick: () => ye(e.value ?? e.label),
2656
+ onClick: () => Y(e.value ?? e.label),
2645
2657
  className: "bailey-suggestion-card",
2646
- children: [/* @__PURE__ */ v("span", { children: e.label }), /* @__PURE__ */ v(wt, { className: "bailey-suggestion-icon" })]
2658
+ children: [/* @__PURE__ */ v("span", { children: e.label }), /* @__PURE__ */ v(Et, { className: "bailey-suggestion-icon" })]
2647
2659
  }, `${e.label}-${t}`))]
2648
2660
  }) : /* @__PURE__ */ v("div", {
2649
2661
  className: "bailey-empty-state",
2650
2662
  children: L.emptyStateMessage
2651
2663
  })),
2652
2664
  A.map((e, t) => {
2653
- let r = e.role === "assistant" && t === A.length - 1, i = N === "streaming" && r && e.content === "", a = e.role === "assistant" ? st(j, e.createdAt) : [], o = a.some((e) => e.status === "running");
2665
+ let r = e.role === "assistant" && t === A.length - 1, i = N === "streaming" && r && e.content === "", a = e.role === "assistant" ? lt(j, e.createdAt) : [], o = a.some((e) => e.status === "running");
2654
2666
  return /* @__PURE__ */ v("div", {
2655
2667
  className: e.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
2656
2668
  children: e.role === "user" ? /* @__PURE__ */ y("div", {
@@ -2665,53 +2677,53 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2665
2677
  className: "bailey-user-bubble",
2666
2678
  children: e.content
2667
2679
  })]
2668
- }) : i ? o ? /* @__PURE__ */ v(an, {
2680
+ }) : i ? o ? /* @__PURE__ */ v(sn, {
2669
2681
  steps: a,
2670
2682
  resolveActivityIcon: b
2671
2683
  }) : /* @__PURE__ */ v("div", {
2672
2684
  className: "bailey-thinking-hint",
2673
- children: J ?? L.thinkingHint
2685
+ children: G ?? L.thinkingHint
2674
2686
  }) : /* @__PURE__ */ y("div", {
2675
2687
  className: "bailey-assistant-message",
2676
2688
  children: [
2677
- !e.streaming && /* @__PURE__ */ v(on, {
2689
+ !e.streaming && /* @__PURE__ */ v(cn, {
2678
2690
  steps: a,
2679
2691
  labels: L,
2680
2692
  resolveActivityIcon: b
2681
2693
  }),
2682
- /* @__PURE__ */ v(wn, {
2694
+ /* @__PURE__ */ v(En, {
2683
2695
  content: e.content,
2684
- components: K
2696
+ components: he
2685
2697
  }),
2686
- e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(Yt, {
2698
+ e.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(Zt, {
2687
2699
  src: e.src,
2688
2700
  alt: e.alt
2689
- }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: O ? O(e) : /* @__PURE__ */ v(nn, {
2701
+ }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: D ? D(e) : /* @__PURE__ */ v(an, {
2690
2702
  ...e,
2691
2703
  title: e.title ?? L.mcpAppDefaultTitle
2692
2704
  }) }, t) : null),
2693
- e.streaming && /* @__PURE__ */ v(an, {
2705
+ e.streaming && /* @__PURE__ */ v(sn, {
2694
2706
  steps: a,
2695
2707
  resolveActivityIcon: b
2696
2708
  }),
2697
- e.streaming && ve && !o && /* @__PURE__ */ v("div", {
2709
+ e.streaming && be && !o && /* @__PURE__ */ v("div", {
2698
2710
  className: "bailey-streaming-hint",
2699
- children: ve
2711
+ children: be
2700
2712
  }),
2701
2713
  !e.streaming && /* @__PURE__ */ y("div", {
2702
2714
  className: "bailey-message-actions",
2703
- children: [/* @__PURE__ */ v(zt, {
2715
+ children: [/* @__PURE__ */ v(Vt, {
2704
2716
  markdown: e.content,
2705
2717
  ariaLabel: L.copyButtonAriaLabel,
2706
2718
  tooltipDefaultText: L.copyButtonTooltipDefault,
2707
2719
  tooltipCopiedText: L.copyButtonTooltipCopied
2708
- }), T?.(e)]
2720
+ }), w?.(e)]
2709
2721
  })
2710
2722
  ]
2711
2723
  })
2712
2724
  }, e.id);
2713
2725
  }),
2714
- /* @__PURE__ */ v("div", { ref: W })
2726
+ /* @__PURE__ */ v("div", { ref: pe })
2715
2727
  ]
2716
2728
  }),
2717
2729
  te && /* @__PURE__ */ y("div", {
@@ -2733,7 +2745,7 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2733
2745
  })]
2734
2746
  })]
2735
2747
  }),
2736
- !w && /* @__PURE__ */ v(Jt, {
2748
+ !C && /* @__PURE__ */ v(Xt, {
2737
2749
  events: j,
2738
2750
  lastRequest: M,
2739
2751
  onClear: ie
@@ -2742,14 +2754,14 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2742
2754
  className: "bailey-input-area",
2743
2755
  children: [/* @__PURE__ */ y("form", {
2744
2756
  onSubmit: (e) => {
2745
- e.preventDefault(), !(!I.trim() || N === "streaming") && (ye(I), oe(""));
2757
+ e.preventDefault(), !(!I.trim() || N === "streaming") && (Y(I), oe(""));
2746
2758
  },
2747
2759
  className: "bailey-input-row",
2748
2760
  children: [/* @__PURE__ */ v("input", {
2749
2761
  ref: ue,
2750
2762
  type: "text",
2751
- placeholder: Z,
2752
- "aria-label": Z,
2763
+ placeholder: J,
2764
+ "aria-label": J,
2753
2765
  value: I,
2754
2766
  onChange: (e) => oe(e.target.value),
2755
2767
  disabled: N === "streaming",
@@ -2763,10 +2775,10 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2763
2775
  onClick: ne,
2764
2776
  "aria-label": L.stopAriaLabel,
2765
2777
  className: "bailey-stop-button",
2766
- children: /* @__PURE__ */ v(Ct, { className: "bailey-stop-icon" })
2778
+ children: /* @__PURE__ */ v(Tt, { className: "bailey-stop-icon" })
2767
2779
  })
2768
2780
  }), /* @__PURE__ */ v(g.Portal, {
2769
- container: U instanceof ShadowRoot ? U : void 0,
2781
+ container: H instanceof ShadowRoot ? H : void 0,
2770
2782
  children: /* @__PURE__ */ y(g.Content, {
2771
2783
  side: "top",
2772
2784
  className: "bailey-tooltip-content",
@@ -2778,69 +2790,69 @@ function On({ chat: e, placeholder: t, replyPlaceholder: r = bn, emptyPlaceholde
2778
2790
  "aria-label": L.sendAriaLabel,
2779
2791
  disabled: !I.trim(),
2780
2792
  className: "bailey-send-button",
2781
- children: /* @__PURE__ */ v(St, { className: "bailey-send-icon" })
2793
+ children: /* @__PURE__ */ v(wt, { className: "bailey-send-icon" })
2782
2794
  })]
2783
- }), (!X || H) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
2795
+ }), (!xe || V) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
2784
2796
  asChild: !0,
2785
2797
  children: /* @__PURE__ */ v("button", {
2786
2798
  type: "button",
2787
2799
  ref: de,
2788
2800
  "aria-label": L.menuAriaLabel,
2789
2801
  className: "bailey-menu-button",
2790
- children: /* @__PURE__ */ v(kt, { className: "bailey-menu-icon" })
2802
+ children: /* @__PURE__ */ v(jt, { className: "bailey-menu-icon" })
2791
2803
  })
2792
2804
  }), /* @__PURE__ */ v(h.Portal, {
2793
- container: U instanceof ShadowRoot ? U : void 0,
2805
+ container: H instanceof ShadowRoot ? H : void 0,
2794
2806
  children: /* @__PURE__ */ y(h.Content, {
2795
2807
  side: "top",
2796
2808
  align: "end",
2797
2809
  sideOffset: 8,
2798
2810
  className: "bailey-menu-content",
2799
2811
  onCloseAutoFocus: (e) => {
2800
- V.current &&= (e.preventDefault(), !1);
2812
+ B.current &&= (e.preventDefault(), !1);
2801
2813
  },
2802
- children: [!X && /* @__PURE__ */ y(h.Item, {
2814
+ children: [!xe && /* @__PURE__ */ y(h.Item, {
2803
2815
  onSelect: () => F(),
2804
2816
  className: "bailey-menu-item",
2805
- children: [/* @__PURE__ */ v(At, { className: "bailey-menu-item-icon" }), L.newChatButtonText]
2806
- }), H && /* @__PURE__ */ y(h.Item, {
2817
+ children: [/* @__PURE__ */ v(Mt, { className: "bailey-menu-item-icon" }), L.newChatButtonText]
2818
+ }), V && /* @__PURE__ */ y(h.Item, {
2807
2819
  onSelect: () => {
2808
2820
  if (c) {
2809
2821
  c();
2810
2822
  return;
2811
2823
  }
2812
- V.current = !0, z(!0);
2824
+ B.current = !0, z(!0);
2813
2825
  },
2814
2826
  className: "bailey-menu-item",
2815
- children: [/* @__PURE__ */ v(Dt, { className: "bailey-menu-item-icon" }), L.historyMenuItemText]
2827
+ children: [/* @__PURE__ */ v(kt, { className: "bailey-menu-item-icon" }), L.historyMenuItemText]
2816
2828
  })]
2817
2829
  })
2818
2830
  })] })]
2819
2831
  }),
2820
- (X || _?.alwaysVisible) && _ && /* @__PURE__ */ v("div", {
2832
+ (xe || _?.alwaysVisible) && _ && /* @__PURE__ */ v("div", {
2821
2833
  className: "bailey-privacy-note",
2822
2834
  children: /* @__PURE__ */ v(p, {
2823
- remarkPlugins: Sn,
2824
- components: Cn,
2835
+ remarkPlugins: wn,
2836
+ components: Tn,
2825
2837
  skipHtml: !0,
2826
2838
  children: _.markdown
2827
2839
  })
2828
2840
  })
2829
2841
  ]
2830
- }), R && l && !c && /* @__PURE__ */ v(mn, {
2842
+ }), R && l && !c && /* @__PURE__ */ v(gn, {
2831
2843
  client: l.client,
2832
2844
  pageSize: l.pageSize,
2833
2845
  chat: e,
2834
2846
  labels: L,
2835
2847
  locale: m,
2836
- onClose: xe
2848
+ onClose: Z
2837
2849
  })]
2838
2850
  })
2839
2851
  });
2840
2852
  }
2841
2853
  //#endregion
2842
2854
  //#region src/ui/BaileyFeedbackButtons.tsx
2843
- var kn = {
2855
+ var jn = {
2844
2856
  feedbackGroupLabel: "Rate this response",
2845
2857
  feedbackThumbsUpAriaLabel: "Good response",
2846
2858
  feedbackThumbsDownAriaLabel: "Bad response",
@@ -2861,48 +2873,48 @@ var kn = {
2861
2873
  feedbackReasonUnsafe: "Unsafe",
2862
2874
  feedbackReasonTooLong: "Too long",
2863
2875
  feedbackReasonOther: "Other"
2864
- }, An = 2e3, jn = [
2876
+ }, Mn = 2e3, Nn = [
2865
2877
  "inaccurate",
2866
2878
  "unhelpful",
2867
2879
  "unsafe",
2868
2880
  "too_long",
2869
2881
  "other"
2870
- ], Mn = {
2882
+ ], Pn = {
2871
2883
  inaccurate: "feedbackReasonInaccurate",
2872
2884
  unhelpful: "feedbackReasonUnhelpful",
2873
2885
  unsafe: "feedbackReasonUnsafe",
2874
2886
  too_long: "feedbackReasonTooLong",
2875
2887
  other: "feedbackReasonOther"
2876
- }, Nn = (e) => jn.includes(e) ? e : "other";
2877
- function Pn(e) {
2878
- return Array.from(new Set((e ?? jn).map(Nn)));
2888
+ }, Fn = (e) => Nn.includes(e) ? e : "other";
2889
+ function In(e) {
2890
+ return Array.from(new Set((e ?? Nn).map(Fn)));
2879
2891
  }
2880
- function Fn(e) {
2881
- return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), An) : An;
2892
+ function Ln(e) {
2893
+ return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), Mn) : Mn;
2882
2894
  }
2883
- function In(e, t) {
2895
+ function Rn(e, t) {
2884
2896
  if (e === null || t === null) return e === t;
2885
2897
  let n = e.reasonCodes ?? [], r = t.reasonCodes ?? [];
2886
2898
  return e.rating === t.rating && (e.comment ?? "") === (t.comment ?? "") && n.length === r.length && n.every((e, t) => e === r[t]);
2887
2899
  }
2888
- function Ln(e) {
2889
- return e.messageId ? /* @__PURE__ */ v(Rn, { ...e }, e.messageId) : null;
2900
+ function zn(e) {
2901
+ return e.messageId ? /* @__PURE__ */ v(Bn, { ...e }, e.messageId) : null;
2890
2902
  }
2891
- function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, className: l }) {
2903
+ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, className: l }) {
2892
2904
  let u = {
2893
- ...kn,
2905
+ ...jn,
2894
2906
  ...o
2895
- }, p = Pn(i), m = Fn(a), h = r ? { rating: r } : null, [b, x] = f(h), [S, C] = f(r ?? null), [w, T] = f(!1), [E, D] = f("down"), [O, k] = f([]), [ee, A] = f(""), [j, M] = f(!1), [N, te] = f(!1), [P, ne] = f(!1), [re, ie] = f(!1), ae = d(h), F = d(null), I = d(0), oe = d(!1), L = d(!0), se = d(null), ce = d(null), le = d(null), ue = d(null), de = d(null), R = bt(ce), z = c(), B = `${z}-comment`, V = `${z}-counter`, H = `${z}-privacy`;
2907
+ }, p = In(i), m = Ln(a), h = r ? { rating: r } : null, [b, ee] = f(h), [x, S] = f(r ?? null), [C, w] = f(!1), [T, E] = f("down"), [D, O] = f([]), [k, A] = f(""), [j, M] = f(!1), [N, te] = f(!1), [P, ne] = f(!1), [re, ie] = f(!1), ae = d(h), F = d(null), I = d(0), oe = d(!1), L = d(!0), se = d(null), ce = d(null), le = d(null), ue = d(null), de = d(null), R = St(ce), z = c(), fe = `${z}-comment`, B = `${z}-counter`, V = `${z}-privacy`;
2896
2908
  s(() => (L.current = !0, () => {
2897
2909
  L.current = !1;
2898
2910
  }), []), s(() => {
2899
- w && de.current?.focus();
2900
- }, [w]), s(() => {
2901
- se.current && !P && !w && ((se.current === "up" ? le : ue).current?.focus(), se.current = null);
2911
+ C && de.current?.focus();
2912
+ }, [C]), s(() => {
2913
+ se.current && !P && !C && ((se.current === "up" ? le : ue).current?.focus(), se.current = null);
2902
2914
  });
2903
- let U = () => {
2904
- k([]), A("");
2905
- }, W = async (r) => {
2915
+ let H = () => {
2916
+ O([]), A("");
2917
+ }, pe = async (r) => {
2906
2918
  try {
2907
2919
  return r.kind === "clear" ? await n({ messageId: e }) : await t({
2908
2920
  messageId: e,
@@ -2911,61 +2923,61 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2911
2923
  } catch {
2912
2924
  return !1;
2913
2925
  }
2914
- }, fe = async () => {
2926
+ }, U = async () => {
2915
2927
  if (!oe.current) {
2916
2928
  oe.current = !0, te(!0);
2917
2929
  try {
2918
2930
  for (; F.current && L.current;) {
2919
- let e = F.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && In(t, ae.current) || await W(e);
2931
+ let e = F.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Rn(t, ae.current) || await pe(e);
2920
2932
  if (!L.current) return;
2921
2933
  let r = F.current?.version !== e.version;
2922
- !n && r || (n ? (ae.current = t, x(t)) : (C(ae.current?.rating ?? null), ie(!0)), r || (F.current = null, ne(!1), n && e.kind === "submit" && e.formSubmit && (T(!1), M(!0), se.current = e.snapshot.rating)));
2934
+ !n && r || (n ? (ae.current = t, ee(t)) : (S(ae.current?.rating ?? null), ie(!0)), r || (F.current = null, ne(!1), n && e.kind === "submit" && e.formSubmit && (w(!1), M(!0), se.current = e.snapshot.rating)));
2923
2935
  }
2924
2936
  } finally {
2925
2937
  oe.current = !1, L.current && te(!1);
2926
2938
  }
2927
2939
  }
2928
- }, G = (e) => {
2940
+ }, me = (e) => {
2929
2941
  I.current += 1, F.current = {
2930
2942
  ...e,
2931
2943
  version: I.current
2932
- }, ie(!1), fe();
2933
- }, K = () => {
2934
- C(null), T(!1), M(!1), U(), G({ kind: "clear" });
2935
- }, q = (e) => {
2944
+ }, ie(!1), U();
2945
+ }, he = () => {
2946
+ S(null), w(!1), M(!1), H(), me({ kind: "clear" });
2947
+ }, W = (e) => {
2936
2948
  if (!P) {
2937
- if (S === e) {
2938
- K();
2949
+ if (x === e) {
2950
+ he();
2939
2951
  return;
2940
2952
  }
2941
- C(e), M(!1), U(), e === "down" ? (D("down"), T(!0)) : T(!1), G({
2953
+ S(e), M(!1), H(), e === "down" ? (E("down"), w(!0)) : w(!1), me({
2942
2954
  kind: "submit",
2943
2955
  snapshot: { rating: e },
2944
2956
  formSubmit: !1
2945
2957
  });
2946
2958
  }
2947
- }, J = (e) => {
2948
- S !== null && (D(S), k((e?.reasonCodes ?? []).map(Nn)), A(e?.comment ?? ""), ie(!1), T(!0));
2949
- }, pe = () => {
2950
- P || (T(!1), ie(!1), U(), se.current = E);
2951
- }, me = () => {
2959
+ }, G = (e) => {
2960
+ x !== null && (E(x), O((e?.reasonCodes ?? []).map(Fn)), A(e?.comment ?? ""), ie(!1), w(!0));
2961
+ }, K = () => {
2962
+ P || (w(!1), ie(!1), H(), se.current = T);
2963
+ }, ge = () => {
2952
2964
  if (P) return;
2953
- let e = ee.trim(), t = p.filter((e) => O.includes(e)), n = {
2954
- rating: E,
2965
+ let e = k.trim(), t = p.filter((e) => D.includes(e)), n = {
2966
+ rating: T,
2955
2967
  ...t.length > 0 ? { reasonCodes: t } : {},
2956
2968
  ...e ? { comment: e } : {}
2957
2969
  };
2958
- ne(!0), C(E), G({
2970
+ ne(!0), S(T), me({
2959
2971
  kind: "submit",
2960
2972
  snapshot: n,
2961
2973
  formSubmit: !0
2962
2974
  });
2963
- }, he = (e) => {
2964
- k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
2965
- }, ge = (e) => {
2966
- e.key === "Escape" && (e.stopPropagation(), pe());
2967
- }, Y = S !== null && b?.rating === S && !N && !w, _e = !!b && (!!b.comment || (b.reasonCodes?.length ?? 0) > 0), ve = N ? u.feedbackSavingText : Y ? u.feedbackThanksText : "", X = (e) => {
2968
- let t = S === e, n = e === "up" ? u.feedbackThumbsUpAriaLabel : u.feedbackThumbsDownAriaLabel, r = e === "up" ? Nt : Pt;
2975
+ }, _e = (e) => {
2976
+ O((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
2977
+ }, ve = (e) => {
2978
+ e.key === "Escape" && (e.stopPropagation(), K());
2979
+ }, ye = x !== null && b?.rating === x && !N && !C, q = !!b && (!!b.comment || (b.reasonCodes?.length ?? 0) > 0), be = N ? u.feedbackSavingText : ye ? u.feedbackThanksText : "", xe = (e) => {
2980
+ let t = x === e, n = e === "up" ? u.feedbackThumbsUpAriaLabel : u.feedbackThumbsDownAriaLabel, r = e === "up" ? Ft : It;
2969
2981
  return /* @__PURE__ */ y(g.Root, { children: [/* @__PURE__ */ v(g.Trigger, {
2970
2982
  asChild: !0,
2971
2983
  children: /* @__PURE__ */ v("button", {
@@ -2976,7 +2988,7 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2976
2988
  "aria-label": n,
2977
2989
  "aria-busy": t && N ? !0 : void 0,
2978
2990
  disabled: P,
2979
- onClick: () => q(e),
2991
+ onClick: () => W(e),
2980
2992
  children: /* @__PURE__ */ v(r, {
2981
2993
  className: "bailey-feedback-icon",
2982
2994
  filled: t
@@ -3002,7 +3014,7 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3002
3014
  "aria-label": u.feedbackGroupLabel,
3003
3015
  "aria-busy": N ? !0 : void 0,
3004
3016
  className: "bailey-feedback-thumbs",
3005
- children: [X("up"), X("down")]
3017
+ children: [xe("up"), xe("down")]
3006
3018
  })
3007
3019
  }),
3008
3020
  /* @__PURE__ */ y("span", {
@@ -3011,17 +3023,17 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3011
3023
  children: [N && /* @__PURE__ */ v("span", {
3012
3024
  className: "bailey-feedback-spinner",
3013
3025
  "aria-hidden": "true"
3014
- }), ve]
3026
+ }), be]
3015
3027
  }),
3016
- Y && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
3028
+ ye && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
3017
3029
  type: "button",
3018
3030
  className: "bailey-feedback-link",
3019
- onClick: () => J(b),
3020
- children: j || _e ? u.feedbackEditText : u.feedbackAddCommentText
3031
+ onClick: () => G(b),
3032
+ children: j || q ? u.feedbackEditText : u.feedbackAddCommentText
3021
3033
  }), /* @__PURE__ */ v("button", {
3022
3034
  type: "button",
3023
3035
  className: "bailey-feedback-link",
3024
- onClick: K,
3036
+ onClick: he,
3025
3037
  children: u.feedbackUndoText
3026
3038
  })] }),
3027
3039
  re && /* @__PURE__ */ v("span", {
@@ -3029,9 +3041,9 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3029
3041
  className: "bailey-feedback-error",
3030
3042
  children: u.feedbackErrorText
3031
3043
  }),
3032
- w && /* @__PURE__ */ y("div", {
3044
+ C && /* @__PURE__ */ y("div", {
3033
3045
  className: "bailey-feedback-form",
3034
- onKeyDown: ge,
3046
+ onKeyDown: ve,
3035
3047
  children: [
3036
3048
  p.length > 0 && /* @__PURE__ */ y("fieldset", {
3037
3049
  className: "bailey-feedback-reasons",
@@ -3046,41 +3058,41 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3046
3058
  } : void 0,
3047
3059
  type: "button",
3048
3060
  className: "bailey-feedback-chip",
3049
- "aria-pressed": O.includes(e),
3061
+ "aria-pressed": D.includes(e),
3050
3062
  disabled: P,
3051
- onClick: () => he(e),
3052
- children: u[Mn[e]]
3063
+ onClick: () => _e(e),
3064
+ children: u[Pn[e]]
3053
3065
  }, e))
3054
3066
  })]
3055
3067
  }),
3056
3068
  /* @__PURE__ */ v("label", {
3057
- htmlFor: B,
3069
+ htmlFor: fe,
3058
3070
  className: "bailey-feedback-legend",
3059
3071
  children: u.feedbackCommentLabel
3060
3072
  }),
3061
3073
  /* @__PURE__ */ v("textarea", {
3062
- id: B,
3074
+ id: fe,
3063
3075
  ref: p.length === 0 ? (e) => {
3064
3076
  de.current = e;
3065
3077
  } : void 0,
3066
3078
  className: "bailey-feedback-textarea",
3067
- value: ee,
3079
+ value: k,
3068
3080
  maxLength: m,
3069
3081
  placeholder: u.feedbackCommentPlaceholder,
3070
- "aria-describedby": `${V} ${H}`,
3082
+ "aria-describedby": `${B} ${V}`,
3071
3083
  disabled: P,
3072
3084
  onChange: (e) => A(e.target.value.slice(0, m))
3073
3085
  }),
3074
3086
  /* @__PURE__ */ y("div", {
3075
3087
  className: "bailey-feedback-meta",
3076
3088
  children: [/* @__PURE__ */ v("span", {
3077
- id: H,
3089
+ id: V,
3078
3090
  className: "bailey-feedback-privacy",
3079
3091
  children: u.feedbackPrivacyNote
3080
3092
  }), /* @__PURE__ */ v("span", {
3081
- id: V,
3093
+ id: B,
3082
3094
  className: "bailey-feedback-counter",
3083
- children: `${ee.length} / ${m}`
3095
+ children: `${k.length} / ${m}`
3084
3096
  })]
3085
3097
  }),
3086
3098
  /* @__PURE__ */ y("div", {
@@ -3089,13 +3101,13 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3089
3101
  type: "button",
3090
3102
  className: "bailey-feedback-button",
3091
3103
  disabled: P,
3092
- onClick: pe,
3104
+ onClick: K,
3093
3105
  children: u.feedbackCancelText
3094
3106
  }), /* @__PURE__ */ v("button", {
3095
3107
  type: "button",
3096
3108
  className: "bailey-feedback-button bailey-feedback-button-primary",
3097
3109
  disabled: P,
3098
- onClick: me,
3110
+ onClick: ge,
3099
3111
  children: P ? u.feedbackSavingText : u.feedbackSubmitText
3100
3112
  })]
3101
3113
  })
@@ -3106,6 +3118,6 @@ function Rn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
3106
3118
  }
3107
3119
  //#endregion
3108
3120
  //#region src/index.ts
3109
- var zn = "0.3.1-pre.2";
3121
+ var Vn = "0.3.1-pre.2";
3110
3122
  //#endregion
3111
- export { Ot as ActivityIcon, wt as ArrowUpRightIcon, zn as BAILEYAI_CHAT_UI_VERSION, Le as BAILEY_CHART_PROMPT_FRAGMENT, ke as BAILEY_TABLE_GRID_ROW_THRESHOLD, V as BaileyApiError, On as BaileyChatPanel, U as BaileyCleanupError, Ln as BaileyFeedbackButtons, mn as BaileyHistoryDrawer, Jt as BaileyTracePanel, zt as CopyMarkdownButton, ie as DEFAULT_CONVERSATION_STORAGE_KEY, St as HeartIcon, Ge as TRACE_KIND_LABEL, Pt as ThumbDownIcon, Nt as ThumbUpIcon, we as createBaileyClient, Te as createBaileyFeedbackHandlers, xt as createBaileyMarkdownComponents, F as createMemoryConversationStorage, ae as createSessionConversationStorage, k as extractPseudoToolCalls, Fe as extractTableData, pn as formatRelativeTime, tt as formatTraceGap, et as formatTraceTime, at as hasTraceFailure, re as isConversationIdForSub, e as isSafeMarkdownUrl, $ as joinInstructions, te as mapTranscript, ne as mergeEarlierPage, We as parseBaileyChartSpec, A as parseSseFrames, Oe as resolveToolCall, Ie as shouldUseGrid, ot as toActivityLines, st as toToolSteps, nt as toTraceRows, it as toTraceSegments, Ye as traceEventArgsDetail, $e as traceEventHint, Xe as traceEventOutputDetail, Qe as traceEventRawDetail, Je as traceEventSummary, qe as traceEventToolName, rt as traceSummaryLine, B as useBaileyChat, fe as useBaileyConversations };
3123
+ export { At as ActivityIcon, Et as ArrowUpRightIcon, Vn as BAILEYAI_CHAT_UI_VERSION, ze as BAILEY_CHART_PROMPT_FRAGMENT, je as BAILEY_TABLE_GRID_ROW_THRESHOLD, V as BaileyApiError, An as BaileyChatPanel, pe as BaileyCleanupError, zn as BaileyFeedbackButtons, gn as BaileyHistoryDrawer, Xt as BaileyTracePanel, Vt as CopyMarkdownButton, ie as DEFAULT_CONVERSATION_STORAGE_KEY, wt as HeartIcon, qe as TRACE_KIND_LABEL, It as ThumbDownIcon, Ft as ThumbUpIcon, De as createBaileyClient, Q as createBaileyFeedbackHandlers, Ct as createBaileyMarkdownComponents, F as createMemoryConversationStorage, ae as createSessionConversationStorage, O as extractPseudoToolCalls, Le as extractTableData, hn as formatRelativeTime, rt as formatTraceGap, nt as formatTraceTime, st as hasTraceFailure, re as isConversationIdForSub, e as isSafeMarkdownUrl, Oe as joinInstructions, te as mapTranscript, ne as mergeEarlierPage, Ke as parseBaileyChartSpec, A as parseSseFrames, $ as resolveToolCall, Re as shouldUseGrid, ct as toActivityLines, lt as toToolSteps, it as toTraceRows, ot as toTraceSegments, Ze as traceEventArgsDetail, tt as traceEventHint, Qe as traceEventOutputDetail, et as traceEventRawDetail, Xe as traceEventSummary, Ye as traceEventToolName, at as traceSummaryLine, B as useBaileyChat, me as useBaileyConversations };