@icanbwell/baileyai-chat-ui 1.1.0 → 1.1.1

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
  // 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", x = RegExp(`<(${b})>([\\s\\S]*?)<\\/\\1>`, "g"), S = RegExp(`<(?:${b})>[\\s\\S]*$`), C = /<name>([\s\S]*?)<\/name>/, ee = /<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 = C.exec(e)?.[1]?.trim() || "unknown_tool", n = ee.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,11 +31,11 @@ function O(e) {
31
31
  }
32
32
  return t;
33
33
  }
34
- function ee(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(x, (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
41
  }), "")), a = n ? i.replace(S, "") : i;
@@ -205,7 +205,7 @@ function se() {
205
205
  remove: (e) => window.sessionStorage.removeItem(e)
206
206
  };
207
207
  }
208
- function R() {
208
+ function ce() {
209
209
  let e = /* @__PURE__ */ new Map();
210
210
  return {
211
211
  get: (t) => e.get(t) ?? null,
@@ -214,12 +214,12 @@ function R() {
214
214
  };
215
215
  }
216
216
  // src/logic/useBaileyChat.ts
217
- var z = 200, ce = 100, le = 15e4, ue = "bailey", B = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, de = (e, t, n, r) => {
217
+ var R = 200, le = 100, ue = [503, 405], de = 15e4, z = "bailey", fe = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, pe = (e, t, n, r) => {
218
218
  if (t === 401 || t === 403) return `${e} isn't reachable with your current login.`;
219
219
  let i = `${e} request failed (status ${t ?? "network error"}).`, a = (r || n || "").trim();
220
- return a ? `${i} ${a.length > z ? `${a.slice(0, z)}…` : a}` : i;
220
+ return a ? `${i} ${a.length > R ? `${a.slice(0, R)}…` : a}` : i;
221
221
  };
222
- function V(e, t, n) {
222
+ function B(e, t, n) {
223
223
  if (e) try {
224
224
  return e.get(t) || void 0;
225
225
  } catch (e) {
@@ -227,82 +227,82 @@ function V(e, t, n) {
227
227
  return;
228
228
  }
229
229
  }
230
- function H(e, t) {
230
+ function me(e, t) {
231
231
  t.signal.aborted || typeof e != "string" || (t.historyStatus = e);
232
232
  }
233
- function fe(e, t, n, r) {
233
+ function he(e, t, n, r) {
234
234
  try {
235
235
  e?.set(t, n);
236
236
  } catch (e) {
237
237
  r(e, "write");
238
238
  }
239
239
  }
240
- function pe(e, t, n) {
240
+ function ge(e, t, n) {
241
241
  try {
242
242
  e?.remove(t);
243
243
  } catch (e) {
244
244
  n(e, "remove");
245
245
  }
246
246
  }
247
- var me = (e, t) => t ? `${e}:${t}` : e;
248
- function he(e) {
247
+ var _e = (e, t) => t ? `${e}:${t}` : e;
248
+ function ve(e) {
249
249
  let { seed: t, sub: n, storage: r, key: i, report: a } = e;
250
- if (!n) return t || V(r, i, a);
250
+ if (!n) return t || B(r, i, a);
251
251
  if (t && L({
252
252
  conversationId: t,
253
253
  sub: n
254
254
  })) return t;
255
- let o = V(r, i, a);
255
+ let o = B(r, i, a);
256
256
  if (o) {
257
257
  if (L({
258
258
  conversationId: o,
259
259
  sub: n
260
260
  })) return o;
261
- pe(r, i, a);
261
+ ge(r, i, a);
262
262
  }
263
263
  }
264
- var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tools: i = [], toolChoice: o, firstUserMessagePrefix: c, onAssistantMessageComplete: l, idleTimeoutMs: p = le, client: m, conversationId: h, sub: g, storage: _, storageKey: v = oe, sendFullTranscript: y = !1, onStorageError: b, onContextLoss: x }) => {
265
- let [S, C] = f([]), [w, T] = f([]), [E, D] = f(null), [O, k] = f("idle"), [ne, M] = f(null), N = g !== void 0 && g.trim() === "", P = N ? void 0 : g?.trim() || void 0, re = u(() => se(), []), I = N ? null : _ === void 0 ? re : _ || null, R = d(b), z = d(x);
264
+ var ye = ({ transport: e, model: t, instructions: n, assistantName: r = z, tools: i = [], toolChoice: o, firstUserMessagePrefix: c, onAssistantMessageComplete: l, idleTimeoutMs: p = de, client: m, conversationId: h, sub: g, storage: _, storageKey: v = oe, sendFullTranscript: y = !1, onStorageError: b, onContextLoss: x }) => {
265
+ let [S, C] = f([]), [ee, w] = f([]), [T, E] = f(null), [D, k] = f("idle"), [ne, M] = f(null), N = g !== void 0 && g.trim() === "", P = N ? void 0 : g?.trim() || void 0, re = u(() => se(), []), I = N ? null : _ === void 0 ? re : _ || null, ce = d(b), R = d(x);
266
266
  s(() => {
267
- R.current = b, z.current = x;
267
+ ce.current = b, R.current = x;
268
268
  }, [b, x]);
269
- let V = a((e, t) => {
269
+ let B = a((e, t) => {
270
270
  try {
271
- R.current?.(e, t);
271
+ ce.current?.(e, t);
272
272
  } catch {}
273
- }, []), ge = (e) => he({
273
+ }, []), ye = (e) => ve({
274
274
  seed: h,
275
275
  sub: P,
276
276
  storage: I,
277
- key: me(v, P),
277
+ key: _e(v, P),
278
278
  report: e
279
- }), [U] = f(() => {
279
+ }), [be] = f(() => {
280
280
  let e = [];
281
281
  return {
282
- id: ge((t, n) => void e.push({
282
+ id: ye((t, n) => void e.push({
283
283
  error: t,
284
284
  operation: n
285
285
  })),
286
286
  errors: e
287
287
  };
288
- }), [_e, W] = f(U.id), [ve, ye] = f(U.errors.length > 0), G = a((e, t) => {
289
- ye(!0), V(e, t);
290
- }, [V]);
288
+ }), [V, H] = f(be.id), [xe, U] = f(be.errors.length > 0), W = a((e, t) => {
289
+ U(!0), B(e, t);
290
+ }, [B]);
291
291
  s(() => {
292
- U.errors.forEach(({ error: e, operation: t }) => V(e, t));
293
- }, [U, V]), s(() => {
294
- N && V(/* @__PURE__ */ Error("sub is blank"), "key");
295
- }, [N, V]);
296
- let K = d(_e), q = d({
292
+ be.errors.forEach(({ error: e, operation: t }) => B(e, t));
293
+ }, [be, B]), s(() => {
294
+ N && B(/* @__PURE__ */ Error("sub is blank"), "key");
295
+ }, [N, B]);
296
+ let G = d(V), K = d({
297
297
  storage: I,
298
- key: me(v, P),
298
+ key: _e(v, P),
299
299
  sub: P,
300
300
  sendFullTranscript: y
301
301
  });
302
302
  s(() => {
303
- q.current = {
303
+ K.current = {
304
304
  storage: I,
305
- key: me(v, P),
305
+ key: _e(v, P),
306
306
  sub: P,
307
307
  sendFullTranscript: y
308
308
  };
@@ -312,50 +312,50 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
312
312
  P,
313
313
  y
314
314
  ]);
315
- let be = _ === !1 ? "off" : ve || N ? "degraded" : "ok", [xe, Se] = f(!1), [Ce, J] = f("idle"), [we, Te] = f(!1), Ee = d(0), Y = d(null), X = d(null), De = d(!1), Z = a(() => {
316
- Ee.current += 1, Y.current?.abort(), Y.current = null, X.current = null, De.current = !1, Te(!1), J("idle");
317
- }, []), Oe = d(m);
315
+ let Se = _ === !1 ? "off" : xe || N ? "degraded" : "ok", [Ce, we] = f(!1), [Te, q] = f("idle"), [Ee, De] = f(!1), J = d(0), Y = d(null), X = d(null), Oe = d(!1), Z = a(() => {
316
+ J.current += 1, Y.current?.abort(), Y.current = null, X.current = null, Oe.current = !1, De(!1), q("idle");
317
+ }, []), ke = d(m);
318
318
  s(() => {
319
- Oe.current = m;
319
+ ke.current = m;
320
320
  }, [m]), s(() => () => Y.current?.abort(), []);
321
- let ke = d(null), Ae = d(""), Q = d(0), je = d([]);
321
+ let Ae = d(null), je = d(""), Q = d(0), Me = d([]);
322
322
  s(() => {
323
- je.current = S;
323
+ Me.current = S;
324
324
  }, [S]);
325
- let $ = d([]), Me = d(/* @__PURE__ */ new Map()), Ne = d(/* @__PURE__ */ new Map()), Pe = d(null), Fe = a(() => {
326
- Pe.current !== null && (clearTimeout(Pe.current), Pe.current = null);
327
- }, []), Ie = a((e) => {
328
- Fe(), Pe.current = setTimeout(() => {
325
+ let $ = d([]), Ne = d(/* @__PURE__ */ new Map()), Pe = d(/* @__PURE__ */ new Map()), Fe = d(null), Ie = a(() => {
326
+ Fe.current !== null && (clearTimeout(Fe.current), Fe.current = null);
327
+ }, []), Le = a((e) => {
328
+ Ie(), Fe.current = setTimeout(() => {
329
329
  e.abort(new DOMException("The assistant took too long to respond. Please try again.", "TimeoutError"));
330
330
  }, p);
331
- }, [Fe, p]);
331
+ }, [Ie, p]);
332
332
  s(() => () => {
333
- ke.current?.abort(), Fe();
334
- }, [Fe]);
335
- let Le = a(({ reportedId: e, source: t, turn: n }) => {
333
+ Ae.current?.abort(), Ie();
334
+ }, [Ie]);
335
+ let Re = a(({ reportedId: e, source: t, turn: n }) => {
336
336
  if (n.signal.aborted || typeof e != "string" || !e) return;
337
337
  if (t === "event") n.reportedId = e, n.reportedFromEvent = !0;
338
338
  else if (!n.reportedFromEvent) n.reportedId = e;
339
339
  else return;
340
- if (n.heldId || e === K.current) return;
341
- let { sub: r, storage: i, key: a } = q.current;
340
+ if (n.heldId || e === G.current) return;
341
+ let { sub: r, storage: i, key: a } = K.current;
342
342
  (!r || L({
343
343
  conversationId: e,
344
344
  sub: r
345
- })) && (K.current = e, W(e), fe(i, a, e, G));
346
- }, [G]), Re = a((e, t, n, r) => {
345
+ })) && (G.current = e, H(e), he(i, a, e, W));
346
+ }, [W]), ze = a((e, t, n, r) => {
347
347
  let i = (e) => {
348
- n.push(e), T((t) => [...t, e]);
348
+ n.push(e), w((t) => [...t, e]);
349
349
  };
350
350
  if (t.type === "response.output_text.delta") {
351
351
  if (!t.delta) return !1;
352
- let n = Me.current.get(e) ?? {
352
+ let n = Ne.current.get(e) ?? {
353
353
  raw: "",
354
354
  emittedCount: 0
355
355
  };
356
356
  n.raw += t.delta;
357
- let { cleanedText: r, matches: a } = ee(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
358
- if (n.emittedCount = a.length, Me.current.set(e, n), Ne.current.set(e, o), C((t) => t.map((t) => t.id === e ? {
357
+ let { cleanedText: r, matches: a } = O(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
358
+ if (n.emittedCount = a.length, Ne.current.set(e, n), Pe.current.set(e, o), C((t) => t.map((t) => t.id === e ? {
359
359
  ...t,
360
360
  content: o
361
361
  } : t)), s.length > 0) {
@@ -427,26 +427,26 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
427
427
  turnSentAt: Q.current
428
428
  }), !0;
429
429
  if (t.type === "response.output_text.done") return !1;
430
- if (t.type === "response.created") return Le({
430
+ if (t.type === "response.created") return Re({
431
431
  reportedId: t.response?.conversation?.id,
432
432
  source: "event",
433
433
  turn: r
434
- }), H(t.response?.conversation?.history_status, r), !1;
434
+ }), me(t.response?.conversation?.history_status, r), !1;
435
435
  if (t.type === "response.completed") {
436
- Le({
436
+ Re({
437
437
  reportedId: t.response?.conversation?.id,
438
438
  source: "event",
439
439
  turn: r
440
- }), H(t.response?.conversation?.history_status, r);
440
+ }), me(t.response?.conversation?.history_status, r);
441
441
  let n = typeof t.message_id == "string" && t.message_id ? t.message_id : void 0;
442
442
  n && C((t) => t.map((t) => t.id === e ? {
443
443
  ...t,
444
444
  serverMessageId: n
445
445
  } : t));
446
- let i = Me.current.get(e);
446
+ let i = Ne.current.get(e);
447
447
  if (i) {
448
- let { cleanedText: t } = ee(i.raw, { hideOpenBlock: !1 }), n = t.trim();
449
- n !== Ne.current.get(e) && (Ne.current.set(e, n), C((t) => t.map((t) => t.id === e ? {
448
+ let { cleanedText: t } = O(i.raw, { hideOpenBlock: !1 }), n = t.trim();
449
+ n !== Pe.current.get(e) && (Pe.current.set(e, n), C((t) => t.map((t) => t.id === e ? {
450
450
  ...t,
451
451
  content: n
452
452
  } : t)));
@@ -490,11 +490,11 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
490
490
  at: Date.now(),
491
491
  turnSentAt: Q.current
492
492
  }), !0;
493
- }, [Le]), ze = a(async (a) => {
494
- k("streaming"), M(null), Se(!1);
493
+ }, [Re]), Be = a(async (a) => {
494
+ k("streaming"), M(null), we(!1);
495
495
  let s = Date.now();
496
496
  Q.current = s;
497
- let u = B(), d = {
497
+ let u = fe(), d = {
498
498
  id: u,
499
499
  role: "assistant",
500
500
  content: "",
@@ -512,8 +512,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
512
512
  content: e.content,
513
513
  hidden: e.hidden,
514
514
  titleHint: e.titleHint
515
- }), { sendFullTranscript: m } = q.current, h = m ? void 0 : K.current, g = h ? p.slice(-1) : p;
516
- D({
515
+ }), { sendFullTranscript: m } = K.current, h = m ? void 0 : G.current, g = h ? p.slice(-1) : p;
516
+ E({
517
517
  model: t,
518
518
  systemPrompt: n,
519
519
  messages: g,
@@ -528,11 +528,11 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
528
528
  }
529
529
  });
530
530
  let _ = new AbortController();
531
- ke.current = _, Ie(_);
531
+ Ae.current = _, Le(_);
532
532
  let v = {
533
533
  signal: _.signal,
534
534
  heldId: h
535
- }, y = "", b = null, x = !1, S = !1, w = !1, E = [], O = (e, t) => {
535
+ }, y = "", b = null, x = !1, S = !1, ee = !1, T = [], D = (e, t) => {
536
536
  k("error"), M(e);
537
537
  let n = {
538
538
  kind: "error",
@@ -541,8 +541,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
541
541
  turnSentAt: s,
542
542
  ...t
543
543
  };
544
- E.push(n), T((e) => [...e, n]);
545
- }, ee = (e, t) => {
544
+ T.push(n), w((e) => [...e, n]);
545
+ }, O = (e, t) => {
546
546
  e.forEach((e) => {
547
547
  if (e.type === "error") {
548
548
  b = e.message;
@@ -552,8 +552,8 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
552
552
  at: Date.now(),
553
553
  turnSentAt: s
554
554
  };
555
- E.push(t), T((e) => [...e, t]);
556
- } else e.type === "response.output_text.delta" && e.delta && (w = !0), Re(u, e, E, v) && (S = !0);
555
+ T.push(t), w((e) => [...e, t]);
556
+ } else e.type === "response.output_text.delta" && e.delta && (ee = !0), ze(u, e, T, v) && (S = !0);
557
557
  }), t && (x = !0, C((e) => e.map((e) => e.id === u ? {
558
558
  ...e,
559
559
  streaming: !1
@@ -567,18 +567,18 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
567
567
  tools: i,
568
568
  toolChoice: o,
569
569
  ...h ? { conversationId: h } : {},
570
- onConversationId: (e) => Le({
570
+ onConversationId: (e) => Re({
571
571
  reportedId: e,
572
572
  source: "header",
573
573
  turn: v
574
574
  }),
575
575
  signal: _.signal,
576
576
  onChunk: (e) => {
577
- Ie(_), y += e;
577
+ Le(_), y += e;
578
578
  let { events: t, remainder: n, done: r } = A(y);
579
- y = n, ee(t, r);
579
+ y = n, O(t, r);
580
580
  let i = Date.now();
581
- D((e) => e && e.sentAt === s ? {
581
+ E((e) => e && e.sentAt === s ? {
582
582
  ...e,
583
583
  streamStats: {
584
584
  chunkCount: e.streamStats.chunkCount + 1,
@@ -588,7 +588,7 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
588
588
  } : e);
589
589
  },
590
590
  onRequestId: (e) => {
591
- D((t) => t && t.sentAt === s ? {
591
+ E((t) => t && t.sentAt === s ? {
592
592
  ...t,
593
593
  requestId: e
594
594
  } : t);
@@ -602,49 +602,49 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
602
602
  });
603
603
  if (y.trim()) {
604
604
  let { events: e, done: t } = A(`${y}\n\n`);
605
- y = "", ee(e, t);
605
+ y = "", O(e, t);
606
606
  }
607
607
  if (b) {
608
608
  k("error"), M(b);
609
609
  return;
610
610
  }
611
611
  if (f === "timeout" && !x) {
612
- O(d || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
612
+ D(d || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
613
613
  return;
614
614
  }
615
615
  if (p && !x) {
616
- O("The connection was interrupted before the answer finished. Try again.");
616
+ D("The connection was interrupted before the answer finished. Try again.");
617
617
  return;
618
618
  }
619
619
  if (a === void 0 || a >= 400) {
620
- O(de(r, a, c, d), {
620
+ D(pe(r, a, c, d), {
621
621
  httpStatus: a,
622
622
  rawBody: c || void 0
623
623
  });
624
624
  return;
625
625
  }
626
- let m = v.reportedId, T = m !== h, j = v.historyStatus === "failed" || v.historyStatus === "empty";
627
- if (h && !v.signal.aborted && (T || j)) {
628
- K.current = void 0, W(void 0), pe(q.current.storage, q.current.key, G), Z(), Se(!0);
626
+ let m = v.reportedId, w = m !== h, j = v.historyStatus === "failed" || v.historyStatus === "empty";
627
+ if (h && !v.signal.aborted && (w || j)) {
628
+ G.current = void 0, H(void 0), ge(K.current.storage, K.current.key, W), Z(), we(!0);
629
629
  try {
630
- z.current?.({
630
+ R.current?.({
631
631
  sentId: h,
632
632
  ...m ? { reportedId: m } : {},
633
- reason: T ? "id" : "history"
633
+ reason: w ? "id" : "history"
634
634
  });
635
635
  } catch {}
636
636
  }
637
637
  if (!S) {
638
- O(`${r} returned an empty response.`);
638
+ D(`${r} returned an empty response.`);
639
639
  return;
640
640
  }
641
- if (!w) {
642
- O(`${r} ran some tools but didn't return an answer. Try asking again.`);
641
+ if (!ee) {
642
+ D(`${r} ran some tools but didn't return an answer. Try asking again.`);
643
643
  return;
644
644
  }
645
645
  k("idle");
646
- let te = Ne.current.get(u) ?? "";
647
- D((e) => e && e.sentAt === s ? {
646
+ let te = Pe.current.get(u) ?? "";
647
+ E((e) => e && e.sentAt === s ? {
648
648
  ...e,
649
649
  response: { content: te }
650
650
  } : e), l && await l({
@@ -652,23 +652,23 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
652
652
  role: "assistant",
653
653
  content: te,
654
654
  streaming: !1
655
- }, E);
655
+ }, T);
656
656
  } catch (e) {
657
657
  let t = e;
658
658
  if (t?.name === "TimeoutError") {
659
- O(t.message, { source: "client-timeout" });
659
+ D(t.message, { source: "client-timeout" });
660
660
  return;
661
661
  }
662
662
  if (t?.name === "AbortError") {
663
663
  k("idle");
664
664
  return;
665
665
  }
666
- O(t instanceof j ? te(t, r) : t?.message || `${r} request failed.`);
666
+ D(t instanceof j ? te(t, r) : t?.message || `${r} request failed.`);
667
667
  } finally {
668
- Fe();
669
- let e = Ne.current.get(u) ?? "";
670
- Me.current.delete(u), Ne.current.delete(u);
671
- let t = E.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
668
+ Ie();
669
+ let e = Pe.current.get(u) ?? "";
670
+ Ne.current.delete(u), Pe.current.delete(u);
671
+ let t = T.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
672
672
  C((e) => e.flatMap((e) => e.id === u ? e.content || t ? [{
673
673
  ...e,
674
674
  streaming: !1
@@ -687,118 +687,118 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
687
687
  o,
688
688
  c,
689
689
  l,
690
+ ze,
690
691
  Re,
691
692
  Le,
692
693
  Ie,
693
- Fe,
694
- G,
694
+ W,
695
695
  Z
696
- ]), Be = a((e) => {
697
- je.current = e, C(e);
698
- }, []), Ve = a((e) => {
696
+ ]), Ve = a((e) => {
697
+ Me.current = e, C(e);
698
+ }, []), He = a((e) => {
699
699
  let t = e.trim();
700
700
  if (!t) return;
701
- Ae.current = t;
701
+ je.current = t;
702
702
  let n = {
703
- id: B(),
703
+ id: fe(),
704
704
  role: "user",
705
705
  content: t,
706
706
  createdAt: Date.now()
707
707
  }, r = [...$.current, n];
708
- $.current = r, Be([...je.current, n]), ze(r);
709
- }, [ze, Be]), He = a((e, t) => {
710
- if (O === "streaming") return;
708
+ $.current = r, Ve([...Me.current, n]), Be(r);
709
+ }, [Be, Ve]), Ue = a((e, t) => {
710
+ if (D === "streaming") return;
711
711
  let n = e.trim();
712
712
  if (!n) return;
713
- Ae.current = n;
713
+ je.current = n;
714
714
  let r = t?.trim(), i = {
715
- id: B(),
715
+ id: fe(),
716
716
  role: "user",
717
717
  content: n,
718
718
  createdAt: Date.now(),
719
719
  hidden: !0,
720
720
  ...r ? { titleHint: r } : {}
721
721
  }, a = [...$.current, i];
722
- $.current = a, ze(a);
723
- }, [ze, O]), Ue = a(() => {
724
- ke.current?.abort();
725
- }, []), We = a(() => {
726
- if (O === "streaming" || !Ae.current) return;
727
- let e = je.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
728
- Be(n);
722
+ $.current = a, Be(a);
723
+ }, [Be, D]), We = a(() => {
724
+ Ae.current?.abort();
725
+ }, []), Ge = a(() => {
726
+ if (D === "streaming" || !je.current) return;
727
+ let e = Me.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
728
+ Ve(n);
729
729
  let r = $.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
730
- $.current = a, ze(a);
730
+ $.current = a, Be(a);
731
731
  }, [
732
- ze,
733
732
  Be,
734
- O
735
- ]), Ge = a(() => T([]), []), Ke = a(() => {
733
+ Ve,
734
+ D
735
+ ]), Ke = a(() => w([]), []), qe = a(() => {
736
736
  M(null), k((e) => e === "error" ? "idle" : e);
737
- }, []), qe = a(() => {
738
- ke.current?.abort(), Z(), Se(!1), Be([]), $.current = [], T([]), D(null), k("idle"), M(null), Ae.current = "";
739
- }, [Z, Be]), Je = a(() => {
740
- qe(), K.current = void 0, W(void 0), pe(q.current.storage, q.current.key, G);
741
- }, [qe, G]), Ye = d(P);
737
+ }, []), Je = a(() => {
738
+ Ae.current?.abort(), Z(), we(!1), Ve([]), $.current = [], w([]), E(null), k("idle"), M(null), je.current = "";
739
+ }, [Z, Ve]), Ye = a(() => {
740
+ Je(), G.current = void 0, H(void 0), ge(K.current.storage, K.current.key, W);
741
+ }, [Je, W]), Xe = d(P);
742
742
  s(() => {
743
- let e = Ye.current;
743
+ let e = Xe.current;
744
744
  if (e === P) return;
745
- Ye.current = P, e !== void 0 && qe();
746
- let t = ge(G);
747
- K.current = t, W(t);
745
+ Xe.current = P, e !== void 0 && Je();
746
+ let t = ye(W);
747
+ G.current = t, H(t);
748
748
  }, [P]);
749
- let Xe = a((e) => {
750
- ke.current?.abort();
749
+ let Ze = a((e) => {
750
+ Ae.current?.abort();
751
751
  let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
752
752
  ...e,
753
753
  streaming: !1
754
754
  }));
755
- Be(t.filter((e) => !e.hidden)), $.current = t, T([]), D(null), k("idle"), M(null), Ae.current = "";
756
- }, [Be]), Ze = a((e) => {
757
- Z(), Xe(e);
758
- }, [Z, Xe]), Qe = a((e) => {
759
- K.current = e, W(e), fe(q.current.storage, q.current.key, e, G), Se(!1);
760
- }, [G]), $e = a((e) => {
755
+ Ve(t.filter((e) => !e.hidden)), $.current = t, w([]), E(null), k("idle"), M(null), je.current = "";
756
+ }, [Ve]), Qe = a((e) => {
757
+ Z(), Ze(e);
758
+ }, [Z, Ze]), $e = a((e) => {
759
+ G.current = e, H(e), he(K.current.storage, K.current.key, e, W), we(!1);
760
+ }, [W]), et = a((e) => {
761
761
  let t = e.hasMoreBefore && e.nextBeforeAbsoluteIndex !== null;
762
- X.current = t ? e.nextBeforeAbsoluteIndex : null, Te(t);
763
- }, []), et = a(async ({ conversationId: e }) => {
764
- let t = Oe.current, { sub: n } = q.current, r = !!e && (!n || L({
762
+ X.current = t ? e.nextBeforeAbsoluteIndex : null, De(t);
763
+ }, []), tt = a(async ({ conversationId: e }) => {
764
+ let t = ke.current, { sub: n } = K.current, r = !!e && (!n || L({
765
765
  conversationId: e,
766
766
  sub: n
767
767
  }));
768
- if (!t || !r) throw J("error"), Error(t ? "invalid conversation id" : "no client");
769
- ke.current?.abort(), Z();
770
- let i = Ee.current, a = new AbortController();
771
- Y.current = a, J("loading");
768
+ if (!t || !r) throw q("error"), Error(t ? "invalid conversation id" : "no client");
769
+ Ae.current?.abort(), Z();
770
+ let i = J.current, a = new AbortController();
771
+ Y.current = a, q("loading");
772
772
  try {
773
773
  let n = await t.getConversation({
774
774
  conversationId: e,
775
- limit: ce,
775
+ limit: le,
776
776
  signal: a.signal
777
777
  });
778
- if (i !== Ee.current) return;
779
- Xe(F({ messages: n.messages })), Qe(e), $e(n), J("idle");
778
+ if (i !== J.current) return;
779
+ Ze(F({ messages: n.messages })), $e(e), et(n), q("idle");
780
780
  } catch (e) {
781
- if (i !== Ee.current) return;
782
- throw J("error"), e;
781
+ if (i !== J.current) return;
782
+ throw q("error"), e;
783
783
  }
784
784
  }, [
785
- $e,
785
+ et,
786
786
  Z,
787
- Qe,
788
- Xe
789
- ]), tt = a(async () => {
790
- let e = Oe.current, t = K.current, n = X.current;
791
- if (!e || !t || n === null || De.current) return;
792
- let r = Ee.current, i = new AbortController();
793
- Y.current = i, De.current = !0, J("loading");
787
+ $e,
788
+ Ze
789
+ ]), nt = a(async () => {
790
+ let e = ke.current, t = G.current, n = X.current;
791
+ if (!e || !t || n === null || Oe.current) return;
792
+ let r = J.current, i = new AbortController();
793
+ Y.current = i, Oe.current = !0, q("loading");
794
794
  try {
795
795
  let a = await e.getConversation({
796
796
  conversationId: t,
797
- limit: ce,
797
+ limit: le,
798
798
  beforeAbsoluteIndex: n,
799
799
  signal: i.signal
800
800
  });
801
- if (r !== Ee.current) return;
801
+ if (r !== J.current) return;
802
802
  let o = F({ messages: a.messages });
803
803
  $.current = ie({
804
804
  current: $.current,
@@ -808,46 +808,46 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
808
808
  current: e,
809
809
  earlier: o
810
810
  });
811
- return je.current = t, t;
812
- }), $e(a), J("idle");
811
+ return Me.current = t, t;
812
+ }), et(a), q("idle");
813
813
  } catch (e) {
814
- if (r !== Ee.current) return;
815
- throw J("error"), e;
814
+ if (r !== J.current) return;
815
+ throw q("error"), e;
816
816
  } finally {
817
- r === Ee.current && (De.current = !1);
817
+ r === J.current && (Oe.current = !1);
818
818
  }
819
- }, [$e]), [nt, rt] = f();
819
+ }, [et]), [rt, it] = f();
820
820
  return {
821
- conversationId: _e,
822
- persistence: be,
823
- contextLost: xe,
821
+ conversationId: V,
822
+ persistence: Se,
823
+ contextLost: Ce,
824
824
  messages: S,
825
- traceEvents: w,
826
- lastRequest: E,
827
- status: O,
825
+ traceEvents: ee,
826
+ lastRequest: T,
827
+ status: D,
828
828
  error: ne,
829
- send: Ve,
830
- sendHidden: He,
831
- stop: Ue,
832
- retryLast: We,
833
- clearTrace: Ge,
834
- clearError: Ke,
835
- newChat: Je,
836
- loadMessages: Ze,
837
- loadConversation: et,
838
- loadEarlier: tt,
839
- hasEarlier: we,
840
- historyStatus: Ce,
829
+ send: He,
830
+ sendHidden: Ue,
831
+ stop: We,
832
+ retryLast: Ge,
833
+ clearTrace: Ke,
834
+ clearError: qe,
835
+ newChat: Ye,
836
+ loadMessages: Qe,
837
+ loadConversation: tt,
838
+ loadEarlier: nt,
839
+ hasEarlier: Ee,
840
+ historyStatus: Te,
841
841
  feedback: u(() => {
842
- if (!m || nt === m) return;
842
+ if (!m || rt === m) return;
843
843
  let e = ae({
844
844
  client: m,
845
- getConversationId: () => _e
845
+ getConversationId: () => V
846
846
  }), t = async (e) => {
847
847
  try {
848
848
  await e();
849
849
  } catch (e) {
850
- throw e instanceof j && e.status === 503 && rt(m), e;
850
+ throw e instanceof j && ue.includes(e.status) && it(m), e;
851
851
  }
852
852
  }, n = (e, t) => C((n) => n.map((n) => n.serverMessageId === e ? {
853
853
  ...n,
@@ -869,15 +869,15 @@ var ge = ({ transport: e, model: t, instructions: n, assistantName: r = ue, tool
869
869
  };
870
870
  }, [
871
871
  m,
872
- _e,
873
- nt
872
+ V,
873
+ rt
874
874
  ])
875
875
  };
876
- }, U = (e) => e instanceof j ? e : new j({
876
+ }, be = (e) => e instanceof j ? e : new j({
877
877
  status: 0,
878
878
  kind: "network"
879
879
  });
880
- function _e(e) {
880
+ function V(e) {
881
881
  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([]);
882
882
  s(() => {
883
883
  h.current = e.client, g.current = r;
@@ -900,7 +900,7 @@ function _e(e) {
900
900
  }), _.current = r.nextCursor, m(r.nextCursor), u(null), c("idle");
901
901
  } catch (e) {
902
902
  if (n.signal.aborted) return;
903
- u(U(e)), c("error");
903
+ u(be(e)), c("error");
904
904
  }
905
905
  }, [t]);
906
906
  s(() => {
@@ -937,37 +937,37 @@ function _e(e) {
937
937
  };
938
938
  }
939
939
  // src/client/routes.ts
940
- function W(e) {
940
+ function H(e) {
941
941
  return e.replace(/\/+$/, "");
942
942
  }
943
- function ve(e, t) {
943
+ function xe(e, t) {
944
944
  let n = new URLSearchParams();
945
945
  for (let [e, r] of Object.entries(t)) r !== void 0 && n.set(e, String(r));
946
946
  let r = n.toString();
947
947
  return r ? `${e}?${r}` : e;
948
948
  }
949
- var ye = {
949
+ var U = {
950
950
  responses(e) {
951
- return `${W(e)}/responses`;
951
+ return `${H(e)}/responses`;
952
952
  },
953
953
  conversations(e, t) {
954
- return ve(`${W(e)}/conversations`, {
954
+ return xe(`${H(e)}/conversations`, {
955
955
  limit: t.limit,
956
956
  cursor: t.cursor
957
957
  });
958
958
  },
959
959
  conversation(e, t, n) {
960
- return ve(`${W(e)}/conversations/${encodeURIComponent(t)}`, {
960
+ return xe(`${H(e)}/conversations/${encodeURIComponent(t)}`, {
961
961
  limit: n.limit,
962
962
  before_absolute_index: n.beforeAbsoluteIndex
963
963
  });
964
964
  },
965
965
  feedback(e, t, n) {
966
- return `${W(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
966
+ return `${H(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
967
967
  }
968
968
  };
969
969
  // src/client/createBaileyClient.ts
970
- function G(e) {
970
+ function W(e) {
971
971
  return {
972
972
  status: void 0,
973
973
  text: "",
@@ -976,30 +976,30 @@ function G(e) {
976
976
  ...e ? { errorCause: e.cause } : {}
977
977
  };
978
978
  }
979
- var K = "The assistant took too long to respond. Please try again.";
980
- function q(e) {
979
+ var G = "The assistant took too long to respond. Please try again.";
980
+ function K(e) {
981
981
  return {
982
982
  status: e.status,
983
983
  text: "",
984
- errorMessage: K,
984
+ errorMessage: G,
985
985
  errorKind: "timeout",
986
986
  errorCause: e.cause,
987
987
  ...e.status === void 0 ? {} : { interrupted: !0 }
988
988
  };
989
989
  }
990
- var be = 3e4, xe = 155e3, Se = "x-chat-id", Ce = "header", J = "body", we = "x-request-id", Te = "x-conversation-id", Ee = "x-message-id", Y = (e) => e && typeof e == "object" ? e : {}, X = (e, t = "") => typeof e == "string" ? e : t, De = (e, t = 0) => typeof e == "number" ? e : t;
990
+ var Se = 3e4, Ce = 155e3, we = "x-chat-id", Te = "header", q = "body", Ee = "x-request-id", De = "x-conversation-id", J = "x-message-id", Y = (e) => e && typeof e == "object" ? e : {}, X = (e, t = "") => typeof e == "string" ? e : t, Oe = (e, t = 0) => typeof e == "number" ? e : t;
991
991
  function Z(e) {
992
992
  let t = Y(e);
993
993
  return {
994
994
  conversationId: X(t.conversation_id),
995
995
  title: typeof t.title == "string" ? t.title : null,
996
996
  status: X(t.status),
997
- messageCount: De(t.message_count),
997
+ messageCount: Oe(t.message_count),
998
998
  createdAt: X(t.created_at),
999
999
  updatedAt: X(t.updated_at)
1000
1000
  };
1001
1001
  }
1002
- function Oe(e) {
1002
+ function ke(e) {
1003
1003
  if (!e || typeof e != "object") return null;
1004
1004
  let t = Y(e);
1005
1005
  return {
@@ -1009,7 +1009,7 @@ function Oe(e) {
1009
1009
  ...typeof t.updated_at == "string" ? { updatedAt: t.updated_at } : {}
1010
1010
  };
1011
1011
  }
1012
- function ke(e) {
1012
+ function Ae(e) {
1013
1013
  let t = Y(e);
1014
1014
  return {
1015
1015
  messageId: X(t.message_id),
@@ -1017,10 +1017,10 @@ function ke(e) {
1017
1017
  content: X(t.content),
1018
1018
  hidden: t.hidden === !0,
1019
1019
  createdAt: X(t.created_at),
1020
- feedback: Oe(t.feedback)
1020
+ feedback: ke(t.feedback)
1021
1021
  };
1022
1022
  }
1023
- function Ae(e) {
1023
+ function je(e) {
1024
1024
  let t = new AbortController(), n = !1, r = setTimeout(() => {
1025
1025
  n = !0, t.abort();
1026
1026
  }, e.timeoutMs), i = () => t.abort(e.caller?.reason);
@@ -1042,9 +1042,9 @@ function Q(e) {
1042
1042
  kind: "aborted"
1043
1043
  });
1044
1044
  }
1045
- function je(e) {
1046
- let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? be, a = e.idleTimeoutMs ?? xe, o = e.conversationVia ?? Ce;
1047
- if (o !== Ce && o !== J) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
1045
+ function Me(e) {
1046
+ let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? Se, a = e.idleTimeoutMs ?? Ce, o = e.conversationVia ?? Te;
1047
+ if (o !== Te && o !== q) throw TypeError("createBaileyClient: conversationVia must be 'header' or 'body'");
1048
1048
  let s = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
1049
1049
  function c(t) {
1050
1050
  try {
@@ -1055,7 +1055,7 @@ function je(e) {
1055
1055
  e.kind === "http" && (e.status === 401 || e.status === 403) && r?.(e);
1056
1056
  }
1057
1057
  async function u(e) {
1058
- let t = Ae({
1058
+ let t = je({
1059
1059
  caller: e.signal,
1060
1060
  timeoutMs: i
1061
1061
  });
@@ -1128,10 +1128,10 @@ function je(e) {
1128
1128
  e.signal.aborted ? i() : e.signal.addEventListener("abort", i, { once: !0 });
1129
1129
  let u, d, f = () => {
1130
1130
  clearTimeout(u), u = setTimeout(() => {
1131
- d = new DOMException(K, "TimeoutError"), r.abort(d);
1131
+ d = new DOMException(G, "TimeoutError"), r.abort(d);
1132
1132
  }, a);
1133
1133
  }, p = (t) => {
1134
- if (d && !e.signal.aborted) return q({
1134
+ if (d && !e.signal.aborted) return K({
1135
1135
  cause: d,
1136
1136
  status: t
1137
1137
  });
@@ -1146,10 +1146,10 @@ function je(e) {
1146
1146
  ...await n()
1147
1147
  };
1148
1148
  } catch {
1149
- return G();
1149
+ return W();
1150
1150
  }
1151
1151
  if (r.signal.aborted) return p();
1152
- i["Content-Type"] = "application/json", e.conversationId && o === Ce && (i[Se] = e.conversationId);
1152
+ i["Content-Type"] = "application/json", e.conversationId && o === Te && (i[we] = e.conversationId);
1153
1153
  let a = e.input[e.input.length - 1], u = {
1154
1154
  ...a?.hidden === !0 ? { hidden: !0 } : {},
1155
1155
  ...a?.titleHint ? { title_hint: a.titleHint } : {}
@@ -1163,21 +1163,21 @@ function je(e) {
1163
1163
  stream: !0,
1164
1164
  ...Object.keys(u).length > 0 ? { metadata: u } : {}
1165
1165
  };
1166
- e.conversationId && o === J && (d.conversation = e.conversationId), e.tools.length > 0 && (d.tools = e.tools), e.toolChoice && (d.tool_choice = e.toolChoice);
1166
+ e.conversationId && o === q && (d.conversation = e.conversationId), e.tools.length > 0 && (d.tools = e.tools), e.toolChoice && (d.tool_choice = e.toolChoice);
1167
1167
  let m;
1168
1168
  try {
1169
- m = await s(ye.responses(t), {
1169
+ m = await s(U.responses(t), {
1170
1170
  method: "POST",
1171
1171
  headers: i,
1172
1172
  body: JSON.stringify(d),
1173
1173
  signal: r.signal
1174
1174
  });
1175
1175
  } catch (e) {
1176
- return r.signal.aborted ? p() : G({ cause: e });
1176
+ return r.signal.aborted ? p() : W({ cause: e });
1177
1177
  }
1178
- let h = m.headers.get(we);
1178
+ let h = m.headers.get(Ee);
1179
1179
  h && e.onRequestId?.(h);
1180
- let g = m.headers.get(Ee);
1180
+ let g = m.headers.get(J);
1181
1181
  if (g && e.onMessageId?.(g), !m.ok) {
1182
1182
  l(new j({
1183
1183
  status: m.status,
@@ -1189,7 +1189,7 @@ function je(e) {
1189
1189
  text: e
1190
1190
  };
1191
1191
  }
1192
- let _ = m.headers.get(Te);
1192
+ let _ = m.headers.get(De);
1193
1193
  if (_ && e.onConversationId?.(_), !m.body) return {
1194
1194
  status: m.status,
1195
1195
  text: ""
@@ -1228,7 +1228,7 @@ function je(e) {
1228
1228
  async listConversations(e = {}) {
1229
1229
  let n = Y(await u({
1230
1230
  method: "GET",
1231
- url: ye.conversations(t, e),
1231
+ url: U.conversations(t, e),
1232
1232
  signal: e.signal,
1233
1233
  requireJsonBody: !0
1234
1234
  }));
@@ -1240,7 +1240,7 @@ function je(e) {
1240
1240
  async getConversation(e) {
1241
1241
  let n = Y(await u({
1242
1242
  method: "GET",
1243
- url: ye.conversation(t, e.conversationId, e),
1243
+ url: U.conversation(t, e.conversationId, e),
1244
1244
  signal: e.signal,
1245
1245
  requireJsonBody: !0
1246
1246
  }));
@@ -1250,7 +1250,7 @@ function je(e) {
1250
1250
  });
1251
1251
  return {
1252
1252
  conversation: Z(n.conversation),
1253
- messages: Array.isArray(n.messages) ? n.messages.map(ke) : [],
1253
+ messages: Array.isArray(n.messages) ? n.messages.map(Ae) : [],
1254
1254
  hasMoreBefore: n.has_more_before === !0,
1255
1255
  nextBeforeAbsoluteIndex: typeof n.next_before_absolute_index == "number" ? n.next_before_absolute_index : null
1256
1256
  };
@@ -1258,14 +1258,14 @@ function je(e) {
1258
1258
  async deleteConversation(e) {
1259
1259
  await u({
1260
1260
  method: "DELETE",
1261
- url: ye.conversation(t, e.conversationId, {}),
1261
+ url: U.conversation(t, e.conversationId, {}),
1262
1262
  signal: e.signal
1263
1263
  });
1264
1264
  },
1265
1265
  async submitFeedback(e) {
1266
1266
  await u({
1267
1267
  method: "PUT",
1268
- url: ye.feedback(t, e.conversationId, e.messageId),
1268
+ url: U.feedback(t, e.conversationId, e.messageId),
1269
1269
  body: {
1270
1270
  rating: e.rating,
1271
1271
  ...e.reasonCodes ? { reason_codes: e.reasonCodes } : {},
@@ -1277,7 +1277,7 @@ function je(e) {
1277
1277
  async clearFeedback(e) {
1278
1278
  await u({
1279
1279
  method: "DELETE",
1280
- url: ye.feedback(t, e.conversationId, e.messageId),
1280
+ url: U.feedback(t, e.conversationId, e.messageId),
1281
1281
  signal: e.signal
1282
1282
  });
1283
1283
  }
@@ -1288,10 +1288,10 @@ function $(...e) {
1288
1288
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
1289
1289
  }
1290
1290
  // src/utils/toolCalls.ts
1291
- var Me = "call_tool", Ne = "a tool";
1292
- function Pe(e, t) {
1291
+ var Ne = "call_tool", Pe = "a tool";
1292
+ function Fe(e, t) {
1293
1293
  let n = {
1294
- name: e === Me ? Ne : e,
1294
+ name: e === Ne ? Pe : e,
1295
1295
  args: null,
1296
1296
  viaCallTool: !1
1297
1297
  };
@@ -1304,7 +1304,7 @@ function Pe(e, t) {
1304
1304
  }
1305
1305
  if (typeof r != "object" || !r) return n;
1306
1306
  let i = r;
1307
- if (e === Me) {
1307
+ if (e === Ne) {
1308
1308
  let e = typeof i.name == "string" ? i.name : void 0;
1309
1309
  if (!e) return n;
1310
1310
  let t = i.arguments;
@@ -1321,32 +1321,32 @@ function Pe(e, t) {
1321
1321
  };
1322
1322
  }
1323
1323
  // src/utils/table.ts
1324
- var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Ie).join(""), Le = (e) => {
1324
+ var Ie = 5, Le = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Le).join(""), Re = (e) => {
1325
1325
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
1326
1326
  for (let t of e.children ?? []) {
1327
- let e = Le(t);
1327
+ let e = Re(t);
1328
1328
  if (e) return e;
1329
1329
  }
1330
- }, Re = (e, t) => (e.children ?? []).find((e) => e.tagName === t), ze = (e) => {
1331
- let t = Ie(e), n = Le(e);
1330
+ }, ze = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Be = (e) => {
1331
+ let t = Le(e), n = Re(e);
1332
1332
  return n ? {
1333
1333
  text: t,
1334
1334
  href: n
1335
1335
  } : { text: t };
1336
- }, Be = (e) => (e.children ?? []).filter((e) => e.type === "element").map(ze), Ve = (e) => {
1336
+ }, Ve = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Be), He = (e) => {
1337
1337
  if (e.tagName !== "table") return null;
1338
- let t = Re(e, "thead"), n = t && Re(t, "tr");
1338
+ let t = ze(e, "thead"), n = t && ze(t, "tr");
1339
1339
  return {
1340
- headers: n ? Be(n).map((e) => e.text) : [],
1341
- rows: (Re(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Be)
1340
+ headers: n ? Ve(n).map((e) => e.text) : [],
1341
+ rows: (ze(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Ve)
1342
1342
  };
1343
- }, He = (e) => e.length > 5, Ue = "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```", We = [
1343
+ }, Ue = (e) => e.length > 5, We = "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```", Ge = [
1344
1344
  "bar",
1345
1345
  "line",
1346
1346
  "pie",
1347
1347
  "doughnut",
1348
1348
  "scatter"
1349
- ], Ge = 8, Ke = 50, qe = 8, Je = 500, Ye = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Xe = (e) => {
1349
+ ], Ke = 8, qe = 50, Je = 8, Ye = 500, Xe = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Ze = (e) => {
1350
1350
  let t;
1351
1351
  try {
1352
1352
  t = JSON.parse(e);
@@ -1355,17 +1355,17 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1355
1355
  }
1356
1356
  if (typeof t != "object" || !t) return null;
1357
1357
  let n = t;
1358
- if (typeof n.type != "string" || !We.includes(n.type)) return null;
1358
+ if (typeof n.type != "string" || !Ge.includes(n.type)) return null;
1359
1359
  let r = n.type;
1360
1360
  if (n.title !== void 0 && typeof n.title != "string") return null;
1361
1361
  let i = n.title;
1362
1362
  if (typeof n.data != "object" || n.data === null) return null;
1363
1363
  let a = n.data;
1364
- if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ge || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
1364
+ if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ke || (r === "pie" || r === "doughnut") && a.datasets.length !== 1) return null;
1365
1365
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
1366
1366
  let o = a.datasets;
1367
1367
  if (r === "scatter") {
1368
- for (let e of o) if (e.data.length < 1 || e.data.length > Je || !e.data.every(Ye)) return null;
1368
+ for (let e of o) if (e.data.length < 1 || e.data.length > Ye || !e.data.every(Xe)) return null;
1369
1369
  return {
1370
1370
  type: r,
1371
1371
  title: i,
@@ -1373,7 +1373,7 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1373
1373
  };
1374
1374
  }
1375
1375
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
1376
- let s = a.labels, c = r === "pie" || r === "doughnut" ? qe : Ke;
1376
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? Je : qe;
1377
1377
  if (s.length < 1 || s.length > c) return null;
1378
1378
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
1379
1379
  return {
@@ -1384,7 +1384,7 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1384
1384
  datasets: o
1385
1385
  }
1386
1386
  };
1387
- }, Ze = {
1387
+ }, Qe = {
1388
1388
  tool_start: "Tool start",
1389
1389
  tool_end: "Tool end",
1390
1390
  pseudo_tool_call: "Narrated tool call",
@@ -1395,13 +1395,13 @@ var Fe = 5, Ie = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1395
1395
  error: "Error",
1396
1396
  raw: "Raw event"
1397
1397
  };
1398
- function Qe(e) {
1399
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : Pe(e.name, e.args);
1398
+ function $e(e) {
1399
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : Fe(e.name, e.args);
1400
1400
  }
1401
- function $e(e, t = Qe(e)) {
1401
+ function et(e, t = $e(e)) {
1402
1402
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
1403
1403
  }
1404
- function et(e, t = Qe(e)) {
1404
+ function tt(e, t = $e(e)) {
1405
1405
  switch (e.kind) {
1406
1406
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
1407
1407
  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" : ""}`;
@@ -1414,23 +1414,23 @@ function et(e, t = Qe(e)) {
1414
1414
  case "raw": return `Unrecognized event: ${e.eventType}`;
1415
1415
  }
1416
1416
  }
1417
- function tt(e, t = Qe(e)) {
1417
+ function nt(e, t = $e(e)) {
1418
1418
  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;
1419
1419
  }
1420
- function nt(e) {
1420
+ function rt(e) {
1421
1421
  return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
1422
1422
  }
1423
- function rt(e) {
1423
+ function it(e) {
1424
1424
  return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
1425
1425
  }
1426
- function it(e) {
1426
+ function at(e) {
1427
1427
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
1428
1428
  }
1429
- function at(e) {
1429
+ function ot(e) {
1430
1430
  switch (e.kind) {
1431
- case "tool_start": return `Calling ${Pe(e.name, e.args).name}...`;
1431
+ case "tool_start": return `Calling ${Fe(e.name, e.args).name}...`;
1432
1432
  case "tool_end": {
1433
- let t = Pe(e.name, e.args).name;
1433
+ let t = Fe(e.name, e.args).name;
1434
1434
  return e.isError ? `${t} failed` : `${t} returned`;
1435
1435
  }
1436
1436
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -1442,11 +1442,11 @@ function at(e) {
1442
1442
  case "raw": return `Unrecognized event: ${e.eventType}`;
1443
1443
  }
1444
1444
  }
1445
- function ot(e) {
1445
+ function st(e) {
1446
1446
  let t = new Date(e);
1447
1447
  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")}`;
1448
1448
  }
1449
- function st(e) {
1449
+ function ct(e) {
1450
1450
  if (e <= 0) return "+0ms";
1451
1451
  if (e < 1e3) return `+${Math.round(e)}ms`;
1452
1452
  let t = e / 1e3;
@@ -1454,31 +1454,31 @@ function st(e) {
1454
1454
  let n = Math.floor(t / 60), r = Math.round(t % 60);
1455
1455
  return `+${n}m${String(r).padStart(2, "0")}s`;
1456
1456
  }
1457
- function ct(e) {
1457
+ function lt(e) {
1458
1458
  return e.map((t, n) => {
1459
- let r = Qe(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1459
+ let r = $e(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1460
1460
  return {
1461
1461
  key: `${t.at}-${n}`,
1462
1462
  kind: t.kind,
1463
- toolName: $e(t, r),
1463
+ toolName: et(t, r),
1464
1464
  isToolStart: t.kind === "tool_start",
1465
1465
  failed: t.kind === "tool_end" && t.isError === !0,
1466
- time: ot(t.at),
1466
+ time: st(t.at),
1467
1467
  gapMs: t.at - i,
1468
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Ze[t.kind],
1469
- summary: et(t, r),
1470
- argsDetail: tt(t, r),
1471
- outputDetail: nt(t),
1472
- structuredOutputDetail: rt(t),
1473
- rawDetail: it(t)
1468
+ label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Qe[t.kind],
1469
+ summary: tt(t, r),
1470
+ argsDetail: nt(t, r),
1471
+ outputDetail: rt(t),
1472
+ structuredOutputDetail: it(t),
1473
+ rawDetail: at(t)
1474
1474
  };
1475
1475
  });
1476
1476
  }
1477
- function lt(e) {
1477
+ function ut(e) {
1478
1478
  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 = [];
1479
1479
  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(" · ");
1480
1480
  }
1481
- function ut(e) {
1481
+ function dt(e) {
1482
1482
  let t = [];
1483
1483
  for (let n of e) {
1484
1484
  let e = t[t.length - 1];
@@ -1493,22 +1493,22 @@ function ut(e) {
1493
1493
  }
1494
1494
  return t;
1495
1495
  }
1496
- function dt(e) {
1496
+ function ft(e) {
1497
1497
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
1498
1498
  }
1499
- function ft(e, t) {
1499
+ function pt(e, t) {
1500
1500
  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) => ({
1501
1501
  key: `${e.at}-${t}`,
1502
- text: at(e),
1503
- toolName: $e(e)
1502
+ text: ot(e),
1503
+ toolName: et(e)
1504
1504
  }));
1505
1505
  }
1506
- function pt(e, t) {
1506
+ function mt(e, t) {
1507
1507
  if (t === void 0) return [];
1508
1508
  let n = [];
1509
1509
  for (let r of e) if (r.turnSentAt === t) {
1510
1510
  if (r.kind === "tool_start") {
1511
- let e = Pe(r.name, r.args).name;
1511
+ let e = Fe(r.name, r.args).name;
1512
1512
  n.push({
1513
1513
  key: `step-${n.length}`,
1514
1514
  callId: r.callId,
@@ -1518,7 +1518,7 @@ function pt(e, t) {
1518
1518
  startOffsetMs: r.at - t
1519
1519
  });
1520
1520
  } else if (r.kind === "tool_end") {
1521
- let e = Pe(r.name, r.args).name, i = r.isError ? "failed" : "done", a = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
1521
+ let e = Fe(r.name, r.args).name, i = r.isError ? "failed" : "done", a = n.find((t) => t.status === "running" && t.callId === r.callId && t.toolName === e);
1522
1522
  a ? (a.status = i, a.runtimeSeconds = r.runtimeSeconds, a.label = r.displayName || a.label) : n.push({
1523
1523
  key: `step-${n.length}`,
1524
1524
  callId: r.callId,
@@ -1533,51 +1533,51 @@ function pt(e, t) {
1533
1533
  return n;
1534
1534
  }
1535
1535
  // src/styles.css?inline
1536
- var mt = "/*! 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-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--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{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);font-style:italic;display:flex}.bailey-streaming-hint{margin-top: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);font-style:italic;display:flex}.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-chat-transcript[data-suggestions-align=end]{flex-direction:column;display:flex}.bailey-suggestions[data-align=end]{align-items:flex-end;margin-top:auto}.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);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));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-card{border:var(--bailey-suggestion-border,none);border-radius:var(--bailey-suggestion-radius,1rem);font-weight:var(--bailey-suggestion-font-weight,normal)}.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-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.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);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-width:1px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input-row{border-radius:var(--bailey-input-radius,9999px);border-color:var(--bailey-input-border-color,var(--color-bailey-border))}.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(--bailey-send-fg,var(--color-bailey-heart));background-color:var(--bailey-send-bg,transparent);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,#16a34a1a)}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,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(--bailey-stop-fg,var(--color-bailey-error));background-color:var(--bailey-stop-bg,transparent);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,#d32f2f1a)}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,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-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@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)}}", ht = r(void 0), gt = /:root\s*,\s*:host\s*\{([^}]*)\}/, _t = ".bailey-chat-panel,.bailey-menu-content,.bailey-tooltip-content", vt = /^\s*--color-bailey-([\w-]+)\s*:\s*(.+?)\s*$/, yt = /^(\s*--font-sans\s*:\s*)(.+?)\s*$/, bt = /var\(--color-bailey-([\w-]+)\)/g;
1537
- function xt(e) {
1538
- let t = e.match(new RegExp(gt, "g"))?.length ?? 0;
1536
+ var ht = "/*! 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-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--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{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);font-style:italic;display:flex}.bailey-streaming-hint{margin-top: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);font-style:italic;display:flex}.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-chat-transcript[data-suggestions-align=end]{flex-direction:column;display:flex}.bailey-suggestions[data-align=end]{align-items:flex-end;margin-top:auto}.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);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));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-card{border:var(--bailey-suggestion-border,none);border-radius:var(--bailey-suggestion-radius,1rem);font-weight:var(--bailey-suggestion-font-weight,normal)}.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-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.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);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-width:1px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input-row{border-radius:var(--bailey-input-radius,9999px);border-color:var(--bailey-input-border-color,var(--color-bailey-border))}.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(--bailey-send-fg,var(--color-bailey-heart));background-color:var(--bailey-send-bg,transparent);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,#16a34a1a)}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:var(--bailey-send-bg-hover,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(--bailey-stop-fg,var(--color-bailey-error));background-color:var(--bailey-stop-bg,transparent);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,#d32f2f1a)}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:var(--bailey-stop-bg-hover,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-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@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)}}", gt = r(void 0), _t = /:root\s*,\s*:host\s*\{([^}]*)\}/, vt = ".bailey-chat-panel,.bailey-menu-content,.bailey-tooltip-content", yt = /^\s*--color-bailey-([\w-]+)\s*:\s*(.+?)\s*$/, bt = /^(\s*--font-sans\s*:\s*)(.+?)\s*$/, xt = /var\(--color-bailey-([\w-]+)\)/g;
1537
+ function St(e) {
1538
+ let t = e.match(new RegExp(_t, "g"))?.length ?? 0;
1539
1539
  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.`);
1540
1540
  let n = /* @__PURE__ */ new Map();
1541
- return e.replace(gt, (e, t) => `${_t}{${t.split(";").filter((e) => {
1541
+ return e.replace(_t, (e, t) => `${vt}{${t.split(";").filter((e) => {
1542
1542
  if (!e.trim()) return !1;
1543
- let t = e.match(vt);
1543
+ let t = e.match(yt);
1544
1544
  return t && n.set(t[1], t[2]), !t;
1545
- }).map((e) => e.replace(yt, "$1var(--bailey-font-sans,$2)")).join(";")}}`).replace(bt, (e, t) => n.has(t) ? `var(--color-bailey-${t},${n.get(t)})` : e);
1545
+ }).map((e) => e.replace(bt, "$1var(--bailey-font-sans,$2)")).join(";")}}`).replace(xt, (e, t) => n.has(t) ? `var(--color-bailey-${t},${n.get(t)})` : e);
1546
1546
  }
1547
- var St = xt(mt), Ct = "data-source", wt = "baileyai-chat-ui", Tt = /* @__PURE__ */ new WeakMap();
1548
- function Et(e) {
1547
+ var Ct = St(ht), wt = "data-source", Tt = "baileyai-chat-ui", Et = /* @__PURE__ */ new WeakMap();
1548
+ function Dt(e) {
1549
1549
  let t = e.getRootNode();
1550
1550
  return t instanceof ShadowRoot ? t : document;
1551
1551
  }
1552
- function Dt(e) {
1553
- let t = e instanceof ShadowRoot ? e : document.head, n = Tt.get(e) ?? 0;
1554
- if (n === 0 && !t.querySelector(`style[${Ct}="${wt}"]`)) {
1552
+ function Ot(e) {
1553
+ let t = e instanceof ShadowRoot ? e : document.head, n = Et.get(e) ?? 0;
1554
+ if (n === 0 && !t.querySelector(`style[${wt}="${Tt}"]`)) {
1555
1555
  let e = document.createElement("style");
1556
- e.setAttribute(Ct, wt), e.textContent = St, t.appendChild(e);
1556
+ e.setAttribute(wt, Tt), e.textContent = Ct, t.appendChild(e);
1557
1557
  }
1558
- return Tt.set(e, n + 1), () => {
1559
- let n = (Tt.get(e) ?? 1) - 1;
1560
- n <= 0 ? (Tt.delete(e), t.querySelector(`style[${Ct}="${wt}"]`)?.remove()) : Tt.set(e, n);
1558
+ return Et.set(e, n + 1), () => {
1559
+ let n = (Et.get(e) ?? 1) - 1;
1560
+ n <= 0 ? (Et.delete(e), t.querySelector(`style[${wt}="${Tt}"]`)?.remove()) : Et.set(e, n);
1561
1561
  };
1562
1562
  }
1563
- function Ot(e, t = !1) {
1563
+ function kt(e, t = !1) {
1564
1564
  let [n, r] = f(null);
1565
1565
  return l(() => {
1566
1566
  if (t) return;
1567
1567
  let n = e.current;
1568
1568
  if (!n) return;
1569
- let i = Et(n);
1570
- return r(i), Dt(i);
1569
+ let i = Dt(n);
1570
+ return r(i), Ot(i);
1571
1571
  }, [t, e]), n;
1572
1572
  }
1573
- function kt(e) {
1574
- let t = o(ht), n = t !== void 0, r = Ot(e, n);
1573
+ function At(e) {
1574
+ let t = o(gt), n = t !== void 0, r = kt(e, n);
1575
1575
  return n ? t : r;
1576
1576
  }
1577
1577
  // src/context/BaileyFeedbackSlotContext.ts
1578
- var At = r(void 0);
1578
+ var jt = r(void 0);
1579
1579
  // src/ui/markdown.tsx
1580
- function jt({ renderTable: t, renderChart: n } = {}) {
1580
+ function Mt({ renderTable: t, renderChart: n } = {}) {
1581
1581
  return {
1582
1582
  a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ v(_, { children: n }) : /* @__PURE__ */ v("a", {
1583
1583
  href: t,
@@ -1586,8 +1586,8 @@ function jt({ renderTable: t, renderChart: n } = {}) {
1586
1586
  children: n
1587
1587
  }),
1588
1588
  table: ({ node: n, children: r }) => {
1589
- let i = n && Ve(n);
1590
- if (i && He(i.rows) && t) {
1589
+ let i = n && He(n);
1590
+ if (i && Ue(i.rows) && t) {
1591
1591
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
1592
1592
  return /* @__PURE__ */ v(_, { children: t({
1593
1593
  headers: i.headers,
@@ -1599,7 +1599,7 @@ function jt({ renderTable: t, renderChart: n } = {}) {
1599
1599
  pre: ({ children: e }) => {
1600
1600
  let t = (Array.isArray(e) ? e[0] : e)?.props;
1601
1601
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
1602
- let e = t?.children, r = Xe(Array.isArray(e) ? e.join("") : String(e ?? ""));
1602
+ let e = t?.children, r = Ze(Array.isArray(e) ? e.join("") : String(e ?? ""));
1603
1603
  if (r) return /* @__PURE__ */ v(_, { children: n(r) });
1604
1604
  }
1605
1605
  return /* @__PURE__ */ v("pre", { children: e });
@@ -1607,7 +1607,7 @@ function jt({ renderTable: t, renderChart: n } = {}) {
1607
1607
  };
1608
1608
  }
1609
1609
  // src/ui/icons.tsx
1610
- function Mt({ className: e }) {
1610
+ function Nt({ className: e }) {
1611
1611
  return /* @__PURE__ */ v("svg", {
1612
1612
  viewBox: "0 0 24 24",
1613
1613
  fill: "currentColor",
@@ -1616,7 +1616,7 @@ function Mt({ className: e }) {
1616
1616
  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" })
1617
1617
  });
1618
1618
  }
1619
- function Nt({ className: e }) {
1619
+ function Pt({ className: e }) {
1620
1620
  return /* @__PURE__ */ v("svg", {
1621
1621
  viewBox: "0 0 24 24",
1622
1622
  fill: "currentColor",
@@ -1631,7 +1631,7 @@ function Nt({ className: e }) {
1631
1631
  })
1632
1632
  });
1633
1633
  }
1634
- function Pt({ className: e }) {
1634
+ function Ft({ className: e }) {
1635
1635
  return /* @__PURE__ */ y("svg", {
1636
1636
  viewBox: "0 0 24 24",
1637
1637
  fill: "none",
@@ -1644,7 +1644,7 @@ function Pt({ className: e }) {
1644
1644
  children: [/* @__PURE__ */ v("path", { d: "M7 17 17 7" }), /* @__PURE__ */ v("path", { d: "M9 7h8v8" })]
1645
1645
  });
1646
1646
  }
1647
- function Ft({ className: e }) {
1647
+ function It({ className: e }) {
1648
1648
  return /* @__PURE__ */ y("svg", {
1649
1649
  viewBox: "0 0 24 24",
1650
1650
  fill: "none",
@@ -1663,7 +1663,7 @@ function Ft({ className: e }) {
1663
1663
  }), /* @__PURE__ */ v("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
1664
1664
  });
1665
1665
  }
1666
- function It({ className: e }) {
1666
+ function Lt({ className: e }) {
1667
1667
  return /* @__PURE__ */ v("svg", {
1668
1668
  viewBox: "0 0 24 24",
1669
1669
  fill: "none",
@@ -1676,7 +1676,7 @@ function It({ className: e }) {
1676
1676
  children: /* @__PURE__ */ v("path", { d: "M5 12.5 9.5 17 19 7" })
1677
1677
  });
1678
1678
  }
1679
- function Lt({ className: e }) {
1679
+ function Rt({ className: e }) {
1680
1680
  return /* @__PURE__ */ v("svg", {
1681
1681
  viewBox: "0 0 24 24",
1682
1682
  fill: "none",
@@ -1689,7 +1689,7 @@ function Lt({ className: e }) {
1689
1689
  children: /* @__PURE__ */ v("path", { d: "m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2" })
1690
1690
  });
1691
1691
  }
1692
- function Rt({ className: e }) {
1692
+ function zt({ className: e }) {
1693
1693
  return /* @__PURE__ */ y("svg", {
1694
1694
  viewBox: "0 0 24 24",
1695
1695
  fill: "none",
@@ -1706,7 +1706,7 @@ function Rt({ className: e }) {
1706
1706
  }), /* @__PURE__ */ v("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
1707
1707
  });
1708
1708
  }
1709
- function zt({ className: e }) {
1709
+ function Bt({ className: e }) {
1710
1710
  return /* @__PURE__ */ y("svg", {
1711
1711
  viewBox: "0 0 24 24",
1712
1712
  fill: "currentColor",
@@ -1731,7 +1731,7 @@ function zt({ className: e }) {
1731
1731
  ]
1732
1732
  });
1733
1733
  }
1734
- function Bt({ className: e }) {
1734
+ function Vt({ className: e }) {
1735
1735
  return /* @__PURE__ */ v("svg", {
1736
1736
  viewBox: "0 0 24 24",
1737
1737
  fill: "none",
@@ -1744,8 +1744,8 @@ function Bt({ className: e }) {
1744
1744
  children: /* @__PURE__ */ v("path", { d: "M12 5v14M5 12h14" })
1745
1745
  });
1746
1746
  }
1747
- var Vt = "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", Ht = "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";
1748
- function Ut({ className: e, filled: t = !1 }) {
1747
+ var Ht = "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", Ut = "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";
1748
+ function Wt({ className: e, filled: t = !1 }) {
1749
1749
  return /* @__PURE__ */ v("svg", {
1750
1750
  viewBox: "0 0 24 24",
1751
1751
  fill: t ? "currentColor" : "none",
@@ -1754,10 +1754,10 @@ function Ut({ className: e, filled: t = !1 }) {
1754
1754
  strokeLinejoin: "round",
1755
1755
  className: e,
1756
1756
  "aria-hidden": "true",
1757
- children: /* @__PURE__ */ v("path", { d: Vt })
1757
+ children: /* @__PURE__ */ v("path", { d: Ht })
1758
1758
  });
1759
1759
  }
1760
- function Wt({ className: e, filled: t = !1 }) {
1760
+ function Gt({ className: e, filled: t = !1 }) {
1761
1761
  return /* @__PURE__ */ v("svg", {
1762
1762
  viewBox: "0 0 24 24",
1763
1763
  fill: t ? "currentColor" : "none",
@@ -1766,10 +1766,10 @@ function Wt({ className: e, filled: t = !1 }) {
1766
1766
  strokeLinejoin: "round",
1767
1767
  className: e,
1768
1768
  "aria-hidden": "true",
1769
- children: /* @__PURE__ */ v("path", { d: Ht })
1769
+ children: /* @__PURE__ */ v("path", { d: Ut })
1770
1770
  });
1771
1771
  }
1772
- function Gt({ className: e }) {
1772
+ function Kt({ className: e }) {
1773
1773
  return /* @__PURE__ */ v("svg", {
1774
1774
  viewBox: "0 0 24 24",
1775
1775
  fill: "none",
@@ -1782,7 +1782,7 @@ function Gt({ className: e }) {
1782
1782
  children: /* @__PURE__ */ v("path", { d: "M15 6l-6 6 6 6" })
1783
1783
  });
1784
1784
  }
1785
- function Kt({ className: e }) {
1785
+ function qt({ className: e }) {
1786
1786
  return /* @__PURE__ */ v("svg", {
1787
1787
  viewBox: "0 0 24 24",
1788
1788
  fill: "none",
@@ -1795,7 +1795,7 @@ function Kt({ className: e }) {
1795
1795
  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" })
1796
1796
  });
1797
1797
  }
1798
- function qt({ className: e }) {
1798
+ function Jt({ className: e }) {
1799
1799
  return /* @__PURE__ */ y("svg", {
1800
1800
  viewBox: "0 0 24 24",
1801
1801
  fill: "none",
@@ -1813,9 +1813,9 @@ function qt({ className: e }) {
1813
1813
  });
1814
1814
  }
1815
1815
  // src/ui/CopyMarkdownButton.tsx
1816
- var Jt = 1500;
1817
- function Yt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
1818
- let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = kt(p);
1816
+ var Yt = 1500;
1817
+ function Xt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
1818
+ let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = At(p);
1819
1819
  return s(() => () => {
1820
1820
  u.current !== null && clearTimeout(u.current);
1821
1821
  }, []), /* @__PURE__ */ v(g.Provider, {
@@ -1834,11 +1834,11 @@ function Yt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1834
1834
  } catch {
1835
1835
  return;
1836
1836
  }
1837
- o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Jt);
1837
+ o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Yt);
1838
1838
  },
1839
1839
  "aria-label": n,
1840
1840
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
1841
- children: v(a ? It : Ft, { className: "bailey-copy-icon" })
1841
+ children: v(a ? Lt : It, { className: "bailey-copy-icon" })
1842
1842
  })
1843
1843
  }), /* @__PURE__ */ v(g.Portal, {
1844
1844
  container: m instanceof ShadowRoot ? m : void 0,
@@ -1852,20 +1852,20 @@ function Yt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1852
1852
  });
1853
1853
  }
1854
1854
  // src/ui/BaileyTracePanel.tsx
1855
- async function Xt(e) {
1855
+ async function Zt(e) {
1856
1856
  try {
1857
1857
  await navigator.clipboard.writeText(e);
1858
1858
  } catch {}
1859
1859
  }
1860
- function Zt({ text: e, label: t = "Copy" }) {
1860
+ function Qt({ text: e, label: t = "Copy" }) {
1861
1861
  return /* @__PURE__ */ v("button", {
1862
1862
  type: "button",
1863
- onClick: () => Xt(e),
1863
+ onClick: () => Zt(e),
1864
1864
  className: "bailey-trace-copy-button",
1865
1865
  children: t
1866
1866
  });
1867
1867
  }
1868
- function Qt(e) {
1868
+ function $t(e) {
1869
1869
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
1870
1870
  switch (e.kind) {
1871
1871
  case "tool_start":
@@ -1876,7 +1876,7 @@ function Qt(e) {
1876
1876
  default: return "bailey-trace-chip bailey-trace-chip-default";
1877
1877
  }
1878
1878
  }
1879
- function $t({ label: e, content: t, copyable: n }) {
1879
+ function en({ label: e, content: t, copyable: n }) {
1880
1880
  return /* @__PURE__ */ y("details", {
1881
1881
  className: "bailey-trace-disclosure",
1882
1882
  children: [
@@ -1886,7 +1886,7 @@ function $t({ label: e, content: t, copyable: n }) {
1886
1886
  }),
1887
1887
  n && /* @__PURE__ */ v("div", {
1888
1888
  className: "bailey-trace-disclosure-actions",
1889
- children: /* @__PURE__ */ v(Zt, { text: t })
1889
+ children: /* @__PURE__ */ v(Qt, { text: t })
1890
1890
  }),
1891
1891
  /* @__PURE__ */ v("pre", {
1892
1892
  className: "bailey-trace-disclosure-content",
@@ -1895,7 +1895,7 @@ function $t({ label: e, content: t, copyable: n }) {
1895
1895
  ]
1896
1896
  });
1897
1897
  }
1898
- function en({ row: e }) {
1898
+ function tn({ row: e }) {
1899
1899
  return /* @__PURE__ */ y("div", {
1900
1900
  className: "bailey-trace-row",
1901
1901
  children: [
@@ -1909,10 +1909,10 @@ function en({ row: e }) {
1909
1909
  /* @__PURE__ */ v("span", {
1910
1910
  className: "bailey-trace-row-gap",
1911
1911
  title: "Time since the previous event",
1912
- children: st(e.gapMs)
1912
+ children: ct(e.gapMs)
1913
1913
  }),
1914
1914
  /* @__PURE__ */ v("span", {
1915
- className: Qt(e),
1915
+ className: $t(e),
1916
1916
  children: e.label
1917
1917
  }),
1918
1918
  /* @__PURE__ */ v("span", {
@@ -1921,32 +1921,32 @@ function en({ row: e }) {
1921
1921
  })
1922
1922
  ]
1923
1923
  }),
1924
- e.argsDetail && /* @__PURE__ */ v($t, {
1924
+ e.argsDetail && /* @__PURE__ */ v(en, {
1925
1925
  label: e.kind === "llm_call_start" ? "request" : "args",
1926
1926
  content: e.argsDetail
1927
1927
  }),
1928
- e.outputDetail && /* @__PURE__ */ v($t, {
1928
+ e.outputDetail && /* @__PURE__ */ v(en, {
1929
1929
  label: e.kind === "llm_call_end" ? "response" : "output",
1930
1930
  content: e.outputDetail
1931
1931
  }),
1932
- e.structuredOutputDetail && /* @__PURE__ */ v($t, {
1932
+ e.structuredOutputDetail && /* @__PURE__ */ v(en, {
1933
1933
  label: "structured output",
1934
1934
  content: e.structuredOutputDetail
1935
1935
  }),
1936
- e.rawDetail && /* @__PURE__ */ v($t, {
1936
+ e.rawDetail && /* @__PURE__ */ v(en, {
1937
1937
  label: "raw",
1938
1938
  content: e.rawDetail
1939
1939
  })
1940
1940
  ]
1941
1941
  });
1942
1942
  }
1943
- function tn(e, t) {
1943
+ function nn(e, t) {
1944
1944
  if (e.chunkCount === 0) return "Streamed: no chunks received";
1945
1945
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
1946
1946
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
1947
1947
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
1948
1948
  }
1949
- function nn({ request: e }) {
1949
+ function rn({ request: e }) {
1950
1950
  let t = u(() => JSON.stringify({
1951
1951
  model: e.model,
1952
1952
  instructions: e.systemPrompt,
@@ -1970,24 +1970,24 @@ function nn({ request: e }) {
1970
1970
  }),
1971
1971
  /* @__PURE__ */ v("span", {
1972
1972
  className: "bailey-trace-request-meta",
1973
- children: tn(e.streamStats, e.sentAt)
1973
+ children: nn(e.streamStats, e.sentAt)
1974
1974
  }),
1975
- /* @__PURE__ */ v($t, {
1975
+ /* @__PURE__ */ v(en, {
1976
1976
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
1977
1977
  content: e.systemPrompt,
1978
1978
  copyable: !0
1979
1979
  }),
1980
- /* @__PURE__ */ v($t, {
1980
+ /* @__PURE__ */ v(en, {
1981
1981
  label: `Messages (${e.messages.length})`,
1982
1982
  content: JSON.stringify(e.messages, null, 2),
1983
1983
  copyable: !0
1984
1984
  }),
1985
- e.response && /* @__PURE__ */ v($t, {
1985
+ e.response && /* @__PURE__ */ v(en, {
1986
1986
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1987
1987
  content: e.response.content,
1988
1988
  copyable: !0
1989
1989
  }),
1990
- /* @__PURE__ */ v($t, {
1990
+ /* @__PURE__ */ v(en, {
1991
1991
  label: "Full payload (JSON)",
1992
1992
  content: t,
1993
1993
  copyable: !0
@@ -1995,14 +1995,14 @@ function nn({ request: e }) {
1995
1995
  ]
1996
1996
  });
1997
1997
  }
1998
- function rn({ events: e, lastRequest: t, onClear: n }) {
1999
- let r = u(() => ct(e), [e]), i = u(() => ut(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
1998
+ function an({ events: e, lastRequest: t, onClear: n }) {
1999
+ let r = u(() => lt(e), [e]), i = u(() => dt(r), [r]), a = u(() => JSON.stringify(e, null, 2), [e]);
2000
2000
  return /* @__PURE__ */ y("div", {
2001
2001
  className: "bailey-trace-body",
2002
2002
  children: [
2003
2003
  /* @__PURE__ */ y("div", {
2004
2004
  className: "bailey-trace-actions-row",
2005
- children: [e.length > 0 && /* @__PURE__ */ v(Zt, {
2005
+ children: [e.length > 0 && /* @__PURE__ */ v(Qt, {
2006
2006
  text: a,
2007
2007
  label: "Copy trace as JSON"
2008
2008
  }), /* @__PURE__ */ v("button", {
@@ -2012,15 +2012,15 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
2012
2012
  children: "Clear"
2013
2013
  })]
2014
2014
  }),
2015
- t && /* @__PURE__ */ v(nn, { request: t }),
2015
+ t && /* @__PURE__ */ v(rn, { request: t }),
2016
2016
  /* @__PURE__ */ v("div", {
2017
2017
  className: "bailey-trace-rows",
2018
2018
  children: i.map((e, t) => {
2019
- if (e.type === "single") return /* @__PURE__ */ v(en, { row: e.row }, e.row.key);
2019
+ if (e.type === "single") return /* @__PURE__ */ v(tn, { row: e.row }, e.row.key);
2020
2020
  let n = e.rows.filter((e) => e.isToolStart).length;
2021
2021
  if (n <= 1) return /* @__PURE__ */ v("div", {
2022
2022
  className: "bailey-trace-rows",
2023
- children: e.rows.map((e) => /* @__PURE__ */ v(en, { row: e }, e.key))
2023
+ children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
2024
2024
  }, `group-${t}`);
2025
2025
  let r = e.rows.filter((e) => e.failed).length;
2026
2026
  return /* @__PURE__ */ y("details", {
@@ -2042,7 +2042,7 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
2042
2042
  ]
2043
2043
  }), /* @__PURE__ */ v("div", {
2044
2044
  className: "bailey-trace-rows",
2045
- children: e.rows.map((e) => /* @__PURE__ */ v(en, { row: e }, e.key))
2045
+ children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
2046
2046
  })]
2047
2047
  }, `group-${t}`);
2048
2048
  })
@@ -2050,8 +2050,8 @@ function rn({ events: e, lastRequest: t, onClear: n }) {
2050
2050
  ]
2051
2051
  });
2052
2052
  }
2053
- function an({ events: e, lastRequest: t, onClear: n }) {
2054
- let [r, i] = f(!1), a = u(() => dt(e), [e]), o = u(() => lt(e), [e]);
2053
+ function on({ events: e, lastRequest: t, onClear: n }) {
2054
+ let [r, i] = f(!1), a = u(() => ft(e), [e]), o = u(() => ut(e), [e]);
2055
2055
  return e.length === 0 && !t ? null : /* @__PURE__ */ y("div", {
2056
2056
  className: "bailey-trace-panel",
2057
2057
  children: [/* @__PURE__ */ y("div", {
@@ -2072,7 +2072,7 @@ function an({ events: e, lastRequest: t, onClear: n }) {
2072
2072
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
2073
2073
  children: o
2074
2074
  })]
2075
- }), r && /* @__PURE__ */ v(rn, {
2075
+ }), r && /* @__PURE__ */ v(an, {
2076
2076
  events: e,
2077
2077
  lastRequest: t,
2078
2078
  onClear: n
@@ -2080,7 +2080,7 @@ function an({ events: e, lastRequest: t, onClear: n }) {
2080
2080
  });
2081
2081
  }
2082
2082
  // src/ui/ToolResultImage.tsx
2083
- function on({ src: e, alt: n, className: r }) {
2083
+ function sn({ src: e, alt: n, className: r }) {
2084
2084
  return t(e) ? /* @__PURE__ */ v("img", {
2085
2085
  src: e,
2086
2086
  alt: n ?? "",
@@ -2089,20 +2089,20 @@ function on({ src: e, alt: n, className: r }) {
2089
2089
  }) : null;
2090
2090
  }
2091
2091
  // src/utils/safeMcpAppResource.ts
2092
- var sn = /^ui:\/\//, cn = 2097152, ln = /* @__PURE__ */ new Set([
2092
+ var cn = /^ui:\/\//, ln = 2097152, un = /* @__PURE__ */ new Set([
2093
2093
  "connectDomains",
2094
2094
  "resourceDomains",
2095
2095
  "frameDomains",
2096
2096
  "baseUriDomains"
2097
- ]), un = /* @__PURE__ */ new Set([
2097
+ ]), dn = /* @__PURE__ */ new Set([
2098
2098
  "camera",
2099
2099
  "microphone",
2100
2100
  "geolocation",
2101
2101
  "clipboardWrite"
2102
- ]), dn = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), fn = (e) => !(!sn.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > cn || !dn(e.csp, ln) || !dn(e.permissions, un));
2102
+ ]), fn = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), pn = (e) => !(!cn.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > ln || !fn(e.csp, un) || !fn(e.permissions, dn));
2103
2103
  // src/ui/McpAppFrame.tsx
2104
- function pn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2105
- return fn({
2104
+ function mn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2105
+ return pn({
2106
2106
  html: e,
2107
2107
  resourceUri: n,
2108
2108
  csp: r,
@@ -2116,15 +2116,15 @@ function pn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, classNa
2116
2116
  }) : null;
2117
2117
  }
2118
2118
  // src/ui/BaileyToolSteps.tsx
2119
- function mn({ toolName: e, resolveActivityIcon: t }) {
2119
+ function hn({ toolName: e, resolveActivityIcon: t }) {
2120
2120
  let n = t?.(e);
2121
2121
  return n === 0 || n && n !== !0 ? /* @__PURE__ */ v("span", {
2122
2122
  className: "bailey-activity-icon",
2123
2123
  children: n
2124
2124
  }) : null;
2125
2125
  }
2126
- function hn({ offsetMs: e, labels: t }) {
2127
- let n = st(e), r = t.toolStepStartedText?.replace("{offset}", n);
2126
+ function gn({ offsetMs: e, labels: t }) {
2127
+ let n = ct(e), r = t.toolStepStartedText?.replace("{offset}", n);
2128
2128
  return /* @__PURE__ */ v("span", {
2129
2129
  className: "bailey-tool-step-start",
2130
2130
  title: r,
@@ -2133,7 +2133,7 @@ function hn({ offsetMs: e, labels: t }) {
2133
2133
  children: n
2134
2134
  });
2135
2135
  }
2136
- function gn({ steps: e, resolveActivityIcon: t }) {
2136
+ function _n({ steps: e, resolveActivityIcon: t }) {
2137
2137
  let n = e.filter((e) => e.status === "running");
2138
2138
  return n.length === 0 ? null : /* @__PURE__ */ v("div", {
2139
2139
  className: "bailey-tool-steps-live",
@@ -2142,7 +2142,7 @@ function gn({ steps: e, resolveActivityIcon: t }) {
2142
2142
  children: n.map((e) => /* @__PURE__ */ y("div", {
2143
2143
  className: "bailey-activity-line",
2144
2144
  children: [
2145
- /* @__PURE__ */ v(mn, {
2145
+ /* @__PURE__ */ v(hn, {
2146
2146
  toolName: e.toolName,
2147
2147
  resolveActivityIcon: t
2148
2148
  }),
@@ -2155,7 +2155,7 @@ function gn({ steps: e, resolveActivityIcon: t }) {
2155
2155
  }, e.key))
2156
2156
  });
2157
2157
  }
2158
- function _n({ steps: e, labels: t, resolveActivityIcon: n }) {
2158
+ function vn({ steps: e, labels: t, resolveActivityIcon: n }) {
2159
2159
  if (e.length === 0) return null;
2160
2160
  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;
2161
2161
  return /* @__PURE__ */ y("details", {
@@ -2165,12 +2165,12 @@ function _n({ steps: e, labels: t, resolveActivityIcon: n }) {
2165
2165
  children: e.map((e) => /* @__PURE__ */ y("li", {
2166
2166
  className: "bailey-tool-step",
2167
2167
  children: [
2168
- /* @__PURE__ */ v(mn, {
2168
+ /* @__PURE__ */ v(hn, {
2169
2169
  toolName: e.toolName,
2170
2170
  resolveActivityIcon: n
2171
2171
  }),
2172
2172
  /* @__PURE__ */ v("span", { children: e.label }),
2173
- e.startOffsetMs !== void 0 && /* @__PURE__ */ v(hn, {
2173
+ e.startOffsetMs !== void 0 && /* @__PURE__ */ v(gn, {
2174
2174
  offsetMs: e.startOffsetMs,
2175
2175
  labels: t
2176
2176
  }),
@@ -2186,28 +2186,28 @@ function _n({ steps: e, labels: t, resolveActivityIcon: n }) {
2186
2186
  });
2187
2187
  }
2188
2188
  // src/utils/relativeTime.ts
2189
- var vn = /(Z|[+-]\d{2}:?\d{2})$/i, yn = 60, bn = 3600, xn = 24 * bn, Sn = 30 * xn * 1e3;
2190
- function Cn(e) {
2191
- return e ? Date.parse(vn.test(e) ? e : `${e}Z`) : NaN;
2192
- }
2189
+ var yn = /(Z|[+-]\d{2}:?\d{2})$/i, bn = 60, xn = 3600, Sn = 24 * xn, Cn = 30 * Sn * 1e3;
2193
2190
  function wn(e) {
2194
- let t = Cn(e.iso);
2191
+ return e ? Date.parse(yn.test(e) ? e : `${e}Z`) : NaN;
2192
+ }
2193
+ function Tn(e) {
2194
+ let t = wn(e.iso);
2195
2195
  if (Number.isNaN(t)) return "";
2196
2196
  let n = e.now ?? Date.now(), r = Math.max(0, n - t);
2197
2197
  if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return e.justNowText ?? "";
2198
- if (r >= Sn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2198
+ if (r >= Cn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2199
2199
  let i = r / 1e3, a = new Intl.RelativeTimeFormat(e.locale, { numeric: "auto" });
2200
- return i < yn ? a.format(0, "second") : i < bn ? a.format(-Math.floor(i / yn), "minute") : i < xn ? a.format(-Math.floor(i / bn), "hour") : a.format(-Math.floor(i / xn), "day");
2200
+ return i < bn ? a.format(0, "second") : i < xn ? a.format(-Math.floor(i / bn), "minute") : i < Sn ? a.format(-Math.floor(i / xn), "hour") : a.format(-Math.floor(i / Sn), "day");
2201
2201
  }
2202
2202
  // src/ui/BaileyHistoryDrawer.tsx
2203
- function Tn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2204
- let s = _e({
2203
+ function En({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2204
+ let s = V({
2205
2205
  client: e,
2206
2206
  pageSize: t
2207
2207
  }), { loadConversation: c, newChat: l } = n, u = a((e) => c ? c(e) : Promise.reject(/* @__PURE__ */ Error("no loadConversation")), [c]), d = a(() => {
2208
2208
  l(), o({ restoreFocusTo: "input" });
2209
2209
  }, [l, o]);
2210
- return /* @__PURE__ */ v(On, {
2210
+ return /* @__PURE__ */ v(kn, {
2211
2211
  conversations: s,
2212
2212
  activeConversationId: n.conversationId,
2213
2213
  selectStatus: n.historyStatus,
@@ -2219,15 +2219,15 @@ function Tn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o
2219
2219
  locale: i
2220
2220
  });
2221
2221
  }
2222
- var En = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), Dn = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
2223
- function On({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
2224
- 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), ee = d(/* @__PURE__ */ new Map()), k = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [te, ne] = f(null), [M, N] = f(null), [P, re] = f(0), [F, I] = f(!1), [ie, L] = f(!1), [ae, oe] = f(!1), se = u ?? (typeof navigator < "u" ? navigator.language : void 0);
2222
+ var Dn = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), On = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
2223
+ function kn({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
2224
+ let { conversations: m, status: h, error: g, hasMore: b, refresh: x, loadMore: S, remove: C } = e, ee = 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), [te, ne] = f(null), [M, N] = f(null), [P, re] = f(0), [F, I] = f(!1), [ie, L] = f(!1), [ae, oe] = f(!1), se = u ?? (typeof navigator < "u" ? navigator.language : void 0);
2225
2225
  s(() => {
2226
- E.current?.focus();
2226
+ T.current?.focus();
2227
2227
  }, []), s(() => {
2228
2228
  let e = A.current;
2229
2229
  if (!e) return;
2230
- let t = e.kind === "select" ? ee.current.get(e.id) : e.kind === "delete" ? k.current.get(e.id) : e.kind === "cancel" ? O.current : D.current;
2230
+ 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;
2231
2231
  t && (t.focus(), A.current = null);
2232
2232
  }), s(() => {
2233
2233
  let e = j.current;
@@ -2240,16 +2240,16 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2240
2240
  b,
2241
2241
  m
2242
2242
  ]);
2243
- let R = () => {
2243
+ let ce = () => {
2244
2244
  j.current = m.length, S();
2245
- }, z = (e) => {
2245
+ }, R = (e) => {
2246
2246
  A.current = {
2247
2247
  kind: "delete",
2248
2248
  id: e
2249
2249
  }, ne(null);
2250
- }, ce = (e) => {
2251
- e.key === "Escape" && (e.stopPropagation(), te ? z(te) : o({ restoreFocusTo: "menu" }));
2252
- }, le = async (e) => {
2250
+ }, le = (e) => {
2251
+ e.key === "Escape" && (e.stopPropagation(), te ? R(te) : o({ restoreFocusTo: "menu" }));
2252
+ }, ue = async (e) => {
2253
2253
  if (oe(!1), e === t) o({ restoreFocusTo: "input" });
2254
2254
  else {
2255
2255
  L(!0);
@@ -2264,7 +2264,7 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2264
2264
  }
2265
2265
  L(!1), o({ restoreFocusTo: "input" });
2266
2266
  }
2267
- }, ue = async (e) => {
2267
+ }, de = async (e) => {
2268
2268
  let n = m.findIndex((t) => t.conversationId === e), r = m[n + 1] ?? m[n - 1];
2269
2269
  A.current = r ? {
2270
2270
  kind: "select",
@@ -2280,12 +2280,12 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2280
2280
  } finally {
2281
2281
  re((e) => e - 1);
2282
2282
  }
2283
- }, B = h === "loading" && m.length === 0, de = h === "error" && m.length === 0, V = h === "error" && m.length > 0 && b, H = h === "loading" && m.length > 0, fe = ie || n === "loading", pe = B ? l.historyLoadingText : P > 0 ? l.historyDeletingText : F ? l.historyDeletedText : m.length > 0 ? En(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", me = B || P > 0;
2283
+ }, z = h === "loading" && m.length === 0, fe = h === "error" && m.length === 0, pe = h === "error" && m.length > 0 && b, B = h === "loading" && m.length > 0, me = ie || n === "loading", he = z ? l.historyLoadingText : P > 0 ? l.historyDeletingText : F ? l.historyDeletedText : m.length > 0 ? Dn(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", ge = z || P > 0;
2284
2284
  return /* @__PURE__ */ y("section", {
2285
2285
  role: "region",
2286
- "aria-labelledby": w,
2286
+ "aria-labelledby": ee,
2287
2287
  className: "bailey-history-drawer",
2288
- onKeyDown: ce,
2288
+ onKeyDown: le,
2289
2289
  children: [
2290
2290
  /* @__PURE__ */ y("div", {
2291
2291
  className: "bailey-history-header",
@@ -2295,23 +2295,23 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2295
2295
  className: "bailey-history-icon-button",
2296
2296
  "aria-label": l.historyBackAriaLabel,
2297
2297
  onClick: () => o({ restoreFocusTo: "menu" }),
2298
- children: /* @__PURE__ */ v(Gt, { className: "bailey-history-icon" })
2298
+ children: /* @__PURE__ */ v(Kt, { className: "bailey-history-icon" })
2299
2299
  }),
2300
2300
  /* @__PURE__ */ v("h3", {
2301
- id: w,
2302
- ref: E,
2301
+ id: ee,
2302
+ ref: T,
2303
2303
  tabIndex: -1,
2304
2304
  className: "bailey-history-heading",
2305
2305
  children: l.historyTitle
2306
2306
  }),
2307
2307
  /* @__PURE__ */ y("button", {
2308
- ref: D,
2308
+ ref: E,
2309
2309
  type: "button",
2310
2310
  className: "bailey-history-button bailey-history-new-chat",
2311
2311
  "aria-label": l.newChatButtonText,
2312
- disabled: B,
2312
+ disabled: z,
2313
2313
  onClick: a,
2314
- children: [/* @__PURE__ */ v(Bt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2314
+ children: [/* @__PURE__ */ v(Vt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2315
2315
  className: "bailey-history-new-chat-text",
2316
2316
  children: l.newChatButtonText
2317
2317
  })]
@@ -2320,9 +2320,9 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2320
2320
  }),
2321
2321
  /* @__PURE__ */ y("div", {
2322
2322
  className: "bailey-history-body",
2323
- "aria-busy": B || void 0,
2323
+ "aria-busy": z || void 0,
2324
2324
  children: [
2325
- B && /* @__PURE__ */ y("div", {
2325
+ z && /* @__PURE__ */ y("div", {
2326
2326
  "aria-hidden": "true",
2327
2327
  children: [
2328
2328
  /* @__PURE__ */ v("div", { className: "bailey-history-skeleton" }),
@@ -2331,13 +2331,13 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2331
2331
  /* @__PURE__ */ v("div", { className: "bailey-history-skeleton" })
2332
2332
  ]
2333
2333
  }),
2334
- de && /* @__PURE__ */ y("div", {
2334
+ fe && /* @__PURE__ */ y("div", {
2335
2335
  role: "alert",
2336
2336
  className: "bailey-history-state bailey-history-state-error",
2337
2337
  children: [
2338
- /* @__PURE__ */ v(qt, { className: "bailey-history-state-icon" }),
2339
- /* @__PURE__ */ v("strong", { children: Dn(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
2340
- /* @__PURE__ */ v("span", { children: Dn(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
2338
+ /* @__PURE__ */ v(Jt, { className: "bailey-history-state-icon" }),
2339
+ /* @__PURE__ */ v("strong", { children: On(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
2340
+ /* @__PURE__ */ v("span", { children: On(g) ? l.historySessionExpiredDescription : l.historyErrorDescription }),
2341
2341
  /* @__PURE__ */ v("button", {
2342
2342
  type: "button",
2343
2343
  className: "bailey-history-button bailey-history-button-primary",
@@ -2346,10 +2346,10 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2346
2346
  })
2347
2347
  ]
2348
2348
  }),
2349
- !B && !de && m.length === 0 && /* @__PURE__ */ y("div", {
2349
+ !z && !fe && m.length === 0 && /* @__PURE__ */ y("div", {
2350
2350
  className: "bailey-history-state",
2351
2351
  children: [
2352
- /* @__PURE__ */ v(Lt, { className: "bailey-history-state-icon" }),
2352
+ /* @__PURE__ */ v(Rt, { className: "bailey-history-state-icon" }),
2353
2353
  /* @__PURE__ */ v("strong", { children: l.historyEmptyTitle }),
2354
2354
  /* @__PURE__ */ v("span", { children: l.historyEmptyDescription }),
2355
2355
  /* @__PURE__ */ v("button", {
@@ -2368,11 +2368,11 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2368
2368
  className: "bailey-history-row bailey-history-row-confirming",
2369
2369
  children: /* @__PURE__ */ y("div", {
2370
2370
  role: "group",
2371
- "aria-labelledby": T,
2371
+ "aria-labelledby": w,
2372
2372
  className: "bailey-history-confirm",
2373
2373
  children: [
2374
2374
  /* @__PURE__ */ v("span", {
2375
- id: T,
2375
+ id: w,
2376
2376
  className: "bailey-history-confirm-question",
2377
2377
  children: l.historyDeleteConfirmQuestion
2378
2378
  }),
@@ -2383,38 +2383,38 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2383
2383
  /* @__PURE__ */ v("button", {
2384
2384
  type: "button",
2385
2385
  className: "bailey-history-button bailey-history-button-danger",
2386
- onClick: () => void ue(n),
2386
+ onClick: () => void de(n),
2387
2387
  children: l.historyDeleteConfirmText
2388
2388
  }),
2389
2389
  /* @__PURE__ */ v("button", {
2390
- ref: O,
2390
+ ref: D,
2391
2391
  type: "button",
2392
2392
  className: "bailey-history-button",
2393
- onClick: () => z(n),
2393
+ onClick: () => R(n),
2394
2394
  children: l.historyDeleteCancelText
2395
2395
  })
2396
2396
  ]
2397
2397
  })
2398
2398
  }, n);
2399
- let a = wn({
2399
+ let a = Tn({
2400
2400
  iso: e.updatedAt,
2401
2401
  locale: se,
2402
2402
  now: p?.(),
2403
2403
  justNowText: l.historyJustNowText
2404
- }), o = En(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = M === n;
2404
+ }), o = Dn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = M === n;
2405
2405
  return /* @__PURE__ */ y("li", {
2406
2406
  className: `bailey-history-row${i ? " bailey-history-row-active" : ""}${s ? " bailey-history-row-failed" : ""}`,
2407
2407
  children: [
2408
2408
  /* @__PURE__ */ y("button", {
2409
2409
  type: "button",
2410
2410
  ref: (e) => {
2411
- e ? ee.current.set(n, e) : ee.current.delete(n);
2411
+ e ? O.current.set(n, e) : O.current.delete(n);
2412
2412
  },
2413
2413
  className: "bailey-history-select",
2414
2414
  "aria-current": i ? "true" : void 0,
2415
- "aria-disabled": fe || void 0,
2415
+ "aria-disabled": me || void 0,
2416
2416
  onClick: () => {
2417
- fe || le(n);
2417
+ me || ue(n);
2418
2418
  },
2419
2419
  children: [/* @__PURE__ */ v("span", {
2420
2420
  className: "bailey-history-row-title",
@@ -2443,22 +2443,22 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2443
2443
  e ? k.current.set(n, e) : k.current.delete(n);
2444
2444
  },
2445
2445
  className: "bailey-history-icon-button bailey-history-delete",
2446
- "aria-label": En(l.historyDeleteAriaLabel, { title: r }),
2446
+ "aria-label": Dn(l.historyDeleteAriaLabel, { title: r }),
2447
2447
  onClick: () => {
2448
2448
  N(null), I(!1), A.current = { kind: "cancel" }, ne(n);
2449
2449
  },
2450
- children: /* @__PURE__ */ v(Kt, { className: "bailey-history-icon" })
2450
+ children: /* @__PURE__ */ v(qt, { className: "bailey-history-icon" })
2451
2451
  }),
2452
2452
  s && /* @__PURE__ */ y("div", {
2453
2453
  role: "alert",
2454
2454
  className: "bailey-history-row-error",
2455
2455
  children: [
2456
- /* @__PURE__ */ v(qt, { className: "bailey-history-icon-small" }),
2456
+ /* @__PURE__ */ v(Jt, { className: "bailey-history-icon-small" }),
2457
2457
  /* @__PURE__ */ v("span", { children: l.historyDeleteFailedText }),
2458
2458
  /* @__PURE__ */ v("button", {
2459
2459
  type: "button",
2460
2460
  className: "bailey-history-button bailey-history-button-small",
2461
- onClick: () => void ue(n),
2461
+ onClick: () => void de(n),
2462
2462
  children: l.historyDeleteRetryText
2463
2463
  }),
2464
2464
  /* @__PURE__ */ v("button", {
@@ -2480,24 +2480,24 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2480
2480
  }),
2481
2481
  b && m.length > 0 && /* @__PURE__ */ v("div", {
2482
2482
  className: "bailey-history-more",
2483
- children: V ? /* @__PURE__ */ y("div", {
2483
+ children: pe ? /* @__PURE__ */ y("div", {
2484
2484
  role: "alert",
2485
2485
  className: "bailey-history-inline-error",
2486
2486
  children: [/* @__PURE__ */ v("span", { children: l.historyLoadMoreErrorText }), /* @__PURE__ */ v("button", {
2487
2487
  type: "button",
2488
2488
  className: "bailey-history-button",
2489
- onClick: R,
2489
+ onClick: ce,
2490
2490
  children: l.retryButtonText
2491
2491
  })]
2492
2492
  }) : /* @__PURE__ */ y("button", {
2493
2493
  type: "button",
2494
2494
  className: "bailey-history-button",
2495
- disabled: H,
2496
- onClick: R,
2497
- children: [H && /* @__PURE__ */ v("span", {
2495
+ disabled: B,
2496
+ onClick: ce,
2497
+ children: [B && /* @__PURE__ */ v("span", {
2498
2498
  className: "bailey-history-spinner",
2499
2499
  "aria-hidden": "true"
2500
- }), H ? l.historyLoadingMoreText : l.historyLoadMoreText]
2500
+ }), B ? l.historyLoadingMoreText : l.historyLoadMoreText]
2501
2501
  })
2502
2502
  })
2503
2503
  ]
@@ -2506,16 +2506,16 @@ function On({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2506
2506
  role: "status",
2507
2507
  "aria-live": "polite",
2508
2508
  className: "bailey-history-status",
2509
- children: [me && /* @__PURE__ */ v("span", {
2509
+ children: [ge && /* @__PURE__ */ v("span", {
2510
2510
  className: "bailey-history-spinner",
2511
2511
  "aria-hidden": "true"
2512
- }), pe]
2512
+ }), he]
2513
2513
  })
2514
2514
  ]
2515
2515
  });
2516
2516
  }
2517
2517
  // src/ui/historyLabels.ts
2518
- var kn = {
2518
+ var An = {
2519
2519
  newChatButtonText: "New chat",
2520
2520
  retryButtonText: "Retry",
2521
2521
  historyTitle: "Chat history",
@@ -2548,7 +2548,7 @@ var kn = {
2548
2548
  historyDeleteRetryText: "Try again",
2549
2549
  historyDeleteDismissText: "Dismiss",
2550
2550
  historyJustNowText: "just now"
2551
- }, An = {
2551
+ }, jn = {
2552
2552
  feedbackGroupLabel: "Rate this response",
2553
2553
  feedbackThumbsUpAriaLabel: "Good response",
2554
2554
  feedbackThumbsDownAriaLabel: "Bad response",
@@ -2568,50 +2568,50 @@ var kn = {
2568
2568
  feedbackReasonUnsafe: "Unsafe",
2569
2569
  feedbackReasonTooLong: "Too long",
2570
2570
  feedbackReasonOther: "Other"
2571
- }, jn = 2e3, Mn = [
2571
+ }, Mn = 2e3, Nn = [
2572
2572
  "inaccurate",
2573
2573
  "unhelpful",
2574
2574
  "unsafe",
2575
2575
  "too_long",
2576
2576
  "other"
2577
- ], Nn = {
2577
+ ], Pn = {
2578
2578
  inaccurate: "feedbackReasonInaccurate",
2579
2579
  unhelpful: "feedbackReasonUnhelpful",
2580
2580
  unsafe: "feedbackReasonUnsafe",
2581
2581
  too_long: "feedbackReasonTooLong",
2582
2582
  other: "feedbackReasonOther"
2583
- }, Pn = (e) => Mn.includes(e) ? e : "other";
2584
- function Fn(e) {
2585
- return Array.from(new Set((e ?? Mn).map(Pn)));
2586
- }
2583
+ }, Fn = (e) => Nn.includes(e) ? e : "other";
2587
2584
  function In(e) {
2588
- return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), jn) : jn;
2585
+ return Array.from(new Set((e ?? Nn).map(Fn)));
2586
+ }
2587
+ function Ln(e) {
2588
+ return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), Mn) : Mn;
2589
2589
  }
2590
- function Ln(e, t) {
2590
+ function Rn(e, t) {
2591
2591
  if (e === null || t === null) return e === t;
2592
2592
  let n = e.reasonCodes ?? [], r = t.reasonCodes ?? [];
2593
2593
  return e.rating === t.rating && (e.comment ?? "") === (t.comment ?? "") && n.length === r.length && n.every((e, t) => e === r[t]);
2594
2594
  }
2595
- function Rn(e) {
2596
- let t = o(At), n = t && !t.builtIn ? t.claim : void 0, { messageId: r } = e;
2597
- return l(() => n && r ? n(r) : void 0, [n, r]), e.messageId ? /* @__PURE__ */ v(zn, { ...e }, e.messageId) : null;
2595
+ function zn(e) {
2596
+ let t = o(jt), n = t && !t.builtIn ? t.claim : void 0, { messageId: r } = e;
2597
+ return l(() => n && r ? n(r) : void 0, [n, r]), e.messageId ? /* @__PURE__ */ v(Bn, { ...e }, e.messageId) : null;
2598
2598
  }
2599
- function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, assistantName: l = "bailey", className: u }) {
2599
+ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, assistantName: l = "bailey", className: u }) {
2600
2600
  let p = {
2601
- ...An,
2601
+ ...jn,
2602
2602
  feedbackCommentPlaceholder: `What should ${l} have said or done differently?`,
2603
2603
  ...o
2604
- }, m = Fn(i), h = In(a), b = r ? { rating: r } : null, [x, S] = f(b), [C, w] = f(r ?? null), [T, E] = f(!1), [D, O] = f("down"), [ee, k] = f([]), [A, j] = f(""), [te, ne] = f(!1), [M, N] = f(!1), [P, re] = f(!1), [F, I] = f(!1), ie = d(b), L = d(null), ae = d(0), oe = d(!1), se = d(!0), R = d(null), z = d(null), ce = d(null), le = d(null), ue = d(null), B = kt(z), de = c(), V = `${de}-comment`, H = `${de}-counter`, fe = `${de}-privacy`;
2604
+ }, m = In(i), h = Ln(a), b = r ? { rating: r } : null, [x, S] = f(b), [C, ee] = f(r ?? null), [w, T] = f(!1), [E, D] = f("down"), [O, k] = f([]), [A, j] = f(""), [te, ne] = f(!1), [M, N] = f(!1), [P, re] = f(!1), [F, I] = f(!1), ie = d(b), L = d(null), ae = d(0), oe = d(!1), se = d(!0), ce = d(null), R = d(null), le = d(null), ue = d(null), de = d(null), z = At(R), fe = c(), pe = `${fe}-comment`, B = `${fe}-counter`, me = `${fe}-privacy`;
2605
2605
  s(() => (se.current = !0, () => {
2606
2606
  se.current = !1;
2607
2607
  }), []), s(() => {
2608
- T && ue.current?.focus();
2609
- }, [T]), s(() => {
2610
- R.current && !P && !T && ((R.current === "up" ? ce : le).current?.focus(), R.current = null);
2608
+ w && de.current?.focus();
2609
+ }, [w]), s(() => {
2610
+ ce.current && !P && !w && ((ce.current === "up" ? le : ue).current?.focus(), ce.current = null);
2611
2611
  });
2612
- let pe = () => {
2612
+ let he = () => {
2613
2613
  k([]), j("");
2614
- }, me = async (r) => {
2614
+ }, ge = async (r) => {
2615
2615
  try {
2616
2616
  return r.kind === "clear" ? await n({ messageId: e }) : await t({
2617
2617
  messageId: e,
@@ -2620,73 +2620,73 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2620
2620
  } catch {
2621
2621
  return !1;
2622
2622
  }
2623
- }, he = async () => {
2623
+ }, _e = async () => {
2624
2624
  if (!oe.current) {
2625
2625
  oe.current = !0, N(!0);
2626
2626
  try {
2627
2627
  for (; L.current && se.current;) {
2628
- let e = L.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Ln(t, ie.current) || await me(e);
2628
+ let e = L.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Rn(t, ie.current) || await ge(e);
2629
2629
  if (!se.current) return;
2630
2630
  let r = L.current?.version !== e.version;
2631
- (n || !r) && (n ? (ie.current = t, S(t)) : (w(ie.current?.rating ?? null), I(!0)), r || (L.current = null, re(!1), n && e.kind === "submit" && e.formSubmit && (E(!1), ne(!0), R.current = e.snapshot.rating)));
2631
+ (n || !r) && (n ? (ie.current = t, S(t)) : (ee(ie.current?.rating ?? null), I(!0)), r || (L.current = null, re(!1), n && e.kind === "submit" && e.formSubmit && (T(!1), ne(!0), ce.current = e.snapshot.rating)));
2632
2632
  }
2633
2633
  } finally {
2634
2634
  oe.current = !1, se.current && N(!1);
2635
2635
  }
2636
2636
  }
2637
- }, ge = (e) => {
2637
+ }, ve = (e) => {
2638
2638
  ae.current += 1, L.current = {
2639
2639
  ...e,
2640
2640
  version: ae.current
2641
- }, I(!1), he();
2642
- }, U = () => {
2643
- w(null), E(!1), ne(!1), pe(), ge({ kind: "clear" });
2644
- }, _e = (e) => {
2645
- P || (C === e ? U() : (w(e), ne(!1), pe(), e === "down" ? (O("down"), E(!0)) : E(!1), ge({
2641
+ }, I(!1), _e();
2642
+ }, ye = () => {
2643
+ ee(null), T(!1), ne(!1), he(), ve({ kind: "clear" });
2644
+ }, be = (e) => {
2645
+ P || (C === e ? ye() : (ee(e), ne(!1), he(), e === "down" ? (D("down"), T(!0)) : T(!1), ve({
2646
2646
  kind: "submit",
2647
2647
  snapshot: { rating: e },
2648
2648
  formSubmit: !1
2649
2649
  })));
2650
- }, W = (e) => {
2651
- C !== null && (O(C), k((e?.reasonCodes ?? []).map(Pn)), j(e?.comment ?? ""), I(!1), E(!0));
2652
- }, ve = () => {
2653
- P || (E(!1), I(!1), pe(), R.current = D);
2654
- }, ye = () => {
2650
+ }, V = (e) => {
2651
+ C !== null && (D(C), k((e?.reasonCodes ?? []).map(Fn)), j(e?.comment ?? ""), I(!1), T(!0));
2652
+ }, H = () => {
2653
+ P || (T(!1), I(!1), he(), ce.current = E);
2654
+ }, xe = () => {
2655
2655
  if (P) return;
2656
- let e = A.trim(), t = m.filter((e) => ee.includes(e)), n = {
2657
- rating: D,
2656
+ let e = A.trim(), t = m.filter((e) => O.includes(e)), n = {
2657
+ rating: E,
2658
2658
  ...t.length > 0 ? { reasonCodes: t } : {},
2659
2659
  ...e ? { comment: e } : {}
2660
2660
  };
2661
- re(!0), w(D), ge({
2661
+ re(!0), ee(E), ve({
2662
2662
  kind: "submit",
2663
2663
  snapshot: n,
2664
2664
  formSubmit: !0
2665
2665
  });
2666
- }, G = (e) => {
2666
+ }, U = (e) => {
2667
2667
  k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
2668
- }, K = (e) => {
2669
- e.key === "Escape" && (e.stopPropagation(), ve());
2670
- }, q = C !== null && x?.rating === C && !M && !T, be = !!x && (!!x.comment || (x.reasonCodes?.length ?? 0) > 0), xe = M ? p.feedbackSavingText : q ? p.feedbackThanksText : "", Se = (e) => {
2671
- let t = C === e, n = e === "up" ? p.feedbackThumbsUpAriaLabel : p.feedbackThumbsDownAriaLabel, r = e === "up" ? Ut : Wt;
2668
+ }, W = (e) => {
2669
+ e.key === "Escape" && (e.stopPropagation(), H());
2670
+ }, G = C !== null && x?.rating === C && !M && !w, K = !!x && (!!x.comment || (x.reasonCodes?.length ?? 0) > 0), Se = M ? p.feedbackSavingText : G ? p.feedbackThanksText : "", Ce = (e) => {
2671
+ let t = C === e, n = e === "up" ? p.feedbackThumbsUpAriaLabel : p.feedbackThumbsDownAriaLabel, r = e === "up" ? Wt : Gt;
2672
2672
  return /* @__PURE__ */ y(g.Root, { children: [/* @__PURE__ */ v(g.Trigger, {
2673
2673
  asChild: !0,
2674
2674
  children: /* @__PURE__ */ v("button", {
2675
- ref: e === "up" ? ce : le,
2675
+ ref: e === "up" ? le : ue,
2676
2676
  type: "button",
2677
2677
  className: "bailey-feedback-thumb",
2678
2678
  "aria-pressed": t,
2679
2679
  "aria-label": n,
2680
2680
  "aria-busy": t && M ? !0 : void 0,
2681
2681
  disabled: P,
2682
- onClick: () => _e(e),
2682
+ onClick: () => be(e),
2683
2683
  children: /* @__PURE__ */ v(r, {
2684
2684
  className: "bailey-feedback-icon",
2685
2685
  filled: t
2686
2686
  })
2687
2687
  })
2688
2688
  }), /* @__PURE__ */ v(g.Portal, {
2689
- container: B instanceof ShadowRoot ? B : void 0,
2689
+ container: z instanceof ShadowRoot ? z : void 0,
2690
2690
  children: /* @__PURE__ */ y(g.Content, {
2691
2691
  side: "top",
2692
2692
  className: "bailey-tooltip-content",
@@ -2695,7 +2695,7 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2695
2695
  })] });
2696
2696
  };
2697
2697
  return /* @__PURE__ */ y("div", {
2698
- ref: z,
2698
+ ref: R,
2699
2699
  className: `bailey-feedback${u ? ` ${u}` : ""}`,
2700
2700
  children: [
2701
2701
  /* @__PURE__ */ v(g.Provider, {
@@ -2705,7 +2705,7 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2705
2705
  "aria-label": p.feedbackGroupLabel,
2706
2706
  "aria-busy": M ? !0 : void 0,
2707
2707
  className: "bailey-feedback-thumbs",
2708
- children: [Se("up"), Se("down")]
2708
+ children: [Ce("up"), Ce("down")]
2709
2709
  })
2710
2710
  }),
2711
2711
  /* @__PURE__ */ y("span", {
@@ -2714,17 +2714,17 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2714
2714
  children: [M && /* @__PURE__ */ v("span", {
2715
2715
  className: "bailey-feedback-spinner",
2716
2716
  "aria-hidden": "true"
2717
- }), xe]
2717
+ }), Se]
2718
2718
  }),
2719
- q && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
2719
+ G && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
2720
2720
  type: "button",
2721
2721
  className: "bailey-feedback-link",
2722
- onClick: () => W(x),
2723
- children: te || be ? p.feedbackEditText : p.feedbackAddCommentText
2722
+ onClick: () => V(x),
2723
+ children: te || K ? p.feedbackEditText : p.feedbackAddCommentText
2724
2724
  }), /* @__PURE__ */ v("button", {
2725
2725
  type: "button",
2726
2726
  className: "bailey-feedback-link",
2727
- onClick: U,
2727
+ onClick: ye,
2728
2728
  children: p.feedbackUndoText
2729
2729
  })] }),
2730
2730
  F && /* @__PURE__ */ v("span", {
@@ -2732,9 +2732,9 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2732
2732
  className: "bailey-feedback-error",
2733
2733
  children: p.feedbackErrorText
2734
2734
  }),
2735
- T && /* @__PURE__ */ y("div", {
2735
+ w && /* @__PURE__ */ y("div", {
2736
2736
  className: "bailey-feedback-form",
2737
- onKeyDown: K,
2737
+ onKeyDown: W,
2738
2738
  children: [
2739
2739
  m.length > 0 && /* @__PURE__ */ y("fieldset", {
2740
2740
  className: "bailey-feedback-reasons",
@@ -2745,43 +2745,43 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2745
2745
  className: "bailey-feedback-chips",
2746
2746
  children: m.map((e, t) => /* @__PURE__ */ v("button", {
2747
2747
  ref: t === 0 ? (e) => {
2748
- ue.current = e;
2748
+ de.current = e;
2749
2749
  } : void 0,
2750
2750
  type: "button",
2751
2751
  className: "bailey-feedback-chip",
2752
- "aria-pressed": ee.includes(e),
2752
+ "aria-pressed": O.includes(e),
2753
2753
  disabled: P,
2754
- onClick: () => G(e),
2755
- children: p[Nn[e]]
2754
+ onClick: () => U(e),
2755
+ children: p[Pn[e]]
2756
2756
  }, e))
2757
2757
  })]
2758
2758
  }),
2759
2759
  /* @__PURE__ */ v("label", {
2760
- htmlFor: V,
2760
+ htmlFor: pe,
2761
2761
  className: "bailey-feedback-legend",
2762
2762
  children: p.feedbackCommentLabel
2763
2763
  }),
2764
2764
  /* @__PURE__ */ v("textarea", {
2765
- id: V,
2765
+ id: pe,
2766
2766
  ref: m.length === 0 ? (e) => {
2767
- ue.current = e;
2767
+ de.current = e;
2768
2768
  } : void 0,
2769
2769
  className: "bailey-feedback-textarea",
2770
2770
  value: A,
2771
2771
  maxLength: h,
2772
2772
  placeholder: p.feedbackCommentPlaceholder,
2773
- "aria-describedby": `${H} ${fe}`,
2773
+ "aria-describedby": `${B} ${me}`,
2774
2774
  disabled: P,
2775
2775
  onChange: (e) => j(e.target.value.slice(0, h))
2776
2776
  }),
2777
2777
  /* @__PURE__ */ y("div", {
2778
2778
  className: "bailey-feedback-meta",
2779
2779
  children: [/* @__PURE__ */ v("span", {
2780
- id: fe,
2780
+ id: me,
2781
2781
  className: "bailey-feedback-privacy",
2782
2782
  children: p.feedbackPrivacyNote
2783
2783
  }), /* @__PURE__ */ v("span", {
2784
- id: H,
2784
+ id: B,
2785
2785
  className: "bailey-feedback-counter",
2786
2786
  children: `${A.length} / ${h}`
2787
2787
  })]
@@ -2792,13 +2792,13 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2792
2792
  type: "button",
2793
2793
  className: "bailey-feedback-button",
2794
2794
  disabled: P,
2795
- onClick: ve,
2795
+ onClick: H,
2796
2796
  children: p.feedbackCancelText
2797
2797
  }), /* @__PURE__ */ v("button", {
2798
2798
  type: "button",
2799
2799
  className: "bailey-feedback-button bailey-feedback-button-primary",
2800
2800
  disabled: P,
2801
- onClick: ye,
2801
+ onClick: xe,
2802
2802
  children: P ? p.feedbackSavingText : p.feedbackSubmitText
2803
2803
  })]
2804
2804
  })
@@ -2808,8 +2808,8 @@ function zn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2808
2808
  });
2809
2809
  }
2810
2810
  // src/ui/BaileyChatPanel.tsx
2811
- var Bn = "bailey", Vn = {
2812
- ...kn,
2811
+ var Vn = "bailey", Hn = {
2812
+ ...An,
2813
2813
  newChatButtonText: "New chat",
2814
2814
  newChatAriaLabel: "new chat",
2815
2815
  historyAriaLabel: "conversation history",
@@ -2835,84 +2835,84 @@ var Bn = "bailey", Vn = {
2835
2835
  mcpAppDefaultTitle: "MCP App",
2836
2836
  loadEarlierButtonText: "Load earlier messages",
2837
2837
  loadEarlierErrorText: "Couldn't load earlier messages."
2838
- }, Hn = [m], Un = {
2839
- ...jt(),
2838
+ }, Un = [m], Wn = {
2839
+ ...Mt(),
2840
2840
  p: ({ children: e }) => /* @__PURE__ */ v(_, { children: e })
2841
- }, Wn = i(function({ content: e, components: t }) {
2841
+ }, Gn = i(function({ content: e, components: t }) {
2842
2842
  return /* @__PURE__ */ v("div", {
2843
2843
  className: "bailey-markdown-content",
2844
2844
  children: /* @__PURE__ */ v(p, {
2845
- remarkPlugins: Hn,
2845
+ remarkPlugins: Un,
2846
2846
  components: t,
2847
2847
  skipHtml: !0,
2848
2848
  children: e
2849
2849
  })
2850
2850
  });
2851
2851
  });
2852
- function Gn(e, t, n) {
2852
+ function Kn(e, t, n) {
2853
2853
  if (e !== "streaming") return;
2854
2854
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
2855
2855
  return r[r.length - 1];
2856
2856
  }
2857
- function Kn(e) {
2858
- if (e && e.kind !== "tool_end") return at(e);
2859
- }
2860
2857
  function qn(e) {
2858
+ if (e && e.kind !== "tool_end") return ot(e);
2859
+ }
2860
+ function Jn(e) {
2861
2861
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
2862
2862
  hour: "numeric",
2863
2863
  minute: "2-digit"
2864
2864
  });
2865
2865
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
2866
2866
  }
2867
- function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i, assistantName: o = Bn, suggestions: c, suggestionsAlign: l = "start", hideMenuButton: m = !1, onHistoryClick: _, history: b, locale: x, privacyNote: S, resolveActivityIcon: C, sendIcon: w, className: T, height: E, width: D, hideDeveloperDetails: O = !1, renderMessageActions: ee, feedback: k, renderTable: A, renderChart: j, renderMcpApp: te, labels: ne, formatMessageTime: M }) {
2868
- let { messages: N, traceEvents: P, lastRequest: re, status: F, error: I, send: ie, stop: L, retryLast: ae, clearTrace: oe, clearError: se, newChat: R } = e, [z, ce] = f(""), [le, ue] = f(/* @__PURE__ */ new Map()), B = a((e) => {
2869
- let t = (t) => ue((n) => {
2867
+ function Yn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i, assistantName: o = Vn, suggestions: c, suggestionsAlign: l = "start", hideMenuButton: m = !1, onHistoryClick: _, history: b, locale: x, privacyNote: S, resolveActivityIcon: C, sendIcon: ee, className: w, height: T, width: E, hideDeveloperDetails: D = !1, renderMessageActions: O, feedback: k, renderTable: A, renderChart: j, renderMcpApp: te, labels: ne, formatMessageTime: M }) {
2868
+ let { messages: N, traceEvents: P, lastRequest: re, status: F, error: I, send: ie, stop: L, retryLast: ae, clearTrace: oe, clearError: se, newChat: ce } = e, [R, le] = f(""), [ue, de] = f(/* @__PURE__ */ new Map()), z = a((e) => {
2869
+ let t = (t) => de((n) => {
2870
2870
  let r = new Map(n), i = (r.get(e) ?? 0) + t;
2871
2871
  return i > 0 ? r.set(e, i) : r.delete(e), r;
2872
2872
  });
2873
2873
  return t(1), () => t(-1);
2874
- }, []), de = u(() => ({
2874
+ }, []), fe = u(() => ({
2875
2875
  builtIn: !1,
2876
- claim: B
2877
- }), [B]), V = u(() => ({
2876
+ claim: z
2877
+ }), [z]), pe = u(() => ({
2878
2878
  builtIn: !0,
2879
- claim: B
2880
- }), [B]), H = {
2881
- ...Vn,
2879
+ claim: z
2880
+ }), [z]), B = {
2881
+ ...Hn,
2882
2882
  emptyStateMessage: `Ask ${o} a question to get started.`,
2883
2883
  ...ne
2884
- }, fe = M ?? qn, pe = d(null), me = d(null), he = d(null), ge = d(null), [U, _e] = f(!1), W = d(null), ve = d(!1), ye = !!_ || !!b, G = Ot(pe), K = d(null), q = d(null), be = d(!0), xe = u(() => jt({
2884
+ }, me = M ?? Jn, he = d(null), ge = d(null), _e = d(null), ve = d(null), [ye, be] = f(!1), V = d(null), H = d(!1), xe = !!_ || !!b, U = kt(he), W = d(null), G = d(null), K = d(!0), Se = u(() => Mt({
2885
2885
  renderTable: A,
2886
2886
  renderChart: j
2887
- }), [A, j]), Se = u(() => Gn(F, P, re), [
2887
+ }), [A, j]), Ce = u(() => Kn(F, P, re), [
2888
2888
  F,
2889
2889
  P,
2890
2890
  re
2891
- ]), Ce = Kn(Se), J = Se?.kind === "tool_end" ? Se.at : void 0, we = N[N.length - 1]?.content.length ?? 0, [Te, Ee] = f(null), Y = Te;
2892
- J !== void 0 && Te?.at !== J && (Y = {
2893
- at: J,
2894
- length: we
2895
- }, Ee(Y));
2896
- let X = J !== void 0 && Y?.at === J && we <= Y.length, De = Ce ?? (X ? H.thinkingHint : void 0), Z = N.length === 0, Oe = t ?? (Z ? i ?? `How can ${o} AI help you today?` : r ?? `Reply to ${o} AI`);
2891
+ ]), we = qn(Ce), Te = Ce?.kind === "tool_end" ? Ce.at : void 0, q = N[N.length - 1]?.content.length ?? 0, [Ee, De] = f(null), J = Ee;
2892
+ Te !== void 0 && Ee?.at !== Te && (J = {
2893
+ at: Te,
2894
+ length: q
2895
+ }, De(J));
2896
+ let Y = Te !== void 0 && J?.at === Te && q <= J.length, X = we ?? (Y ? B.thinkingHint : void 0), Oe = N.length === 0, Z = t ?? (Oe ? i ?? `How can ${o} AI help you today?` : r ?? `Reply to ${o} AI`);
2897
2897
  s(() => {
2898
- let e = q.current;
2898
+ let e = G.current;
2899
2899
  if (!e) return;
2900
2900
  let t = () => {
2901
2901
  let t = e.scrollHeight - e.scrollTop - e.clientHeight;
2902
- be.current = t < 60;
2902
+ K.current = t < 60;
2903
2903
  };
2904
2904
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
2905
2905
  }, []), s(() => {
2906
- be.current && K.current?.scrollIntoView({
2906
+ K.current && W.current?.scrollIntoView({
2907
2907
  behavior: F === "streaming" ? "auto" : "smooth",
2908
2908
  block: "nearest"
2909
2909
  });
2910
2910
  }, [N, F]);
2911
2911
  let ke = (e) => {
2912
- be.current = !0, ie(e);
2913
- }, Ae = d(null), Q = () => {
2914
- let t = q.current;
2915
- be.current = !1, Ae.current = t ? {
2912
+ K.current = !0, ie(e);
2913
+ }, Ae = d(null), je = () => {
2914
+ let t = G.current;
2915
+ K.current = !1, Ae.current = t ? {
2916
2916
  height: t.scrollHeight,
2917
2917
  top: t.scrollTop
2918
2918
  } : null, e.loadEarlier?.().catch(() => {
@@ -2920,35 +2920,35 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
2920
2920
  });
2921
2921
  };
2922
2922
  s(() => {
2923
- let e = Ae.current, t = q.current;
2923
+ let e = Ae.current, t = G.current;
2924
2924
  e && t && t.scrollHeight !== e.height && (t.scrollTop = e.top + (t.scrollHeight - e.height), Ae.current = null);
2925
2925
  }, [N]), s(() => {
2926
- me.current?.toggleAttribute("inert", U);
2927
- }, [U]), s(() => {
2928
- !U && W.current && ((W.current === "input" ? he.current : ge.current)?.focus(), W.current = null);
2929
- }, [U]);
2930
- let je = a((e) => {
2931
- W.current = e.restoreFocusTo, _e(!1);
2926
+ ge.current?.toggleAttribute("inert", ye);
2927
+ }, [ye]), s(() => {
2928
+ !ye && V.current && ((V.current === "input" ? _e.current : ve.current)?.focus(), V.current = null);
2929
+ }, [ye]);
2930
+ let Q = a((e) => {
2931
+ V.current = e.restoreFocusTo, be(!1);
2932
2932
  }, []);
2933
- return /* @__PURE__ */ v(ht.Provider, {
2934
- value: G,
2935
- children: /* @__PURE__ */ v(At.Provider, {
2936
- value: de,
2933
+ return /* @__PURE__ */ v(gt.Provider, {
2934
+ value: U,
2935
+ children: /* @__PURE__ */ v(jt.Provider, {
2936
+ value: fe,
2937
2937
  children: /* @__PURE__ */ y("div", {
2938
- ref: pe,
2939
- className: `bailey-chat-panel${T ? ` ${T}` : ""}`,
2940
- style: E !== void 0 || D !== void 0 ? {
2941
- height: E,
2942
- width: D
2938
+ ref: he,
2939
+ className: `bailey-chat-panel${w ? ` ${w}` : ""}`,
2940
+ style: T !== void 0 || E !== void 0 ? {
2941
+ height: T,
2942
+ width: E
2943
2943
  } : void 0,
2944
2944
  children: [/* @__PURE__ */ y("div", {
2945
2945
  className: "bailey-chat-panel-inner",
2946
- ref: me,
2946
+ ref: ge,
2947
2947
  children: [
2948
2948
  /* @__PURE__ */ y("div", {
2949
2949
  className: "bailey-chat-transcript",
2950
- ref: q,
2951
- "data-suggestions-align": Z && c && c.length > 0 ? l : void 0,
2950
+ ref: G,
2951
+ "data-suggestions-align": Oe && c && c.length > 0 ? l : void 0,
2952
2952
  children: [
2953
2953
  e.hasEarlier && e.loadEarlier && /* @__PURE__ */ y("div", {
2954
2954
  className: "bailey-load-earlier",
@@ -2956,32 +2956,32 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
2956
2956
  type: "button",
2957
2957
  className: "bailey-load-earlier-button",
2958
2958
  disabled: e.historyStatus === "loading",
2959
- onClick: Q,
2960
- children: H.loadEarlierButtonText
2959
+ onClick: je,
2960
+ children: B.loadEarlierButtonText
2961
2961
  }), e.historyStatus === "error" && /* @__PURE__ */ v("div", {
2962
2962
  role: "alert",
2963
2963
  className: "bailey-load-earlier-error",
2964
- children: H.loadEarlierErrorText
2964
+ children: B.loadEarlierErrorText
2965
2965
  })]
2966
2966
  }),
2967
- Z && (c && c.length > 0 ? /* @__PURE__ */ y("div", {
2967
+ Oe && (c && c.length > 0 ? /* @__PURE__ */ y("div", {
2968
2968
  className: "bailey-suggestions",
2969
2969
  "data-align": l,
2970
- children: [H.suggestionsTitle && /* @__PURE__ */ v("div", {
2970
+ children: [B.suggestionsTitle && /* @__PURE__ */ v("div", {
2971
2971
  className: "bailey-suggestions-title",
2972
- children: H.suggestionsTitle
2972
+ children: B.suggestionsTitle
2973
2973
  }), c.map((e, t) => /* @__PURE__ */ y("button", {
2974
2974
  type: "button",
2975
2975
  onClick: () => ke(e.value ?? e.label),
2976
2976
  className: "bailey-suggestion-card",
2977
- children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(Pt, { className: "bailey-suggestion-icon" })]
2977
+ children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(Ft, { className: "bailey-suggestion-icon" })]
2978
2978
  }, `${e.label}-${t}`))]
2979
2979
  }) : /* @__PURE__ */ v("div", {
2980
2980
  className: "bailey-empty-state",
2981
- children: H.emptyStateMessage
2981
+ children: B.emptyStateMessage
2982
2982
  })),
2983
2983
  N.map((t, r) => {
2984
- let i = t.role === "assistant" && r === N.length - 1, a = F === "streaming" && i && t.content === "", s = t.role === "assistant" ? pt(P, t.createdAt) : [], c = s.some((e) => e.status === "running");
2984
+ let i = t.role === "assistant" && r === N.length - 1, a = F === "streaming" && i && t.content === "", s = t.role === "assistant" ? mt(P, t.createdAt) : [], c = s.some((e) => e.status === "running");
2985
2985
  return /* @__PURE__ */ v("div", {
2986
2986
  className: t.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
2987
2987
  children: t.role === "user" ? /* @__PURE__ */ y("div", {
@@ -2990,47 +2990,47 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
2990
2990
  className: "bailey-message-meta",
2991
2991
  children: [/* @__PURE__ */ v("span", {
2992
2992
  className: "bailey-message-meta-name",
2993
- children: H.youLabel
2994
- }), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: fe(t.createdAt) })]
2993
+ children: B.youLabel
2994
+ }), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: me(t.createdAt) })]
2995
2995
  }), /* @__PURE__ */ v("div", {
2996
2996
  className: "bailey-user-bubble",
2997
2997
  children: t.content
2998
2998
  })]
2999
- }) : a ? c ? /* @__PURE__ */ v(gn, {
2999
+ }) : a ? c ? /* @__PURE__ */ v(_n, {
3000
3000
  steps: s,
3001
3001
  resolveActivityIcon: C
3002
3002
  }) : /* @__PURE__ */ y("div", {
3003
3003
  className: "bailey-thinking-hint",
3004
- children: [/* @__PURE__ */ v("span", { children: Ce ?? H.thinkingHint }), /* @__PURE__ */ v("span", {
3004
+ children: [/* @__PURE__ */ v("span", { children: we ?? B.thinkingHint }), /* @__PURE__ */ v("span", {
3005
3005
  className: "bailey-step-spinner",
3006
3006
  "aria-hidden": "true"
3007
3007
  })]
3008
3008
  }) : /* @__PURE__ */ y("div", {
3009
3009
  className: "bailey-assistant-message",
3010
3010
  children: [
3011
- !t.streaming && /* @__PURE__ */ v(_n, {
3011
+ !t.streaming && /* @__PURE__ */ v(vn, {
3012
3012
  steps: s,
3013
- labels: H,
3013
+ labels: B,
3014
3014
  resolveActivityIcon: C
3015
3015
  }),
3016
- /* @__PURE__ */ v(Wn, {
3016
+ /* @__PURE__ */ v(Gn, {
3017
3017
  content: t.content,
3018
- components: xe
3018
+ components: Se
3019
3019
  }),
3020
- t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(on, {
3020
+ t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(sn, {
3021
3021
  src: e.src,
3022
3022
  alt: e.alt
3023
- }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: te ? te(e) : /* @__PURE__ */ v(pn, {
3023
+ }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: te ? te(e) : /* @__PURE__ */ v(mn, {
3024
3024
  ...e,
3025
- title: e.title ?? H.mcpAppDefaultTitle
3025
+ title: e.title ?? B.mcpAppDefaultTitle
3026
3026
  }) }, t) : null),
3027
- t.streaming && /* @__PURE__ */ v(gn, {
3027
+ t.streaming && /* @__PURE__ */ v(_n, {
3028
3028
  steps: s,
3029
3029
  resolveActivityIcon: C
3030
3030
  }),
3031
- t.streaming && De && !c && /* @__PURE__ */ y("div", {
3031
+ t.streaming && X && !c && /* @__PURE__ */ y("div", {
3032
3032
  className: "bailey-streaming-hint",
3033
- children: [/* @__PURE__ */ v("span", { children: De }), /* @__PURE__ */ v("span", {
3033
+ children: [/* @__PURE__ */ v("span", { children: X }), /* @__PURE__ */ v("span", {
3034
3034
  className: "bailey-step-spinner",
3035
3035
  "aria-hidden": "true"
3036
3036
  })]
@@ -3038,15 +3038,15 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
3038
3038
  !t.streaming && /* @__PURE__ */ y("div", {
3039
3039
  className: "bailey-message-actions",
3040
3040
  children: [
3041
- /* @__PURE__ */ v(Yt, {
3041
+ /* @__PURE__ */ v(Xt, {
3042
3042
  markdown: t.content,
3043
- ariaLabel: H.copyButtonAriaLabel,
3044
- tooltipDefaultText: H.copyButtonTooltipDefault,
3045
- tooltipCopiedText: H.copyButtonTooltipCopied
3043
+ ariaLabel: B.copyButtonAriaLabel,
3044
+ tooltipDefaultText: B.copyButtonTooltipDefault,
3045
+ tooltipCopiedText: B.copyButtonTooltipCopied
3046
3046
  }),
3047
- k !== !1 && e.feedback && e.conversationId && t.serverMessageId && !le.has(t.serverMessageId) && /* @__PURE__ */ v(At.Provider, {
3048
- value: V,
3049
- children: /* @__PURE__ */ v(Rn, {
3047
+ k !== !1 && e.feedback && e.conversationId && t.serverMessageId && !ue.has(t.serverMessageId) && /* @__PURE__ */ v(jt.Provider, {
3048
+ value: pe,
3049
+ children: /* @__PURE__ */ v(zn, {
3050
3050
  ...k,
3051
3051
  assistantName: o,
3052
3052
  messageId: t.serverMessageId,
@@ -3055,14 +3055,14 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
3055
3055
  onClear: e.feedback.onClear
3056
3056
  })
3057
3057
  }),
3058
- ee?.(t)
3058
+ O?.(t)
3059
3059
  ]
3060
3060
  })
3061
3061
  ]
3062
3062
  })
3063
3063
  }, t.id);
3064
3064
  }),
3065
- /* @__PURE__ */ v("div", { ref: K })
3065
+ /* @__PURE__ */ v("div", { ref: W })
3066
3066
  ]
3067
3067
  }),
3068
3068
  I && /* @__PURE__ */ y("div", {
@@ -3074,17 +3074,17 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
3074
3074
  type: "button",
3075
3075
  onClick: ae,
3076
3076
  className: "bailey-retry-button",
3077
- children: H.retryButtonText
3077
+ children: B.retryButtonText
3078
3078
  }), /* @__PURE__ */ v("button", {
3079
3079
  type: "button",
3080
3080
  onClick: se,
3081
- "aria-label": H.dismissErrorAriaLabel,
3081
+ "aria-label": B.dismissErrorAriaLabel,
3082
3082
  className: "bailey-dismiss-button",
3083
3083
  children: "✕"
3084
3084
  })]
3085
3085
  })]
3086
3086
  }),
3087
- !O && /* @__PURE__ */ v(an, {
3087
+ !D && /* @__PURE__ */ v(on, {
3088
3088
  events: P,
3089
3089
  lastRequest: re,
3090
3090
  onClear: oe
@@ -3093,16 +3093,16 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
3093
3093
  className: "bailey-input-area",
3094
3094
  children: [/* @__PURE__ */ y("form", {
3095
3095
  onSubmit: (e) => {
3096
- e.preventDefault(), z.trim() && F !== "streaming" && (ke(z), ce(""));
3096
+ e.preventDefault(), R.trim() && F !== "streaming" && (ke(R), le(""));
3097
3097
  },
3098
3098
  className: "bailey-input-row",
3099
3099
  children: [/* @__PURE__ */ v("input", {
3100
- ref: he,
3100
+ ref: _e,
3101
3101
  type: "text",
3102
- placeholder: Oe,
3103
- "aria-label": Oe,
3104
- value: z,
3105
- onChange: (e) => ce(e.target.value),
3102
+ placeholder: Z,
3103
+ "aria-label": Z,
3104
+ value: R,
3105
+ onChange: (e) => le(e.target.value),
3106
3106
  disabled: F === "streaming",
3107
3107
  className: "bailey-input"
3108
3108
  }), F === "streaming" ? /* @__PURE__ */ v(g.Provider, {
@@ -3112,80 +3112,80 @@ function Jn({ chat: e, placeholder: t, replyPlaceholder: r, emptyPlaceholder: i,
3112
3112
  children: /* @__PURE__ */ v("button", {
3113
3113
  type: "button",
3114
3114
  onClick: L,
3115
- "aria-label": H.stopAriaLabel,
3115
+ "aria-label": B.stopAriaLabel,
3116
3116
  className: "bailey-stop-button",
3117
- children: /* @__PURE__ */ v(Nt, { className: "bailey-stop-icon" })
3117
+ children: /* @__PURE__ */ v(Pt, { className: "bailey-stop-icon" })
3118
3118
  })
3119
3119
  }), /* @__PURE__ */ v(g.Portal, {
3120
- container: G instanceof ShadowRoot ? G : void 0,
3120
+ container: U instanceof ShadowRoot ? U : void 0,
3121
3121
  children: /* @__PURE__ */ y(g.Content, {
3122
3122
  side: "top",
3123
3123
  className: "bailey-tooltip-content",
3124
- children: [H.stopButtonText, /* @__PURE__ */ v(g.Arrow, { className: "bailey-tooltip-arrow" })]
3124
+ children: [B.stopButtonText, /* @__PURE__ */ v(g.Arrow, { className: "bailey-tooltip-arrow" })]
3125
3125
  })
3126
3126
  })] })
3127
3127
  }) : /* @__PURE__ */ v("button", {
3128
3128
  type: "submit",
3129
- "aria-label": H.sendAriaLabel,
3130
- disabled: !z.trim(),
3129
+ "aria-label": B.sendAriaLabel,
3130
+ disabled: !R.trim(),
3131
3131
  className: "bailey-send-button",
3132
- children: w ?? /* @__PURE__ */ v(Mt, { className: "bailey-send-icon" })
3132
+ children: ee ?? /* @__PURE__ */ v(Nt, { className: "bailey-send-icon" })
3133
3133
  })]
3134
- }), !m && (!Z || ye) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
3134
+ }), !m && (!Oe || xe) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
3135
3135
  asChild: !0,
3136
3136
  children: /* @__PURE__ */ v("button", {
3137
3137
  type: "button",
3138
- ref: ge,
3139
- "aria-label": H.menuAriaLabel,
3138
+ ref: ve,
3139
+ "aria-label": B.menuAriaLabel,
3140
3140
  className: "bailey-menu-button",
3141
- children: /* @__PURE__ */ v(zt, { className: "bailey-menu-icon" })
3141
+ children: /* @__PURE__ */ v(Bt, { className: "bailey-menu-icon" })
3142
3142
  })
3143
3143
  }), /* @__PURE__ */ v(h.Portal, {
3144
- container: G instanceof ShadowRoot ? G : void 0,
3144
+ container: U instanceof ShadowRoot ? U : void 0,
3145
3145
  children: /* @__PURE__ */ y(h.Content, {
3146
3146
  side: "top",
3147
3147
  align: "end",
3148
3148
  sideOffset: 8,
3149
3149
  className: "bailey-menu-content",
3150
3150
  onCloseAutoFocus: (e) => {
3151
- ve.current &&= (e.preventDefault(), !1);
3151
+ H.current &&= (e.preventDefault(), !1);
3152
3152
  },
3153
- children: [!Z && /* @__PURE__ */ y(h.Item, {
3154
- onSelect: () => R(),
3153
+ children: [!Oe && /* @__PURE__ */ y(h.Item, {
3154
+ onSelect: () => ce(),
3155
3155
  className: "bailey-menu-item",
3156
- children: [/* @__PURE__ */ v(Bt, { className: "bailey-menu-item-icon" }), H.newChatButtonText]
3157
- }), ye && /* @__PURE__ */ y(h.Item, {
3156
+ children: [/* @__PURE__ */ v(Vt, { className: "bailey-menu-item-icon" }), B.newChatButtonText]
3157
+ }), xe && /* @__PURE__ */ y(h.Item, {
3158
3158
  onSelect: () => {
3159
- _ ? _() : (ve.current = !0, _e(!0));
3159
+ _ ? _() : (H.current = !0, be(!0));
3160
3160
  },
3161
3161
  className: "bailey-menu-item",
3162
- children: [/* @__PURE__ */ v(Lt, { className: "bailey-menu-item-icon" }), H.historyMenuItemText]
3162
+ children: [/* @__PURE__ */ v(Rt, { className: "bailey-menu-item-icon" }), B.historyMenuItemText]
3163
3163
  })]
3164
3164
  })
3165
3165
  })] })]
3166
3166
  }),
3167
- (Z || S?.alwaysVisible) && S && /* @__PURE__ */ v("div", {
3167
+ (Oe || S?.alwaysVisible) && S && /* @__PURE__ */ v("div", {
3168
3168
  className: "bailey-privacy-note",
3169
3169
  children: /* @__PURE__ */ v(p, {
3170
- remarkPlugins: Hn,
3171
- components: Un,
3170
+ remarkPlugins: Un,
3171
+ components: Wn,
3172
3172
  skipHtml: !0,
3173
3173
  children: S.markdown
3174
3174
  })
3175
3175
  })
3176
3176
  ]
3177
- }), U && b && !_ && /* @__PURE__ */ v(Tn, {
3177
+ }), ye && b && !_ && /* @__PURE__ */ v(En, {
3178
3178
  client: b.client,
3179
3179
  pageSize: b.pageSize,
3180
3180
  chat: e,
3181
- labels: H,
3181
+ labels: B,
3182
3182
  locale: x,
3183
- onClose: je
3183
+ onClose: Q
3184
3184
  })]
3185
3185
  })
3186
3186
  })
3187
3187
  });
3188
3188
  }
3189
3189
  // src/index.ts
3190
- var Yn = "0.3.1-pre.2";
3191
- export { Rt as ActivityIcon, Pt as ArrowUpRightIcon, Yn as BAILEYAI_CHAT_UI_VERSION, Ue as BAILEY_CHART_PROMPT_FRAGMENT, Fe as BAILEY_TABLE_GRID_ROW_THRESHOLD, j as BaileyApiError, Jn as BaileyChatPanel, M as BaileyCleanupError, Rn as BaileyFeedbackButtons, Tn as BaileyHistoryDrawer, an as BaileyTracePanel, Yt as CopyMarkdownButton, oe as DEFAULT_CONVERSATION_STORAGE_KEY, Mt as HeartIcon, Ze as TRACE_KIND_LABEL, Wt as ThumbDownIcon, Ut as ThumbUpIcon, je as createBaileyClient, ae as createBaileyFeedbackHandlers, jt as createBaileyMarkdownComponents, R as createMemoryConversationStorage, se as createSessionConversationStorage, ee as extractPseudoToolCalls, Ve as extractTableData, wn as formatRelativeTime, st as formatTraceGap, ot as formatTraceTime, dt as hasTraceFailure, L as isConversationIdForSub, e as isSafeMarkdownUrl, $ as joinInstructions, F as mapTranscript, ie as mergeEarlierPage, Xe as parseBaileyChartSpec, A as parseSseFrames, Pe as resolveToolCall, He as shouldUseGrid, ft as toActivityLines, pt as toToolSteps, ct as toTraceRows, ut as toTraceSegments, tt as traceEventArgsDetail, at as traceEventHint, nt as traceEventOutputDetail, it as traceEventRawDetail, et as traceEventSummary, $e as traceEventToolName, lt as traceSummaryLine, ge as useBaileyChat, _e as useBaileyConversations };
3190
+ var Xn = "0.3.1-pre.2";
3191
+ export { zt as ActivityIcon, Ft as ArrowUpRightIcon, Xn as BAILEYAI_CHAT_UI_VERSION, We as BAILEY_CHART_PROMPT_FRAGMENT, Ie as BAILEY_TABLE_GRID_ROW_THRESHOLD, j as BaileyApiError, Yn as BaileyChatPanel, M as BaileyCleanupError, zn as BaileyFeedbackButtons, En as BaileyHistoryDrawer, on as BaileyTracePanel, Xt as CopyMarkdownButton, oe as DEFAULT_CONVERSATION_STORAGE_KEY, Nt as HeartIcon, Qe as TRACE_KIND_LABEL, Gt as ThumbDownIcon, Wt as ThumbUpIcon, Me as createBaileyClient, ae as createBaileyFeedbackHandlers, Mt as createBaileyMarkdownComponents, ce as createMemoryConversationStorage, se as createSessionConversationStorage, O as extractPseudoToolCalls, He as extractTableData, Tn as formatRelativeTime, ct as formatTraceGap, st as formatTraceTime, ft as hasTraceFailure, L as isConversationIdForSub, e as isSafeMarkdownUrl, $ as joinInstructions, F as mapTranscript, ie as mergeEarlierPage, Ze as parseBaileyChartSpec, A as parseSseFrames, Fe as resolveToolCall, Ue as shouldUseGrid, pt as toActivityLines, mt as toToolSteps, lt as toTraceRows, dt as toTraceSegments, nt as traceEventArgsDetail, ot as traceEventHint, rt as traceEventOutputDetail, at as traceEventRawDetail, tt as traceEventSummary, et as traceEventToolName, ut as traceSummaryLine, ye as useBaileyChat, V as useBaileyConversations };