@squadico/chatbot 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{answer-Bi8GWLyA.cjs → answer-C3IUYu5f.cjs} +3 -3
- package/dist/answer-C3IUYu5f.cjs.map +1 -0
- package/dist/{answer-BDuY6oLY.js → answer-CQWAgbwL.js} +17 -5
- package/dist/answer-CQWAgbwL.js.map +1 -0
- package/dist/chatbot-widgets.global.js +3 -3
- package/dist/chatbot-widgets.global.js.map +1 -1
- package/dist/chatbot.global.js +11 -11
- package/dist/chatbot.global.js.map +1 -1
- package/dist/extras-CFSQMYPh.cjs +4 -0
- package/dist/extras-CFSQMYPh.cjs.map +1 -0
- package/dist/{extras-BSCTuiit.js → extras-DP27_4bx.js} +178 -115
- package/dist/extras-DP27_4bx.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/client.d.ts +2 -0
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/i18n.d.ts +5 -0
- package/dist/lib/i18n.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/src-BXQdw_Q7.cjs +7 -0
- package/dist/src-BXQdw_Q7.cjs.map +1 -0
- package/dist/{src-9RHZ3YFb.js → src-CwY6PP_H.js} +233 -219
- package/dist/src-CwY6PP_H.js.map +1 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/widgets/approval/SqcApproval.d.ts.map +1 -1
- package/dist/widgets/extras-loader.d.ts +1 -1
- package/dist/widgets/parse/confirm.d.ts +1 -1
- package/dist/widgets.cjs +1 -1
- package/dist/widgets.js +2 -2
- package/package.json +1 -1
- package/dist/answer-BDuY6oLY.js.map +0 -1
- package/dist/answer-Bi8GWLyA.cjs.map +0 -1
- package/dist/extras-BAqWS9pU.cjs +0 -4
- package/dist/extras-BAqWS9pU.cjs.map +0 -1
- package/dist/extras-BSCTuiit.js.map +0 -1
- package/dist/src-9RHZ3YFb.js.map +0 -1
- package/dist/src-BaM2DlJ3.cjs +0 -7
- package/dist/src-BaM2DlJ3.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, S as r, T as i, a, b as o, d as s, f as c, g as l, h as u, i as d, m as f, n as p, p as m, r as h, s as g, t as _, w as v, x as y, y as b } from "./answer-
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, a, b as o, d as s, f as c, g as l, h as u, i as d, m as f, n as p, p as m, r as h, s as g, t as _, w as v, x as y, y as b } from "./answer-CQWAgbwL.js";
|
|
2
2
|
//#region src/lib/context.ts
|
|
3
3
|
var x = /* @__PURE__ */ new Set(["sessionId"]);
|
|
4
4
|
function S(e) {
|
|
@@ -171,15 +171,27 @@ function U(e) {
|
|
|
171
171
|
function re(e) {
|
|
172
172
|
if (!e || typeof e != "object") return;
|
|
173
173
|
let t = e;
|
|
174
|
-
if (
|
|
174
|
+
if (typeof t.tool_call_id != "string" || !t.tool_call_id) return;
|
|
175
|
+
let n = {
|
|
175
176
|
toolCallId: t.tool_call_id,
|
|
176
177
|
tool: typeof t.tool == "string" ? t.tool : "",
|
|
177
178
|
arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
|
|
178
179
|
};
|
|
180
|
+
t.labels && typeof t.labels == "object" && (n.labels = Object.fromEntries(Object.entries(t.labels).filter((e) => typeof e[1] == "string")));
|
|
181
|
+
let r = W(t.consent);
|
|
182
|
+
return r && (n.consent = r), n;
|
|
179
183
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (typeof
|
|
184
|
+
function W(e) {
|
|
185
|
+
let t = e;
|
|
186
|
+
if (typeof t?.checkout_hash == "string" && typeof t.total == "string") return {
|
|
187
|
+
...t,
|
|
188
|
+
lines: Array.isArray(t.lines) ? t.lines : [],
|
|
189
|
+
checkoutHash: t.checkout_hash
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
var G = /* @__PURE__ */ new Set(["user", "assistant"]);
|
|
193
|
+
function K(e, t) {
|
|
194
|
+
if (typeof e.role != "string" || !G.has(e.role) || typeof e.content != "string" || !e.content) return null;
|
|
183
195
|
let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
|
|
184
196
|
return {
|
|
185
197
|
id: typeof e.id == "string" && e.id ? e.id : O(),
|
|
@@ -187,16 +199,16 @@ function G(e, t) {
|
|
|
187
199
|
content: e.content,
|
|
188
200
|
createdAt: Number.isNaN(n) ? Date.now() : n,
|
|
189
201
|
agent: B(e.agent, t),
|
|
190
|
-
attachments:
|
|
202
|
+
attachments: q(e.attachments),
|
|
191
203
|
authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
|
|
192
204
|
};
|
|
193
205
|
}
|
|
194
|
-
function
|
|
206
|
+
function q(e) {
|
|
195
207
|
if (!Array.isArray(e)) return;
|
|
196
|
-
let t = e.map((e) =>
|
|
208
|
+
let t = e.map((e) => J(e)).filter((e) => e !== null);
|
|
197
209
|
return t.length > 0 ? t : void 0;
|
|
198
210
|
}
|
|
199
|
-
function
|
|
211
|
+
function J(e) {
|
|
200
212
|
if (!e || typeof e != "object") return null;
|
|
201
213
|
let { id: t, kind: n, filename: r, content_type: i } = e;
|
|
202
214
|
return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
|
|
@@ -223,7 +235,7 @@ async function ie(e) {
|
|
|
223
235
|
branding: r.branding === !0
|
|
224
236
|
};
|
|
225
237
|
}
|
|
226
|
-
async function
|
|
238
|
+
async function Y(e) {
|
|
227
239
|
let t = await fetch(I(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
228
240
|
method: "POST",
|
|
229
241
|
headers: L(),
|
|
@@ -236,7 +248,7 @@ async function ae(e) {
|
|
|
236
248
|
if (!t.ok) throw await z(t);
|
|
237
249
|
let n = await t.json();
|
|
238
250
|
if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new P("The API opened a conversation without an id or a token");
|
|
239
|
-
let r = (Array.isArray(n.messages) ? n.messages : []).map((t) =>
|
|
251
|
+
let r = (Array.isArray(n.messages) ? n.messages : []).map((t) => K(t, e.apiUrl)).filter((e) => e !== null);
|
|
240
252
|
return {
|
|
241
253
|
conversationId: n.id,
|
|
242
254
|
visitorToken: n.visitor_token,
|
|
@@ -251,7 +263,7 @@ async function ae(e) {
|
|
|
251
263
|
branding: n.branding === !0
|
|
252
264
|
};
|
|
253
265
|
}
|
|
254
|
-
async function
|
|
266
|
+
async function ae(e) {
|
|
255
267
|
let t = await fetch(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
256
268
|
method: "GET",
|
|
257
269
|
headers: L(e.visitorToken),
|
|
@@ -267,7 +279,7 @@ async function J(e) {
|
|
|
267
279
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
268
280
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
269
281
|
welcomeSuggestions: F(n.welcome_suggestions),
|
|
270
|
-
messages: (Array.isArray(n.messages) ? n.messages : []).map((t) =>
|
|
282
|
+
messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => K(t, e.apiUrl)).filter((e) => e !== null),
|
|
271
283
|
handles: V(n.handles, e.apiUrl),
|
|
272
284
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
273
285
|
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
@@ -277,19 +289,19 @@ async function J(e) {
|
|
|
277
289
|
async function oe(e) {
|
|
278
290
|
let t = new FormData();
|
|
279
291
|
t.append("file", e.file);
|
|
280
|
-
let n = await fetch(
|
|
292
|
+
let n = await fetch(X(e), {
|
|
281
293
|
method: "POST",
|
|
282
294
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
283
295
|
body: t,
|
|
284
296
|
signal: e.signal
|
|
285
297
|
});
|
|
286
298
|
if (!n.ok) throw await z(n);
|
|
287
|
-
let r =
|
|
299
|
+
let r = J(await n.json());
|
|
288
300
|
if (!r) throw new P("The upload could not be read", n.status);
|
|
289
301
|
return r;
|
|
290
302
|
}
|
|
291
303
|
async function se(e) {
|
|
292
|
-
let t = await fetch(`${
|
|
304
|
+
let t = await fetch(`${X(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
293
305
|
method: "DELETE",
|
|
294
306
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
295
307
|
signal: e.signal
|
|
@@ -297,30 +309,31 @@ async function se(e) {
|
|
|
297
309
|
if (!t.ok) throw await z(t);
|
|
298
310
|
}
|
|
299
311
|
async function ce(e) {
|
|
300
|
-
let t = await fetch(`${
|
|
312
|
+
let t = await fetch(`${X(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
301
313
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
302
314
|
signal: e.signal
|
|
303
315
|
});
|
|
304
316
|
if (!t.ok) throw await z(t);
|
|
305
317
|
return t.blob();
|
|
306
318
|
}
|
|
307
|
-
function
|
|
319
|
+
function X(e) {
|
|
308
320
|
return I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
309
321
|
}
|
|
310
322
|
async function le(e) {
|
|
311
|
-
return
|
|
323
|
+
return Z(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
312
324
|
content: e.message,
|
|
313
325
|
attachment_ids: e.attachmentIds ?? [],
|
|
314
326
|
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
315
327
|
}, e);
|
|
316
328
|
}
|
|
317
329
|
async function ue(e) {
|
|
318
|
-
return
|
|
330
|
+
return Z(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
319
331
|
tool_call_id: e.toolCallId,
|
|
320
|
-
approved: e.approved
|
|
332
|
+
approved: e.approved,
|
|
333
|
+
...e.approved && e.consentHash ? { consent_hash: e.consentHash } : {}
|
|
321
334
|
}, e);
|
|
322
335
|
}
|
|
323
|
-
async function
|
|
336
|
+
async function Z(e, t, n) {
|
|
324
337
|
let r = await fetch(e, {
|
|
325
338
|
method: "POST",
|
|
326
339
|
headers: L(n.visitorToken, n.subjectToken),
|
|
@@ -371,11 +384,11 @@ async function X(e, t, n) {
|
|
|
371
384
|
}
|
|
372
385
|
//#endregion
|
|
373
386
|
//#region src/lib/conversation.ts
|
|
374
|
-
var
|
|
375
|
-
function
|
|
387
|
+
var Q = "squadico-chatbot:conversation";
|
|
388
|
+
function $() {
|
|
376
389
|
try {
|
|
377
390
|
if (typeof sessionStorage > "u") return;
|
|
378
|
-
let e = sessionStorage.getItem(
|
|
391
|
+
let e = sessionStorage.getItem(Q);
|
|
379
392
|
if (!e) return;
|
|
380
393
|
let t = JSON.parse(e);
|
|
381
394
|
return t && typeof t == "object" ? t : void 0;
|
|
@@ -383,13 +396,13 @@ function Q() {
|
|
|
383
396
|
return;
|
|
384
397
|
}
|
|
385
398
|
}
|
|
386
|
-
function
|
|
399
|
+
function de(e) {
|
|
387
400
|
try {
|
|
388
401
|
if (typeof sessionStorage > "u") return;
|
|
389
|
-
sessionStorage.setItem(
|
|
402
|
+
sessionStorage.setItem(Q, JSON.stringify(e));
|
|
390
403
|
} catch {}
|
|
391
404
|
}
|
|
392
|
-
function
|
|
405
|
+
function fe(e) {
|
|
393
406
|
if (!e || typeof e != "object") return;
|
|
394
407
|
let { sessionId: t, visitorToken: n } = e;
|
|
395
408
|
return typeof t == "string" && t && typeof n == "string" && n ? {
|
|
@@ -397,10 +410,10 @@ function de(e) {
|
|
|
397
410
|
visitorToken: n
|
|
398
411
|
} : void 0;
|
|
399
412
|
}
|
|
400
|
-
function
|
|
401
|
-
let t =
|
|
413
|
+
function pe(e) {
|
|
414
|
+
let t = $();
|
|
402
415
|
if (!t || typeof t.embedKey != "string" || !t.embedKey) return;
|
|
403
|
-
let n = typeof t.agent == "string" ? t.agent : void 0, r =
|
|
416
|
+
let n = typeof t.agent == "string" ? t.agent : void 0, r = fe(e === void 0 || n === void 0 || e === n ? t : t.threads?.[e]);
|
|
404
417
|
if (r) return {
|
|
405
418
|
...r,
|
|
406
419
|
embedKey: t.embedKey,
|
|
@@ -409,25 +422,25 @@ function fe(e) {
|
|
|
409
422
|
agent: e ?? n
|
|
410
423
|
};
|
|
411
424
|
}
|
|
412
|
-
function
|
|
413
|
-
let t =
|
|
425
|
+
function me(e) {
|
|
426
|
+
let t = $(), n = t && ge(t, e) ? t.threads ?? {} : {}, r = e.agent ? {
|
|
414
427
|
...n,
|
|
415
428
|
[e.agent]: {
|
|
416
429
|
sessionId: e.sessionId,
|
|
417
430
|
visitorToken: e.visitorToken
|
|
418
431
|
}
|
|
419
432
|
} : n;
|
|
420
|
-
|
|
433
|
+
de({
|
|
421
434
|
...e,
|
|
422
435
|
threads: r
|
|
423
436
|
});
|
|
424
437
|
}
|
|
425
|
-
function
|
|
438
|
+
function he(e) {
|
|
426
439
|
if (e !== void 0) {
|
|
427
|
-
let t =
|
|
440
|
+
let t = $();
|
|
428
441
|
if (!t) return;
|
|
429
442
|
let n = { ...t.threads ?? {} };
|
|
430
|
-
delete n[e],
|
|
443
|
+
delete n[e], de(t.agent === void 0 || t.agent === e ? {
|
|
431
444
|
embedKey: t.embedKey,
|
|
432
445
|
user: t.user,
|
|
433
446
|
scope: t.scope,
|
|
@@ -440,34 +453,34 @@ function me(e) {
|
|
|
440
453
|
}
|
|
441
454
|
try {
|
|
442
455
|
if (typeof sessionStorage > "u") return;
|
|
443
|
-
sessionStorage.removeItem(
|
|
456
|
+
sessionStorage.removeItem(Q);
|
|
444
457
|
} catch {}
|
|
445
458
|
}
|
|
446
|
-
function
|
|
459
|
+
function ge(e, { embedKey: t, user: n, scope: r }) {
|
|
447
460
|
return e.embedKey === t && e.user === n && e.scope === r;
|
|
448
461
|
}
|
|
449
462
|
//#endregion
|
|
450
463
|
//#region src/lib/useChat.ts
|
|
451
|
-
async function
|
|
464
|
+
async function _e(e) {
|
|
452
465
|
if (e) try {
|
|
453
466
|
return await e() || void 0;
|
|
454
467
|
} catch {
|
|
455
468
|
return;
|
|
456
469
|
}
|
|
457
470
|
}
|
|
458
|
-
var
|
|
459
|
-
function
|
|
471
|
+
var ve = "preview-welcome";
|
|
472
|
+
function ye(e, t) {
|
|
460
473
|
return e === void 0 && t === void 0 ? void 0 : JSON.stringify([e, t]);
|
|
461
474
|
}
|
|
462
|
-
function
|
|
475
|
+
function be(e) {
|
|
463
476
|
let t = e instanceof P ? e.status : void 0;
|
|
464
477
|
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
465
478
|
}
|
|
466
|
-
var
|
|
467
|
-
function
|
|
479
|
+
var xe = 5e3;
|
|
480
|
+
function Se(e) {
|
|
468
481
|
return e instanceof P && e.code === "conversation_retired";
|
|
469
482
|
}
|
|
470
|
-
function
|
|
483
|
+
function Ce(t) {
|
|
471
484
|
let [n, r] = e([]), [a, s] = e(!1), [c, l] = e(""), [u, d] = e(0), [f, p] = e([]), [m, h] = e(""), [g, _] = e(""), [x, S] = e(null), [C, w] = e([]), [T, E] = e(!1), [D, te] = e(!1), [k, A] = e([]), [j, M] = e([]), [ne, N] = e(null), F = o(null), I = o(t);
|
|
472
485
|
I.current = t;
|
|
473
486
|
let L = o(null), R = o(null), z = o(null), B = o(null), V = o(void 0), H = o(void 0), U = o(void 0), re = o(/* @__PURE__ */ new Map()), W = o({
|
|
@@ -493,14 +506,14 @@ function Se(t) {
|
|
|
493
506
|
createdAt: Date.now()
|
|
494
507
|
} : null, [G]), q = i((e) => {
|
|
495
508
|
I.current.onEvent?.(e);
|
|
496
|
-
}, []),
|
|
509
|
+
}, []), J = i((e, t) => {
|
|
497
510
|
r((n) => n.map((n) => n.id === e ? {
|
|
498
511
|
...n,
|
|
499
512
|
...t
|
|
500
513
|
} : n));
|
|
501
514
|
}, []), X = i((e, t) => {
|
|
502
515
|
let n = e instanceof P ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (I.current.locale ?? b(void 0)).t.error;
|
|
503
|
-
t &&
|
|
516
|
+
t && J(t, {
|
|
504
517
|
content: i,
|
|
505
518
|
streaming: !1,
|
|
506
519
|
error: !0,
|
|
@@ -511,7 +524,7 @@ function Se(t) {
|
|
|
511
524
|
status: n,
|
|
512
525
|
sessionId: R.current?.sessionId ?? ""
|
|
513
526
|
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
514
|
-
}, [q,
|
|
527
|
+
}, [q, J]), Z = i(() => {
|
|
515
528
|
let e = I.current;
|
|
516
529
|
if (!e.embedKey) throw new P("No embed key: nothing says which application to open");
|
|
517
530
|
return {
|
|
@@ -526,35 +539,35 @@ function Se(t) {
|
|
|
526
539
|
sessionId: t.conversationId,
|
|
527
540
|
visitorToken: t.visitorToken
|
|
528
541
|
};
|
|
529
|
-
R.current = i, V.current =
|
|
542
|
+
R.current = i, V.current = ye(e.claim?.id, e.scope);
|
|
530
543
|
let a = n ?? H.current ?? t.agentHandle;
|
|
531
|
-
return H.current = a, U.current ?? (U.current = a),
|
|
544
|
+
return H.current = a, U.current ?? (U.current = a), me({
|
|
532
545
|
...i,
|
|
533
546
|
embedKey: e.embedKey,
|
|
534
547
|
user: e.claim?.id,
|
|
535
548
|
scope: e.scope,
|
|
536
549
|
agent: a
|
|
537
|
-
}), l(t.conversationId), p(t.handles), h(e.opts.agent && t.agentHandle ? t.agentHandle : ""), _(a ?? ""), w(t.welcomeSuggestions), E(!!t.withHuman), te(t.branding), r((e) => [...t.messages, ...e.filter((e) => e.id !==
|
|
550
|
+
}), l(t.conversationId), p(t.handles), h(e.opts.agent && t.agentHandle ? t.agentHandle : ""), _(a ?? ""), w(t.welcomeSuggestions), E(!!t.withHuman), te(t.branding), r((e) => [...t.messages, ...e.filter((e) => e.id !== ve)]), i;
|
|
538
551
|
}, []), $ = i((e) => {
|
|
539
552
|
if (z.current) return z.current;
|
|
540
|
-
let t = H.current, n =
|
|
541
|
-
if (!n || !
|
|
553
|
+
let t = H.current, n = pe(t);
|
|
554
|
+
if (!n || !ge(n, {
|
|
542
555
|
embedKey: e.embedKey,
|
|
543
556
|
user: e.claim?.id,
|
|
544
557
|
scope: e.scope
|
|
545
558
|
})) return Promise.resolve(null);
|
|
546
|
-
let r =
|
|
559
|
+
let r = ae({
|
|
547
560
|
apiUrl: e.apiUrl,
|
|
548
561
|
conversationId: n.sessionId,
|
|
549
562
|
visitorToken: n.visitorToken
|
|
550
|
-
}).then((r) => H.current === t ? Q(e, r, n.agent) : null).catch(() => (
|
|
563
|
+
}).then((r) => H.current === t ? Q(e, r, n.agent) : null).catch(() => (he(n.agent), null)).finally(() => {
|
|
551
564
|
z.current = null;
|
|
552
565
|
});
|
|
553
566
|
return z.current = r, r;
|
|
554
567
|
}, [Q]), de = i(async () => {
|
|
555
568
|
if (R.current) return R.current;
|
|
556
569
|
if (L.current) return L.current;
|
|
557
|
-
let e = Z(), t = $(e).then((t) => t ??
|
|
570
|
+
let e = Z(), t = $(e).then((t) => t ?? Y({
|
|
558
571
|
apiUrl: e.apiUrl,
|
|
559
572
|
embedKey: e.embedKey,
|
|
560
573
|
user: e.claim,
|
|
@@ -570,7 +583,7 @@ function Se(t) {
|
|
|
570
583
|
Q,
|
|
571
584
|
$,
|
|
572
585
|
Z
|
|
573
|
-
]),
|
|
586
|
+
]), fe = i(() => {
|
|
574
587
|
if (R.current || L.current || B.current) return;
|
|
575
588
|
let e;
|
|
576
589
|
try {
|
|
@@ -590,7 +603,7 @@ function Se(t) {
|
|
|
590
603
|
H.current = t ?? i.agentHandle, U.current ?? (U.current = H.current), p(i.handles), h(e.opts.agent && i.agentHandle ? i.agentHandle : ""), _(H.current ?? ""), w(i.welcomeSuggestions), te(i.branding);
|
|
591
604
|
let a = i.welcomeMessage;
|
|
592
605
|
a && r((e) => e.length > 0 ? e : [{
|
|
593
|
-
id:
|
|
606
|
+
id: ve,
|
|
594
607
|
role: "assistant",
|
|
595
608
|
content: a,
|
|
596
609
|
createdAt: Date.now(),
|
|
@@ -634,18 +647,18 @@ function Se(t) {
|
|
|
634
647
|
sessionId: i.sessionId
|
|
635
648
|
});
|
|
636
649
|
let s = "", c = (e) => {
|
|
637
|
-
s += e,
|
|
650
|
+
s += e, J(o, {
|
|
638
651
|
content: s,
|
|
639
652
|
activity: void 0
|
|
640
653
|
});
|
|
641
654
|
}, l = (e) => {
|
|
642
|
-
s ||
|
|
655
|
+
s || J(o, { activity: e });
|
|
643
656
|
}, u;
|
|
644
657
|
try {
|
|
645
658
|
u = await t(i, c, a.signal, l);
|
|
646
659
|
} catch (e) {
|
|
647
|
-
if (!
|
|
648
|
-
i = await de(), s = "",
|
|
660
|
+
if (!Se(e) || (he(H.current), R.current = null, L.current = null, !n)) throw e;
|
|
661
|
+
i = await de(), s = "", J(o, {
|
|
649
662
|
content: "",
|
|
650
663
|
activity: void 0
|
|
651
664
|
}), u = await t(i, c, a.signal, l);
|
|
@@ -654,7 +667,7 @@ function Se(t) {
|
|
|
654
667
|
r((e) => e.filter((e) => e.id !== o));
|
|
655
668
|
return;
|
|
656
669
|
}
|
|
657
|
-
|
|
670
|
+
J(o, {
|
|
658
671
|
content: u.answer,
|
|
659
672
|
streaming: !1,
|
|
660
673
|
activity: void 0,
|
|
@@ -672,7 +685,7 @@ function Se(t) {
|
|
|
672
685
|
});
|
|
673
686
|
})().catch((e) => {
|
|
674
687
|
if (a.signal.aborted) {
|
|
675
|
-
|
|
688
|
+
J(o, {
|
|
676
689
|
streaming: !1,
|
|
677
690
|
activity: void 0
|
|
678
691
|
});
|
|
@@ -686,13 +699,13 @@ function Se(t) {
|
|
|
686
699
|
de,
|
|
687
700
|
q,
|
|
688
701
|
X,
|
|
689
|
-
|
|
702
|
+
J
|
|
690
703
|
]), we = i((e) => {
|
|
691
704
|
let t = e.trim();
|
|
692
705
|
if (!t && k.length === 0) return;
|
|
693
706
|
let n = k;
|
|
694
707
|
A([]), N(null), Ce(t, async (e, r, i, a) => le({
|
|
695
|
-
subjectToken: await
|
|
708
|
+
subjectToken: await _e(I.current.getSubjectToken),
|
|
696
709
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
697
710
|
conversationId: e.sessionId,
|
|
698
711
|
visitorToken: e.visitorToken,
|
|
@@ -712,7 +725,7 @@ function Se(t) {
|
|
|
712
725
|
conversationId: t.sessionId,
|
|
713
726
|
visitorToken: t.visitorToken,
|
|
714
727
|
file: e
|
|
715
|
-
})).then((e) => A((t) => [...t, e])).catch((e) => N(
|
|
728
|
+
})).then((e) => A((t) => [...t, e])).catch((e) => N(be(e))).finally(() => M((t) => {
|
|
716
729
|
let n = t.indexOf(e.name);
|
|
717
730
|
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
718
731
|
}));
|
|
@@ -737,12 +750,13 @@ function Se(t) {
|
|
|
737
750
|
}, []), Oe = i((e, t) => {
|
|
738
751
|
let n = x;
|
|
739
752
|
n && Ce(t, async (t, r, i, a) => ue({
|
|
740
|
-
subjectToken: await
|
|
753
|
+
subjectToken: await _e(I.current.getSubjectToken),
|
|
741
754
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
742
755
|
conversationId: t.sessionId,
|
|
743
756
|
visitorToken: t.visitorToken,
|
|
744
757
|
toolCallId: n.toolCallId,
|
|
745
758
|
approved: e,
|
|
759
|
+
consentHash: n.consent?.checkoutHash,
|
|
746
760
|
onToken: r,
|
|
747
761
|
onProgress: a,
|
|
748
762
|
signal: i
|
|
@@ -750,7 +764,7 @@ function Se(t) {
|
|
|
750
764
|
}, [x, Ce]), ke = i(() => {
|
|
751
765
|
F.current?.abort(), F.current = null, s(!1);
|
|
752
766
|
}, []), Ae = i(() => {
|
|
753
|
-
F.current?.abort(), F.current = null, R.current = null, L.current = null, z.current = null, B.current = null, V.current = void 0, re.current.clear(),
|
|
767
|
+
F.current?.abort(), F.current = null, R.current = null, L.current = null, z.current = null, B.current = null, V.current = void 0, re.current.clear(), he(), s(!1), S(null), E(!1), l(""), d((e) => e + 1), h(""), A([]), r([]), w([]), q({
|
|
754
768
|
type: "chatbot-reset",
|
|
755
769
|
sessionId: ""
|
|
756
770
|
});
|
|
@@ -761,7 +775,7 @@ function Se(t) {
|
|
|
761
775
|
if (re.current.delete(e), R.current = t?.conversation ?? null, z.current = null, B.current = null, r(t?.messages ?? []), w(t?.welcomeSuggestions ?? []), S(t?.approval ?? null), E(t?.withHuman ?? !1), A(t?.attachments ?? []), l(t?.conversation?.sessionId ?? ""), t?.conversation) {
|
|
762
776
|
try {
|
|
763
777
|
let n = Z();
|
|
764
|
-
|
|
778
|
+
me({
|
|
765
779
|
...t.conversation,
|
|
766
780
|
embedKey: n.embedKey,
|
|
767
781
|
user: n.claim?.id,
|
|
@@ -771,13 +785,13 @@ function Se(t) {
|
|
|
771
785
|
} catch {}
|
|
772
786
|
return;
|
|
773
787
|
}
|
|
774
|
-
|
|
775
|
-
}, [
|
|
788
|
+
fe();
|
|
789
|
+
}, [fe, Z]), Me = t.humanPollMs ?? xe;
|
|
776
790
|
v(() => {
|
|
777
791
|
if (!T || !c) return;
|
|
778
792
|
let e = setInterval(() => {
|
|
779
793
|
let e = R.current;
|
|
780
|
-
!e || F.current ||
|
|
794
|
+
!e || F.current || ae({
|
|
781
795
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
782
796
|
conversationId: e.sessionId,
|
|
783
797
|
visitorToken: e.visitorToken
|
|
@@ -791,7 +805,7 @@ function Se(t) {
|
|
|
791
805
|
c,
|
|
792
806
|
Me
|
|
793
807
|
]);
|
|
794
|
-
let Ne =
|
|
808
|
+
let Ne = ye(t.user?.id, t.scope);
|
|
795
809
|
return v(() => {
|
|
796
810
|
if (R.current) {
|
|
797
811
|
V.current !== Ne && Ae();
|
|
@@ -822,7 +836,7 @@ function Se(t) {
|
|
|
822
836
|
approval: x,
|
|
823
837
|
withHuman: T,
|
|
824
838
|
branding: D,
|
|
825
|
-
start:
|
|
839
|
+
start: fe,
|
|
826
840
|
send: we,
|
|
827
841
|
attachments: k,
|
|
828
842
|
uploading: j,
|
|
@@ -838,7 +852,7 @@ function Se(t) {
|
|
|
838
852
|
}
|
|
839
853
|
//#endregion
|
|
840
854
|
//#region src/components/Avatar.tsx
|
|
841
|
-
function
|
|
855
|
+
function we({ name: t, color: n, url: r, size: i = 16 }) {
|
|
842
856
|
let [a, o] = e(void 0), s = !!r && a !== r;
|
|
843
857
|
return /* @__PURE__ */ l("span", {
|
|
844
858
|
class: "sqc-avatar",
|
|
@@ -854,16 +868,16 @@ function Ce({ name: t, color: n, url: r, size: i = 16 }) {
|
|
|
854
868
|
src: r,
|
|
855
869
|
alt: "",
|
|
856
870
|
onError: () => o(r)
|
|
857
|
-
}) :
|
|
871
|
+
}) : Te(t)
|
|
858
872
|
});
|
|
859
873
|
}
|
|
860
|
-
function
|
|
874
|
+
function Te(e) {
|
|
861
875
|
let t = Array.from(e.trim())[0];
|
|
862
876
|
return t ? t.toLocaleUpperCase() : "?";
|
|
863
877
|
}
|
|
864
878
|
//#endregion
|
|
865
879
|
//#region src/components/AgentRail.tsx
|
|
866
|
-
function
|
|
880
|
+
function Ee({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
867
881
|
return /* @__PURE__ */ l("nav", {
|
|
868
882
|
class: "sqc-rail",
|
|
869
883
|
"aria-label": i,
|
|
@@ -875,7 +889,7 @@ function Te({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
875
889
|
"data-tip": e.name,
|
|
876
890
|
disabled: n,
|
|
877
891
|
onClick: () => r(e.handle),
|
|
878
|
-
children: [/* @__PURE__ */ l(
|
|
892
|
+
children: [/* @__PURE__ */ l(we, {
|
|
879
893
|
name: e.name,
|
|
880
894
|
color: e.color,
|
|
881
895
|
url: e.avatarUrl,
|
|
@@ -883,28 +897,28 @@ function Te({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
883
897
|
}), /* @__PURE__ */ l("span", {
|
|
884
898
|
class: "sqc-rail__label",
|
|
885
899
|
"aria-hidden": "true",
|
|
886
|
-
children:
|
|
900
|
+
children: De(e.handle)
|
|
887
901
|
})]
|
|
888
902
|
}, e.handle))
|
|
889
903
|
});
|
|
890
904
|
}
|
|
891
|
-
function
|
|
905
|
+
function De(e) {
|
|
892
906
|
let t = e.split(/[-_]/)[0] ?? e;
|
|
893
907
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
894
908
|
}
|
|
895
909
|
//#endregion
|
|
896
910
|
//#region src/components/Composer.tsx
|
|
897
|
-
var
|
|
898
|
-
function
|
|
911
|
+
var Oe = 132, ke = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", Ae = /^[a-zA-Z0-9_-]*$/;
|
|
912
|
+
function je(e, t) {
|
|
899
913
|
let n = e.slice(0, t), r = n.lastIndexOf("@");
|
|
900
914
|
if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
|
|
901
915
|
let i = n.slice(r + 1);
|
|
902
|
-
return
|
|
916
|
+
return Ae.test(i) ? {
|
|
903
917
|
start: r,
|
|
904
918
|
query: i
|
|
905
919
|
} : null;
|
|
906
920
|
}
|
|
907
|
-
function
|
|
921
|
+
function Me({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addressee: u, attachments: d = [], uploading: f = [], attachmentError: p, onAttach: m, onDetach: h, onSend: g, onStop: _ }) {
|
|
908
922
|
let [b, x] = e(""), [S, C] = e(null), [w, ee] = e(0), [T, E] = e(!1), D = o(null), te = o(null), O = !!m, k = f.length > 0, A = y(() => {
|
|
909
923
|
if (!S || !c || c.length === 0) return [];
|
|
910
924
|
let e = S.query.toLowerCase();
|
|
@@ -913,8 +927,8 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
913
927
|
let e = D.current;
|
|
914
928
|
if (!e) return;
|
|
915
929
|
e.style.height = "auto";
|
|
916
|
-
let t = e.scrollHeight >
|
|
917
|
-
e.style.height = `${Math.min(e.scrollHeight,
|
|
930
|
+
let t = e.scrollHeight > Oe;
|
|
931
|
+
e.style.height = `${Math.min(e.scrollHeight, Oe)}px`, e.style.overflowY = t ? "auto" : "hidden";
|
|
918
932
|
}, []);
|
|
919
933
|
v(() => {
|
|
920
934
|
s && D.current?.focus(), M();
|
|
@@ -922,7 +936,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
922
936
|
u && (x((e) => e || `@${u} `), requestAnimationFrame(M));
|
|
923
937
|
}, [u, M]);
|
|
924
938
|
let ne = i((e) => {
|
|
925
|
-
C(
|
|
939
|
+
C(je(e.value, e.selectionStart ?? e.value.length)), ee(0);
|
|
926
940
|
}, []), P = i((e) => {
|
|
927
941
|
let t = D.current;
|
|
928
942
|
if (!t || !S) return;
|
|
@@ -1032,7 +1046,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1032
1046
|
children: [
|
|
1033
1047
|
/* @__PURE__ */ l("span", {
|
|
1034
1048
|
class: "sqc-mention__icon",
|
|
1035
|
-
children: /* @__PURE__ */ l(
|
|
1049
|
+
children: /* @__PURE__ */ l(we, {
|
|
1036
1050
|
name: e.name,
|
|
1037
1051
|
color: e.color,
|
|
1038
1052
|
url: e.avatarUrl,
|
|
@@ -1079,7 +1093,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1079
1093
|
ref: te,
|
|
1080
1094
|
type: "file",
|
|
1081
1095
|
multiple: !0,
|
|
1082
|
-
accept:
|
|
1096
|
+
accept: ke,
|
|
1083
1097
|
class: "sqc-file-input",
|
|
1084
1098
|
onChange: (e) => {
|
|
1085
1099
|
F(e.currentTarget.files), e.currentTarget.value = "";
|
|
@@ -1141,14 +1155,14 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1141
1155
|
}
|
|
1142
1156
|
//#endregion
|
|
1143
1157
|
//#region src/components/RichText.tsx
|
|
1144
|
-
var
|
|
1145
|
-
function
|
|
1158
|
+
var Ne = /^(\s*)[-*•]\s+/, Pe = /^(\s*)\d+[.)]\s+/, Fe = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, Ie = /^\s*([-*_])(?:\s*\1){2,}\s*$/, Le = /^\s*>\s?(.*)$/, Re = /^\s*```/;
|
|
1159
|
+
function ze(e, t, n, r) {
|
|
1146
1160
|
let i = e[t].ordered, a = [], o = t;
|
|
1147
1161
|
for (; o < e.length && e[o].depth >= n;) {
|
|
1148
1162
|
let t = e[o];
|
|
1149
1163
|
if (t.depth === n && t.ordered !== i) break;
|
|
1150
1164
|
if (t.depth > n) {
|
|
1151
|
-
let [n, i] =
|
|
1165
|
+
let [n, i] = ze(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1152
1166
|
s ? s.nested.push(n) : a.push({
|
|
1153
1167
|
key: `${r}-${o}`,
|
|
1154
1168
|
text: null,
|
|
@@ -1165,7 +1179,7 @@ function Re(e, t, n, r) {
|
|
|
1165
1179
|
let s = a.map((e) => /* @__PURE__ */ l("li", { children: [e.text === null ? null : g(e.text, e.key), e.nested] }, e.key));
|
|
1166
1180
|
return [l(i ? "ol" : "ul", { children: s }, r), o];
|
|
1167
1181
|
}
|
|
1168
|
-
function
|
|
1182
|
+
function Be(e) {
|
|
1169
1183
|
let t = e.split("\n"), n = [], r = [], i = [], a = [], o = () => {
|
|
1170
1184
|
if (!r.length) return;
|
|
1171
1185
|
let e = `p${n.length}`;
|
|
@@ -1174,7 +1188,7 @@ function ze(e) {
|
|
|
1174
1188
|
if (!i.length) return;
|
|
1175
1189
|
let e = 0;
|
|
1176
1190
|
for (; e < i.length;) {
|
|
1177
|
-
let t = `l${n.length}`, [r, a] =
|
|
1191
|
+
let t = `l${n.length}`, [r, a] = ze(i, e, i[e].depth, t);
|
|
1178
1192
|
n.push(r), e = a;
|
|
1179
1193
|
}
|
|
1180
1194
|
i = [];
|
|
@@ -1187,10 +1201,10 @@ function ze(e) {
|
|
|
1187
1201
|
};
|
|
1188
1202
|
for (let e = 0; e < t.length; e += 1) {
|
|
1189
1203
|
let d = t[e];
|
|
1190
|
-
if (
|
|
1204
|
+
if (Re.test(d)) {
|
|
1191
1205
|
u();
|
|
1192
1206
|
let r = [];
|
|
1193
|
-
for (e += 1; e < t.length && !
|
|
1207
|
+
for (e += 1; e < t.length && !Re.test(t[e]);) r.push(t[e]), e += 1;
|
|
1194
1208
|
let i = `c${n.length}`;
|
|
1195
1209
|
n.push(/* @__PURE__ */ l("pre", { children: /* @__PURE__ */ l("code", { children: r.join("\n") }) }, i));
|
|
1196
1210
|
continue;
|
|
@@ -1199,23 +1213,23 @@ function ze(e) {
|
|
|
1199
1213
|
u();
|
|
1200
1214
|
continue;
|
|
1201
1215
|
}
|
|
1202
|
-
let f =
|
|
1216
|
+
let f = Fe.exec(d);
|
|
1203
1217
|
if (f) {
|
|
1204
1218
|
u();
|
|
1205
1219
|
let e = f[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", r = `h${n.length}`;
|
|
1206
1220
|
n.push(/* @__PURE__ */ l(t, { children: g(f[2], r) }, r));
|
|
1207
1221
|
continue;
|
|
1208
1222
|
}
|
|
1209
|
-
if (
|
|
1223
|
+
if (Ie.test(d)) {
|
|
1210
1224
|
u(), n.push(/* @__PURE__ */ l("hr", {}, `r${n.length}`));
|
|
1211
1225
|
continue;
|
|
1212
1226
|
}
|
|
1213
|
-
let p =
|
|
1227
|
+
let p = Le.exec(d);
|
|
1214
1228
|
if (p) {
|
|
1215
1229
|
o(), s(), a.push(p[1]);
|
|
1216
1230
|
continue;
|
|
1217
1231
|
}
|
|
1218
|
-
let m =
|
|
1232
|
+
let m = Ne.exec(d), h = m ? null : Pe.exec(d), _ = m ?? h;
|
|
1219
1233
|
if (_) {
|
|
1220
1234
|
o(), c(), i.push({
|
|
1221
1235
|
depth: _[1].replace(/\t/g, " ").length,
|
|
@@ -1228,7 +1242,7 @@ function ze(e) {
|
|
|
1228
1242
|
}
|
|
1229
1243
|
return u(), n;
|
|
1230
1244
|
}
|
|
1231
|
-
function
|
|
1245
|
+
function Ve(e) {
|
|
1232
1246
|
let t = o(null), { form: n, locked: i, language: a } = e;
|
|
1233
1247
|
return r(() => {
|
|
1234
1248
|
h();
|
|
@@ -1247,9 +1261,9 @@ function Be(e) {
|
|
|
1247
1261
|
children: n.fields.map((e) => /* @__PURE__ */ l("p", { children: e.label }, e.name))
|
|
1248
1262
|
});
|
|
1249
1263
|
}
|
|
1250
|
-
function
|
|
1264
|
+
function He(e, n, r) {
|
|
1251
1265
|
switch (e.kind) {
|
|
1252
|
-
case "markdown": return /* @__PURE__ */ l(t, { children:
|
|
1266
|
+
case "markdown": return /* @__PURE__ */ l(t, { children: Be(e.text) });
|
|
1253
1267
|
case "table": return /* @__PURE__ */ l("sqc-table", {
|
|
1254
1268
|
table: {
|
|
1255
1269
|
header: e.header,
|
|
@@ -1265,24 +1279,24 @@ function Ve(e, n, r) {
|
|
|
1265
1279
|
locked: r,
|
|
1266
1280
|
language: n.code
|
|
1267
1281
|
});
|
|
1268
|
-
case "form": return /* @__PURE__ */ l(
|
|
1282
|
+
case "form": return /* @__PURE__ */ l(Ve, {
|
|
1269
1283
|
form: e.form,
|
|
1270
1284
|
locked: r,
|
|
1271
1285
|
language: n.code
|
|
1272
1286
|
});
|
|
1273
1287
|
}
|
|
1274
1288
|
}
|
|
1275
|
-
function
|
|
1289
|
+
function Ue({ text: e, locale: n, live: r, confirmable: i }) {
|
|
1276
1290
|
let { blocks: a, confirm: o } = _(e, n.code, i === !0), s = !r;
|
|
1277
|
-
return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children:
|
|
1291
|
+
return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children: He(e, n, s) }, `b${r}`)), o && /* @__PURE__ */ l("sqc-confirm", {
|
|
1278
1292
|
locked: s,
|
|
1279
1293
|
language: n.code
|
|
1280
1294
|
})] });
|
|
1281
1295
|
}
|
|
1282
1296
|
//#endregion
|
|
1283
1297
|
//#region src/components/MessageList.tsx
|
|
1284
|
-
var
|
|
1285
|
-
function
|
|
1298
|
+
var We = 80;
|
|
1299
|
+
function Ge({ at: e, locale: t }) {
|
|
1286
1300
|
let n = new Date(e);
|
|
1287
1301
|
return /* @__PURE__ */ l("time", {
|
|
1288
1302
|
class: "sqc-msg__time",
|
|
@@ -1293,7 +1307,7 @@ function We({ at: e, locale: t }) {
|
|
|
1293
1307
|
})
|
|
1294
1308
|
});
|
|
1295
1309
|
}
|
|
1296
|
-
function
|
|
1310
|
+
function Ke(e) {
|
|
1297
1311
|
let { call: t, locked: n, locale: i } = e, a = i.code, s = o(null);
|
|
1298
1312
|
r(() => {
|
|
1299
1313
|
h();
|
|
@@ -1332,7 +1346,7 @@ function Ge(e) {
|
|
|
1332
1346
|
]
|
|
1333
1347
|
});
|
|
1334
1348
|
}
|
|
1335
|
-
function
|
|
1349
|
+
function qe({ file: t, load: n }) {
|
|
1336
1350
|
let [r, i] = e(null);
|
|
1337
1351
|
return v(() => {
|
|
1338
1352
|
let e = null, r = !0;
|
|
@@ -1350,7 +1364,7 @@ function Ke({ file: t, load: n }) {
|
|
|
1350
1364
|
children: t.filename
|
|
1351
1365
|
});
|
|
1352
1366
|
}
|
|
1353
|
-
function
|
|
1367
|
+
function Je(e) {
|
|
1354
1368
|
let { file: t, load: n, language: i } = e, a = o(null), s = y(() => n(t.id).then((e) => e.text()).catch(() => ""), [t.id, n]);
|
|
1355
1369
|
return r(() => {
|
|
1356
1370
|
h();
|
|
@@ -1370,13 +1384,13 @@ function qe(e) {
|
|
|
1370
1384
|
children: t.filename
|
|
1371
1385
|
});
|
|
1372
1386
|
}
|
|
1373
|
-
function
|
|
1387
|
+
function Ye({ files: e, load: t, language: n }) {
|
|
1374
1388
|
return e.length === 0 || !t ? null : /* @__PURE__ */ l("div", {
|
|
1375
1389
|
class: "sqc-attachments sqc-attachments--sent",
|
|
1376
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(
|
|
1390
|
+
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(qe, {
|
|
1377
1391
|
file: e,
|
|
1378
1392
|
load: t
|
|
1379
|
-
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(
|
|
1393
|
+
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(Je, {
|
|
1380
1394
|
file: e,
|
|
1381
1395
|
load: t,
|
|
1382
1396
|
language: n
|
|
@@ -1390,17 +1404,17 @@ function Je({ files: e, load: t, language: n }) {
|
|
|
1390
1404
|
}, e.id))
|
|
1391
1405
|
});
|
|
1392
1406
|
}
|
|
1393
|
-
function
|
|
1407
|
+
function Xe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onLoadAttachment: a }) {
|
|
1394
1408
|
let o = e.streaming && !e.content, s = !!e.approval;
|
|
1395
1409
|
return /* @__PURE__ */ l("div", {
|
|
1396
1410
|
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
1397
1411
|
children: [e.role === "assistant" && /* @__PURE__ */ l("div", {
|
|
1398
1412
|
class: "sqc-msg__who",
|
|
1399
|
-
children: [e.agent ? /* @__PURE__ */ l(
|
|
1413
|
+
children: [e.agent ? /* @__PURE__ */ l(we, {
|
|
1400
1414
|
name: e.agent.name,
|
|
1401
1415
|
color: e.agent.color,
|
|
1402
1416
|
url: e.agent.avatarUrl
|
|
1403
|
-
}) : /* @__PURE__ */ l(
|
|
1417
|
+
}) : /* @__PURE__ */ l(Qe, {}), e.authorName ?? e.agent?.name ?? n]
|
|
1404
1418
|
}), /* @__PURE__ */ l("div", {
|
|
1405
1419
|
class: "sqc-msg__bubble",
|
|
1406
1420
|
children: [o ? /* @__PURE__ */ l("span", {
|
|
@@ -1421,7 +1435,7 @@ function Ye({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1421
1435
|
}) : /* @__PURE__ */ l("div", {
|
|
1422
1436
|
class: "sqc-msg__body",
|
|
1423
1437
|
children: [
|
|
1424
|
-
/* @__PURE__ */ l(
|
|
1438
|
+
/* @__PURE__ */ l(Ue, {
|
|
1425
1439
|
text: e.content,
|
|
1426
1440
|
locale: t,
|
|
1427
1441
|
live: r,
|
|
@@ -1431,29 +1445,29 @@ function Ye({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1431
1445
|
class: "sqc-caret",
|
|
1432
1446
|
"aria-hidden": "true"
|
|
1433
1447
|
}),
|
|
1434
|
-
s && /* @__PURE__ */ l(
|
|
1448
|
+
s && /* @__PURE__ */ l(Ke, {
|
|
1435
1449
|
locale: t,
|
|
1436
1450
|
call: e.content.trim() === "" ? e.approval : void 0,
|
|
1437
1451
|
locked: !i
|
|
1438
1452
|
}),
|
|
1439
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(
|
|
1453
|
+
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(Ze, {
|
|
1440
1454
|
message: e,
|
|
1441
1455
|
locale: t
|
|
1442
1456
|
}),
|
|
1443
|
-
/* @__PURE__ */ l(
|
|
1457
|
+
/* @__PURE__ */ l(Ye, {
|
|
1444
1458
|
files: e.attachments ?? [],
|
|
1445
1459
|
load: a,
|
|
1446
1460
|
language: t.code
|
|
1447
1461
|
})
|
|
1448
1462
|
]
|
|
1449
|
-
}), !o && /* @__PURE__ */ l(
|
|
1463
|
+
}), !o && /* @__PURE__ */ l(Ge, {
|
|
1450
1464
|
at: e.createdAt,
|
|
1451
1465
|
locale: t
|
|
1452
1466
|
})]
|
|
1453
1467
|
})]
|
|
1454
1468
|
});
|
|
1455
1469
|
}
|
|
1456
|
-
function
|
|
1470
|
+
function Ze({ message: e, locale: n }) {
|
|
1457
1471
|
let r = e.offered ?? [];
|
|
1458
1472
|
return /* @__PURE__ */ l("p", {
|
|
1459
1473
|
class: "sqc-msg__unaddressed",
|
|
@@ -1470,7 +1484,7 @@ function Xe({ message: e, locale: n }) {
|
|
|
1470
1484
|
]
|
|
1471
1485
|
});
|
|
1472
1486
|
}
|
|
1473
|
-
function
|
|
1487
|
+
function Qe() {
|
|
1474
1488
|
return /* @__PURE__ */ l("svg", {
|
|
1475
1489
|
viewBox: "0 0 24 24",
|
|
1476
1490
|
fill: "none",
|
|
@@ -1482,7 +1496,7 @@ function Ze() {
|
|
|
1482
1496
|
children: /* @__PURE__ */ l("path", { d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" })
|
|
1483
1497
|
});
|
|
1484
1498
|
}
|
|
1485
|
-
function
|
|
1499
|
+
function $e({ messages: e, locale: t, assistantName: n, suggestions: i, showSuggestions: a, busy: s, withHuman: c, onSuggestion: u, onChoice: d, onDecide: f, onCompose: m, onLoadAttachment: h }) {
|
|
1486
1500
|
let g = o(null), _ = o(!0);
|
|
1487
1501
|
r(() => {
|
|
1488
1502
|
let e = g.current;
|
|
@@ -1533,7 +1547,7 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1533
1547
|
let e = g.current;
|
|
1534
1548
|
if (!e) return;
|
|
1535
1549
|
let t = () => {
|
|
1536
|
-
_.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1550
|
+
_.current = e.scrollHeight - e.scrollTop - e.clientHeight < We;
|
|
1537
1551
|
};
|
|
1538
1552
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1539
1553
|
}, []), /* @__PURE__ */ l("div", {
|
|
@@ -1543,7 +1557,7 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1543
1557
|
"aria-live": "polite",
|
|
1544
1558
|
"aria-atomic": "false",
|
|
1545
1559
|
children: [
|
|
1546
|
-
e.map((r, i) => /* @__PURE__ */ l(
|
|
1560
|
+
e.map((r, i) => /* @__PURE__ */ l(Xe, {
|
|
1547
1561
|
message: r,
|
|
1548
1562
|
locale: t,
|
|
1549
1563
|
assistantName: n,
|
|
@@ -1570,28 +1584,28 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1570
1584
|
}
|
|
1571
1585
|
//#endregion
|
|
1572
1586
|
//#region src/components/ChatbotWidget.tsx
|
|
1573
|
-
var
|
|
1574
|
-
function
|
|
1587
|
+
var et = { width: "min(392px, 100vw)" }, tt = /* @__PURE__ */ new Set(["sessionId"]);
|
|
1588
|
+
function nt(e) {
|
|
1575
1589
|
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1576
1590
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1577
1591
|
}
|
|
1578
|
-
function
|
|
1592
|
+
function rt(e) {
|
|
1579
1593
|
if (!e) return [];
|
|
1580
1594
|
let t = [];
|
|
1581
1595
|
for (let [n, r] of Object.entries(e)) {
|
|
1582
|
-
if (
|
|
1596
|
+
if (tt.has(n) || typeof r != "string" && !w(r)) continue;
|
|
1583
1597
|
let e = C(r);
|
|
1584
1598
|
e && t.push({
|
|
1585
|
-
label:
|
|
1599
|
+
label: nt(n),
|
|
1586
1600
|
value: e
|
|
1587
1601
|
});
|
|
1588
1602
|
}
|
|
1589
1603
|
return t;
|
|
1590
1604
|
}
|
|
1591
|
-
function
|
|
1605
|
+
function it(e, t) {
|
|
1592
1606
|
return e?.trim() ? e : t;
|
|
1593
1607
|
}
|
|
1594
|
-
function
|
|
1608
|
+
function at(t) {
|
|
1595
1609
|
let [n, r] = e(!1);
|
|
1596
1610
|
return v(() => {
|
|
1597
1611
|
if (t !== "auto" || typeof matchMedia != "function") return;
|
|
@@ -1601,9 +1615,9 @@ function it(t) {
|
|
|
1601
1615
|
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
1602
1616
|
}, [t]), t === "dark" ? "dark" : t === "light" ? "light" : n ? "dark" : "light";
|
|
1603
1617
|
}
|
|
1604
|
-
function
|
|
1618
|
+
function ot(t) {
|
|
1605
1619
|
a();
|
|
1606
|
-
let n = t.persistOpen ?? !0, [s, c] = e(() => te(t.defaultOpen, n)), [u, d] = e(!1), f = o(null), p = o(null), m =
|
|
1620
|
+
let n = t.persistOpen ?? !0, [s, c] = e(() => te(t.defaultOpen, n)), [u, d] = e(!1), f = o(null), p = o(null), m = at(t.theme ?? "light"), h = y(() => b(t.locale), [t.locale]), g = h.t, _ = it(t.heading, g.heading), x = it(t.assistantName, g.assistant), S = it(t.greeting, g.greeting), C = t.onEvent, { send: w, reset: ee, decide: T, stop: E, start: O, resets: k, busy: A, messages: j, withHuman: M, branding: ne, sessionId: N, handles: P, addressee: F, agentHandle: I, welcomeSuggestions: L, attachments: R, uploading: z, attachmentError: B, attach: V, detach: H, loadAttachment: U, switchTo: re } = Ce({
|
|
1607
1621
|
embedKey: t.embedKey,
|
|
1608
1622
|
user: t.user,
|
|
1609
1623
|
scope: t.scope,
|
|
@@ -1645,43 +1659,43 @@ function at(t) {
|
|
|
1645
1659
|
k,
|
|
1646
1660
|
O
|
|
1647
1661
|
]);
|
|
1648
|
-
let q = P.length >= 2,
|
|
1662
|
+
let q = P.length >= 2, J = w, ie = i(() => {
|
|
1649
1663
|
d(!1), ee();
|
|
1650
|
-
}, [ee]),
|
|
1664
|
+
}, [ee]), Y = o({
|
|
1651
1665
|
openPanel: G,
|
|
1652
1666
|
closePanel: K,
|
|
1653
|
-
send:
|
|
1654
|
-
reset:
|
|
1667
|
+
send: J,
|
|
1668
|
+
reset: ie,
|
|
1655
1669
|
sessionId: N
|
|
1656
1670
|
});
|
|
1657
|
-
|
|
1671
|
+
Y.current = {
|
|
1658
1672
|
openPanel: G,
|
|
1659
1673
|
closePanel: K,
|
|
1660
|
-
send:
|
|
1661
|
-
reset:
|
|
1674
|
+
send: J,
|
|
1675
|
+
reset: ie,
|
|
1662
1676
|
sessionId: N
|
|
1663
1677
|
};
|
|
1664
|
-
let
|
|
1665
|
-
open: () =>
|
|
1666
|
-
close: () =>
|
|
1667
|
-
toggle: () => W.current ?
|
|
1668
|
-
reset: () =>
|
|
1678
|
+
let ae = o({
|
|
1679
|
+
open: () => Y.current.openPanel(),
|
|
1680
|
+
close: () => Y.current.closePanel(),
|
|
1681
|
+
toggle: () => W.current ? Y.current.closePanel() : Y.current.openPanel(),
|
|
1682
|
+
reset: () => Y.current.reset(),
|
|
1669
1683
|
send: (e) => {
|
|
1670
|
-
|
|
1684
|
+
Y.current.openPanel(), Y.current.send(e);
|
|
1671
1685
|
},
|
|
1672
1686
|
isOpen: () => W.current,
|
|
1673
|
-
sessionId: () =>
|
|
1674
|
-
}),
|
|
1675
|
-
r(() => (
|
|
1687
|
+
sessionId: () => Y.current.sessionId
|
|
1688
|
+
}), oe = t.bind;
|
|
1689
|
+
r(() => (oe?.(ae.current), () => oe?.(null)), [oe]), v(() => {
|
|
1676
1690
|
if (!s) return;
|
|
1677
1691
|
let e = (e) => {
|
|
1678
1692
|
e.key === "Escape" && (e.stopPropagation(), K());
|
|
1679
1693
|
};
|
|
1680
1694
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1681
1695
|
}, [K, s]);
|
|
1682
|
-
let
|
|
1696
|
+
let se = y(() => j.some((e) => e.role === "user"), [j]), ce = L.length > 0 ? L : t.suggestions, X = y(() => rt(t.context), [t.context]), le = {
|
|
1683
1697
|
...t.accent ? { "--sqc-accent": t.accent } : {},
|
|
1684
|
-
"--sqc-width": t.width ??
|
|
1698
|
+
"--sqc-width": t.width ?? et.width
|
|
1685
1699
|
};
|
|
1686
1700
|
return /* @__PURE__ */ l("div", {
|
|
1687
1701
|
class: "sqc",
|
|
@@ -1689,7 +1703,7 @@ function at(t) {
|
|
|
1689
1703
|
"data-position": t.position ?? "bottom-right",
|
|
1690
1704
|
"data-layout": t.layout ?? "sidebar",
|
|
1691
1705
|
"data-open": s ? "true" : "false",
|
|
1692
|
-
style:
|
|
1706
|
+
style: le,
|
|
1693
1707
|
children: [/* @__PURE__ */ l("button", {
|
|
1694
1708
|
ref: p,
|
|
1695
1709
|
type: "button",
|
|
@@ -1703,7 +1717,7 @@ function at(t) {
|
|
|
1703
1717
|
children: /* @__PURE__ */ l("slot", {
|
|
1704
1718
|
name: "launcher-icon",
|
|
1705
1719
|
class: "sqc-slot-icon",
|
|
1706
|
-
children: /* @__PURE__ */ l(
|
|
1720
|
+
children: /* @__PURE__ */ l(Qe, {})
|
|
1707
1721
|
})
|
|
1708
1722
|
}), u && /* @__PURE__ */ l("span", {
|
|
1709
1723
|
class: "sqc-launcher__badge",
|
|
@@ -1722,7 +1736,7 @@ function at(t) {
|
|
|
1722
1736
|
/* @__PURE__ */ l("span", {
|
|
1723
1737
|
class: "sqc-header__icon",
|
|
1724
1738
|
"aria-hidden": "true",
|
|
1725
|
-
children: /* @__PURE__ */ l(
|
|
1739
|
+
children: /* @__PURE__ */ l(Qe, {})
|
|
1726
1740
|
}),
|
|
1727
1741
|
/* @__PURE__ */ l("div", {
|
|
1728
1742
|
class: "sqc-header__titles",
|
|
@@ -1731,13 +1745,13 @@ function at(t) {
|
|
|
1731
1745
|
children: _
|
|
1732
1746
|
}), /* @__PURE__ */ l("p", {
|
|
1733
1747
|
class: "sqc-header__sub",
|
|
1734
|
-
children:
|
|
1748
|
+
children: it(t.subheading, g.subheading)
|
|
1735
1749
|
})]
|
|
1736
1750
|
}),
|
|
1737
1751
|
/* @__PURE__ */ l("button", {
|
|
1738
1752
|
type: "button",
|
|
1739
1753
|
class: "sqc-icon-btn",
|
|
1740
|
-
onClick:
|
|
1754
|
+
onClick: ie,
|
|
1741
1755
|
"aria-label": g.newConversation,
|
|
1742
1756
|
"data-tip": g.newConversation,
|
|
1743
1757
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1771,7 +1785,7 @@ function at(t) {
|
|
|
1771
1785
|
]
|
|
1772
1786
|
}), /* @__PURE__ */ l("div", {
|
|
1773
1787
|
class: "sqc-panel__body",
|
|
1774
|
-
children: [q && /* @__PURE__ */ l(
|
|
1788
|
+
children: [q && /* @__PURE__ */ l(Ee, {
|
|
1775
1789
|
handles: P,
|
|
1776
1790
|
active: I || void 0,
|
|
1777
1791
|
disabled: A,
|
|
@@ -1780,31 +1794,31 @@ function at(t) {
|
|
|
1780
1794
|
}), /* @__PURE__ */ l("div", {
|
|
1781
1795
|
class: "sqc-panel__main",
|
|
1782
1796
|
children: [
|
|
1783
|
-
(t.showContext ?? !0) &&
|
|
1797
|
+
(t.showContext ?? !0) && X.length > 0 && /* @__PURE__ */ l("div", {
|
|
1784
1798
|
class: "sqc-context",
|
|
1785
1799
|
"aria-label": g.context.region,
|
|
1786
|
-
children:
|
|
1800
|
+
children: X.map((e) => /* @__PURE__ */ l("span", {
|
|
1787
1801
|
class: "sqc-chip",
|
|
1788
1802
|
title: `${e.label}: ${e.value}`,
|
|
1789
1803
|
children: [/* @__PURE__ */ l("b", { children: e.label }), e.value]
|
|
1790
1804
|
}, e.label))
|
|
1791
1805
|
}),
|
|
1792
|
-
/* @__PURE__ */ l(
|
|
1806
|
+
/* @__PURE__ */ l($e, {
|
|
1793
1807
|
messages: j,
|
|
1794
1808
|
locale: h,
|
|
1795
1809
|
assistantName: x,
|
|
1796
|
-
suggestions:
|
|
1797
|
-
showSuggestions: !
|
|
1810
|
+
suggestions: ce,
|
|
1811
|
+
showSuggestions: !se,
|
|
1798
1812
|
busy: A,
|
|
1799
1813
|
withHuman: M,
|
|
1800
|
-
onSuggestion:
|
|
1801
|
-
onChoice:
|
|
1814
|
+
onSuggestion: J,
|
|
1815
|
+
onChoice: J,
|
|
1802
1816
|
onDecide: T,
|
|
1803
1817
|
onCompose: () => f.current?.querySelector(".sqc-composer__input")?.focus(),
|
|
1804
1818
|
onLoadAttachment: U
|
|
1805
1819
|
}),
|
|
1806
|
-
/* @__PURE__ */ l(
|
|
1807
|
-
placeholder:
|
|
1820
|
+
/* @__PURE__ */ l(Me, {
|
|
1821
|
+
placeholder: it(t.placeholder, g.placeholder),
|
|
1808
1822
|
locale: h,
|
|
1809
1823
|
busy: A,
|
|
1810
1824
|
autoFocus: s,
|
|
@@ -1815,7 +1829,7 @@ function at(t) {
|
|
|
1815
1829
|
attachmentError: B ? g.attachments[B] : void 0,
|
|
1816
1830
|
onAttach: V,
|
|
1817
1831
|
onDetach: H,
|
|
1818
|
-
onSend:
|
|
1832
|
+
onSend: J,
|
|
1819
1833
|
onStop: E
|
|
1820
1834
|
}),
|
|
1821
1835
|
/* @__PURE__ */ l("p", {
|
|
@@ -1839,7 +1853,7 @@ function at(t) {
|
|
|
1839
1853
|
}
|
|
1840
1854
|
//#endregion
|
|
1841
1855
|
//#region src/styles.css?inline
|
|
1842
|
-
var ot = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:\"Plus Jakarta Sans\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:\"\";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:\"·\";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:stretch}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}.sqc-waiting{align-items:center;gap:8px;display:inline-flex}.sqc-activity{color:var(--sqc-text-muted);font-size:12px}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:\"\";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-attachment__chart{flex-basis:100%;min-width:0}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}", st = "squadico-chatbot", ct = [
|
|
1856
|
+
var st = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:\"Plus Jakarta Sans\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:\"\";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:\"·\";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:stretch}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}.sqc-waiting{align-items:center;gap:8px;display:inline-flex}.sqc-activity{color:var(--sqc-text-muted);font-size:12px}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:\"\";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-attachment__chart{flex-basis:100%;min-width:0}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}", ct = "squadico-chatbot", lt = [
|
|
1843
1857
|
"embed-key",
|
|
1844
1858
|
"context",
|
|
1845
1859
|
"user",
|
|
@@ -1859,21 +1873,21 @@ var ot = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480
|
|
|
1859
1873
|
"persist-open",
|
|
1860
1874
|
"show-context",
|
|
1861
1875
|
"locale"
|
|
1862
|
-
],
|
|
1863
|
-
function
|
|
1864
|
-
if (
|
|
1876
|
+
], ut;
|
|
1877
|
+
function dt() {
|
|
1878
|
+
if (ut !== void 0) return ut;
|
|
1865
1879
|
try {
|
|
1866
1880
|
let e = new CSSStyleSheet();
|
|
1867
|
-
e.replaceSync(
|
|
1881
|
+
e.replaceSync(st), ut = e;
|
|
1868
1882
|
} catch {
|
|
1869
|
-
|
|
1883
|
+
ut = null;
|
|
1870
1884
|
}
|
|
1871
|
-
return
|
|
1885
|
+
return ut;
|
|
1872
1886
|
}
|
|
1873
|
-
function
|
|
1874
|
-
typeof console < "u" && console.warn(`[${
|
|
1887
|
+
function ft(e, t) {
|
|
1888
|
+
typeof console < "u" && console.warn(`[${ct}] ${e}`, t ?? "");
|
|
1875
1889
|
}
|
|
1876
|
-
function
|
|
1890
|
+
function pt(e) {
|
|
1877
1891
|
if (!(!e || !e.trim())) try {
|
|
1878
1892
|
let t = JSON.parse(e);
|
|
1879
1893
|
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
@@ -1884,45 +1898,45 @@ function ft(e) {
|
|
|
1884
1898
|
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
1885
1899
|
};
|
|
1886
1900
|
}
|
|
1887
|
-
|
|
1901
|
+
ft("the \"user\" attribute needs an object with an id", e);
|
|
1888
1902
|
} catch (e) {
|
|
1889
|
-
|
|
1903
|
+
ft("the \"user\" attribute is not valid JSON", e);
|
|
1890
1904
|
}
|
|
1891
1905
|
}
|
|
1892
|
-
function
|
|
1906
|
+
function mt(e) {
|
|
1893
1907
|
if (!(!e || !e.trim())) try {
|
|
1894
1908
|
let t = JSON.parse(e);
|
|
1895
1909
|
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
1896
|
-
|
|
1910
|
+
ft("the `context` attribute must be a JSON object", e);
|
|
1897
1911
|
} catch (e) {
|
|
1898
|
-
|
|
1912
|
+
ft("the `context` attribute is not valid JSON", e);
|
|
1899
1913
|
}
|
|
1900
1914
|
}
|
|
1901
|
-
function
|
|
1915
|
+
function ht(e) {
|
|
1902
1916
|
if (!(!e || !e.trim())) {
|
|
1903
1917
|
if (e.trim().startsWith("[")) try {
|
|
1904
1918
|
let t = JSON.parse(e);
|
|
1905
1919
|
if (Array.isArray(t)) return t.map(String);
|
|
1906
1920
|
} catch (e) {
|
|
1907
|
-
|
|
1921
|
+
ft("the `suggestions` attribute is not valid JSON", e);
|
|
1908
1922
|
return;
|
|
1909
1923
|
}
|
|
1910
1924
|
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
1911
1925
|
}
|
|
1912
1926
|
}
|
|
1913
|
-
function
|
|
1927
|
+
function gt(e) {
|
|
1914
1928
|
if (e !== null) return e !== "false" && e !== "0";
|
|
1915
1929
|
}
|
|
1916
|
-
function
|
|
1930
|
+
function _t(e) {
|
|
1917
1931
|
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
1918
1932
|
}
|
|
1919
|
-
function
|
|
1933
|
+
function vt(e) {
|
|
1920
1934
|
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
1921
1935
|
}
|
|
1922
|
-
function
|
|
1936
|
+
function yt(e) {
|
|
1923
1937
|
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
1924
1938
|
}
|
|
1925
|
-
var
|
|
1939
|
+
var bt = [
|
|
1926
1940
|
"context",
|
|
1927
1941
|
"embedKey",
|
|
1928
1942
|
"user",
|
|
@@ -1930,7 +1944,7 @@ var yt = [
|
|
|
1930
1944
|
"getSubjectToken",
|
|
1931
1945
|
"agent"
|
|
1932
1946
|
];
|
|
1933
|
-
function
|
|
1947
|
+
function xt() {
|
|
1934
1948
|
var e, t, r, i, a, o, d, p, h, g, _, v, y, b, x;
|
|
1935
1949
|
return t = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakSet(), b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
|
|
1936
1950
|
constructor() {
|
|
@@ -1944,14 +1958,14 @@ function bt() {
|
|
|
1944
1958
|
}), f(this, x, (e) => {
|
|
1945
1959
|
s(r, this, e), e && s(o, this, e.sessionId());
|
|
1946
1960
|
});
|
|
1947
|
-
let e = this.attachShadow({ mode: "open" }), n =
|
|
1961
|
+
let e = this.attachShadow({ mode: "open" }), n = dt();
|
|
1948
1962
|
if (n) e.adoptedStyleSheets = [n];
|
|
1949
1963
|
else {
|
|
1950
1964
|
let t = document.createElement("style");
|
|
1951
|
-
t.textContent =
|
|
1965
|
+
t.textContent = st, e.append(t);
|
|
1952
1966
|
}
|
|
1953
1967
|
s(t, this, document.createElement("div")), e.append(c(t, this));
|
|
1954
|
-
for (let e of
|
|
1968
|
+
for (let e of bt) {
|
|
1955
1969
|
if (!Object.hasOwn(this, e)) continue;
|
|
1956
1970
|
let t = this[e];
|
|
1957
1971
|
delete this[e], this[e] = t;
|
|
@@ -1966,14 +1980,14 @@ function bt() {
|
|
|
1966
1980
|
attributeChangedCallback(e, t, n) {
|
|
1967
1981
|
if (t !== n) {
|
|
1968
1982
|
if (e === "open" && c(r, this)) {
|
|
1969
|
-
|
|
1983
|
+
gt(n) ? c(r, this).open() : c(r, this).close();
|
|
1970
1984
|
return;
|
|
1971
1985
|
}
|
|
1972
1986
|
m(y, this, S).call(this);
|
|
1973
1987
|
}
|
|
1974
1988
|
}
|
|
1975
1989
|
get context() {
|
|
1976
|
-
return c(d, this) ??
|
|
1990
|
+
return c(d, this) ?? mt(this.getAttribute("context"));
|
|
1977
1991
|
}
|
|
1978
1992
|
set context(e) {
|
|
1979
1993
|
s(d, this, e), m(y, this, S).call(this);
|
|
@@ -1991,7 +2005,7 @@ function bt() {
|
|
|
1991
2005
|
s(h, this, e), m(y, this, S).call(this);
|
|
1992
2006
|
}
|
|
1993
2007
|
get user() {
|
|
1994
|
-
return c(p, this) ??
|
|
2008
|
+
return c(p, this) ?? pt(this.getAttribute("user"));
|
|
1995
2009
|
}
|
|
1996
2010
|
set user(e) {
|
|
1997
2011
|
s(p, this, e), m(y, this, S).call(this);
|
|
@@ -2009,7 +2023,7 @@ function bt() {
|
|
|
2009
2023
|
s(_, this, e), m(y, this, S).call(this);
|
|
2010
2024
|
}
|
|
2011
2025
|
get open() {
|
|
2012
|
-
return c(r, this)?.isOpen() ??
|
|
2026
|
+
return c(r, this)?.isOpen() ?? gt(this.getAttribute("open")) ?? !1;
|
|
2013
2027
|
}
|
|
2014
2028
|
set open(e) {
|
|
2015
2029
|
e ? this.openChat() : this.closeChat();
|
|
@@ -2031,12 +2045,12 @@ function bt() {
|
|
|
2031
2045
|
}
|
|
2032
2046
|
sendMessage(e) {
|
|
2033
2047
|
if (!c(r, this)) {
|
|
2034
|
-
|
|
2048
|
+
ft("sendMessage() called before the component was mounted — ignored");
|
|
2035
2049
|
return;
|
|
2036
2050
|
}
|
|
2037
2051
|
c(r, this).send(e);
|
|
2038
2052
|
}
|
|
2039
|
-
}, M(e, "observedAttributes",
|
|
2053
|
+
}, M(e, "observedAttributes", lt), e;
|
|
2040
2054
|
function S() {
|
|
2041
2055
|
c(i, this) || !c(a, this) || (s(i, this, !0), queueMicrotask(() => {
|
|
2042
2056
|
s(i, this, !1), c(a, this) && m(y, this, C).call(this);
|
|
@@ -2044,7 +2058,7 @@ function bt() {
|
|
|
2044
2058
|
}
|
|
2045
2059
|
function C() {
|
|
2046
2060
|
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
2047
|
-
n(/* @__PURE__ */ l(
|
|
2061
|
+
n(/* @__PURE__ */ l(ot, {
|
|
2048
2062
|
embedKey: this.embedKey,
|
|
2049
2063
|
context: this.context,
|
|
2050
2064
|
user: this.user,
|
|
@@ -2056,29 +2070,29 @@ function bt() {
|
|
|
2056
2070
|
assistantName: e("assistant-name"),
|
|
2057
2071
|
placeholder: e("placeholder"),
|
|
2058
2072
|
greeting: e("greeting"),
|
|
2059
|
-
suggestions:
|
|
2073
|
+
suggestions: ht(this.getAttribute("suggestions")),
|
|
2060
2074
|
width: e("width"),
|
|
2061
2075
|
accent: e("accent"),
|
|
2062
|
-
theme:
|
|
2063
|
-
position:
|
|
2064
|
-
layout:
|
|
2065
|
-
defaultOpen:
|
|
2066
|
-
persistOpen:
|
|
2067
|
-
showContext:
|
|
2076
|
+
theme: _t(this.getAttribute("theme")),
|
|
2077
|
+
position: vt(this.getAttribute("position")),
|
|
2078
|
+
layout: yt(this.getAttribute("layout")),
|
|
2079
|
+
defaultOpen: gt(this.getAttribute("open")) ?? !1,
|
|
2080
|
+
persistOpen: gt(this.getAttribute("persist-open")) ?? !0,
|
|
2081
|
+
showContext: gt(this.getAttribute("show-context")) ?? !0,
|
|
2068
2082
|
locale: e("locale"),
|
|
2069
2083
|
onEvent: c(b, this),
|
|
2070
2084
|
bind: c(x, this)
|
|
2071
2085
|
}), c(t, this));
|
|
2072
2086
|
}
|
|
2073
2087
|
}
|
|
2074
|
-
var
|
|
2075
|
-
function
|
|
2076
|
-
typeof window > "u" || typeof HTMLElement > "u" || (
|
|
2088
|
+
var St;
|
|
2089
|
+
function Ct(e = ct) {
|
|
2090
|
+
typeof window > "u" || typeof HTMLElement > "u" || (St ?? (St = xt()), window.customElements.get(e) || window.customElements.define(e, St));
|
|
2077
2091
|
}
|
|
2078
2092
|
//#endregion
|
|
2079
2093
|
//#region src/index.ts
|
|
2080
|
-
|
|
2094
|
+
Ct();
|
|
2081
2095
|
//#endregion
|
|
2082
|
-
export { N as a, P as i,
|
|
2096
|
+
export { N as a, P as i, Ct as n, te as o, ne as r, ct as t };
|
|
2083
2097
|
|
|
2084
|
-
//# sourceMappingURL=src-
|
|
2098
|
+
//# sourceMappingURL=src-CwY6PP_H.js.map
|