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