@icanbwell/baileyai-chat-ui 1.0.29 → 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,9 +6,9 @@ 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", ee = RegExp(`<(${b})>([\\s\\S]*?)<\\/\\1>`, "g"), x = RegExp(`<(?:${b})>[\\s\\S]*$`), S = /<name>([\s\S]*?)<\/name>/, C = /<arguments>([\s\S]*?)<\/arguments>/, w = /<invoke\s+name="([^"]*)"\s*>([\s\S]*?)<\/invoke>/g, T = /<parameter\s+name="([^"]*)"\s*>([\s\S]*?)<\/parameter>/g;
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
10
  function E(e) {
11
- let t = S.exec(e)?.[1]?.trim() || "unknown_tool", n = C.exec(e)?.[1]?.trim();
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
@@ -32,13 +32,13 @@ function D(e) {
32
32
  return t;
33
33
  }
34
34
  function O(e, t = {}) {
35
- let { hideOpenBlock: n = !0 } = t, r = [], i = e.replace(ee, (e, t, n) => (t === "call_tool" ? r.push(E(n)) : t === "search_tools" ? r.push({
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
38
  }) : t === "function_calls" ? r.push(...D(n)) : r.push({
39
39
  name: "function_result",
40
40
  args: n.trim()
41
- }), "")), a = n ? i.replace(x, "") : i;
41
+ }), "")), a = n ? i.replace(S, "") : i;
42
42
  return r.length === 0 && a === i ? {
43
43
  cleanedText: i,
44
44
  matches: r
@@ -108,44 +108,44 @@ var j = class extends Error {
108
108
  status;
109
109
  kind;
110
110
  constructor(e) {
111
- super(e.message ?? M(e), e.cause === void 0 ? void 0 : { cause: e.cause }), this.name = "BaileyApiError", this.status = e.status, this.kind = e.kind;
111
+ super(e.message ?? ne(e), e.cause === void 0 ? void 0 : { cause: e.cause }), this.name = "BaileyApiError", this.status = e.status, this.kind = e.kind;
112
112
  }
113
113
  };
114
- function M(e) {
114
+ function te(e, t = "Bailey") {
115
115
  switch (e.kind) {
116
- case "http": return `Bailey request failed (status ${e.status})`;
117
- case "timeout": return "Bailey request timed out";
118
- case "aborted": return "Bailey request aborted";
119
- case "invalid-response": return `Bailey returned an unreadable response (status ${e.status})`;
120
- default: return "Bailey request failed (network error)";
116
+ case "http": return `${t} request failed (status ${e.status})`;
117
+ case "timeout": return `${t} request timed out`;
118
+ case "aborted": return `${t} request aborted`;
119
+ case "invalid-response": return `${t} returned an unreadable response (status ${e.status})`;
120
+ default: return `${t} request failed (network error)`;
121
121
  }
122
122
  }
123
- var N = class extends Error {
123
+ var ne = (e) => te(e), M = class extends Error {
124
124
  operation;
125
125
  constructor(e) {
126
126
  super(`Bailey cleanup failed (${e.operation})`), this.name = "BaileyCleanupError", this.operation = e.operation;
127
127
  }
128
- }, P = {
128
+ }, N = {
129
129
  inaccurate: !0,
130
130
  unhelpful: !0,
131
131
  unsafe: !0,
132
132
  too_long: !0,
133
133
  other: !0
134
- }, F = (e) => Object.hasOwn(P, e) ? e : "other";
135
- function I(e) {
134
+ }, P = (e) => Object.hasOwn(N, e) ? e : "other";
135
+ function re(e) {
136
136
  if (!e || e.rating !== "up" && e.rating !== "down") return;
137
- let t = (e.reasonCodes ?? []).map(F);
137
+ let t = (e.reasonCodes ?? []).map(P);
138
138
  return {
139
139
  rating: e.rating,
140
140
  ...t.length > 0 ? { reasonCodes: t } : {},
141
141
  ...e.comment ? { comment: e.comment } : {}
142
142
  };
143
143
  }
144
- function te(e) {
144
+ function F(e) {
145
145
  let t = [];
146
146
  return e.messages.forEach((e, n) => {
147
147
  if (e.hidden || e.role !== "user" && e.role !== "assistant") return;
148
- let r = Date.parse(e.createdAt), i = Number.isNaN(r) ? void 0 : r, a = e.messageId || `loaded-${n}-${e.role}-${i ?? 0}`, o = e.role === "assistant" ? I(e.feedback) : void 0;
148
+ let r = Date.parse(e.createdAt), i = Number.isNaN(r) ? void 0 : r, a = e.messageId || `loaded-${n}-${e.role}-${i ?? 0}`, o = e.role === "assistant" ? re(e.feedback) : void 0;
149
149
  t.push({
150
150
  id: a,
151
151
  role: e.role,
@@ -157,9 +157,9 @@ function te(e) {
157
157
  });
158
158
  }), t;
159
159
  }
160
- var ne = (e) => e.serverMessageId ?? e.id;
161
- function re(e) {
162
- let t = new Set(e.current.map(ne)), n = e.earlier.filter((e) => !t.has(ne(e)));
160
+ var I = (e) => e.serverMessageId ?? e.id;
161
+ function ie(e) {
162
+ let t = new Set(e.current.map(I)), n = e.earlier.filter((e) => !t.has(I(e)));
163
163
  return n.length === 0 ? e.current : [...n, ...e.current];
164
164
  }
165
165
  // src/logic/conversationId.ts
@@ -170,7 +170,7 @@ function L(e) {
170
170
  return e.conversationId.startsWith(n) && e.conversationId.length > n.length;
171
171
  }
172
172
  // src/client/feedbackHandlers.ts
173
- function ie(e) {
173
+ function ae(e) {
174
174
  let { client: t, getConversationId: n } = e, r = () => {
175
175
  let e = n();
176
176
  if (!e) throw Error("no conversation id");
@@ -197,15 +197,15 @@ function ie(e) {
197
197
  };
198
198
  }
199
199
  // src/logic/conversationStorage.ts
200
- var ae = "baileyai-chat-ui:conversation";
201
- function R() {
200
+ var oe = "baileyai-chat-ui:conversation";
201
+ function se() {
202
202
  return {
203
203
  get: (e) => window.sessionStorage.getItem(e),
204
204
  set: (e, t) => window.sessionStorage.setItem(e, t),
205
205
  remove: (e) => window.sessionStorage.removeItem(e)
206
206
  };
207
207
  }
208
- function z() {
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 z() {
214
214
  };
215
215
  }
216
216
  // src/logic/useBaileyChat.ts
217
- var B = 200, oe = 100, se = 15e4, ce = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`, le = (e, t, n) => {
218
- if (e === 401 || e === 403) return "Bailey isn't reachable with your current login.";
219
- let r = `Bailey request failed (status ${e ?? "network error"}).`, i = (n || t || "").trim();
220
- return i ? `${r} ${i.length > B ? `${i.slice(0, B)}…` : i}` : 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
+ if (t === 401 || t === 403) return `${e} isn't reachable with your current login.`;
219
+ let i = `${e} request failed (status ${t ?? "network error"}).`, a = (r || n || "").trim();
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,139 +227,139 @@ function V(e, t, n) {
227
227
  return;
228
228
  }
229
229
  }
230
- function ue(e, t) {
230
+ function me(e, t) {
231
231
  t.signal.aborted || typeof e != "string" || (t.historyStatus = e);
232
232
  }
233
- function de(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 H(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 U = (e, t) => t ? `${e}:${t}` : e;
248
- function fe(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
- H(r, i, a);
261
+ ge(r, i, a);
262
262
  }
263
263
  }
264
- var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i, firstUserMessagePrefix: o, onAssistantMessageComplete: c, idleTimeoutMs: l = se, client: p, conversationId: m, sub: h, storage: g, storageKey: _ = ae, sendFullTranscript: v = !1, onStorageError: y, onContextLoss: b }) => {
265
- let [ee, x] = f([]), [S, C] = f([]), [w, T] = f(null), [E, D] = f("idle"), [k, M] = f(null), N = h !== void 0 && h.trim() === "", P = N ? void 0 : h?.trim() || void 0, F = u(() => R(), []), I = N ? null : g === void 0 ? F : g || null, ne = d(y), z = d(b);
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
- ne.current = y, z.current = b;
268
- }, [y, b]);
267
+ ce.current = b, R.current = x;
268
+ }, [b, x]);
269
269
  let B = a((e, t) => {
270
270
  try {
271
- ne.current?.(e, t);
271
+ ce.current?.(e, t);
272
272
  } catch {}
273
- }, []), V = (e) => fe({
274
- seed: m,
273
+ }, []), ye = (e) => ve({
274
+ seed: h,
275
275
  sub: P,
276
276
  storage: I,
277
- key: U(_, P),
277
+ key: _e(v, P),
278
278
  report: e
279
- }), [W] = f(() => {
279
+ }), [be] = f(() => {
280
280
  let e = [];
281
281
  return {
282
- id: V((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
- }), [pe, G] = f(W.id), [me, he] = f(W.errors.length > 0), K = a((e, t) => {
289
- he(!0), B(e, t);
288
+ }), [V, H] = f(be.id), [xe, U] = f(be.errors.length > 0), W = a((e, t) => {
289
+ U(!0), B(e, t);
290
290
  }, [B]);
291
291
  s(() => {
292
- W.errors.forEach(({ error: e, operation: t }) => B(e, t));
293
- }, [W, B]), s(() => {
292
+ be.errors.forEach(({ error: e, operation: t }) => B(e, t));
293
+ }, [be, B]), s(() => {
294
294
  N && B(/* @__PURE__ */ Error("sub is blank"), "key");
295
295
  }, [N, B]);
296
- let q = d(pe), J = d({
296
+ let G = d(V), K = d({
297
297
  storage: I,
298
- key: U(_, P),
298
+ key: _e(v, P),
299
299
  sub: P,
300
- sendFullTranscript: v
300
+ sendFullTranscript: y
301
301
  });
302
302
  s(() => {
303
- J.current = {
303
+ K.current = {
304
304
  storage: I,
305
- key: U(_, P),
305
+ key: _e(v, P),
306
306
  sub: P,
307
- sendFullTranscript: v
307
+ sendFullTranscript: y
308
308
  };
309
309
  }, [
310
310
  I,
311
- _,
311
+ v,
312
312
  P,
313
- v
313
+ y
314
314
  ]);
315
- let ge = g === !1 ? "off" : me || N ? "degraded" : "ok", [_e, ve] = f(!1), [ye, Y] = f("idle"), [be, xe] = f(!1), Se = d(0), Ce = d(null), we = d(null), X = d(!1), Z = a(() => {
316
- Se.current += 1, Ce.current?.abort(), Ce.current = null, we.current = null, X.current = !1, xe(!1), Y("idle");
317
- }, []), Te = d(p);
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
- Te.current = p;
320
- }, [p]), s(() => () => Ce.current?.abort(), []);
321
- let Ee = d(null), De = d(""), Oe = d(0), ke = d([]);
319
+ ke.current = m;
320
+ }, [m]), s(() => () => Y.current?.abort(), []);
321
+ let Ae = d(null), je = d(""), Q = d(0), Me = d([]);
322
322
  s(() => {
323
- ke.current = ee;
324
- }, [ee]);
325
- let Q = d([]), Ae = d(/* @__PURE__ */ new Map()), je = d(/* @__PURE__ */ new Map()), Me = d(null), $ = a(() => {
326
- Me.current !== null && (clearTimeout(Me.current), Me.current = null);
327
- }, []), Ne = a((e) => {
328
- $(), Me.current = setTimeout(() => {
323
+ Me.current = S;
324
+ }, [S]);
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
- }, l);
331
- }, [$, l]);
330
+ }, p);
331
+ }, [Ie, p]);
332
332
  s(() => () => {
333
- Ee.current?.abort(), $();
334
- }, [$]);
335
- let Pe = 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 === q.current) return;
341
- let { sub: r, storage: i, key: a } = J.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
- })) && (q.current = e, G(e), de(i, a, e, K));
346
- }, [K]), Fe = 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), C((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 = Ae.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
357
  let { cleanedText: r, matches: a } = O(n.raw), o = r.trim(), s = a.slice(n.emittedCount);
358
- if (n.emittedCount = a.length, Ae.current.set(e, n), je.current.set(e, o), x((t) => t.map((t) => t.id === e ? {
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) {
362
- let e = Date.now(), t = Oe.current;
362
+ let e = Date.now(), t = Q.current;
363
363
  s.forEach((n) => i({
364
364
  kind: "pseudo_tool_call",
365
365
  name: n.name,
@@ -372,7 +372,7 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
372
372
  }
373
373
  if (t.type === "response.output_item.added" || t.type === "response.output_item.done") {
374
374
  let n = t.item;
375
- if (n.type === "output_image") return n.image_url && x((t) => t.map((t) => t.id === e ? {
375
+ if (n.type === "output_image") return n.image_url && C((t) => t.map((t) => t.id === e ? {
376
376
  ...t,
377
377
  parts: [...t.parts ?? [], {
378
378
  type: "image",
@@ -380,7 +380,7 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
380
380
  }]
381
381
  } : t)), !0;
382
382
  if (n.type === "function_call" || n.type === "mcp_call") {
383
- let e = Date.now(), r = Oe.current, a = n.name || "unknown_tool";
383
+ let e = Date.now(), r = Q.current, a = n.name || "unknown_tool";
384
384
  return i(t.type === "response.output_item.added" ? {
385
385
  kind: "tool_start",
386
386
  name: a,
@@ -404,7 +404,7 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
404
404
  }), !0;
405
405
  }
406
406
  if (n.type === "llm_call") {
407
- let e = Date.now(), r = Oe.current;
407
+ let e = Date.now(), r = Q.current;
408
408
  return i(t.type === "response.output_item.added" ? {
409
409
  kind: "llm_call_start",
410
410
  request: n.request ?? [],
@@ -424,29 +424,29 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
424
424
  status: t.status,
425
425
  message: t.message,
426
426
  at: Date.now(),
427
- turnSentAt: Oe.current
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 Pe({
430
+ if (t.type === "response.created") return Re({
431
431
  reportedId: t.response?.conversation?.id,
432
432
  source: "event",
433
433
  turn: r
434
- }), ue(t.response?.conversation?.history_status, r), !1;
434
+ }), me(t.response?.conversation?.history_status, r), !1;
435
435
  if (t.type === "response.completed") {
436
- Pe({
436
+ Re({
437
437
  reportedId: t.response?.conversation?.id,
438
438
  source: "event",
439
439
  turn: r
440
- }), ue(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
- n && x((t) => t.map((t) => t.id === e ? {
442
+ n && C((t) => t.map((t) => t.id === e ? {
443
443
  ...t,
444
444
  serverMessageId: n
445
445
  } : t));
446
- let i = Ae.current.get(e);
446
+ let i = Ne.current.get(e);
447
447
  if (i) {
448
448
  let { cleanedText: t } = O(i.raw, { hideOpenBlock: !1 }), n = t.trim();
449
- n !== je.current.get(e) && (je.current.set(e, n), x((t) => t.map((t) => t.id === e ? {
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)));
@@ -457,7 +457,7 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
457
457
  kind: "info",
458
458
  message: t.message,
459
459
  at: Date.now(),
460
- turnSentAt: Oe.current
460
+ turnSentAt: Q.current
461
461
  }), !0;
462
462
  if (t.type === "mcp_app") {
463
463
  let n = t.resourceUri;
@@ -466,10 +466,10 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
466
466
  eventType: t.type,
467
467
  raw: JSON.stringify(t),
468
468
  at: Date.now(),
469
- turnSentAt: Oe.current
469
+ turnSentAt: Q.current
470
470
  }), !0;
471
471
  let { html: r, title: a, csp: o, permissions: s, prefersBorder: c, displayMode: l } = t;
472
- return x((t) => t.map((t) => t.id === e ? {
472
+ return C((t) => t.map((t) => t.id === e ? {
473
473
  ...t,
474
474
  parts: [...t.parts ?? [], {
475
475
  type: "mcp_app",
@@ -488,23 +488,23 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
488
488
  eventType: t.type,
489
489
  raw: JSON.stringify(t),
490
490
  at: Date.now(),
491
- turnSentAt: Oe.current
491
+ turnSentAt: Q.current
492
492
  }), !0;
493
- }, [Pe]), Ie = a(async (a) => {
494
- D("streaming"), M(null), ve(!1);
493
+ }, [Re]), Be = a(async (a) => {
494
+ k("streaming"), M(null), we(!1);
495
495
  let s = Date.now();
496
- Oe.current = s;
497
- let l = ce(), u = {
498
- id: l,
496
+ Q.current = s;
497
+ let u = fe(), d = {
498
+ id: u,
499
499
  role: "assistant",
500
500
  content: "",
501
501
  streaming: !0,
502
502
  createdAt: s
503
503
  };
504
- x((e) => [...e, u]), Q.current = [...a, u];
505
- let d = a.findIndex((e) => e.role === "user" && !e.hidden), f = a.map((e, t) => t === d && o ? {
504
+ C((e) => [...e, d]), $.current = [...a, d];
505
+ let f = a.findIndex((e) => e.role === "user" && !e.hidden), p = a.map((e, t) => t === f && c ? {
506
506
  role: e.role,
507
- content: `${o}${e.content}`,
507
+ content: `${c}${e.content}`,
508
508
  hidden: e.hidden,
509
509
  titleHint: e.titleHint
510
510
  } : {
@@ -512,13 +512,13 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
512
512
  content: e.content,
513
513
  hidden: e.hidden,
514
514
  titleHint: e.titleHint
515
- }), { sendFullTranscript: p } = J.current, m = p ? void 0 : q.current, h = m ? f.slice(-1) : f;
516
- T({
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
- messages: h,
520
- tools: r,
521
- toolChoice: i,
519
+ messages: g,
520
+ tools: i,
521
+ toolChoice: o,
522
522
  stream: !0,
523
523
  sentAt: s,
524
524
  streamStats: {
@@ -527,13 +527,13 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
527
527
  lastChunkAt: null
528
528
  }
529
529
  });
530
- let g = new AbortController();
531
- Ee.current = g, Ne(g);
532
- let _ = {
533
- signal: g.signal,
534
- heldId: m
535
- }, v = "", y = null, b = !1, ee = !1, S = !1, w = [], E = (e, t) => {
536
- D("error"), M(e);
530
+ let _ = new AbortController();
531
+ Ae.current = _, Le(_);
532
+ let v = {
533
+ signal: _.signal,
534
+ heldId: h
535
+ }, y = "", b = null, x = !1, S = !1, ee = !1, T = [], D = (e, t) => {
536
+ k("error"), M(e);
537
537
  let n = {
538
538
  kind: "error",
539
539
  message: e,
@@ -541,44 +541,44 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
541
541
  turnSentAt: s,
542
542
  ...t
543
543
  };
544
- w.push(n), C((e) => [...e, n]);
544
+ T.push(n), w((e) => [...e, n]);
545
545
  }, O = (e, t) => {
546
546
  e.forEach((e) => {
547
547
  if (e.type === "error") {
548
- y = e.message;
548
+ b = e.message;
549
549
  let t = {
550
550
  kind: "error",
551
551
  message: e.message,
552
552
  at: Date.now(),
553
553
  turnSentAt: s
554
554
  };
555
- w.push(t), C((e) => [...e, t]);
556
- } else e.type === "response.output_text.delta" && e.delta && (S = !0), Fe(l, e, w, _) && (ee = !0);
557
- }), t && (b = !0, x((e) => e.map((e) => e.id === l ? {
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
+ }), t && (x = !0, C((e) => e.map((e) => e.id === u ? {
558
558
  ...e,
559
559
  streaming: !1
560
560
  } : e)));
561
561
  };
562
562
  try {
563
- let { status: a, text: o, errorMessage: u, errorKind: d, interrupted: f } = await e.streamChat({
563
+ let { status: a, text: c, errorMessage: d, errorKind: f, interrupted: p } = await e.streamChat({
564
564
  model: t,
565
565
  instructions: n,
566
- input: h,
567
- tools: r,
568
- toolChoice: i,
569
- ...m ? { conversationId: m } : {},
570
- onConversationId: (e) => Pe({
566
+ input: g,
567
+ tools: i,
568
+ toolChoice: o,
569
+ ...h ? { conversationId: h } : {},
570
+ onConversationId: (e) => Re({
571
571
  reportedId: e,
572
572
  source: "header",
573
- turn: _
573
+ turn: v
574
574
  }),
575
- signal: g.signal,
575
+ signal: _.signal,
576
576
  onChunk: (e) => {
577
- Ne(g), v += e;
578
- let { events: t, remainder: n, done: r } = A(v);
579
- v = n, O(t, r);
577
+ Le(_), y += e;
578
+ let { events: t, remainder: n, done: r } = A(y);
579
+ y = n, O(t, r);
580
580
  let i = Date.now();
581
- T((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,91 +588,91 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
588
588
  } : e);
589
589
  },
590
590
  onRequestId: (e) => {
591
- T((t) => t && t.sentAt === s ? {
591
+ E((t) => t && t.sentAt === s ? {
592
592
  ...t,
593
593
  requestId: e
594
594
  } : t);
595
595
  },
596
596
  onMessageId: (e) => {
597
- typeof e == "string" && e && x((t) => t.map((t) => t.id === l ? {
597
+ typeof e == "string" && e && C((t) => t.map((t) => t.id === u ? {
598
598
  ...t,
599
599
  serverMessageId: e
600
600
  } : t));
601
601
  }
602
602
  });
603
- if (v.trim()) {
604
- let { events: e, done: t } = A(`${v}\n\n`);
605
- v = "", O(e, t);
603
+ if (y.trim()) {
604
+ let { events: e, done: t } = A(`${y}\n\n`);
605
+ y = "", O(e, t);
606
606
  }
607
- if (y) {
608
- D("error"), M(y);
607
+ if (b) {
608
+ k("error"), M(b);
609
609
  return;
610
610
  }
611
- if (d === "timeout" && !b) {
612
- E(u || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
611
+ if (f === "timeout" && !x) {
612
+ D(d || "The assistant took too long to respond. Please try again.", { source: "client-timeout" });
613
613
  return;
614
614
  }
615
- if (f && !b) {
616
- E("The connection was interrupted before the answer finished. Try again.");
615
+ if (p && !x) {
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
- E(le(a, o, u), {
620
+ D(pe(r, a, c, d), {
621
621
  httpStatus: a,
622
- rawBody: o || void 0
622
+ rawBody: c || void 0
623
623
  });
624
624
  return;
625
625
  }
626
- let p = _.reportedId, C = p !== m, k = _.historyStatus === "failed" || _.historyStatus === "empty";
627
- if (m && !_.signal.aborted && (C || k)) {
628
- q.current = void 0, G(void 0), H(J.current.storage, J.current.key, K), Z(), ve(!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?.({
631
- sentId: m,
632
- ...p ? { reportedId: p } : {},
633
- reason: C ? "id" : "history"
630
+ R.current?.({
631
+ sentId: h,
632
+ ...m ? { reportedId: m } : {},
633
+ reason: w ? "id" : "history"
634
634
  });
635
635
  } catch {}
636
636
  }
637
- if (!ee) {
638
- E("Bailey returned an empty response.");
637
+ if (!S) {
638
+ D(`${r} returned an empty response.`);
639
639
  return;
640
640
  }
641
- if (!S) {
642
- E("Bailey 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
- D("idle");
646
- let j = je.current.get(l) ?? "";
647
- T((e) => e && e.sentAt === s ? {
645
+ k("idle");
646
+ let te = Pe.current.get(u) ?? "";
647
+ E((e) => e && e.sentAt === s ? {
648
648
  ...e,
649
- response: { content: j }
650
- } : e), c && await c({
651
- id: l,
649
+ response: { content: te }
650
+ } : e), l && await l({
651
+ id: u,
652
652
  role: "assistant",
653
- content: j,
653
+ content: te,
654
654
  streaming: !1
655
- }, w);
655
+ }, T);
656
656
  } catch (e) {
657
657
  let t = e;
658
658
  if (t?.name === "TimeoutError") {
659
- E(t.message, { source: "client-timeout" });
659
+ D(t.message, { source: "client-timeout" });
660
660
  return;
661
661
  }
662
662
  if (t?.name === "AbortError") {
663
- D("idle");
663
+ k("idle");
664
664
  return;
665
665
  }
666
- E(t?.message || "Bailey request failed.");
666
+ D(t instanceof j ? te(t, r) : t?.message || `${r} request failed.`);
667
667
  } finally {
668
- $();
669
- let e = je.current.get(l) ?? "";
670
- Ae.current.delete(l), je.current.delete(l);
671
- let t = w.some((e) => e.kind === "tool_start" || e.kind === "tool_end");
672
- x((e) => e.flatMap((e) => e.id === l ? e.content || t ? [{
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
+ C((e) => e.flatMap((e) => e.id === u ? e.content || t ? [{
673
673
  ...e,
674
674
  streaming: !1
675
- }] : [] : [e])), Q.current = Q.current.flatMap((t) => t.id === l ? e ? [{
675
+ }] : [] : [e])), $.current = $.current.flatMap((t) => t.id === u ? e ? [{
676
676
  ...t,
677
677
  content: e,
678
678
  streaming: !1
@@ -686,169 +686,170 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
686
686
  i,
687
687
  o,
688
688
  c,
689
- Fe,
690
- Pe,
691
- Ne,
692
- $,
693
- K,
689
+ l,
690
+ ze,
691
+ Re,
692
+ Le,
693
+ Ie,
694
+ W,
694
695
  Z
695
- ]), Le = a((e) => {
696
- ke.current = e, x(e);
697
- }, []), Re = a((e) => {
696
+ ]), Ve = a((e) => {
697
+ Me.current = e, C(e);
698
+ }, []), He = a((e) => {
698
699
  let t = e.trim();
699
700
  if (!t) return;
700
- De.current = t;
701
+ je.current = t;
701
702
  let n = {
702
- id: ce(),
703
+ id: fe(),
703
704
  role: "user",
704
705
  content: t,
705
706
  createdAt: Date.now()
706
- }, r = [...Q.current, n];
707
- Q.current = r, Le([...ke.current, n]), Ie(r);
708
- }, [Ie, Le]), ze = a((e, t) => {
709
- if (E === "streaming") return;
707
+ }, r = [...$.current, n];
708
+ $.current = r, Ve([...Me.current, n]), Be(r);
709
+ }, [Be, Ve]), Ue = a((e, t) => {
710
+ if (D === "streaming") return;
710
711
  let n = e.trim();
711
712
  if (!n) return;
712
- De.current = n;
713
+ je.current = n;
713
714
  let r = t?.trim(), i = {
714
- id: ce(),
715
+ id: fe(),
715
716
  role: "user",
716
717
  content: n,
717
718
  createdAt: Date.now(),
718
719
  hidden: !0,
719
720
  ...r ? { titleHint: r } : {}
720
- }, a = [...Q.current, i];
721
- Q.current = a, Ie(a);
722
- }, [Ie, E]), Be = a(() => {
723
- Ee.current?.abort();
724
- }, []), Ve = a(() => {
725
- if (E === "streaming" || !De.current) return;
726
- let e = ke.current, t = e[e.length - 1], n = t && t.role === "assistant" ? e.slice(0, -1) : e;
727
- Le(n);
728
- let r = Q.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
729
- Q.current = a, Ie(a);
721
+ }, a = [...$.current, i];
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
+ let r = $.current, i = r[r.length - 1], a = i && i.role === "assistant" ? r.slice(0, -1) : r;
730
+ $.current = a, Be(a);
730
731
  }, [
731
- Ie,
732
- Le,
733
- E
734
- ]), He = a(() => C([]), []), Ue = a(() => {
735
- M(null), D((e) => e === "error" ? "idle" : e);
736
- }, []), We = a(() => {
737
- Ee.current?.abort(), Z(), ve(!1), Le([]), Q.current = [], C([]), T(null), D("idle"), M(null), De.current = "";
738
- }, [Z, Le]), Ge = a(() => {
739
- We(), q.current = void 0, G(void 0), H(J.current.storage, J.current.key, K);
740
- }, [We, K]), Ke = d(P);
732
+ Be,
733
+ Ve,
734
+ D
735
+ ]), Ke = a(() => w([]), []), qe = a(() => {
736
+ M(null), k((e) => e === "error" ? "idle" : e);
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);
741
742
  s(() => {
742
- let e = Ke.current;
743
+ let e = Xe.current;
743
744
  if (e === P) return;
744
- Ke.current = P, e !== void 0 && We();
745
- let t = V(K);
746
- q.current = t, G(t);
745
+ Xe.current = P, e !== void 0 && Je();
746
+ let t = ye(W);
747
+ G.current = t, H(t);
747
748
  }, [P]);
748
- let qe = a((e) => {
749
- Ee.current?.abort();
749
+ let Ze = a((e) => {
750
+ Ae.current?.abort();
750
751
  let t = e.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
751
752
  ...e,
752
753
  streaming: !1
753
754
  }));
754
- Le(t.filter((e) => !e.hidden)), Q.current = t, C([]), T(null), D("idle"), M(null), De.current = "";
755
- }, [Le]), Je = a((e) => {
756
- Z(), qe(e);
757
- }, [Z, qe]), Ye = a((e) => {
758
- q.current = e, G(e), de(J.current.storage, J.current.key, e, K), ve(!1);
759
- }, [K]), Xe = 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) => {
760
761
  let t = e.hasMoreBefore && e.nextBeforeAbsoluteIndex !== null;
761
- we.current = t ? e.nextBeforeAbsoluteIndex : null, xe(t);
762
- }, []), Ze = a(async ({ conversationId: e }) => {
763
- let t = Te.current, { sub: n } = J.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({
764
765
  conversationId: e,
765
766
  sub: n
766
767
  }));
767
- if (!t || !r) throw Y("error"), Error(t ? "invalid conversation id" : "no client");
768
- Ee.current?.abort(), Z();
769
- let i = Se.current, a = new AbortController();
770
- Ce.current = a, Y("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");
771
772
  try {
772
773
  let n = await t.getConversation({
773
774
  conversationId: e,
774
- limit: oe,
775
+ limit: le,
775
776
  signal: a.signal
776
777
  });
777
- if (i !== Se.current) return;
778
- qe(te({ messages: n.messages })), Ye(e), Xe(n), Y("idle");
778
+ if (i !== J.current) return;
779
+ Ze(F({ messages: n.messages })), $e(e), et(n), q("idle");
779
780
  } catch (e) {
780
- if (i !== Se.current) return;
781
- throw Y("error"), e;
781
+ if (i !== J.current) return;
782
+ throw q("error"), e;
782
783
  }
783
784
  }, [
784
- Xe,
785
+ et,
785
786
  Z,
786
- Ye,
787
- qe
788
- ]), Qe = a(async () => {
789
- let e = Te.current, t = q.current, n = we.current;
790
- if (!e || !t || n === null || X.current) return;
791
- let r = Se.current, i = new AbortController();
792
- Ce.current = i, X.current = !0, Y("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");
793
794
  try {
794
795
  let a = await e.getConversation({
795
796
  conversationId: t,
796
- limit: oe,
797
+ limit: le,
797
798
  beforeAbsoluteIndex: n,
798
799
  signal: i.signal
799
800
  });
800
- if (r !== Se.current) return;
801
- let o = te({ messages: a.messages });
802
- Q.current = re({
803
- current: Q.current,
801
+ if (r !== J.current) return;
802
+ let o = F({ messages: a.messages });
803
+ $.current = ie({
804
+ current: $.current,
804
805
  earlier: o
805
- }), x((e) => {
806
- let t = re({
806
+ }), C((e) => {
807
+ let t = ie({
807
808
  current: e,
808
809
  earlier: o
809
810
  });
810
- return ke.current = t, t;
811
- }), Xe(a), Y("idle");
811
+ return Me.current = t, t;
812
+ }), et(a), q("idle");
812
813
  } catch (e) {
813
- if (r !== Se.current) return;
814
- throw Y("error"), e;
814
+ if (r !== J.current) return;
815
+ throw q("error"), e;
815
816
  } finally {
816
- r === Se.current && (X.current = !1);
817
+ r === J.current && (Oe.current = !1);
817
818
  }
818
- }, [Xe]), [$e, et] = f();
819
+ }, [et]), [rt, it] = f();
819
820
  return {
820
- conversationId: pe,
821
- persistence: ge,
822
- contextLost: _e,
823
- messages: ee,
824
- traceEvents: S,
825
- lastRequest: w,
826
- status: E,
827
- error: k,
828
- send: Re,
829
- sendHidden: ze,
830
- stop: Be,
831
- retryLast: Ve,
832
- clearTrace: He,
833
- clearError: Ue,
834
- newChat: Ge,
835
- loadMessages: Je,
836
- loadConversation: Ze,
837
- loadEarlier: Qe,
838
- hasEarlier: be,
839
- historyStatus: ye,
821
+ conversationId: V,
822
+ persistence: Se,
823
+ contextLost: Ce,
824
+ messages: S,
825
+ traceEvents: ee,
826
+ lastRequest: T,
827
+ status: D,
828
+ error: ne,
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,
840
841
  feedback: u(() => {
841
- if (!p || $e === p) return;
842
- let e = ie({
843
- client: p,
844
- getConversationId: () => pe
842
+ if (!m || rt === m) return;
843
+ let e = ae({
844
+ client: m,
845
+ getConversationId: () => V
845
846
  }), t = async (e) => {
846
847
  try {
847
848
  await e();
848
849
  } catch (e) {
849
- throw e instanceof j && e.status === 503 && et(p), e;
850
+ throw e instanceof j && ue.includes(e.status) && it(m), e;
850
851
  }
851
- }, n = (e, t) => x((n) => n.map((n) => n.serverMessageId === e ? {
852
+ }, n = (e, t) => C((n) => n.map((n) => n.serverMessageId === e ? {
852
853
  ...n,
853
854
  feedback: t
854
855
  } : n));
@@ -867,16 +868,16 @@ var W = ({ transport: e, model: t, instructions: n, tools: r = [], toolChoice: i
867
868
  }
868
869
  };
869
870
  }, [
870
- p,
871
- pe,
872
- $e
871
+ m,
872
+ V,
873
+ rt
873
874
  ])
874
875
  };
875
- }, pe = (e) => e instanceof j ? e : new j({
876
+ }, be = (e) => e instanceof j ? e : new j({
876
877
  status: 0,
877
878
  kind: "network"
878
879
  });
879
- function G(e) {
880
+ function V(e) {
880
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([]);
881
882
  s(() => {
882
883
  h.current = e.client, g.current = r;
@@ -899,15 +900,15 @@ function G(e) {
899
900
  }), _.current = r.nextCursor, m(r.nextCursor), u(null), c("idle");
900
901
  } catch (e) {
901
902
  if (n.signal.aborted) return;
902
- u(pe(e)), c("error");
903
+ u(be(e)), c("error");
903
904
  }
904
905
  }, [t]);
905
906
  s(() => {
906
907
  if (n) return y("replace"), () => v.current?.abort();
907
908
  }, [n, y]);
908
- let b = a(() => y("replace"), [y]), ee = a(async () => {
909
+ let b = a(() => y("replace"), [y]), x = a(async () => {
909
910
  _.current !== null && await y("append");
910
- }, [y]), x = a(async ({ conversationId: e }) => {
911
+ }, [y]), S = a(async ({ conversationId: e }) => {
911
912
  let t = g.current.findIndex((t) => t.conversationId === e), n = t === -1 ? void 0 : {
912
913
  row: g.current[t],
913
914
  index: t
@@ -931,42 +932,42 @@ function G(e) {
931
932
  error: l,
932
933
  hasMore: p !== null,
933
934
  refresh: b,
934
- loadMore: ee,
935
- remove: x
935
+ loadMore: x,
936
+ remove: S
936
937
  };
937
938
  }
938
939
  // src/client/routes.ts
939
- function me(e) {
940
+ function H(e) {
940
941
  return e.replace(/\/+$/, "");
941
942
  }
942
- function he(e, t) {
943
+ function xe(e, t) {
943
944
  let n = new URLSearchParams();
944
945
  for (let [e, r] of Object.entries(t)) r !== void 0 && n.set(e, String(r));
945
946
  let r = n.toString();
946
947
  return r ? `${e}?${r}` : e;
947
948
  }
948
- var K = {
949
+ var U = {
949
950
  responses(e) {
950
- return `${me(e)}/responses`;
951
+ return `${H(e)}/responses`;
951
952
  },
952
953
  conversations(e, t) {
953
- return he(`${me(e)}/conversations`, {
954
+ return xe(`${H(e)}/conversations`, {
954
955
  limit: t.limit,
955
956
  cursor: t.cursor
956
957
  });
957
958
  },
958
959
  conversation(e, t, n) {
959
- return he(`${me(e)}/conversations/${encodeURIComponent(t)}`, {
960
+ return xe(`${H(e)}/conversations/${encodeURIComponent(t)}`, {
960
961
  limit: n.limit,
961
962
  before_absolute_index: n.beforeAbsoluteIndex
962
963
  });
963
964
  },
964
965
  feedback(e, t, n) {
965
- return `${me(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
966
+ return `${H(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`;
966
967
  }
967
968
  };
968
969
  // src/client/createBaileyClient.ts
969
- function q(e) {
970
+ function W(e) {
970
971
  return {
971
972
  status: void 0,
972
973
  text: "",
@@ -975,32 +976,32 @@ function q(e) {
975
976
  ...e ? { errorCause: e.cause } : {}
976
977
  };
977
978
  }
978
- var J = "The assistant took too long to respond. Please try again.";
979
- function ge(e) {
979
+ var G = "The assistant took too long to respond. Please try again.";
980
+ function K(e) {
980
981
  return {
981
982
  status: e.status,
982
983
  text: "",
983
- errorMessage: J,
984
+ errorMessage: G,
984
985
  errorKind: "timeout",
985
986
  errorCause: e.cause,
986
987
  ...e.status === void 0 ? {} : { interrupted: !0 }
987
988
  };
988
989
  }
989
- var _e = 3e4, ve = 155e3, ye = "x-chat-id", Y = "header", be = "body", xe = "x-request-id", Se = "x-conversation-id", Ce = "x-message-id", we = (e) => e && typeof e == "object" ? e : {}, X = (e, t = "") => typeof e == "string" ? e : t, Z = (e, t = 0) => typeof e == "number" ? e : t;
990
- function Te(e) {
991
- let t = we(e);
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
+ function Z(e) {
992
+ let t = Y(e);
992
993
  return {
993
994
  conversationId: X(t.conversation_id),
994
995
  title: typeof t.title == "string" ? t.title : null,
995
996
  status: X(t.status),
996
- messageCount: Z(t.message_count),
997
+ messageCount: Oe(t.message_count),
997
998
  createdAt: X(t.created_at),
998
999
  updatedAt: X(t.updated_at)
999
1000
  };
1000
1001
  }
1001
- function Ee(e) {
1002
+ function ke(e) {
1002
1003
  if (!e || typeof e != "object") return null;
1003
- let t = we(e);
1004
+ let t = Y(e);
1004
1005
  return {
1005
1006
  rating: X(t.rating),
1006
1007
  reasonCodes: Array.isArray(t.reason_codes) ? t.reason_codes.filter((e) => typeof e == "string") : [],
@@ -1008,18 +1009,18 @@ function Ee(e) {
1008
1009
  ...typeof t.updated_at == "string" ? { updatedAt: t.updated_at } : {}
1009
1010
  };
1010
1011
  }
1011
- function De(e) {
1012
- let t = we(e);
1012
+ function Ae(e) {
1013
+ let t = Y(e);
1013
1014
  return {
1014
1015
  messageId: X(t.message_id),
1015
1016
  role: X(t.role),
1016
1017
  content: X(t.content),
1017
1018
  hidden: t.hidden === !0,
1018
1019
  createdAt: X(t.created_at),
1019
- feedback: Ee(t.feedback)
1020
+ feedback: ke(t.feedback)
1020
1021
  };
1021
1022
  }
1022
- function Oe(e) {
1023
+ function je(e) {
1023
1024
  let t = new AbortController(), n = !1, r = setTimeout(() => {
1024
1025
  n = !0, t.abort();
1025
1026
  }, e.timeoutMs), i = () => t.abort(e.caller?.reason);
@@ -1031,7 +1032,7 @@ function Oe(e) {
1031
1032
  }
1032
1033
  };
1033
1034
  }
1034
- function ke(e) {
1035
+ function Q(e) {
1035
1036
  return e.timedOut() ? new j({
1036
1037
  status: 0,
1037
1038
  kind: "timeout",
@@ -1041,20 +1042,20 @@ function ke(e) {
1041
1042
  kind: "aborted"
1042
1043
  });
1043
1044
  }
1044
- function Q(e) {
1045
- let { baseUrl: t, getHeaders: n, onAuthError: r } = e, i = e.requestTimeoutMs ?? _e, a = e.idleTimeoutMs ?? ve, o = e.conversationVia ?? Y;
1046
- if (o !== Y && o !== be) 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'");
1047
1048
  let s = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
1048
1049
  function c(t) {
1049
1050
  try {
1050
- e.onCleanupError?.(new N({ operation: t }));
1051
+ e.onCleanupError?.(new M({ operation: t }));
1051
1052
  } catch {}
1052
1053
  }
1053
1054
  function l(e) {
1054
1055
  e.kind === "http" && (e.status === 401 || e.status === 403) && r?.(e);
1055
1056
  }
1056
1057
  async function u(e) {
1057
- let t = Oe({
1058
+ let t = je({
1058
1059
  caller: e.signal,
1059
1060
  timeoutMs: i
1060
1061
  });
@@ -1071,7 +1072,7 @@ function Q(e) {
1071
1072
  kind: "network"
1072
1073
  });
1073
1074
  }
1074
- if (t.signal.aborted) throw ke(t);
1075
+ if (t.signal.aborted) throw Q(t);
1075
1076
  e.body !== void 0 && (r["Content-Type"] = "application/json");
1076
1077
  let i;
1077
1078
  try {
@@ -1082,7 +1083,7 @@ function Q(e) {
1082
1083
  signal: t.signal
1083
1084
  });
1084
1085
  } catch (e) {
1085
- throw t.signal.aborted ? ke(t) : new j({
1086
+ throw t.signal.aborted ? Q(t) : new j({
1086
1087
  status: 0,
1087
1088
  kind: "network",
1088
1089
  cause: e
@@ -1108,7 +1109,7 @@ function Q(e) {
1108
1109
  return t;
1109
1110
  } catch (n) {
1110
1111
  if (n instanceof j) throw n;
1111
- if (t.timedOut() || t.signal.aborted) throw ke(t);
1112
+ if (t.timedOut() || t.signal.aborted) throw Q(t);
1112
1113
  if (e.requireJsonBody) throw new j({
1113
1114
  status: i.status,
1114
1115
  kind: "invalid-response"
@@ -1127,10 +1128,10 @@ function Q(e) {
1127
1128
  e.signal.aborted ? i() : e.signal.addEventListener("abort", i, { once: !0 });
1128
1129
  let u, d, f = () => {
1129
1130
  clearTimeout(u), u = setTimeout(() => {
1130
- d = new DOMException(J, "TimeoutError"), r.abort(d);
1131
+ d = new DOMException(G, "TimeoutError"), r.abort(d);
1131
1132
  }, a);
1132
1133
  }, p = (t) => {
1133
- if (d && !e.signal.aborted) return ge({
1134
+ if (d && !e.signal.aborted) return K({
1134
1135
  cause: d,
1135
1136
  status: t
1136
1137
  });
@@ -1145,10 +1146,10 @@ function Q(e) {
1145
1146
  ...await n()
1146
1147
  };
1147
1148
  } catch {
1148
- return q();
1149
+ return W();
1149
1150
  }
1150
1151
  if (r.signal.aborted) return p();
1151
- i["Content-Type"] = "application/json", e.conversationId && o === Y && (i[ye] = e.conversationId);
1152
+ i["Content-Type"] = "application/json", e.conversationId && o === Te && (i[we] = e.conversationId);
1152
1153
  let a = e.input[e.input.length - 1], u = {
1153
1154
  ...a?.hidden === !0 ? { hidden: !0 } : {},
1154
1155
  ...a?.titleHint ? { title_hint: a.titleHint } : {}
@@ -1162,21 +1163,21 @@ function Q(e) {
1162
1163
  stream: !0,
1163
1164
  ...Object.keys(u).length > 0 ? { metadata: u } : {}
1164
1165
  };
1165
- e.conversationId && o === be && (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);
1166
1167
  let m;
1167
1168
  try {
1168
- m = await s(K.responses(t), {
1169
+ m = await s(U.responses(t), {
1169
1170
  method: "POST",
1170
1171
  headers: i,
1171
1172
  body: JSON.stringify(d),
1172
1173
  signal: r.signal
1173
1174
  });
1174
1175
  } catch (e) {
1175
- return r.signal.aborted ? p() : q({ cause: e });
1176
+ return r.signal.aborted ? p() : W({ cause: e });
1176
1177
  }
1177
- let h = m.headers.get(xe);
1178
+ let h = m.headers.get(Ee);
1178
1179
  h && e.onRequestId?.(h);
1179
- let g = m.headers.get(Ce);
1180
+ let g = m.headers.get(J);
1180
1181
  if (g && e.onMessageId?.(g), !m.ok) {
1181
1182
  l(new j({
1182
1183
  status: m.status,
@@ -1188,7 +1189,7 @@ function Q(e) {
1188
1189
  text: e
1189
1190
  };
1190
1191
  }
1191
- let _ = m.headers.get(Se);
1192
+ let _ = m.headers.get(De);
1192
1193
  if (_ && e.onConversationId?.(_), !m.body) return {
1193
1194
  status: m.status,
1194
1195
  text: ""
@@ -1225,21 +1226,21 @@ function Q(e) {
1225
1226
  }
1226
1227
  },
1227
1228
  async listConversations(e = {}) {
1228
- let n = we(await u({
1229
+ let n = Y(await u({
1229
1230
  method: "GET",
1230
- url: K.conversations(t, e),
1231
+ url: U.conversations(t, e),
1231
1232
  signal: e.signal,
1232
1233
  requireJsonBody: !0
1233
1234
  }));
1234
1235
  return {
1235
- conversations: Array.isArray(n.conversations) ? n.conversations.map(Te).filter((e) => e.conversationId !== "") : [],
1236
+ conversations: Array.isArray(n.conversations) ? n.conversations.map(Z).filter((e) => e.conversationId !== "") : [],
1236
1237
  nextCursor: typeof n.next_cursor == "string" ? n.next_cursor : null
1237
1238
  };
1238
1239
  },
1239
1240
  async getConversation(e) {
1240
- let n = we(await u({
1241
+ let n = Y(await u({
1241
1242
  method: "GET",
1242
- url: K.conversation(t, e.conversationId, e),
1243
+ url: U.conversation(t, e.conversationId, e),
1243
1244
  signal: e.signal,
1244
1245
  requireJsonBody: !0
1245
1246
  }));
@@ -1248,8 +1249,8 @@ function Q(e) {
1248
1249
  kind: "invalid-response"
1249
1250
  });
1250
1251
  return {
1251
- conversation: Te(n.conversation),
1252
- messages: Array.isArray(n.messages) ? n.messages.map(De) : [],
1252
+ conversation: Z(n.conversation),
1253
+ messages: Array.isArray(n.messages) ? n.messages.map(Ae) : [],
1253
1254
  hasMoreBefore: n.has_more_before === !0,
1254
1255
  nextBeforeAbsoluteIndex: typeof n.next_before_absolute_index == "number" ? n.next_before_absolute_index : null
1255
1256
  };
@@ -1257,14 +1258,14 @@ function Q(e) {
1257
1258
  async deleteConversation(e) {
1258
1259
  await u({
1259
1260
  method: "DELETE",
1260
- url: K.conversation(t, e.conversationId, {}),
1261
+ url: U.conversation(t, e.conversationId, {}),
1261
1262
  signal: e.signal
1262
1263
  });
1263
1264
  },
1264
1265
  async submitFeedback(e) {
1265
1266
  await u({
1266
1267
  method: "PUT",
1267
- url: K.feedback(t, e.conversationId, e.messageId),
1268
+ url: U.feedback(t, e.conversationId, e.messageId),
1268
1269
  body: {
1269
1270
  rating: e.rating,
1270
1271
  ...e.reasonCodes ? { reason_codes: e.reasonCodes } : {},
@@ -1276,21 +1277,21 @@ function Q(e) {
1276
1277
  async clearFeedback(e) {
1277
1278
  await u({
1278
1279
  method: "DELETE",
1279
- url: K.feedback(t, e.conversationId, e.messageId),
1280
+ url: U.feedback(t, e.conversationId, e.messageId),
1280
1281
  signal: e.signal
1281
1282
  });
1282
1283
  }
1283
1284
  };
1284
1285
  }
1285
1286
  // src/utils/prompt.ts
1286
- function Ae(...e) {
1287
+ function $(...e) {
1287
1288
  return e.filter((e) => !!(e && e.trim())).join("\n\n");
1288
1289
  }
1289
1290
  // src/utils/toolCalls.ts
1290
- var je = "call_tool", Me = "a tool";
1291
- function $(e, t) {
1291
+ var Ne = "call_tool", Pe = "a tool";
1292
+ function Fe(e, t) {
1292
1293
  let n = {
1293
- name: e === je ? Me : e,
1294
+ name: e === Ne ? Pe : e,
1294
1295
  args: null,
1295
1296
  viaCallTool: !1
1296
1297
  };
@@ -1303,7 +1304,7 @@ function $(e, t) {
1303
1304
  }
1304
1305
  if (typeof r != "object" || !r) return n;
1305
1306
  let i = r;
1306
- if (e === je) {
1307
+ if (e === Ne) {
1307
1308
  let e = typeof i.name == "string" ? i.name : void 0;
1308
1309
  if (!e) return n;
1309
1310
  let t = i.arguments;
@@ -1320,32 +1321,32 @@ function $(e, t) {
1320
1321
  };
1321
1322
  }
1322
1323
  // src/utils/table.ts
1323
- var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Pe).join(""), Fe = (e) => {
1324
+ var Ie = 5, Le = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).map(Le).join(""), Re = (e) => {
1324
1325
  if (e.tagName === "a" && e.properties?.href) return e.properties.href;
1325
1326
  for (let t of e.children ?? []) {
1326
- let e = Fe(t);
1327
+ let e = Re(t);
1327
1328
  if (e) return e;
1328
1329
  }
1329
- }, Ie = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Le = (e) => {
1330
- let t = Pe(e), n = Fe(e);
1330
+ }, ze = (e, t) => (e.children ?? []).find((e) => e.tagName === t), Be = (e) => {
1331
+ let t = Le(e), n = Re(e);
1331
1332
  return n ? {
1332
1333
  text: t,
1333
1334
  href: n
1334
1335
  } : { text: t };
1335
- }, Re = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Le), ze = (e) => {
1336
+ }, Ve = (e) => (e.children ?? []).filter((e) => e.type === "element").map(Be), He = (e) => {
1336
1337
  if (e.tagName !== "table") return null;
1337
- let t = Ie(e, "thead"), n = t && Ie(t, "tr");
1338
+ let t = ze(e, "thead"), n = t && ze(t, "tr");
1338
1339
  return {
1339
- headers: n ? Re(n).map((e) => e.text) : [],
1340
- rows: (Ie(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Re)
1340
+ headers: n ? Ve(n).map((e) => e.text) : [],
1341
+ rows: (ze(e, "tbody")?.children ?? []).filter((e) => e.tagName === "tr").map(Ve)
1341
1342
  };
1342
- }, Be = (e) => e.length > 5, Ve = "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```", He = [
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 = [
1343
1344
  "bar",
1344
1345
  "line",
1345
1346
  "pie",
1346
1347
  "doughnut",
1347
1348
  "scatter"
1348
- ], Ue = 8, We = 50, Ge = 8, Ke = 500, qe = (e) => typeof e == "object" && !!e && typeof e.x == "number" && typeof e.y == "number", Je = (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) => {
1349
1350
  let t;
1350
1351
  try {
1351
1352
  t = JSON.parse(e);
@@ -1354,17 +1355,17 @@ var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1354
1355
  }
1355
1356
  if (typeof t != "object" || !t) return null;
1356
1357
  let n = t;
1357
- if (typeof n.type != "string" || !He.includes(n.type)) return null;
1358
+ if (typeof n.type != "string" || !Ge.includes(n.type)) return null;
1358
1359
  let r = n.type;
1359
1360
  if (n.title !== void 0 && typeof n.title != "string") return null;
1360
1361
  let i = n.title;
1361
1362
  if (typeof n.data != "object" || n.data === null) return null;
1362
1363
  let a = n.data;
1363
- if (!Array.isArray(a.datasets) || a.datasets.length < 1 || a.datasets.length > Ue || (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;
1364
1365
  for (let e of a.datasets) if (typeof e != "object" || !e || typeof e.label != "string" || !Array.isArray(e.data)) return null;
1365
1366
  let o = a.datasets;
1366
1367
  if (r === "scatter") {
1367
- for (let e of o) if (e.data.length < 1 || e.data.length > Ke || !e.data.every(qe)) return null;
1368
+ for (let e of o) if (e.data.length < 1 || e.data.length > Ye || !e.data.every(Xe)) return null;
1368
1369
  return {
1369
1370
  type: r,
1370
1371
  title: i,
@@ -1372,7 +1373,7 @@ var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1372
1373
  };
1373
1374
  }
1374
1375
  if (!Array.isArray(a.labels) || !a.labels.every((e) => typeof e == "string")) return null;
1375
- let s = a.labels, c = r === "pie" || r === "doughnut" ? Ge : We;
1376
+ let s = a.labels, c = r === "pie" || r === "doughnut" ? Je : qe;
1376
1377
  if (s.length < 1 || s.length > c) return null;
1377
1378
  for (let e of o) if (e.data.length !== s.length || !e.data.every((e) => typeof e == "number")) return null;
1378
1379
  return {
@@ -1383,7 +1384,7 @@ var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1383
1384
  datasets: o
1384
1385
  }
1385
1386
  };
1386
- }, Ye = {
1387
+ }, Qe = {
1387
1388
  tool_start: "Tool start",
1388
1389
  tool_end: "Tool end",
1389
1390
  pseudo_tool_call: "Narrated tool call",
@@ -1394,13 +1395,13 @@ var Ne = 5, Pe = (e) => e.type === "text" ? e.value ?? "" : (e.children ?? []).m
1394
1395
  error: "Error",
1395
1396
  raw: "Raw event"
1396
1397
  };
1397
- function Xe(e) {
1398
- return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : $(e.name, e.args);
1398
+ function $e(e) {
1399
+ return e.kind !== "tool_start" && e.kind !== "tool_end" ? null : Fe(e.name, e.args);
1399
1400
  }
1400
- function Ze(e, t = Xe(e)) {
1401
+ function et(e, t = $e(e)) {
1401
1402
  return e.kind === "pseudo_tool_call" ? e.name : t?.name ?? null;
1402
1403
  }
1403
- function Qe(e, t = Xe(e)) {
1404
+ function tt(e, t = $e(e)) {
1404
1405
  switch (e.kind) {
1405
1406
  case "tool_start": return t.viaCallTool ? `${t.name} (via call_tool)` : t.name;
1406
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" : ""}`;
@@ -1413,23 +1414,23 @@ function Qe(e, t = Xe(e)) {
1413
1414
  case "raw": return `Unrecognized event: ${e.eventType}`;
1414
1415
  }
1415
1416
  }
1416
- function $e(e, t = Xe(e)) {
1417
+ function nt(e, t = $e(e)) {
1417
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;
1418
1419
  }
1419
- function et(e) {
1420
+ function rt(e) {
1420
1421
  return e.kind === "tool_end" ? e.output ?? null : e.kind === "llm_call_end" ? e.response ?? null : null;
1421
1422
  }
1422
- function tt(e) {
1423
+ function it(e) {
1423
1424
  return e.kind === "tool_end" && e.structuredOutput ? JSON.stringify(e.structuredOutput, null, 2) : null;
1424
1425
  }
1425
- function nt(e) {
1426
+ function at(e) {
1426
1427
  return e.kind === "raw" ? e.raw : e.kind === "error" ? e.rawBody ?? null : null;
1427
1428
  }
1428
- function rt(e) {
1429
+ function ot(e) {
1429
1430
  switch (e.kind) {
1430
- case "tool_start": return `Calling ${$(e.name, e.args).name}...`;
1431
+ case "tool_start": return `Calling ${Fe(e.name, e.args).name}...`;
1431
1432
  case "tool_end": {
1432
- let t = $(e.name, e.args).name;
1433
+ let t = Fe(e.name, e.args).name;
1433
1434
  return e.isError ? `${t} failed` : `${t} returned`;
1434
1435
  }
1435
1436
  case "pseudo_tool_call": return `${e.name} (written as text, not called)`;
@@ -1441,11 +1442,11 @@ function rt(e) {
1441
1442
  case "raw": return `Unrecognized event: ${e.eventType}`;
1442
1443
  }
1443
1444
  }
1444
- function it(e) {
1445
+ function st(e) {
1445
1446
  let t = new Date(e);
1446
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")}`;
1447
1448
  }
1448
- function at(e) {
1449
+ function ct(e) {
1449
1450
  if (e <= 0) return "+0ms";
1450
1451
  if (e < 1e3) return `+${Math.round(e)}ms`;
1451
1452
  let t = e / 1e3;
@@ -1453,31 +1454,31 @@ function at(e) {
1453
1454
  let n = Math.floor(t / 60), r = Math.round(t % 60);
1454
1455
  return `+${n}m${String(r).padStart(2, "0")}s`;
1455
1456
  }
1456
- function ot(e) {
1457
+ function lt(e) {
1457
1458
  return e.map((t, n) => {
1458
- let r = Xe(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1459
+ let r = $e(t), i = n === 0 ? t.turnSentAt : e[n - 1].at;
1459
1460
  return {
1460
1461
  key: `${t.at}-${n}`,
1461
1462
  kind: t.kind,
1462
- toolName: Ze(t, r),
1463
+ toolName: et(t, r),
1463
1464
  isToolStart: t.kind === "tool_start",
1464
1465
  failed: t.kind === "tool_end" && t.isError === !0,
1465
- time: it(t.at),
1466
+ time: st(t.at),
1466
1467
  gapMs: t.at - i,
1467
- label: t.kind === "tool_end" && t.isError === !0 ? "Tool failed" : Ye[t.kind],
1468
- summary: Qe(t, r),
1469
- argsDetail: $e(t, r),
1470
- outputDetail: et(t),
1471
- structuredOutputDetail: tt(t),
1472
- rawDetail: nt(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)
1473
1474
  };
1474
1475
  });
1475
1476
  }
1476
- function st(e) {
1477
+ function ut(e) {
1477
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 = [];
1478
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(" · ");
1479
1480
  }
1480
- function ct(e) {
1481
+ function dt(e) {
1481
1482
  let t = [];
1482
1483
  for (let n of e) {
1483
1484
  let e = t[t.length - 1];
@@ -1492,22 +1493,22 @@ function ct(e) {
1492
1493
  }
1493
1494
  return t;
1494
1495
  }
1495
- function lt(e) {
1496
+ function ft(e) {
1496
1497
  return e.some((e) => e.kind === "tool_end" && e.isError || e.kind === "error");
1497
1498
  }
1498
- function ut(e, t) {
1499
+ function pt(e, t) {
1499
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) => ({
1500
1501
  key: `${e.at}-${t}`,
1501
- text: rt(e),
1502
- toolName: Ze(e)
1502
+ text: ot(e),
1503
+ toolName: et(e)
1503
1504
  }));
1504
1505
  }
1505
- function dt(e, t) {
1506
+ function mt(e, t) {
1506
1507
  if (t === void 0) return [];
1507
1508
  let n = [];
1508
1509
  for (let r of e) if (r.turnSentAt === t) {
1509
1510
  if (r.kind === "tool_start") {
1510
- let e = $(r.name, r.args).name;
1511
+ let e = Fe(r.name, r.args).name;
1511
1512
  n.push({
1512
1513
  key: `step-${n.length}`,
1513
1514
  callId: r.callId,
@@ -1517,7 +1518,7 @@ function dt(e, t) {
1517
1518
  startOffsetMs: r.at - t
1518
1519
  });
1519
1520
  } else if (r.kind === "tool_end") {
1520
- let e = $(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);
1521
1522
  a ? (a.status = i, a.runtimeSeconds = r.runtimeSeconds, a.label = r.displayName || a.label) : n.push({
1522
1523
  key: `step-${n.length}`,
1523
1524
  callId: r.callId,
@@ -1532,46 +1533,51 @@ function dt(e, t) {
1532
1533
  return n;
1533
1534
  }
1534
1535
  // src/styles.css?inline
1535
- var ft = "/*! 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-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-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);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,\"Inter\", -apple-system, \"Segoe UI\", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:\"·\";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-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)}}", pt = r(void 0), mt = /:root\s*,\s*:host\s*\{([^}]*)\}/, ht = ".bailey-chat-panel", gt = ".bailey-menu-content,.bailey-tooltip-content", _t = "--color-bailey-";
1536
- function vt(e) {
1537
- let t = e.match(new RegExp(mt, "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;
1538
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.`);
1539
- return e.replace(mt, (e, t) => `${ht}{${t}}${gt}{${t.split(";").filter((e) => e.trim() && !e.trim().startsWith(_t)).join(";")}}`);
1540
- }
1541
- var yt = vt(ft), bt = "data-source", xt = "baileyai-chat-ui", St = /* @__PURE__ */ new WeakMap();
1542
- function Ct(e) {
1540
+ let n = /* @__PURE__ */ new Map();
1541
+ return e.replace(_t, (e, t) => `${vt}{${t.split(";").filter((e) => {
1542
+ if (!e.trim()) return !1;
1543
+ let t = e.match(yt);
1544
+ return t && n.set(t[1], t[2]), !t;
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
+ }
1547
+ var Ct = St(ht), wt = "data-source", Tt = "baileyai-chat-ui", Et = /* @__PURE__ */ new WeakMap();
1548
+ function Dt(e) {
1543
1549
  let t = e.getRootNode();
1544
1550
  return t instanceof ShadowRoot ? t : document;
1545
1551
  }
1546
- function wt(e) {
1547
- let t = e instanceof ShadowRoot ? e : document.head, n = St.get(e) ?? 0;
1548
- if (n === 0 && !t.querySelector(`style[${bt}="${xt}"]`)) {
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}"]`)) {
1549
1555
  let e = document.createElement("style");
1550
- e.setAttribute(bt, xt), e.textContent = yt, t.appendChild(e);
1556
+ e.setAttribute(wt, Tt), e.textContent = Ct, t.appendChild(e);
1551
1557
  }
1552
- return St.set(e, n + 1), () => {
1553
- let n = (St.get(e) ?? 1) - 1;
1554
- n <= 0 ? (St.delete(e), t.querySelector(`style[${bt}="${xt}"]`)?.remove()) : St.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);
1555
1561
  };
1556
1562
  }
1557
- function Tt(e, t = !1) {
1563
+ function kt(e, t = !1) {
1558
1564
  let [n, r] = f(null);
1559
1565
  return l(() => {
1560
1566
  if (t) return;
1561
1567
  let n = e.current;
1562
1568
  if (!n) return;
1563
- let i = Ct(n);
1564
- return r(i), wt(i);
1569
+ let i = Dt(n);
1570
+ return r(i), Ot(i);
1565
1571
  }, [t, e]), n;
1566
1572
  }
1567
- function Et(e) {
1568
- let t = o(pt), n = t !== void 0, r = Tt(e, n);
1573
+ function At(e) {
1574
+ let t = o(gt), n = t !== void 0, r = kt(e, n);
1569
1575
  return n ? t : r;
1570
1576
  }
1571
1577
  // src/context/BaileyFeedbackSlotContext.ts
1572
- var Dt = r(void 0);
1578
+ var jt = r(void 0);
1573
1579
  // src/ui/markdown.tsx
1574
- function Ot({ renderTable: t, renderChart: n } = {}) {
1580
+ function Mt({ renderTable: t, renderChart: n } = {}) {
1575
1581
  return {
1576
1582
  a: ({ href: t, children: n }) => !t || !e(t) ? /* @__PURE__ */ v(_, { children: n }) : /* @__PURE__ */ v("a", {
1577
1583
  href: t,
@@ -1580,8 +1586,8 @@ function Ot({ renderTable: t, renderChart: n } = {}) {
1580
1586
  children: n
1581
1587
  }),
1582
1588
  table: ({ node: n, children: r }) => {
1583
- let i = n && ze(n);
1584
- if (i && Be(i.rows) && t) {
1589
+ let i = n && He(n);
1590
+ if (i && Ue(i.rows) && t) {
1585
1591
  let n = i.rows.map((t) => t.map((t) => t.href && !e(t.href) ? { text: t.text } : t));
1586
1592
  return /* @__PURE__ */ v(_, { children: t({
1587
1593
  headers: i.headers,
@@ -1593,7 +1599,7 @@ function Ot({ renderTable: t, renderChart: n } = {}) {
1593
1599
  pre: ({ children: e }) => {
1594
1600
  let t = (Array.isArray(e) ? e[0] : e)?.props;
1595
1601
  if ((t?.className?.split(" ") ?? []).includes("language-chartjs") && n) {
1596
- let e = t?.children, r = Je(Array.isArray(e) ? e.join("") : String(e ?? ""));
1602
+ let e = t?.children, r = Ze(Array.isArray(e) ? e.join("") : String(e ?? ""));
1597
1603
  if (r) return /* @__PURE__ */ v(_, { children: n(r) });
1598
1604
  }
1599
1605
  return /* @__PURE__ */ v("pre", { children: e });
@@ -1601,7 +1607,7 @@ function Ot({ renderTable: t, renderChart: n } = {}) {
1601
1607
  };
1602
1608
  }
1603
1609
  // src/ui/icons.tsx
1604
- function kt({ className: e }) {
1610
+ function Nt({ className: e }) {
1605
1611
  return /* @__PURE__ */ v("svg", {
1606
1612
  viewBox: "0 0 24 24",
1607
1613
  fill: "currentColor",
@@ -1610,7 +1616,7 @@ function kt({ className: e }) {
1610
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" })
1611
1617
  });
1612
1618
  }
1613
- function At({ className: e }) {
1619
+ function Pt({ className: e }) {
1614
1620
  return /* @__PURE__ */ v("svg", {
1615
1621
  viewBox: "0 0 24 24",
1616
1622
  fill: "currentColor",
@@ -1625,7 +1631,7 @@ function At({ className: e }) {
1625
1631
  })
1626
1632
  });
1627
1633
  }
1628
- function jt({ className: e }) {
1634
+ function Ft({ className: e }) {
1629
1635
  return /* @__PURE__ */ y("svg", {
1630
1636
  viewBox: "0 0 24 24",
1631
1637
  fill: "none",
@@ -1638,7 +1644,7 @@ function jt({ className: e }) {
1638
1644
  children: [/* @__PURE__ */ v("path", { d: "M7 17 17 7" }), /* @__PURE__ */ v("path", { d: "M9 7h8v8" })]
1639
1645
  });
1640
1646
  }
1641
- function Mt({ className: e }) {
1647
+ function It({ className: e }) {
1642
1648
  return /* @__PURE__ */ y("svg", {
1643
1649
  viewBox: "0 0 24 24",
1644
1650
  fill: "none",
@@ -1657,7 +1663,7 @@ function Mt({ className: e }) {
1657
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" })]
1658
1664
  });
1659
1665
  }
1660
- function Nt({ className: e }) {
1666
+ function Lt({ className: e }) {
1661
1667
  return /* @__PURE__ */ v("svg", {
1662
1668
  viewBox: "0 0 24 24",
1663
1669
  fill: "none",
@@ -1670,7 +1676,7 @@ function Nt({ className: e }) {
1670
1676
  children: /* @__PURE__ */ v("path", { d: "M5 12.5 9.5 17 19 7" })
1671
1677
  });
1672
1678
  }
1673
- function Pt({ className: e }) {
1679
+ function Rt({ className: e }) {
1674
1680
  return /* @__PURE__ */ v("svg", {
1675
1681
  viewBox: "0 0 24 24",
1676
1682
  fill: "none",
@@ -1683,7 +1689,7 @@ function Pt({ className: e }) {
1683
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" })
1684
1690
  });
1685
1691
  }
1686
- function Ft({ className: e }) {
1692
+ function zt({ className: e }) {
1687
1693
  return /* @__PURE__ */ y("svg", {
1688
1694
  viewBox: "0 0 24 24",
1689
1695
  fill: "none",
@@ -1700,7 +1706,7 @@ function Ft({ className: e }) {
1700
1706
  }), /* @__PURE__ */ v("path", { d: "M8.5 12.5 11 15l4.5-5.5" })]
1701
1707
  });
1702
1708
  }
1703
- function It({ className: e }) {
1709
+ function Bt({ className: e }) {
1704
1710
  return /* @__PURE__ */ y("svg", {
1705
1711
  viewBox: "0 0 24 24",
1706
1712
  fill: "currentColor",
@@ -1725,7 +1731,7 @@ function It({ className: e }) {
1725
1731
  ]
1726
1732
  });
1727
1733
  }
1728
- function Lt({ className: e }) {
1734
+ function Vt({ className: e }) {
1729
1735
  return /* @__PURE__ */ v("svg", {
1730
1736
  viewBox: "0 0 24 24",
1731
1737
  fill: "none",
@@ -1738,8 +1744,8 @@ function Lt({ className: e }) {
1738
1744
  children: /* @__PURE__ */ v("path", { d: "M12 5v14M5 12h14" })
1739
1745
  });
1740
1746
  }
1741
- var Rt = "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", zt = "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";
1742
- function Bt({ 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 }) {
1743
1749
  return /* @__PURE__ */ v("svg", {
1744
1750
  viewBox: "0 0 24 24",
1745
1751
  fill: t ? "currentColor" : "none",
@@ -1748,10 +1754,10 @@ function Bt({ className: e, filled: t = !1 }) {
1748
1754
  strokeLinejoin: "round",
1749
1755
  className: e,
1750
1756
  "aria-hidden": "true",
1751
- children: /* @__PURE__ */ v("path", { d: Rt })
1757
+ children: /* @__PURE__ */ v("path", { d: Ht })
1752
1758
  });
1753
1759
  }
1754
- function Vt({ className: e, filled: t = !1 }) {
1760
+ function Gt({ className: e, filled: t = !1 }) {
1755
1761
  return /* @__PURE__ */ v("svg", {
1756
1762
  viewBox: "0 0 24 24",
1757
1763
  fill: t ? "currentColor" : "none",
@@ -1760,10 +1766,10 @@ function Vt({ className: e, filled: t = !1 }) {
1760
1766
  strokeLinejoin: "round",
1761
1767
  className: e,
1762
1768
  "aria-hidden": "true",
1763
- children: /* @__PURE__ */ v("path", { d: zt })
1769
+ children: /* @__PURE__ */ v("path", { d: Ut })
1764
1770
  });
1765
1771
  }
1766
- function Ht({ className: e }) {
1772
+ function Kt({ className: e }) {
1767
1773
  return /* @__PURE__ */ v("svg", {
1768
1774
  viewBox: "0 0 24 24",
1769
1775
  fill: "none",
@@ -1776,7 +1782,7 @@ function Ht({ className: e }) {
1776
1782
  children: /* @__PURE__ */ v("path", { d: "M15 6l-6 6 6 6" })
1777
1783
  });
1778
1784
  }
1779
- function Ut({ className: e }) {
1785
+ function qt({ className: e }) {
1780
1786
  return /* @__PURE__ */ v("svg", {
1781
1787
  viewBox: "0 0 24 24",
1782
1788
  fill: "none",
@@ -1789,7 +1795,7 @@ function Ut({ className: e }) {
1789
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" })
1790
1796
  });
1791
1797
  }
1792
- function Wt({ className: e }) {
1798
+ function Jt({ className: e }) {
1793
1799
  return /* @__PURE__ */ y("svg", {
1794
1800
  viewBox: "0 0 24 24",
1795
1801
  fill: "none",
@@ -1807,9 +1813,9 @@ function Wt({ className: e }) {
1807
1813
  });
1808
1814
  }
1809
1815
  // src/ui/CopyMarkdownButton.tsx
1810
- var Gt = 1500;
1811
- function Kt({ markdown: e, className: t, ariaLabel: n = "copy response as markdown", tooltipDefaultText: r = "Copy as markdown", tooltipCopiedText: i = "Copied!" }) {
1812
- let [a, o] = f(!1), [c, l] = f(!1), u = d(null), p = d(null), m = Et(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);
1813
1819
  return s(() => () => {
1814
1820
  u.current !== null && clearTimeout(u.current);
1815
1821
  }, []), /* @__PURE__ */ v(g.Provider, {
@@ -1828,11 +1834,11 @@ function Kt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1828
1834
  } catch {
1829
1835
  return;
1830
1836
  }
1831
- o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Gt);
1837
+ o(!0), u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => o(!1), Yt);
1832
1838
  },
1833
1839
  "aria-label": n,
1834
1840
  className: `bailey-copy-button${t ? ` ${t}` : ""}`,
1835
- children: v(a ? Nt : Mt, { className: "bailey-copy-icon" })
1841
+ children: v(a ? Lt : It, { className: "bailey-copy-icon" })
1836
1842
  })
1837
1843
  }), /* @__PURE__ */ v(g.Portal, {
1838
1844
  container: m instanceof ShadowRoot ? m : void 0,
@@ -1846,20 +1852,20 @@ function Kt({ markdown: e, className: t, ariaLabel: n = "copy response as markdo
1846
1852
  });
1847
1853
  }
1848
1854
  // src/ui/BaileyTracePanel.tsx
1849
- async function qt(e) {
1855
+ async function Zt(e) {
1850
1856
  try {
1851
1857
  await navigator.clipboard.writeText(e);
1852
1858
  } catch {}
1853
1859
  }
1854
- function Jt({ text: e, label: t = "Copy" }) {
1860
+ function Qt({ text: e, label: t = "Copy" }) {
1855
1861
  return /* @__PURE__ */ v("button", {
1856
1862
  type: "button",
1857
- onClick: () => qt(e),
1863
+ onClick: () => Zt(e),
1858
1864
  className: "bailey-trace-copy-button",
1859
1865
  children: t
1860
1866
  });
1861
1867
  }
1862
- function Yt(e) {
1868
+ function $t(e) {
1863
1869
  if (e.failed || e.kind === "error") return "bailey-trace-chip bailey-trace-chip-error";
1864
1870
  switch (e.kind) {
1865
1871
  case "tool_start":
@@ -1870,7 +1876,7 @@ function Yt(e) {
1870
1876
  default: return "bailey-trace-chip bailey-trace-chip-default";
1871
1877
  }
1872
1878
  }
1873
- function Xt({ label: e, content: t, copyable: n }) {
1879
+ function en({ label: e, content: t, copyable: n }) {
1874
1880
  return /* @__PURE__ */ y("details", {
1875
1881
  className: "bailey-trace-disclosure",
1876
1882
  children: [
@@ -1880,7 +1886,7 @@ function Xt({ label: e, content: t, copyable: n }) {
1880
1886
  }),
1881
1887
  n && /* @__PURE__ */ v("div", {
1882
1888
  className: "bailey-trace-disclosure-actions",
1883
- children: /* @__PURE__ */ v(Jt, { text: t })
1889
+ children: /* @__PURE__ */ v(Qt, { text: t })
1884
1890
  }),
1885
1891
  /* @__PURE__ */ v("pre", {
1886
1892
  className: "bailey-trace-disclosure-content",
@@ -1889,7 +1895,7 @@ function Xt({ label: e, content: t, copyable: n }) {
1889
1895
  ]
1890
1896
  });
1891
1897
  }
1892
- function Zt({ row: e }) {
1898
+ function tn({ row: e }) {
1893
1899
  return /* @__PURE__ */ y("div", {
1894
1900
  className: "bailey-trace-row",
1895
1901
  children: [
@@ -1903,10 +1909,10 @@ function Zt({ row: e }) {
1903
1909
  /* @__PURE__ */ v("span", {
1904
1910
  className: "bailey-trace-row-gap",
1905
1911
  title: "Time since the previous event",
1906
- children: at(e.gapMs)
1912
+ children: ct(e.gapMs)
1907
1913
  }),
1908
1914
  /* @__PURE__ */ v("span", {
1909
- className: Yt(e),
1915
+ className: $t(e),
1910
1916
  children: e.label
1911
1917
  }),
1912
1918
  /* @__PURE__ */ v("span", {
@@ -1915,32 +1921,32 @@ function Zt({ row: e }) {
1915
1921
  })
1916
1922
  ]
1917
1923
  }),
1918
- e.argsDetail && /* @__PURE__ */ v(Xt, {
1924
+ e.argsDetail && /* @__PURE__ */ v(en, {
1919
1925
  label: e.kind === "llm_call_start" ? "request" : "args",
1920
1926
  content: e.argsDetail
1921
1927
  }),
1922
- e.outputDetail && /* @__PURE__ */ v(Xt, {
1928
+ e.outputDetail && /* @__PURE__ */ v(en, {
1923
1929
  label: e.kind === "llm_call_end" ? "response" : "output",
1924
1930
  content: e.outputDetail
1925
1931
  }),
1926
- e.structuredOutputDetail && /* @__PURE__ */ v(Xt, {
1932
+ e.structuredOutputDetail && /* @__PURE__ */ v(en, {
1927
1933
  label: "structured output",
1928
1934
  content: e.structuredOutputDetail
1929
1935
  }),
1930
- e.rawDetail && /* @__PURE__ */ v(Xt, {
1936
+ e.rawDetail && /* @__PURE__ */ v(en, {
1931
1937
  label: "raw",
1932
1938
  content: e.rawDetail
1933
1939
  })
1934
1940
  ]
1935
1941
  });
1936
1942
  }
1937
- function Qt(e, t) {
1943
+ function nn(e, t) {
1938
1944
  if (e.chunkCount === 0) return "Streamed: no chunks received";
1939
1945
  if (e.chunkCount === 1 || e.firstChunkAt === null) return "Streamed: 1 chunk (not incremental)";
1940
1946
  let n = e.firstChunkAt - t, r = (e.lastChunkAt ?? e.firstChunkAt) - e.firstChunkAt;
1941
1947
  return `Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r / 1e3).toFixed(1)}s`;
1942
1948
  }
1943
- function $t({ request: e }) {
1949
+ function rn({ request: e }) {
1944
1950
  let t = u(() => JSON.stringify({
1945
1951
  model: e.model,
1946
1952
  instructions: e.systemPrompt,
@@ -1964,24 +1970,24 @@ function $t({ request: e }) {
1964
1970
  }),
1965
1971
  /* @__PURE__ */ v("span", {
1966
1972
  className: "bailey-trace-request-meta",
1967
- children: Qt(e.streamStats, e.sentAt)
1973
+ children: nn(e.streamStats, e.sentAt)
1968
1974
  }),
1969
- /* @__PURE__ */ v(Xt, {
1975
+ /* @__PURE__ */ v(en, {
1970
1976
  label: `System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,
1971
1977
  content: e.systemPrompt,
1972
1978
  copyable: !0
1973
1979
  }),
1974
- /* @__PURE__ */ v(Xt, {
1980
+ /* @__PURE__ */ v(en, {
1975
1981
  label: `Messages (${e.messages.length})`,
1976
1982
  content: JSON.stringify(e.messages, null, 2),
1977
1983
  copyable: !0
1978
1984
  }),
1979
- e.response && /* @__PURE__ */ v(Xt, {
1985
+ e.response && /* @__PURE__ */ v(en, {
1980
1986
  label: `Response (${e.response.content.length.toLocaleString()} chars)`,
1981
1987
  content: e.response.content,
1982
1988
  copyable: !0
1983
1989
  }),
1984
- /* @__PURE__ */ v(Xt, {
1990
+ /* @__PURE__ */ v(en, {
1985
1991
  label: "Full payload (JSON)",
1986
1992
  content: t,
1987
1993
  copyable: !0
@@ -1989,14 +1995,14 @@ function $t({ request: e }) {
1989
1995
  ]
1990
1996
  });
1991
1997
  }
1992
- function en({ events: e, lastRequest: t, onClear: n }) {
1993
- let r = u(() => ot(e), [e]), i = u(() => ct(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]);
1994
2000
  return /* @__PURE__ */ y("div", {
1995
2001
  className: "bailey-trace-body",
1996
2002
  children: [
1997
2003
  /* @__PURE__ */ y("div", {
1998
2004
  className: "bailey-trace-actions-row",
1999
- children: [e.length > 0 && /* @__PURE__ */ v(Jt, {
2005
+ children: [e.length > 0 && /* @__PURE__ */ v(Qt, {
2000
2006
  text: a,
2001
2007
  label: "Copy trace as JSON"
2002
2008
  }), /* @__PURE__ */ v("button", {
@@ -2006,15 +2012,15 @@ function en({ events: e, lastRequest: t, onClear: n }) {
2006
2012
  children: "Clear"
2007
2013
  })]
2008
2014
  }),
2009
- t && /* @__PURE__ */ v($t, { request: t }),
2015
+ t && /* @__PURE__ */ v(rn, { request: t }),
2010
2016
  /* @__PURE__ */ v("div", {
2011
2017
  className: "bailey-trace-rows",
2012
2018
  children: i.map((e, t) => {
2013
- if (e.type === "single") return /* @__PURE__ */ v(Zt, { row: e.row }, e.row.key);
2019
+ if (e.type === "single") return /* @__PURE__ */ v(tn, { row: e.row }, e.row.key);
2014
2020
  let n = e.rows.filter((e) => e.isToolStart).length;
2015
2021
  if (n <= 1) return /* @__PURE__ */ v("div", {
2016
2022
  className: "bailey-trace-rows",
2017
- children: e.rows.map((e) => /* @__PURE__ */ v(Zt, { row: e }, e.key))
2023
+ children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
2018
2024
  }, `group-${t}`);
2019
2025
  let r = e.rows.filter((e) => e.failed).length;
2020
2026
  return /* @__PURE__ */ y("details", {
@@ -2036,7 +2042,7 @@ function en({ events: e, lastRequest: t, onClear: n }) {
2036
2042
  ]
2037
2043
  }), /* @__PURE__ */ v("div", {
2038
2044
  className: "bailey-trace-rows",
2039
- children: e.rows.map((e) => /* @__PURE__ */ v(Zt, { row: e }, e.key))
2045
+ children: e.rows.map((e) => /* @__PURE__ */ v(tn, { row: e }, e.key))
2040
2046
  })]
2041
2047
  }, `group-${t}`);
2042
2048
  })
@@ -2044,8 +2050,8 @@ function en({ events: e, lastRequest: t, onClear: n }) {
2044
2050
  ]
2045
2051
  });
2046
2052
  }
2047
- function tn({ events: e, lastRequest: t, onClear: n }) {
2048
- let [r, i] = f(!1), a = u(() => lt(e), [e]), o = u(() => st(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]);
2049
2055
  return e.length === 0 && !t ? null : /* @__PURE__ */ y("div", {
2050
2056
  className: "bailey-trace-panel",
2051
2057
  children: [/* @__PURE__ */ y("div", {
@@ -2066,7 +2072,7 @@ function tn({ events: e, lastRequest: t, onClear: n }) {
2066
2072
  className: a ? "bailey-trace-summary bailey-trace-summary-error" : "bailey-trace-summary",
2067
2073
  children: o
2068
2074
  })]
2069
- }), r && /* @__PURE__ */ v(en, {
2075
+ }), r && /* @__PURE__ */ v(an, {
2070
2076
  events: e,
2071
2077
  lastRequest: t,
2072
2078
  onClear: n
@@ -2074,7 +2080,7 @@ function tn({ events: e, lastRequest: t, onClear: n }) {
2074
2080
  });
2075
2081
  }
2076
2082
  // src/ui/ToolResultImage.tsx
2077
- function nn({ src: e, alt: n, className: r }) {
2083
+ function sn({ src: e, alt: n, className: r }) {
2078
2084
  return t(e) ? /* @__PURE__ */ v("img", {
2079
2085
  src: e,
2080
2086
  alt: n ?? "",
@@ -2083,20 +2089,20 @@ function nn({ src: e, alt: n, className: r }) {
2083
2089
  }) : null;
2084
2090
  }
2085
2091
  // src/utils/safeMcpAppResource.ts
2086
- var rn = /^ui:\/\//, an = 2097152, on = /* @__PURE__ */ new Set([
2092
+ var cn = /^ui:\/\//, ln = 2097152, un = /* @__PURE__ */ new Set([
2087
2093
  "connectDomains",
2088
2094
  "resourceDomains",
2089
2095
  "frameDomains",
2090
2096
  "baseUriDomains"
2091
- ]), sn = /* @__PURE__ */ new Set([
2097
+ ]), dn = /* @__PURE__ */ new Set([
2092
2098
  "camera",
2093
2099
  "microphone",
2094
2100
  "geolocation",
2095
2101
  "clipboardWrite"
2096
- ]), cn = (e, t) => e === void 0 ? !0 : typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.keys(e).every((e) => t.has(e)), ln = (e) => !(!rn.test(e.resourceUri) || typeof e.html != "string" || e.html.length === 0 || e.html.length > an || !cn(e.csp, on) || !cn(e.permissions, sn));
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));
2097
2103
  // src/ui/McpAppFrame.tsx
2098
- function un({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2099
- return ln({
2104
+ function mn({ html: e, title: t, resourceUri: n, csp: r, permissions: i, className: a }) {
2105
+ return pn({
2100
2106
  html: e,
2101
2107
  resourceUri: n,
2102
2108
  csp: r,
@@ -2110,15 +2116,15 @@ function un({ html: e, title: t, resourceUri: n, csp: r, permissions: i, classNa
2110
2116
  }) : null;
2111
2117
  }
2112
2118
  // src/ui/BaileyToolSteps.tsx
2113
- function dn({ toolName: e, resolveActivityIcon: t }) {
2119
+ function hn({ toolName: e, resolveActivityIcon: t }) {
2114
2120
  let n = t?.(e);
2115
2121
  return n === 0 || n && n !== !0 ? /* @__PURE__ */ v("span", {
2116
2122
  className: "bailey-activity-icon",
2117
2123
  children: n
2118
2124
  }) : null;
2119
2125
  }
2120
- function fn({ offsetMs: e, labels: t }) {
2121
- let n = at(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);
2122
2128
  return /* @__PURE__ */ v("span", {
2123
2129
  className: "bailey-tool-step-start",
2124
2130
  title: r,
@@ -2127,7 +2133,7 @@ function fn({ offsetMs: e, labels: t }) {
2127
2133
  children: n
2128
2134
  });
2129
2135
  }
2130
- function pn({ steps: e, resolveActivityIcon: t }) {
2136
+ function _n({ steps: e, resolveActivityIcon: t }) {
2131
2137
  let n = e.filter((e) => e.status === "running");
2132
2138
  return n.length === 0 ? null : /* @__PURE__ */ v("div", {
2133
2139
  className: "bailey-tool-steps-live",
@@ -2136,7 +2142,7 @@ function pn({ steps: e, resolveActivityIcon: t }) {
2136
2142
  children: n.map((e) => /* @__PURE__ */ y("div", {
2137
2143
  className: "bailey-activity-line",
2138
2144
  children: [
2139
- /* @__PURE__ */ v(dn, {
2145
+ /* @__PURE__ */ v(hn, {
2140
2146
  toolName: e.toolName,
2141
2147
  resolveActivityIcon: t
2142
2148
  }),
@@ -2149,7 +2155,7 @@ function pn({ steps: e, resolveActivityIcon: t }) {
2149
2155
  }, e.key))
2150
2156
  });
2151
2157
  }
2152
- function mn({ steps: e, labels: t, resolveActivityIcon: n }) {
2158
+ function vn({ steps: e, labels: t, resolveActivityIcon: n }) {
2153
2159
  if (e.length === 0) return null;
2154
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;
2155
2161
  return /* @__PURE__ */ y("details", {
@@ -2159,12 +2165,12 @@ function mn({ steps: e, labels: t, resolveActivityIcon: n }) {
2159
2165
  children: e.map((e) => /* @__PURE__ */ y("li", {
2160
2166
  className: "bailey-tool-step",
2161
2167
  children: [
2162
- /* @__PURE__ */ v(dn, {
2168
+ /* @__PURE__ */ v(hn, {
2163
2169
  toolName: e.toolName,
2164
2170
  resolveActivityIcon: n
2165
2171
  }),
2166
2172
  /* @__PURE__ */ v("span", { children: e.label }),
2167
- e.startOffsetMs !== void 0 && /* @__PURE__ */ v(fn, {
2173
+ e.startOffsetMs !== void 0 && /* @__PURE__ */ v(gn, {
2168
2174
  offsetMs: e.startOffsetMs,
2169
2175
  labels: t
2170
2176
  }),
@@ -2180,28 +2186,28 @@ function mn({ steps: e, labels: t, resolveActivityIcon: n }) {
2180
2186
  });
2181
2187
  }
2182
2188
  // src/utils/relativeTime.ts
2183
- var hn = /(Z|[+-]\d{2}:?\d{2})$/i, gn = 60, _n = 3600, vn = 24 * _n, yn = 30 * vn * 1e3;
2184
- function bn(e) {
2185
- return e ? Date.parse(hn.test(e) ? e : `${e}Z`) : NaN;
2189
+ var yn = /(Z|[+-]\d{2}:?\d{2})$/i, bn = 60, xn = 3600, Sn = 24 * xn, Cn = 30 * Sn * 1e3;
2190
+ function wn(e) {
2191
+ return e ? Date.parse(yn.test(e) ? e : `${e}Z`) : NaN;
2186
2192
  }
2187
- function xn(e) {
2188
- let t = bn(e.iso);
2193
+ function Tn(e) {
2194
+ let t = wn(e.iso);
2189
2195
  if (Number.isNaN(t)) return "";
2190
2196
  let n = e.now ?? Date.now(), r = Math.max(0, n - t);
2191
2197
  if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return e.justNowText ?? "";
2192
- if (r >= yn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2198
+ if (r >= Cn) return new Intl.DateTimeFormat(e.locale, { dateStyle: "medium" }).format(t);
2193
2199
  let i = r / 1e3, a = new Intl.RelativeTimeFormat(e.locale, { numeric: "auto" });
2194
- return i < gn ? a.format(0, "second") : i < _n ? a.format(-Math.floor(i / gn), "minute") : i < vn ? a.format(-Math.floor(i / _n), "hour") : a.format(-Math.floor(i / vn), "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");
2195
2201
  }
2196
2202
  // src/ui/BaileyHistoryDrawer.tsx
2197
- function Sn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2198
- let s = G({
2203
+ function En({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o }) {
2204
+ let s = V({
2199
2205
  client: e,
2200
2206
  pageSize: t
2201
2207
  }), { loadConversation: c, newChat: l } = n, u = a((e) => c ? c(e) : Promise.reject(/* @__PURE__ */ Error("no loadConversation")), [c]), d = a(() => {
2202
2208
  l(), o({ restoreFocusTo: "input" });
2203
2209
  }, [l, o]);
2204
- return /* @__PURE__ */ v(Tn, {
2210
+ return /* @__PURE__ */ v(kn, {
2205
2211
  conversations: s,
2206
2212
  activeConversationId: n.conversationId,
2207
2213
  selectStatus: n.historyStatus,
@@ -2213,9 +2219,9 @@ function Sn({ client: e, pageSize: t, chat: n, labels: r, locale: i, onClose: o
2213
2219
  locale: i
2214
2220
  });
2215
2221
  }
2216
- var Cn = (e, t) => Object.entries(t).reduce((e, [t, n]) => e.split(`{${t}}`).join(String(n)), e), wn = (e) => !e || e.kind !== "http" ? !1 : e.status === 401 || e.status === 403;
2217
- function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSelect: r, onActiveDeleted: i, onNewChat: a, onClose: o, labels: l, locale: u, now: p }) {
2218
- let { conversations: m, status: h, error: g, hasMore: b, refresh: ee, loadMore: x, remove: S } = e, C = c(), w = c(), T = d(null), E = d(null), D = d(null), O = d(/* @__PURE__ */ new Map()), k = d(/* @__PURE__ */ new Map()), A = d(null), j = d(null), [M, N] = f(null), [P, F] = f(null), [I, te] = f(0), [ne, re] = f(!1), [L, ie] = f(!1), [ae, R] = f(!1), z = 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);
2219
2225
  s(() => {
2220
2226
  T.current?.focus();
2221
2227
  }, []), s(() => {
@@ -2234,52 +2240,52 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2234
2240
  b,
2235
2241
  m
2236
2242
  ]);
2237
- let B = () => {
2238
- j.current = m.length, x();
2239
- }, oe = (e) => {
2243
+ let ce = () => {
2244
+ j.current = m.length, S();
2245
+ }, R = (e) => {
2240
2246
  A.current = {
2241
2247
  kind: "delete",
2242
2248
  id: e
2243
- }, N(null);
2244
- }, se = (e) => {
2245
- e.key === "Escape" && (e.stopPropagation(), M ? oe(M) : o({ restoreFocusTo: "menu" }));
2246
- }, ce = async (e) => {
2247
- if (R(!1), e === t) o({ restoreFocusTo: "input" });
2249
+ }, ne(null);
2250
+ }, le = (e) => {
2251
+ e.key === "Escape" && (e.stopPropagation(), te ? R(te) : o({ restoreFocusTo: "menu" }));
2252
+ }, ue = async (e) => {
2253
+ if (oe(!1), e === t) o({ restoreFocusTo: "input" });
2248
2254
  else {
2249
- ie(!0);
2255
+ L(!0);
2250
2256
  try {
2251
2257
  await r({ conversationId: e });
2252
2258
  } catch {
2253
2259
  A.current = {
2254
2260
  kind: "select",
2255
2261
  id: e
2256
- }, R(!0), ie(!1);
2262
+ }, oe(!0), L(!1);
2257
2263
  return;
2258
2264
  }
2259
- ie(!1), o({ restoreFocusTo: "input" });
2265
+ L(!1), o({ restoreFocusTo: "input" });
2260
2266
  }
2261
- }, le = async (e) => {
2267
+ }, de = async (e) => {
2262
2268
  let n = m.findIndex((t) => t.conversationId === e), r = m[n + 1] ?? m[n - 1];
2263
2269
  A.current = r ? {
2264
2270
  kind: "select",
2265
2271
  id: r.conversationId
2266
- } : { kind: "newChat" }, N(null), F(null), re(!1), te((e) => e + 1);
2272
+ } : { kind: "newChat" }, ne(null), N(null), I(!1), re((e) => e + 1);
2267
2273
  try {
2268
- await S({ conversationId: e }), re(!0), e === t && i?.();
2274
+ await C({ conversationId: e }), I(!0), e === t && i?.();
2269
2275
  } catch {
2270
2276
  A.current = {
2271
2277
  kind: "delete",
2272
2278
  id: e
2273
- }, F(e);
2279
+ }, N(e);
2274
2280
  } finally {
2275
- te((e) => e - 1);
2281
+ re((e) => e - 1);
2276
2282
  }
2277
- }, V = h === "loading" && m.length === 0, ue = h === "error" && m.length === 0, de = h === "error" && m.length > 0 && b, H = h === "loading" && m.length > 0, U = L || n === "loading", fe = V ? l.historyLoadingText : I > 0 ? l.historyDeletingText : ne ? l.historyDeletedText : m.length > 0 ? Cn(m.length === 1 ? l.historyCountTextOne : l.historyCountTextMany, { count: m.length }) : "", W = V || I > 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;
2278
2284
  return /* @__PURE__ */ y("section", {
2279
2285
  role: "region",
2280
- "aria-labelledby": C,
2286
+ "aria-labelledby": ee,
2281
2287
  className: "bailey-history-drawer",
2282
- onKeyDown: se,
2288
+ onKeyDown: le,
2283
2289
  children: [
2284
2290
  /* @__PURE__ */ y("div", {
2285
2291
  className: "bailey-history-header",
@@ -2289,10 +2295,10 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2289
2295
  className: "bailey-history-icon-button",
2290
2296
  "aria-label": l.historyBackAriaLabel,
2291
2297
  onClick: () => o({ restoreFocusTo: "menu" }),
2292
- children: /* @__PURE__ */ v(Ht, { className: "bailey-history-icon" })
2298
+ children: /* @__PURE__ */ v(Kt, { className: "bailey-history-icon" })
2293
2299
  }),
2294
2300
  /* @__PURE__ */ v("h3", {
2295
- id: C,
2301
+ id: ee,
2296
2302
  ref: T,
2297
2303
  tabIndex: -1,
2298
2304
  className: "bailey-history-heading",
@@ -2303,9 +2309,9 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2303
2309
  type: "button",
2304
2310
  className: "bailey-history-button bailey-history-new-chat",
2305
2311
  "aria-label": l.newChatButtonText,
2306
- disabled: V,
2312
+ disabled: z,
2307
2313
  onClick: a,
2308
- children: [/* @__PURE__ */ v(Lt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2314
+ children: [/* @__PURE__ */ v(Vt, { className: "bailey-history-icon-small" }), /* @__PURE__ */ v("span", {
2309
2315
  className: "bailey-history-new-chat-text",
2310
2316
  children: l.newChatButtonText
2311
2317
  })]
@@ -2314,9 +2320,9 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2314
2320
  }),
2315
2321
  /* @__PURE__ */ y("div", {
2316
2322
  className: "bailey-history-body",
2317
- "aria-busy": V || void 0,
2323
+ "aria-busy": z || void 0,
2318
2324
  children: [
2319
- V && /* @__PURE__ */ y("div", {
2325
+ z && /* @__PURE__ */ y("div", {
2320
2326
  "aria-hidden": "true",
2321
2327
  children: [
2322
2328
  /* @__PURE__ */ v("div", { className: "bailey-history-skeleton" }),
@@ -2325,25 +2331,25 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2325
2331
  /* @__PURE__ */ v("div", { className: "bailey-history-skeleton" })
2326
2332
  ]
2327
2333
  }),
2328
- ue && /* @__PURE__ */ y("div", {
2334
+ fe && /* @__PURE__ */ y("div", {
2329
2335
  role: "alert",
2330
2336
  className: "bailey-history-state bailey-history-state-error",
2331
2337
  children: [
2332
- /* @__PURE__ */ v(Wt, { className: "bailey-history-state-icon" }),
2333
- /* @__PURE__ */ v("strong", { children: wn(g) ? l.historySessionExpiredTitle : l.historyErrorTitle }),
2334
- /* @__PURE__ */ v("span", { children: wn(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 }),
2335
2341
  /* @__PURE__ */ v("button", {
2336
2342
  type: "button",
2337
2343
  className: "bailey-history-button bailey-history-button-primary",
2338
- onClick: () => void ee(),
2344
+ onClick: () => void x(),
2339
2345
  children: l.retryButtonText
2340
2346
  })
2341
2347
  ]
2342
2348
  }),
2343
- !V && !ue && m.length === 0 && /* @__PURE__ */ y("div", {
2349
+ !z && !fe && m.length === 0 && /* @__PURE__ */ y("div", {
2344
2350
  className: "bailey-history-state",
2345
2351
  children: [
2346
- /* @__PURE__ */ v(Pt, { className: "bailey-history-state-icon" }),
2352
+ /* @__PURE__ */ v(Rt, { className: "bailey-history-state-icon" }),
2347
2353
  /* @__PURE__ */ v("strong", { children: l.historyEmptyTitle }),
2348
2354
  /* @__PURE__ */ v("span", { children: l.historyEmptyDescription }),
2349
2355
  /* @__PURE__ */ v("button", {
@@ -2358,7 +2364,7 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2358
2364
  className: "bailey-history-list",
2359
2365
  children: m.map((e) => {
2360
2366
  let n = e.conversationId, r = e.title?.trim() ? e.title : l.historyUntitledText, i = n === t;
2361
- if (M === n) return /* @__PURE__ */ v("li", {
2367
+ if (te === n) return /* @__PURE__ */ v("li", {
2362
2368
  className: "bailey-history-row bailey-history-row-confirming",
2363
2369
  children: /* @__PURE__ */ y("div", {
2364
2370
  role: "group",
@@ -2377,25 +2383,25 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2377
2383
  /* @__PURE__ */ v("button", {
2378
2384
  type: "button",
2379
2385
  className: "bailey-history-button bailey-history-button-danger",
2380
- onClick: () => void le(n),
2386
+ onClick: () => void de(n),
2381
2387
  children: l.historyDeleteConfirmText
2382
2388
  }),
2383
2389
  /* @__PURE__ */ v("button", {
2384
2390
  ref: D,
2385
2391
  type: "button",
2386
2392
  className: "bailey-history-button",
2387
- onClick: () => oe(n),
2393
+ onClick: () => R(n),
2388
2394
  children: l.historyDeleteCancelText
2389
2395
  })
2390
2396
  ]
2391
2397
  })
2392
2398
  }, n);
2393
- let a = xn({
2399
+ let a = Tn({
2394
2400
  iso: e.updatedAt,
2395
- locale: z,
2401
+ locale: se,
2396
2402
  now: p?.(),
2397
2403
  justNowText: l.historyJustNowText
2398
- }), o = Cn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = P === n;
2404
+ }), o = Dn(e.messageCount === 1 ? l.historyMessageCountOne : l.historyMessageCountMany, { count: e.messageCount }), s = M === n;
2399
2405
  return /* @__PURE__ */ y("li", {
2400
2406
  className: `bailey-history-row${i ? " bailey-history-row-active" : ""}${s ? " bailey-history-row-failed" : ""}`,
2401
2407
  children: [
@@ -2406,9 +2412,9 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2406
2412
  },
2407
2413
  className: "bailey-history-select",
2408
2414
  "aria-current": i ? "true" : void 0,
2409
- "aria-disabled": U || void 0,
2415
+ "aria-disabled": me || void 0,
2410
2416
  onClick: () => {
2411
- U || ce(n);
2417
+ me || ue(n);
2412
2418
  },
2413
2419
  children: [/* @__PURE__ */ v("span", {
2414
2420
  className: "bailey-history-row-title",
@@ -2437,28 +2443,28 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2437
2443
  e ? k.current.set(n, e) : k.current.delete(n);
2438
2444
  },
2439
2445
  className: "bailey-history-icon-button bailey-history-delete",
2440
- "aria-label": Cn(l.historyDeleteAriaLabel, { title: r }),
2446
+ "aria-label": Dn(l.historyDeleteAriaLabel, { title: r }),
2441
2447
  onClick: () => {
2442
- F(null), re(!1), A.current = { kind: "cancel" }, N(n);
2448
+ N(null), I(!1), A.current = { kind: "cancel" }, ne(n);
2443
2449
  },
2444
- children: /* @__PURE__ */ v(Ut, { className: "bailey-history-icon" })
2450
+ children: /* @__PURE__ */ v(qt, { className: "bailey-history-icon" })
2445
2451
  }),
2446
2452
  s && /* @__PURE__ */ y("div", {
2447
2453
  role: "alert",
2448
2454
  className: "bailey-history-row-error",
2449
2455
  children: [
2450
- /* @__PURE__ */ v(Wt, { className: "bailey-history-icon-small" }),
2456
+ /* @__PURE__ */ v(Jt, { className: "bailey-history-icon-small" }),
2451
2457
  /* @__PURE__ */ v("span", { children: l.historyDeleteFailedText }),
2452
2458
  /* @__PURE__ */ v("button", {
2453
2459
  type: "button",
2454
2460
  className: "bailey-history-button bailey-history-button-small",
2455
- onClick: () => void le(n),
2461
+ onClick: () => void de(n),
2456
2462
  children: l.historyDeleteRetryText
2457
2463
  }),
2458
2464
  /* @__PURE__ */ v("button", {
2459
2465
  type: "button",
2460
2466
  className: "bailey-history-button bailey-history-button-small",
2461
- onClick: () => F(null),
2467
+ onClick: () => N(null),
2462
2468
  children: l.historyDeleteDismissText
2463
2469
  })
2464
2470
  ]
@@ -2474,24 +2480,24 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2474
2480
  }),
2475
2481
  b && m.length > 0 && /* @__PURE__ */ v("div", {
2476
2482
  className: "bailey-history-more",
2477
- children: de ? /* @__PURE__ */ y("div", {
2483
+ children: pe ? /* @__PURE__ */ y("div", {
2478
2484
  role: "alert",
2479
2485
  className: "bailey-history-inline-error",
2480
2486
  children: [/* @__PURE__ */ v("span", { children: l.historyLoadMoreErrorText }), /* @__PURE__ */ v("button", {
2481
2487
  type: "button",
2482
2488
  className: "bailey-history-button",
2483
- onClick: B,
2489
+ onClick: ce,
2484
2490
  children: l.retryButtonText
2485
2491
  })]
2486
2492
  }) : /* @__PURE__ */ y("button", {
2487
2493
  type: "button",
2488
2494
  className: "bailey-history-button",
2489
- disabled: H,
2490
- onClick: B,
2491
- children: [H && /* @__PURE__ */ v("span", {
2495
+ disabled: B,
2496
+ onClick: ce,
2497
+ children: [B && /* @__PURE__ */ v("span", {
2492
2498
  className: "bailey-history-spinner",
2493
2499
  "aria-hidden": "true"
2494
- }), H ? l.historyLoadingMoreText : l.historyLoadMoreText]
2500
+ }), B ? l.historyLoadingMoreText : l.historyLoadMoreText]
2495
2501
  })
2496
2502
  })
2497
2503
  ]
@@ -2500,16 +2506,16 @@ function Tn({ conversations: e, activeConversationId: t, selectStatus: n, onSele
2500
2506
  role: "status",
2501
2507
  "aria-live": "polite",
2502
2508
  className: "bailey-history-status",
2503
- children: [W && /* @__PURE__ */ v("span", {
2509
+ children: [ge && /* @__PURE__ */ v("span", {
2504
2510
  className: "bailey-history-spinner",
2505
2511
  "aria-hidden": "true"
2506
- }), fe]
2512
+ }), he]
2507
2513
  })
2508
2514
  ]
2509
2515
  });
2510
2516
  }
2511
2517
  // src/ui/historyLabels.ts
2512
- var En = {
2518
+ var An = {
2513
2519
  newChatButtonText: "New chat",
2514
2520
  retryButtonText: "Retry",
2515
2521
  historyTitle: "Chat history",
@@ -2542,13 +2548,12 @@ var En = {
2542
2548
  historyDeleteRetryText: "Try again",
2543
2549
  historyDeleteDismissText: "Dismiss",
2544
2550
  historyJustNowText: "just now"
2545
- }, Dn = {
2551
+ }, jn = {
2546
2552
  feedbackGroupLabel: "Rate this response",
2547
2553
  feedbackThumbsUpAriaLabel: "Good response",
2548
2554
  feedbackThumbsDownAriaLabel: "Bad response",
2549
2555
  feedbackReasonGroupLabel: "What went wrong?",
2550
2556
  feedbackCommentLabel: "Tell us more",
2551
- feedbackCommentPlaceholder: "What should Bailey have said or done differently?",
2552
2557
  feedbackSubmitText: "Submit",
2553
2558
  feedbackCancelText: "Cancel",
2554
2559
  feedbackThanksText: "Thanks for your feedback",
@@ -2563,49 +2568,50 @@ var En = {
2563
2568
  feedbackReasonUnsafe: "Unsafe",
2564
2569
  feedbackReasonTooLong: "Too long",
2565
2570
  feedbackReasonOther: "Other"
2566
- }, On = 2e3, kn = [
2571
+ }, Mn = 2e3, Nn = [
2567
2572
  "inaccurate",
2568
2573
  "unhelpful",
2569
2574
  "unsafe",
2570
2575
  "too_long",
2571
2576
  "other"
2572
- ], An = {
2577
+ ], Pn = {
2573
2578
  inaccurate: "feedbackReasonInaccurate",
2574
2579
  unhelpful: "feedbackReasonUnhelpful",
2575
2580
  unsafe: "feedbackReasonUnsafe",
2576
2581
  too_long: "feedbackReasonTooLong",
2577
2582
  other: "feedbackReasonOther"
2578
- }, jn = (e) => kn.includes(e) ? e : "other";
2579
- function Mn(e) {
2580
- return Array.from(new Set((e ?? kn).map(jn)));
2583
+ }, Fn = (e) => Nn.includes(e) ? e : "other";
2584
+ function In(e) {
2585
+ return Array.from(new Set((e ?? Nn).map(Fn)));
2581
2586
  }
2582
- function Nn(e) {
2583
- return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), On) : On;
2587
+ function Ln(e) {
2588
+ return typeof e == "number" && e > 0 ? Math.min(Math.floor(e), Mn) : Mn;
2584
2589
  }
2585
- function Pn(e, t) {
2590
+ function Rn(e, t) {
2586
2591
  if (e === null || t === null) return e === t;
2587
2592
  let n = e.reasonCodes ?? [], r = t.reasonCodes ?? [];
2588
2593
  return e.rating === t.rating && (e.comment ?? "") === (t.comment ?? "") && n.length === r.length && n.every((e, t) => e === r[t]);
2589
2594
  }
2590
- function Fn(e) {
2591
- let t = o(Dt), n = t && !t.builtIn ? t.claim : void 0, { messageId: r } = e;
2592
- return l(() => n && r ? n(r) : void 0, [n, r]), e.messageId ? /* @__PURE__ */ v(In, { ...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;
2593
2598
  }
2594
- function In({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, className: l }) {
2595
- let u = {
2596
- ...Dn,
2599
+ function Bn({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOptions: i, maxCommentLength: a, labels: o, assistantName: l = "bailey", className: u }) {
2600
+ let p = {
2601
+ ...jn,
2602
+ feedbackCommentPlaceholder: `What should ${l} have said or done differently?`,
2597
2603
  ...o
2598
- }, p = Mn(i), m = Nn(a), h = r ? { rating: r } : null, [b, ee] = f(h), [x, S] = f(r ?? null), [C, w] = f(!1), [T, E] = f("down"), [D, O] = f([]), [k, A] = f(""), [j, M] = f(!1), [N, P] = f(!1), [F, I] = f(!1), [te, ne] = f(!1), re = d(h), L = d(null), ie = d(0), ae = d(!1), R = d(!0), z = d(null), B = d(null), oe = d(null), se = d(null), ce = d(null), le = Et(B), V = c(), ue = `${V}-comment`, de = `${V}-counter`, H = `${V}-privacy`;
2599
- s(() => (R.current = !0, () => {
2600
- R.current = !1;
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
+ s(() => (se.current = !0, () => {
2606
+ se.current = !1;
2601
2607
  }), []), s(() => {
2602
- C && ce.current?.focus();
2603
- }, [C]), s(() => {
2604
- z.current && !F && !C && ((z.current === "up" ? oe : se).current?.focus(), z.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);
2605
2611
  });
2606
- let U = () => {
2607
- O([]), A("");
2608
- }, fe = async (r) => {
2612
+ let he = () => {
2613
+ k([]), j("");
2614
+ }, ge = async (r) => {
2609
2615
  try {
2610
2616
  return r.kind === "clear" ? await n({ messageId: e }) : await t({
2611
2617
  messageId: e,
@@ -2614,73 +2620,73 @@ function In({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2614
2620
  } catch {
2615
2621
  return !1;
2616
2622
  }
2617
- }, W = async () => {
2618
- if (!ae.current) {
2619
- ae.current = !0, P(!0);
2623
+ }, _e = async () => {
2624
+ if (!oe.current) {
2625
+ oe.current = !0, N(!0);
2620
2626
  try {
2621
- for (; L.current && R.current;) {
2622
- let e = L.current, t = e.kind === "clear" ? null : e.snapshot, n = !(e.kind === "submit" && e.formSubmit) && Pn(t, re.current) || await fe(e);
2623
- if (!R.current) return;
2627
+ for (; L.current && se.current;) {
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
+ if (!se.current) return;
2624
2630
  let r = L.current?.version !== e.version;
2625
- (n || !r) && (n ? (re.current = t, ee(t)) : (S(re.current?.rating ?? null), ne(!0)), r || (L.current = null, I(!1), n && e.kind === "submit" && e.formSubmit && (w(!1), M(!0), z.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)));
2626
2632
  }
2627
2633
  } finally {
2628
- ae.current = !1, R.current && P(!1);
2634
+ oe.current = !1, se.current && N(!1);
2629
2635
  }
2630
2636
  }
2631
- }, pe = (e) => {
2632
- ie.current += 1, L.current = {
2637
+ }, ve = (e) => {
2638
+ ae.current += 1, L.current = {
2633
2639
  ...e,
2634
- version: ie.current
2635
- }, ne(!1), W();
2636
- }, G = () => {
2637
- S(null), w(!1), M(!1), U(), pe({ kind: "clear" });
2638
- }, me = (e) => {
2639
- F || (x === e ? G() : (S(e), M(!1), U(), e === "down" ? (E("down"), w(!0)) : w(!1), pe({
2640
+ version: ae.current
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({
2640
2646
  kind: "submit",
2641
2647
  snapshot: { rating: e },
2642
2648
  formSubmit: !1
2643
2649
  })));
2644
- }, he = (e) => {
2645
- x !== null && (E(x), O((e?.reasonCodes ?? []).map(jn)), A(e?.comment ?? ""), ne(!1), w(!0));
2646
- }, K = () => {
2647
- F || (w(!1), ne(!1), U(), z.current = T);
2648
- }, q = () => {
2649
- if (F) return;
2650
- let e = k.trim(), t = p.filter((e) => D.includes(e)), n = {
2651
- rating: T,
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
+ if (P) return;
2656
+ let e = A.trim(), t = m.filter((e) => O.includes(e)), n = {
2657
+ rating: E,
2652
2658
  ...t.length > 0 ? { reasonCodes: t } : {},
2653
2659
  ...e ? { comment: e } : {}
2654
2660
  };
2655
- I(!0), S(T), pe({
2661
+ re(!0), ee(E), ve({
2656
2662
  kind: "submit",
2657
2663
  snapshot: n,
2658
2664
  formSubmit: !0
2659
2665
  });
2660
- }, J = (e) => {
2661
- O((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
2662
- }, ge = (e) => {
2663
- e.key === "Escape" && (e.stopPropagation(), K());
2664
- }, _e = x !== null && b?.rating === x && !N && !C, ve = !!b && (!!b.comment || (b.reasonCodes?.length ?? 0) > 0), ye = N ? u.feedbackSavingText : _e ? u.feedbackThanksText : "", Y = (e) => {
2665
- let t = x === e, n = e === "up" ? u.feedbackThumbsUpAriaLabel : u.feedbackThumbsDownAriaLabel, r = e === "up" ? Bt : Vt;
2666
+ }, U = (e) => {
2667
+ k((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
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;
2666
2672
  return /* @__PURE__ */ y(g.Root, { children: [/* @__PURE__ */ v(g.Trigger, {
2667
2673
  asChild: !0,
2668
2674
  children: /* @__PURE__ */ v("button", {
2669
- ref: e === "up" ? oe : se,
2675
+ ref: e === "up" ? le : ue,
2670
2676
  type: "button",
2671
2677
  className: "bailey-feedback-thumb",
2672
2678
  "aria-pressed": t,
2673
2679
  "aria-label": n,
2674
- "aria-busy": t && N ? !0 : void 0,
2675
- disabled: F,
2676
- onClick: () => me(e),
2680
+ "aria-busy": t && M ? !0 : void 0,
2681
+ disabled: P,
2682
+ onClick: () => be(e),
2677
2683
  children: /* @__PURE__ */ v(r, {
2678
2684
  className: "bailey-feedback-icon",
2679
2685
  filled: t
2680
2686
  })
2681
2687
  })
2682
2688
  }), /* @__PURE__ */ v(g.Portal, {
2683
- container: le instanceof ShadowRoot ? le : void 0,
2689
+ container: z instanceof ShadowRoot ? z : void 0,
2684
2690
  children: /* @__PURE__ */ y(g.Content, {
2685
2691
  side: "top",
2686
2692
  className: "bailey-tooltip-content",
@@ -2689,95 +2695,95 @@ function In({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2689
2695
  })] });
2690
2696
  };
2691
2697
  return /* @__PURE__ */ y("div", {
2692
- ref: B,
2693
- className: `bailey-feedback${l ? ` ${l}` : ""}`,
2698
+ ref: R,
2699
+ className: `bailey-feedback${u ? ` ${u}` : ""}`,
2694
2700
  children: [
2695
2701
  /* @__PURE__ */ v(g.Provider, {
2696
2702
  delayDuration: 200,
2697
2703
  children: /* @__PURE__ */ y("div", {
2698
2704
  role: "group",
2699
- "aria-label": u.feedbackGroupLabel,
2700
- "aria-busy": N ? !0 : void 0,
2705
+ "aria-label": p.feedbackGroupLabel,
2706
+ "aria-busy": M ? !0 : void 0,
2701
2707
  className: "bailey-feedback-thumbs",
2702
- children: [Y("up"), Y("down")]
2708
+ children: [Ce("up"), Ce("down")]
2703
2709
  })
2704
2710
  }),
2705
2711
  /* @__PURE__ */ y("span", {
2706
2712
  role: "status",
2707
2713
  className: "bailey-feedback-status",
2708
- children: [N && /* @__PURE__ */ v("span", {
2714
+ children: [M && /* @__PURE__ */ v("span", {
2709
2715
  className: "bailey-feedback-spinner",
2710
2716
  "aria-hidden": "true"
2711
- }), ye]
2717
+ }), Se]
2712
2718
  }),
2713
- _e && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
2719
+ G && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
2714
2720
  type: "button",
2715
2721
  className: "bailey-feedback-link",
2716
- onClick: () => he(b),
2717
- children: j || ve ? u.feedbackEditText : u.feedbackAddCommentText
2722
+ onClick: () => V(x),
2723
+ children: te || K ? p.feedbackEditText : p.feedbackAddCommentText
2718
2724
  }), /* @__PURE__ */ v("button", {
2719
2725
  type: "button",
2720
2726
  className: "bailey-feedback-link",
2721
- onClick: G,
2722
- children: u.feedbackUndoText
2727
+ onClick: ye,
2728
+ children: p.feedbackUndoText
2723
2729
  })] }),
2724
- te && /* @__PURE__ */ v("span", {
2730
+ F && /* @__PURE__ */ v("span", {
2725
2731
  role: "alert",
2726
2732
  className: "bailey-feedback-error",
2727
- children: u.feedbackErrorText
2733
+ children: p.feedbackErrorText
2728
2734
  }),
2729
- C && /* @__PURE__ */ y("div", {
2735
+ w && /* @__PURE__ */ y("div", {
2730
2736
  className: "bailey-feedback-form",
2731
- onKeyDown: ge,
2737
+ onKeyDown: W,
2732
2738
  children: [
2733
- p.length > 0 && /* @__PURE__ */ y("fieldset", {
2739
+ m.length > 0 && /* @__PURE__ */ y("fieldset", {
2734
2740
  className: "bailey-feedback-reasons",
2735
2741
  children: [/* @__PURE__ */ v("legend", {
2736
2742
  className: "bailey-feedback-legend",
2737
- children: u.feedbackReasonGroupLabel
2743
+ children: p.feedbackReasonGroupLabel
2738
2744
  }), /* @__PURE__ */ v("div", {
2739
2745
  className: "bailey-feedback-chips",
2740
- children: p.map((e, t) => /* @__PURE__ */ v("button", {
2746
+ children: m.map((e, t) => /* @__PURE__ */ v("button", {
2741
2747
  ref: t === 0 ? (e) => {
2742
- ce.current = e;
2748
+ de.current = e;
2743
2749
  } : void 0,
2744
2750
  type: "button",
2745
2751
  className: "bailey-feedback-chip",
2746
- "aria-pressed": D.includes(e),
2747
- disabled: F,
2748
- onClick: () => J(e),
2749
- children: u[An[e]]
2752
+ "aria-pressed": O.includes(e),
2753
+ disabled: P,
2754
+ onClick: () => U(e),
2755
+ children: p[Pn[e]]
2750
2756
  }, e))
2751
2757
  })]
2752
2758
  }),
2753
2759
  /* @__PURE__ */ v("label", {
2754
- htmlFor: ue,
2760
+ htmlFor: pe,
2755
2761
  className: "bailey-feedback-legend",
2756
- children: u.feedbackCommentLabel
2762
+ children: p.feedbackCommentLabel
2757
2763
  }),
2758
2764
  /* @__PURE__ */ v("textarea", {
2759
- id: ue,
2760
- ref: p.length === 0 ? (e) => {
2761
- ce.current = e;
2765
+ id: pe,
2766
+ ref: m.length === 0 ? (e) => {
2767
+ de.current = e;
2762
2768
  } : void 0,
2763
2769
  className: "bailey-feedback-textarea",
2764
- value: k,
2765
- maxLength: m,
2766
- placeholder: u.feedbackCommentPlaceholder,
2767
- "aria-describedby": `${de} ${H}`,
2768
- disabled: F,
2769
- onChange: (e) => A(e.target.value.slice(0, m))
2770
+ value: A,
2771
+ maxLength: h,
2772
+ placeholder: p.feedbackCommentPlaceholder,
2773
+ "aria-describedby": `${B} ${me}`,
2774
+ disabled: P,
2775
+ onChange: (e) => j(e.target.value.slice(0, h))
2770
2776
  }),
2771
2777
  /* @__PURE__ */ y("div", {
2772
2778
  className: "bailey-feedback-meta",
2773
2779
  children: [/* @__PURE__ */ v("span", {
2774
- id: H,
2780
+ id: me,
2775
2781
  className: "bailey-feedback-privacy",
2776
- children: u.feedbackPrivacyNote
2782
+ children: p.feedbackPrivacyNote
2777
2783
  }), /* @__PURE__ */ v("span", {
2778
- id: de,
2784
+ id: B,
2779
2785
  className: "bailey-feedback-counter",
2780
- children: `${k.length} / ${m}`
2786
+ children: `${A.length} / ${h}`
2781
2787
  })]
2782
2788
  }),
2783
2789
  /* @__PURE__ */ y("div", {
@@ -2785,15 +2791,15 @@ function In({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2785
2791
  children: [/* @__PURE__ */ v("button", {
2786
2792
  type: "button",
2787
2793
  className: "bailey-feedback-button",
2788
- disabled: F,
2789
- onClick: K,
2790
- children: u.feedbackCancelText
2794
+ disabled: P,
2795
+ onClick: H,
2796
+ children: p.feedbackCancelText
2791
2797
  }), /* @__PURE__ */ v("button", {
2792
2798
  type: "button",
2793
2799
  className: "bailey-feedback-button bailey-feedback-button-primary",
2794
- disabled: F,
2795
- onClick: q,
2796
- children: F ? u.feedbackSavingText : u.feedbackSubmitText
2800
+ disabled: P,
2801
+ onClick: xe,
2802
+ children: P ? p.feedbackSavingText : p.feedbackSubmitText
2797
2803
  })]
2798
2804
  })
2799
2805
  ]
@@ -2802,15 +2808,14 @@ function In({ messageId: e, onSubmit: t, onClear: n, initialRating: r, reasonOpt
2802
2808
  });
2803
2809
  }
2804
2810
  // src/ui/BaileyChatPanel.tsx
2805
- var Ln = "How can bailey AI help you today?", Rn = "Reply to bailey AI", zn = {
2806
- ...En,
2811
+ var Vn = "bailey", Hn = {
2812
+ ...An,
2807
2813
  newChatButtonText: "New chat",
2808
2814
  newChatAriaLabel: "new chat",
2809
2815
  historyAriaLabel: "conversation history",
2810
2816
  historyMenuItemText: "Chat history",
2811
2817
  menuAriaLabel: "more options",
2812
2818
  suggestionsTitle: "Suggested for you",
2813
- emptyStateMessage: "Ask Bailey a question to get started.",
2814
2819
  youLabel: "You",
2815
2820
  thinkingHint: "Thinking…",
2816
2821
  retryButtonText: "Retry",
@@ -2830,118 +2835,120 @@ var Ln = "How can bailey AI help you today?", Rn = "Reply to bailey AI", zn = {
2830
2835
  mcpAppDefaultTitle: "MCP App",
2831
2836
  loadEarlierButtonText: "Load earlier messages",
2832
2837
  loadEarlierErrorText: "Couldn't load earlier messages."
2833
- }, Bn = [m], Vn = {
2834
- ...Ot(),
2838
+ }, Un = [m], Wn = {
2839
+ ...Mt(),
2835
2840
  p: ({ children: e }) => /* @__PURE__ */ v(_, { children: e })
2836
- }, Hn = i(function({ content: e, components: t }) {
2841
+ }, Gn = i(function({ content: e, components: t }) {
2837
2842
  return /* @__PURE__ */ v("div", {
2838
2843
  className: "bailey-markdown-content",
2839
2844
  children: /* @__PURE__ */ v(p, {
2840
- remarkPlugins: Bn,
2845
+ remarkPlugins: Un,
2841
2846
  components: t,
2842
2847
  skipHtml: !0,
2843
2848
  children: e
2844
2849
  })
2845
2850
  });
2846
2851
  });
2847
- function Un(e, t, n) {
2852
+ function Kn(e, t, n) {
2848
2853
  if (e !== "streaming") return;
2849
2854
  let r = t.filter((e) => e.turnSentAt === n?.sentAt);
2850
2855
  return r[r.length - 1];
2851
2856
  }
2852
- function Wn(e) {
2853
- if (e && e.kind !== "tool_end") return rt(e);
2857
+ function qn(e) {
2858
+ if (e && e.kind !== "tool_end") return ot(e);
2854
2859
  }
2855
- function Gn(e) {
2860
+ function Jn(e) {
2856
2861
  let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString(), r = t.toLocaleTimeString([], {
2857
2862
  hour: "numeric",
2858
2863
  minute: "2-digit"
2859
2864
  });
2860
2865
  return n ? `Today ${r}` : `${t.toLocaleDateString()} ${r}`;
2861
2866
  }
2862
- function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholder: i, suggestions: o, onHistoryClick: c, history: l, locale: m, privacyNote: _, resolveActivityIcon: b, sendIcon: ee, className: x, height: S, width: C, hideDeveloperDetails: w = !1, renderMessageActions: T, feedback: E, renderTable: D, renderChart: O, renderMcpApp: k, labels: A, formatMessageTime: j }) {
2863
- let { messages: M, traceEvents: N, lastRequest: P, status: F, error: I, send: te, stop: ne, retryLast: re, clearTrace: L, clearError: ie, newChat: ae } = e, [R, z] = f(""), [B, oe] = f(/* @__PURE__ */ new Map()), se = a((e) => {
2864
- let t = (t) => oe((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) => {
2865
2870
  let r = new Map(n), i = (r.get(e) ?? 0) + t;
2866
2871
  return i > 0 ? r.set(e, i) : r.delete(e), r;
2867
2872
  });
2868
2873
  return t(1), () => t(-1);
2869
- }, []), ce = u(() => ({
2874
+ }, []), fe = u(() => ({
2870
2875
  builtIn: !1,
2871
- claim: se
2872
- }), [se]), le = u(() => ({
2876
+ claim: z
2877
+ }), [z]), pe = u(() => ({
2873
2878
  builtIn: !0,
2874
- claim: se
2875
- }), [se]), V = {
2876
- ...zn,
2877
- ...A
2878
- }, ue = j ?? Gn, de = d(null), H = d(null), U = d(null), fe = d(null), [W, pe] = f(!1), G = d(null), me = d(!1), he = !!c || !!l, K = Tt(de), q = d(null), J = d(null), ge = d(!0), _e = u(() => Ot({
2879
- renderTable: D,
2880
- renderChart: O
2881
- }), [D, O]), ve = u(() => Un(F, N, P), [
2879
+ claim: z
2880
+ }), [z]), B = {
2881
+ ...Hn,
2882
+ emptyStateMessage: `Ask ${o} a question to get started.`,
2883
+ ...ne
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
+ renderTable: A,
2886
+ renderChart: j
2887
+ }), [A, j]), Ce = u(() => Kn(F, P, re), [
2882
2888
  F,
2883
- N,
2884
- P
2885
- ]), ye = Wn(ve), Y = ve?.kind === "tool_end" ? ve.at : void 0, be = M[M.length - 1]?.content.length ?? 0, [xe, Se] = f(null), Ce = xe;
2886
- Y !== void 0 && xe?.at !== Y && (Ce = {
2887
- at: Y,
2888
- length: be
2889
- }, Se(Ce));
2890
- let we = Y !== void 0 && Ce?.at === Y && be <= Ce.length, X = ye ?? (we ? V.thinkingHint : void 0), Z = M.length === 0, Te = t ?? (Z ? i ?? Ln : r);
2889
+ P,
2890
+ re
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`);
2891
2897
  s(() => {
2892
- let e = J.current;
2898
+ let e = G.current;
2893
2899
  if (!e) return;
2894
2900
  let t = () => {
2895
2901
  let t = e.scrollHeight - e.scrollTop - e.clientHeight;
2896
- ge.current = t < 60;
2902
+ K.current = t < 60;
2897
2903
  };
2898
2904
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
2899
2905
  }, []), s(() => {
2900
- ge.current && q.current?.scrollIntoView({
2906
+ K.current && W.current?.scrollIntoView({
2901
2907
  behavior: F === "streaming" ? "auto" : "smooth",
2902
2908
  block: "nearest"
2903
2909
  });
2904
- }, [M, F]);
2905
- let Ee = (e) => {
2906
- ge.current = !0, te(e);
2907
- }, De = d(null), Oe = () => {
2908
- let t = J.current;
2909
- ge.current = !1, De.current = t ? {
2910
+ }, [N, F]);
2911
+ let ke = (e) => {
2912
+ K.current = !0, ie(e);
2913
+ }, Ae = d(null), je = () => {
2914
+ let t = G.current;
2915
+ K.current = !1, Ae.current = t ? {
2910
2916
  height: t.scrollHeight,
2911
2917
  top: t.scrollTop
2912
2918
  } : null, e.loadEarlier?.().catch(() => {
2913
- De.current = null;
2919
+ Ae.current = null;
2914
2920
  });
2915
2921
  };
2916
2922
  s(() => {
2917
- let e = De.current, t = J.current;
2918
- e && t && t.scrollHeight !== e.height && (t.scrollTop = e.top + (t.scrollHeight - e.height), De.current = null);
2919
- }, [M]), s(() => {
2920
- H.current?.toggleAttribute("inert", W);
2921
- }, [W]), s(() => {
2922
- !W && G.current && ((G.current === "input" ? U.current : fe.current)?.focus(), G.current = null);
2923
- }, [W]);
2924
- let ke = a((e) => {
2925
- G.current = e.restoreFocusTo, pe(!1);
2923
+ let e = Ae.current, t = G.current;
2924
+ e && t && t.scrollHeight !== e.height && (t.scrollTop = e.top + (t.scrollHeight - e.height), Ae.current = null);
2925
+ }, [N]), s(() => {
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);
2926
2932
  }, []);
2927
- return /* @__PURE__ */ v(pt.Provider, {
2928
- value: K,
2929
- children: /* @__PURE__ */ v(Dt.Provider, {
2930
- value: ce,
2933
+ return /* @__PURE__ */ v(gt.Provider, {
2934
+ value: U,
2935
+ children: /* @__PURE__ */ v(jt.Provider, {
2936
+ value: fe,
2931
2937
  children: /* @__PURE__ */ y("div", {
2932
- ref: de,
2933
- className: `bailey-chat-panel${x ? ` ${x}` : ""}`,
2934
- style: S !== void 0 || C !== void 0 ? {
2935
- height: S,
2936
- width: C
2938
+ ref: he,
2939
+ className: `bailey-chat-panel${w ? ` ${w}` : ""}`,
2940
+ style: T !== void 0 || E !== void 0 ? {
2941
+ height: T,
2942
+ width: E
2937
2943
  } : void 0,
2938
2944
  children: [/* @__PURE__ */ y("div", {
2939
2945
  className: "bailey-chat-panel-inner",
2940
- ref: H,
2946
+ ref: ge,
2941
2947
  children: [
2942
2948
  /* @__PURE__ */ y("div", {
2943
2949
  className: "bailey-chat-transcript",
2944
- ref: J,
2950
+ ref: G,
2951
+ "data-suggestions-align": Oe && c && c.length > 0 ? l : void 0,
2945
2952
  children: [
2946
2953
  e.hasEarlier && e.loadEarlier && /* @__PURE__ */ y("div", {
2947
2954
  className: "bailey-load-earlier",
@@ -2949,31 +2956,32 @@ function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholde
2949
2956
  type: "button",
2950
2957
  className: "bailey-load-earlier-button",
2951
2958
  disabled: e.historyStatus === "loading",
2952
- onClick: Oe,
2953
- children: V.loadEarlierButtonText
2959
+ onClick: je,
2960
+ children: B.loadEarlierButtonText
2954
2961
  }), e.historyStatus === "error" && /* @__PURE__ */ v("div", {
2955
2962
  role: "alert",
2956
2963
  className: "bailey-load-earlier-error",
2957
- children: V.loadEarlierErrorText
2964
+ children: B.loadEarlierErrorText
2958
2965
  })]
2959
2966
  }),
2960
- Z && (o && o.length > 0 ? /* @__PURE__ */ y("div", {
2967
+ Oe && (c && c.length > 0 ? /* @__PURE__ */ y("div", {
2961
2968
  className: "bailey-suggestions",
2962
- children: [/* @__PURE__ */ v("div", {
2969
+ "data-align": l,
2970
+ children: [B.suggestionsTitle && /* @__PURE__ */ v("div", {
2963
2971
  className: "bailey-suggestions-title",
2964
- children: V.suggestionsTitle
2965
- }), o.map((e, t) => /* @__PURE__ */ y("button", {
2972
+ children: B.suggestionsTitle
2973
+ }), c.map((e, t) => /* @__PURE__ */ y("button", {
2966
2974
  type: "button",
2967
- onClick: () => Ee(e.value ?? e.label),
2975
+ onClick: () => ke(e.value ?? e.label),
2968
2976
  className: "bailey-suggestion-card",
2969
- children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(jt, { className: "bailey-suggestion-icon" })]
2977
+ children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(Ft, { className: "bailey-suggestion-icon" })]
2970
2978
  }, `${e.label}-${t}`))]
2971
2979
  }) : /* @__PURE__ */ v("div", {
2972
2980
  className: "bailey-empty-state",
2973
- children: V.emptyStateMessage
2981
+ children: B.emptyStateMessage
2974
2982
  })),
2975
- M.map((t, r) => {
2976
- let i = t.role === "assistant" && r === M.length - 1, a = F === "streaming" && i && t.content === "", o = t.role === "assistant" ? dt(N, t.createdAt) : [], s = o.some((e) => e.status === "running");
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" ? mt(P, t.createdAt) : [], c = s.some((e) => e.status === "running");
2977
2985
  return /* @__PURE__ */ v("div", {
2978
2986
  className: t.role === "user" ? "bailey-message-row bailey-message-row-user" : "bailey-message-row",
2979
2987
  children: t.role === "user" ? /* @__PURE__ */ y("div", {
@@ -2982,45 +2990,45 @@ function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholde
2982
2990
  className: "bailey-message-meta",
2983
2991
  children: [/* @__PURE__ */ v("span", {
2984
2992
  className: "bailey-message-meta-name",
2985
- children: V.youLabel
2986
- }), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: ue(t.createdAt) })]
2993
+ children: B.youLabel
2994
+ }), t.createdAt !== void 0 && /* @__PURE__ */ v("span", { children: me(t.createdAt) })]
2987
2995
  }), /* @__PURE__ */ v("div", {
2988
2996
  className: "bailey-user-bubble",
2989
2997
  children: t.content
2990
2998
  })]
2991
- }) : a ? s ? /* @__PURE__ */ v(pn, {
2992
- steps: o,
2993
- resolveActivityIcon: b
2999
+ }) : a ? c ? /* @__PURE__ */ v(_n, {
3000
+ steps: s,
3001
+ resolveActivityIcon: C
2994
3002
  }) : /* @__PURE__ */ y("div", {
2995
3003
  className: "bailey-thinking-hint",
2996
- children: [/* @__PURE__ */ v("span", { children: ye ?? V.thinkingHint }), /* @__PURE__ */ v("span", {
3004
+ children: [/* @__PURE__ */ v("span", { children: we ?? B.thinkingHint }), /* @__PURE__ */ v("span", {
2997
3005
  className: "bailey-step-spinner",
2998
3006
  "aria-hidden": "true"
2999
3007
  })]
3000
3008
  }) : /* @__PURE__ */ y("div", {
3001
3009
  className: "bailey-assistant-message",
3002
3010
  children: [
3003
- !t.streaming && /* @__PURE__ */ v(mn, {
3004
- steps: o,
3005
- labels: V,
3006
- resolveActivityIcon: b
3011
+ !t.streaming && /* @__PURE__ */ v(vn, {
3012
+ steps: s,
3013
+ labels: B,
3014
+ resolveActivityIcon: C
3007
3015
  }),
3008
- /* @__PURE__ */ v(Hn, {
3016
+ /* @__PURE__ */ v(Gn, {
3009
3017
  content: t.content,
3010
- components: _e
3018
+ components: Se
3011
3019
  }),
3012
- t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(nn, {
3020
+ t.parts?.map((e, t) => e.type === "image" ? /* @__PURE__ */ v(sn, {
3013
3021
  src: e.src,
3014
3022
  alt: e.alt
3015
- }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: k ? k(e) : /* @__PURE__ */ v(un, {
3023
+ }, t) : e.type === "mcp_app" ? /* @__PURE__ */ v(n, { children: te ? te(e) : /* @__PURE__ */ v(mn, {
3016
3024
  ...e,
3017
- title: e.title ?? V.mcpAppDefaultTitle
3025
+ title: e.title ?? B.mcpAppDefaultTitle
3018
3026
  }) }, t) : null),
3019
- t.streaming && /* @__PURE__ */ v(pn, {
3020
- steps: o,
3021
- resolveActivityIcon: b
3027
+ t.streaming && /* @__PURE__ */ v(_n, {
3028
+ steps: s,
3029
+ resolveActivityIcon: C
3022
3030
  }),
3023
- t.streaming && X && !s && /* @__PURE__ */ y("div", {
3031
+ t.streaming && X && !c && /* @__PURE__ */ y("div", {
3024
3032
  className: "bailey-streaming-hint",
3025
3033
  children: [/* @__PURE__ */ v("span", { children: X }), /* @__PURE__ */ v("span", {
3026
3034
  className: "bailey-step-spinner",
@@ -3030,30 +3038,31 @@ function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholde
3030
3038
  !t.streaming && /* @__PURE__ */ y("div", {
3031
3039
  className: "bailey-message-actions",
3032
3040
  children: [
3033
- /* @__PURE__ */ v(Kt, {
3041
+ /* @__PURE__ */ v(Xt, {
3034
3042
  markdown: t.content,
3035
- ariaLabel: V.copyButtonAriaLabel,
3036
- tooltipDefaultText: V.copyButtonTooltipDefault,
3037
- tooltipCopiedText: V.copyButtonTooltipCopied
3043
+ ariaLabel: B.copyButtonAriaLabel,
3044
+ tooltipDefaultText: B.copyButtonTooltipDefault,
3045
+ tooltipCopiedText: B.copyButtonTooltipCopied
3038
3046
  }),
3039
- E !== !1 && e.feedback && e.conversationId && t.serverMessageId && !B.has(t.serverMessageId) && /* @__PURE__ */ v(Dt.Provider, {
3040
- value: le,
3041
- children: /* @__PURE__ */ v(Fn, {
3042
- ...E,
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
+ ...k,
3051
+ assistantName: o,
3043
3052
  messageId: t.serverMessageId,
3044
3053
  initialRating: t.feedback?.rating,
3045
3054
  onSubmit: e.feedback.onSubmit,
3046
3055
  onClear: e.feedback.onClear
3047
3056
  })
3048
3057
  }),
3049
- T?.(t)
3058
+ O?.(t)
3050
3059
  ]
3051
3060
  })
3052
3061
  ]
3053
3062
  })
3054
3063
  }, t.id);
3055
3064
  }),
3056
- /* @__PURE__ */ v("div", { ref: q })
3065
+ /* @__PURE__ */ v("div", { ref: W })
3057
3066
  ]
3058
3067
  }),
3059
3068
  I && /* @__PURE__ */ y("div", {
@@ -3063,37 +3072,37 @@ function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholde
3063
3072
  className: "bailey-error-actions",
3064
3073
  children: [/* @__PURE__ */ v("button", {
3065
3074
  type: "button",
3066
- onClick: re,
3075
+ onClick: ae,
3067
3076
  className: "bailey-retry-button",
3068
- children: V.retryButtonText
3077
+ children: B.retryButtonText
3069
3078
  }), /* @__PURE__ */ v("button", {
3070
3079
  type: "button",
3071
- onClick: ie,
3072
- "aria-label": V.dismissErrorAriaLabel,
3080
+ onClick: se,
3081
+ "aria-label": B.dismissErrorAriaLabel,
3073
3082
  className: "bailey-dismiss-button",
3074
3083
  children: "✕"
3075
3084
  })]
3076
3085
  })]
3077
3086
  }),
3078
- !w && /* @__PURE__ */ v(tn, {
3079
- events: N,
3080
- lastRequest: P,
3081
- onClear: L
3087
+ !D && /* @__PURE__ */ v(on, {
3088
+ events: P,
3089
+ lastRequest: re,
3090
+ onClear: oe
3082
3091
  }),
3083
3092
  /* @__PURE__ */ y("div", {
3084
3093
  className: "bailey-input-area",
3085
3094
  children: [/* @__PURE__ */ y("form", {
3086
3095
  onSubmit: (e) => {
3087
- e.preventDefault(), R.trim() && F !== "streaming" && (Ee(R), z(""));
3096
+ e.preventDefault(), R.trim() && F !== "streaming" && (ke(R), le(""));
3088
3097
  },
3089
3098
  className: "bailey-input-row",
3090
3099
  children: [/* @__PURE__ */ v("input", {
3091
- ref: U,
3100
+ ref: _e,
3092
3101
  type: "text",
3093
- placeholder: Te,
3094
- "aria-label": Te,
3102
+ placeholder: Z,
3103
+ "aria-label": Z,
3095
3104
  value: R,
3096
- onChange: (e) => z(e.target.value),
3105
+ onChange: (e) => le(e.target.value),
3097
3106
  disabled: F === "streaming",
3098
3107
  className: "bailey-input"
3099
3108
  }), F === "streaming" ? /* @__PURE__ */ v(g.Provider, {
@@ -3102,81 +3111,81 @@ function Kn({ chat: e, placeholder: t, replyPlaceholder: r = Rn, emptyPlaceholde
3102
3111
  asChild: !0,
3103
3112
  children: /* @__PURE__ */ v("button", {
3104
3113
  type: "button",
3105
- onClick: ne,
3106
- "aria-label": V.stopAriaLabel,
3114
+ onClick: L,
3115
+ "aria-label": B.stopAriaLabel,
3107
3116
  className: "bailey-stop-button",
3108
- children: /* @__PURE__ */ v(At, { className: "bailey-stop-icon" })
3117
+ children: /* @__PURE__ */ v(Pt, { className: "bailey-stop-icon" })
3109
3118
  })
3110
3119
  }), /* @__PURE__ */ v(g.Portal, {
3111
- container: K instanceof ShadowRoot ? K : void 0,
3120
+ container: U instanceof ShadowRoot ? U : void 0,
3112
3121
  children: /* @__PURE__ */ y(g.Content, {
3113
3122
  side: "top",
3114
3123
  className: "bailey-tooltip-content",
3115
- children: [V.stopButtonText, /* @__PURE__ */ v(g.Arrow, { className: "bailey-tooltip-arrow" })]
3124
+ children: [B.stopButtonText, /* @__PURE__ */ v(g.Arrow, { className: "bailey-tooltip-arrow" })]
3116
3125
  })
3117
3126
  })] })
3118
3127
  }) : /* @__PURE__ */ v("button", {
3119
3128
  type: "submit",
3120
- "aria-label": V.sendAriaLabel,
3129
+ "aria-label": B.sendAriaLabel,
3121
3130
  disabled: !R.trim(),
3122
3131
  className: "bailey-send-button",
3123
- children: ee ?? /* @__PURE__ */ v(kt, { className: "bailey-send-icon" })
3132
+ children: ee ?? /* @__PURE__ */ v(Nt, { className: "bailey-send-icon" })
3124
3133
  })]
3125
- }), (!Z || he) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
3134
+ }), !m && (!Oe || xe) && /* @__PURE__ */ y(h.Root, { children: [/* @__PURE__ */ v(h.Trigger, {
3126
3135
  asChild: !0,
3127
3136
  children: /* @__PURE__ */ v("button", {
3128
3137
  type: "button",
3129
- ref: fe,
3130
- "aria-label": V.menuAriaLabel,
3138
+ ref: ve,
3139
+ "aria-label": B.menuAriaLabel,
3131
3140
  className: "bailey-menu-button",
3132
- children: /* @__PURE__ */ v(It, { className: "bailey-menu-icon" })
3141
+ children: /* @__PURE__ */ v(Bt, { className: "bailey-menu-icon" })
3133
3142
  })
3134
3143
  }), /* @__PURE__ */ v(h.Portal, {
3135
- container: K instanceof ShadowRoot ? K : void 0,
3144
+ container: U instanceof ShadowRoot ? U : void 0,
3136
3145
  children: /* @__PURE__ */ y(h.Content, {
3137
3146
  side: "top",
3138
3147
  align: "end",
3139
3148
  sideOffset: 8,
3140
3149
  className: "bailey-menu-content",
3141
3150
  onCloseAutoFocus: (e) => {
3142
- me.current &&= (e.preventDefault(), !1);
3151
+ H.current &&= (e.preventDefault(), !1);
3143
3152
  },
3144
- children: [!Z && /* @__PURE__ */ y(h.Item, {
3145
- onSelect: () => ae(),
3153
+ children: [!Oe && /* @__PURE__ */ y(h.Item, {
3154
+ onSelect: () => ce(),
3146
3155
  className: "bailey-menu-item",
3147
- children: [/* @__PURE__ */ v(Lt, { className: "bailey-menu-item-icon" }), V.newChatButtonText]
3148
- }), he && /* @__PURE__ */ y(h.Item, {
3156
+ children: [/* @__PURE__ */ v(Vt, { className: "bailey-menu-item-icon" }), B.newChatButtonText]
3157
+ }), xe && /* @__PURE__ */ y(h.Item, {
3149
3158
  onSelect: () => {
3150
- c ? c() : (me.current = !0, pe(!0));
3159
+ _ ? _() : (H.current = !0, be(!0));
3151
3160
  },
3152
3161
  className: "bailey-menu-item",
3153
- children: [/* @__PURE__ */ v(Pt, { className: "bailey-menu-item-icon" }), V.historyMenuItemText]
3162
+ children: [/* @__PURE__ */ v(Rt, { className: "bailey-menu-item-icon" }), B.historyMenuItemText]
3154
3163
  })]
3155
3164
  })
3156
3165
  })] })]
3157
3166
  }),
3158
- (Z || _?.alwaysVisible) && _ && /* @__PURE__ */ v("div", {
3167
+ (Oe || S?.alwaysVisible) && S && /* @__PURE__ */ v("div", {
3159
3168
  className: "bailey-privacy-note",
3160
3169
  children: /* @__PURE__ */ v(p, {
3161
- remarkPlugins: Bn,
3162
- components: Vn,
3170
+ remarkPlugins: Un,
3171
+ components: Wn,
3163
3172
  skipHtml: !0,
3164
- children: _.markdown
3173
+ children: S.markdown
3165
3174
  })
3166
3175
  })
3167
3176
  ]
3168
- }), W && l && !c && /* @__PURE__ */ v(Sn, {
3169
- client: l.client,
3170
- pageSize: l.pageSize,
3177
+ }), ye && b && !_ && /* @__PURE__ */ v(En, {
3178
+ client: b.client,
3179
+ pageSize: b.pageSize,
3171
3180
  chat: e,
3172
- labels: V,
3173
- locale: m,
3174
- onClose: ke
3181
+ labels: B,
3182
+ locale: x,
3183
+ onClose: Q
3175
3184
  })]
3176
3185
  })
3177
3186
  })
3178
3187
  });
3179
3188
  }
3180
3189
  // src/index.ts
3181
- var qn = "0.3.1-pre.2";
3182
- export { Ft as ActivityIcon, jt as ArrowUpRightIcon, qn as BAILEYAI_CHAT_UI_VERSION, Ve as BAILEY_CHART_PROMPT_FRAGMENT, Ne as BAILEY_TABLE_GRID_ROW_THRESHOLD, j as BaileyApiError, Kn as BaileyChatPanel, N as BaileyCleanupError, Fn as BaileyFeedbackButtons, Sn as BaileyHistoryDrawer, tn as BaileyTracePanel, Kt as CopyMarkdownButton, ae as DEFAULT_CONVERSATION_STORAGE_KEY, kt as HeartIcon, Ye as TRACE_KIND_LABEL, Vt as ThumbDownIcon, Bt as ThumbUpIcon, Q as createBaileyClient, ie as createBaileyFeedbackHandlers, Ot as createBaileyMarkdownComponents, z as createMemoryConversationStorage, R as createSessionConversationStorage, O as extractPseudoToolCalls, ze as extractTableData, xn as formatRelativeTime, at as formatTraceGap, it as formatTraceTime, lt as hasTraceFailure, L as isConversationIdForSub, e as isSafeMarkdownUrl, Ae as joinInstructions, te as mapTranscript, re as mergeEarlierPage, Je as parseBaileyChartSpec, A as parseSseFrames, $ as resolveToolCall, Be as shouldUseGrid, ut as toActivityLines, dt as toToolSteps, ot as toTraceRows, ct as toTraceSegments, $e as traceEventArgsDetail, rt as traceEventHint, et as traceEventOutputDetail, nt as traceEventRawDetail, Qe as traceEventSummary, Ze as traceEventToolName, st as traceSummaryLine, W as useBaileyChat, G 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 };