vpschatbotwidget 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +1,53 @@
1
- import { jsx as l, jsxs as C, Fragment as le } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as k, Fragment as oe } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import Xe, { createContext as _t, useContext as Qe, useMemo as we, useState as Y, useRef as X, useCallback as Q, forwardRef as et, createElement as Ce, useEffect as ge } from "react";
4
- const xt = {};
5
- function te(e) {
3
+ import Xe, { createContext as yt, useContext as Qe, useMemo as Ce, useState as j, useRef as K, useCallback as X, forwardRef as et, createElement as ke, useEffect as me } from "react";
4
+ const wt = {};
5
+ function ee(e) {
6
6
  return e != null && e.trim() !== "" ? e.trim().replace(/\/+$/, "") : String("").trim().replace(/\/+$/, "");
7
7
  }
8
8
  function We(e, t) {
9
- const r = te(e);
9
+ const r = ee(e);
10
10
  if (!r)
11
11
  return t;
12
12
  if (r.endsWith("/api") && t.startsWith("/api/"))
13
13
  return `${r}${t.slice(4)}`;
14
14
  if (r.endsWith("/api") && t === "/health") {
15
- const o = r.slice(0, -4);
16
- return o ? `${o}/health` : "/health";
15
+ const s = r.slice(0, -4);
16
+ return s ? `${s}/health` : "/health";
17
17
  }
18
18
  const n = t.startsWith("/") ? t : `/${t}`;
19
19
  return `${r}${n}`;
20
20
  }
21
- function wt(e) {
21
+ function Ct(e) {
22
22
  return e && typeof e == "object" && "data" in e && e.success !== !1 ? e.data : e;
23
23
  }
24
- function Ct(e, t, r) {
25
- var s, a, i;
26
- const n = e, o = (s = n == null ? void 0 : n.error) == null ? void 0 : s.message;
27
- return o && !kt(o) ? {
24
+ function kt(e, t, r) {
25
+ var l, a, i;
26
+ const n = e, s = (l = n == null ? void 0 : n.error) == null ? void 0 : l.message;
27
+ return s && !St(s) ? {
28
28
  code: (a = n == null ? void 0 : n.error) == null ? void 0 : a.code,
29
- message: o,
29
+ message: s,
30
30
  requestId: (i = n == null ? void 0 : n.error) == null ? void 0 : i.request_id
31
31
  } : r >= 500 ? { message: "I couldn't process that request right now." } : r === 0 ? { message: "Something went wrong while connecting. Please try again." } : { message: t };
32
32
  }
33
- function kt(e) {
33
+ function St(e) {
34
34
  return /traceback|sql|exception|stack|api[_ ]?key|password/i.test(e);
35
35
  }
36
- function St(e) {
36
+ function Ft(e) {
37
37
  return {
38
38
  chunkId: e.chunk_id,
39
39
  source: e.source,
40
40
  score: e.score
41
41
  };
42
42
  }
43
- function Ft(e) {
43
+ function Et(e) {
44
44
  return {
45
45
  toolName: e.tool_name,
46
46
  arguments: e.arguments ?? {},
47
47
  result: e.result ?? {}
48
48
  };
49
49
  }
50
- function Et(e) {
50
+ function Tt(e) {
51
51
  return {
52
52
  model: e.model,
53
53
  promptTokens: e.prompt_tokens,
@@ -55,7 +55,7 @@ function Et(e) {
55
55
  totalTokens: e.total_tokens
56
56
  };
57
57
  }
58
- function Tt(e) {
58
+ function Rt(e) {
59
59
  const t = e.role === "user" || e.role === "system" ? e.role : "assistant";
60
60
  return {
61
61
  id: String(e.id),
@@ -71,7 +71,7 @@ function Tt(e) {
71
71
  } : void 0
72
72
  };
73
73
  }
74
- async function Rt(e) {
74
+ async function At(e) {
75
75
  const t = await e.text();
76
76
  if (!t) return {};
77
77
  try {
@@ -81,31 +81,31 @@ async function Rt(e) {
81
81
  }
82
82
  }
83
83
  function tt(e) {
84
- const t = te(e);
85
- async function r(n, o) {
86
- let s;
84
+ const t = ee(e);
85
+ async function r(n, s) {
86
+ let l;
87
87
  const a = We(t, n);
88
88
  try {
89
- s = await fetch(a, {
90
- ...o,
89
+ l = await fetch(a, {
90
+ ...s,
91
91
  headers: {
92
92
  "Content-Type": "application/json",
93
- ...(o == null ? void 0 : o.headers) ?? {}
93
+ ...(s == null ? void 0 : s.headers) ?? {}
94
94
  }
95
95
  });
96
96
  } catch {
97
97
  throw { message: "Something went wrong while connecting. Please try again." };
98
98
  }
99
- if (s.status === 204)
99
+ if (l.status === 204)
100
100
  return;
101
- const i = await Rt(s);
102
- if (!s.ok)
103
- throw Ct(
101
+ const i = await At(l);
102
+ if (!l.ok)
103
+ throw kt(
104
104
  i,
105
105
  "I couldn't process that request right now.",
106
- s.status
106
+ l.status
107
107
  );
108
- return wt(i);
108
+ return Ct(i);
109
109
  }
110
110
  return {
111
111
  apiBaseUrl: t,
@@ -116,28 +116,28 @@ function tt(e) {
116
116
  });
117
117
  return { sessionId: n.session_id, createdAt: n.created_at };
118
118
  },
119
- async sendMessage(n, o) {
120
- const s = await r(
119
+ async sendMessage(n, s) {
120
+ const l = await r(
121
121
  `/api/v1/sessions/${n}/messages`,
122
122
  {
123
123
  method: "POST",
124
- body: JSON.stringify({ message: o })
124
+ body: JSON.stringify({ message: s })
125
125
  }
126
126
  );
127
127
  return {
128
- requestId: s.request_id,
129
- sessionId: s.session_id,
130
- answer: s.answer,
131
- sources: (s.sources || []).map(St),
132
- toolCalls: (s.tool_calls || []).map(Ft),
133
- usage: Et(s.usage)
128
+ requestId: l.request_id,
129
+ sessionId: l.session_id,
130
+ answer: l.answer,
131
+ sources: (l.sources || []).map(Ft),
132
+ toolCalls: (l.tool_calls || []).map(Et),
133
+ usage: Tt(l.usage)
134
134
  };
135
135
  },
136
136
  async getHistory(n) {
137
137
  try {
138
138
  return ((await r(
139
139
  `/api/v1/sessions/${n}/messages`
140
- )).messages || []).map(Tt);
140
+ )).messages || []).map(Rt);
141
141
  } catch {
142
142
  return [];
143
143
  }
@@ -161,7 +161,7 @@ function tt(e) {
161
161
  }
162
162
  };
163
163
  }
164
- const pn = tt(), At = [
164
+ const hn = tt(), Bt = [
165
165
  {
166
166
  label: "How do I access my reports?",
167
167
  query: "How do I access my reports in the VPS Customer Portal?"
@@ -178,20 +178,20 @@ const pn = tt(), At = [
178
178
  label: "How do I contact VPS Support?",
179
179
  query: "How can I contact VPS Customer Support?"
180
180
  }
181
- ], Fe = _t(null);
182
- function Bt() {
183
- const e = Qe(Fe);
181
+ ], Ee = yt(null);
182
+ function Dt() {
183
+ const e = Qe(Ee);
184
184
  if (!e)
185
185
  throw new Error("useChatbot must be used inside ChatProvider.");
186
186
  return e;
187
187
  }
188
188
  function rt() {
189
- return Qe(Fe);
189
+ return Qe(Ee);
190
190
  }
191
- function je(e) {
191
+ function $e(e) {
192
192
  return `${e}-${crypto.randomUUID()}`;
193
193
  }
194
- function Dt(e) {
194
+ function Mt(e) {
195
195
  if (e && typeof e == "object" && "message" in e) {
196
196
  const t = String(e.message);
197
197
  if (t && !/traceback|sql|exception|stack|api[_ ]?key|password/i.test(t))
@@ -202,87 +202,87 @@ function Dt(e) {
202
202
  const nt = ({
203
203
  children: e,
204
204
  userContext: t = {},
205
- suggestions: r = At,
205
+ suggestions: r = Bt,
206
206
  disableSuggestions: n = !1,
207
- initialMessage: o,
208
- apiBaseUrl: s,
207
+ initialMessage: s,
208
+ apiBaseUrl: l,
209
209
  apiUrl: a,
210
210
  proxyUrl: i,
211
211
  api: d
212
212
  }) => {
213
- const p = s ?? a ?? i, m = we(
214
- () => d ?? tt(p),
215
- [d, p]
216
- ), [y, f] = Y(null), [u, g] = Y([]), [E, v] = Y("idle"), [B, W] = Y(null), L = X(null), $ = X(!1), N = Q(async () => {
217
- if (y) return y;
218
- v("connecting");
219
- const _ = await m.createSession();
220
- return f(_.sessionId), _.sessionId;
221
- }, [y, m]), M = Q(
222
- async (_) => {
223
- L.current = _;
224
- const k = {
225
- id: je("user"),
213
+ const h = l ?? a ?? i, g = Ce(
214
+ () => d ?? tt(h),
215
+ [d, h]
216
+ ), [v, f] = j(null), [u, m] = j([]), [T, _] = j("idle"), [D, V] = j(null), L = K(null), $ = K(!1), P = X(async () => {
217
+ if (v) return v;
218
+ _("connecting");
219
+ const y = await g.createSession();
220
+ return f(y.sessionId), y.sessionId;
221
+ }, [v, g]), I = X(
222
+ async (y) => {
223
+ L.current = y;
224
+ const S = {
225
+ id: $e("user"),
226
226
  role: "user",
227
- content: _,
227
+ content: y,
228
228
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
229
229
  status: "complete"
230
- }, S = je("asst"), A = {
231
- id: S,
230
+ }, F = $e("asst"), B = {
231
+ id: F,
232
232
  role: "assistant",
233
233
  content: "",
234
234
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
235
235
  status: "pending"
236
236
  };
237
- g((R) => [...R, k, A]), v("awaiting"), W(null);
237
+ m((A) => [...A, S, B]), _("awaiting"), V(null);
238
238
  try {
239
- const R = await N(), F = await m.sendMessage(R, _);
240
- g(
241
- (j) => j.map(
242
- (H) => H.id === S ? {
243
- ...H,
244
- id: F.requestId || S,
245
- content: F.answer,
239
+ const A = await P(), E = await g.sendMessage(A, y);
240
+ m(
241
+ (W) => W.map(
242
+ (z) => z.id === F ? {
243
+ ...z,
244
+ id: E.requestId || F,
245
+ content: E.answer,
246
246
  status: "complete",
247
- sources: F.sources,
248
- toolCalls: F.toolCalls,
249
- usage: F.usage
250
- } : H
247
+ sources: E.sources,
248
+ toolCalls: E.toolCalls,
249
+ usage: E.usage
250
+ } : z
251
251
  )
252
- ), v("idle");
253
- } catch (R) {
254
- const F = Dt(R);
255
- g(
256
- (j) => j.map(
257
- (H) => H.id === S ? { ...H, content: F, status: "error" } : H
252
+ ), _("idle");
253
+ } catch (A) {
254
+ const E = Mt(A);
255
+ m(
256
+ (W) => W.map(
257
+ (z) => z.id === F ? { ...z, content: E, status: "error" } : z
258
258
  )
259
- ), W(F), v("error");
259
+ ), V(E), _("error");
260
260
  }
261
261
  },
262
- [N, m]
263
- ), T = Q(
264
- async (_) => {
265
- const k = _.trim();
266
- !k || E === "awaiting" || E === "connecting" || await M(k);
262
+ [P, g]
263
+ ), R = X(
264
+ async (y) => {
265
+ const S = y.trim();
266
+ !S || T === "awaiting" || T === "connecting" || await I(S);
267
267
  },
268
- [M, E]
269
- ), z = Q(async () => {
270
- const _ = L.current;
271
- _ && (g((k) => k.filter((S) => S.status !== "error")), await M(_));
272
- }, [M]), I = Q(async () => {
273
- }, []), J = Q(() => {
274
- }, []), U = Q(async () => {
275
- y && await m.closeSession(y), f(null), g([]), v("idle"), W(null), L.current = null;
276
- }, [y, m]);
268
+ [I, T]
269
+ ), O = X(async () => {
270
+ const y = L.current;
271
+ y && (m((S) => S.filter((F) => F.status !== "error")), await I(y));
272
+ }, [I]), N = X(async () => {
273
+ }, []), Z = X(() => {
274
+ }, []), U = X(async () => {
275
+ v && await g.closeSession(v), f(null), m([]), _("idle"), V(null), L.current = null;
276
+ }, [v, g]);
277
277
  Xe.useEffect(() => {
278
- !o || $.current || ($.current = !0, T(o));
279
- }, [o, T]);
280
- const b = we(
278
+ !s || $.current || ($.current = !0, R(s));
279
+ }, [s, R]);
280
+ const b = Ce(
281
281
  () => ({
282
282
  messages: u,
283
- status: E,
284
- error: B,
285
- sessionId: y,
283
+ status: T,
284
+ error: D,
285
+ sessionId: v,
286
286
  pendingTicket: null,
287
287
  ticketBusy: !1,
288
288
  lastTicket: null,
@@ -290,47 +290,47 @@ const nt = ({
290
290
  showSuggestions: !n && u.length === 0,
291
291
  suggestionBadgesEnabled: !n,
292
292
  userContext: t,
293
- apiBaseUrl: m.apiBaseUrl,
294
- sendMessage: T,
295
- retryLast: z,
296
- confirmTicket: I,
297
- cancelTicket: J,
293
+ apiBaseUrl: g.apiBaseUrl,
294
+ sendMessage: R,
295
+ retryLast: O,
296
+ confirmTicket: N,
297
+ cancelTicket: Z,
298
298
  resetConversation: U
299
299
  }),
300
300
  [
301
301
  u,
302
- E,
303
- B,
304
- y,
302
+ T,
303
+ D,
304
+ v,
305
305
  r,
306
306
  n,
307
307
  t,
308
- m.apiBaseUrl,
309
- T,
310
- z,
311
- I,
312
- J,
308
+ g.apiBaseUrl,
309
+ R,
310
+ O,
311
+ N,
312
+ Z,
313
313
  U
314
314
  ]
315
315
  );
316
- return /* @__PURE__ */ l(Fe.Provider, { value: b, children: e });
316
+ return /* @__PURE__ */ o(Ee.Provider, { value: b, children: e });
317
317
  };
318
- function ye() {
319
- return Bt();
318
+ function ve() {
319
+ return Dt();
320
320
  }
321
- const Mt = ({ message: e, onRetry: t }) => /* @__PURE__ */ C(
321
+ const It = ({ message: e, onRetry: t }) => /* @__PURE__ */ k(
322
322
  "div",
323
323
  {
324
- className: "mx-4 mb-2 rounded-lg border border-[var(--error-border)] bg-[var(--error-bg)] px-3 py-2 text-[12.5px] text-[var(--error-text)]",
324
+ className: "chat-error-banner",
325
325
  role: "alert",
326
326
  children: [
327
- /* @__PURE__ */ l("p", { children: e }),
328
- t && /* @__PURE__ */ l(
327
+ /* @__PURE__ */ o("p", { children: e }),
328
+ t && /* @__PURE__ */ o(
329
329
  "button",
330
330
  {
331
331
  type: "button",
332
332
  onClick: t,
333
- className: "mt-1.5 text-[12px] font-semibold underline underline-offset-2",
333
+ className: "chat-error-retry-btn",
334
334
  children: "Try again"
335
335
  }
336
336
  )
@@ -343,14 +343,14 @@ const Mt = ({ message: e, onRetry: t }) => /* @__PURE__ */ C(
343
343
  * This source code is licensed under the ISC license.
344
344
  * See the LICENSE file in the root directory of this source tree.
345
345
  */
346
- const It = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ot = (...e) => e.filter((t, r, n) => !!t && t.trim() !== "" && n.indexOf(t) === r).join(" ").trim();
346
+ const Nt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), st = (...e) => e.filter((t, r, n) => !!t && t.trim() !== "" && n.indexOf(t) === r).join(" ").trim();
347
347
  /**
348
348
  * @license lucide-react v0.468.0 - ISC
349
349
  *
350
350
  * This source code is licensed under the ISC license.
351
351
  * See the LICENSE file in the root directory of this source tree.
352
352
  */
353
- var Nt = {
353
+ var Pt = {
354
354
  xmlns: "http://www.w3.org/2000/svg",
355
355
  width: 24,
356
356
  height: 24,
@@ -367,31 +367,31 @@ var Nt = {
367
367
  * This source code is licensed under the ISC license.
368
368
  * See the LICENSE file in the root directory of this source tree.
369
369
  */
370
- const Pt = et(
370
+ const xt = et(
371
371
  ({
372
372
  color: e = "currentColor",
373
373
  size: t = 24,
374
374
  strokeWidth: r = 2,
375
375
  absoluteStrokeWidth: n,
376
- className: o = "",
377
- children: s,
376
+ className: s = "",
377
+ children: l,
378
378
  iconNode: a,
379
379
  ...i
380
- }, d) => Ce(
380
+ }, d) => ke(
381
381
  "svg",
382
382
  {
383
383
  ref: d,
384
- ...Nt,
384
+ ...Pt,
385
385
  width: t,
386
386
  height: t,
387
387
  stroke: e,
388
388
  strokeWidth: n ? Number(r) * 24 / Number(t) : r,
389
- className: ot("lucide", o),
389
+ className: st("lucide", s),
390
390
  ...i
391
391
  },
392
392
  [
393
- ...a.map(([p, m]) => Ce(p, m)),
394
- ...Array.isArray(s) ? s : [s]
393
+ ...a.map(([h, g]) => ke(h, g)),
394
+ ...Array.isArray(l) ? l : [l]
395
395
  ]
396
396
  )
397
397
  );
@@ -401,13 +401,13 @@ const Pt = et(
401
401
  * This source code is licensed under the ISC license.
402
402
  * See the LICENSE file in the root directory of this source tree.
403
403
  */
404
- const O = (e, t) => {
404
+ const H = (e, t) => {
405
405
  const r = et(
406
- ({ className: n, ...o }, s) => Ce(Pt, {
407
- ref: s,
406
+ ({ className: n, ...s }, l) => ke(xt, {
407
+ ref: l,
408
408
  iconNode: t,
409
- className: ot(`lucide-${It(e)}`, n),
410
- ...o
409
+ className: st(`lucide-${Nt(e)}`, n),
410
+ ...s
411
411
  })
412
412
  );
413
413
  return r.displayName = `${e}`, r;
@@ -418,7 +418,7 @@ const O = (e, t) => {
418
418
  * This source code is licensed under the ISC license.
419
419
  * See the LICENSE file in the root directory of this source tree.
420
420
  */
421
- const Lt = O("ArrowDown", [
421
+ const Lt = H("ArrowDown", [
422
422
  ["path", { d: "M12 5v14", key: "s699le" }],
423
423
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
424
424
  ]);
@@ -428,7 +428,7 @@ const Lt = O("ArrowDown", [
428
428
  * This source code is licensed under the ISC license.
429
429
  * See the LICENSE file in the root directory of this source tree.
430
430
  */
431
- const zt = O("ArrowLeft", [
431
+ const Ot = H("ArrowLeft", [
432
432
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
433
433
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
434
434
  ]);
@@ -438,7 +438,7 @@ const zt = O("ArrowLeft", [
438
438
  * This source code is licensed under the ISC license.
439
439
  * See the LICENSE file in the root directory of this source tree.
440
440
  */
441
- const Ot = O("ArrowUp", [
441
+ const Ht = H("ArrowUp", [
442
442
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
443
443
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
444
444
  ]);
@@ -448,7 +448,7 @@ const Ot = O("ArrowUp", [
448
448
  * This source code is licensed under the ISC license.
449
449
  * See the LICENSE file in the root directory of this source tree.
450
450
  */
451
- const st = O("BotMessageSquare", [
451
+ const lt = H("BotMessageSquare", [
452
452
  ["path", { d: "M12 6V2H8", key: "1155em" }],
453
453
  ["path", { d: "m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z", key: "w2lp3e" }],
454
454
  ["path", { d: "M2 12h2", key: "1t8f8n" }],
@@ -462,14 +462,14 @@ const st = O("BotMessageSquare", [
462
462
  * This source code is licensed under the ISC license.
463
463
  * See the LICENSE file in the root directory of this source tree.
464
464
  */
465
- const Ht = O("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
465
+ const zt = H("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
466
466
  /**
467
467
  * @license lucide-react v0.468.0 - ISC
468
468
  *
469
469
  * This source code is licensed under the ISC license.
470
470
  * See the LICENSE file in the root directory of this source tree.
471
471
  */
472
- const qt = O("ChevronDown", [
472
+ const qt = H("ChevronDown", [
473
473
  ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
474
474
  ]);
475
475
  /**
@@ -478,14 +478,14 @@ const qt = O("ChevronDown", [
478
478
  * This source code is licensed under the ISC license.
479
479
  * See the LICENSE file in the root directory of this source tree.
480
480
  */
481
- const Gt = O("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
481
+ const Gt = H("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
482
482
  /**
483
483
  * @license lucide-react v0.468.0 - ISC
484
484
  *
485
485
  * This source code is licensed under the ISC license.
486
486
  * See the LICENSE file in the root directory of this source tree.
487
487
  */
488
- const Vt = O("ClipboardCheck", [
488
+ const Vt = H("ClipboardCheck", [
489
489
  ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
490
490
  [
491
491
  "path",
@@ -502,7 +502,7 @@ const Vt = O("ClipboardCheck", [
502
502
  * This source code is licensed under the ISC license.
503
503
  * See the LICENSE file in the root directory of this source tree.
504
504
  */
505
- const Wt = O("FileText", [
505
+ const Wt = H("FileText", [
506
506
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
507
507
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
508
508
  ["path", { d: "M10 9H8", key: "b1mrlr" }],
@@ -515,7 +515,7 @@ const Wt = O("FileText", [
515
515
  * This source code is licensed under the ISC license.
516
516
  * See the LICENSE file in the root directory of this source tree.
517
517
  */
518
- const jt = O("FlaskConical", [
518
+ const $t = H("FlaskConical", [
519
519
  [
520
520
  "path",
521
521
  {
@@ -532,7 +532,7 @@ const jt = O("FlaskConical", [
532
532
  * This source code is licensed under the ISC license.
533
533
  * See the LICENSE file in the root directory of this source tree.
534
534
  */
535
- const lt = O("MessageSquare", [
535
+ const ot = H("MessageSquare", [
536
536
  ["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }]
537
537
  ]);
538
538
  /**
@@ -541,7 +541,7 @@ const lt = O("MessageSquare", [
541
541
  * This source code is licensed under the ISC license.
542
542
  * See the LICENSE file in the root directory of this source tree.
543
543
  */
544
- const $t = O("Microscope", [
544
+ const Ut = H("Microscope", [
545
545
  ["path", { d: "M6 18h8", key: "1borvv" }],
546
546
  ["path", { d: "M3 22h18", key: "8prr45" }],
547
547
  ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
@@ -555,14 +555,14 @@ const $t = O("Microscope", [
555
555
  * This source code is licensed under the ISC license.
556
556
  * See the LICENSE file in the root directory of this source tree.
557
557
  */
558
- const Ut = O("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
558
+ const jt = H("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
559
559
  /**
560
560
  * @license lucide-react v0.468.0 - ISC
561
561
  *
562
562
  * This source code is licensed under the ISC license.
563
563
  * See the LICENSE file in the root directory of this source tree.
564
564
  */
565
- const Yt = O("RefreshCw", [
565
+ const Yt = H("RefreshCw", [
566
566
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
567
567
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
568
568
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
@@ -574,7 +574,7 @@ const Yt = O("RefreshCw", [
574
574
  * This source code is licensed under the ISC license.
575
575
  * See the LICENSE file in the root directory of this source tree.
576
576
  */
577
- const Zt = O("TestTubeDiagonal", [
577
+ const Zt = H("TestTubeDiagonal", [
578
578
  [
579
579
  "path",
580
580
  { d: "M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3", key: "1ub6xw" }
@@ -588,13 +588,13 @@ const Zt = O("TestTubeDiagonal", [
588
588
  * This source code is licensed under the ISC license.
589
589
  * See the LICENSE file in the root directory of this source tree.
590
590
  */
591
- const Jt = O("X", [
591
+ const Jt = H("X", [
592
592
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
593
593
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
594
594
  ]), Kt = {
595
595
  alpha: {
596
596
  label: "Alpha",
597
- Icon: jt,
597
+ Icon: $t,
598
598
  variant: "env-badge--alpha",
599
599
  tooltip: "Alpha build — internal testing only"
600
600
  },
@@ -606,7 +606,7 @@ const Jt = O("X", [
606
606
  },
607
607
  gamma: {
608
608
  label: "Gamma",
609
- Icon: $t,
609
+ Icon: Ut,
610
610
  variant: "env-badge--gamma",
611
611
  tooltip: "Gamma / Release Candidate"
612
612
  },
@@ -622,21 +622,21 @@ const Jt = O("X", [
622
622
  className: r = ""
623
623
  }) => {
624
624
  if (!e) return null;
625
- const { label: n, Icon: o, variant: s, tooltip: a } = Kt[e];
626
- return /* @__PURE__ */ C(
625
+ const { label: n, Icon: s, variant: l, tooltip: a } = Kt[e];
626
+ return /* @__PURE__ */ k(
627
627
  "span",
628
628
  {
629
- className: `env-badge ${s} ${r} text-[var(--vps-orange)] font-medium text-[10px] leading-[12px] px-1.5 py-0.5 rounded-full border border-[var(--border)] bg-[var(--orange-50)] hover:bg-[var(--grey-200)] cursor-pointer hover:text-foreground flex items-center gap-1 `,
629
+ className: `env-badge-inline ${l} ${r}`.trim(),
630
630
  title: a,
631
631
  "aria-label": `${n} build`,
632
632
  role: "status",
633
633
  children: [
634
- /* @__PURE__ */ l(o, { size: 10, className: "env-badge-icon", "aria-hidden": "true" }),
635
- /* @__PURE__ */ l("span", { className: "text-[var(--text-primary)] font-medium text-[10px] leading-[12px]", children: n })
634
+ /* @__PURE__ */ o(s, { size: 10, className: "env-badge-icon", "aria-hidden": "true" }),
635
+ /* @__PURE__ */ o("span", { className: "env-badge-inline-label", children: n })
636
636
  ]
637
637
  }
638
638
  );
639
- }, Qt = (e) => /* @__PURE__ */ l(
639
+ }, Qt = (e) => /* @__PURE__ */ o(
640
640
  "svg",
641
641
  {
642
642
  width: e.width || "24px",
@@ -646,170 +646,150 @@ const Jt = O("X", [
646
646
  xmlns: "http://www.w3.org/2000/svg",
647
647
  fill: e.Color || "currentColor",
648
648
  ...e,
649
- children: /* @__PURE__ */ l("path", { d: "M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z" })
649
+ children: /* @__PURE__ */ o("path", { d: "M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z" })
650
650
  }
651
651
  ), er = ({
652
652
  title: e = "VPS AI Assistant",
653
653
  subtitle: t = "Customer portal support",
654
654
  onClose: r,
655
655
  onReset: n,
656
- onBack: o,
657
- showMinimize: s = !1,
656
+ onBack: s,
657
+ showMinimize: l = !1,
658
658
  envStage: a,
659
659
  envPulse: i = !0
660
- }) => /* @__PURE__ */ C("header", { className: "flex items-center justify-between border-b border-border bg-card px-5 py-4", children: [
661
- /* @__PURE__ */ C("div", { className: "flex items-center gap-3", children: [
662
- o && /* @__PURE__ */ l(
660
+ }) => /* @__PURE__ */ k("header", { className: "chat-header", children: [
661
+ /* @__PURE__ */ k("div", { className: "chat-header-left", children: [
662
+ s && /* @__PURE__ */ o(
663
663
  "button",
664
664
  {
665
665
  type: "button",
666
- onClick: o,
667
- className: "flex h-8 w-8 items-center justify-center rounded-full border border-border bg-muted text-muted-foreground hover:bg-[var(--grey-100)]",
666
+ onClick: s,
667
+ className: "icon-btn-back",
668
668
  "aria-label": "Back",
669
- children: /* @__PURE__ */ l(zt, { size: 16 })
669
+ children: /* @__PURE__ */ o(Ot, { size: 16 })
670
670
  }
671
671
  ),
672
- /* @__PURE__ */ l(
672
+ /* @__PURE__ */ o(
673
673
  "div",
674
674
  {
675
- className: "flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",
675
+ className: "avatar-circle",
676
676
  "aria-hidden": "true",
677
- children: /* @__PURE__ */ l(Qt, { width: "16px", height: "16px", Color: "white" })
677
+ children: /* @__PURE__ */ o(Qt, { width: "16px", height: "16px", color: "white" })
678
678
  }
679
679
  ),
680
- /* @__PURE__ */ C("div", { children: [
681
- /* @__PURE__ */ C("div", { className: "flex items-center gap-1.5", children: [
682
- /* @__PURE__ */ l("h2", { className: "text-[16px] font-bold tracking-tight text-foreground", children: e }),
683
- /* @__PURE__ */ l(Xt, { stage: a, pulse: i })
680
+ /* @__PURE__ */ k("div", { children: [
681
+ /* @__PURE__ */ k("div", { className: "chat-header-title-row", children: [
682
+ /* @__PURE__ */ o("h2", { className: "chat-header-title", children: e }),
683
+ /* @__PURE__ */ o(Xt, { stage: a, pulse: i })
684
684
  ] }),
685
- /* @__PURE__ */ l("p", { className: "text-[12px] text-muted-foreground font-medium text-[var(--text-subtle)]", children: t || "Customer portal support" })
685
+ /* @__PURE__ */ o("p", { className: "chat-header-subtitle", children: t || "Customer portal support" })
686
686
  ] })
687
687
  ] }),
688
- /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
689
- n && /* @__PURE__ */ l(
688
+ /* @__PURE__ */ k("div", { className: "chat-header-actions", children: [
689
+ n && /* @__PURE__ */ o(
690
690
  "button",
691
691
  {
692
692
  type: "button",
693
693
  onClick: n,
694
- className: "flex h-7 w-7 items-center justify-center rounded-md text-[var(--text-subtle)] hover:bg-muted hover:text-foreground",
694
+ className: "icon-btn-action",
695
695
  "aria-label": "Start a new conversation",
696
696
  title: "New conversation",
697
- children: /* @__PURE__ */ l(Yt, { size: 15 })
697
+ children: /* @__PURE__ */ o(Yt, { size: 15 })
698
698
  }
699
699
  ),
700
- r && /* @__PURE__ */ l(
700
+ r && /* @__PURE__ */ o(
701
701
  "button",
702
702
  {
703
703
  type: "button",
704
704
  onClick: r,
705
- className: "flex h-7 w-7 items-center justify-center rounded-md text-[var(--text-subtle)] hover:bg-muted hover:text-foreground",
706
- "aria-label": s ? "Minimize chat" : "Close chat",
707
- children: /* @__PURE__ */ l(Ut, { size: 16 })
705
+ className: "icon-btn-action",
706
+ "aria-label": l ? "Minimize chat" : "Close chat",
707
+ children: /* @__PURE__ */ o(jt, { size: 16 })
708
708
  }
709
709
  )
710
710
  ] })
711
711
  ] });
712
712
  function tr(e, t) {
713
- const r = X(e);
714
- ge(() => {
713
+ const r = K(e);
714
+ me(() => {
715
715
  var n;
716
716
  r.current && !e && ((n = t.current) == null || n.focus()), r.current = e;
717
717
  }, [e, t]);
718
718
  }
719
- function at(e) {
720
- var t, r, n = "";
721
- if (typeof e == "string" || typeof e == "number") n += e;
722
- else if (typeof e == "object") if (Array.isArray(e)) {
723
- var o = e.length;
724
- for (t = 0; t < o; t++) e[t] && (r = at(e[t])) && (n && (n += " "), n += r);
725
- } else for (r in e) e[r] && (n && (n += " "), n += r);
726
- return n;
727
- }
728
- function rr() {
729
- for (var e, t, r = 0, n = "", o = arguments.length; r < o; r++) (e = arguments[r]) && (t = at(e)) && (n && (n += " "), n += t);
730
- return n;
731
- }
732
- function V(...e) {
733
- return rr(e);
734
- }
735
- function nr(e, t) {
719
+ function rr(e, t) {
736
720
  const r = t.trim().toLowerCase();
737
721
  return r ? e.filter(
738
722
  (n) => n.label.toLowerCase().includes(r) || n.query.toLowerCase().includes(r)
739
723
  ) : e;
740
724
  }
741
- const or = ({
725
+ const nr = ({
742
726
  suggestions: e,
743
727
  onSelect: t,
744
728
  disabled: r,
745
729
  variant: n = "list"
746
- }) => e.length ? n === "badge" ? /* @__PURE__ */ l(
730
+ }) => e.length ? n === "badge" ? /* @__PURE__ */ o(
747
731
  "ul",
748
732
  {
749
- className: "mb-2 flex flex-wrap gap-1.5",
733
+ className: "suggestions-badge-list",
750
734
  "aria-label": "Suggested questions",
751
- children: e.map((o) => /* @__PURE__ */ l("li", { className: "max-w-full", children: /* @__PURE__ */ l(
735
+ children: e.map((s) => /* @__PURE__ */ o("li", { className: "suggestion-badge-item", children: /* @__PURE__ */ o(
752
736
  "button",
753
737
  {
754
738
  type: "button",
755
739
  disabled: r,
756
- onClick: () => t(o),
757
- title: o.query,
758
- className: V(
759
- "max-w-full truncate rounded-full border border-border bg-card px-2.5 py-1 text-left text-[11.5px] font-semibold text-foreground",
760
- "hover:border-primary hover:bg-[var(--tint-solus-10)] hover:text-primary",
761
- "disabled:cursor-not-allowed disabled:opacity-50"
762
- ),
763
- children: o.label
740
+ onClick: () => t(s),
741
+ title: s.query,
742
+ className: "suggestion-badge-btn",
743
+ children: s.label
764
744
  }
765
- ) }, o.query))
745
+ ) }, s.query))
766
746
  }
767
- ) : /* @__PURE__ */ l("div", { className: "mt-3 flex flex-col gap-2", children: e.map((o) => /* @__PURE__ */ l(
747
+ ) : /* @__PURE__ */ o("div", { className: "suggestions-list", children: e.map((s) => /* @__PURE__ */ o(
768
748
  "button",
769
749
  {
770
750
  type: "button",
771
751
  disabled: r,
772
- onClick: () => t(o),
773
- className: "rounded-lg border border-border bg-card px-3.5 py-2.5 text-left text-[13px] font-semibold text-foreground shadow-[0_1px_3px_rgba(0,0,0,0.02)] transition hover:-translate-y-px hover:border-vps-light-grey hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none motion-reduce:hover:translate-y-0",
774
- children: o.label
752
+ onClick: () => t(s),
753
+ className: "suggestion-list-btn",
754
+ children: s.label
775
755
  },
776
- o.query
756
+ s.query
777
757
  )) }) : null, sr = ({
778
758
  onSend: e,
779
759
  disabled: t = !1,
780
760
  placeholder: r = "Ask something…"
781
761
  }) => {
782
- const { suggestions: n, showSuggestions: o, suggestionBadgesEnabled: s } = ye(), [a, i] = Y(""), d = X(null), p = (u) => {
762
+ const { suggestions: n, showSuggestions: s, suggestionBadgesEnabled: l } = ve(), [a, i] = j(""), d = K(null), h = (u) => {
783
763
  u && (u.style.height = "auto", u.style.height = `${Math.min(u.scrollHeight, 96)}px`);
784
764
  };
785
- tr(t, d), ge(() => {
786
- p(d.current);
765
+ tr(t, d), me(() => {
766
+ h(d.current);
787
767
  }, [a]);
788
- const m = we(() => {
789
- if (!s || t) return [];
768
+ const g = Ce(() => {
769
+ if (!l || t) return [];
790
770
  const u = a.trim();
791
- return u ? nr(n, u) : o ? n : [];
792
- }, [t, o, s, n, a]), y = (u) => {
771
+ return u ? rr(n, u) : s ? n : [];
772
+ }, [t, s, l, n, a]), v = (u) => {
793
773
  i(u.query);
794
- const g = d.current;
795
- g == null || g.focus();
774
+ const m = d.current;
775
+ m == null || m.focus();
796
776
  }, f = () => {
797
777
  const u = a.trim();
798
778
  !u || t || (e(u), i(""), d.current && (d.current.style.height = "auto"));
799
779
  };
800
- return /* @__PURE__ */ C("div", { className: "bg-card px-4 pb-3 pt-2", children: [
801
- /* @__PURE__ */ l(
802
- or,
780
+ return /* @__PURE__ */ k("div", { className: "chat-input-wrapper", children: [
781
+ /* @__PURE__ */ o(
782
+ nr,
803
783
  {
804
784
  variant: "badge",
805
- suggestions: m,
806
- onSelect: y,
785
+ suggestions: g,
786
+ onSelect: v,
807
787
  disabled: t
808
788
  }
809
789
  ),
810
- /* @__PURE__ */ l("label", { htmlFor: "vps-chat-input", className: "sr-only", children: "Chat message" }),
811
- /* @__PURE__ */ C("div", { className: "flex items-end gap-2 rounded-xl bg-[var(--input-bg)] px-2.5 py-1.5", children: [
812
- /* @__PURE__ */ l(
790
+ /* @__PURE__ */ o("label", { htmlFor: "vps-chat-input", className: "sr-only", children: "Chat message" }),
791
+ /* @__PURE__ */ k("div", { className: "chat-input-row", children: [
792
+ /* @__PURE__ */ o(
813
793
  "textarea",
814
794
  {
815
795
  id: "vps-chat-input",
@@ -819,78 +799,78 @@ const or = ({
819
799
  disabled: t,
820
800
  placeholder: r,
821
801
  onChange: (u) => {
822
- i(u.target.value), p(u.target);
802
+ i(u.target.value), h(u.target);
823
803
  },
824
804
  onKeyDown: (u) => {
825
805
  u.key === "Enter" && !u.shiftKey && (u.preventDefault(), f());
826
806
  },
827
- className: "max-h-24 flex-1 resize-none bg-transparent py-1.5 text-[13.5px] text-foreground outline-none placeholder:text-[var(--text-subtle)] disabled:opacity-60"
807
+ className: "chat-textarea"
828
808
  }
829
809
  ),
830
- /* @__PURE__ */ l(
810
+ /* @__PURE__ */ o(
831
811
  "button",
832
812
  {
833
813
  type: "button",
834
814
  onClick: f,
835
815
  disabled: t || !a.trim(),
836
816
  "aria-label": "Send message",
837
- className: "mb-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-action text-action-foreground hover:bg-[var(--action-hover)] disabled:cursor-not-allowed disabled:opacity-40",
838
- children: /* @__PURE__ */ l(Ot, { size: 16 })
817
+ className: "chat-send-btn",
818
+ children: /* @__PURE__ */ o(Ht, { size: 16 })
839
819
  }
840
820
  )
841
821
  ] }),
842
- /* @__PURE__ */ C("p", { className: "mt-2 text-center text-[11px] font-medium text-[var(--text-subtle)]", children: [
822
+ /* @__PURE__ */ k("p", { className: "chat-input-footer", children: [
843
823
  "Powered by ",
844
- /* @__PURE__ */ l("span", { className: "text-primary font-bold hover:underline cursor-pointer", children: "VPS Veritas AI" })
824
+ /* @__PURE__ */ o("span", { className: "chat-input-footer-brand", children: "VPS Veritas AI" })
845
825
  ] })
846
826
  ] });
847
827
  };
848
- function lr({ defaultTagName: e, props: t, render: r, state: n = {}, stateAttributesMapping: o }) {
849
- let s = ke(ar(n, o), t);
850
- if (!r) return c.createElement(e, s);
851
- if (typeof r == "function") return r(s, n);
828
+ function lr({ defaultTagName: e, props: t, render: r, state: n = {}, stateAttributesMapping: s }) {
829
+ let l = Se(or(n, s), t);
830
+ if (!r) return c.createElement(e, l);
831
+ if (typeof r == "function") return r(l, n);
852
832
  if (!c.isValidElement(r)) return null;
853
- let a = r.props, i = { ...ke(s, a), ref: ae(s.ref, a.ref) };
833
+ let a = r.props, i = { ...Se(l, a), ref: ae(l.ref, a.ref) };
854
834
  return c.cloneElement(r, i);
855
835
  }
856
- function ke(...e) {
836
+ function Se(...e) {
857
837
  let t = {};
858
838
  for (let r of e) {
859
839
  if (!r) continue;
860
840
  let n = r;
861
- for (let o of Object.keys(n)) {
862
- let s = n[o];
863
- if (s === void 0) continue;
864
- let a = t[o];
865
- o === "className" ? t[o] = [a, s].filter(Boolean).join(" ") : o === "style" ? t[o] = { ...a, ...s } : o === "ref" ? t[o] = ae(a, s) : cr(o) && typeof a == "function" && typeof s == "function" ? t[o] = ir(s, a) : t[o] = s;
841
+ for (let s of Object.keys(n)) {
842
+ let l = n[s];
843
+ if (l === void 0) continue;
844
+ let a = t[s];
845
+ s === "className" ? t[s] = [a, l].filter(Boolean).join(" ") : s === "style" ? t[s] = { ...a, ...l } : s === "ref" ? t[s] = ae(a, l) : ir(s) && typeof a == "function" && typeof l == "function" ? t[s] = ar(l, a) : t[s] = l;
866
846
  }
867
847
  }
868
848
  return t;
869
849
  }
870
- function ar(e, t) {
850
+ function or(e, t) {
871
851
  var n;
872
852
  let r = {};
873
- for (let o of Object.keys(e)) {
874
- let s = e[o], a = (n = t == null ? void 0 : t[o]) == null ? void 0 : n.call(t, s);
853
+ for (let s of Object.keys(e)) {
854
+ let l = e[s], a = (n = t == null ? void 0 : t[s]) == null ? void 0 : n.call(t, l);
875
855
  if (a) {
876
856
  Object.assign(r, a);
877
857
  continue;
878
858
  }
879
- if (o === "slot") {
880
- r["data-slot"] = s;
859
+ if (s === "slot") {
860
+ r["data-slot"] = l;
881
861
  continue;
882
862
  }
883
- let i = `data-${String(o).replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`)}`;
884
- typeof s == "boolean" ? r[i] = s ? "" : void 0 : s != null && (r[i] = String(s));
863
+ let i = `data-${String(s).replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`)}`;
864
+ typeof l == "boolean" ? r[i] = l ? "" : void 0 : l != null && (r[i] = String(l));
885
865
  }
886
866
  return r;
887
867
  }
888
- function ir(e, t) {
868
+ function ar(e, t) {
889
869
  return function(r) {
890
870
  e(r), r.defaultPrevented || t(r);
891
871
  };
892
872
  }
893
- function cr(e) {
873
+ function ir(e) {
894
874
  return /^on[A-Z]/.test(e);
895
875
  }
896
876
  function ae(...e) {
@@ -899,44 +879,44 @@ function ae(...e) {
899
879
  for (let n of t) typeof n == "function" ? n(r) : n && (n.current = r);
900
880
  };
901
881
  }
902
- var ur = 8, dr = 64, fr = 0, be = 0.5, pr = 180, hr = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", " "]), it = { start: !1, end: !1 }, mr = [], ve = { currentAnchorId: null, visibleMessageIds: mr };
882
+ var cr = 8, ur = 64, dr = 0, be = 0.5, fr = 180, hr = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", " "]), at = { start: !1, end: !1 }, pr = [], _e = { currentAnchorId: null, visibleMessageIds: pr };
903
883
  function gr({ content: e, scrollEdgeThreshold: t, spacer: r, viewport: n }) {
904
- if (!n || !e) return it;
905
- let o = Ee({ content: e, spacer: r, viewport: n });
906
- return { start: n.scrollTop > t, end: o - n.scrollTop - n.clientHeight > t };
907
- }
908
- function br({ content: e, scrollMargin: t, scrollPreviousItemPeek: r, spacer: n, viewport: o, visibleMessageIds: s }) {
909
- if (!e || !o) return ve;
910
- let a = o.getBoundingClientRect(), i = a.top + t + r, d = typeof IntersectionObserver > "u", p = [], m = null;
911
- for (let y of se(e, n)) {
912
- let f = y.dataset.messageId;
884
+ if (!n || !e) return at;
885
+ let s = Te({ content: e, spacer: r, viewport: n });
886
+ return { start: n.scrollTop > t, end: s - n.scrollTop - n.clientHeight > t };
887
+ }
888
+ function mr({ content: e, scrollMargin: t, scrollPreviousItemPeek: r, spacer: n, viewport: s, visibleMessageIds: l }) {
889
+ if (!e || !s) return _e;
890
+ let a = s.getBoundingClientRect(), i = a.top + t + r, d = typeof IntersectionObserver > "u", h = [], g = null;
891
+ for (let v of le(e, n)) {
892
+ let f = v.dataset.messageId;
913
893
  if (!f) continue;
914
- let u = y.dataset.scrollAnchor === "true", g = u || d ? y.getBoundingClientRect() : null;
915
- (d && g ? g.bottom > i && g.top < a.bottom : s.has(f)) && p.push(f), u && g && g.top <= i + be && (m = f);
894
+ let u = v.dataset.scrollAnchor === "true", m = u || d ? v.getBoundingClientRect() : null;
895
+ (d && m ? m.bottom > i && m.top < a.bottom : l.has(f)) && h.push(f), u && m && m.top <= i + be && (g = f);
916
896
  }
917
- return p.length === 0 && m === null ? ve : { currentAnchorId: m, visibleMessageIds: p };
897
+ return h.length === 0 && g === null ? _e : { currentAnchorId: g, visibleMessageIds: h };
918
898
  }
919
- function se(e, t) {
899
+ function le(e, t) {
920
900
  return Array.from(e.children).filter((r) => r instanceof HTMLElement && r !== t);
921
901
  }
922
- function vr(e, t) {
902
+ function br(e, t) {
923
903
  for (let r = t; r < e.length; r++) {
924
904
  let n = e[r];
925
905
  if ((n == null ? void 0 : n.dataset.scrollAnchor) === "true") return n;
926
906
  }
927
907
  return null;
928
908
  }
929
- function yr(e, t) {
909
+ function _r(e, t) {
930
910
  for (let r of e) if (r.dataset.scrollAnchor === "true" && !t.has(r)) return r;
931
911
  return null;
932
912
  }
933
- function _r(e, t) {
913
+ function vr(e, t) {
934
914
  var n;
935
915
  let r = 0;
936
- for (let o = t; o < e.length; o++) if (((n = e[o]) == null ? void 0 : n.dataset.scrollAnchor) === "true" && (r += 1, r > 1)) return !0;
916
+ for (let s = t; s < e.length; s++) if (((n = e[s]) == null ? void 0 : n.dataset.scrollAnchor) === "true" && (r += 1, r > 1)) return !0;
937
917
  return !1;
938
918
  }
939
- function xr(e) {
919
+ function yr(e) {
940
920
  for (let t = e.length - 1; t >= 0; t--) {
941
921
  let r = e[t];
942
922
  if ((r == null ? void 0 : r.dataset.scrollAnchor) === "true") return r;
@@ -945,82 +925,82 @@ function xr(e) {
945
925
  }
946
926
  function wr({ content: e, spacer: t, viewport: r }) {
947
927
  let n = r.getBoundingClientRect();
948
- for (let o of se(e, t)) {
949
- if (!o.dataset.messageId) continue;
950
- let s = o.getBoundingClientRect();
951
- if (s.bottom > n.top && s.top < n.bottom) return o;
928
+ for (let s of le(e, t)) {
929
+ if (!s.dataset.messageId) continue;
930
+ let l = s.getBoundingClientRect();
931
+ if (l.bottom > n.top && l.top < n.bottom) return s;
952
932
  }
953
933
  return null;
954
934
  }
955
- function Cr({ align: e, element: t, scrollMargin: r, spacer: n, viewport: o }) {
956
- let s = ct(t, o), a = t.getBoundingClientRect().height, i = Fr(n);
935
+ function Cr({ align: e, element: t, scrollMargin: r, spacer: n, viewport: s }) {
936
+ let l = it(t, s), a = t.getBoundingClientRect().height, i = Fr(n);
957
937
  if (e === "center") {
958
- let d = Math.max(0, o.clientHeight - i.start - i.end);
959
- return s - i.start - (d - a) / 2 - r;
938
+ let d = Math.max(0, s.clientHeight - i.start - i.end);
939
+ return l - i.start - (d - a) / 2 - r;
960
940
  }
961
- if (e === "end") return s - o.clientHeight + a + i.end + r;
941
+ if (e === "end") return l - s.clientHeight + a + i.end + r;
962
942
  if (e === "nearest") {
963
- let d = s + a, p = o.scrollTop + i.start, m = o.scrollTop + o.clientHeight - i.end;
964
- return s >= p && d <= m ? o.scrollTop : s < p ? s - i.start - r : d - o.clientHeight + i.end + r;
943
+ let d = l + a, h = s.scrollTop + i.start, g = s.scrollTop + s.clientHeight - i.end;
944
+ return l >= h && d <= g ? s.scrollTop : l < h ? l - i.start - r : d - s.clientHeight + i.end + r;
965
945
  }
966
- return s - i.start - r;
946
+ return l - i.start - r;
967
947
  }
968
- function ct(e, t) {
948
+ function it(e, t) {
969
949
  let r = e.getBoundingClientRect(), n = t.getBoundingClientRect();
970
950
  return r.top - n.top + t.scrollTop;
971
951
  }
972
- function he(e, t) {
952
+ function pe(e, t) {
973
953
  return e.getBoundingClientRect().top - t.getBoundingClientRect().top;
974
954
  }
975
955
  function kr({ content: e, scrollTop: t, spacer: r, viewport: n }) {
976
- let o = Ee({ content: e, spacer: r, viewport: n });
977
- return t + n.clientHeight - o;
956
+ let s = Te({ content: e, spacer: r, viewport: n });
957
+ return t + n.clientHeight - s;
978
958
  }
979
- function Ee({ content: e, spacer: t, viewport: r }) {
980
- let n = se(e, t), o = ut(e), s = r.getBoundingClientRect(), a = r.scrollTop, i = o.start + o.end;
959
+ function Te({ content: e, spacer: t, viewport: r }) {
960
+ let n = le(e, t), s = ct(e), l = r.getBoundingClientRect(), a = r.scrollTop, i = s.start + s.end;
981
961
  for (let d of n) {
982
- let p = d.getBoundingClientRect();
983
- i = Math.max(i, p.bottom - s.top + a + o.end);
962
+ let h = d.getBoundingClientRect();
963
+ i = Math.max(i, h.bottom - l.top + a + s.end);
984
964
  }
985
965
  return i;
986
966
  }
987
967
  function Sr(e) {
988
968
  return Math.max(0, e.scrollHeight - e.clientHeight);
989
969
  }
990
- function ut(e) {
970
+ function ct(e) {
991
971
  let t = window.getComputedStyle(e);
992
- return { end: Se(t.paddingBlockEnd || t.paddingBottom), start: Se(t.paddingBlockStart || t.paddingTop) };
972
+ return { end: Fe(t.paddingBlockEnd || t.paddingBottom), start: Fe(t.paddingBlockStart || t.paddingTop) };
993
973
  }
994
974
  function Fr(e) {
995
975
  let t = e == null ? void 0 : e.parentElement;
996
- return t ? ut(t) : { end: 0, start: 0 };
976
+ return t ? ct(t) : { end: 0, start: 0 };
997
977
  }
998
978
  function Er(e) {
999
979
  if (!e) return 0;
1000
980
  let t = window.getComputedStyle(e), r = t.rowGap === "normal" ? t.gap : t.rowGap;
1001
- return Se(r);
981
+ return Fe(r);
1002
982
  }
1003
- function Se(e) {
983
+ function Fe(e) {
1004
984
  if (!e) return 0;
1005
985
  let t = Number.parseFloat(e);
1006
986
  return Number.isFinite(t) ? t : 0;
1007
987
  }
1008
- function dt(e, t) {
988
+ function ut(e, t) {
1009
989
  let r = e, n = /* @__PURE__ */ new Set();
1010
- return { getSnapshot: () => r, hasListeners: () => n.size > 0, setSnapshot: (o) => {
1011
- t(r, o) || (r = o, n.forEach((s) => s()));
1012
- }, subscribe: (o, s, a) => {
990
+ return { getSnapshot: () => r, hasListeners: () => n.size > 0, setSnapshot: (s) => {
991
+ t(r, s) || (r = s, n.forEach((l) => l()));
992
+ }, subscribe: (s, l, a) => {
1013
993
  let i = n.size === 0;
1014
- return n.add(o), i && (s == null || s()), () => {
1015
- n.delete(o), n.size === 0 && (a == null || a());
994
+ return n.add(s), i && (l == null || l()), () => {
995
+ n.delete(s), n.size === 0 && (a == null || a());
1016
996
  };
1017
997
  } };
1018
998
  }
1019
- function $e(e, t) {
1020
- return dt(e, t);
999
+ function Ue(e, t) {
1000
+ return ut(e, t);
1021
1001
  }
1022
1002
  function Tr() {
1023
- return dt(ve, Ar);
1003
+ return ut(_e, Ar);
1024
1004
  }
1025
1005
  function Rr(e, t) {
1026
1006
  return e.start === t.start && e.end === t.end;
@@ -1028,218 +1008,218 @@ function Rr(e, t) {
1028
1008
  function Ar(e, t) {
1029
1009
  return e.currentAnchorId !== t.currentAnchorId || e.visibleMessageIds.length !== t.visibleMessageIds.length ? !1 : e.visibleMessageIds.every((r, n) => r === t.visibleMessageIds[n]);
1030
1010
  }
1031
- function Br({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: r, scrollMargin: n, scrollPreviousItemPeek: o }) {
1032
- let s = c.useRef(e), a = c.useRef(!1), i = c.useRef(null), d = c.useRef(!1), p = c.useRef(r), m = c.useRef(0), y = c.useRef(null), f = c.useRef(0), u = c.useRef(e ? "following-bottom" : "free-scrolling"), g = c.useRef(/* @__PURE__ */ new Map()), E = c.useRef(null), v = c.useRef(null), B = c.useRef(null), W = c.useRef(o), L = c.useRef(!0), $ = c.useRef(null), N = c.useRef(n), M = c.useRef(null), T = c.useRef(0), z = c.useRef(0), I = c.useRef(null), J = c.useRef(null), U = c.useRef(null), b = c.useRef(null), _ = c.useRef(null), k = c.useRef(null), S = c.useRef(null), A = c.useRef(null), R = c.useRef(null), F = c.useRef(/* @__PURE__ */ new Set()), j = c.useRef(/* @__PURE__ */ new WeakSet());
1033
- return U.current === null && (U.current = $e(t === "end" || t === "last-anchor", (H, ce) => H === ce)), b.current === null && (b.current = $e(it, Rr)), R.current === null && (R.current = Tr()), s.current = e, p.current = r, N.current = n, W.current = o, { autoScrollRef: s, autoscrollingRef: a, autoscrollingTimeoutRef: _, streamingTurnRef: B, contentRef: i, defaultScrollPositionAppliedRef: d, firstItemRef: y, itemCountRef: m, lastScrollTopRef: f, messageElementsRef: g, modeRef: u, pendingScrollFrameRef: M, pendingScrollToMessageRef: E, prependRestoreRef: v, preserveScrollOnPrependRef: L, pendingDefaultScrollStore: U.current, rootRef: $, scrollEdgeThresholdRef: p, scrollMarginRef: N, scrollPreviousItemPeekRef: W, spacerGapRef: T, spacerHeightRef: z, spacerRef: I, stateFrameRef: J, stateStore: b.current, viewportRef: k, visibilityFrameRef: S, visibilityObserverRef: A, visibilityStore: R.current, visibleMessageIdsRef: F, handledScrollAnchorsRef: j };
1011
+ function Br({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: r, scrollMargin: n, scrollPreviousItemPeek: s }) {
1012
+ let l = c.useRef(e), a = c.useRef(!1), i = c.useRef(null), d = c.useRef(!1), h = c.useRef(r), g = c.useRef(0), v = c.useRef(null), f = c.useRef(0), u = c.useRef(e ? "following-bottom" : "free-scrolling"), m = c.useRef(/* @__PURE__ */ new Map()), T = c.useRef(null), _ = c.useRef(null), D = c.useRef(null), V = c.useRef(s), L = c.useRef(!0), $ = c.useRef(null), P = c.useRef(n), I = c.useRef(null), R = c.useRef(0), O = c.useRef(0), N = c.useRef(null), Z = c.useRef(null), U = c.useRef(null), b = c.useRef(null), y = c.useRef(null), S = c.useRef(null), F = c.useRef(null), B = c.useRef(null), A = c.useRef(null), E = c.useRef(/* @__PURE__ */ new Set()), W = c.useRef(/* @__PURE__ */ new WeakSet());
1013
+ return U.current === null && (U.current = Ue(t === "end" || t === "last-anchor", (z, ce) => z === ce)), b.current === null && (b.current = Ue(at, Rr)), A.current === null && (A.current = Tr()), l.current = e, h.current = r, P.current = n, V.current = s, { autoScrollRef: l, autoscrollingRef: a, autoscrollingTimeoutRef: y, streamingTurnRef: D, contentRef: i, defaultScrollPositionAppliedRef: d, firstItemRef: v, itemCountRef: g, lastScrollTopRef: f, messageElementsRef: m, modeRef: u, pendingScrollFrameRef: I, pendingScrollToMessageRef: T, prependRestoreRef: _, preserveScrollOnPrependRef: L, pendingDefaultScrollStore: U.current, rootRef: $, scrollEdgeThresholdRef: h, scrollMarginRef: P, scrollPreviousItemPeekRef: V, spacerGapRef: R, spacerHeightRef: O, spacerRef: N, stateFrameRef: Z, stateStore: b.current, viewportRef: S, visibilityFrameRef: F, visibilityObserverRef: B, visibilityStore: A.current, visibleMessageIdsRef: E, handledScrollAnchorsRef: W };
1034
1014
  }
1035
- function ft(e) {
1015
+ function dt(e) {
1036
1016
  e.pendingDefaultScrollStore.setSnapshot(!1);
1037
1017
  }
1038
- function me(e) {
1039
- e.defaultScrollPositionAppliedRef.current = !0, ft(e);
1018
+ function ge(e) {
1019
+ e.defaultScrollPositionAppliedRef.current = !0, dt(e);
1040
1020
  }
1041
1021
  function Dr({ refs: e, commitScrollState: t, scheduleStateCommit: r, scheduleVisibilitySync: n }) {
1042
- let { streamingTurnRef: o, autoScrollRef: s, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef: d, itemCountRef: p, messageElementsRef: m, modeRef: y, pendingScrollToMessageRef: f, prependRestoreRef: u, scrollMarginRef: g, scrollPreviousItemPeekRef: E, spacerGapRef: v, spacerHeightRef: B, spacerRef: W, viewportRef: L } = e, $ = c.useCallback((b) => {
1022
+ let { streamingTurnRef: s, autoScrollRef: l, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef: d, itemCountRef: h, messageElementsRef: g, modeRef: v, pendingScrollToMessageRef: f, prependRestoreRef: u, scrollMarginRef: m, scrollPreviousItemPeekRef: T, spacerGapRef: _, spacerHeightRef: D, spacerRef: V, viewportRef: L } = e, $ = c.useCallback((b) => {
1043
1023
  i.current !== null && (window.clearTimeout(i.current), i.current = null), a.current !== b && (a.current = b, t()), b && (i.current = window.setTimeout(() => {
1044
1024
  i.current = null, a.current = !1, t();
1045
- }, pr));
1046
- }, [t]), N = c.useCallback((b) => {
1047
- let _ = W.current;
1048
- if (!_) return;
1049
- let k = Math.max(0, Math.ceil(b));
1050
- B.current !== k && (B.current = k, _.hidden = k === 0, _.style.height = `${k}px`, _.style.marginTop = k > 0 ? `${-v.current}px` : "");
1051
- }, []), M = c.useCallback((b, { behavior: _ = "auto", autoscrolling: k = !1 } = {}) => {
1052
- let S = L.current;
1053
- if (!S) return;
1054
- let A = Math.max(0, b);
1055
- if (Math.abs(S.scrollTop - A) <= be) {
1056
- S.scrollTop = A, t();
1025
+ }, fr));
1026
+ }, [t]), P = c.useCallback((b) => {
1027
+ let y = V.current;
1028
+ if (!y) return;
1029
+ let S = Math.max(0, Math.ceil(b));
1030
+ D.current !== S && (D.current = S, y.hidden = S === 0, y.style.height = `${S}px`, y.style.marginTop = S > 0 ? `${-_.current}px` : "");
1031
+ }, []), I = c.useCallback((b, { behavior: y = "auto", autoscrolling: S = !1 } = {}) => {
1032
+ let F = L.current;
1033
+ if (!F) return;
1034
+ let B = Math.max(0, b);
1035
+ if (Math.abs(F.scrollTop - B) <= be) {
1036
+ F.scrollTop = B, t();
1057
1037
  return;
1058
1038
  }
1059
- k && $(!0), S.scrollTo({ top: A, behavior: _ }), r();
1060
- }, [t, r, $]), T = c.useCallback(({ behavior: b = "auto" } = {}) => L.current ? (N(0), o.current = null, y.current = "free-scrolling", M(0, { behavior: b }), n(), !0) : !1, [n, M, N]), z = c.useCallback(({ behavior: b = "auto" } = {}) => {
1061
- let _ = L.current;
1062
- return _ ? (N(0), o.current = null, y.current = s.current ? "following-bottom" : "free-scrolling", M(Sr(_), { autoscrolling: !0, behavior: b }), n(), !0) : !1;
1063
- }, [n, M, N]), I = c.useCallback((b, { align: _ = "start", behavior: k = "auto", scrollMargin: S = g.current } = {}, { keepPreviousPeek: A = !1 } = {}) => {
1064
- let R = d.current, F = L.current;
1065
- if (!R || !F || !R.contains(b)) return !1;
1066
- let j = Cr({ align: _, element: b, scrollMargin: A ? S + E.current : S, spacer: W.current, viewport: F }), H = kr({ content: R, scrollTop: j, spacer: W.current, viewport: F });
1067
- return N(H), u.current = { element: b, viewportTop: he(b, F) }, y.current = A ? "anchored-to-message" : "settling-jump", o.current = A ? b : null, M(j, { behavior: k }), n(), !0;
1068
- }, [n, M, N]), J = c.useCallback(() => {
1069
- let b = o.current;
1070
- return !b || !b.isConnected || y.current !== "anchored-to-message" ? !1 : I(b, { align: "start" }, { keepPreviousPeek: !0 });
1071
- }, [I]), U = c.useCallback((b, _) => {
1072
- let k = m.current.get(b);
1073
- return k ? (me(e), I(k, _) ? (f.current = null, !0) : (f.current = { messageId: b, options: _ }, !0)) : p.current === 0 ? (f.current = { messageId: b, options: _ }, me(e), !0) : !1;
1074
- }, [I]);
1039
+ S && $(!0), F.scrollTo({ top: B, behavior: y }), r();
1040
+ }, [t, r, $]), R = c.useCallback(({ behavior: b = "auto" } = {}) => L.current ? (P(0), s.current = null, v.current = "free-scrolling", I(0, { behavior: b }), n(), !0) : !1, [n, I, P]), O = c.useCallback(({ behavior: b = "auto" } = {}) => {
1041
+ let y = L.current;
1042
+ return y ? (P(0), s.current = null, v.current = l.current ? "following-bottom" : "free-scrolling", I(Sr(y), { autoscrolling: !0, behavior: b }), n(), !0) : !1;
1043
+ }, [n, I, P]), N = c.useCallback((b, { align: y = "start", behavior: S = "auto", scrollMargin: F = m.current } = {}, { keepPreviousPeek: B = !1 } = {}) => {
1044
+ let A = d.current, E = L.current;
1045
+ if (!A || !E || !A.contains(b)) return !1;
1046
+ let W = Cr({ align: y, element: b, scrollMargin: B ? F + T.current : F, spacer: V.current, viewport: E }), z = kr({ content: A, scrollTop: W, spacer: V.current, viewport: E });
1047
+ return P(z), u.current = { element: b, viewportTop: pe(b, E) }, v.current = B ? "anchored-to-message" : "settling-jump", s.current = B ? b : null, I(W, { behavior: S }), n(), !0;
1048
+ }, [n, I, P]), Z = c.useCallback(() => {
1049
+ let b = s.current;
1050
+ return !b || !b.isConnected || v.current !== "anchored-to-message" ? !1 : N(b, { align: "start" }, { keepPreviousPeek: !0 });
1051
+ }, [N]), U = c.useCallback((b, y) => {
1052
+ let S = g.current.get(b);
1053
+ return S ? (ge(e), N(S, y) ? (f.current = null, !0) : (f.current = { messageId: b, options: y }, !0)) : h.current === 0 ? (f.current = { messageId: b, options: y }, ge(e), !0) : !1;
1054
+ }, [N]);
1075
1055
  return { flushPendingScrollToMessage: c.useCallback(() => {
1076
1056
  let b = f.current;
1077
1057
  if (!b) return !1;
1078
- let _ = m.current.get(b.messageId);
1079
- return !_ || !I(_, b.options) ? !1 : (f.current = null, me(e), !0);
1080
- }, [I]), reanchorToAnchoredMessage: J, scrollToElement: I, scrollToEnd: z, scrollToMessage: U, scrollToStart: T };
1058
+ let y = g.current.get(b.messageId);
1059
+ return !y || !N(y, b.options) ? !1 : (f.current = null, ge(e), !0);
1060
+ }, [N]), reanchorToAnchoredMessage: Z, scrollToElement: N, scrollToEnd: O, scrollToMessage: U, scrollToStart: R };
1081
1061
  }
1082
- function Ue(e, t) {
1062
+ function je(e, t) {
1083
1063
  return c.useCallback((r) => {
1084
1064
  e.current = r, r && t();
1085
1065
  }, [e, t]);
1086
1066
  }
1087
- function Mr({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: r = ur, scrollPreviousItemPeek: n = dr, scrollMargin: o = fr }) {
1088
- let s = Br({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: r, scrollMargin: o, scrollPreviousItemPeek: n }), { streamingTurnRef: a, autoScrollRef: i, autoscrollingRef: d, autoscrollingTimeoutRef: p, contentRef: m, defaultScrollPositionAppliedRef: y, firstItemRef: f, itemCountRef: u, lastScrollTopRef: g, messageElementsRef: E, modeRef: v, pendingScrollFrameRef: B, pendingScrollToMessageRef: W, prependRestoreRef: L, preserveScrollOnPrependRef: $, pendingDefaultScrollStore: N, rootRef: M, scrollEdgeThresholdRef: T, scrollMarginRef: z, scrollPreviousItemPeekRef: I, spacerGapRef: J, spacerHeightRef: U, spacerRef: b, stateFrameRef: _, stateStore: k, viewportRef: S, visibilityFrameRef: A, visibilityObserverRef: R, visibilityStore: F, visibleMessageIdsRef: j, handledScrollAnchorsRef: H } = s, ce = c.useRef(t);
1089
- ce.current !== t && (ce.current = t, y.current = !1);
1090
- let ue = c.useCallback((h) => {
1091
- let x = M.current, w = S.current, D = [h.start && "start", h.end && "end"].filter(Boolean).join(" "), K = d.current;
1092
- for (let G of [x, w]) G && (D ? G.setAttribute("data-scrollable", D) : G.removeAttribute("data-scrollable"), G.toggleAttribute("data-autoscrolling", K));
1093
- }, []), Te = c.useCallback((h) => {
1094
- var D;
1095
- let x = ((D = S.current) == null ? void 0 : D.scrollTop) ?? 0, w = x < g.current - be;
1096
- g.current = x, i.current && !h.end && v.current !== "settling-jump" && v.current !== "anchored-to-message" ? v.current = "following-bottom" : v.current === "following-bottom" && h.end && w && !d.current && (v.current = "free-scrolling");
1097
- }, []), Z = c.useCallback(() => {
1098
- let h = gr({ content: m.current, scrollEdgeThreshold: T.current, spacer: b.current, viewport: S.current });
1099
- Te(h);
1100
- let x = v.current === "following-bottom" ? { ...h, end: !1 } : h;
1101
- ue(x), k.setSnapshot(x);
1102
- }, [Te, k, ue]), ne = c.useCallback(() => {
1103
- _.current === null && (_.current = window.requestAnimationFrame(() => {
1104
- _.current = null, Z();
1067
+ function Mr({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: r = cr, scrollPreviousItemPeek: n = ur, scrollMargin: s = dr }) {
1068
+ let l = Br({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: r, scrollMargin: s, scrollPreviousItemPeek: n }), { streamingTurnRef: a, autoScrollRef: i, autoscrollingRef: d, autoscrollingTimeoutRef: h, contentRef: g, defaultScrollPositionAppliedRef: v, firstItemRef: f, itemCountRef: u, lastScrollTopRef: m, messageElementsRef: T, modeRef: _, pendingScrollFrameRef: D, pendingScrollToMessageRef: V, prependRestoreRef: L, preserveScrollOnPrependRef: $, pendingDefaultScrollStore: P, rootRef: I, scrollEdgeThresholdRef: R, scrollMarginRef: O, scrollPreviousItemPeekRef: N, spacerGapRef: Z, spacerHeightRef: U, spacerRef: b, stateFrameRef: y, stateStore: S, viewportRef: F, visibilityFrameRef: B, visibilityObserverRef: A, visibilityStore: E, visibleMessageIdsRef: W, handledScrollAnchorsRef: z } = l, ce = c.useRef(t);
1069
+ ce.current !== t && (ce.current = t, v.current = !1);
1070
+ let ue = c.useCallback((p) => {
1071
+ let w = I.current, C = F.current, M = [p.start && "start", p.end && "end"].filter(Boolean).join(" "), J = d.current;
1072
+ for (let G of [w, C]) G && (M ? G.setAttribute("data-scrollable", M) : G.removeAttribute("data-scrollable"), G.toggleAttribute("data-autoscrolling", J));
1073
+ }, []), Re = c.useCallback((p) => {
1074
+ var M;
1075
+ let w = ((M = F.current) == null ? void 0 : M.scrollTop) ?? 0, C = w < m.current - be;
1076
+ m.current = w, i.current && !p.end && _.current !== "settling-jump" && _.current !== "anchored-to-message" ? _.current = "following-bottom" : _.current === "following-bottom" && p.end && C && !d.current && (_.current = "free-scrolling");
1077
+ }, []), Y = c.useCallback(() => {
1078
+ let p = gr({ content: g.current, scrollEdgeThreshold: R.current, spacer: b.current, viewport: F.current });
1079
+ Re(p);
1080
+ let w = _.current === "following-bottom" ? { ...p, end: !1 } : p;
1081
+ ue(w), S.setSnapshot(w);
1082
+ }, [Re, S, ue]), ne = c.useCallback(() => {
1083
+ y.current === null && (y.current = window.requestAnimationFrame(() => {
1084
+ y.current = null, Y();
1105
1085
  }));
1106
- }, [Z]), P = c.useCallback(() => {
1107
- F.hasListeners() && A.current === null && (A.current = window.requestAnimationFrame(() => {
1108
- A.current = null, F.hasListeners() && F.setSnapshot(br({ content: m.current, scrollMargin: z.current, scrollPreviousItemPeek: I.current, spacer: b.current, viewport: S.current, visibleMessageIds: j.current }));
1086
+ }, [Y]), x = c.useCallback(() => {
1087
+ E.hasListeners() && B.current === null && (B.current = window.requestAnimationFrame(() => {
1088
+ B.current = null, E.hasListeners() && E.setSnapshot(mr({ content: g.current, scrollMargin: O.current, scrollPreviousItemPeek: N.current, spacer: b.current, viewport: F.current, visibleMessageIds: W.current }));
1109
1089
  }));
1110
- }, [F]), { flushPendingScrollToMessage: de, reanchorToAnchoredMessage: Re, scrollToElement: oe, scrollToEnd: q, scrollToMessage: Ae, scrollToStart: fe } = Dr({ refs: s, commitScrollState: Z, scheduleStateCommit: ne, scheduleVisibilitySync: P }), Be = c.useCallback(() => {
1111
- let h = L.current, x = S.current;
1112
- if (!h || !x || !h.element.isConnected) return !1;
1113
- let w = he(h.element, x) - h.viewportTop;
1114
- return Math.abs(w) <= be ? !1 : (x.scrollTop += w, h.viewportTop = he(h.element, x), ne(), P(), !0);
1115
- }, [ne, P]), ee = c.useCallback(() => {
1116
- let h = m.current, x = S.current;
1117
- if (!h || !x) {
1090
+ }, [E]), { flushPendingScrollToMessage: de, reanchorToAnchoredMessage: Ae, scrollToElement: se, scrollToEnd: q, scrollToMessage: Be, scrollToStart: fe } = Dr({ refs: l, commitScrollState: Y, scheduleStateCommit: ne, scheduleVisibilitySync: x }), De = c.useCallback(() => {
1091
+ let p = L.current, w = F.current;
1092
+ if (!p || !w || !p.element.isConnected) return !1;
1093
+ let C = pe(p.element, w) - p.viewportTop;
1094
+ return Math.abs(C) <= be ? !1 : (w.scrollTop += C, p.viewportTop = pe(p.element, w), ne(), x(), !0);
1095
+ }, [ne, x]), Q = c.useCallback(() => {
1096
+ let p = g.current, w = F.current;
1097
+ if (!p || !w) {
1118
1098
  L.current = null;
1119
1099
  return;
1120
1100
  }
1121
- let w = wr({ content: h, spacer: b.current, viewport: x });
1122
- L.current = w ? { element: w, viewportTop: he(w, x) } : null;
1123
- }, []), De = c.useCallback(() => {
1124
- B.current === null && (B.current = window.requestAnimationFrame(() => {
1125
- B.current = null, de() && ee();
1101
+ let C = wr({ content: p, spacer: b.current, viewport: w });
1102
+ L.current = C ? { element: C, viewportTop: pe(C, w) } : null;
1103
+ }, []), Me = c.useCallback(() => {
1104
+ D.current === null && (D.current = window.requestAnimationFrame(() => {
1105
+ D.current = null, de() && Q();
1126
1106
  }));
1127
- }, [ee, de]), pe = c.useCallback(() => {
1128
- if (!t || y.current || u.current === 0) return !1;
1129
- let h = !1;
1107
+ }, [Q, de]), he = c.useCallback(() => {
1108
+ if (!t || v.current || u.current === 0) return !1;
1109
+ let p = !1;
1130
1110
  if (t === "last-anchor") {
1131
- let x = m.current, w = S.current, D = x && w ? xr(se(x, b.current)) : null;
1132
- if (!x || !w || !D) h = q({ behavior: "auto" });
1111
+ let w = g.current, C = F.current, M = w && C ? yr(le(w, b.current)) : null;
1112
+ if (!w || !C || !M) p = q({ behavior: "auto" });
1133
1113
  else {
1134
- let K = ct(D, w);
1135
- h = Ee({ content: x, spacer: b.current, viewport: w }) - K <= w.clientHeight ? q({ behavior: "auto" }) : oe(D, { align: "start" }, { keepPreviousPeek: !0 });
1114
+ let J = it(M, C);
1115
+ p = Te({ content: w, spacer: b.current, viewport: C }) - J <= C.clientHeight ? q({ behavior: "auto" }) : se(M, { align: "start" }, { keepPreviousPeek: !0 });
1136
1116
  }
1137
- } else h = t === "end" ? q({ behavior: "auto" }) : fe({ behavior: "auto" });
1138
- return h ? (me(s), !0) : !1;
1139
- }, [t, oe, q, fe]), Me = c.useCallback(() => {
1140
- let h = m.current;
1141
- if (!h) return;
1142
- let x = se(h, b.current), w = u.current, D = f.current;
1143
- u.current = x.length, f.current = x[0] ?? null, (() => {
1117
+ } else p = t === "end" ? q({ behavior: "auto" }) : fe({ behavior: "auto" });
1118
+ return p ? (ge(l), !0) : !1;
1119
+ }, [t, se, q, fe]), Ie = c.useCallback(() => {
1120
+ let p = g.current;
1121
+ if (!p) return;
1122
+ let w = le(p, b.current), C = u.current, M = f.current;
1123
+ u.current = w.length, f.current = w[0] ?? null, (() => {
1144
1124
  if (de()) return;
1145
- if (w === 0) {
1146
- if (pe() || x.length > 0 && i.current && q({ behavior: "auto" })) return;
1147
- Z(), P();
1125
+ if (C === 0) {
1126
+ if (he() || w.length > 0 && i.current && q({ behavior: "auto" })) return;
1127
+ Y(), x();
1148
1128
  return;
1149
1129
  }
1150
- let K = D ? x.indexOf(D) : -1;
1151
- if ($.current && K > 0) {
1152
- Be();
1130
+ let J = M ? w.indexOf(M) : -1;
1131
+ if ($.current && J > 0) {
1132
+ De();
1153
1133
  return;
1154
1134
  }
1155
- if (x.length > w) {
1156
- let G = vr(x, w);
1135
+ if (w.length > C) {
1136
+ let G = br(w, C);
1157
1137
  if (G) {
1158
- if (i.current && v.current === "following-bottom" && _r(x, w)) {
1138
+ if (i.current && _.current === "following-bottom" && vr(w, C)) {
1159
1139
  q({ behavior: "auto" });
1160
1140
  return;
1161
1141
  }
1162
- oe(G, { align: "start" }, { keepPreviousPeek: !0 }), H.current.add(G);
1142
+ se(G, { align: "start" }, { keepPreviousPeek: !0 }), z.current.add(G);
1163
1143
  return;
1164
1144
  }
1165
1145
  }
1166
- if (x.length === w) {
1167
- let G = yr(x, H.current);
1146
+ if (w.length === C) {
1147
+ let G = _r(w, z.current);
1168
1148
  if (G) {
1169
- oe(G, { align: "start" }, { keepPreviousPeek: !0 }), H.current.add(G);
1149
+ se(G, { align: "start" }, { keepPreviousPeek: !0 }), z.current.add(G);
1170
1150
  return;
1171
1151
  }
1172
1152
  }
1173
- v.current === "following-bottom" && i.current ? q({ behavior: "auto" }) : (Z(), P());
1174
- })(), ee();
1175
- }, [pe, ee, Z, de, Be, P, oe, q]), Ie = c.useCallback(() => {
1176
- if (v.current === "following-bottom" && i.current) {
1153
+ _.current === "following-bottom" && i.current ? q({ behavior: "auto" }) : (Y(), x());
1154
+ })(), Q();
1155
+ }, [he, Q, Y, de, De, x, se, q]), Ne = c.useCallback(() => {
1156
+ if (_.current === "following-bottom" && i.current) {
1177
1157
  q({ behavior: "auto" });
1178
1158
  return;
1179
1159
  }
1180
- let h = U.current;
1181
- if (Re()) {
1182
- i.current && h > 0 && U.current === 0 && q({ behavior: "auto" });
1160
+ let p = U.current;
1161
+ if (Ae()) {
1162
+ i.current && p > 0 && U.current === 0 && q({ behavior: "auto" });
1183
1163
  return;
1184
1164
  }
1185
- ne(), P();
1186
- }, [Re, ne, P, q]), Ne = c.useCallback(() => {
1187
- let h = S.current;
1188
- if (!(!h || !F.hasListeners())) {
1165
+ ne(), x();
1166
+ }, [Ae, ne, x, q]), Pe = c.useCallback(() => {
1167
+ let p = F.current;
1168
+ if (!(!p || !E.hasListeners())) {
1189
1169
  if (typeof IntersectionObserver > "u") {
1190
- P();
1170
+ x();
1191
1171
  return;
1192
1172
  }
1193
- R.current || (R.current = new IntersectionObserver((x) => {
1194
- for (let w of x) {
1195
- let D = w.target.dataset.messageId;
1196
- D && (w.isIntersecting ? j.current.add(D) : j.current.delete(D));
1173
+ A.current || (A.current = new IntersectionObserver((w) => {
1174
+ for (let C of w) {
1175
+ let M = C.target.dataset.messageId;
1176
+ M && (C.isIntersecting ? W.current.add(M) : W.current.delete(M));
1197
1177
  }
1198
- P();
1199
- }, { root: h, rootMargin: `${-(z.current + I.current)}px 0px 0px 0px`, threshold: [0, 0.01, 0.5, 1] })), E.current.forEach((x) => {
1200
- var w;
1201
- (w = R.current) == null || w.observe(x);
1202
- }), P();
1178
+ x();
1179
+ }, { root: p, rootMargin: `${-(O.current + N.current)}px 0px 0px 0px`, threshold: [0, 0.01, 0.5, 1] })), T.current.forEach((w) => {
1180
+ var C;
1181
+ (C = A.current) == null || C.observe(w);
1182
+ }), x();
1203
1183
  }
1204
- }, [P, F]), Pe = c.useCallback(() => {
1205
- var h;
1206
- A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), (h = R.current) == null || h.disconnect(), R.current = null, j.current.clear(), F.setSnapshot(ve);
1207
- }, [F]), vt = c.useCallback((h, x, w) => {
1208
- var D, K, G;
1209
- if (x) {
1210
- E.current.set(h, x), (D = R.current) == null || D.observe(x), P(), ((K = W.current) == null ? void 0 : K.messageId) === h && De();
1184
+ }, [x, E]), xe = c.useCallback(() => {
1185
+ var p;
1186
+ B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), (p = A.current) == null || p.disconnect(), A.current = null, W.current.clear(), E.setSnapshot(_e);
1187
+ }, [E]), _t = c.useCallback((p, w, C) => {
1188
+ var M, J, G;
1189
+ if (w) {
1190
+ T.current.set(p, w), (M = A.current) == null || M.observe(w), x(), ((J = V.current) == null ? void 0 : J.messageId) === p && Me();
1211
1191
  return;
1212
1192
  }
1213
- w && E.current.get(h) === w && (E.current.delete(h), j.current.delete(h), (G = R.current) == null || G.unobserve(w), P());
1214
- }, [De, P]), Le = c.useCallback(() => {
1215
- (v.current === "following-bottom" || v.current === "anchored-to-message" || v.current === "settling-jump") && (a.current = null, v.current = "free-scrolling");
1216
- }, []), ze = c.useCallback(() => ue(k.getSnapshot()), [k, ue]), Oe = Ue(M, ze), He = Ue(S, ze), qe = c.useCallback((h) => {
1217
- m.current = h;
1218
- }, []), Ge = c.useCallback((h) => {
1219
- b.current = h, J.current = Er((h == null ? void 0 : h.parentElement) ?? null);
1193
+ C && T.current.get(p) === C && (T.current.delete(p), W.current.delete(p), (G = A.current) == null || G.unobserve(C), x());
1194
+ }, [Me, x]), Le = c.useCallback(() => {
1195
+ (_.current === "following-bottom" || _.current === "anchored-to-message" || _.current === "settling-jump") && (a.current = null, _.current = "free-scrolling");
1196
+ }, []), Oe = c.useCallback(() => ue(S.getSnapshot()), [S, ue]), He = je(I, Oe), ze = je(F, Oe), qe = c.useCallback((p) => {
1197
+ g.current = p;
1198
+ }, []), Ge = c.useCallback((p) => {
1199
+ b.current = p, Z.current = Er((p == null ? void 0 : p.parentElement) ?? null);
1220
1200
  }, []), Ve = c.useCallback(() => {
1221
- Z(), P(), ee();
1222
- }, [ee, Z, P]), yt = c.useMemo(() => ({ handleContentChange: Me, handleResize: Ie, observeVisibility: Ne, pendingDefaultScrollStore: N, preserveScrollOnPrependRef: $, scrollToEnd: q, scrollToMessage: Ae, scrollToStart: fe, setContentElement: qe, setRootElement: Oe, setSpacerElement: Ge, setViewportElement: He, stateStore: k, syncAfterScroll: Ve, unobserveVisibility: Pe, userScrollIntent: Le, viewportRef: S, visibilityStore: F }), [Me, Ie, Ne, N, q, Ae, fe, qe, Oe, Ge, He, k, Ve, Pe, Le, F]);
1201
+ Y(), x(), Q();
1202
+ }, [Q, Y, x]), vt = c.useMemo(() => ({ handleContentChange: Ie, handleResize: Ne, observeVisibility: Pe, pendingDefaultScrollStore: P, preserveScrollOnPrependRef: $, scrollToEnd: q, scrollToMessage: Be, scrollToStart: fe, setContentElement: qe, setRootElement: He, setSpacerElement: Ge, setViewportElement: ze, stateStore: S, syncAfterScroll: Ve, unobserveVisibility: xe, userScrollIntent: Le, viewportRef: F, visibilityStore: E }), [Ie, Ne, Pe, P, q, Be, fe, qe, He, Ge, ze, S, Ve, xe, Le, E]);
1223
1203
  return c.useLayoutEffect(() => {
1224
- pe() || u.current === 0 && ft(s);
1225
- }, [pe]), c.useEffect(() => () => {
1226
- var h;
1227
- _.current !== null && (window.cancelAnimationFrame(_.current), _.current = null), A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), p.current !== null && (window.clearTimeout(p.current), p.current = null), B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), (h = R.current) == null || h.disconnect(), R.current = null;
1204
+ he() || u.current === 0 && dt(l);
1205
+ }, [he]), c.useEffect(() => () => {
1206
+ var p;
1207
+ y.current !== null && (window.cancelAnimationFrame(y.current), y.current = null), B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), h.current !== null && (window.clearTimeout(h.current), h.current = null), D.current !== null && (window.cancelAnimationFrame(D.current), D.current = null), (p = A.current) == null || p.disconnect(), A.current = null;
1228
1208
  }, []), c.useLayoutEffect(() => {
1229
- if (e && v.current === "following-bottom" && u.current > 0) {
1209
+ if (e && _.current === "following-bottom" && u.current > 0) {
1230
1210
  q({ behavior: "auto" });
1231
1211
  return;
1232
1212
  }
1233
- Z();
1234
- }, [e, Z, q]), { context: yt, registerMessage: vt };
1213
+ Y();
1214
+ }, [e, Y, q]), { context: vt, registerMessage: _t };
1235
1215
  }
1236
1216
  function Ir(e) {
1237
1217
  let t = c.useRef(e);
1238
1218
  return t.current = e, t;
1239
1219
  }
1240
- var pt = c.createContext(null), ht = c.createContext(null);
1220
+ var ft = c.createContext(null), ht = c.createContext(null);
1241
1221
  function ie() {
1242
- let e = c.useContext(pt);
1222
+ let e = c.useContext(ft);
1243
1223
  if (!e) throw new Error("useMessageScroller must be used within a MessageScroller.");
1244
1224
  return e;
1245
1225
  }
@@ -1248,105 +1228,118 @@ function Nr() {
1248
1228
  if (!e) throw new Error("MessageScrollerItem must be used within a MessageScroller.");
1249
1229
  return e;
1250
1230
  }
1251
- function Pr({ autoScroll: e = !1, children: t, defaultScrollPosition: r = "end", scrollEdgeThreshold: n, scrollPreviousItemPeek: o, scrollMargin: s }) {
1252
- let { context: a, registerMessage: i } = Mr({ autoScroll: e, defaultScrollPosition: r, scrollEdgeThreshold: n, scrollPreviousItemPeek: o, scrollMargin: s });
1253
- return l(pt.Provider, { value: a, children: l(ht.Provider, { value: i, children: t }) });
1231
+ function Pr({ autoScroll: e = !1, children: t, defaultScrollPosition: r = "end", scrollEdgeThreshold: n, scrollPreviousItemPeek: s, scrollMargin: l }) {
1232
+ let { context: a, registerMessage: i } = Mr({ autoScroll: e, defaultScrollPosition: r, scrollEdgeThreshold: n, scrollPreviousItemPeek: s, scrollMargin: l });
1233
+ return o(ft.Provider, { value: a, children: o(ht.Provider, { value: i, children: t }) });
1254
1234
  }
1255
- function mt() {
1235
+ function pt() {
1256
1236
  let { pendingDefaultScrollStore: e } = ie();
1257
1237
  return c.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
1258
1238
  }
1259
- function Lr({ children: e, ...t }) {
1260
- let { setRootElement: r } = ie(), n = mt();
1261
- return l("div", { ref: r, ...t, ...n ? { "data-pending-scroll": "" } : null, children: e });
1239
+ function xr({ children: e, ...t }) {
1240
+ let { setRootElement: r } = ie(), n = pt();
1241
+ return o("div", { ref: r, ...t, ...n ? { "data-pending-scroll": "" } : null, children: e });
1262
1242
  }
1263
- function zr({ "aria-label": e, children: t, onKeyDown: r, onScroll: n, onTouchMove: o, onWheel: s, preserveScrollOnPrepend: a = !0, ref: i, role: d, tabIndex: p, ...m }) {
1264
- let { handleResize: y, preserveScrollOnPrependRef: f, setViewportElement: u, syncAfterScroll: g, userScrollIntent: E, viewportRef: v } = ie(), B = mt();
1243
+ function Lr({ "aria-label": e, children: t, onKeyDown: r, onScroll: n, onTouchMove: s, onWheel: l, preserveScrollOnPrepend: a = !0, ref: i, role: d, tabIndex: h, ...g }) {
1244
+ let { handleResize: v, preserveScrollOnPrependRef: f, setViewportElement: u, syncAfterScroll: m, userScrollIntent: T, viewportRef: _ } = ie(), D = pt();
1265
1245
  f.current = a;
1266
- let W = c.useCallback((T) => {
1267
- var z;
1268
- u(T), (z = ae(i)) == null || z(T);
1246
+ let V = c.useCallback((R) => {
1247
+ var O;
1248
+ u(R), (O = ae(i)) == null || O(R);
1269
1249
  }, [i, u]);
1270
- function L(T) {
1271
- g(), n == null || n(T);
1250
+ function L(R) {
1251
+ m(), n == null || n(R);
1272
1252
  }
1273
- function $(T) {
1274
- E(), s == null || s(T);
1253
+ function $(R) {
1254
+ T(), l == null || l(R);
1275
1255
  }
1276
- function N(T) {
1277
- E(), o == null || o(T);
1256
+ function P(R) {
1257
+ T(), s == null || s(R);
1278
1258
  }
1279
- function M(T) {
1280
- hr.has(T.key) && E(), r == null || r(T);
1259
+ function I(R) {
1260
+ hr.has(R.key) && T(), r == null || r(R);
1281
1261
  }
1282
1262
  return c.useEffect(() => {
1283
- let T = v.current;
1284
- if (!T || typeof ResizeObserver > "u") return;
1285
- let z = 0, I = new ResizeObserver(() => {
1286
- window.cancelAnimationFrame(z), z = window.requestAnimationFrame(y);
1263
+ let R = _.current;
1264
+ if (!R || typeof ResizeObserver > "u") return;
1265
+ let O = 0, N = new ResizeObserver(() => {
1266
+ window.cancelAnimationFrame(O), O = window.requestAnimationFrame(v);
1287
1267
  });
1288
- return I.observe(T), () => {
1289
- window.cancelAnimationFrame(z), I.disconnect();
1268
+ return N.observe(R), () => {
1269
+ window.cancelAnimationFrame(O), N.disconnect();
1290
1270
  };
1291
- }, [y, v]), l("div", { ref: W, role: d ?? "region", "aria-label": e ?? "Messages", tabIndex: p ?? 0, onKeyDown: M, onScroll: L, onTouchMove: N, onWheel: $, ...m, ...B ? { "data-pending-scroll": "" } : null, children: t });
1271
+ }, [v, _]), o("div", { ref: V, role: d ?? "region", "aria-label": e ?? "Messages", tabIndex: h ?? 0, onKeyDown: I, onScroll: L, onTouchMove: P, onWheel: $, ...g, ...D ? { "data-pending-scroll": "" } : null, children: t });
1292
1272
  }
1293
- function Or({ "aria-relevant": e, children: t, ref: r, role: n, spacerClassName: o, ...s }) {
1294
- let { handleContentChange: a, handleResize: i, setContentElement: d, setSpacerElement: p } = ie(), m = c.useRef(null), y = c.useCallback((f) => {
1273
+ function Or({ "aria-relevant": e, children: t, ref: r, role: n, spacerClassName: s, ...l }) {
1274
+ let { handleContentChange: a, handleResize: i, setContentElement: d, setSpacerElement: h } = ie(), g = c.useRef(null), v = c.useCallback((f) => {
1295
1275
  var u;
1296
- m.current = f, d(f), (u = ae(r)) == null || u(f);
1276
+ g.current = f, d(f), (u = ae(r)) == null || u(f);
1297
1277
  }, [r, d]);
1298
1278
  return c.useLayoutEffect(() => {
1299
- let f = m.current;
1279
+ let f = g.current;
1300
1280
  if (!f || (a(), typeof MutationObserver > "u")) return;
1301
1281
  let u = new MutationObserver(() => {
1302
1282
  a();
1303
1283
  });
1304
1284
  return u.observe(f, { childList: !0 }), () => u.disconnect();
1305
1285
  }, [a]), c.useEffect(() => {
1306
- let f = m.current;
1286
+ let f = g.current;
1307
1287
  if (!f || typeof ResizeObserver > "u") return;
1308
- let u = 0, g = new ResizeObserver(() => {
1288
+ let u = 0, m = new ResizeObserver(() => {
1309
1289
  window.cancelAnimationFrame(u), u = window.requestAnimationFrame(i);
1310
1290
  });
1311
- return g.observe(f), () => {
1312
- window.cancelAnimationFrame(u), g.disconnect();
1291
+ return m.observe(f), () => {
1292
+ window.cancelAnimationFrame(u), m.disconnect();
1313
1293
  };
1314
- }, [i]), C("div", { ref: y, role: n ?? "log", "aria-relevant": e ?? "additions", ...s, children: [t, l("div", { ref: p, "aria-hidden": "true", "data-message-scroller-spacer": "", hidden: !0, className: o })] });
1294
+ }, [i]), k("div", { ref: v, role: n ?? "log", "aria-relevant": e ?? "additions", ...l, children: [t, o("div", { ref: h, "aria-hidden": "true", "data-message-scroller-spacer": "", hidden: !0, className: s })] });
1315
1295
  }
1316
1296
  function Hr({ messageId: e, ref: t, scrollAnchor: r = !1, ...n }) {
1317
- let o = Nr(), s = c.useRef(null), a = c.useCallback((i) => {
1318
- var p;
1319
- let d = s.current;
1320
- s.current = i, e && o(e, i, d), (p = ae(t)) == null || p(i);
1321
- }, [e, t, o]);
1322
- return l("div", { ref: a, "data-message-id": e, "data-scroll-anchor": r ? "true" : "false", ...n });
1323
- }
1324
- function qr({ behavior: e = "smooth", children: t, direction: r = "end", onClick: n, render: o, tabIndex: s, type: a = "button", ...i }) {
1325
- let { scrollToEnd: d, scrollToStart: p, stateStore: m } = ie(), y = Ir(n), f = c.useCallback((v) => m.subscribe(v), [m]), u = c.useCallback(() => {
1326
- let v = m.getSnapshot();
1327
- return r === "start" ? v.start : v.end;
1328
- }, [r, m]), g = c.useSyncExternalStore(f, u, u), E = c.useCallback((v) => {
1329
- var B;
1330
- g && ((B = y.current) == null || B.call(y, v), v.defaultPrevented || (v.currentTarget.blur(), r === "start" ? p({ behavior: e }) : d({ behavior: e })));
1331
- }, [e, r, g, y, d, p]);
1332
- return lr({ defaultTagName: "button", props: ke({ type: a, inert: !g, tabIndex: g ? s : -1, children: t ?? C("span", { children: ["Scroll to ", r] }), onClick: E }, i), render: o, state: { active: g, direction: r }, stateAttributesMapping: { active: (v) => ({ "data-active": v ? "true" : "false" }) } });
1333
- }
1334
- var re = { Provider: Pr, Root: Lr, Viewport: zr, Content: Or, Item: Hr, Button: qr };
1297
+ let s = Nr(), l = c.useRef(null), a = c.useCallback((i) => {
1298
+ var h;
1299
+ let d = l.current;
1300
+ l.current = i, e && s(e, i, d), (h = ae(t)) == null || h(i);
1301
+ }, [e, t, s]);
1302
+ return o("div", { ref: a, "data-message-id": e, "data-scroll-anchor": r ? "true" : "false", ...n });
1303
+ }
1304
+ function zr({ behavior: e = "smooth", children: t, direction: r = "end", onClick: n, render: s, tabIndex: l, type: a = "button", ...i }) {
1305
+ let { scrollToEnd: d, scrollToStart: h, stateStore: g } = ie(), v = Ir(n), f = c.useCallback((_) => g.subscribe(_), [g]), u = c.useCallback(() => {
1306
+ let _ = g.getSnapshot();
1307
+ return r === "start" ? _.start : _.end;
1308
+ }, [r, g]), m = c.useSyncExternalStore(f, u, u), T = c.useCallback((_) => {
1309
+ var D;
1310
+ m && ((D = v.current) == null || D.call(v, _), _.defaultPrevented || (_.currentTarget.blur(), r === "start" ? h({ behavior: e }) : d({ behavior: e })));
1311
+ }, [e, r, m, v, d, h]);
1312
+ return lr({ defaultTagName: "button", props: Se({ type: a, inert: !m, tabIndex: m ? l : -1, children: t ?? k("span", { children: ["Scroll to ", r] }), onClick: T }, i), render: s, state: { active: m, direction: r }, stateAttributesMapping: { active: (_) => ({ "data-active": _ ? "true" : "false" }) } });
1313
+ }
1314
+ var te = { Provider: Pr, Root: xr, Viewport: Lr, Content: Or, Item: Hr, Button: zr };
1315
+ function gt(e) {
1316
+ var t, r, n = "";
1317
+ if (typeof e == "string" || typeof e == "number") n += e;
1318
+ else if (typeof e == "object") if (Array.isArray(e)) {
1319
+ var s = e.length;
1320
+ for (t = 0; t < s; t++) e[t] && (r = gt(e[t])) && (n && (n += " "), n += r);
1321
+ } else for (r in e) e[r] && (n && (n += " "), n += r);
1322
+ return n;
1323
+ }
1324
+ function qr() {
1325
+ for (var e, t, r = 0, n = "", s = arguments.length; r < s; r++) (e = arguments[r]) && (t = gt(e)) && (n && (n += " "), n += t);
1326
+ return n;
1327
+ }
1328
+ function re(...e) {
1329
+ return qr(e);
1330
+ }
1335
1331
  function Gr(e) {
1336
- return /* @__PURE__ */ l(re.Provider, { ...e });
1332
+ return /* @__PURE__ */ o(te.Provider, { ...e });
1337
1333
  }
1338
1334
  function Vr({
1339
1335
  className: e,
1340
1336
  ...t
1341
1337
  }) {
1342
- return /* @__PURE__ */ l(
1343
- re.Root,
1338
+ return /* @__PURE__ */ o(
1339
+ te.Root,
1344
1340
  {
1345
1341
  "data-slot": "message-scroller",
1346
- className: V(
1347
- "group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
1348
- e
1349
- ),
1342
+ className: re("msg-scroller-root", e),
1350
1343
  ...t
1351
1344
  }
1352
1345
  );
@@ -1355,28 +1348,24 @@ function Wr({
1355
1348
  className: e,
1356
1349
  ...t
1357
1350
  }) {
1358
- return /* @__PURE__ */ l(
1359
- re.Viewport,
1351
+ return /* @__PURE__ */ o(
1352
+ te.Viewport,
1360
1353
  {
1361
1354
  "data-slot": "message-scroller-viewport",
1362
- className: V(
1363
- "size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain",
1364
- "data-[pending-scroll]:invisible",
1365
- e
1366
- ),
1355
+ className: re("msg-scroller-viewport", e),
1367
1356
  ...t
1368
1357
  }
1369
1358
  );
1370
1359
  }
1371
- function jr({
1360
+ function $r({
1372
1361
  className: e,
1373
1362
  ...t
1374
1363
  }) {
1375
- return /* @__PURE__ */ l(
1376
- re.Content,
1364
+ return /* @__PURE__ */ o(
1365
+ te.Content,
1377
1366
  {
1378
1367
  "data-slot": "message-scroller-content",
1379
- className: V("flex h-max min-h-full flex-col gap-4 px-4 py-4", e),
1368
+ className: re("msg-scroller-content", e),
1380
1369
  ...t
1381
1370
  }
1382
1371
  );
@@ -1386,42 +1375,31 @@ function Ye({
1386
1375
  scrollAnchor: t = !1,
1387
1376
  ...r
1388
1377
  }) {
1389
- return /* @__PURE__ */ l(
1390
- re.Item,
1378
+ return /* @__PURE__ */ o(
1379
+ te.Item,
1391
1380
  {
1392
1381
  "data-slot": "message-scroller-item",
1393
1382
  scrollAnchor: t,
1394
- className: V(
1395
- "min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
1396
- e
1397
- ),
1383
+ className: re("msg-scroller-item", e),
1398
1384
  ...r
1399
1385
  }
1400
1386
  );
1401
1387
  }
1402
- function $r({
1388
+ function Ur({
1403
1389
  direction: e = "end",
1404
1390
  className: t,
1405
1391
  children: r,
1406
1392
  ...n
1407
1393
  }) {
1408
- return /* @__PURE__ */ l(
1409
- re.Button,
1394
+ return /* @__PURE__ */ o(
1395
+ te.Button,
1410
1396
  {
1411
1397
  "data-slot": "message-scroller-button",
1412
1398
  direction: e,
1413
- className: V(
1414
- "absolute left-1/2 z-10 flex h-9 w-9 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-card text-foreground shadow-md transition-[opacity,transform] duration-200",
1415
- "hover:bg-[var(--input-bg)]",
1416
- "data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0",
1417
- "data-[active=true]:scale-100 data-[active=true]:opacity-100",
1418
- "data-[direction=end]:bottom-3 data-[direction=start]:top-3",
1419
- "motion-reduce:transition-none",
1420
- t
1421
- ),
1399
+ className: re("msg-scroller-btn", t),
1422
1400
  ...n,
1423
- children: r ?? /* @__PURE__ */ C(le, { children: [
1424
- /* @__PURE__ */ l(
1401
+ children: r ?? /* @__PURE__ */ k(oe, { children: [
1402
+ /* @__PURE__ */ o(
1425
1403
  Lt,
1426
1404
  {
1427
1405
  size: 16,
@@ -1429,78 +1407,78 @@ function $r({
1429
1407
  className: e === "start" ? "rotate-180" : void 0
1430
1408
  }
1431
1409
  ),
1432
- /* @__PURE__ */ l("span", { className: "sr-only", children: e === "end" ? "Jump to latest" : "Jump to start" })
1410
+ /* @__PURE__ */ o("span", { className: "sr-only", children: e === "end" ? "Jump to latest" : "Jump to start" })
1433
1411
  ] })
1434
1412
  }
1435
1413
  );
1436
1414
  }
1437
- const Ur = () => /* @__PURE__ */ C("div", { className: "flex items-start gap-2.5", children: [
1438
- /* @__PURE__ */ l(
1415
+ const jr = () => /* @__PURE__ */ k("div", { className: "chat-empty-row", children: [
1416
+ /* @__PURE__ */ o(
1439
1417
  "div",
1440
1418
  {
1441
- className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground",
1419
+ className: "avatar-circle avatar-circle--mt",
1442
1420
  "aria-hidden": "true",
1443
- children: /* @__PURE__ */ l(st, { size: 15 })
1421
+ children: /* @__PURE__ */ o(lt, { size: 15 })
1444
1422
  }
1445
1423
  ),
1446
- /* @__PURE__ */ l("div", { className: "max-w-[82%] rounded-2xl rounded-tl-sm border border-border bg-[var(--bubble-assistant-bg)] px-3.5 py-2.5 text-[13.5px] leading-[1.55] text-foreground", children: /* @__PURE__ */ l("p", { children: "Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a question below the text box." }) })
1424
+ /* @__PURE__ */ o("div", { className: "chat-empty-bubble", children: /* @__PURE__ */ o("p", { children: "Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a question below the text box." }) })
1447
1425
  ] });
1448
- function _e(e) {
1449
- return e.split(/(\*\*[^*]+\*\*|`[^`]+`|https?:\/\/[^\s]+)/g).map((r, n) => r.startsWith("**") && r.endsWith("**") ? /* @__PURE__ */ l("strong", { children: r.slice(2, -2) }, n) : r.startsWith("`") && r.endsWith("`") ? /* @__PURE__ */ l(
1426
+ function ye(e) {
1427
+ return e.split(/(\*\*[^*]+\*\*|`[^`]+`|https?:\/\/[^\s]+)/g).map((r, n) => r.startsWith("**") && r.endsWith("**") ? /* @__PURE__ */ o("strong", { children: r.slice(2, -2) }, n) : r.startsWith("`") && r.endsWith("`") ? /* @__PURE__ */ o(
1450
1428
  "code",
1451
1429
  {
1452
- className: "rounded bg-[var(--input-bg)] px-1 py-0.5 font-mono text-[12px] text-foreground",
1430
+ className: "md-code",
1453
1431
  children: r.slice(1, -1)
1454
1432
  },
1455
1433
  n
1456
- ) : /^https?:\/\//.test(r) ? /* @__PURE__ */ l(
1434
+ ) : /^https?:\/\//.test(r) ? /* @__PURE__ */ o(
1457
1435
  "a",
1458
1436
  {
1459
1437
  href: r,
1460
1438
  target: "_blank",
1461
1439
  rel: "noopener noreferrer",
1462
- className: "underline underline-offset-2",
1440
+ className: "md-link",
1463
1441
  children: r
1464
1442
  },
1465
1443
  n
1466
- ) : /* @__PURE__ */ l(Xe.Fragment, { children: r }, n));
1444
+ ) : /* @__PURE__ */ o(Xe.Fragment, { children: r }, n));
1467
1445
  }
1468
1446
  function Yr({ text: e }) {
1469
1447
  if (!e) return null;
1470
1448
  const t = e.split(/\n\n+/);
1471
- return /* @__PURE__ */ l(le, { children: t.map((r, n) => {
1449
+ return /* @__PURE__ */ o(oe, { children: t.map((r, n) => {
1472
1450
  if (r.trim().startsWith("- ") || r.trim().startsWith("* ")) {
1473
- const o = r.split(/\n/).filter((s) => s.trim().startsWith("- ") || s.trim().startsWith("* "));
1474
- return /* @__PURE__ */ l("ul", { className: "my-1.5 ml-4 list-disc space-y-0.5", children: o.map((s, a) => /* @__PURE__ */ l("li", { children: _e(s.replace(/^[-*]\s+/, "")) }, a)) }, n);
1451
+ const s = r.split(/\n/).filter((l) => l.trim().startsWith("- ") || l.trim().startsWith("* "));
1452
+ return /* @__PURE__ */ o("ul", { className: "md-ul", children: s.map((l, a) => /* @__PURE__ */ o("li", { children: ye(l.replace(/^[-*]\s+/, "")) }, a)) }, n);
1475
1453
  }
1476
1454
  if (/^\d+\.\s+/.test(r.trim())) {
1477
- const o = r.split(/\n/).filter((s) => /^\d+\.\s+/.test(s.trim()));
1478
- return /* @__PURE__ */ l("ol", { className: "my-1.5 ml-4 list-decimal space-y-0.5", children: o.map((s, a) => /* @__PURE__ */ l("li", { children: _e(s.replace(/^\d+\.\s+/, "")) }, a)) }, n);
1455
+ const s = r.split(/\n/).filter((l) => /^\d+\.\s+/.test(l.trim()));
1456
+ return /* @__PURE__ */ o("ol", { className: "md-ol", children: s.map((l, a) => /* @__PURE__ */ o("li", { children: ye(l.replace(/^\d+\.\s+/, "")) }, a)) }, n);
1479
1457
  }
1480
1458
  if (r.startsWith("```")) {
1481
- const o = r.replace(/^```[a-zA-Z]*\n?/, "").replace(/```$/, "");
1482
- return /* @__PURE__ */ l(
1459
+ const s = r.replace(/^```[a-zA-Z]*\n?/, "").replace(/```$/, "");
1460
+ return /* @__PURE__ */ o(
1483
1461
  "pre",
1484
1462
  {
1485
- className: "my-2 overflow-x-auto rounded-lg bg-[var(--code-bg)] p-3 font-mono text-[12px] text-primary-foreground",
1486
- children: /* @__PURE__ */ l("code", { children: o })
1463
+ className: "md-pre",
1464
+ children: /* @__PURE__ */ o("code", { children: s })
1487
1465
  },
1488
1466
  n
1489
1467
  );
1490
1468
  }
1491
- return /* @__PURE__ */ l("p", { className: "mb-2 last:mb-0 whitespace-pre-wrap", children: _e(r) }, n);
1469
+ return /* @__PURE__ */ o("p", { className: "md-p", children: ye(r) }, n);
1492
1470
  }) });
1493
1471
  }
1494
- const Zr = ({ className: e }) => /* @__PURE__ */ C(
1472
+ const Zr = ({ className: e }) => /* @__PURE__ */ k(
1495
1473
  "div",
1496
1474
  {
1497
- className: V("flex items-center gap-1 py-0.5", e),
1475
+ className: re("typing-indicator", e),
1498
1476
  role: "status",
1499
1477
  "aria-label": "Assistant is preparing a reply",
1500
1478
  children: [
1501
- /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-[var(--text-subtle)] motion-safe:animate-pulse" }),
1502
- /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-[var(--text-subtle)] motion-safe:animate-pulse [animation-delay:150ms]" }),
1503
- /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-[var(--text-subtle)] motion-safe:animate-pulse [animation-delay:300ms]" })
1479
+ /* @__PURE__ */ o("span", { className: "typing-dot" }),
1480
+ /* @__PURE__ */ o("span", { className: "typing-dot" }),
1481
+ /* @__PURE__ */ o("span", { className: "typing-dot" })
1504
1482
  ]
1505
1483
  }
1506
1484
  );
@@ -1508,31 +1486,31 @@ function Jr(e) {
1508
1486
  return e === "create_ticket" ? "Support ticket processed" : e === "get_customer" ? "Account verified" : e === "get_ticket" ? "Ticket status loaded" : "Information retrieved";
1509
1487
  }
1510
1488
  function Kr({ sources: e }) {
1511
- const [t, r] = Y(!1);
1512
- return e.length ? /* @__PURE__ */ C("div", { className: "mt-2 border-t border-border pt-1.5", children: [
1513
- /* @__PURE__ */ C(
1489
+ const [t, r] = j(!1);
1490
+ return e.length ? /* @__PURE__ */ k("div", { className: "sources-panel", children: [
1491
+ /* @__PURE__ */ k(
1514
1492
  "button",
1515
1493
  {
1516
1494
  type: "button",
1517
- className: "inline-flex items-center gap-1.5 text-[11.5px] font-semibold text-muted-foreground hover:text-foreground",
1495
+ className: "sources-toggle-btn",
1518
1496
  onClick: () => r((n) => !n),
1519
1497
  "aria-expanded": t,
1520
1498
  children: [
1521
- /* @__PURE__ */ l(Wt, { size: 12, "aria-hidden": "true" }),
1499
+ /* @__PURE__ */ o(Wt, { size: 12, "aria-hidden": "true" }),
1522
1500
  e.length,
1523
1501
  " grounded source",
1524
1502
  e.length > 1 ? "s" : "",
1525
- t ? /* @__PURE__ */ l(Gt, { size: 12 }) : /* @__PURE__ */ l(qt, { size: 12 })
1503
+ t ? /* @__PURE__ */ o(Gt, { size: 12 }) : /* @__PURE__ */ o(qt, { size: 12 })
1526
1504
  ]
1527
1505
  }
1528
1506
  ),
1529
- t && /* @__PURE__ */ l("ul", { className: "mt-1.5 space-y-1", children: e.map((n) => /* @__PURE__ */ C(
1507
+ t && /* @__PURE__ */ o("ul", { className: "sources-list", children: e.map((n) => /* @__PURE__ */ k(
1530
1508
  "li",
1531
1509
  {
1532
- className: "flex items-center justify-between rounded-md border border-border bg-muted px-2 py-1 text-[11px] text-muted-foreground",
1510
+ className: "source-item",
1533
1511
  children: [
1534
- /* @__PURE__ */ l("span", { className: "truncate", title: n.source, children: n.source.split(/[/\\]/).pop() || n.source }),
1535
- /* @__PURE__ */ C("span", { className: "ml-2 font-semibold text-success", children: [
1512
+ /* @__PURE__ */ o("span", { className: "source-name", title: n.source, children: n.source.split(/[/\\]/).pop() || n.source }),
1513
+ /* @__PURE__ */ k("span", { className: "source-score", children: [
1536
1514
  Math.round(n.score * 100),
1537
1515
  "%"
1538
1516
  ] })
@@ -1543,10 +1521,10 @@ function Kr({ sources: e }) {
1543
1521
  ] }) : null;
1544
1522
  }
1545
1523
  function Xr({ toolCalls: e }) {
1546
- return e.length ? /* @__PURE__ */ l("div", { className: "mt-2 flex flex-wrap gap-1.5", children: e.map((t, r) => /* @__PURE__ */ l(
1524
+ return e.length ? /* @__PURE__ */ o("div", { className: "tool-badges", children: e.map((t, r) => /* @__PURE__ */ o(
1547
1525
  "span",
1548
1526
  {
1549
- className: "inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",
1527
+ className: "tool-badge",
1550
1528
  children: Jr(t.toolName)
1551
1529
  },
1552
1530
  `${t.toolName}-${r}`
@@ -1554,109 +1532,98 @@ function Xr({ toolCalls: e }) {
1554
1532
  }
1555
1533
  const Qr = ({ message: e }) => {
1556
1534
  const t = e.role === "user", r = e.status === "error";
1557
- return /* @__PURE__ */ C(
1558
- "div",
1559
- {
1560
- className: V("flex items-start gap-2.5", t && "flex-row-reverse"),
1561
- children: [
1562
- !t && /* @__PURE__ */ l(
1563
- "div",
1564
- {
1565
- className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground",
1566
- "aria-hidden": "true",
1567
- children: /* @__PURE__ */ l(st, { size: 15 })
1568
- }
1569
- ),
1570
- /* @__PURE__ */ C("div", { className: V("flex max-w-[82%] flex-col", t && "items-end"), children: [
1571
- /* @__PURE__ */ C(
1572
- "div",
1573
- {
1574
- className: V(
1575
- "rounded-2xl px-3.5 py-2.5 text-[13.5px] leading-[1.55]",
1576
- t && "rounded-tr-sm bg-[var(--bubble-user-bg)] text-[var(--bubble-user-text)] font-medium",
1577
- !t && !r && "rounded-tl-sm border border-border bg-[var(--bubble-bot-message-bg)] text-foreground",
1578
- r && "rounded-tl-sm border border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-text)]"
1579
- ),
1580
- children: [
1581
- e.status === "pending" ? /* @__PURE__ */ l(Zr, {}) : t ? /* @__PURE__ */ l("p", { className: "whitespace-pre-wrap", children: e.content }) : /* @__PURE__ */ l(Yr, { text: e.content }),
1582
- e.toolCalls ? /* @__PURE__ */ l(Xr, { toolCalls: e.toolCalls }) : null,
1583
- e.sources ? /* @__PURE__ */ l(Kr, { sources: e.sources }) : null
1584
- ]
1585
- }
1586
- ),
1587
- t && e.status !== "error" && /* @__PURE__ */ l(Ht, { size: 13, className: "mt-1 text-success", "aria-hidden": "true" })
1588
- ] })
1589
- ]
1590
- }
1591
- );
1535
+ return /* @__PURE__ */ k("div", { className: `msg-row${t ? " msg-row--user" : ""}`, children: [
1536
+ !t && /* @__PURE__ */ o(
1537
+ "div",
1538
+ {
1539
+ className: "avatar-circle avatar-circle--mt",
1540
+ "aria-hidden": "true",
1541
+ children: /* @__PURE__ */ o(lt, { size: 15 })
1542
+ }
1543
+ ),
1544
+ /* @__PURE__ */ k("div", { className: `msg-col${t ? " msg-col--user" : ""}`, children: [
1545
+ /* @__PURE__ */ k(
1546
+ "div",
1547
+ {
1548
+ className: t ? "msg-bubble msg-bubble--user" : r ? "msg-bubble msg-bubble--error" : "msg-bubble msg-bubble--bot",
1549
+ children: [
1550
+ e.status === "pending" ? /* @__PURE__ */ o(Zr, {}) : t ? /* @__PURE__ */ o("p", { className: "msg-user-pre", children: e.content }) : /* @__PURE__ */ o(Yr, { text: e.content }),
1551
+ e.toolCalls ? /* @__PURE__ */ o(Xr, { toolCalls: e.toolCalls }) : null,
1552
+ e.sources ? /* @__PURE__ */ o(Kr, { sources: e.sources }) : null
1553
+ ]
1554
+ }
1555
+ ),
1556
+ t && e.status !== "error" && /* @__PURE__ */ o(zt, { size: 13, className: "msg-tick", "aria-hidden": "true" })
1557
+ ] })
1558
+ ] });
1592
1559
  }, en = () => {
1593
- const { messages: e, status: t, showSuggestions: r } = ye();
1594
- return /* @__PURE__ */ l(
1560
+ const { messages: e, status: t, showSuggestions: r } = ve();
1561
+ return /* @__PURE__ */ o(
1595
1562
  Gr,
1596
1563
  {
1597
1564
  autoScroll: !0,
1598
1565
  defaultScrollPosition: "last-anchor",
1599
1566
  scrollPreviousItemPeek: 64,
1600
- children: /* @__PURE__ */ C(Vr, { children: [
1601
- /* @__PURE__ */ l(Wr, { "aria-label": "Chat messages", children: /* @__PURE__ */ C(jr, { "aria-busy": t === "awaiting" || t === "connecting", children: [
1602
- r && /* @__PURE__ */ l(Ye, { messageId: "welcome", children: /* @__PURE__ */ l(Ur, {}) }),
1603
- e.map((o) => /* @__PURE__ */ l(
1567
+ children: /* @__PURE__ */ k(Vr, { children: [
1568
+ /* @__PURE__ */ o(Wr, { "aria-label": "Chat messages", children: /* @__PURE__ */ k($r, { "aria-busy": t === "awaiting" || t === "connecting", children: [
1569
+ r && /* @__PURE__ */ o(Ye, { messageId: "welcome", children: /* @__PURE__ */ o(jr, {}) }),
1570
+ e.map((s) => /* @__PURE__ */ o(
1604
1571
  Ye,
1605
1572
  {
1606
- messageId: o.id,
1607
- scrollAnchor: o.role === "user",
1608
- children: /* @__PURE__ */ l(Qr, { message: o })
1573
+ messageId: s.id,
1574
+ scrollAnchor: s.role === "user",
1575
+ children: /* @__PURE__ */ o(Qr, { message: s })
1609
1576
  },
1610
- o.id
1577
+ s.id
1611
1578
  ))
1612
1579
  ] }) }),
1613
- /* @__PURE__ */ l($r, {})
1580
+ /* @__PURE__ */ o(Ur, {})
1614
1581
  ] })
1615
1582
  }
1616
1583
  );
1617
1584
  }, tn = () => {
1618
- const { pendingTicket: e, ticketBusy: t, userContext: r, confirmTicket: n, cancelTicket: o } = ye(), s = !r.customerId && !r.email, [a, i] = Y("");
1619
- return e ? /* @__PURE__ */ C(
1585
+ const { pendingTicket: e, ticketBusy: t, userContext: r, confirmTicket: n, cancelTicket: s } = ve(), l = !r.customerId && !r.email, [a, i] = j("");
1586
+ return e ? /* @__PURE__ */ k(
1620
1587
  "div",
1621
1588
  {
1622
- className: "mx-4 mb-3 rounded-xl border border-border bg-card p-4 shadow-sm",
1589
+ className: "ticket-card",
1623
1590
  role: "region",
1624
1591
  "aria-label": "Create support ticket",
1625
1592
  children: [
1626
- /* @__PURE__ */ l("h3", { className: "text-[13.5px] font-bold text-foreground", children: "Create support ticket?" }),
1627
- /* @__PURE__ */ l("p", { className: "mt-1.5 text-[12.5px] leading-5 text-muted-foreground", children: "I can open a support request for you. Nothing is created until you confirm." }),
1628
- /* @__PURE__ */ l("p", { className: "mt-2 rounded-md bg-muted px-2.5 py-2 text-[12.5px] text-foreground", children: e.description }),
1629
- s && /* @__PURE__ */ C("label", { className: "mt-3 block text-[12px] font-semibold text-foreground", children: [
1593
+ /* @__PURE__ */ o("h3", { className: "ticket-card-title", children: "Create support ticket?" }),
1594
+ /* @__PURE__ */ o("p", { className: "ticket-card-desc", children: "I can open a support request for you. Nothing is created until you confirm." }),
1595
+ /* @__PURE__ */ o("p", { className: "ticket-card-body", children: e.description }),
1596
+ l && /* @__PURE__ */ k("label", { className: "ticket-id-label", children: [
1630
1597
  "Customer ID or email",
1631
- /* @__PURE__ */ l(
1598
+ /* @__PURE__ */ o(
1632
1599
  "input",
1633
1600
  {
1634
1601
  value: a,
1635
1602
  onChange: (d) => i(d.target.value),
1636
- className: "mt-1 w-full rounded-md border border-border px-2.5 py-2 text-[13px] font-normal outline-none focus-visible:ring-2 focus-visible:ring-primary",
1603
+ className: "ticket-id-input",
1637
1604
  placeholder: "CUST-1001 or you@company.com",
1638
1605
  autoComplete: "email"
1639
1606
  }
1640
1607
  )
1641
1608
  ] }),
1642
- /* @__PURE__ */ C("div", { className: "mt-3 flex justify-end gap-2", children: [
1643
- /* @__PURE__ */ l(
1609
+ /* @__PURE__ */ k("div", { className: "ticket-actions", children: [
1610
+ /* @__PURE__ */ o(
1644
1611
  "button",
1645
1612
  {
1646
1613
  type: "button",
1647
- onClick: o,
1614
+ onClick: s,
1648
1615
  disabled: t,
1649
- className: "rounded-lg border border-border bg-card px-3.5 py-1.5 text-[12.5px] font-semibold text-muted-foreground hover:bg-muted",
1616
+ className: "ticket-cancel-btn",
1650
1617
  children: "Cancel"
1651
1618
  }
1652
1619
  ),
1653
- /* @__PURE__ */ l(
1620
+ /* @__PURE__ */ o(
1654
1621
  "button",
1655
1622
  {
1656
1623
  type: "button",
1657
1624
  onClick: () => void n(a),
1658
- disabled: t || s && !a.trim(),
1659
- className: "rounded-lg bg-action px-3.5 py-1.5 text-[12.5px] font-semibold text-action-foreground hover:bg-[var(--action-hover)] disabled:opacity-40",
1625
+ disabled: t || l && !a.trim(),
1626
+ className: "ticket-confirm-btn",
1660
1627
  children: t ? "Creating…" : "Create ticket"
1661
1628
  }
1662
1629
  )
@@ -1664,44 +1631,41 @@ const Qr = ({ message: e }) => {
1664
1631
  ]
1665
1632
  }
1666
1633
  ) : null;
1667
- }, gt = ({
1634
+ }, mt = ({
1668
1635
  className: e,
1669
1636
  onClose: t,
1670
1637
  showMinimize: r,
1671
1638
  title: n,
1672
- subtitle: o,
1673
- envStage: s,
1639
+ subtitle: s,
1640
+ envStage: l,
1674
1641
  envPulse: a = !0
1675
1642
  }) => {
1676
- const { sendMessage: i, status: d, error: p, resetConversation: m, retryLast: y, pendingTicket: f } = ye(), u = d === "awaiting" || d === "connecting" || !!f;
1677
- return /* @__PURE__ */ C(
1643
+ const { sendMessage: i, status: d, error: h, resetConversation: g, retryLast: v, pendingTicket: f } = ve(), u = d === "awaiting" || d === "connecting" || !!f;
1644
+ return /* @__PURE__ */ k(
1678
1645
  "section",
1679
1646
  {
1680
- className: V(
1681
- "flex h-full min-h-0 flex-col overflow-hidden bg-card",
1682
- e
1683
- ),
1647
+ className: `chat-panel${e ? ` ${e}` : ""}`,
1684
1648
  "aria-label": "VPS AI Assistant",
1685
1649
  children: [
1686
- /* @__PURE__ */ l(
1650
+ /* @__PURE__ */ o(
1687
1651
  er,
1688
1652
  {
1689
1653
  title: n,
1690
- subtitle: o,
1654
+ subtitle: s,
1691
1655
  onClose: t,
1692
- onReset: () => void m(),
1656
+ onReset: () => void g(),
1693
1657
  showMinimize: r,
1694
- envStage: s,
1658
+ envStage: l,
1695
1659
  envPulse: a
1696
1660
  }
1697
1661
  ),
1698
- /* @__PURE__ */ l("div", { className: "relative min-h-0 flex-1", children: /* @__PURE__ */ l(en, {}) }),
1699
- p && d === "error" && /* @__PURE__ */ l(Mt, { message: p, onRetry: () => void y() }),
1700
- /* @__PURE__ */ l(tn, {}),
1701
- /* @__PURE__ */ l(
1662
+ /* @__PURE__ */ o("div", { className: "chat-panel-body", children: /* @__PURE__ */ o(en, {}) }),
1663
+ h && d === "error" && /* @__PURE__ */ o(It, { message: h, onRetry: () => void v() }),
1664
+ /* @__PURE__ */ o(tn, {}),
1665
+ /* @__PURE__ */ o(
1702
1666
  sr,
1703
1667
  {
1704
- onSend: (g) => void i(g),
1668
+ onSend: (m) => void i(m),
1705
1669
  disabled: u
1706
1670
  }
1707
1671
  )
@@ -1713,17 +1677,13 @@ const Qr = ({ message: e }) => {
1713
1677
  onClose: t,
1714
1678
  envStage: r,
1715
1679
  envPulse: n = !0
1716
- }) => e ? /* @__PURE__ */ l(
1680
+ }) => e ? /* @__PURE__ */ o(
1717
1681
  "div",
1718
1682
  {
1719
1683
  id: "vps-chatbot-widget-panel",
1720
- className: V(
1721
- "fixed bottom-[98px] right-7 z-[999] flex h-[min(660px,calc(100vh-120px))] w-[min(420px,calc(100vw-32px))] flex-col overflow-hidden rounded-[20px] border border-border bg-card",
1722
- "shadow-[0_20px_40px_-15px_rgba(0,0,0,0.12)]",
1723
- "origin-bottom-right animate-[chat-pop_180ms_ease-out] motion-reduce:animate-none"
1724
- ),
1725
- children: /* @__PURE__ */ l(
1726
- gt,
1684
+ className: "widget-panel",
1685
+ children: /* @__PURE__ */ o(
1686
+ mt,
1727
1687
  {
1728
1688
  onClose: t,
1729
1689
  showMinimize: !0,
@@ -1736,7 +1696,7 @@ const Qr = ({ message: e }) => {
1736
1696
  ) : null, nn = ({
1737
1697
  open: e,
1738
1698
  onToggle: t
1739
- }) => /* @__PURE__ */ l(
1699
+ }) => /* @__PURE__ */ o(
1740
1700
  "button",
1741
1701
  {
1742
1702
  type: "button",
@@ -1744,112 +1704,98 @@ const Qr = ({ message: e }) => {
1744
1704
  "aria-expanded": e,
1745
1705
  "aria-controls": "vps-chatbot-widget-panel",
1746
1706
  "aria-label": e ? "Close assistant" : "Open assistant",
1747
- className: V(
1748
- "fixed bottom-7 right-7 z-[1000] flex h-[58px] w-[58px] items-center justify-center rounded-xl text-primary-foreground",
1749
- "bg-primary hover:bg-[var(--primary-hover)]",
1750
- "shadow-md",
1751
- "transition duration-200 motion-reduce:transition-none motion-reduce:hover:scale-100",
1752
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary"
1753
- ),
1754
- children: e ? /* @__PURE__ */ l(Jt, { size: 22 }) : /* @__PURE__ */ l(lt, { size: 24 })
1707
+ className: "widget-trigger-btn",
1708
+ children: e ? /* @__PURE__ */ o(Jt, { size: 22 }) : /* @__PURE__ */ o(ot, { size: 24 })
1755
1709
  }
1756
1710
  ), Ze = ({
1757
1711
  defaultOpen: e = !1,
1758
1712
  open: t,
1759
1713
  onOpenChange: r,
1760
1714
  envStage: n,
1761
- envPulse: o = !0
1715
+ envPulse: s = !0
1762
1716
  }) => {
1763
- const [s, a] = Y(e), i = t ?? s, d = (p) => {
1764
- r == null || r(p), t === void 0 && a(p);
1717
+ const [l, a] = j(e), i = t ?? l, d = (h) => {
1718
+ r == null || r(h), t === void 0 && a(h);
1765
1719
  };
1766
- return /* @__PURE__ */ C(le, { children: [
1767
- /* @__PURE__ */ l(
1720
+ return /* @__PURE__ */ k(oe, { children: [
1721
+ /* @__PURE__ */ o(
1768
1722
  rn,
1769
1723
  {
1770
1724
  open: i,
1771
1725
  onClose: () => d(!1),
1772
1726
  envStage: n,
1773
- envPulse: o
1727
+ envPulse: s
1774
1728
  }
1775
1729
  ),
1776
- /* @__PURE__ */ l(nn, { open: i, onToggle: () => d(!i) })
1730
+ /* @__PURE__ */ o(nn, { open: i, onToggle: () => d(!i) })
1777
1731
  ] });
1778
- }, hn = ({
1732
+ }, pn = ({
1779
1733
  apiBaseUrl: e,
1780
1734
  apiUrl: t,
1781
1735
  proxyUrl: r,
1782
1736
  userContext: n,
1783
- suggestions: o,
1784
- disableSuggestions: s,
1737
+ suggestions: s,
1738
+ disableSuggestions: l,
1785
1739
  initialMessage: a,
1786
1740
  ...i
1787
1741
  }) => {
1788
- const d = rt(), p = e ?? t ?? r;
1789
- return !!d && (!p || te(p) === te(d == null ? void 0 : d.apiBaseUrl)) && !n && !o && s === void 0 && !a ? /* @__PURE__ */ l(Ze, { ...i }) : /* @__PURE__ */ l(
1742
+ const d = rt(), h = e ?? t ?? r;
1743
+ return !!d && (!h || ee(h) === ee(d == null ? void 0 : d.apiBaseUrl)) && !n && !s && l === void 0 && !a ? /* @__PURE__ */ o(Ze, { ...i }) : /* @__PURE__ */ o(
1790
1744
  nt,
1791
1745
  {
1792
- apiBaseUrl: p,
1746
+ apiBaseUrl: h,
1793
1747
  userContext: n,
1794
- suggestions: o,
1795
- disableSuggestions: s,
1748
+ suggestions: s,
1749
+ disableSuggestions: l,
1796
1750
  initialMessage: a,
1797
- children: /* @__PURE__ */ l(Ze, { ...i })
1751
+ children: /* @__PURE__ */ o(Ze, { ...i })
1798
1752
  }
1799
1753
  );
1800
- }, on = ({
1754
+ }, sn = ({
1801
1755
  open: e,
1802
1756
  onClose: t,
1803
1757
  subtitle: r,
1804
1758
  title: n,
1805
- envStage: o,
1806
- envPulse: s = !0
1807
- }) => /* @__PURE__ */ C(le, { children: [
1808
- /* @__PURE__ */ l(
1759
+ envStage: s,
1760
+ envPulse: l = !0
1761
+ }) => /* @__PURE__ */ k(oe, { children: [
1762
+ /* @__PURE__ */ o(
1809
1763
  "div",
1810
1764
  {
1811
- className: V(
1812
- "fixed inset-0 z-[90] bg-[var(--overlay)] sm:hidden",
1813
- e ? "opacity-100" : "pointer-events-none opacity-0",
1814
- "transition-opacity duration-200 motion-reduce:transition-none"
1815
- ),
1765
+ className: `embedded-overlay ${e ? "embedded-overlay--open" : "embedded-overlay--closed"}`,
1816
1766
  hidden: !e,
1817
1767
  onClick: t,
1818
1768
  "aria-hidden": "true"
1819
1769
  }
1820
1770
  ),
1821
- /* @__PURE__ */ l(
1771
+ /* @__PURE__ */ o(
1822
1772
  "aside",
1823
1773
  {
1824
1774
  id: "vps-embedded-chat-panel",
1825
- className: V(
1826
- "fixed inset-y-0 right-0 z-[100] flex w-full max-w-[440px] flex-col border-l border-border bg-card shadow-xl",
1827
- "transition-transform duration-300 ease-out motion-reduce:transition-none",
1828
- e ? "translate-x-0" : "translate-x-full"
1829
- ),
1775
+ className: `embedded-panel ${e ? "embedded-panel--open" : "embedded-panel--closed"}`,
1830
1776
  "aria-hidden": !e,
1831
- children: e && /* @__PURE__ */ l(
1832
- gt,
1777
+ children: e && /* @__PURE__ */ o(
1778
+ mt,
1833
1779
  {
1834
1780
  onClose: t,
1835
1781
  title: n || "VPS AI Assistant",
1836
1782
  subtitle: r,
1837
- envStage: o,
1838
- envPulse: s
1783
+ envStage: s,
1784
+ envPulse: l
1839
1785
  }
1840
1786
  )
1841
1787
  }
1842
1788
  )
1843
- ] }), sn = 5, xe = 8, bt = "vps-embedded-assistant-top";
1844
- function ln(e, t, r) {
1789
+ ] }), ln = 5, we = 8, bt = "vps-embedded-assistant-top";
1790
+ function on(e, t, r) {
1845
1791
  return Math.min(r, Math.max(t, e));
1846
1792
  }
1847
1793
  function Je(e, t) {
1848
1794
  const r = Math.max(
1849
- xe,
1850
- window.innerHeight - t - xe
1795
+ we,
1796
+ window.innerHeight - t - we
1851
1797
  );
1852
- return ln(e, xe, r);
1798
+ return on(e, we, r);
1853
1799
  }
1854
1800
  function an() {
1855
1801
  try {
@@ -1870,69 +1816,69 @@ function cn(e) {
1870
1816
  const un = ({
1871
1817
  onOpen: e
1872
1818
  }) => {
1873
- const t = X(null), r = X({
1819
+ const t = K(null), r = K({
1874
1820
  pointerId: null,
1875
1821
  startY: 0,
1876
1822
  startTop: 0,
1877
1823
  moved: !1
1878
- }), [n, o] = Y(
1824
+ }), [n, s] = j(
1879
1825
  () => typeof window > "u" ? null : an()
1880
- ), s = X(n), a = X(!1), [i, d] = Y(!1);
1881
- ge(() => {
1882
- s.current = n;
1883
- }, [n]), ge(() => {
1826
+ ), l = K(n), a = K(!1), [i, d] = j(!1);
1827
+ me(() => {
1828
+ l.current = n;
1829
+ }, [n]), me(() => {
1884
1830
  const f = t.current;
1885
1831
  if (!f) return;
1886
1832
  const u = () => {
1887
- o((g) => {
1888
- const E = g ?? Math.round(window.innerHeight / 2 - f.offsetHeight / 2), v = Je(E, f.offsetHeight);
1889
- return s.current = v, v;
1833
+ s((m) => {
1834
+ const T = m ?? Math.round(window.innerHeight / 2 - f.offsetHeight / 2), _ = Je(T, f.offsetHeight);
1835
+ return l.current = _, _;
1890
1836
  });
1891
1837
  };
1892
1838
  return u(), window.addEventListener("resize", u), () => window.removeEventListener("resize", u);
1893
1839
  }, []);
1894
- const p = (f) => {
1840
+ const h = (f) => {
1895
1841
  if (f.button !== 0) return;
1896
- const u = f.currentTarget, g = u.getBoundingClientRect();
1842
+ const u = f.currentTarget, m = u.getBoundingClientRect();
1897
1843
  r.current = {
1898
1844
  pointerId: f.pointerId,
1899
1845
  startY: f.clientY,
1900
- startTop: g.top,
1846
+ startTop: m.top,
1901
1847
  moved: !1
1902
1848
  };
1903
1849
  try {
1904
1850
  u.setPointerCapture(f.pointerId);
1905
1851
  } catch {
1906
1852
  }
1907
- }, m = (f) => {
1853
+ }, g = (f) => {
1908
1854
  if (r.current.pointerId !== f.pointerId) return;
1909
1855
  const u = f.clientY - r.current.startY;
1910
- if (!r.current.moved && Math.abs(u) < sn) return;
1856
+ if (!r.current.moved && Math.abs(u) < ln) return;
1911
1857
  r.current.moved = !0, d(!0);
1912
- const g = Je(
1858
+ const m = Je(
1913
1859
  r.current.startTop + u,
1914
1860
  f.currentTarget.offsetHeight
1915
1861
  );
1916
- s.current = g, o(g);
1917
- }, y = (f) => {
1918
- var g, E;
1862
+ l.current = m, s(m);
1863
+ }, v = (f) => {
1864
+ var m, T;
1919
1865
  if (r.current.pointerId !== f.pointerId) return;
1920
1866
  try {
1921
- (E = (g = f.currentTarget).hasPointerCapture) != null && E.call(g, f.pointerId) && f.currentTarget.releasePointerCapture(f.pointerId);
1867
+ (T = (m = f.currentTarget).hasPointerCapture) != null && T.call(m, f.pointerId) && f.currentTarget.releasePointerCapture(f.pointerId);
1922
1868
  } catch {
1923
1869
  }
1924
1870
  const u = r.current.moved;
1925
- r.current.pointerId = null, r.current.moved = !1, d(!1), u && (a.current = !0, s.current != null && cn(s.current));
1871
+ r.current.pointerId = null, r.current.moved = !1, d(!1), u && (a.current = !0, l.current != null && cn(l.current));
1926
1872
  };
1927
- return /* @__PURE__ */ C(
1873
+ return /* @__PURE__ */ k(
1928
1874
  "button",
1929
1875
  {
1930
1876
  ref: t,
1931
1877
  type: "button",
1932
- onPointerDown: p,
1933
- onPointerMove: m,
1934
- onPointerUp: y,
1935
- onPointerCancel: y,
1878
+ onPointerDown: h,
1879
+ onPointerMove: g,
1880
+ onPointerUp: v,
1881
+ onPointerCancel: v,
1936
1882
  onClick: () => {
1937
1883
  if (a.current) {
1938
1884
  a.current = !1;
@@ -1943,13 +1889,13 @@ const un = ({
1943
1889
  "aria-expanded": !1,
1944
1890
  "aria-controls": "vps-embedded-chat-panel",
1945
1891
  "aria-label": "Assistant",
1946
- className: `fixed right-0 z-[80] flex touch-none items-center gap-2 rounded-l-lg bg-action px-3 py-2.5 text-[12.5px] font-semibold text-action-foreground shadow-lg hover:bg-[var(--action-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${i ? "cursor-grabbing" : "cursor-grab"}`,
1892
+ className: `embedded-trigger-btn ${i ? "embedded-trigger-btn--grabbing" : "embedded-trigger-btn--grab"}`,
1947
1893
  style: {
1948
1894
  top: n ?? "50%",
1949
1895
  transform: n == null ? "translateY(-50%)" : void 0
1950
1896
  },
1951
1897
  children: [
1952
- /* @__PURE__ */ l(lt, { size: 16 }),
1898
+ /* @__PURE__ */ o(ot, { size: 16 }),
1953
1899
  "Assistant"
1954
1900
  ]
1955
1901
  }
@@ -1959,47 +1905,47 @@ const un = ({
1959
1905
  open: t,
1960
1906
  onOpenChange: r,
1961
1907
  showTrigger: n = !0,
1962
- envStage: o,
1963
- envPulse: s = !0
1908
+ envStage: s,
1909
+ envPulse: l = !0
1964
1910
  }) => {
1965
- const [a, i] = Y(e), d = t ?? a, p = (m) => {
1966
- r == null || r(m), t === void 0 && i(m);
1911
+ const [a, i] = j(e), d = t ?? a, h = (g) => {
1912
+ r == null || r(g), t === void 0 && i(g);
1967
1913
  };
1968
- return /* @__PURE__ */ C(le, { children: [
1969
- n && !d && /* @__PURE__ */ l(un, { onOpen: () => p(!0) }),
1970
- /* @__PURE__ */ l(
1971
- on,
1914
+ return /* @__PURE__ */ k(oe, { children: [
1915
+ n && !d && /* @__PURE__ */ o(un, { onOpen: () => h(!0) }),
1916
+ /* @__PURE__ */ o(
1917
+ sn,
1972
1918
  {
1973
1919
  open: d,
1974
- onClose: () => p(!1),
1975
- envStage: o,
1976
- envPulse: s
1920
+ onClose: () => h(!1),
1921
+ envStage: s,
1922
+ envPulse: l
1977
1923
  }
1978
1924
  )
1979
1925
  ] });
1980
- }, mn = ({
1926
+ }, gn = ({
1981
1927
  apiBaseUrl: e,
1982
1928
  apiUrl: t,
1983
1929
  proxyUrl: r,
1984
1930
  userContext: n,
1985
- suggestions: o,
1986
- disableSuggestions: s,
1931
+ suggestions: s,
1932
+ disableSuggestions: l,
1987
1933
  initialMessage: a,
1988
1934
  ...i
1989
1935
  }) => {
1990
- const d = rt(), p = e ?? t ?? r;
1991
- return !!d && (!p || te(p) === te(d == null ? void 0 : d.apiBaseUrl)) && !n && !o && s === void 0 && !a ? /* @__PURE__ */ l(Ke, { ...i }) : /* @__PURE__ */ l(
1936
+ const d = rt(), h = e ?? t ?? r;
1937
+ return !!d && (!h || ee(h) === ee(d == null ? void 0 : d.apiBaseUrl)) && !n && !s && l === void 0 && !a ? /* @__PURE__ */ o(Ke, { ...i }) : /* @__PURE__ */ o(
1992
1938
  nt,
1993
1939
  {
1994
- apiBaseUrl: p,
1940
+ apiBaseUrl: h,
1995
1941
  userContext: n,
1996
- suggestions: o,
1997
- disableSuggestions: s,
1942
+ suggestions: s,
1943
+ disableSuggestions: l,
1998
1944
  initialMessage: a,
1999
- children: /* @__PURE__ */ l(Ke, { ...i })
1945
+ children: /* @__PURE__ */ o(Ke, { ...i })
2000
1946
  }
2001
1947
  );
2002
- }, gn = {
1948
+ }, mn = {
2003
1949
  Colors: {
2004
1950
  VPS_White: "#fff",
2005
1951
  VPS_Dark_Blue: "#1A1A31",
@@ -2164,16 +2110,16 @@ const un = ({
2164
2110
  }
2165
2111
  };
2166
2112
  export {
2167
- gt as ChatPanel,
2113
+ mt as ChatPanel,
2168
2114
  nt as ChatProvider,
2169
- hn as ChatbotWidget,
2170
- gn as ColorPalette,
2171
- mn as EmbeddedChatbot,
2115
+ pn as ChatbotWidget,
2116
+ mn as ColorPalette,
2117
+ gn as EmbeddedChatbot,
2172
2118
  We as buildApiUrl,
2173
- pn as chatApi,
2119
+ hn as chatApi,
2174
2120
  tt as createChatApi,
2175
- te as resolveApiBaseUrl,
2176
- Bt as useChatContext,
2177
- ye as useChatbot,
2121
+ ee as resolveApiBaseUrl,
2122
+ Dt as useChatContext,
2123
+ ve as useChatbot,
2178
2124
  rt as useOptionalChatContext
2179
2125
  };