vpschatbotwidget 1.1.0 → 1.2.0

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.
Files changed (31) hide show
  1. package/dist-lib/types/chatbot/api/chatbot-api.d.ts +7 -4
  2. package/dist-lib/types/chatbot/api/chatbot-api.test.d.ts +1 -0
  3. package/dist-lib/types/chatbot/api/chatbot-types.d.ts +14 -0
  4. package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +0 -1
  5. package/dist-lib/types/chatbot/core/ChatContext.d.ts +4 -1
  6. package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +2 -1
  7. package/dist-lib/types/chatbot/core/ChatProvider.d.ts +2 -0
  8. package/dist-lib/types/chatbot/core/grounding.test.d.ts +1 -0
  9. package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +1 -0
  10. package/dist-lib/types/chatbot/index.d.ts +1 -1
  11. package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +1 -0
  12. package/dist-lib/vps-chatbot.cjs +53 -24
  13. package/dist-lib/vps-chatbot.js +1181 -840
  14. package/package.json +1 -1
  15. package/src/chatbot/api/chatbot-api.test.ts +48 -0
  16. package/src/chatbot/api/chatbot-api.ts +141 -49
  17. package/src/chatbot/api/chatbot-types.ts +16 -0
  18. package/src/chatbot/chatbot.test.tsx +24 -1
  19. package/src/chatbot/core/AgentReasoning.tsx +28 -23
  20. package/src/chatbot/core/ChatContext.tsx +4 -0
  21. package/src/chatbot/core/ChatInput.tsx +14 -1
  22. package/src/chatbot/core/ChatMarkdown.tsx +12 -3
  23. package/src/chatbot/core/ChatMessage.tsx +16 -4
  24. package/src/chatbot/core/ChatProvider.tsx +84 -15
  25. package/src/chatbot/core/ChatTypingIndicator.tsx +2 -7
  26. package/src/chatbot/core/GroundedSources.tsx +4 -6
  27. package/src/chatbot/core/grounding.test.tsx +21 -0
  28. package/src/chatbot/embedded/EmbeddedChatbot.tsx +4 -1
  29. package/src/chatbot/index.ts +2 -0
  30. package/src/chatbot/widget/ChatbotWidget.tsx +4 -1
  31. package/src/index.css +38 -162
@@ -1,12 +1,12 @@
1
- import { jsx as l, jsxs as T, Fragment as ke } from "react/jsx-runtime";
2
- import * as u from "react";
3
- import Ae, { createContext as Ct, useContext as nt, useMemo as he, useState as K, useRef as se, useCallback as le, forwardRef as st, createElement as Fe, useEffect as ie } from "react";
4
- const St = {};
5
- function ce(e) {
1
+ import { jsx as l, jsxs as w, Fragment as De } from "react/jsx-runtime";
2
+ import * as d from "react";
3
+ import oe, { createContext as Et, useContext as it, useMemo as ye, useState as U, useRef as re, useCallback as ue, forwardRef as ct, createElement as He, useEffect as ke } from "react";
4
+ const Rt = {};
5
+ function ve(e) {
6
6
  return e != null && e.trim() !== "" ? e.trim().replace(/\/+$/, "") : String("").trim().replace(/\/+$/, "");
7
7
  }
8
- function Se(e, t) {
9
- const n = ce(e);
8
+ function Pe(e, t) {
9
+ const n = ve(e);
10
10
  if (!n)
11
11
  return t;
12
12
  if (n.endsWith("/api") && t.startsWith("/api/"))
@@ -18,22 +18,22 @@ function Se(e, t) {
18
18
  const r = t.startsWith("/") ? t : `/${t}`;
19
19
  return `${n}${r}`;
20
20
  }
21
- function Tt(e) {
21
+ function Xe(e) {
22
22
  return e && typeof e == "object" && "data" in e && e.success !== !1 ? e.data : e;
23
23
  }
24
- function Ft(e, t, n) {
24
+ function Ze(e, t, n) {
25
25
  var o, a, i;
26
26
  const r = e, s = (o = r == null ? void 0 : r.error) == null ? void 0 : o.message;
27
- return s && !Et(s) ? {
27
+ return s && !At(s) ? {
28
28
  code: (a = r == null ? void 0 : r.error) == null ? void 0 : a.code,
29
29
  message: s,
30
30
  requestId: (i = r == null ? void 0 : r.error) == null ? void 0 : i.request_id
31
31
  } : n >= 500 ? { message: "I couldn't process that request right now." } : n === 0 ? { message: "Something went wrong while connecting. Please try again." } : { message: t };
32
32
  }
33
- function Et(e) {
33
+ function At(e) {
34
34
  return /traceback|sql|exception|stack|api[_ ]?key|password/i.test(e);
35
35
  }
36
- function je(e) {
36
+ function xe(e) {
37
37
  return {
38
38
  chunkId: e.chunk_id,
39
39
  source: e.source,
@@ -42,14 +42,14 @@ function je(e) {
42
42
  snippet: e.snippet
43
43
  };
44
44
  }
45
- function Ye(e) {
45
+ function Le(e) {
46
46
  return {
47
47
  toolName: e.tool_name,
48
48
  arguments: e.arguments ?? {},
49
49
  result: e.result ?? {}
50
50
  };
51
51
  }
52
- function Je(e) {
52
+ function qe(e) {
53
53
  return {
54
54
  model: e.model,
55
55
  promptTokens: e.prompt_tokens,
@@ -57,7 +57,7 @@ function Je(e) {
57
57
  totalTokens: e.total_tokens
58
58
  };
59
59
  }
60
- function Rt(e) {
60
+ function Nt(e) {
61
61
  const t = e.role === "user" || e.role === "system" ? e.role : "assistant";
62
62
  return {
63
63
  id: String(e.id),
@@ -73,7 +73,7 @@ function Rt(e) {
73
73
  } : void 0
74
74
  };
75
75
  }
76
- async function At(e) {
76
+ async function Oe(e) {
77
77
  const t = await e.text();
78
78
  if (!t) return {};
79
79
  try {
@@ -82,11 +82,11 @@ async function At(e) {
82
82
  return {};
83
83
  }
84
84
  }
85
- function ot(e) {
86
- const t = ce(e);
85
+ function ut(e) {
86
+ const t = ve(e);
87
87
  async function n(r, s) {
88
88
  let o;
89
- const a = Se(t, r);
89
+ const a = Pe(t, r);
90
90
  try {
91
91
  o = await fetch(a, {
92
92
  ...s,
@@ -100,105 +100,161 @@ function ot(e) {
100
100
  }
101
101
  if (o.status === 204)
102
102
  return;
103
- const i = await At(o);
103
+ const i = await Oe(o);
104
104
  if (!o.ok)
105
- throw Ft(
105
+ throw Ze(
106
106
  i,
107
107
  "I couldn't process that request right now.",
108
108
  o.status
109
109
  );
110
- return Tt(i);
110
+ return Xe(i);
111
111
  }
112
112
  return {
113
113
  apiBaseUrl: t,
114
- async createSession() {
115
- const r = await n("/api/v1/sessions", {
114
+ async listModels() {
115
+ try {
116
+ const r = await n("/api/v1/models");
117
+ return { defaultModelId: r.default_model_id, complexModelId: r.complex_model_id, models: r.models || [] };
118
+ } catch {
119
+ return null;
120
+ }
121
+ },
122
+ async createSession(r) {
123
+ const s = await n("/api/v1/sessions", {
116
124
  method: "POST",
125
+ signal: r,
117
126
  body: JSON.stringify({})
118
127
  });
119
- return { sessionId: r.session_id, createdAt: r.created_at };
128
+ return { sessionId: s.session_id, createdAt: s.created_at };
120
129
  },
121
- async sendMessage(r, s, o) {
122
- const a = await n(
130
+ async sendMessage(r, s, o, a) {
131
+ const i = await n(
123
132
  `/api/v1/sessions/${r}/messages`,
124
133
  {
125
134
  method: "POST",
135
+ signal: a,
126
136
  body: JSON.stringify({
127
137
  message: s,
128
138
  ...(o == null ? void 0 : o.roleId) !== void 0 ? { role_id: o.roleId } : {},
129
- ...o != null && o.client ? { client: o.client } : {}
139
+ ...o != null && o.client ? { client: o.client } : {},
140
+ ...o != null && o.modelId ? { model_id: o.modelId } : {}
130
141
  })
131
142
  }
132
143
  );
133
144
  return {
134
- requestId: a.request_id,
135
- sessionId: a.session_id,
136
- answer: a.answer,
137
- sources: (a.sources || []).map(je),
138
- toolCalls: (a.tool_calls || []).map(Ye),
139
- usage: Je(a.usage)
145
+ requestId: i.request_id,
146
+ sessionId: i.session_id,
147
+ answer: i.answer,
148
+ sources: (i.sources || []).map(xe),
149
+ toolCalls: (i.tool_calls || []).map(Le),
150
+ usage: qe(i.usage),
151
+ durationMs: i.duration_ms
140
152
  };
141
153
  },
142
- async sendMessageStream(r, s, o, a) {
143
- const i = Se(t, `/api/v1/sessions/${r}/messages/stream`);
154
+ async sendMessageStream(r, s, o, a, i, u) {
155
+ var g, f;
156
+ const h = Pe(t, `/api/v1/sessions/${r}/messages/stream`);
144
157
  try {
145
- const c = await fetch(i, {
158
+ const c = await fetch(h, {
146
159
  method: "POST",
160
+ signal: u,
147
161
  headers: {
148
162
  "Content-Type": "application/json"
149
163
  },
150
164
  body: JSON.stringify({
151
165
  message: s,
152
166
  ...(o == null ? void 0 : o.roleId) !== void 0 ? { role_id: o.roleId } : {},
153
- ...o != null && o.client ? { client: o.client } : {}
167
+ ...o != null && o.client ? { client: o.client } : {},
168
+ ...o != null && o.modelId ? { model_id: o.modelId } : {}
154
169
  })
155
170
  });
156
- if (!c.ok || !c.body)
157
- return await this.sendMessage(r, s, o);
158
- const f = c.body.getReader(), g = new TextDecoder();
159
- let v = "", h = null;
160
- for (; ; ) {
161
- const { done: d, value: p } = await f.read();
162
- if (d) break;
163
- v += g.decode(p, { stream: !0 });
164
- const y = v.split(`
165
-
171
+ if (!c.ok) {
172
+ if (c.status === 404 || c.status === 405)
173
+ return await this.sendMessage(r, s, o, u);
174
+ const T = await Oe(c);
175
+ throw Ze(
176
+ T,
177
+ "I couldn't process that request right now.",
178
+ c.status
179
+ );
180
+ }
181
+ if (!c.body || (f = (g = c.headers) == null ? void 0 : g.get("content-type")) != null && f.includes("application/json")) {
182
+ const T = Xe(await Oe(c));
183
+ if (typeof T.answer != "string" || !T.usage)
184
+ throw { message: "The response stream ended unexpectedly." };
185
+ return {
186
+ requestId: T.request_id,
187
+ sessionId: T.session_id,
188
+ answer: T.answer,
189
+ sources: (T.sources || []).map(xe),
190
+ toolCalls: (T.tool_calls || []).map(Le),
191
+ usage: qe(T.usage),
192
+ durationMs: T.duration_ms
193
+ };
194
+ }
195
+ const p = c.body.getReader(), b = new TextDecoder();
196
+ let k = "";
197
+ const v = { value: null }, m = (T) => {
198
+ const x = T.split(/\r?\n/).filter((N) => N.startsWith("data:")).map((N) => N.slice(5).trimStart()).join(`
166
199
  `);
167
- v = y.pop() || "";
168
- for (const b of y) {
169
- const F = b.trim();
170
- if (F.startsWith("data:"))
171
- try {
172
- const k = JSON.parse(F.slice(5).trim());
173
- if (k.type === "progress" && k.stage)
174
- a == null || a(k.stage);
175
- else if (k.type === "complete")
176
- h = {
177
- requestId: k.request_id,
178
- sessionId: k.session_id,
179
- answer: k.answer,
180
- sources: (k.sources || []).map(je),
181
- toolCalls: (k.tool_calls || []).map(Ye),
182
- usage: Je(k.usage)
183
- };
184
- else if (k.type === "error")
185
- throw new Error(k.message || "An error occurred");
186
- } catch (k) {
187
- if (!(k instanceof Error && k.message !== "An error occurred"))
188
- throw k;
189
- }
200
+ if (!x) return;
201
+ let C = {};
202
+ try {
203
+ const N = JSON.parse(x);
204
+ if (!N || typeof N != "object") return;
205
+ C = N;
206
+ } catch {
207
+ return;
208
+ }
209
+ if (C.type === "progress" && typeof C.stage == "string")
210
+ a == null || a(C.stage);
211
+ else if (C.type === "token" && typeof C.text == "string")
212
+ i == null || i(C.text);
213
+ else if (C.type === "complete")
214
+ v.value = {
215
+ requestId: C.request_id || "",
216
+ sessionId: C.session_id || r,
217
+ answer: C.answer || "",
218
+ sources: (C.sources || []).map(xe),
219
+ toolCalls: (C.tool_calls || []).map(Le),
220
+ usage: C.usage ? qe(C.usage) : { model: "", promptTokens: 0, completionTokens: 0, totalTokens: 0 },
221
+ durationMs: C.duration_ms
222
+ };
223
+ else if (C.type === "error")
224
+ throw {
225
+ message: C.message || "I couldn't process that request right now.",
226
+ requestId: C.request_id
227
+ };
228
+ };
229
+ try {
230
+ for (; !v.value; ) {
231
+ const { done: T, value: x } = await p.read();
232
+ if (T) break;
233
+ if (k += b.decode(x, { stream: !0 }), k.length > 1e6)
234
+ throw { message: "The response stream was too large." };
235
+ const C = k.split(/\r?\n\r?\n/);
236
+ k = C.pop() || "";
237
+ for (const N of C)
238
+ if (m(N), v.value) break;
190
239
  }
240
+ k += b.decode(), !v.value && k.trim() && m(k);
241
+ } finally {
242
+ await p.cancel().catch(() => {
243
+ }), p.releaseLock();
191
244
  }
192
- return h || await this.sendMessage(r, s, o);
193
- } catch {
194
- return await this.sendMessage(r, s, o);
245
+ const B = v.value;
246
+ if (B)
247
+ return B;
248
+ throw { message: "The response stream ended before the answer was complete." };
249
+ } catch (c) {
250
+ throw !(c instanceof Error) && c && typeof c == "object" && "message" in c ? c : { message: "Something went wrong while connecting. Please try again." };
195
251
  }
196
252
  },
197
253
  async getHistory(r) {
198
254
  try {
199
255
  return ((await n(
200
256
  `/api/v1/sessions/${r}/messages`
201
- )).messages || []).map(Rt);
257
+ )).messages || []).map(Nt);
202
258
  } catch {
203
259
  return [];
204
260
  }
@@ -214,7 +270,7 @@ function ot(e) {
214
270
  },
215
271
  async checkHealth() {
216
272
  try {
217
- const r = Se(t, "/health");
273
+ const r = Pe(t, "/health");
218
274
  return (await fetch(r)).ok;
219
275
  } catch {
220
276
  return !1;
@@ -222,7 +278,7 @@ function ot(e) {
222
278
  }
223
279
  };
224
280
  }
225
- const fn = ot(), Bt = [
281
+ const Sn = ut(), It = [
226
282
  {
227
283
  label: "How do I access my reports?",
228
284
  query: "How do I access my reports in the VPS Customer Portal?"
@@ -239,15 +295,15 @@ const fn = ot(), Bt = [
239
295
  label: "How do I contact VPS Support?",
240
296
  query: "How can I contact VPS Customer Support?"
241
297
  }
242
- ], Be = Ct(null);
298
+ ], Ve = Et(null);
243
299
  function Mt() {
244
- const e = nt(Be);
300
+ const e = it(Ve);
245
301
  if (!e)
246
302
  throw new Error("useChatbot must be used inside ChatProvider.");
247
303
  return e;
248
304
  }
249
- function Me() {
250
- return nt(Be);
305
+ function Ge() {
306
+ return it(Ve);
251
307
  }
252
308
  const Dt = `Hello! I am your **VPS Veritas assistant**.
253
309
 
@@ -259,10 +315,10 @@ I can help you with:
259
315
  - **Samplogic** sample logistics, report downloads, and support tickets
260
316
 
261
317
  Feel free to ask a question or select one of the suggested topics below!`;
262
- function Ze(e) {
318
+ function et(e) {
263
319
  return `${e}-${crypto.randomUUID()}`;
264
320
  }
265
- function It(e) {
321
+ function Bt(e) {
266
322
  if (e && typeof e == "object" && "message" in e) {
267
323
  const t = String(e.message);
268
324
  if (t && !/traceback|sql|exception|stack|api[_ ]?key|password/i.test(t))
@@ -270,169 +326,219 @@ function It(e) {
270
326
  }
271
327
  return "I couldn't process that request right now.";
272
328
  }
273
- const lt = ({
329
+ const dt = ({
274
330
  children: e,
275
331
  userContext: t = {},
276
332
  role: n,
277
333
  roleId: r,
278
334
  client: s,
279
335
  welcomeMessage: o,
280
- suggestions: a = Bt,
336
+ suggestions: a = It,
281
337
  disableSuggestions: i = !1,
282
- initialMessage: c,
283
- apiBaseUrl: f,
338
+ initialMessage: u,
339
+ apiBaseUrl: h,
284
340
  apiUrl: g,
285
- proxyUrl: v,
286
- api: h,
287
- hideInspectSources: d = !1,
288
- showGroundedSources: p = !0
341
+ proxyUrl: f,
342
+ api: c,
343
+ hideInspectSources: p = !1,
344
+ showGroundedSources: b = !0,
345
+ modelId: k = "auto"
289
346
  }) => {
290
- const y = f ?? g ?? v, b = he(
291
- () => h ?? ot(y),
292
- [h, y]
293
- ), F = he(() => ({
347
+ const v = h ?? g ?? f, m = ye(
348
+ () => c ?? ut(v),
349
+ [c, v]
350
+ ), B = ye(() => ({
294
351
  ...t,
295
352
  ...n !== void 0 ? { role: n } : {},
296
353
  ...r !== void 0 ? { roleId: r } : {},
297
354
  ...s !== void 0 ? { client: s } : {}
298
- }), [t, n, r, s]), k = he(() => o === "" ? null : {
355
+ }), [t, n, r, s]), T = ye(() => o === "" ? null : {
299
356
  id: "welcome-default",
300
357
  role: "assistant",
301
358
  content: o || Dt,
302
359
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
303
360
  status: "complete"
304
- }, [o]), [D, j] = K(null), [I, N] = K(() => k ? [k] : []), [E, L] = K("idle"), [q, te] = K(null), Y = se(null), _ = se(!1), S = le(async () => {
305
- if (D) return D;
306
- L("connecting");
307
- const W = await b.createSession();
308
- return j(W.sessionId), W.sessionId;
309
- }, [D, b]), R = le(
310
- async (W) => {
311
- Y.current = W;
312
- const Q = {
313
- id: Ze("user"),
361
+ }, [o]), [x, C] = U(null), [N, I] = U(() => T ? [T] : []), [z, q] = U("idle"), [le, K] = U(null), y = re(null), A = re(!1), M = re(null), D = re(!1), [P, O] = U([]), [L, Y] = U(k);
362
+ oe.useEffect(() => Y(k), [k]), oe.useEffect(() => {
363
+ var S;
364
+ let R = !0;
365
+ return O([]), (S = m.listModels) == null || S.call(m).then((V) => {
366
+ R && O((V == null ? void 0 : V.models) || []);
367
+ }).catch(() => {
368
+ }), () => {
369
+ R = !1;
370
+ };
371
+ }, [m]);
372
+ const ee = ue((R) => {
373
+ !D.current && (R === "auto" || P.some((S) => S.id === R && S.configured)) && Y(R);
374
+ }, [P]);
375
+ oe.useEffect(() => () => {
376
+ var R;
377
+ return (R = M.current) == null ? void 0 : R.abort();
378
+ }, []);
379
+ const de = ue(async (R) => {
380
+ if (x) return x;
381
+ q("connecting");
382
+ const S = await m.createSession(R);
383
+ if (R.aborted) throw new DOMException("Aborted", "AbortError");
384
+ return C(S.sessionId), S.sessionId;
385
+ }, [x, m]), ne = ue(
386
+ async (R) => {
387
+ if (D.current) return;
388
+ D.current = !0;
389
+ const S = new AbortController();
390
+ M.current = S;
391
+ let V, fe = "";
392
+ const me = () => {
393
+ V !== void 0 && cancelAnimationFrame(V), V = void 0;
394
+ };
395
+ y.current = R;
396
+ const ie = {
397
+ id: et("user"),
314
398
  role: "user",
315
- content: W,
399
+ content: R,
316
400
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
317
401
  status: "complete"
318
- }, X = Ze("asst"), J = {
319
- id: X,
402
+ }, se = et("asst"), ge = {
403
+ id: se,
320
404
  role: "assistant",
321
405
  content: "",
322
406
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
323
407
  status: "pending",
324
- progressText: "Analyzing question & expanding domain terms "
325
- };
326
- N((A) => [...A, Q, J]), L("awaiting"), te(null);
327
- const oe = (A) => {
328
- N(
329
- ($) => $.map(
330
- (Z) => Z.id === X ? { ...Z, progressText: A } : Z
408
+ progressText: "Preparing your answer…"
409
+ }, Ee = performance.now();
410
+ I((X) => [...X, ie, ge]), q("awaiting"), K(null);
411
+ const Re = (X) => {
412
+ S.signal.aborted || I(
413
+ (j) => j.map(
414
+ (Z) => Z.id === se ? { ...Z, progressText: X } : Z
331
415
  )
332
416
  );
333
417
  };
334
418
  try {
335
- const A = await S(), $ = b.sendMessageStream ? await b.sendMessageStream(
336
- A,
337
- W,
419
+ const X = await de(S.signal), j = m.sendMessageStream ? await m.sendMessageStream(
420
+ X,
421
+ R,
338
422
  {
339
- roleId: F.roleId,
340
- client: F.client
423
+ roleId: B.roleId,
424
+ client: B.client,
425
+ modelId: L
341
426
  },
427
+ Re,
342
428
  (Z) => {
343
- oe(Z);
344
- }
345
- ) : await b.sendMessage(A, W, {
346
- roleId: F.roleId,
347
- client: F.client
348
- });
349
- N(
429
+ S.signal.aborted || (fe += Z, V === void 0 && (V = requestAnimationFrame(() => {
430
+ V = void 0, S.signal.aborted || I((Q) => Q.map((be) => be.id === se ? { ...be, content: fe } : be));
431
+ })));
432
+ },
433
+ S.signal
434
+ ) : await m.sendMessage(X, R, {
435
+ roleId: B.roleId,
436
+ client: B.client,
437
+ modelId: L
438
+ }, S.signal);
439
+ if (me(), S.signal.aborted) return;
440
+ I(
350
441
  (Z) => Z.map(
351
- (U) => U.id === X ? {
352
- ...U,
353
- id: $.requestId || X,
354
- content: $.answer,
442
+ (Q) => Q.id === se ? {
443
+ ...Q,
444
+ id: j.requestId || se,
445
+ content: j.answer,
355
446
  status: "complete",
356
447
  progressText: void 0,
357
- sources: $.sources,
358
- toolCalls: $.toolCalls,
359
- usage: $.usage
360
- } : U
448
+ sources: j.sources,
449
+ toolCalls: j.toolCalls,
450
+ usage: j.usage,
451
+ durationMs: Math.max(
452
+ Math.round(performance.now() - Ee),
453
+ j.durationMs ?? 0
454
+ )
455
+ } : Q
361
456
  )
362
- ), L("idle");
363
- } catch (A) {
364
- const $ = It(A);
365
- N(
457
+ ), q("idle");
458
+ } catch (X) {
459
+ if (me(), S.signal.aborted) return;
460
+ const j = Bt(X);
461
+ I(
366
462
  (Z) => Z.map(
367
- (U) => U.id === X ? { ...U, content: $, status: "error", progressText: void 0 } : U
463
+ (Q) => Q.id === se ? { ...Q, content: j, status: "error", progressText: void 0 } : Q
368
464
  )
369
- ), te($), L("error");
465
+ ), K(j), q("error");
466
+ } finally {
467
+ me(), M.current === S && (M.current = null, D.current = !1);
370
468
  }
371
469
  },
372
- [S, b, F.client, F.roleId]
373
- ), B = le(
374
- async (W) => {
375
- const Q = W.trim();
376
- !Q || E === "awaiting" || E === "connecting" || await R(Q);
470
+ [de, m, B.client, B.roleId, L]
471
+ ), he = ue(
472
+ async (R) => {
473
+ const S = R.trim();
474
+ !S || z === "awaiting" || z === "connecting" || await ne(S);
377
475
  },
378
- [R, E]
379
- ), M = le(async () => {
380
- const W = Y.current;
381
- W && (N((Q) => Q.filter((X) => X.status !== "error")), await R(W));
382
- }, [R]), P = le(async () => {
383
- }, []), x = le(() => {
384
- }, []), G = le(async () => {
385
- D && await b.closeSession(D), j(null), N(k ? [k] : []), L("idle"), te(null), Y.current = null;
386
- }, [D, b, k]);
387
- Ae.useEffect(() => {
388
- !c || _.current || (_.current = !0, B(c));
389
- }, [c, B]);
390
- const re = he(
476
+ [ne, z]
477
+ ), J = ue(async () => {
478
+ if (D.current) return;
479
+ const R = y.current;
480
+ R && (I((S) => S.filter((V) => V.status !== "error")), await ne(R));
481
+ }, [ne]), ae = ue(async () => {
482
+ }, []), $ = ue(() => {
483
+ }, []), pe = ue(async () => {
484
+ var R;
485
+ (R = M.current) == null || R.abort(), M.current = null, D.current = !1, C(null), I(T ? [T] : []), q("idle"), K(null), y.current = null, x && await m.closeSession(x);
486
+ }, [x, m, T]);
487
+ oe.useEffect(() => {
488
+ !u || A.current || (A.current = !0, he(u));
489
+ }, [u, he]);
490
+ const Te = ye(
391
491
  () => ({
392
- messages: I,
393
- status: E,
394
- error: q,
395
- sessionId: D,
492
+ messages: N,
493
+ status: z,
494
+ error: le,
495
+ sessionId: x,
396
496
  pendingTicket: null,
397
497
  ticketBusy: !1,
398
498
  lastTicket: null,
399
499
  suggestions: a,
400
- showSuggestions: !i && (I.length === 0 || I.length === 1 && I[0].id === "welcome-default"),
500
+ showSuggestions: !i && (N.length === 0 || N.length === 1 && N[0].id === "welcome-default"),
401
501
  suggestionBadgesEnabled: !i,
402
- userContext: F,
403
- apiBaseUrl: b.apiBaseUrl,
404
- hideInspectSources: d,
405
- showGroundedSources: p,
406
- sendMessage: B,
407
- retryLast: M,
408
- confirmTicket: P,
409
- cancelTicket: x,
410
- resetConversation: G
502
+ userContext: B,
503
+ apiBaseUrl: m.apiBaseUrl,
504
+ hideInspectSources: p,
505
+ showGroundedSources: b,
506
+ sendMessage: he,
507
+ retryLast: J,
508
+ confirmTicket: ae,
509
+ cancelTicket: $,
510
+ resetConversation: pe,
511
+ models: P,
512
+ selectedModelId: L,
513
+ selectModel: ee
411
514
  }),
412
515
  [
413
- I,
414
- E,
415
- q,
416
- D,
516
+ N,
517
+ z,
518
+ le,
519
+ x,
417
520
  a,
418
521
  i,
419
- F,
420
- b.apiBaseUrl,
421
- d,
422
- p,
423
522
  B,
424
- M,
523
+ m.apiBaseUrl,
524
+ p,
525
+ b,
526
+ he,
527
+ J,
528
+ ae,
529
+ $,
530
+ pe,
425
531
  P,
426
- x,
427
- G
532
+ L,
533
+ ee
428
534
  ]
429
535
  );
430
- return /* @__PURE__ */ l(Be.Provider, { value: re, children: e });
536
+ return /* @__PURE__ */ l(Ve.Provider, { value: Te, children: e });
431
537
  };
432
- function Ce() {
538
+ function Be() {
433
539
  return Mt();
434
540
  }
435
- const Nt = ({ message: e, onRetry: t }) => /* @__PURE__ */ T(
541
+ const Pt = ({ message: e, onRetry: t }) => /* @__PURE__ */ w(
436
542
  "div",
437
543
  {
438
544
  className: "chat-error-banner",
@@ -457,14 +563,14 @@ const Nt = ({ message: e, onRetry: t }) => /* @__PURE__ */ T(
457
563
  * This source code is licensed under the ISC license.
458
564
  * See the LICENSE file in the root directory of this source tree.
459
565
  */
460
- const Pt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), at = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim();
566
+ const xt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ht = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim();
461
567
  /**
462
568
  * @license lucide-react v0.468.0 - ISC
463
569
  *
464
570
  * This source code is licensed under the ISC license.
465
571
  * See the LICENSE file in the root directory of this source tree.
466
572
  */
467
- var xt = {
573
+ var Lt = {
468
574
  xmlns: "http://www.w3.org/2000/svg",
469
575
  width: 24,
470
576
  height: 24,
@@ -481,7 +587,7 @@ var xt = {
481
587
  * This source code is licensed under the ISC license.
482
588
  * See the LICENSE file in the root directory of this source tree.
483
589
  */
484
- const Lt = st(
590
+ const qt = ct(
485
591
  ({
486
592
  color: e = "currentColor",
487
593
  size: t = 24,
@@ -491,20 +597,20 @@ const Lt = st(
491
597
  children: o,
492
598
  iconNode: a,
493
599
  ...i
494
- }, c) => Fe(
600
+ }, u) => He(
495
601
  "svg",
496
602
  {
497
- ref: c,
498
- ...xt,
603
+ ref: u,
604
+ ...Lt,
499
605
  width: t,
500
606
  height: t,
501
607
  stroke: e,
502
608
  strokeWidth: r ? Number(n) * 24 / Number(t) : n,
503
- className: at("lucide", s),
609
+ className: ht("lucide", s),
504
610
  ...i
505
611
  },
506
612
  [
507
- ...a.map(([f, g]) => Fe(f, g)),
613
+ ...a.map(([h, g]) => He(h, g)),
508
614
  ...Array.isArray(o) ? o : [o]
509
615
  ]
510
616
  )
@@ -515,12 +621,12 @@ const Lt = st(
515
621
  * This source code is licensed under the ISC license.
516
622
  * See the LICENSE file in the root directory of this source tree.
517
623
  */
518
- const z = (e, t) => {
519
- const n = st(
520
- ({ className: r, ...s }, o) => Fe(Lt, {
624
+ const H = (e, t) => {
625
+ const n = ct(
626
+ ({ className: r, ...s }, o) => He(qt, {
521
627
  ref: o,
522
628
  iconNode: t,
523
- className: at(`lucide-${Pt(e)}`, r),
629
+ className: ht(`lucide-${xt(e)}`, r),
524
630
  ...s
525
631
  })
526
632
  );
@@ -532,7 +638,7 @@ const z = (e, t) => {
532
638
  * This source code is licensed under the ISC license.
533
639
  * See the LICENSE file in the root directory of this source tree.
534
640
  */
535
- const Ot = z("ArrowDown", [
641
+ const Ot = H("ArrowDown", [
536
642
  ["path", { d: "M12 5v14", key: "s699le" }],
537
643
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
538
644
  ]);
@@ -542,7 +648,7 @@ const Ot = z("ArrowDown", [
542
648
  * This source code is licensed under the ISC license.
543
649
  * See the LICENSE file in the root directory of this source tree.
544
650
  */
545
- const qt = z("ArrowLeft", [
651
+ const $t = H("ArrowLeft", [
546
652
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
547
653
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
548
654
  ]);
@@ -552,7 +658,7 @@ const qt = z("ArrowLeft", [
552
658
  * This source code is licensed under the ISC license.
553
659
  * See the LICENSE file in the root directory of this source tree.
554
660
  */
555
- const Wt = z("ArrowUp", [
661
+ const Ht = H("ArrowUp", [
556
662
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
557
663
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
558
664
  ]);
@@ -562,7 +668,23 @@ const Wt = z("ArrowUp", [
562
668
  * This source code is licensed under the ISC license.
563
669
  * See the LICENSE file in the root directory of this source tree.
564
670
  */
565
- const it = z("BotMessageSquare", [
671
+ const zt = H("BookOpen", [
672
+ ["path", { d: "M12 7v14", key: "1akyts" }],
673
+ [
674
+ "path",
675
+ {
676
+ d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
677
+ key: "ruj8y"
678
+ }
679
+ ]
680
+ ]);
681
+ /**
682
+ * @license lucide-react v0.468.0 - ISC
683
+ *
684
+ * This source code is licensed under the ISC license.
685
+ * See the LICENSE file in the root directory of this source tree.
686
+ */
687
+ const pt = H("BotMessageSquare", [
566
688
  ["path", { d: "M12 6V2H8", key: "1155em" }],
567
689
  ["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" }],
568
690
  ["path", { d: "M2 12h2", key: "1t8f8n" }],
@@ -576,28 +698,15 @@ const it = z("BotMessageSquare", [
576
698
  * This source code is licensed under the ISC license.
577
699
  * See the LICENSE file in the root directory of this source tree.
578
700
  */
579
- const $t = z("Brain", [
580
- [
581
- "path",
582
- {
583
- d: "M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",
584
- key: "l5xja"
585
- }
586
- ],
587
- [
588
- "path",
589
- {
590
- d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",
591
- key: "ep3f8r"
592
- }
593
- ],
594
- ["path", { d: "M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4", key: "1p4c4q" }],
595
- ["path", { d: "M17.599 6.5a3 3 0 0 0 .399-1.375", key: "tmeiqw" }],
596
- ["path", { d: "M6.003 5.125A3 3 0 0 0 6.401 6.5", key: "105sqy" }],
597
- ["path", { d: "M3.477 10.896a4 4 0 0 1 .585-.396", key: "ql3yin" }],
598
- ["path", { d: "M19.938 10.5a4 4 0 0 1 .585.396", key: "1qfode" }],
599
- ["path", { d: "M6 18a4 4 0 0 1-1.967-.516", key: "2e4loj" }],
600
- ["path", { d: "M19.967 17.484A4 4 0 0 1 18 18", key: "159ez6" }]
701
+ const Wt = H("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
702
+ /**
703
+ * @license lucide-react v0.468.0 - ISC
704
+ *
705
+ * This source code is licensed under the ISC license.
706
+ * See the LICENSE file in the root directory of this source tree.
707
+ */
708
+ const Vt = H("ChevronDown", [
709
+ ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
601
710
  ]);
602
711
  /**
603
712
  * @license lucide-react v0.468.0 - ISC
@@ -605,14 +714,24 @@ const $t = z("Brain", [
605
714
  * This source code is licensed under the ISC license.
606
715
  * See the LICENSE file in the root directory of this source tree.
607
716
  */
608
- const Ht = z("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
717
+ const Gt = H("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
718
+ /**
719
+ * @license lucide-react v0.468.0 - ISC
720
+ *
721
+ * This source code is licensed under the ISC license.
722
+ * See the LICENSE file in the root directory of this source tree.
723
+ */
724
+ const Ut = H("CircleCheck", [
725
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
726
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
727
+ ]);
609
728
  /**
610
729
  * @license lucide-react v0.468.0 - ISC
611
730
  *
612
731
  * This source code is licensed under the ISC license.
613
732
  * See the LICENSE file in the root directory of this source tree.
614
733
  */
615
- const Vt = z("ClipboardCheck", [
734
+ const jt = H("ClipboardCheck", [
616
735
  ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
617
736
  [
618
737
  "path",
@@ -629,7 +748,18 @@ const Vt = z("ClipboardCheck", [
629
748
  * This source code is licensed under the ISC license.
630
749
  * See the LICENSE file in the root directory of this source tree.
631
750
  */
632
- const zt = z("FlaskConical", [
751
+ const Yt = H("ExternalLink", [
752
+ ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
753
+ ["path", { d: "M10 14 21 3", key: "gplh6r" }],
754
+ ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
755
+ ]);
756
+ /**
757
+ * @license lucide-react v0.468.0 - ISC
758
+ *
759
+ * This source code is licensed under the ISC license.
760
+ * See the LICENSE file in the root directory of this source tree.
761
+ */
762
+ const Jt = H("FlaskConical", [
633
763
  [
634
764
  "path",
635
765
  {
@@ -646,7 +776,16 @@ const zt = z("FlaskConical", [
646
776
  * This source code is licensed under the ISC license.
647
777
  * See the LICENSE file in the root directory of this source tree.
648
778
  */
649
- const ct = z("MessageSquare", [
779
+ const Kt = H("LoaderCircle", [
780
+ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
781
+ ]);
782
+ /**
783
+ * @license lucide-react v0.468.0 - ISC
784
+ *
785
+ * This source code is licensed under the ISC license.
786
+ * See the LICENSE file in the root directory of this source tree.
787
+ */
788
+ const ft = H("MessageSquare", [
650
789
  ["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" }]
651
790
  ]);
652
791
  /**
@@ -655,7 +794,7 @@ const ct = z("MessageSquare", [
655
794
  * This source code is licensed under the ISC license.
656
795
  * See the LICENSE file in the root directory of this source tree.
657
796
  */
658
- const Gt = z("Microscope", [
797
+ const Qt = H("Microscope", [
659
798
  ["path", { d: "M6 18h8", key: "1borvv" }],
660
799
  ["path", { d: "M3 22h18", key: "8prr45" }],
661
800
  ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
@@ -669,14 +808,14 @@ const Gt = z("Microscope", [
669
808
  * This source code is licensed under the ISC license.
670
809
  * See the LICENSE file in the root directory of this source tree.
671
810
  */
672
- const Ut = z("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
811
+ const Xt = H("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
673
812
  /**
674
813
  * @license lucide-react v0.468.0 - ISC
675
814
  *
676
815
  * This source code is licensed under the ISC license.
677
816
  * See the LICENSE file in the root directory of this source tree.
678
817
  */
679
- const jt = z("RefreshCw", [
818
+ const Zt = H("RefreshCw", [
680
819
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
681
820
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
682
821
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
@@ -688,7 +827,23 @@ const jt = z("RefreshCw", [
688
827
  * This source code is licensed under the ISC license.
689
828
  * See the LICENSE file in the root directory of this source tree.
690
829
  */
691
- const Yt = z("TestTubeDiagonal", [
830
+ const er = H("ShieldCheck", [
831
+ [
832
+ "path",
833
+ {
834
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
835
+ key: "oel41y"
836
+ }
837
+ ],
838
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
839
+ ]);
840
+ /**
841
+ * @license lucide-react v0.468.0 - ISC
842
+ *
843
+ * This source code is licensed under the ISC license.
844
+ * See the LICENSE file in the root directory of this source tree.
845
+ */
846
+ const tr = H("TestTubeDiagonal", [
692
847
  [
693
848
  "path",
694
849
  { 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" }
@@ -702,42 +857,42 @@ const Yt = z("TestTubeDiagonal", [
702
857
  * This source code is licensed under the ISC license.
703
858
  * See the LICENSE file in the root directory of this source tree.
704
859
  */
705
- const Jt = z("X", [
860
+ const rr = H("X", [
706
861
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
707
862
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
708
- ]), Zt = {
863
+ ]), nr = {
709
864
  alpha: {
710
865
  label: "Alpha",
711
- Icon: zt,
866
+ Icon: Jt,
712
867
  variant: "env-badge--alpha",
713
868
  tooltip: "Alpha build — internal testing only"
714
869
  },
715
870
  beta: {
716
871
  label: "Beta",
717
- Icon: Yt,
872
+ Icon: tr,
718
873
  variant: "env-badge--beta",
719
874
  tooltip: "Beta build — public pre-release"
720
875
  },
721
876
  gamma: {
722
877
  label: "Gamma",
723
- Icon: Gt,
878
+ Icon: Qt,
724
879
  variant: "env-badge--gamma",
725
880
  tooltip: "Gamma / Release Candidate"
726
881
  },
727
882
  qa: {
728
883
  label: "QA",
729
- Icon: Vt,
884
+ Icon: jt,
730
885
  variant: "env-badge--qa",
731
886
  tooltip: "Quality Assurance build"
732
887
  }
733
- }, Kt = ({
888
+ }, sr = ({
734
889
  stage: e,
735
890
  pulse: t = !0,
736
891
  className: n = ""
737
892
  }) => {
738
893
  if (!e) return null;
739
- const { label: r, Icon: s, variant: o, tooltip: a } = Zt[e];
740
- return /* @__PURE__ */ T(
894
+ const { label: r, Icon: s, variant: o, tooltip: a } = nr[e];
895
+ return /* @__PURE__ */ w(
741
896
  "span",
742
897
  {
743
898
  className: `env-badge-inline ${o} ${n}`.trim(),
@@ -750,7 +905,7 @@ const Jt = z("X", [
750
905
  ]
751
906
  }
752
907
  );
753
- }, Qt = (e) => /* @__PURE__ */ l(
908
+ }, or = (e) => /* @__PURE__ */ l(
754
909
  "svg",
755
910
  {
756
911
  width: e.width || "24px",
@@ -762,7 +917,7 @@ const Jt = z("X", [
762
917
  ...e,
763
918
  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" })
764
919
  }
765
- ), Xt = ({
920
+ ), lr = ({
766
921
  title: e = "VPS AI Assistant",
767
922
  subtitle: t = "Customer portal support",
768
923
  onClose: n,
@@ -771,8 +926,8 @@ const Jt = z("X", [
771
926
  showMinimize: o = !1,
772
927
  envStage: a,
773
928
  envPulse: i = !0
774
- }) => /* @__PURE__ */ T("header", { className: "chat-header", children: [
775
- /* @__PURE__ */ T("div", { className: "chat-header-left", children: [
929
+ }) => /* @__PURE__ */ w("header", { className: "chat-header", children: [
930
+ /* @__PURE__ */ w("div", { className: "chat-header-left", children: [
776
931
  s && /* @__PURE__ */ l(
777
932
  "button",
778
933
  {
@@ -780,7 +935,7 @@ const Jt = z("X", [
780
935
  onClick: s,
781
936
  className: "icon-btn-back",
782
937
  "aria-label": "Back",
783
- children: /* @__PURE__ */ l(qt, { size: 16 })
938
+ children: /* @__PURE__ */ l($t, { size: 16 })
784
939
  }
785
940
  ),
786
941
  /* @__PURE__ */ l(
@@ -788,18 +943,18 @@ const Jt = z("X", [
788
943
  {
789
944
  className: "avatar-circle",
790
945
  "aria-hidden": "true",
791
- children: /* @__PURE__ */ l(Qt, { width: "16px", height: "16px", color: "white" })
946
+ children: /* @__PURE__ */ l(or, { width: "16px", height: "16px", color: "white" })
792
947
  }
793
948
  ),
794
- /* @__PURE__ */ T("div", { children: [
795
- /* @__PURE__ */ T("div", { className: "chat-header-title-row", children: [
949
+ /* @__PURE__ */ w("div", { children: [
950
+ /* @__PURE__ */ w("div", { className: "chat-header-title-row", children: [
796
951
  /* @__PURE__ */ l("h2", { className: "chat-header-title", children: e }),
797
- /* @__PURE__ */ l(Kt, { stage: a, pulse: i })
952
+ /* @__PURE__ */ l(sr, { stage: a, pulse: i })
798
953
  ] }),
799
954
  /* @__PURE__ */ l("p", { className: "chat-header-subtitle", children: t || "Customer portal support" })
800
955
  ] })
801
956
  ] }),
802
- /* @__PURE__ */ T("div", { className: "chat-header-actions", children: [
957
+ /* @__PURE__ */ w("div", { className: "chat-header-actions", children: [
803
958
  r && /* @__PURE__ */ l(
804
959
  "button",
805
960
  {
@@ -808,7 +963,7 @@ const Jt = z("X", [
808
963
  className: "icon-btn-action",
809
964
  "aria-label": "Start a new conversation",
810
965
  title: "New conversation",
811
- children: /* @__PURE__ */ l(jt, { size: 15 })
966
+ children: /* @__PURE__ */ l(Zt, { size: 15 })
812
967
  }
813
968
  ),
814
969
  n && /* @__PURE__ */ l(
@@ -818,25 +973,25 @@ const Jt = z("X", [
818
973
  onClick: n,
819
974
  className: "icon-btn-action",
820
975
  "aria-label": o ? "Minimize chat" : "Close chat",
821
- children: /* @__PURE__ */ l(Ut, { size: 16 })
976
+ children: /* @__PURE__ */ l(Xt, { size: 16 })
822
977
  }
823
978
  )
824
979
  ] })
825
980
  ] });
826
- function er(e, t) {
827
- const n = se(e);
828
- ie(() => {
981
+ function ar(e, t) {
982
+ const n = re(e);
983
+ ke(() => {
829
984
  var r;
830
985
  n.current && !e && ((r = t.current) == null || r.focus()), n.current = e;
831
986
  }, [e, t]);
832
987
  }
833
- function tr(e, t) {
988
+ function ir(e, t) {
834
989
  const n = t.trim().toLowerCase();
835
990
  return n ? e.filter(
836
991
  (r) => r.label.toLowerCase().includes(n) || r.query.toLowerCase().includes(n)
837
992
  ) : e;
838
993
  }
839
- const rr = ({
994
+ const cr = ({
840
995
  suggestions: e,
841
996
  onSelect: t,
842
997
  disabled: n,
@@ -868,55 +1023,55 @@ const rr = ({
868
1023
  children: s.label
869
1024
  },
870
1025
  s.query
871
- )) }) : null, nr = ({
1026
+ )) }) : null, ur = ({
872
1027
  onSend: e,
873
1028
  disabled: t = !1,
874
1029
  placeholder: n = "Ask something…"
875
1030
  }) => {
876
- const { suggestions: r, showSuggestions: s, suggestionBadgesEnabled: o } = Ce(), [a, i] = K(""), c = se(null), f = (d) => {
877
- d && (d.style.height = "auto", d.style.height = `${Math.min(d.scrollHeight, 96)}px`);
1031
+ const { suggestions: r, showSuggestions: s, suggestionBadgesEnabled: o, models: a, selectedModelId: i, selectModel: u } = Be(), [h, g] = U(""), f = re(null), c = oe.useId(), p = (m) => {
1032
+ m && (m.style.height = "auto", m.style.height = `${Math.min(m.scrollHeight, 96)}px`);
878
1033
  };
879
- er(t, c), ie(() => {
880
- f(c.current);
881
- }, [a]);
882
- const g = he(() => {
1034
+ ar(t, f), ke(() => {
1035
+ p(f.current);
1036
+ }, [h]);
1037
+ const b = ye(() => {
883
1038
  if (!o || t) return [];
884
- const d = a.trim();
885
- return d ? tr(r, d) : s ? r : [];
886
- }, [t, s, o, r, a]), v = (d) => {
887
- i(d.query);
888
- const p = c.current;
889
- p == null || p.focus();
890
- }, h = () => {
891
- const d = a.trim();
892
- !d || t || (e(d), i(""), c.current && (c.current.style.height = "auto"));
1039
+ const m = h.trim();
1040
+ return m ? ir(r, m) : s ? r : [];
1041
+ }, [t, s, o, r, h]), k = (m) => {
1042
+ g(m.query);
1043
+ const B = f.current;
1044
+ B == null || B.focus();
1045
+ }, v = () => {
1046
+ const m = h.trim();
1047
+ !m || t || (e(m), g(""), f.current && (f.current.style.height = "auto"));
893
1048
  };
894
- return /* @__PURE__ */ T("div", { className: "chat-input-wrapper", children: [
1049
+ return /* @__PURE__ */ w("div", { className: "chat-input-wrapper", children: [
895
1050
  /* @__PURE__ */ l(
896
- rr,
1051
+ cr,
897
1052
  {
898
1053
  variant: "badge",
899
- suggestions: g,
900
- onSelect: v,
1054
+ suggestions: b,
1055
+ onSelect: k,
901
1056
  disabled: t
902
1057
  }
903
1058
  ),
904
1059
  /* @__PURE__ */ l("label", { htmlFor: "vps-chat-input", className: "sr-only", children: "Chat message" }),
905
- /* @__PURE__ */ T("div", { className: "chat-input-row", children: [
1060
+ /* @__PURE__ */ w("div", { className: "chat-input-row", children: [
906
1061
  /* @__PURE__ */ l(
907
1062
  "textarea",
908
1063
  {
909
1064
  id: "vps-chat-input",
910
- ref: c,
1065
+ ref: f,
911
1066
  rows: 1,
912
- value: a,
1067
+ value: h,
913
1068
  disabled: t,
914
1069
  placeholder: n,
915
- onChange: (d) => {
916
- i(d.target.value), f(d.target);
1070
+ onChange: (m) => {
1071
+ g(m.target.value), p(m.target);
917
1072
  },
918
- onKeyDown: (d) => {
919
- d.key === "Enter" && !d.shiftKey && (d.preventDefault(), h());
1073
+ onKeyDown: (m) => {
1074
+ m.key === "Enter" && !m.shiftKey && (m.preventDefault(), v());
920
1075
  },
921
1076
  className: "chat-textarea"
922
1077
  }
@@ -925,29 +1080,46 @@ const rr = ({
925
1080
  "button",
926
1081
  {
927
1082
  type: "button",
928
- onClick: h,
929
- disabled: t || !a.trim(),
1083
+ onClick: v,
1084
+ disabled: t || !h.trim(),
930
1085
  "aria-label": "Send message",
931
1086
  className: "chat-send-btn",
932
- children: /* @__PURE__ */ l(Wt, { size: 16 })
1087
+ children: /* @__PURE__ */ l(Ht, { size: 16 })
933
1088
  }
934
1089
  )
935
1090
  ] }),
936
- /* @__PURE__ */ T("p", { className: "chat-input-footer", children: [
1091
+ a.length > 1 && /* @__PURE__ */ w("div", { className: "chat-model-picker", children: [
1092
+ /* @__PURE__ */ l("label", { htmlFor: c, children: "AI model" }),
1093
+ /* @__PURE__ */ w(
1094
+ "select",
1095
+ {
1096
+ id: c,
1097
+ "aria-label": "AI model",
1098
+ value: i,
1099
+ disabled: t,
1100
+ onChange: (m) => u(m.target.value),
1101
+ children: [
1102
+ /* @__PURE__ */ l("option", { value: "auto", children: "Automatic" }),
1103
+ a.map((m) => /* @__PURE__ */ l("option", { value: m.id, disabled: !m.configured, children: m.label }, m.id))
1104
+ ]
1105
+ }
1106
+ )
1107
+ ] }),
1108
+ /* @__PURE__ */ w("p", { className: "chat-input-footer", children: [
937
1109
  "Powered by ",
938
1110
  /* @__PURE__ */ l("span", { className: "chat-input-footer-brand", children: "VPS Veritas AI" })
939
1111
  ] })
940
1112
  ] });
941
1113
  };
942
- function sr({ defaultTagName: e, props: t, render: n, state: r = {}, stateAttributesMapping: s }) {
943
- let o = Ee(or(r, s), t);
944
- if (!n) return u.createElement(e, o);
1114
+ function dr({ defaultTagName: e, props: t, render: n, state: r = {}, stateAttributesMapping: s }) {
1115
+ let o = ze(hr(r, s), t);
1116
+ if (!n) return d.createElement(e, o);
945
1117
  if (typeof n == "function") return n(o, r);
946
- if (!u.isValidElement(n)) return null;
947
- let a = n.props, i = { ...Ee(o, a), ref: pe(o.ref, a.ref) };
948
- return u.cloneElement(n, i);
1118
+ if (!d.isValidElement(n)) return null;
1119
+ let a = n.props, i = { ...ze(o, a), ref: Se(o.ref, a.ref) };
1120
+ return d.cloneElement(n, i);
949
1121
  }
950
- function Ee(...e) {
1122
+ function ze(...e) {
951
1123
  let t = {};
952
1124
  for (let n of e) {
953
1125
  if (!n) continue;
@@ -956,12 +1128,12 @@ function Ee(...e) {
956
1128
  let o = r[s];
957
1129
  if (o === void 0) continue;
958
1130
  let a = t[s];
959
- s === "className" ? t[s] = [a, o].filter(Boolean).join(" ") : s === "style" ? t[s] = { ...a, ...o } : s === "ref" ? t[s] = pe(a, o) : ar(s) && typeof a == "function" && typeof o == "function" ? t[s] = lr(o, a) : t[s] = o;
1131
+ s === "className" ? t[s] = [a, o].filter(Boolean).join(" ") : s === "style" ? t[s] = { ...a, ...o } : s === "ref" ? t[s] = Se(a, o) : fr(s) && typeof a == "function" && typeof o == "function" ? t[s] = pr(o, a) : t[s] = o;
960
1132
  }
961
1133
  }
962
1134
  return t;
963
1135
  }
964
- function or(e, t) {
1136
+ function hr(e, t) {
965
1137
  var r;
966
1138
  let n = {};
967
1139
  for (let s of Object.keys(e)) {
@@ -974,132 +1146,132 @@ function or(e, t) {
974
1146
  n["data-slot"] = o;
975
1147
  continue;
976
1148
  }
977
- let i = `data-${String(s).replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`;
1149
+ let i = `data-${String(s).replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`)}`;
978
1150
  typeof o == "boolean" ? n[i] = o ? "" : void 0 : o != null && (n[i] = String(o));
979
1151
  }
980
1152
  return n;
981
1153
  }
982
- function lr(e, t) {
1154
+ function pr(e, t) {
983
1155
  return function(n) {
984
1156
  e(n), n.defaultPrevented || t(n);
985
1157
  };
986
1158
  }
987
- function ar(e) {
1159
+ function fr(e) {
988
1160
  return /^on[A-Z]/.test(e);
989
1161
  }
990
- function pe(...e) {
1162
+ function Se(...e) {
991
1163
  let t = e.filter(Boolean);
992
1164
  if (t.length !== 0) return (n) => {
993
1165
  for (let r of t) typeof r == "function" ? r(n) : r && (r.current = n);
994
1166
  };
995
1167
  }
996
- var ir = 8, cr = 64, ur = 0, we = 0.5, dr = 180, hr = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", " "]), ut = { start: !1, end: !1 }, fr = [], ye = { currentAnchorId: null, visibleMessageIds: fr };
997
- function pr({ content: e, scrollEdgeThreshold: t, spacer: n, viewport: r }) {
998
- if (!r || !e) return ut;
999
- let s = De({ content: e, spacer: n, viewport: r });
1168
+ var mr = 8, gr = 64, br = 0, Ie = 0.5, vr = 180, _r = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", " "]), mt = { start: !1, end: !1 }, wr = [], Me = { currentAnchorId: null, visibleMessageIds: wr };
1169
+ function yr({ content: e, scrollEdgeThreshold: t, spacer: n, viewport: r }) {
1170
+ if (!r || !e) return mt;
1171
+ let s = Ue({ content: e, spacer: n, viewport: r });
1000
1172
  return { start: r.scrollTop > t, end: s - r.scrollTop - r.clientHeight > t };
1001
1173
  }
1002
- function gr({ content: e, scrollMargin: t, scrollPreviousItemPeek: n, spacer: r, viewport: s, visibleMessageIds: o }) {
1003
- if (!e || !s) return ye;
1004
- let a = s.getBoundingClientRect(), i = a.top + t + n, c = typeof IntersectionObserver > "u", f = [], g = null;
1005
- for (let v of fe(e, r)) {
1006
- let h = v.dataset.messageId;
1007
- if (!h) continue;
1008
- let d = v.dataset.scrollAnchor === "true", p = d || c ? v.getBoundingClientRect() : null;
1009
- (c && p ? p.bottom > i && p.top < a.bottom : o.has(h)) && f.push(h), d && p && p.top <= i + we && (g = h);
1174
+ function kr({ content: e, scrollMargin: t, scrollPreviousItemPeek: n, spacer: r, viewport: s, visibleMessageIds: o }) {
1175
+ if (!e || !s) return Me;
1176
+ let a = s.getBoundingClientRect(), i = a.top + t + n, u = typeof IntersectionObserver > "u", h = [], g = null;
1177
+ for (let f of Ce(e, r)) {
1178
+ let c = f.dataset.messageId;
1179
+ if (!c) continue;
1180
+ let p = f.dataset.scrollAnchor === "true", b = p || u ? f.getBoundingClientRect() : null;
1181
+ (u && b ? b.bottom > i && b.top < a.bottom : o.has(c)) && h.push(c), p && b && b.top <= i + Ie && (g = c);
1010
1182
  }
1011
- return f.length === 0 && g === null ? ye : { currentAnchorId: g, visibleMessageIds: f };
1183
+ return h.length === 0 && g === null ? Me : { currentAnchorId: g, visibleMessageIds: h };
1012
1184
  }
1013
- function fe(e, t) {
1185
+ function Ce(e, t) {
1014
1186
  return Array.from(e.children).filter((n) => n instanceof HTMLElement && n !== t);
1015
1187
  }
1016
- function mr(e, t) {
1188
+ function Cr(e, t) {
1017
1189
  for (let n = t; n < e.length; n++) {
1018
1190
  let r = e[n];
1019
1191
  if ((r == null ? void 0 : r.dataset.scrollAnchor) === "true") return r;
1020
1192
  }
1021
1193
  return null;
1022
1194
  }
1023
- function br(e, t) {
1195
+ function Sr(e, t) {
1024
1196
  for (let n of e) if (n.dataset.scrollAnchor === "true" && !t.has(n)) return n;
1025
1197
  return null;
1026
1198
  }
1027
- function vr(e, t) {
1199
+ function Fr(e, t) {
1028
1200
  var r;
1029
1201
  let n = 0;
1030
1202
  for (let s = t; s < e.length; s++) if (((r = e[s]) == null ? void 0 : r.dataset.scrollAnchor) === "true" && (n += 1, n > 1)) return !0;
1031
1203
  return !1;
1032
1204
  }
1033
- function _r(e) {
1205
+ function Tr(e) {
1034
1206
  for (let t = e.length - 1; t >= 0; t--) {
1035
1207
  let n = e[t];
1036
1208
  if ((n == null ? void 0 : n.dataset.scrollAnchor) === "true") return n;
1037
1209
  }
1038
1210
  return null;
1039
1211
  }
1040
- function wr({ content: e, spacer: t, viewport: n }) {
1212
+ function Er({ content: e, spacer: t, viewport: n }) {
1041
1213
  let r = n.getBoundingClientRect();
1042
- for (let s of fe(e, t)) {
1214
+ for (let s of Ce(e, t)) {
1043
1215
  if (!s.dataset.messageId) continue;
1044
1216
  let o = s.getBoundingClientRect();
1045
1217
  if (o.bottom > r.top && o.top < r.bottom) return s;
1046
1218
  }
1047
1219
  return null;
1048
1220
  }
1049
- function yr({ align: e, element: t, scrollMargin: n, spacer: r, viewport: s }) {
1050
- let o = dt(t, s), a = t.getBoundingClientRect().height, i = Sr(r);
1221
+ function Rr({ align: e, element: t, scrollMargin: n, spacer: r, viewport: s }) {
1222
+ let o = gt(t, s), a = t.getBoundingClientRect().height, i = Ir(r);
1051
1223
  if (e === "center") {
1052
- let c = Math.max(0, s.clientHeight - i.start - i.end);
1053
- return o - i.start - (c - a) / 2 - n;
1224
+ let u = Math.max(0, s.clientHeight - i.start - i.end);
1225
+ return o - i.start - (u - a) / 2 - n;
1054
1226
  }
1055
1227
  if (e === "end") return o - s.clientHeight + a + i.end + n;
1056
1228
  if (e === "nearest") {
1057
- let c = o + a, f = s.scrollTop + i.start, g = s.scrollTop + s.clientHeight - i.end;
1058
- return o >= f && c <= g ? s.scrollTop : o < f ? o - i.start - n : c - s.clientHeight + i.end + n;
1229
+ let u = o + a, h = s.scrollTop + i.start, g = s.scrollTop + s.clientHeight - i.end;
1230
+ return o >= h && u <= g ? s.scrollTop : o < h ? o - i.start - n : u - s.clientHeight + i.end + n;
1059
1231
  }
1060
1232
  return o - i.start - n;
1061
1233
  }
1062
- function dt(e, t) {
1234
+ function gt(e, t) {
1063
1235
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
1064
1236
  return n.top - r.top + t.scrollTop;
1065
1237
  }
1066
- function ve(e, t) {
1238
+ function Ae(e, t) {
1067
1239
  return e.getBoundingClientRect().top - t.getBoundingClientRect().top;
1068
1240
  }
1069
- function kr({ content: e, scrollTop: t, spacer: n, viewport: r }) {
1070
- let s = De({ content: e, spacer: n, viewport: r });
1241
+ function Ar({ content: e, scrollTop: t, spacer: n, viewport: r }) {
1242
+ let s = Ue({ content: e, spacer: n, viewport: r });
1071
1243
  return t + r.clientHeight - s;
1072
1244
  }
1073
- function De({ content: e, spacer: t, viewport: n }) {
1074
- let r = fe(e, t), s = ht(e), o = n.getBoundingClientRect(), a = n.scrollTop, i = s.start + s.end;
1075
- for (let c of r) {
1076
- let f = c.getBoundingClientRect();
1077
- i = Math.max(i, f.bottom - o.top + a + s.end);
1245
+ function Ue({ content: e, spacer: t, viewport: n }) {
1246
+ let r = Ce(e, t), s = bt(e), o = n.getBoundingClientRect(), a = n.scrollTop, i = s.start + s.end;
1247
+ for (let u of r) {
1248
+ let h = u.getBoundingClientRect();
1249
+ i = Math.max(i, h.bottom - o.top + a + s.end);
1078
1250
  }
1079
1251
  return i;
1080
1252
  }
1081
- function Cr(e) {
1253
+ function Nr(e) {
1082
1254
  return Math.max(0, e.scrollHeight - e.clientHeight);
1083
1255
  }
1084
- function ht(e) {
1256
+ function bt(e) {
1085
1257
  let t = window.getComputedStyle(e);
1086
- return { end: Re(t.paddingBlockEnd || t.paddingBottom), start: Re(t.paddingBlockStart || t.paddingTop) };
1258
+ return { end: We(t.paddingBlockEnd || t.paddingBottom), start: We(t.paddingBlockStart || t.paddingTop) };
1087
1259
  }
1088
- function Sr(e) {
1260
+ function Ir(e) {
1089
1261
  let t = e == null ? void 0 : e.parentElement;
1090
- return t ? ht(t) : { end: 0, start: 0 };
1262
+ return t ? bt(t) : { end: 0, start: 0 };
1091
1263
  }
1092
- function Tr(e) {
1264
+ function Mr(e) {
1093
1265
  if (!e) return 0;
1094
1266
  let t = window.getComputedStyle(e), n = t.rowGap === "normal" ? t.gap : t.rowGap;
1095
- return Re(n);
1267
+ return We(n);
1096
1268
  }
1097
- function Re(e) {
1269
+ function We(e) {
1098
1270
  if (!e) return 0;
1099
1271
  let t = Number.parseFloat(e);
1100
1272
  return Number.isFinite(t) ? t : 0;
1101
1273
  }
1102
- function ft(e, t) {
1274
+ function vt(e, t) {
1103
1275
  let n = e, r = /* @__PURE__ */ new Set();
1104
1276
  return { getSnapshot: () => n, hasListeners: () => r.size > 0, setSnapshot: (s) => {
1105
1277
  t(n, s) || (n = s, r.forEach((o) => o()));
@@ -1110,409 +1282,409 @@ function ft(e, t) {
1110
1282
  };
1111
1283
  } };
1112
1284
  }
1113
- function Ke(e, t) {
1114
- return ft(e, t);
1285
+ function tt(e, t) {
1286
+ return vt(e, t);
1115
1287
  }
1116
- function Fr() {
1117
- return ft(ye, Rr);
1288
+ function Dr() {
1289
+ return vt(Me, Pr);
1118
1290
  }
1119
- function Er(e, t) {
1291
+ function Br(e, t) {
1120
1292
  return e.start === t.start && e.end === t.end;
1121
1293
  }
1122
- function Rr(e, t) {
1294
+ function Pr(e, t) {
1123
1295
  return e.currentAnchorId !== t.currentAnchorId || e.visibleMessageIds.length !== t.visibleMessageIds.length ? !1 : e.visibleMessageIds.every((n, r) => n === t.visibleMessageIds[r]);
1124
1296
  }
1125
- function Ar({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: r, scrollPreviousItemPeek: s }) {
1126
- let o = u.useRef(e), a = u.useRef(!1), i = u.useRef(null), c = u.useRef(!1), f = u.useRef(n), g = u.useRef(0), v = u.useRef(null), h = u.useRef(0), d = u.useRef(e ? "following-bottom" : "free-scrolling"), p = u.useRef(/* @__PURE__ */ new Map()), y = u.useRef(null), b = u.useRef(null), F = u.useRef(null), k = u.useRef(s), D = u.useRef(!0), j = u.useRef(null), I = u.useRef(r), N = u.useRef(null), E = u.useRef(0), L = u.useRef(0), q = u.useRef(null), te = u.useRef(null), Y = u.useRef(null), _ = u.useRef(null), S = u.useRef(null), R = u.useRef(null), B = u.useRef(null), M = u.useRef(null), P = u.useRef(null), x = u.useRef(/* @__PURE__ */ new Set()), G = u.useRef(/* @__PURE__ */ new WeakSet());
1127
- return Y.current === null && (Y.current = Ke(t === "end" || t === "last-anchor", (re, W) => re === W)), _.current === null && (_.current = Ke(ut, Er)), P.current === null && (P.current = Fr()), o.current = e, f.current = n, I.current = r, k.current = s, { autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: S, streamingTurnRef: F, contentRef: i, defaultScrollPositionAppliedRef: c, firstItemRef: v, itemCountRef: g, lastScrollTopRef: h, messageElementsRef: p, modeRef: d, pendingScrollFrameRef: N, pendingScrollToMessageRef: y, prependRestoreRef: b, preserveScrollOnPrependRef: D, pendingDefaultScrollStore: Y.current, rootRef: j, scrollEdgeThresholdRef: f, scrollMarginRef: I, scrollPreviousItemPeekRef: k, spacerGapRef: E, spacerHeightRef: L, spacerRef: q, stateFrameRef: te, stateStore: _.current, viewportRef: R, visibilityFrameRef: B, visibilityObserverRef: M, visibilityStore: P.current, visibleMessageIdsRef: x, handledScrollAnchorsRef: G };
1297
+ function xr({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: r, scrollPreviousItemPeek: s }) {
1298
+ let o = d.useRef(e), a = d.useRef(!1), i = d.useRef(null), u = d.useRef(!1), h = d.useRef(n), g = d.useRef(0), f = d.useRef(null), c = d.useRef(0), p = d.useRef(e ? "following-bottom" : "free-scrolling"), b = d.useRef(/* @__PURE__ */ new Map()), k = d.useRef(null), v = d.useRef(null), m = d.useRef(null), B = d.useRef(s), T = d.useRef(!0), x = d.useRef(null), C = d.useRef(r), N = d.useRef(null), I = d.useRef(0), z = d.useRef(0), q = d.useRef(null), le = d.useRef(null), K = d.useRef(null), y = d.useRef(null), A = d.useRef(null), M = d.useRef(null), D = d.useRef(null), P = d.useRef(null), O = d.useRef(null), L = d.useRef(/* @__PURE__ */ new Set()), Y = d.useRef(/* @__PURE__ */ new WeakSet());
1299
+ return K.current === null && (K.current = tt(t === "end" || t === "last-anchor", (ee, de) => ee === de)), y.current === null && (y.current = tt(mt, Br)), O.current === null && (O.current = Dr()), o.current = e, h.current = n, C.current = r, B.current = s, { autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: A, streamingTurnRef: m, contentRef: i, defaultScrollPositionAppliedRef: u, firstItemRef: f, itemCountRef: g, lastScrollTopRef: c, messageElementsRef: b, modeRef: p, pendingScrollFrameRef: N, pendingScrollToMessageRef: k, prependRestoreRef: v, preserveScrollOnPrependRef: T, pendingDefaultScrollStore: K.current, rootRef: x, scrollEdgeThresholdRef: h, scrollMarginRef: C, scrollPreviousItemPeekRef: B, spacerGapRef: I, spacerHeightRef: z, spacerRef: q, stateFrameRef: le, stateStore: y.current, viewportRef: M, visibilityFrameRef: D, visibilityObserverRef: P, visibilityStore: O.current, visibleMessageIdsRef: L, handledScrollAnchorsRef: Y };
1128
1300
  }
1129
- function pt(e) {
1301
+ function _t(e) {
1130
1302
  e.pendingDefaultScrollStore.setSnapshot(!1);
1131
1303
  }
1132
- function _e(e) {
1133
- e.defaultScrollPositionAppliedRef.current = !0, pt(e);
1304
+ function Ne(e) {
1305
+ e.defaultScrollPositionAppliedRef.current = !0, _t(e);
1134
1306
  }
1135
- function Br({ refs: e, commitScrollState: t, scheduleStateCommit: n, scheduleVisibilitySync: r }) {
1136
- let { streamingTurnRef: s, autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef: c, itemCountRef: f, messageElementsRef: g, modeRef: v, pendingScrollToMessageRef: h, prependRestoreRef: d, scrollMarginRef: p, scrollPreviousItemPeekRef: y, spacerGapRef: b, spacerHeightRef: F, spacerRef: k, viewportRef: D } = e, j = u.useCallback((_) => {
1137
- i.current !== null && (window.clearTimeout(i.current), i.current = null), a.current !== _ && (a.current = _, t()), _ && (i.current = window.setTimeout(() => {
1307
+ function Lr({ refs: e, commitScrollState: t, scheduleStateCommit: n, scheduleVisibilitySync: r }) {
1308
+ let { streamingTurnRef: s, autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef: u, itemCountRef: h, messageElementsRef: g, modeRef: f, pendingScrollToMessageRef: c, prependRestoreRef: p, scrollMarginRef: b, scrollPreviousItemPeekRef: k, spacerGapRef: v, spacerHeightRef: m, spacerRef: B, viewportRef: T } = e, x = d.useCallback((y) => {
1309
+ i.current !== null && (window.clearTimeout(i.current), i.current = null), a.current !== y && (a.current = y, t()), y && (i.current = window.setTimeout(() => {
1138
1310
  i.current = null, a.current = !1, t();
1139
- }, dr));
1140
- }, [t]), I = u.useCallback((_) => {
1141
- let S = k.current;
1142
- if (!S) return;
1143
- let R = Math.max(0, Math.ceil(_));
1144
- F.current !== R && (F.current = R, S.hidden = R === 0, S.style.height = `${R}px`, S.style.marginTop = R > 0 ? `${-b.current}px` : "");
1145
- }, []), N = u.useCallback((_, { behavior: S = "auto", autoscrolling: R = !1 } = {}) => {
1146
- let B = D.current;
1147
- if (!B) return;
1148
- let M = Math.max(0, _);
1149
- if (Math.abs(B.scrollTop - M) <= we) {
1150
- B.scrollTop = M, t();
1311
+ }, vr));
1312
+ }, [t]), C = d.useCallback((y) => {
1313
+ let A = B.current;
1314
+ if (!A) return;
1315
+ let M = Math.max(0, Math.ceil(y));
1316
+ m.current !== M && (m.current = M, A.hidden = M === 0, A.style.height = `${M}px`, A.style.marginTop = M > 0 ? `${-v.current}px` : "");
1317
+ }, []), N = d.useCallback((y, { behavior: A = "auto", autoscrolling: M = !1 } = {}) => {
1318
+ let D = T.current;
1319
+ if (!D) return;
1320
+ let P = Math.max(0, y);
1321
+ if (Math.abs(D.scrollTop - P) <= Ie) {
1322
+ D.scrollTop = P, t();
1151
1323
  return;
1152
1324
  }
1153
- R && j(!0), B.scrollTo({ top: M, behavior: S }), n();
1154
- }, [t, n, j]), E = u.useCallback(({ behavior: _ = "auto" } = {}) => D.current ? (I(0), s.current = null, v.current = "free-scrolling", N(0, { behavior: _ }), r(), !0) : !1, [r, N, I]), L = u.useCallback(({ behavior: _ = "auto" } = {}) => {
1155
- let S = D.current;
1156
- return S ? (I(0), s.current = null, v.current = o.current ? "following-bottom" : "free-scrolling", N(Cr(S), { autoscrolling: !0, behavior: _ }), r(), !0) : !1;
1157
- }, [r, N, I]), q = u.useCallback((_, { align: S = "start", behavior: R = "auto", scrollMargin: B = p.current } = {}, { keepPreviousPeek: M = !1 } = {}) => {
1158
- let P = c.current, x = D.current;
1159
- if (!P || !x || !P.contains(_)) return !1;
1160
- let G = yr({ align: S, element: _, scrollMargin: M ? B + y.current : B, spacer: k.current, viewport: x }), re = kr({ content: P, scrollTop: G, spacer: k.current, viewport: x });
1161
- return I(re), d.current = { element: _, viewportTop: ve(_, x) }, v.current = M ? "anchored-to-message" : "settling-jump", s.current = M ? _ : null, N(G, { behavior: R }), r(), !0;
1162
- }, [r, N, I]), te = u.useCallback(() => {
1163
- let _ = s.current;
1164
- return !_ || !_.isConnected || v.current !== "anchored-to-message" ? !1 : q(_, { align: "start" }, { keepPreviousPeek: !0 });
1165
- }, [q]), Y = u.useCallback((_, S) => {
1166
- let R = g.current.get(_);
1167
- return R ? (_e(e), q(R, S) ? (h.current = null, !0) : (h.current = { messageId: _, options: S }, !0)) : f.current === 0 ? (h.current = { messageId: _, options: S }, _e(e), !0) : !1;
1325
+ M && x(!0), D.scrollTo({ top: P, behavior: A }), n();
1326
+ }, [t, n, x]), I = d.useCallback(({ behavior: y = "auto" } = {}) => T.current ? (C(0), s.current = null, f.current = "free-scrolling", N(0, { behavior: y }), r(), !0) : !1, [r, N, C]), z = d.useCallback(({ behavior: y = "auto" } = {}) => {
1327
+ let A = T.current;
1328
+ return A ? (C(0), s.current = null, f.current = o.current ? "following-bottom" : "free-scrolling", N(Nr(A), { autoscrolling: !0, behavior: y }), r(), !0) : !1;
1329
+ }, [r, N, C]), q = d.useCallback((y, { align: A = "start", behavior: M = "auto", scrollMargin: D = b.current } = {}, { keepPreviousPeek: P = !1 } = {}) => {
1330
+ let O = u.current, L = T.current;
1331
+ if (!O || !L || !O.contains(y)) return !1;
1332
+ let Y = Rr({ align: A, element: y, scrollMargin: P ? D + k.current : D, spacer: B.current, viewport: L }), ee = Ar({ content: O, scrollTop: Y, spacer: B.current, viewport: L });
1333
+ return C(ee), p.current = { element: y, viewportTop: Ae(y, L) }, f.current = P ? "anchored-to-message" : "settling-jump", s.current = P ? y : null, N(Y, { behavior: M }), r(), !0;
1334
+ }, [r, N, C]), le = d.useCallback(() => {
1335
+ let y = s.current;
1336
+ return !y || !y.isConnected || f.current !== "anchored-to-message" ? !1 : q(y, { align: "start" }, { keepPreviousPeek: !0 });
1337
+ }, [q]), K = d.useCallback((y, A) => {
1338
+ let M = g.current.get(y);
1339
+ return M ? (Ne(e), q(M, A) ? (c.current = null, !0) : (c.current = { messageId: y, options: A }, !0)) : h.current === 0 ? (c.current = { messageId: y, options: A }, Ne(e), !0) : !1;
1168
1340
  }, [q]);
1169
- return { flushPendingScrollToMessage: u.useCallback(() => {
1170
- let _ = h.current;
1171
- if (!_) return !1;
1172
- let S = g.current.get(_.messageId);
1173
- return !S || !q(S, _.options) ? !1 : (h.current = null, _e(e), !0);
1174
- }, [q]), reanchorToAnchoredMessage: te, scrollToElement: q, scrollToEnd: L, scrollToMessage: Y, scrollToStart: E };
1175
- }
1176
- function Qe(e, t) {
1177
- return u.useCallback((n) => {
1341
+ return { flushPendingScrollToMessage: d.useCallback(() => {
1342
+ let y = c.current;
1343
+ if (!y) return !1;
1344
+ let A = g.current.get(y.messageId);
1345
+ return !A || !q(A, y.options) ? !1 : (c.current = null, Ne(e), !0);
1346
+ }, [q]), reanchorToAnchoredMessage: le, scrollToElement: q, scrollToEnd: z, scrollToMessage: K, scrollToStart: I };
1347
+ }
1348
+ function rt(e, t) {
1349
+ return d.useCallback((n) => {
1178
1350
  e.current = n, n && t();
1179
1351
  }, [e, t]);
1180
1352
  }
1181
- function Mr({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: n = ir, scrollPreviousItemPeek: r = cr, scrollMargin: s = ur }) {
1182
- let o = Ar({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: s, scrollPreviousItemPeek: r }), { streamingTurnRef: a, autoScrollRef: i, autoscrollingRef: c, autoscrollingTimeoutRef: f, contentRef: g, defaultScrollPositionAppliedRef: v, firstItemRef: h, itemCountRef: d, lastScrollTopRef: p, messageElementsRef: y, modeRef: b, pendingScrollFrameRef: F, pendingScrollToMessageRef: k, prependRestoreRef: D, preserveScrollOnPrependRef: j, pendingDefaultScrollStore: I, rootRef: N, scrollEdgeThresholdRef: E, scrollMarginRef: L, scrollPreviousItemPeekRef: q, spacerGapRef: te, spacerHeightRef: Y, spacerRef: _, stateFrameRef: S, stateStore: R, viewportRef: B, visibilityFrameRef: M, visibilityObserverRef: P, visibilityStore: x, visibleMessageIdsRef: G, handledScrollAnchorsRef: re } = o, W = u.useRef(t);
1183
- W.current !== t && (W.current = t, v.current = !1);
1184
- let Q = u.useCallback((m) => {
1185
- let w = N.current, C = B.current, O = [m.start && "start", m.end && "end"].filter(Boolean).join(" "), ne = c.current;
1186
- for (let V of [w, C]) V && (O ? V.setAttribute("data-scrollable", O) : V.removeAttribute("data-scrollable"), V.toggleAttribute("data-autoscrolling", ne));
1187
- }, []), X = u.useCallback((m) => {
1188
- var O;
1189
- let w = ((O = B.current) == null ? void 0 : O.scrollTop) ?? 0, C = w < p.current - we;
1190
- p.current = w, i.current && !m.end && b.current !== "settling-jump" && b.current !== "anchored-to-message" ? b.current = "following-bottom" : b.current === "following-bottom" && m.end && C && !c.current && (b.current = "free-scrolling");
1191
- }, []), J = u.useCallback(() => {
1192
- let m = pr({ content: g.current, scrollEdgeThreshold: E.current, spacer: _.current, viewport: B.current });
1193
- X(m);
1194
- let w = b.current === "following-bottom" ? { ...m, end: !1 } : m;
1195
- Q(w), R.setSnapshot(w);
1196
- }, [X, R, Q]), oe = u.useCallback(() => {
1197
- S.current === null && (S.current = window.requestAnimationFrame(() => {
1198
- S.current = null, J();
1353
+ function qr({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: n = mr, scrollPreviousItemPeek: r = gr, scrollMargin: s = br }) {
1354
+ let o = xr({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: s, scrollPreviousItemPeek: r }), { streamingTurnRef: a, autoScrollRef: i, autoscrollingRef: u, autoscrollingTimeoutRef: h, contentRef: g, defaultScrollPositionAppliedRef: f, firstItemRef: c, itemCountRef: p, lastScrollTopRef: b, messageElementsRef: k, modeRef: v, pendingScrollFrameRef: m, pendingScrollToMessageRef: B, prependRestoreRef: T, preserveScrollOnPrependRef: x, pendingDefaultScrollStore: C, rootRef: N, scrollEdgeThresholdRef: I, scrollMarginRef: z, scrollPreviousItemPeekRef: q, spacerGapRef: le, spacerHeightRef: K, spacerRef: y, stateFrameRef: A, stateStore: M, viewportRef: D, visibilityFrameRef: P, visibilityObserverRef: O, visibilityStore: L, visibleMessageIdsRef: Y, handledScrollAnchorsRef: ee } = o, de = d.useRef(t);
1355
+ de.current !== t && (de.current = t, f.current = !1);
1356
+ let ne = d.useCallback((_) => {
1357
+ let F = N.current, E = D.current, W = [_.start && "start", _.end && "end"].filter(Boolean).join(" "), ce = u.current;
1358
+ for (let G of [F, E]) G && (W ? G.setAttribute("data-scrollable", W) : G.removeAttribute("data-scrollable"), G.toggleAttribute("data-autoscrolling", ce));
1359
+ }, []), he = d.useCallback((_) => {
1360
+ var W;
1361
+ let F = ((W = D.current) == null ? void 0 : W.scrollTop) ?? 0, E = F < b.current - Ie;
1362
+ b.current = F, i.current && !_.end && v.current !== "settling-jump" && v.current !== "anchored-to-message" ? v.current = "following-bottom" : v.current === "following-bottom" && _.end && E && !u.current && (v.current = "free-scrolling");
1363
+ }, []), J = d.useCallback(() => {
1364
+ let _ = yr({ content: g.current, scrollEdgeThreshold: I.current, spacer: y.current, viewport: D.current });
1365
+ he(_);
1366
+ let F = v.current === "following-bottom" ? { ..._, end: !1 } : _;
1367
+ ne(F), M.setSnapshot(F);
1368
+ }, [he, M, ne]), ae = d.useCallback(() => {
1369
+ A.current === null && (A.current = window.requestAnimationFrame(() => {
1370
+ A.current = null, J();
1199
1371
  }));
1200
- }, [J]), A = u.useCallback(() => {
1201
- x.hasListeners() && M.current === null && (M.current = window.requestAnimationFrame(() => {
1202
- M.current = null, x.hasListeners() && x.setSnapshot(gr({ content: g.current, scrollMargin: L.current, scrollPreviousItemPeek: q.current, spacer: _.current, viewport: B.current, visibleMessageIds: G.current }));
1372
+ }, [J]), $ = d.useCallback(() => {
1373
+ L.hasListeners() && P.current === null && (P.current = window.requestAnimationFrame(() => {
1374
+ P.current = null, L.hasListeners() && L.setSnapshot(kr({ content: g.current, scrollMargin: z.current, scrollPreviousItemPeek: q.current, spacer: y.current, viewport: D.current, visibleMessageIds: Y.current }));
1203
1375
  }));
1204
- }, [x]), { flushPendingScrollToMessage: $, reanchorToAnchoredMessage: Z, scrollToElement: U, scrollToEnd: H, scrollToMessage: Ie, scrollToStart: me } = Br({ refs: o, commitScrollState: J, scheduleStateCommit: oe, scheduleVisibilitySync: A }), Ne = u.useCallback(() => {
1205
- let m = D.current, w = B.current;
1206
- if (!m || !w || !m.element.isConnected) return !1;
1207
- let C = ve(m.element, w) - m.viewportTop;
1208
- return Math.abs(C) <= we ? !1 : (w.scrollTop += C, m.viewportTop = ve(m.element, w), oe(), A(), !0);
1209
- }, [oe, A]), ae = u.useCallback(() => {
1210
- let m = g.current, w = B.current;
1211
- if (!m || !w) {
1212
- D.current = null;
1376
+ }, [L]), { flushPendingScrollToMessage: pe, reanchorToAnchoredMessage: Te, scrollToElement: R, scrollToEnd: S, scrollToMessage: V, scrollToStart: fe } = Lr({ refs: o, commitScrollState: J, scheduleStateCommit: ae, scheduleVisibilitySync: $ }), me = d.useCallback(() => {
1377
+ let _ = T.current, F = D.current;
1378
+ if (!_ || !F || !_.element.isConnected) return !1;
1379
+ let E = Ae(_.element, F) - _.viewportTop;
1380
+ return Math.abs(E) <= Ie ? !1 : (F.scrollTop += E, _.viewportTop = Ae(_.element, F), ae(), $(), !0);
1381
+ }, [ae, $]), ie = d.useCallback(() => {
1382
+ let _ = g.current, F = D.current;
1383
+ if (!_ || !F) {
1384
+ T.current = null;
1213
1385
  return;
1214
1386
  }
1215
- let C = wr({ content: m, spacer: _.current, viewport: w });
1216
- D.current = C ? { element: C, viewportTop: ve(C, w) } : null;
1217
- }, []), Pe = u.useCallback(() => {
1218
- F.current === null && (F.current = window.requestAnimationFrame(() => {
1219
- F.current = null, $() && ae();
1387
+ let E = Er({ content: _, spacer: y.current, viewport: F });
1388
+ T.current = E ? { element: E, viewportTop: Ae(E, F) } : null;
1389
+ }, []), se = d.useCallback(() => {
1390
+ m.current === null && (m.current = window.requestAnimationFrame(() => {
1391
+ m.current = null, pe() && ie();
1220
1392
  }));
1221
- }, [ae, $]), be = u.useCallback(() => {
1222
- if (!t || v.current || d.current === 0) return !1;
1223
- let m = !1;
1393
+ }, [ie, pe]), ge = d.useCallback(() => {
1394
+ if (!t || f.current || p.current === 0) return !1;
1395
+ let _ = !1;
1224
1396
  if (t === "last-anchor") {
1225
- let w = g.current, C = B.current, O = w && C ? _r(fe(w, _.current)) : null;
1226
- if (!w || !C || !O) m = H({ behavior: "auto" });
1397
+ let F = g.current, E = D.current, W = F && E ? Tr(Ce(F, y.current)) : null;
1398
+ if (!F || !E || !W) _ = S({ behavior: "auto" });
1227
1399
  else {
1228
- let ne = dt(O, C);
1229
- m = De({ content: w, spacer: _.current, viewport: C }) - ne <= C.clientHeight ? H({ behavior: "auto" }) : U(O, { align: "start" }, { keepPreviousPeek: !0 });
1400
+ let ce = gt(W, E);
1401
+ _ = Ue({ content: F, spacer: y.current, viewport: E }) - ce <= E.clientHeight ? S({ behavior: "auto" }) : R(W, { align: "start" }, { keepPreviousPeek: !0 });
1230
1402
  }
1231
- } else m = t === "end" ? H({ behavior: "auto" }) : me({ behavior: "auto" });
1232
- return m ? (_e(o), !0) : !1;
1233
- }, [t, U, H, me]), xe = u.useCallback(() => {
1234
- let m = g.current;
1235
- if (!m) return;
1236
- let w = fe(m, _.current), C = d.current, O = h.current;
1237
- d.current = w.length, h.current = w[0] ?? null, (() => {
1238
- if ($()) return;
1239
- if (C === 0) {
1240
- if (be() || w.length > 0 && i.current && H({ behavior: "auto" })) return;
1241
- J(), A();
1403
+ } else _ = t === "end" ? S({ behavior: "auto" }) : fe({ behavior: "auto" });
1404
+ return _ ? (Ne(o), !0) : !1;
1405
+ }, [t, R, S, fe]), Ee = d.useCallback(() => {
1406
+ let _ = g.current;
1407
+ if (!_) return;
1408
+ let F = Ce(_, y.current), E = p.current, W = c.current;
1409
+ p.current = F.length, c.current = F[0] ?? null, (() => {
1410
+ if (pe()) return;
1411
+ if (E === 0) {
1412
+ if (ge() || F.length > 0 && i.current && S({ behavior: "auto" })) return;
1413
+ J(), $();
1242
1414
  return;
1243
1415
  }
1244
- let ne = O ? w.indexOf(O) : -1;
1245
- if (j.current && ne > 0) {
1246
- Ne();
1416
+ let ce = W ? F.indexOf(W) : -1;
1417
+ if (x.current && ce > 0) {
1418
+ me();
1247
1419
  return;
1248
1420
  }
1249
- if (w.length > C) {
1250
- let V = mr(w, C);
1251
- if (V) {
1252
- if (i.current && b.current === "following-bottom" && vr(w, C)) {
1253
- H({ behavior: "auto" });
1421
+ if (F.length > E) {
1422
+ let G = Cr(F, E);
1423
+ if (G) {
1424
+ if (i.current && v.current === "following-bottom" && Fr(F, E)) {
1425
+ S({ behavior: "auto" });
1254
1426
  return;
1255
1427
  }
1256
- U(V, { align: "start" }, { keepPreviousPeek: !0 }), re.current.add(V);
1428
+ R(G, { align: "start" }, { keepPreviousPeek: !0 }), ee.current.add(G);
1257
1429
  return;
1258
1430
  }
1259
1431
  }
1260
- if (w.length === C) {
1261
- let V = br(w, re.current);
1262
- if (V) {
1263
- U(V, { align: "start" }, { keepPreviousPeek: !0 }), re.current.add(V);
1432
+ if (F.length === E) {
1433
+ let G = Sr(F, ee.current);
1434
+ if (G) {
1435
+ R(G, { align: "start" }, { keepPreviousPeek: !0 }), ee.current.add(G);
1264
1436
  return;
1265
1437
  }
1266
1438
  }
1267
- b.current === "following-bottom" && i.current ? H({ behavior: "auto" }) : (J(), A());
1268
- })(), ae();
1269
- }, [be, ae, J, $, Ne, A, U, H]), Le = u.useCallback(() => {
1270
- if (b.current === "following-bottom" && i.current) {
1271
- H({ behavior: "auto" });
1439
+ v.current === "following-bottom" && i.current ? S({ behavior: "auto" }) : (J(), $());
1440
+ })(), ie();
1441
+ }, [ge, ie, J, pe, me, $, R, S]), Re = d.useCallback(() => {
1442
+ if (v.current === "following-bottom" && i.current) {
1443
+ S({ behavior: "auto" });
1272
1444
  return;
1273
1445
  }
1274
- let m = Y.current;
1275
- if (Z()) {
1276
- i.current && m > 0 && Y.current === 0 && H({ behavior: "auto" });
1446
+ let _ = K.current;
1447
+ if (Te()) {
1448
+ i.current && _ > 0 && K.current === 0 && S({ behavior: "auto" });
1277
1449
  return;
1278
1450
  }
1279
- oe(), A();
1280
- }, [Z, oe, A, H]), Oe = u.useCallback(() => {
1281
- let m = B.current;
1282
- if (!(!m || !x.hasListeners())) {
1451
+ ae(), $();
1452
+ }, [Te, ae, $, S]), X = d.useCallback(() => {
1453
+ let _ = D.current;
1454
+ if (!(!_ || !L.hasListeners())) {
1283
1455
  if (typeof IntersectionObserver > "u") {
1284
- A();
1456
+ $();
1285
1457
  return;
1286
1458
  }
1287
- P.current || (P.current = new IntersectionObserver((w) => {
1288
- for (let C of w) {
1289
- let O = C.target.dataset.messageId;
1290
- O && (C.isIntersecting ? G.current.add(O) : G.current.delete(O));
1459
+ O.current || (O.current = new IntersectionObserver((F) => {
1460
+ for (let E of F) {
1461
+ let W = E.target.dataset.messageId;
1462
+ W && (E.isIntersecting ? Y.current.add(W) : Y.current.delete(W));
1291
1463
  }
1292
- A();
1293
- }, { root: m, rootMargin: `${-(L.current + q.current)}px 0px 0px 0px`, threshold: [0, 0.01, 0.5, 1] })), y.current.forEach((w) => {
1294
- var C;
1295
- (C = P.current) == null || C.observe(w);
1296
- }), A();
1464
+ $();
1465
+ }, { root: _, rootMargin: `${-(z.current + q.current)}px 0px 0px 0px`, threshold: [0, 0.01, 0.5, 1] })), k.current.forEach((F) => {
1466
+ var E;
1467
+ (E = O.current) == null || E.observe(F);
1468
+ }), $();
1297
1469
  }
1298
- }, [A, x]), qe = u.useCallback(() => {
1299
- var m;
1300
- M.current !== null && (window.cancelAnimationFrame(M.current), M.current = null), (m = P.current) == null || m.disconnect(), P.current = null, G.current.clear(), x.setSnapshot(ye);
1301
- }, [x]), yt = u.useCallback((m, w, C) => {
1302
- var O, ne, V;
1303
- if (w) {
1304
- y.current.set(m, w), (O = P.current) == null || O.observe(w), A(), ((ne = k.current) == null ? void 0 : ne.messageId) === m && Pe();
1470
+ }, [$, L]), j = d.useCallback(() => {
1471
+ var _;
1472
+ P.current !== null && (window.cancelAnimationFrame(P.current), P.current = null), (_ = O.current) == null || _.disconnect(), O.current = null, Y.current.clear(), L.setSnapshot(Me);
1473
+ }, [L]), Z = d.useCallback((_, F, E) => {
1474
+ var W, ce, G;
1475
+ if (F) {
1476
+ k.current.set(_, F), (W = O.current) == null || W.observe(F), $(), ((ce = B.current) == null ? void 0 : ce.messageId) === _ && se();
1305
1477
  return;
1306
1478
  }
1307
- C && y.current.get(m) === C && (y.current.delete(m), G.current.delete(m), (V = P.current) == null || V.unobserve(C), A());
1308
- }, [Pe, A]), We = u.useCallback(() => {
1309
- (b.current === "following-bottom" || b.current === "anchored-to-message" || b.current === "settling-jump") && (a.current = null, b.current = "free-scrolling");
1310
- }, []), $e = u.useCallback(() => Q(R.getSnapshot()), [R, Q]), He = Qe(N, $e), Ve = Qe(B, $e), ze = u.useCallback((m) => {
1311
- g.current = m;
1312
- }, []), Ge = u.useCallback((m) => {
1313
- _.current = m, te.current = Tr((m == null ? void 0 : m.parentElement) ?? null);
1314
- }, []), Ue = u.useCallback(() => {
1315
- J(), A(), ae();
1316
- }, [ae, J, A]), kt = u.useMemo(() => ({ handleContentChange: xe, handleResize: Le, observeVisibility: Oe, pendingDefaultScrollStore: I, preserveScrollOnPrependRef: j, scrollToEnd: H, scrollToMessage: Ie, scrollToStart: me, setContentElement: ze, setRootElement: He, setSpacerElement: Ge, setViewportElement: Ve, stateStore: R, syncAfterScroll: Ue, unobserveVisibility: qe, userScrollIntent: We, viewportRef: B, visibilityStore: x }), [xe, Le, Oe, I, H, Ie, me, ze, He, Ge, Ve, R, Ue, qe, We, x]);
1317
- return u.useLayoutEffect(() => {
1318
- be() || d.current === 0 && pt(o);
1319
- }, [be]), u.useEffect(() => () => {
1320
- var m;
1321
- S.current !== null && (window.cancelAnimationFrame(S.current), S.current = null), M.current !== null && (window.cancelAnimationFrame(M.current), M.current = null), f.current !== null && (window.clearTimeout(f.current), f.current = null), F.current !== null && (window.cancelAnimationFrame(F.current), F.current = null), (m = P.current) == null || m.disconnect(), P.current = null;
1322
- }, []), u.useLayoutEffect(() => {
1323
- if (e && b.current === "following-bottom" && d.current > 0) {
1324
- H({ behavior: "auto" });
1479
+ E && k.current.get(_) === E && (k.current.delete(_), Y.current.delete(_), (G = O.current) == null || G.unobserve(E), $());
1480
+ }, [se, $]), Q = d.useCallback(() => {
1481
+ (v.current === "following-bottom" || v.current === "anchored-to-message" || v.current === "settling-jump") && (a.current = null, v.current = "free-scrolling");
1482
+ }, []), be = d.useCallback(() => ne(M.getSnapshot()), [M, ne]), je = rt(N, be), Ye = rt(D, be), Je = d.useCallback((_) => {
1483
+ g.current = _;
1484
+ }, []), Ke = d.useCallback((_) => {
1485
+ y.current = _, le.current = Mr((_ == null ? void 0 : _.parentElement) ?? null);
1486
+ }, []), Qe = d.useCallback(() => {
1487
+ J(), $(), ie();
1488
+ }, [ie, J, $]), Tt = d.useMemo(() => ({ handleContentChange: Ee, handleResize: Re, observeVisibility: X, pendingDefaultScrollStore: C, preserveScrollOnPrependRef: x, scrollToEnd: S, scrollToMessage: V, scrollToStart: fe, setContentElement: Je, setRootElement: je, setSpacerElement: Ke, setViewportElement: Ye, stateStore: M, syncAfterScroll: Qe, unobserveVisibility: j, userScrollIntent: Q, viewportRef: D, visibilityStore: L }), [Ee, Re, X, C, S, V, fe, Je, je, Ke, Ye, M, Qe, j, Q, L]);
1489
+ return d.useLayoutEffect(() => {
1490
+ ge() || p.current === 0 && _t(o);
1491
+ }, [ge]), d.useEffect(() => () => {
1492
+ var _;
1493
+ A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), P.current !== null && (window.cancelAnimationFrame(P.current), P.current = null), h.current !== null && (window.clearTimeout(h.current), h.current = null), m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null), (_ = O.current) == null || _.disconnect(), O.current = null;
1494
+ }, []), d.useLayoutEffect(() => {
1495
+ if (e && v.current === "following-bottom" && p.current > 0) {
1496
+ S({ behavior: "auto" });
1325
1497
  return;
1326
1498
  }
1327
1499
  J();
1328
- }, [e, J, H]), { context: kt, registerMessage: yt };
1500
+ }, [e, J, S]), { context: Tt, registerMessage: Z };
1329
1501
  }
1330
- function Dr(e) {
1331
- let t = u.useRef(e);
1502
+ function Or(e) {
1503
+ let t = d.useRef(e);
1332
1504
  return t.current = e, t;
1333
1505
  }
1334
- var gt = u.createContext(null), mt = u.createContext(null);
1335
- function ge() {
1336
- let e = u.useContext(gt);
1506
+ var wt = d.createContext(null), yt = d.createContext(null);
1507
+ function Fe() {
1508
+ let e = d.useContext(wt);
1337
1509
  if (!e) throw new Error("useMessageScroller must be used within a MessageScroller.");
1338
1510
  return e;
1339
1511
  }
1340
- function Ir() {
1341
- let e = u.useContext(mt);
1512
+ function $r() {
1513
+ let e = d.useContext(yt);
1342
1514
  if (!e) throw new Error("MessageScrollerItem must be used within a MessageScroller.");
1343
1515
  return e;
1344
1516
  }
1345
- function Nr({ autoScroll: e = !1, children: t, defaultScrollPosition: n = "end", scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o }) {
1346
- let { context: a, registerMessage: i } = Mr({ autoScroll: e, defaultScrollPosition: n, scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o });
1347
- return l(gt.Provider, { value: a, children: l(mt.Provider, { value: i, children: t }) });
1517
+ function Hr({ autoScroll: e = !1, children: t, defaultScrollPosition: n = "end", scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o }) {
1518
+ let { context: a, registerMessage: i } = qr({ autoScroll: e, defaultScrollPosition: n, scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o });
1519
+ return l(wt.Provider, { value: a, children: l(yt.Provider, { value: i, children: t }) });
1348
1520
  }
1349
- function bt() {
1350
- let { pendingDefaultScrollStore: e } = ge();
1351
- return u.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
1521
+ function kt() {
1522
+ let { pendingDefaultScrollStore: e } = Fe();
1523
+ return d.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
1352
1524
  }
1353
- function Pr({ children: e, ...t }) {
1354
- let { setRootElement: n } = ge(), r = bt();
1525
+ function zr({ children: e, ...t }) {
1526
+ let { setRootElement: n } = Fe(), r = kt();
1355
1527
  return l("div", { ref: n, ...t, ...r ? { "data-pending-scroll": "" } : null, children: e });
1356
1528
  }
1357
- function xr({ "aria-label": e, children: t, onKeyDown: n, onScroll: r, onTouchMove: s, onWheel: o, preserveScrollOnPrepend: a = !0, ref: i, role: c, tabIndex: f, ...g }) {
1358
- let { handleResize: v, preserveScrollOnPrependRef: h, setViewportElement: d, syncAfterScroll: p, userScrollIntent: y, viewportRef: b } = ge(), F = bt();
1359
- h.current = a;
1360
- let k = u.useCallback((E) => {
1361
- var L;
1362
- d(E), (L = pe(i)) == null || L(E);
1363
- }, [i, d]);
1364
- function D(E) {
1365
- p(), r == null || r(E);
1529
+ function Wr({ "aria-label": e, children: t, onKeyDown: n, onScroll: r, onTouchMove: s, onWheel: o, preserveScrollOnPrepend: a = !0, ref: i, role: u, tabIndex: h, ...g }) {
1530
+ let { handleResize: f, preserveScrollOnPrependRef: c, setViewportElement: p, syncAfterScroll: b, userScrollIntent: k, viewportRef: v } = Fe(), m = kt();
1531
+ c.current = a;
1532
+ let B = d.useCallback((I) => {
1533
+ var z;
1534
+ p(I), (z = Se(i)) == null || z(I);
1535
+ }, [i, p]);
1536
+ function T(I) {
1537
+ b(), r == null || r(I);
1366
1538
  }
1367
- function j(E) {
1368
- y(), o == null || o(E);
1539
+ function x(I) {
1540
+ k(), o == null || o(I);
1369
1541
  }
1370
- function I(E) {
1371
- y(), s == null || s(E);
1542
+ function C(I) {
1543
+ k(), s == null || s(I);
1372
1544
  }
1373
- function N(E) {
1374
- hr.has(E.key) && y(), n == null || n(E);
1545
+ function N(I) {
1546
+ _r.has(I.key) && k(), n == null || n(I);
1375
1547
  }
1376
- return u.useEffect(() => {
1377
- let E = b.current;
1378
- if (!E || typeof ResizeObserver > "u") return;
1379
- let L = 0, q = new ResizeObserver(() => {
1380
- window.cancelAnimationFrame(L), L = window.requestAnimationFrame(v);
1548
+ return d.useEffect(() => {
1549
+ let I = v.current;
1550
+ if (!I || typeof ResizeObserver > "u") return;
1551
+ let z = 0, q = new ResizeObserver(() => {
1552
+ window.cancelAnimationFrame(z), z = window.requestAnimationFrame(f);
1381
1553
  });
1382
- return q.observe(E), () => {
1383
- window.cancelAnimationFrame(L), q.disconnect();
1554
+ return q.observe(I), () => {
1555
+ window.cancelAnimationFrame(z), q.disconnect();
1384
1556
  };
1385
- }, [v, b]), l("div", { ref: k, role: c ?? "region", "aria-label": e ?? "Messages", tabIndex: f ?? 0, onKeyDown: N, onScroll: D, onTouchMove: I, onWheel: j, ...g, ...F ? { "data-pending-scroll": "" } : null, children: t });
1386
- }
1387
- function Lr({ "aria-relevant": e, children: t, ref: n, role: r, spacerClassName: s, ...o }) {
1388
- let { handleContentChange: a, handleResize: i, setContentElement: c, setSpacerElement: f } = ge(), g = u.useRef(null), v = u.useCallback((h) => {
1389
- var d;
1390
- g.current = h, c(h), (d = pe(n)) == null || d(h);
1391
- }, [n, c]);
1392
- return u.useLayoutEffect(() => {
1393
- let h = g.current;
1394
- if (!h || (a(), typeof MutationObserver > "u")) return;
1395
- let d = new MutationObserver(() => {
1557
+ }, [f, v]), l("div", { ref: B, role: u ?? "region", "aria-label": e ?? "Messages", tabIndex: h ?? 0, onKeyDown: N, onScroll: T, onTouchMove: C, onWheel: x, ...g, ...m ? { "data-pending-scroll": "" } : null, children: t });
1558
+ }
1559
+ function Vr({ "aria-relevant": e, children: t, ref: n, role: r, spacerClassName: s, ...o }) {
1560
+ let { handleContentChange: a, handleResize: i, setContentElement: u, setSpacerElement: h } = Fe(), g = d.useRef(null), f = d.useCallback((c) => {
1561
+ var p;
1562
+ g.current = c, u(c), (p = Se(n)) == null || p(c);
1563
+ }, [n, u]);
1564
+ return d.useLayoutEffect(() => {
1565
+ let c = g.current;
1566
+ if (!c || (a(), typeof MutationObserver > "u")) return;
1567
+ let p = new MutationObserver(() => {
1396
1568
  a();
1397
1569
  });
1398
- return d.observe(h, { childList: !0 }), () => d.disconnect();
1399
- }, [a]), u.useEffect(() => {
1400
- let h = g.current;
1401
- if (!h || typeof ResizeObserver > "u") return;
1402
- let d = 0, p = new ResizeObserver(() => {
1403
- window.cancelAnimationFrame(d), d = window.requestAnimationFrame(i);
1570
+ return p.observe(c, { childList: !0 }), () => p.disconnect();
1571
+ }, [a]), d.useEffect(() => {
1572
+ let c = g.current;
1573
+ if (!c || typeof ResizeObserver > "u") return;
1574
+ let p = 0, b = new ResizeObserver(() => {
1575
+ window.cancelAnimationFrame(p), p = window.requestAnimationFrame(i);
1404
1576
  });
1405
- return p.observe(h), () => {
1406
- window.cancelAnimationFrame(d), p.disconnect();
1577
+ return b.observe(c), () => {
1578
+ window.cancelAnimationFrame(p), b.disconnect();
1407
1579
  };
1408
- }, [i]), T("div", { ref: v, role: r ?? "log", "aria-relevant": e ?? "additions", ...o, children: [t, l("div", { ref: f, "aria-hidden": "true", "data-message-scroller-spacer": "", hidden: !0, className: s })] });
1580
+ }, [i]), w("div", { ref: f, role: r ?? "log", "aria-relevant": e ?? "additions", ...o, children: [t, l("div", { ref: h, "aria-hidden": "true", "data-message-scroller-spacer": "", hidden: !0, className: s })] });
1409
1581
  }
1410
- function Or({ messageId: e, ref: t, scrollAnchor: n = !1, ...r }) {
1411
- let s = Ir(), o = u.useRef(null), a = u.useCallback((i) => {
1412
- var f;
1413
- let c = o.current;
1414
- o.current = i, e && s(e, i, c), (f = pe(t)) == null || f(i);
1582
+ function Gr({ messageId: e, ref: t, scrollAnchor: n = !1, ...r }) {
1583
+ let s = $r(), o = d.useRef(null), a = d.useCallback((i) => {
1584
+ var h;
1585
+ let u = o.current;
1586
+ o.current = i, e && s(e, i, u), (h = Se(t)) == null || h(i);
1415
1587
  }, [e, t, s]);
1416
1588
  return l("div", { ref: a, "data-message-id": e, "data-scroll-anchor": n ? "true" : "false", ...r });
1417
1589
  }
1418
- function qr({ behavior: e = "smooth", children: t, direction: n = "end", onClick: r, render: s, tabIndex: o, type: a = "button", ...i }) {
1419
- let { scrollToEnd: c, scrollToStart: f, stateStore: g } = ge(), v = Dr(r), h = u.useCallback((b) => g.subscribe(b), [g]), d = u.useCallback(() => {
1420
- let b = g.getSnapshot();
1421
- return n === "start" ? b.start : b.end;
1422
- }, [n, g]), p = u.useSyncExternalStore(h, d, d), y = u.useCallback((b) => {
1423
- var F;
1424
- p && ((F = v.current) == null || F.call(v, b), b.defaultPrevented || (b.currentTarget.blur(), n === "start" ? f({ behavior: e }) : c({ behavior: e })));
1425
- }, [e, n, p, v, c, f]);
1426
- return sr({ defaultTagName: "button", props: Ee({ type: a, inert: !p, tabIndex: p ? o : -1, children: t ?? T("span", { children: ["Scroll to ", n] }), onClick: y }, i), render: s, state: { active: p, direction: n }, stateAttributesMapping: { active: (b) => ({ "data-active": b ? "true" : "false" }) } });
1427
- }
1428
- var ue = { Provider: Nr, Root: Pr, Viewport: xr, Content: Lr, Item: Or, Button: qr };
1429
- function vt(e) {
1590
+ function Ur({ behavior: e = "smooth", children: t, direction: n = "end", onClick: r, render: s, tabIndex: o, type: a = "button", ...i }) {
1591
+ let { scrollToEnd: u, scrollToStart: h, stateStore: g } = Fe(), f = Or(r), c = d.useCallback((v) => g.subscribe(v), [g]), p = d.useCallback(() => {
1592
+ let v = g.getSnapshot();
1593
+ return n === "start" ? v.start : v.end;
1594
+ }, [n, g]), b = d.useSyncExternalStore(c, p, p), k = d.useCallback((v) => {
1595
+ var m;
1596
+ b && ((m = f.current) == null || m.call(f, v), v.defaultPrevented || (v.currentTarget.blur(), n === "start" ? h({ behavior: e }) : u({ behavior: e })));
1597
+ }, [e, n, b, f, u, h]);
1598
+ return dr({ defaultTagName: "button", props: ze({ type: a, inert: !b, tabIndex: b ? o : -1, children: t ?? w("span", { children: ["Scroll to ", n] }), onClick: k }, i), render: s, state: { active: b, direction: n }, stateAttributesMapping: { active: (v) => ({ "data-active": v ? "true" : "false" }) } });
1599
+ }
1600
+ var _e = { Provider: Hr, Root: zr, Viewport: Wr, Content: Vr, Item: Gr, Button: Ur };
1601
+ function Ct(e) {
1430
1602
  var t, n, r = "";
1431
1603
  if (typeof e == "string" || typeof e == "number") r += e;
1432
1604
  else if (typeof e == "object") if (Array.isArray(e)) {
1433
1605
  var s = e.length;
1434
- for (t = 0; t < s; t++) e[t] && (n = vt(e[t])) && (r && (r += " "), r += n);
1606
+ for (t = 0; t < s; t++) e[t] && (n = Ct(e[t])) && (r && (r += " "), r += n);
1435
1607
  } else for (n in e) e[n] && (r && (r += " "), r += n);
1436
1608
  return r;
1437
1609
  }
1438
- function Wr() {
1439
- for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = vt(e)) && (r && (r += " "), r += t);
1610
+ function jr() {
1611
+ for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = Ct(e)) && (r && (r += " "), r += t);
1440
1612
  return r;
1441
1613
  }
1442
- function de(...e) {
1443
- return Wr(e);
1614
+ function we(...e) {
1615
+ return jr(e);
1444
1616
  }
1445
- function $r(e) {
1446
- return /* @__PURE__ */ l(ue.Provider, { ...e });
1617
+ function Yr(e) {
1618
+ return /* @__PURE__ */ l(_e.Provider, { ...e });
1447
1619
  }
1448
- function Hr({
1620
+ function Jr({
1449
1621
  className: e,
1450
1622
  ...t
1451
1623
  }) {
1452
1624
  return /* @__PURE__ */ l(
1453
- ue.Root,
1625
+ _e.Root,
1454
1626
  {
1455
1627
  "data-slot": "message-scroller",
1456
- className: de("msg-scroller-root", e),
1628
+ className: we("msg-scroller-root", e),
1457
1629
  ...t
1458
1630
  }
1459
1631
  );
1460
1632
  }
1461
- function Vr({
1633
+ function Kr({
1462
1634
  className: e,
1463
1635
  ...t
1464
1636
  }) {
1465
1637
  return /* @__PURE__ */ l(
1466
- ue.Viewport,
1638
+ _e.Viewport,
1467
1639
  {
1468
1640
  "data-slot": "message-scroller-viewport",
1469
- className: de("msg-scroller-viewport", e),
1641
+ className: we("msg-scroller-viewport", e),
1470
1642
  ...t
1471
1643
  }
1472
1644
  );
1473
1645
  }
1474
- function zr({
1646
+ function Qr({
1475
1647
  className: e,
1476
1648
  ...t
1477
1649
  }) {
1478
1650
  return /* @__PURE__ */ l(
1479
- ue.Content,
1651
+ _e.Content,
1480
1652
  {
1481
1653
  "data-slot": "message-scroller-content",
1482
- className: de("msg-scroller-content", e),
1654
+ className: we("msg-scroller-content", e),
1483
1655
  ...t
1484
1656
  }
1485
1657
  );
1486
1658
  }
1487
- function Xe({
1659
+ function nt({
1488
1660
  className: e,
1489
1661
  scrollAnchor: t = !1,
1490
1662
  ...n
1491
1663
  }) {
1492
1664
  return /* @__PURE__ */ l(
1493
- ue.Item,
1665
+ _e.Item,
1494
1666
  {
1495
1667
  "data-slot": "message-scroller-item",
1496
1668
  scrollAnchor: t,
1497
- className: de("msg-scroller-item", e),
1669
+ className: we("msg-scroller-item", e),
1498
1670
  ...n
1499
1671
  }
1500
1672
  );
1501
1673
  }
1502
- function Gr({
1674
+ function Xr({
1503
1675
  direction: e = "end",
1504
1676
  className: t,
1505
1677
  children: n,
1506
1678
  ...r
1507
1679
  }) {
1508
1680
  return /* @__PURE__ */ l(
1509
- ue.Button,
1681
+ _e.Button,
1510
1682
  {
1511
1683
  "data-slot": "message-scroller-button",
1512
1684
  direction: e,
1513
- className: de("msg-scroller-btn", t),
1685
+ className: we("msg-scroller-btn", t),
1514
1686
  ...r,
1515
- children: n ?? /* @__PURE__ */ T(ke, { children: [
1687
+ children: n ?? /* @__PURE__ */ w(De, { children: [
1516
1688
  /* @__PURE__ */ l(
1517
1689
  Ot,
1518
1690
  {
@@ -1526,31 +1698,38 @@ function Gr({
1526
1698
  }
1527
1699
  );
1528
1700
  }
1529
- const Ur = () => /* @__PURE__ */ T("div", { className: "chat-empty-row", children: [
1701
+ const Zr = () => /* @__PURE__ */ w("div", { className: "chat-empty-row", children: [
1530
1702
  /* @__PURE__ */ l(
1531
1703
  "div",
1532
1704
  {
1533
1705
  className: "avatar-circle avatar-circle--mt",
1534
1706
  "aria-hidden": "true",
1535
- children: /* @__PURE__ */ l(it, { size: 15 })
1707
+ children: /* @__PURE__ */ l(pt, { size: 15 })
1536
1708
  }
1537
1709
  ),
1538
1710
  /* @__PURE__ */ l("div", { className: "chat-empty-bubble", 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." }) })
1539
1711
  ] });
1540
- function ee(e) {
1712
+ function en(e) {
1713
+ const t = e.trim();
1714
+ if (!/[\u0000-\u001f\u007f]/.test(t) && /^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))
1715
+ return t;
1716
+ }
1717
+ function te(e) {
1541
1718
  if (!e) return [];
1542
1719
  const t = /(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+)/g;
1543
1720
  return e.split(t).map((r, s) => {
1544
1721
  if (!r) return null;
1545
1722
  const o = r.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
1546
1723
  if (o) {
1547
- const a = o[1], i = o[2], c = /^https?:\/\//i.test(i);
1724
+ const a = o[1], i = o[2], u = en(i);
1725
+ if (!u) return /* @__PURE__ */ l(oe.Fragment, { children: a }, s);
1726
+ const h = /^https?:\/\//i.test(i);
1548
1727
  return /* @__PURE__ */ l(
1549
1728
  "a",
1550
1729
  {
1551
- href: i,
1552
- target: c ? "_blank" : void 0,
1553
- rel: c ? "noopener noreferrer" : void 0,
1730
+ href: u,
1731
+ target: h ? "_blank" : void 0,
1732
+ rel: h ? "noopener noreferrer" : void 0,
1554
1733
  className: "md-link",
1555
1734
  children: a
1556
1735
  },
@@ -1567,10 +1746,10 @@ function ee(e) {
1567
1746
  children: r
1568
1747
  },
1569
1748
  s
1570
- ) : /* @__PURE__ */ l(Ae.Fragment, { children: r }, s);
1749
+ ) : /* @__PURE__ */ l(oe.Fragment, { children: r }, s);
1571
1750
  });
1572
1751
  }
1573
- function jr(e) {
1752
+ function tn(e) {
1574
1753
  const t = e.replace(/\r\n/g, `
1575
1754
  `).split(`
1576
1755
  `), n = [];
@@ -1582,10 +1761,10 @@ function jr(e) {
1582
1761
  continue;
1583
1762
  }
1584
1763
  if (o.startsWith("```")) {
1585
- const c = o.slice(3).trim(), f = [];
1764
+ const u = o.slice(3).trim(), h = [];
1586
1765
  for (r++; r < t.length && !t[r].trim().startsWith("```"); )
1587
- f.push(t[r]), r++;
1588
- r < t.length && t[r].trim().startsWith("```") && r++, n.push({ type: "code", lang: c, code: f.join(`
1766
+ h.push(t[r]), r++;
1767
+ r < t.length && t[r].trim().startsWith("```") && r++, n.push({ type: "code", lang: u, code: h.join(`
1589
1768
  `) });
1590
1769
  continue;
1591
1770
  }
@@ -1603,33 +1782,33 @@ function jr(e) {
1603
1782
  continue;
1604
1783
  }
1605
1784
  if (o.startsWith(">")) {
1606
- const c = [];
1785
+ const u = [];
1607
1786
  for (; r < t.length && t[r].trim().startsWith(">"); )
1608
- c.push(t[r].trim().replace(/^>\s?/, "")), r++;
1609
- n.push({ type: "quote", lines: c });
1787
+ u.push(t[r].trim().replace(/^>\s?/, "")), r++;
1788
+ n.push({ type: "quote", lines: u });
1610
1789
  continue;
1611
1790
  }
1612
1791
  if (/^[-*]\s+/.test(o)) {
1613
- const c = [];
1792
+ const u = [];
1614
1793
  for (; r < t.length && /^[-*]\s+/.test(t[r].trim()); )
1615
- c.push(t[r].trim().replace(/^[-*]\s+/, "")), r++;
1616
- n.push({ type: "ul", items: c });
1794
+ u.push(t[r].trim().replace(/^[-*]\s+/, "")), r++;
1795
+ n.push({ type: "ul", items: u });
1617
1796
  continue;
1618
1797
  }
1619
1798
  if (/^\d+\.\s+/.test(o)) {
1620
- const c = [];
1799
+ const u = [];
1621
1800
  for (; r < t.length && /^\d+\.\s+/.test(t[r].trim()); )
1622
- c.push(t[r].trim().replace(/^\d+\.\s+/, "")), r++;
1623
- n.push({ type: "ol", items: c });
1801
+ u.push(t[r].trim().replace(/^\d+\.\s+/, "")), r++;
1802
+ n.push({ type: "ol", items: u });
1624
1803
  continue;
1625
1804
  }
1626
1805
  if (o.startsWith("|") && o.endsWith("|")) {
1627
- const c = [];
1806
+ const u = [];
1628
1807
  for (; r < t.length && t[r].trim().startsWith("|") && t[r].trim().endsWith("|"); )
1629
- c.push(t[r].trim()), r++;
1630
- if (c.length >= 2) {
1631
- const f = (d) => d.slice(1, -1).split("|").map((p) => p.trim()), g = f(c[0]), v = c[1].includes("-") ? 2 : 1, h = c.slice(v).map(f);
1632
- n.push({ type: "table", headers: g, rows: h });
1808
+ u.push(t[r].trim()), r++;
1809
+ if (u.length >= 2) {
1810
+ const h = (p) => p.slice(1, -1).split("|").map((b) => b.trim()), g = h(u[0]), f = u[1].includes("-") ? 2 : 1, c = u.slice(f).map(h);
1811
+ n.push({ type: "table", headers: g, rows: c });
1633
1812
  continue;
1634
1813
  }
1635
1814
  }
@@ -1640,157 +1819,315 @@ function jr(e) {
1640
1819
  }
1641
1820
  return n;
1642
1821
  }
1643
- const Yr = ({ text: e }) => {
1644
- if (!e) return null;
1645
- const t = jr(e);
1646
- return /* @__PURE__ */ l("div", { className: "md-content", children: t.map((n, r) => {
1647
- switch (n.type) {
1822
+ const rn = oe.memo(function({ text: t }) {
1823
+ if (!t) return null;
1824
+ const n = tn(t);
1825
+ return /* @__PURE__ */ l("div", { className: "md-content", children: n.map((r, s) => {
1826
+ switch (r.type) {
1648
1827
  case "h":
1649
- return n.level === 1 ? /* @__PURE__ */ l("h2", { className: "md-h1", children: ee(n.content) }, r) : n.level === 2 ? /* @__PURE__ */ l("h3", { className: "md-h2", children: ee(n.content) }, r) : n.level === 3 ? /* @__PURE__ */ l("h4", { className: "md-h3", children: ee(n.content) }, r) : /* @__PURE__ */ l("h5", { className: "md-h4", children: ee(n.content) }, r);
1828
+ return r.level === 1 ? /* @__PURE__ */ l("h2", { className: "md-h1", children: te(r.content) }, s) : r.level === 2 ? /* @__PURE__ */ l("h3", { className: "md-h2", children: te(r.content) }, s) : r.level === 3 ? /* @__PURE__ */ l("h4", { className: "md-h3", children: te(r.content) }, s) : /* @__PURE__ */ l("h5", { className: "md-h4", children: te(r.content) }, s);
1650
1829
  case "ul":
1651
- return /* @__PURE__ */ l("ul", { className: "md-ul", children: n.items.map((s, o) => /* @__PURE__ */ l("li", { className: "md-li", children: ee(s) }, o)) }, r);
1830
+ return /* @__PURE__ */ l("ul", { className: "md-ul", children: r.items.map((o, a) => /* @__PURE__ */ l("li", { className: "md-li", children: te(o) }, a)) }, s);
1652
1831
  case "ol":
1653
- return /* @__PURE__ */ l("ol", { className: "md-ol", children: n.items.map((s, o) => /* @__PURE__ */ l("li", { className: "md-li", children: ee(s) }, o)) }, r);
1832
+ return /* @__PURE__ */ l("ol", { className: "md-ol", children: r.items.map((o, a) => /* @__PURE__ */ l("li", { className: "md-li", children: te(o) }, a)) }, s);
1654
1833
  case "code":
1655
- return /* @__PURE__ */ l("pre", { className: "md-pre", children: /* @__PURE__ */ l("code", { children: n.code }) }, r);
1834
+ return /* @__PURE__ */ l("pre", { className: "md-pre", children: /* @__PURE__ */ l("code", { children: r.code }) }, s);
1656
1835
  case "quote":
1657
- return /* @__PURE__ */ l("blockquote", { className: "md-quote", children: n.lines.map((s, o) => /* @__PURE__ */ l("p", { children: ee(s) }, o)) }, r);
1836
+ return /* @__PURE__ */ l("blockquote", { className: "md-quote", children: r.lines.map((o, a) => /* @__PURE__ */ l("p", { children: te(o) }, a)) }, s);
1658
1837
  case "hr":
1659
- return /* @__PURE__ */ l("hr", { className: "md-hr" }, r);
1838
+ return /* @__PURE__ */ l("hr", { className: "md-hr" }, s);
1660
1839
  case "table":
1661
- return /* @__PURE__ */ l("div", { className: "md-table-wrap", children: /* @__PURE__ */ T("table", { className: "md-table", children: [
1662
- /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: n.headers.map((s, o) => /* @__PURE__ */ l("th", { children: ee(s) }, o)) }) }),
1663
- /* @__PURE__ */ l("tbody", { children: n.rows.map((s, o) => /* @__PURE__ */ l("tr", { children: s.map((a, i) => /* @__PURE__ */ l("td", { children: ee(a) }, i)) }, o)) })
1664
- ] }) }, r);
1840
+ return /* @__PURE__ */ l("div", { className: "md-table-wrap", children: /* @__PURE__ */ w("table", { className: "md-table", children: [
1841
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: r.headers.map((o, a) => /* @__PURE__ */ l("th", { children: te(o) }, a)) }) }),
1842
+ /* @__PURE__ */ l("tbody", { children: r.rows.map((o, a) => /* @__PURE__ */ l("tr", { children: o.map((i, u) => /* @__PURE__ */ l("td", { children: te(i) }, u)) }, a)) })
1843
+ ] }) }, s);
1665
1844
  case "p":
1666
1845
  default:
1667
- return /* @__PURE__ */ l("p", { className: "md-p", children: n.lines.map((s, o) => /* @__PURE__ */ T(Ae.Fragment, { children: [
1668
- ee(s),
1669
- o < n.lines.length - 1 && /* @__PURE__ */ l("br", {})
1670
- ] }, o)) }, r);
1846
+ return /* @__PURE__ */ l("p", { className: "md-p", children: r.lines.map((o, a) => /* @__PURE__ */ w(oe.Fragment, { children: [
1847
+ te(o),
1848
+ a < r.lines.length - 1 && /* @__PURE__ */ l("br", {})
1849
+ ] }, a)) }, s);
1671
1850
  }
1672
1851
  }) });
1673
- }, Jr = ({ className: e, text: t }) => /* @__PURE__ */ l(
1852
+ }), nn = ({ className: e, text: t }) => /* @__PURE__ */ w(
1674
1853
  "div",
1675
1854
  {
1676
- className: de("typing-indicator-container", e),
1855
+ className: we("typing-indicator-container", e),
1677
1856
  role: "status",
1678
1857
  "aria-label": "Assistant is preparing a reply",
1679
- children: /* @__PURE__ */ l("div", { className: "typing-progress-pill", children: /* @__PURE__ */ l("span", { className: "typing-progress-text", children: t || "Retrieving knowledge & generating answer ..." }) })
1858
+ children: [
1859
+ /* @__PURE__ */ w("div", { className: "typing-indicator", "aria-hidden": "true", children: [
1860
+ /* @__PURE__ */ l("span", { className: "typing-dot" }),
1861
+ /* @__PURE__ */ l("span", { className: "typing-dot" }),
1862
+ /* @__PURE__ */ l("span", { className: "typing-dot" })
1863
+ ] }),
1864
+ t && /* @__PURE__ */ l("div", { className: "typing-progress-pill", children: t })
1865
+ ]
1680
1866
  }
1681
- ), Zr = ({
1867
+ ), sn = ({
1682
1868
  status: e = "complete",
1683
1869
  progressText: t,
1684
- sourcesCount: n = 5,
1685
- durationMs: r = 1800
1870
+ durationMs: n
1686
1871
  }) => {
1687
- const s = e === "pending", [o, a] = K(s), [i, c] = K(0);
1688
- ie(() => {
1689
- if (!s) return;
1690
- a(!0);
1691
- const g = Date.now(), v = setInterval(() => {
1692
- c(Number(((Date.now() - g) / 1e3).toFixed(1)));
1693
- }, 100);
1694
- return () => clearInterval(v);
1695
- }, [s]), ie(() => {
1696
- s || a(!1);
1697
- }, [s]);
1698
- const f = s ? `${i}s` : `${(r / 1e3).toFixed(1)}s`;
1699
- return /* @__PURE__ */ l("div", { className: `agent-reasoning-container${s ? " agent-reasoning--active" : ""}`, children: /* @__PURE__ */ l(
1872
+ const r = e === "pending", [s, o] = U(0);
1873
+ ke(() => {
1874
+ if (!r) return;
1875
+ const i = Date.now(), u = setInterval(() => {
1876
+ o(Number(((Date.now() - i) / 1e3).toFixed(1)));
1877
+ }, 250);
1878
+ return () => clearInterval(u);
1879
+ }, [r]);
1880
+ const a = r ? `${s.toFixed(1)}s` : n === void 0 ? void 0 : `${(n / 1e3).toFixed(1)}s`;
1881
+ return /* @__PURE__ */ l("div", { className: `agent-reasoning-container${r ? " agent-reasoning--active" : ""}`, children: /* @__PURE__ */ l(
1700
1882
  "div",
1701
1883
  {
1702
1884
  className: "agent-reasoning-header",
1703
- "aria-expanded": o,
1704
- children: /* @__PURE__ */ T("div", { className: "agent-reasoning-header-left", children: [
1705
- /* @__PURE__ */ l(
1706
- $t,
1885
+ role: "status",
1886
+ "aria-live": "off",
1887
+ children: /* @__PURE__ */ w("div", { className: "agent-reasoning-header-left", children: [
1888
+ r ? /* @__PURE__ */ l(
1889
+ Kt,
1890
+ {
1891
+ size: 13,
1892
+ className: "agent-reasoning-spinner",
1893
+ "aria-hidden": "true"
1894
+ }
1895
+ ) : /* @__PURE__ */ l(
1896
+ Ut,
1707
1897
  {
1708
1898
  size: 13,
1709
- className: `agent-reasoning-brain-icon${s ? " agent-reasoning-brain--pulse" : ""}`
1899
+ className: "agent-reasoning-done-icon",
1900
+ "aria-hidden": "true"
1710
1901
  }
1711
1902
  ),
1712
- /* @__PURE__ */ l("span", { className: "agent-reasoning-title", children: s ? `Thinking (${f})...` : `Thought for ${f} ` })
1903
+ /* @__PURE__ */ l("span", { className: "agent-reasoning-title", children: r ? `${t || "Working…"} · ${a}` : a ? `Response generated in ${a}` : "Response generated" })
1713
1904
  ] })
1714
1905
  }
1715
1906
  ) });
1907
+ }, on = {
1908
+ "fuel-defect-reporting": {
1909
+ label: "Fuel Defect Reporting",
1910
+ path: "/dashboard/fuel-Defect-Reporting"
1911
+ },
1912
+ "bunker-master": {
1913
+ label: "Bunker Master",
1914
+ path: "/dashboard/bunker-master"
1915
+ },
1916
+ "fsc-fsq-e-forms": {
1917
+ label: "Pre-Registration & E-Forms",
1918
+ path: "/dashboard/pre-registration"
1919
+ },
1920
+ "pre-registration-ship": {
1921
+ label: "Pre-Registration",
1922
+ path: "/dashboard/pre-registration"
1923
+ },
1924
+ "reports-fuel": {
1925
+ label: "Fuel Reports",
1926
+ path: "/dashboard/reports"
1927
+ },
1928
+ "sample-fuel": {
1929
+ label: "Sample Status",
1930
+ path: "/dashboard/sample-status"
1931
+ }
1716
1932
  };
1717
- function Kr(e) {
1933
+ function ln(e) {
1934
+ const n = (e.split(/[/\\]/).pop() || "").replace(/\.md$/i, "").toLowerCase();
1935
+ for (const [r, s] of Object.entries(on))
1936
+ if (n.includes(r))
1937
+ return s;
1938
+ return null;
1939
+ }
1940
+ function st(e) {
1941
+ return e.title ? e.title : (e.source.split(/[/\\]/).pop() || e.source).replace(/\.md$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
1942
+ }
1943
+ const an = ({
1944
+ sources: e,
1945
+ hideInspectSources: t = !1,
1946
+ showInspectSources: n = !0,
1947
+ defaultExpanded: r = !1,
1948
+ maxSources: s = 5
1949
+ }) => {
1950
+ const o = t || n === !1, [a, i] = U(r && !o), [u, h] = U(null);
1951
+ if (!e || !e.length) return null;
1952
+ const g = e.slice(0, s);
1953
+ return /* @__PURE__ */ w("div", { className: "grounded-sources-card", children: [
1954
+ /* @__PURE__ */ w("div", { className: "grounded-sources-header", children: [
1955
+ /* @__PURE__ */ w("div", { className: "grounded-sources-badge", children: [
1956
+ /* @__PURE__ */ l(er, { size: 13, className: "grounded-shield-icon" }),
1957
+ /* @__PURE__ */ w("span", { children: [
1958
+ g.length,
1959
+ " retrieved VPS sources"
1960
+ ] })
1961
+ ] }),
1962
+ !o && /* @__PURE__ */ w(
1963
+ "button",
1964
+ {
1965
+ type: "button",
1966
+ className: "grounded-toggle-btn",
1967
+ onClick: () => i((f) => !f),
1968
+ "aria-expanded": a,
1969
+ children: [
1970
+ /* @__PURE__ */ l("span", { children: a ? "Hide Details" : "Inspect Sources" }),
1971
+ a ? /* @__PURE__ */ l(Gt, { size: 12 }) : /* @__PURE__ */ l(Vt, { size: 12 })
1972
+ ]
1973
+ }
1974
+ )
1975
+ ] }),
1976
+ /* @__PURE__ */ l("div", { className: "grounded-pills-row", children: g.map((f, c) => {
1977
+ const p = st(f), b = u === c;
1978
+ return /* @__PURE__ */ w(
1979
+ "button",
1980
+ {
1981
+ type: "button",
1982
+ className: `grounded-source-pill${b ? " grounded-source-pill--selected" : ""}`,
1983
+ onClick: () => {
1984
+ o || (i(!0), h(b ? null : c));
1985
+ },
1986
+ title: f.source,
1987
+ children: [
1988
+ /* @__PURE__ */ l(zt, { size: 11, className: "grounded-book-icon" }),
1989
+ /* @__PURE__ */ w("span", { className: "grounded-pill-title", children: [
1990
+ "[S",
1991
+ c + 1,
1992
+ "] ",
1993
+ p
1994
+ ] }),
1995
+ /* @__PURE__ */ w("span", { className: "grounded-pill-score", title: "Ranking score, not a probability of correctness", children: [
1996
+ "Score ",
1997
+ f.score.toFixed(2)
1998
+ ] })
1999
+ ]
2000
+ },
2001
+ `${f.chunkId}-${c}`
2002
+ );
2003
+ }) }),
2004
+ !o && a && /* @__PURE__ */ l("div", { className: "grounded-sources-details-list", children: g.map((f, c) => {
2005
+ const p = st(f), b = ln(f.source);
2006
+ return /* @__PURE__ */ w(
2007
+ "div",
2008
+ {
2009
+ className: `grounded-detail-item${u === c ? " grounded-detail-item--highlighted" : ""}`,
2010
+ children: [
2011
+ /* @__PURE__ */ w("div", { className: "grounded-detail-top", children: [
2012
+ /* @__PURE__ */ w("div", { className: "grounded-detail-title-group", children: [
2013
+ /* @__PURE__ */ w("span", { className: "grounded-detail-index", children: [
2014
+ "[",
2015
+ c + 1,
2016
+ "]"
2017
+ ] }),
2018
+ /* @__PURE__ */ l("span", { className: "grounded-detail-title", children: p })
2019
+ ] }),
2020
+ /* @__PURE__ */ w("div", { className: "grounded-detail-meta", children: [
2021
+ /* @__PURE__ */ w("span", { className: "grounded-detail-score", children: [
2022
+ "Rank score ",
2023
+ f.score.toFixed(2)
2024
+ ] }),
2025
+ b && /* @__PURE__ */ w(
2026
+ "a",
2027
+ {
2028
+ href: b.path,
2029
+ onClick: (v) => {
2030
+ v.preventDefault(), window.location.href = b.path;
2031
+ },
2032
+ className: "grounded-route-link",
2033
+ title: `Navigate to ${b.label}`,
2034
+ children: [
2035
+ /* @__PURE__ */ l("span", { children: b.label }),
2036
+ /* @__PURE__ */ l(Yt, { size: 10 })
2037
+ ]
2038
+ }
2039
+ )
2040
+ ] })
2041
+ ] }),
2042
+ /* @__PURE__ */ l("div", { className: "grounded-detail-path", children: /* @__PURE__ */ l("code", { children: f.source }) }),
2043
+ f.snippet && /* @__PURE__ */ w("p", { className: "grounded-detail-snippet", children: [
2044
+ '"',
2045
+ f.snippet,
2046
+ '"'
2047
+ ] })
2048
+ ]
2049
+ },
2050
+ `detail-${f.chunkId}-${c}`
2051
+ );
2052
+ }) })
2053
+ ] });
2054
+ };
2055
+ function cn(e) {
1718
2056
  return e === "create_ticket" ? "Support ticket processed" : e === "get_customer" ? "Account verified" : e === "get_ticket" ? "Ticket status loaded" : "Information retrieved";
1719
2057
  }
1720
- function Qr({ toolCalls: e }) {
2058
+ function un({ toolCalls: e }) {
1721
2059
  return e.length ? /* @__PURE__ */ l("div", { className: "tool-badges", children: e.map((t, n) => /* @__PURE__ */ l(
1722
2060
  "span",
1723
2061
  {
1724
2062
  className: "tool-badge",
1725
- children: Kr(t.toolName)
2063
+ children: cn(t.toolName)
1726
2064
  },
1727
2065
  `${t.toolName}-${n}`
1728
2066
  )) }) : null;
1729
2067
  }
1730
- const Xr = ({ message: e }) => {
1731
- var c;
1732
- const t = Me();
1733
- t == null || t.hideInspectSources, t == null || t.showGroundedSources;
1734
- const n = e.role === "user", r = e.status === "error", s = e.status === "pending", o = e.id === "welcome-default" || e.id.startsWith("welcome") || e.id === "welcome", a = !!(s || e.sources && e.sources.length > 0 || e.toolCalls && e.toolCalls.length > 0 || e.usage);
1735
- return /* @__PURE__ */ T("div", { className: `msg-row${n ? " msg-row--user" : ""}`, children: [
1736
- !n && /* @__PURE__ */ l(
2068
+ const dn = ({ message: e }) => {
2069
+ var g;
2070
+ const t = Ge(), n = (t == null ? void 0 : t.hideInspectSources) ?? !1, r = (t == null ? void 0 : t.showGroundedSources) ?? !0, s = e.role === "user", o = e.status === "error", a = e.status === "pending", i = e.id === "welcome-default" || e.id.startsWith("welcome") || e.id === "welcome", u = !!(a || e.durationMs !== void 0 || e.sources && e.sources.length > 0 || e.toolCalls && e.toolCalls.length > 0 || e.usage);
2071
+ return /* @__PURE__ */ w("div", { className: `msg-row${s ? " msg-row--user" : ""}`, children: [
2072
+ !s && /* @__PURE__ */ l(
1737
2073
  "div",
1738
2074
  {
1739
2075
  className: "avatar-circle avatar-circle--mt",
1740
2076
  "aria-hidden": "true",
1741
- children: /* @__PURE__ */ l(it, { size: 15 })
2077
+ children: /* @__PURE__ */ l(pt, { size: 15 })
1742
2078
  }
1743
2079
  ),
1744
- /* @__PURE__ */ T("div", { className: `msg-col${n ? " msg-col--user" : ""}`, children: [
1745
- /* @__PURE__ */ T(
2080
+ /* @__PURE__ */ w("div", { className: `msg-col${s ? " msg-col--user" : ""}`, children: [
2081
+ /* @__PURE__ */ w(
1746
2082
  "div",
1747
2083
  {
1748
- className: n ? "msg-bubble msg-bubble--user" : r ? "msg-bubble msg-bubble--error" : "msg-bubble msg-bubble--bot",
2084
+ className: s ? "msg-bubble msg-bubble--user" : o ? "msg-bubble msg-bubble--error" : "msg-bubble msg-bubble--bot",
1749
2085
  children: [
1750
- !n && !r && !o && a && /* @__PURE__ */ l(
1751
- Zr,
2086
+ !s && !o && !i && u && /* @__PURE__ */ l(
2087
+ sn,
1752
2088
  {
1753
- status: s ? "pending" : "complete",
2089
+ status: a ? "pending" : "complete",
1754
2090
  progressText: e.progressText,
1755
- sourcesCount: ((c = e.sources) == null ? void 0 : c.length) || 5
2091
+ durationMs: e.durationMs
1756
2092
  }
1757
2093
  ),
1758
- s ? /* @__PURE__ */ l(Jr, { text: e.progressText }) : n ? /* @__PURE__ */ l("p", { className: "msg-user-pre", children: e.content }) : /* @__PURE__ */ l("div", { className: "msg-content-wrapper", children: /* @__PURE__ */ l(Yr, { text: e.content }) }),
1759
- e.toolCalls ? /* @__PURE__ */ l(Qr, { toolCalls: e.toolCalls }) : null
2094
+ a ? e.content ? /* @__PURE__ */ l("div", { className: "msg-content-wrapper msg-content-wrapper--streaming", children: /* @__PURE__ */ l("div", { className: "msg-streaming-text", children: e.content }) }) : /* @__PURE__ */ l(nn, {}) : s ? /* @__PURE__ */ l("p", { className: "msg-user-pre", children: e.content }) : /* @__PURE__ */ l("div", { className: "msg-content-wrapper", children: /* @__PURE__ */ l(rn, { text: e.content }) }),
2095
+ e.toolCalls ? /* @__PURE__ */ l(un, { toolCalls: e.toolCalls }) : null,
2096
+ !s && !a && !o && r && ((g = e.sources) != null && g.length) ? /* @__PURE__ */ l(an, { sources: e.sources, hideInspectSources: n }) : null
1760
2097
  ]
1761
2098
  }
1762
2099
  ),
1763
- n && e.status !== "error" && /* @__PURE__ */ l(Ht, { size: 13, className: "msg-tick", "aria-hidden": "true" })
2100
+ s && e.status !== "error" && /* @__PURE__ */ l(Wt, { size: 13, className: "msg-tick", "aria-hidden": "true" })
1764
2101
  ] })
1765
2102
  ] });
1766
- }, en = () => {
1767
- const { messages: e, status: t, showSuggestions: n } = Ce();
2103
+ }, hn = () => {
2104
+ const { messages: e, status: t, showSuggestions: n } = Be();
1768
2105
  return /* @__PURE__ */ l(
1769
- $r,
2106
+ Yr,
1770
2107
  {
1771
2108
  autoScroll: !0,
1772
2109
  defaultScrollPosition: "last-anchor",
1773
2110
  scrollPreviousItemPeek: 64,
1774
- children: /* @__PURE__ */ T(Hr, { children: [
1775
- /* @__PURE__ */ l(Vr, { "aria-label": "Chat messages", children: /* @__PURE__ */ T(zr, { "aria-busy": t === "awaiting" || t === "connecting", children: [
1776
- e.length === 0 && /* @__PURE__ */ l(Xe, { messageId: "welcome", children: /* @__PURE__ */ l(Ur, {}) }),
2111
+ children: /* @__PURE__ */ w(Jr, { children: [
2112
+ /* @__PURE__ */ l(Kr, { "aria-label": "Chat messages", children: /* @__PURE__ */ w(Qr, { "aria-busy": t === "awaiting" || t === "connecting", children: [
2113
+ e.length === 0 && /* @__PURE__ */ l(nt, { messageId: "welcome", children: /* @__PURE__ */ l(Zr, {}) }),
1777
2114
  e.map((s) => /* @__PURE__ */ l(
1778
- Xe,
2115
+ nt,
1779
2116
  {
1780
2117
  messageId: s.id,
1781
2118
  scrollAnchor: s.role === "user",
1782
- children: /* @__PURE__ */ l(Xr, { message: s })
2119
+ children: /* @__PURE__ */ l(dn, { message: s })
1783
2120
  },
1784
2121
  s.id
1785
2122
  ))
1786
2123
  ] }) }),
1787
- /* @__PURE__ */ l(Gr, {})
2124
+ /* @__PURE__ */ l(Xr, {})
1788
2125
  ] })
1789
2126
  }
1790
2127
  );
1791
- }, tn = () => {
1792
- const { pendingTicket: e, ticketBusy: t, userContext: n, confirmTicket: r, cancelTicket: s } = Ce(), o = !n.customerId && !n.email, [a, i] = K("");
1793
- return e ? /* @__PURE__ */ T(
2128
+ }, pn = () => {
2129
+ const { pendingTicket: e, ticketBusy: t, userContext: n, confirmTicket: r, cancelTicket: s } = Be(), o = !n.customerId && !n.email, [a, i] = U("");
2130
+ return e ? /* @__PURE__ */ w(
1794
2131
  "div",
1795
2132
  {
1796
2133
  className: "ticket-card",
@@ -1800,20 +2137,20 @@ const Xr = ({ message: e }) => {
1800
2137
  /* @__PURE__ */ l("h3", { className: "ticket-card-title", children: "Create support ticket?" }),
1801
2138
  /* @__PURE__ */ l("p", { className: "ticket-card-desc", children: "I can open a support request for you. Nothing is created until you confirm." }),
1802
2139
  /* @__PURE__ */ l("p", { className: "ticket-card-body", children: e.description }),
1803
- o && /* @__PURE__ */ T("label", { className: "ticket-id-label", children: [
2140
+ o && /* @__PURE__ */ w("label", { className: "ticket-id-label", children: [
1804
2141
  "Customer ID or email",
1805
2142
  /* @__PURE__ */ l(
1806
2143
  "input",
1807
2144
  {
1808
2145
  value: a,
1809
- onChange: (c) => i(c.target.value),
2146
+ onChange: (u) => i(u.target.value),
1810
2147
  className: "ticket-id-input",
1811
2148
  placeholder: "CUST-1001 or you@company.com",
1812
2149
  autoComplete: "email"
1813
2150
  }
1814
2151
  )
1815
2152
  ] }),
1816
- /* @__PURE__ */ T("div", { className: "ticket-actions", children: [
2153
+ /* @__PURE__ */ w("div", { className: "ticket-actions", children: [
1817
2154
  /* @__PURE__ */ l(
1818
2155
  "button",
1819
2156
  {
@@ -1838,7 +2175,7 @@ const Xr = ({ message: e }) => {
1838
2175
  ]
1839
2176
  }
1840
2177
  ) : null;
1841
- }, _t = ({
2178
+ }, St = ({
1842
2179
  className: e,
1843
2180
  onClose: t,
1844
2181
  showMinimize: n,
@@ -1847,15 +2184,15 @@ const Xr = ({ message: e }) => {
1847
2184
  envStage: o,
1848
2185
  envPulse: a = !0
1849
2186
  }) => {
1850
- const { sendMessage: i, status: c, error: f, resetConversation: g, retryLast: v, pendingTicket: h } = Ce(), d = c === "awaiting" || c === "connecting" || !!h;
1851
- return /* @__PURE__ */ T(
2187
+ const { sendMessage: i, status: u, error: h, resetConversation: g, retryLast: f, pendingTicket: c } = Be(), p = u === "awaiting" || u === "connecting" || !!c;
2188
+ return /* @__PURE__ */ w(
1852
2189
  "section",
1853
2190
  {
1854
2191
  className: `chat-panel${e ? ` ${e}` : ""}`,
1855
2192
  "aria-label": "VPS AI Assistant",
1856
2193
  children: [
1857
2194
  /* @__PURE__ */ l(
1858
- Xt,
2195
+ lr,
1859
2196
  {
1860
2197
  title: r,
1861
2198
  subtitle: s,
@@ -1866,20 +2203,20 @@ const Xr = ({ message: e }) => {
1866
2203
  envPulse: a
1867
2204
  }
1868
2205
  ),
1869
- /* @__PURE__ */ l("div", { className: "chat-panel-body", children: /* @__PURE__ */ l(en, {}) }),
1870
- f && c === "error" && /* @__PURE__ */ l(Nt, { message: f, onRetry: () => void v() }),
1871
- /* @__PURE__ */ l(tn, {}),
2206
+ /* @__PURE__ */ l("div", { className: "chat-panel-body", children: /* @__PURE__ */ l(hn, {}) }),
2207
+ h && u === "error" && /* @__PURE__ */ l(Pt, { message: h, onRetry: () => void f() }),
2208
+ /* @__PURE__ */ l(pn, {}),
1872
2209
  /* @__PURE__ */ l(
1873
- nr,
2210
+ ur,
1874
2211
  {
1875
- onSend: (p) => void i(p),
1876
- disabled: d
2212
+ onSend: (b) => void i(b),
2213
+ disabled: p
1877
2214
  }
1878
2215
  )
1879
2216
  ]
1880
2217
  }
1881
2218
  );
1882
- }, rn = ({
2219
+ }, fn = ({
1883
2220
  open: e,
1884
2221
  onClose: t,
1885
2222
  envStage: n,
@@ -1890,7 +2227,7 @@ const Xr = ({ message: e }) => {
1890
2227
  id: "vps-chatbot-widget-panel",
1891
2228
  className: "widget-panel",
1892
2229
  children: /* @__PURE__ */ l(
1893
- _t,
2230
+ St,
1894
2231
  {
1895
2232
  onClose: t,
1896
2233
  showMinimize: !0,
@@ -1900,7 +2237,7 @@ const Xr = ({ message: e }) => {
1900
2237
  }
1901
2238
  )
1902
2239
  }
1903
- ) : null, nn = ({
2240
+ ) : null, mn = ({
1904
2241
  open: e,
1905
2242
  onToggle: t
1906
2243
  }) => /* @__PURE__ */ l(
@@ -1912,31 +2249,31 @@ const Xr = ({ message: e }) => {
1912
2249
  "aria-controls": "vps-chatbot-widget-panel",
1913
2250
  "aria-label": e ? "Close assistant" : "Open assistant",
1914
2251
  className: "widget-trigger-btn",
1915
- children: e ? /* @__PURE__ */ l(Jt, { size: 22 }) : /* @__PURE__ */ l(ct, { size: 24 })
2252
+ children: e ? /* @__PURE__ */ l(rr, { size: 22 }) : /* @__PURE__ */ l(ft, { size: 24 })
1916
2253
  }
1917
- ), et = ({
2254
+ ), ot = ({
1918
2255
  defaultOpen: e = !1,
1919
2256
  open: t,
1920
2257
  onOpenChange: n,
1921
2258
  envStage: r,
1922
2259
  envPulse: s = !0
1923
2260
  }) => {
1924
- const [o, a] = K(e), i = t ?? o, c = (f) => {
1925
- n == null || n(f), t === void 0 && a(f);
2261
+ const [o, a] = U(e), i = t ?? o, u = (h) => {
2262
+ n == null || n(h), t === void 0 && a(h);
1926
2263
  };
1927
- return /* @__PURE__ */ T(ke, { children: [
2264
+ return /* @__PURE__ */ w(De, { children: [
1928
2265
  /* @__PURE__ */ l(
1929
- rn,
2266
+ fn,
1930
2267
  {
1931
2268
  open: i,
1932
- onClose: () => c(!1),
2269
+ onClose: () => u(!1),
1933
2270
  envStage: r,
1934
2271
  envPulse: s
1935
2272
  }
1936
2273
  ),
1937
- /* @__PURE__ */ l(nn, { open: i, onToggle: () => c(!i) })
2274
+ /* @__PURE__ */ l(mn, { open: i, onToggle: () => u(!i) })
1938
2275
  ] });
1939
- }, pn = ({
2276
+ }, Fn = ({
1940
2277
  apiBaseUrl: e,
1941
2278
  apiUrl: t,
1942
2279
  proxyUrl: n,
@@ -1945,39 +2282,41 @@ const Xr = ({ message: e }) => {
1945
2282
  roleId: o,
1946
2283
  client: a,
1947
2284
  welcomeMessage: i,
1948
- suggestions: c,
1949
- disableSuggestions: f,
2285
+ suggestions: u,
2286
+ disableSuggestions: h,
1950
2287
  initialMessage: g,
1951
- hideInspectSources: v,
1952
- showGroundedSources: h,
1953
- ...d
2288
+ hideInspectSources: f,
2289
+ showGroundedSources: c,
2290
+ modelId: p,
2291
+ ...b
1954
2292
  }) => {
1955
- const p = Me(), y = e ?? t ?? n;
1956
- return !!p && (!y || ce(y) === ce(p == null ? void 0 : p.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !c && f === void 0 && !g && v === void 0 && h === void 0 ? /* @__PURE__ */ l(et, { ...d }) : /* @__PURE__ */ l(
1957
- lt,
2293
+ const k = Ge(), v = e ?? t ?? n;
2294
+ return !!k && (!v || ve(v) === ve(k == null ? void 0 : k.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !u && h === void 0 && !g && f === void 0 && c === void 0 && p === void 0 ? /* @__PURE__ */ l(ot, { ...b }) : /* @__PURE__ */ l(
2295
+ dt,
1958
2296
  {
1959
- apiBaseUrl: y,
2297
+ apiBaseUrl: v,
1960
2298
  userContext: r,
1961
2299
  role: s,
1962
2300
  roleId: o,
1963
2301
  client: a,
1964
2302
  welcomeMessage: i,
1965
- suggestions: c,
1966
- disableSuggestions: f,
2303
+ suggestions: u,
2304
+ disableSuggestions: h,
1967
2305
  initialMessage: g,
1968
- hideInspectSources: v,
1969
- showGroundedSources: h,
1970
- children: /* @__PURE__ */ l(et, { ...d })
2306
+ hideInspectSources: f,
2307
+ showGroundedSources: c,
2308
+ modelId: p,
2309
+ children: /* @__PURE__ */ l(ot, { ...b })
1971
2310
  }
1972
2311
  );
1973
- }, sn = ({
2312
+ }, gn = ({
1974
2313
  open: e,
1975
2314
  onClose: t,
1976
2315
  subtitle: n,
1977
2316
  title: r,
1978
2317
  envStage: s,
1979
2318
  envPulse: o = !0
1980
- }) => /* @__PURE__ */ T(ke, { children: [
2319
+ }) => /* @__PURE__ */ w(De, { children: [
1981
2320
  /* @__PURE__ */ l(
1982
2321
  "div",
1983
2322
  {
@@ -1994,7 +2333,7 @@ const Xr = ({ message: e }) => {
1994
2333
  className: `embedded-panel ${e ? "embedded-panel--open" : "embedded-panel--closed"}`,
1995
2334
  "aria-hidden": !e,
1996
2335
  children: e && /* @__PURE__ */ l(
1997
- _t,
2336
+ St,
1998
2337
  {
1999
2338
  onClose: t,
2000
2339
  title: r || "VPS AI Assistant",
@@ -2005,20 +2344,20 @@ const Xr = ({ message: e }) => {
2005
2344
  )
2006
2345
  }
2007
2346
  )
2008
- ] }), on = 5, Te = 8, wt = "vps-embedded-assistant-top";
2009
- function ln(e, t, n) {
2347
+ ] }), bn = 5, $e = 8, Ft = "vps-embedded-assistant-top";
2348
+ function vn(e, t, n) {
2010
2349
  return Math.min(n, Math.max(t, e));
2011
2350
  }
2012
- function tt(e, t) {
2351
+ function lt(e, t) {
2013
2352
  const n = Math.max(
2014
- Te,
2015
- window.innerHeight - t - Te
2353
+ $e,
2354
+ window.innerHeight - t - $e
2016
2355
  );
2017
- return ln(e, Te, n);
2356
+ return vn(e, $e, n);
2018
2357
  }
2019
- function an() {
2358
+ function _n() {
2020
2359
  try {
2021
- const e = window.localStorage.getItem(wt);
2360
+ const e = window.localStorage.getItem(Ft);
2022
2361
  if (!e) return null;
2023
2362
  const t = Number(e);
2024
2363
  return Number.isFinite(t) ? t : null;
@@ -2026,78 +2365,78 @@ function an() {
2026
2365
  return null;
2027
2366
  }
2028
2367
  }
2029
- function cn(e) {
2368
+ function wn(e) {
2030
2369
  try {
2031
- window.localStorage.setItem(wt, String(e));
2370
+ window.localStorage.setItem(Ft, String(e));
2032
2371
  } catch {
2033
2372
  }
2034
2373
  }
2035
- const un = ({
2374
+ const yn = ({
2036
2375
  onOpen: e
2037
2376
  }) => {
2038
- const t = se(null), n = se({
2377
+ const t = re(null), n = re({
2039
2378
  pointerId: null,
2040
2379
  startY: 0,
2041
2380
  startTop: 0,
2042
2381
  moved: !1
2043
- }), [r, s] = K(
2044
- () => typeof window > "u" ? null : an()
2045
- ), o = se(r), a = se(!1), [i, c] = K(!1);
2046
- ie(() => {
2382
+ }), [r, s] = U(
2383
+ () => typeof window > "u" ? null : _n()
2384
+ ), o = re(r), a = re(!1), [i, u] = U(!1);
2385
+ ke(() => {
2047
2386
  o.current = r;
2048
- }, [r]), ie(() => {
2049
- const h = t.current;
2050
- if (!h) return;
2051
- const d = () => {
2052
- s((p) => {
2053
- const y = p ?? Math.round(window.innerHeight / 2 - h.offsetHeight / 2), b = tt(y, h.offsetHeight);
2054
- return o.current = b, b;
2387
+ }, [r]), ke(() => {
2388
+ const c = t.current;
2389
+ if (!c) return;
2390
+ const p = () => {
2391
+ s((b) => {
2392
+ const k = b ?? Math.round(window.innerHeight / 2 - c.offsetHeight / 2), v = lt(k, c.offsetHeight);
2393
+ return o.current = v, v;
2055
2394
  });
2056
2395
  };
2057
- return d(), window.addEventListener("resize", d), () => window.removeEventListener("resize", d);
2396
+ return p(), window.addEventListener("resize", p), () => window.removeEventListener("resize", p);
2058
2397
  }, []);
2059
- const f = (h) => {
2060
- if (h.button !== 0) return;
2061
- const d = h.currentTarget, p = d.getBoundingClientRect();
2398
+ const h = (c) => {
2399
+ if (c.button !== 0) return;
2400
+ const p = c.currentTarget, b = p.getBoundingClientRect();
2062
2401
  n.current = {
2063
- pointerId: h.pointerId,
2064
- startY: h.clientY,
2065
- startTop: p.top,
2402
+ pointerId: c.pointerId,
2403
+ startY: c.clientY,
2404
+ startTop: b.top,
2066
2405
  moved: !1
2067
2406
  };
2068
2407
  try {
2069
- d.setPointerCapture(h.pointerId);
2408
+ p.setPointerCapture(c.pointerId);
2070
2409
  } catch {
2071
2410
  }
2072
- }, g = (h) => {
2073
- if (n.current.pointerId !== h.pointerId) return;
2074
- const d = h.clientY - n.current.startY;
2075
- if (!n.current.moved && Math.abs(d) < on) return;
2076
- n.current.moved = !0, c(!0);
2077
- const p = tt(
2078
- n.current.startTop + d,
2079
- h.currentTarget.offsetHeight
2411
+ }, g = (c) => {
2412
+ if (n.current.pointerId !== c.pointerId) return;
2413
+ const p = c.clientY - n.current.startY;
2414
+ if (!n.current.moved && Math.abs(p) < bn) return;
2415
+ n.current.moved = !0, u(!0);
2416
+ const b = lt(
2417
+ n.current.startTop + p,
2418
+ c.currentTarget.offsetHeight
2080
2419
  );
2081
- o.current = p, s(p);
2082
- }, v = (h) => {
2083
- var p, y;
2084
- if (n.current.pointerId !== h.pointerId) return;
2420
+ o.current = b, s(b);
2421
+ }, f = (c) => {
2422
+ var b, k;
2423
+ if (n.current.pointerId !== c.pointerId) return;
2085
2424
  try {
2086
- (y = (p = h.currentTarget).hasPointerCapture) != null && y.call(p, h.pointerId) && h.currentTarget.releasePointerCapture(h.pointerId);
2425
+ (k = (b = c.currentTarget).hasPointerCapture) != null && k.call(b, c.pointerId) && c.currentTarget.releasePointerCapture(c.pointerId);
2087
2426
  } catch {
2088
2427
  }
2089
- const d = n.current.moved;
2090
- n.current.pointerId = null, n.current.moved = !1, c(!1), d && (a.current = !0, o.current != null && cn(o.current));
2428
+ const p = n.current.moved;
2429
+ n.current.pointerId = null, n.current.moved = !1, u(!1), p && (a.current = !0, o.current != null && wn(o.current));
2091
2430
  };
2092
- return /* @__PURE__ */ T(
2431
+ return /* @__PURE__ */ w(
2093
2432
  "button",
2094
2433
  {
2095
2434
  ref: t,
2096
2435
  type: "button",
2097
- onPointerDown: f,
2436
+ onPointerDown: h,
2098
2437
  onPointerMove: g,
2099
- onPointerUp: v,
2100
- onPointerCancel: v,
2438
+ onPointerUp: f,
2439
+ onPointerCancel: f,
2101
2440
  onClick: () => {
2102
2441
  if (a.current) {
2103
2442
  a.current = !1;
@@ -2114,12 +2453,12 @@ const un = ({
2114
2453
  transform: r == null ? "translateY(-50%)" : void 0
2115
2454
  },
2116
2455
  children: [
2117
- /* @__PURE__ */ l(ct, { size: 16 }),
2456
+ /* @__PURE__ */ l(ft, { size: 16 }),
2118
2457
  "Assistant"
2119
2458
  ]
2120
2459
  }
2121
2460
  );
2122
- }, rt = ({
2461
+ }, at = ({
2123
2462
  defaultOpen: e = !1,
2124
2463
  open: t,
2125
2464
  onOpenChange: n,
@@ -2127,22 +2466,22 @@ const un = ({
2127
2466
  envStage: s,
2128
2467
  envPulse: o = !0
2129
2468
  }) => {
2130
- const [a, i] = K(e), c = t ?? a, f = (g) => {
2469
+ const [a, i] = U(e), u = t ?? a, h = (g) => {
2131
2470
  n == null || n(g), t === void 0 && i(g);
2132
2471
  };
2133
- return /* @__PURE__ */ T(ke, { children: [
2134
- r && !c && /* @__PURE__ */ l(un, { onOpen: () => f(!0) }),
2472
+ return /* @__PURE__ */ w(De, { children: [
2473
+ r && !u && /* @__PURE__ */ l(yn, { onOpen: () => h(!0) }),
2135
2474
  /* @__PURE__ */ l(
2136
- sn,
2475
+ gn,
2137
2476
  {
2138
- open: c,
2139
- onClose: () => f(!1),
2477
+ open: u,
2478
+ onClose: () => h(!1),
2140
2479
  envStage: s,
2141
2480
  envPulse: o
2142
2481
  }
2143
2482
  )
2144
2483
  ] });
2145
- }, gn = ({
2484
+ }, Tn = ({
2146
2485
  apiBaseUrl: e,
2147
2486
  apiUrl: t,
2148
2487
  proxyUrl: n,
@@ -2151,32 +2490,34 @@ const un = ({
2151
2490
  roleId: o,
2152
2491
  client: a,
2153
2492
  welcomeMessage: i,
2154
- suggestions: c,
2155
- disableSuggestions: f,
2493
+ suggestions: u,
2494
+ disableSuggestions: h,
2156
2495
  initialMessage: g,
2157
- hideInspectSources: v,
2158
- showGroundedSources: h,
2159
- ...d
2496
+ hideInspectSources: f,
2497
+ showGroundedSources: c,
2498
+ modelId: p,
2499
+ ...b
2160
2500
  }) => {
2161
- const p = Me(), y = e ?? t ?? n;
2162
- return !!p && (!y || ce(y) === ce(p == null ? void 0 : p.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !c && f === void 0 && !g && v === void 0 && h === void 0 ? /* @__PURE__ */ l(rt, { ...d }) : /* @__PURE__ */ l(
2163
- lt,
2501
+ const k = Ge(), v = e ?? t ?? n;
2502
+ return !!k && (!v || ve(v) === ve(k == null ? void 0 : k.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !u && h === void 0 && !g && f === void 0 && c === void 0 && p === void 0 ? /* @__PURE__ */ l(at, { ...b }) : /* @__PURE__ */ l(
2503
+ dt,
2164
2504
  {
2165
- apiBaseUrl: y,
2505
+ apiBaseUrl: v,
2166
2506
  userContext: r,
2167
2507
  role: s,
2168
2508
  roleId: o,
2169
2509
  client: a,
2170
2510
  welcomeMessage: i,
2171
- suggestions: c,
2172
- disableSuggestions: f,
2511
+ suggestions: u,
2512
+ disableSuggestions: h,
2173
2513
  initialMessage: g,
2174
- hideInspectSources: v,
2175
- showGroundedSources: h,
2176
- children: /* @__PURE__ */ l(rt, { ...d })
2514
+ hideInspectSources: f,
2515
+ showGroundedSources: c,
2516
+ modelId: p,
2517
+ children: /* @__PURE__ */ l(at, { ...b })
2177
2518
  }
2178
2519
  );
2179
- }, mn = {
2520
+ }, En = {
2180
2521
  Colors: {
2181
2522
  VPS_White: "#fff",
2182
2523
  VPS_Dark_Blue: "#1A1A31",
@@ -2341,16 +2682,16 @@ const un = ({
2341
2682
  }
2342
2683
  };
2343
2684
  export {
2344
- _t as ChatPanel,
2345
- lt as ChatProvider,
2346
- pn as ChatbotWidget,
2347
- mn as ColorPalette,
2348
- gn as EmbeddedChatbot,
2349
- Se as buildApiUrl,
2350
- fn as chatApi,
2351
- ot as createChatApi,
2352
- ce as resolveApiBaseUrl,
2685
+ St as ChatPanel,
2686
+ dt as ChatProvider,
2687
+ Fn as ChatbotWidget,
2688
+ En as ColorPalette,
2689
+ Tn as EmbeddedChatbot,
2690
+ Pe as buildApiUrl,
2691
+ Sn as chatApi,
2692
+ ut as createChatApi,
2693
+ ve as resolveApiBaseUrl,
2353
2694
  Mt as useChatContext,
2354
- Ce as useChatbot,
2355
- Me as useOptionalChatContext
2695
+ Be as useChatbot,
2696
+ Ge as useOptionalChatContext
2356
2697
  };