@squadico/chatbot 1.7.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-BO2Hs9k1.cjs → answer-C3IUYu5f.cjs} +3 -3
- package/dist/answer-C3IUYu5f.cjs.map +1 -0
- package/dist/{answer-DF91dBOx.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-D94278IT.js → extras-DP27_4bx.js} +139 -99
- 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-Bm_aRvFA.js → src-CwY6PP_H.js} +231 -219
- package/dist/src-CwY6PP_H.js.map +1 -0
- package/dist/types.d.ts +18 -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-BO2Hs9k1.cjs.map +0 -1
- package/dist/answer-DF91dBOx.js.map +0 -1
- package/dist/extras-BeCZR-6X.cjs +0 -4
- package/dist/extras-BeCZR-6X.cjs.map +0 -1
- package/dist/extras-D94278IT.js.map +0 -1
- package/dist/src-Bm_aRvFA.js.map +0 -1
- package/dist/src-DcPZdalT.cjs +0 -7
- package/dist/src-DcPZdalT.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) {
|
|
@@ -177,11 +177,21 @@ function re(e) {
|
|
|
177
177
|
tool: typeof t.tool == "string" ? t.tool : "",
|
|
178
178
|
arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
|
|
179
179
|
};
|
|
180
|
-
|
|
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;
|
|
181
183
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
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;
|
|
185
195
|
let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
|
|
186
196
|
return {
|
|
187
197
|
id: typeof e.id == "string" && e.id ? e.id : O(),
|
|
@@ -189,16 +199,16 @@ function G(e, t) {
|
|
|
189
199
|
content: e.content,
|
|
190
200
|
createdAt: Number.isNaN(n) ? Date.now() : n,
|
|
191
201
|
agent: B(e.agent, t),
|
|
192
|
-
attachments:
|
|
202
|
+
attachments: q(e.attachments),
|
|
193
203
|
authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
|
|
194
204
|
};
|
|
195
205
|
}
|
|
196
|
-
function
|
|
206
|
+
function q(e) {
|
|
197
207
|
if (!Array.isArray(e)) return;
|
|
198
|
-
let t = e.map((e) =>
|
|
208
|
+
let t = e.map((e) => J(e)).filter((e) => e !== null);
|
|
199
209
|
return t.length > 0 ? t : void 0;
|
|
200
210
|
}
|
|
201
|
-
function
|
|
211
|
+
function J(e) {
|
|
202
212
|
if (!e || typeof e != "object") return null;
|
|
203
213
|
let { id: t, kind: n, filename: r, content_type: i } = e;
|
|
204
214
|
return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
|
|
@@ -225,7 +235,7 @@ async function ie(e) {
|
|
|
225
235
|
branding: r.branding === !0
|
|
226
236
|
};
|
|
227
237
|
}
|
|
228
|
-
async function
|
|
238
|
+
async function Y(e) {
|
|
229
239
|
let t = await fetch(I(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
230
240
|
method: "POST",
|
|
231
241
|
headers: L(),
|
|
@@ -238,7 +248,7 @@ async function ae(e) {
|
|
|
238
248
|
if (!t.ok) throw await z(t);
|
|
239
249
|
let n = await t.json();
|
|
240
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");
|
|
241
|
-
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);
|
|
242
252
|
return {
|
|
243
253
|
conversationId: n.id,
|
|
244
254
|
visitorToken: n.visitor_token,
|
|
@@ -253,7 +263,7 @@ async function ae(e) {
|
|
|
253
263
|
branding: n.branding === !0
|
|
254
264
|
};
|
|
255
265
|
}
|
|
256
|
-
async function
|
|
266
|
+
async function ae(e) {
|
|
257
267
|
let t = await fetch(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
258
268
|
method: "GET",
|
|
259
269
|
headers: L(e.visitorToken),
|
|
@@ -269,7 +279,7 @@ async function J(e) {
|
|
|
269
279
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
270
280
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
271
281
|
welcomeSuggestions: F(n.welcome_suggestions),
|
|
272
|
-
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),
|
|
273
283
|
handles: V(n.handles, e.apiUrl),
|
|
274
284
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
275
285
|
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
@@ -279,19 +289,19 @@ async function J(e) {
|
|
|
279
289
|
async function oe(e) {
|
|
280
290
|
let t = new FormData();
|
|
281
291
|
t.append("file", e.file);
|
|
282
|
-
let n = await fetch(
|
|
292
|
+
let n = await fetch(X(e), {
|
|
283
293
|
method: "POST",
|
|
284
294
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
285
295
|
body: t,
|
|
286
296
|
signal: e.signal
|
|
287
297
|
});
|
|
288
298
|
if (!n.ok) throw await z(n);
|
|
289
|
-
let r =
|
|
299
|
+
let r = J(await n.json());
|
|
290
300
|
if (!r) throw new P("The upload could not be read", n.status);
|
|
291
301
|
return r;
|
|
292
302
|
}
|
|
293
303
|
async function se(e) {
|
|
294
|
-
let t = await fetch(`${
|
|
304
|
+
let t = await fetch(`${X(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
295
305
|
method: "DELETE",
|
|
296
306
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
297
307
|
signal: e.signal
|
|
@@ -299,30 +309,31 @@ async function se(e) {
|
|
|
299
309
|
if (!t.ok) throw await z(t);
|
|
300
310
|
}
|
|
301
311
|
async function ce(e) {
|
|
302
|
-
let t = await fetch(`${
|
|
312
|
+
let t = await fetch(`${X(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
303
313
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
304
314
|
signal: e.signal
|
|
305
315
|
});
|
|
306
316
|
if (!t.ok) throw await z(t);
|
|
307
317
|
return t.blob();
|
|
308
318
|
}
|
|
309
|
-
function
|
|
319
|
+
function X(e) {
|
|
310
320
|
return I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
311
321
|
}
|
|
312
322
|
async function le(e) {
|
|
313
|
-
return
|
|
323
|
+
return Z(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
314
324
|
content: e.message,
|
|
315
325
|
attachment_ids: e.attachmentIds ?? [],
|
|
316
326
|
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
317
327
|
}, e);
|
|
318
328
|
}
|
|
319
329
|
async function ue(e) {
|
|
320
|
-
return
|
|
330
|
+
return Z(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
321
331
|
tool_call_id: e.toolCallId,
|
|
322
|
-
approved: e.approved
|
|
332
|
+
approved: e.approved,
|
|
333
|
+
...e.approved && e.consentHash ? { consent_hash: e.consentHash } : {}
|
|
323
334
|
}, e);
|
|
324
335
|
}
|
|
325
|
-
async function
|
|
336
|
+
async function Z(e, t, n) {
|
|
326
337
|
let r = await fetch(e, {
|
|
327
338
|
method: "POST",
|
|
328
339
|
headers: L(n.visitorToken, n.subjectToken),
|
|
@@ -373,11 +384,11 @@ async function X(e, t, n) {
|
|
|
373
384
|
}
|
|
374
385
|
//#endregion
|
|
375
386
|
//#region src/lib/conversation.ts
|
|
376
|
-
var
|
|
377
|
-
function
|
|
387
|
+
var Q = "squadico-chatbot:conversation";
|
|
388
|
+
function $() {
|
|
378
389
|
try {
|
|
379
390
|
if (typeof sessionStorage > "u") return;
|
|
380
|
-
let e = sessionStorage.getItem(
|
|
391
|
+
let e = sessionStorage.getItem(Q);
|
|
381
392
|
if (!e) return;
|
|
382
393
|
let t = JSON.parse(e);
|
|
383
394
|
return t && typeof t == "object" ? t : void 0;
|
|
@@ -385,13 +396,13 @@ function Q() {
|
|
|
385
396
|
return;
|
|
386
397
|
}
|
|
387
398
|
}
|
|
388
|
-
function
|
|
399
|
+
function de(e) {
|
|
389
400
|
try {
|
|
390
401
|
if (typeof sessionStorage > "u") return;
|
|
391
|
-
sessionStorage.setItem(
|
|
402
|
+
sessionStorage.setItem(Q, JSON.stringify(e));
|
|
392
403
|
} catch {}
|
|
393
404
|
}
|
|
394
|
-
function
|
|
405
|
+
function fe(e) {
|
|
395
406
|
if (!e || typeof e != "object") return;
|
|
396
407
|
let { sessionId: t, visitorToken: n } = e;
|
|
397
408
|
return typeof t == "string" && t && typeof n == "string" && n ? {
|
|
@@ -399,10 +410,10 @@ function de(e) {
|
|
|
399
410
|
visitorToken: n
|
|
400
411
|
} : void 0;
|
|
401
412
|
}
|
|
402
|
-
function
|
|
403
|
-
let t =
|
|
413
|
+
function pe(e) {
|
|
414
|
+
let t = $();
|
|
404
415
|
if (!t || typeof t.embedKey != "string" || !t.embedKey) return;
|
|
405
|
-
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]);
|
|
406
417
|
if (r) return {
|
|
407
418
|
...r,
|
|
408
419
|
embedKey: t.embedKey,
|
|
@@ -411,25 +422,25 @@ function fe(e) {
|
|
|
411
422
|
agent: e ?? n
|
|
412
423
|
};
|
|
413
424
|
}
|
|
414
|
-
function
|
|
415
|
-
let t =
|
|
425
|
+
function me(e) {
|
|
426
|
+
let t = $(), n = t && ge(t, e) ? t.threads ?? {} : {}, r = e.agent ? {
|
|
416
427
|
...n,
|
|
417
428
|
[e.agent]: {
|
|
418
429
|
sessionId: e.sessionId,
|
|
419
430
|
visitorToken: e.visitorToken
|
|
420
431
|
}
|
|
421
432
|
} : n;
|
|
422
|
-
|
|
433
|
+
de({
|
|
423
434
|
...e,
|
|
424
435
|
threads: r
|
|
425
436
|
});
|
|
426
437
|
}
|
|
427
|
-
function
|
|
438
|
+
function he(e) {
|
|
428
439
|
if (e !== void 0) {
|
|
429
|
-
let t =
|
|
440
|
+
let t = $();
|
|
430
441
|
if (!t) return;
|
|
431
442
|
let n = { ...t.threads ?? {} };
|
|
432
|
-
delete n[e],
|
|
443
|
+
delete n[e], de(t.agent === void 0 || t.agent === e ? {
|
|
433
444
|
embedKey: t.embedKey,
|
|
434
445
|
user: t.user,
|
|
435
446
|
scope: t.scope,
|
|
@@ -442,34 +453,34 @@ function me(e) {
|
|
|
442
453
|
}
|
|
443
454
|
try {
|
|
444
455
|
if (typeof sessionStorage > "u") return;
|
|
445
|
-
sessionStorage.removeItem(
|
|
456
|
+
sessionStorage.removeItem(Q);
|
|
446
457
|
} catch {}
|
|
447
458
|
}
|
|
448
|
-
function
|
|
459
|
+
function ge(e, { embedKey: t, user: n, scope: r }) {
|
|
449
460
|
return e.embedKey === t && e.user === n && e.scope === r;
|
|
450
461
|
}
|
|
451
462
|
//#endregion
|
|
452
463
|
//#region src/lib/useChat.ts
|
|
453
|
-
async function
|
|
464
|
+
async function _e(e) {
|
|
454
465
|
if (e) try {
|
|
455
466
|
return await e() || void 0;
|
|
456
467
|
} catch {
|
|
457
468
|
return;
|
|
458
469
|
}
|
|
459
470
|
}
|
|
460
|
-
var
|
|
461
|
-
function
|
|
471
|
+
var ve = "preview-welcome";
|
|
472
|
+
function ye(e, t) {
|
|
462
473
|
return e === void 0 && t === void 0 ? void 0 : JSON.stringify([e, t]);
|
|
463
474
|
}
|
|
464
|
-
function
|
|
475
|
+
function be(e) {
|
|
465
476
|
let t = e instanceof P ? e.status : void 0;
|
|
466
477
|
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
467
478
|
}
|
|
468
|
-
var
|
|
469
|
-
function
|
|
479
|
+
var xe = 5e3;
|
|
480
|
+
function Se(e) {
|
|
470
481
|
return e instanceof P && e.code === "conversation_retired";
|
|
471
482
|
}
|
|
472
|
-
function
|
|
483
|
+
function Ce(t) {
|
|
473
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);
|
|
474
485
|
I.current = t;
|
|
475
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({
|
|
@@ -495,14 +506,14 @@ function Se(t) {
|
|
|
495
506
|
createdAt: Date.now()
|
|
496
507
|
} : null, [G]), q = i((e) => {
|
|
497
508
|
I.current.onEvent?.(e);
|
|
498
|
-
}, []),
|
|
509
|
+
}, []), J = i((e, t) => {
|
|
499
510
|
r((n) => n.map((n) => n.id === e ? {
|
|
500
511
|
...n,
|
|
501
512
|
...t
|
|
502
513
|
} : n));
|
|
503
514
|
}, []), X = i((e, t) => {
|
|
504
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;
|
|
505
|
-
t &&
|
|
516
|
+
t && J(t, {
|
|
506
517
|
content: i,
|
|
507
518
|
streaming: !1,
|
|
508
519
|
error: !0,
|
|
@@ -513,7 +524,7 @@ function Se(t) {
|
|
|
513
524
|
status: n,
|
|
514
525
|
sessionId: R.current?.sessionId ?? ""
|
|
515
526
|
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
516
|
-
}, [q,
|
|
527
|
+
}, [q, J]), Z = i(() => {
|
|
517
528
|
let e = I.current;
|
|
518
529
|
if (!e.embedKey) throw new P("No embed key: nothing says which application to open");
|
|
519
530
|
return {
|
|
@@ -528,35 +539,35 @@ function Se(t) {
|
|
|
528
539
|
sessionId: t.conversationId,
|
|
529
540
|
visitorToken: t.visitorToken
|
|
530
541
|
};
|
|
531
|
-
R.current = i, V.current =
|
|
542
|
+
R.current = i, V.current = ye(e.claim?.id, e.scope);
|
|
532
543
|
let a = n ?? H.current ?? t.agentHandle;
|
|
533
|
-
return H.current = a, U.current ?? (U.current = a),
|
|
544
|
+
return H.current = a, U.current ?? (U.current = a), me({
|
|
534
545
|
...i,
|
|
535
546
|
embedKey: e.embedKey,
|
|
536
547
|
user: e.claim?.id,
|
|
537
548
|
scope: e.scope,
|
|
538
549
|
agent: a
|
|
539
|
-
}), 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;
|
|
540
551
|
}, []), $ = i((e) => {
|
|
541
552
|
if (z.current) return z.current;
|
|
542
|
-
let t = H.current, n =
|
|
543
|
-
if (!n || !
|
|
553
|
+
let t = H.current, n = pe(t);
|
|
554
|
+
if (!n || !ge(n, {
|
|
544
555
|
embedKey: e.embedKey,
|
|
545
556
|
user: e.claim?.id,
|
|
546
557
|
scope: e.scope
|
|
547
558
|
})) return Promise.resolve(null);
|
|
548
|
-
let r =
|
|
559
|
+
let r = ae({
|
|
549
560
|
apiUrl: e.apiUrl,
|
|
550
561
|
conversationId: n.sessionId,
|
|
551
562
|
visitorToken: n.visitorToken
|
|
552
|
-
}).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(() => {
|
|
553
564
|
z.current = null;
|
|
554
565
|
});
|
|
555
566
|
return z.current = r, r;
|
|
556
567
|
}, [Q]), de = i(async () => {
|
|
557
568
|
if (R.current) return R.current;
|
|
558
569
|
if (L.current) return L.current;
|
|
559
|
-
let e = Z(), t = $(e).then((t) => t ??
|
|
570
|
+
let e = Z(), t = $(e).then((t) => t ?? Y({
|
|
560
571
|
apiUrl: e.apiUrl,
|
|
561
572
|
embedKey: e.embedKey,
|
|
562
573
|
user: e.claim,
|
|
@@ -572,7 +583,7 @@ function Se(t) {
|
|
|
572
583
|
Q,
|
|
573
584
|
$,
|
|
574
585
|
Z
|
|
575
|
-
]),
|
|
586
|
+
]), fe = i(() => {
|
|
576
587
|
if (R.current || L.current || B.current) return;
|
|
577
588
|
let e;
|
|
578
589
|
try {
|
|
@@ -592,7 +603,7 @@ function Se(t) {
|
|
|
592
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);
|
|
593
604
|
let a = i.welcomeMessage;
|
|
594
605
|
a && r((e) => e.length > 0 ? e : [{
|
|
595
|
-
id:
|
|
606
|
+
id: ve,
|
|
596
607
|
role: "assistant",
|
|
597
608
|
content: a,
|
|
598
609
|
createdAt: Date.now(),
|
|
@@ -636,18 +647,18 @@ function Se(t) {
|
|
|
636
647
|
sessionId: i.sessionId
|
|
637
648
|
});
|
|
638
649
|
let s = "", c = (e) => {
|
|
639
|
-
s += e,
|
|
650
|
+
s += e, J(o, {
|
|
640
651
|
content: s,
|
|
641
652
|
activity: void 0
|
|
642
653
|
});
|
|
643
654
|
}, l = (e) => {
|
|
644
|
-
s ||
|
|
655
|
+
s || J(o, { activity: e });
|
|
645
656
|
}, u;
|
|
646
657
|
try {
|
|
647
658
|
u = await t(i, c, a.signal, l);
|
|
648
659
|
} catch (e) {
|
|
649
|
-
if (!
|
|
650
|
-
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, {
|
|
651
662
|
content: "",
|
|
652
663
|
activity: void 0
|
|
653
664
|
}), u = await t(i, c, a.signal, l);
|
|
@@ -656,7 +667,7 @@ function Se(t) {
|
|
|
656
667
|
r((e) => e.filter((e) => e.id !== o));
|
|
657
668
|
return;
|
|
658
669
|
}
|
|
659
|
-
|
|
670
|
+
J(o, {
|
|
660
671
|
content: u.answer,
|
|
661
672
|
streaming: !1,
|
|
662
673
|
activity: void 0,
|
|
@@ -674,7 +685,7 @@ function Se(t) {
|
|
|
674
685
|
});
|
|
675
686
|
})().catch((e) => {
|
|
676
687
|
if (a.signal.aborted) {
|
|
677
|
-
|
|
688
|
+
J(o, {
|
|
678
689
|
streaming: !1,
|
|
679
690
|
activity: void 0
|
|
680
691
|
});
|
|
@@ -688,13 +699,13 @@ function Se(t) {
|
|
|
688
699
|
de,
|
|
689
700
|
q,
|
|
690
701
|
X,
|
|
691
|
-
|
|
702
|
+
J
|
|
692
703
|
]), we = i((e) => {
|
|
693
704
|
let t = e.trim();
|
|
694
705
|
if (!t && k.length === 0) return;
|
|
695
706
|
let n = k;
|
|
696
707
|
A([]), N(null), Ce(t, async (e, r, i, a) => le({
|
|
697
|
-
subjectToken: await
|
|
708
|
+
subjectToken: await _e(I.current.getSubjectToken),
|
|
698
709
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
699
710
|
conversationId: e.sessionId,
|
|
700
711
|
visitorToken: e.visitorToken,
|
|
@@ -714,7 +725,7 @@ function Se(t) {
|
|
|
714
725
|
conversationId: t.sessionId,
|
|
715
726
|
visitorToken: t.visitorToken,
|
|
716
727
|
file: e
|
|
717
|
-
})).then((e) => A((t) => [...t, e])).catch((e) => N(
|
|
728
|
+
})).then((e) => A((t) => [...t, e])).catch((e) => N(be(e))).finally(() => M((t) => {
|
|
718
729
|
let n = t.indexOf(e.name);
|
|
719
730
|
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
720
731
|
}));
|
|
@@ -739,12 +750,13 @@ function Se(t) {
|
|
|
739
750
|
}, []), Oe = i((e, t) => {
|
|
740
751
|
let n = x;
|
|
741
752
|
n && Ce(t, async (t, r, i, a) => ue({
|
|
742
|
-
subjectToken: await
|
|
753
|
+
subjectToken: await _e(I.current.getSubjectToken),
|
|
743
754
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
744
755
|
conversationId: t.sessionId,
|
|
745
756
|
visitorToken: t.visitorToken,
|
|
746
757
|
toolCallId: n.toolCallId,
|
|
747
758
|
approved: e,
|
|
759
|
+
consentHash: n.consent?.checkoutHash,
|
|
748
760
|
onToken: r,
|
|
749
761
|
onProgress: a,
|
|
750
762
|
signal: i
|
|
@@ -752,7 +764,7 @@ function Se(t) {
|
|
|
752
764
|
}, [x, Ce]), ke = i(() => {
|
|
753
765
|
F.current?.abort(), F.current = null, s(!1);
|
|
754
766
|
}, []), Ae = i(() => {
|
|
755
|
-
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({
|
|
756
768
|
type: "chatbot-reset",
|
|
757
769
|
sessionId: ""
|
|
758
770
|
});
|
|
@@ -763,7 +775,7 @@ function Se(t) {
|
|
|
763
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) {
|
|
764
776
|
try {
|
|
765
777
|
let n = Z();
|
|
766
|
-
|
|
778
|
+
me({
|
|
767
779
|
...t.conversation,
|
|
768
780
|
embedKey: n.embedKey,
|
|
769
781
|
user: n.claim?.id,
|
|
@@ -773,13 +785,13 @@ function Se(t) {
|
|
|
773
785
|
} catch {}
|
|
774
786
|
return;
|
|
775
787
|
}
|
|
776
|
-
|
|
777
|
-
}, [
|
|
788
|
+
fe();
|
|
789
|
+
}, [fe, Z]), Me = t.humanPollMs ?? xe;
|
|
778
790
|
v(() => {
|
|
779
791
|
if (!T || !c) return;
|
|
780
792
|
let e = setInterval(() => {
|
|
781
793
|
let e = R.current;
|
|
782
|
-
!e || F.current ||
|
|
794
|
+
!e || F.current || ae({
|
|
783
795
|
apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
|
|
784
796
|
conversationId: e.sessionId,
|
|
785
797
|
visitorToken: e.visitorToken
|
|
@@ -793,7 +805,7 @@ function Se(t) {
|
|
|
793
805
|
c,
|
|
794
806
|
Me
|
|
795
807
|
]);
|
|
796
|
-
let Ne =
|
|
808
|
+
let Ne = ye(t.user?.id, t.scope);
|
|
797
809
|
return v(() => {
|
|
798
810
|
if (R.current) {
|
|
799
811
|
V.current !== Ne && Ae();
|
|
@@ -824,7 +836,7 @@ function Se(t) {
|
|
|
824
836
|
approval: x,
|
|
825
837
|
withHuman: T,
|
|
826
838
|
branding: D,
|
|
827
|
-
start:
|
|
839
|
+
start: fe,
|
|
828
840
|
send: we,
|
|
829
841
|
attachments: k,
|
|
830
842
|
uploading: j,
|
|
@@ -840,7 +852,7 @@ function Se(t) {
|
|
|
840
852
|
}
|
|
841
853
|
//#endregion
|
|
842
854
|
//#region src/components/Avatar.tsx
|
|
843
|
-
function
|
|
855
|
+
function we({ name: t, color: n, url: r, size: i = 16 }) {
|
|
844
856
|
let [a, o] = e(void 0), s = !!r && a !== r;
|
|
845
857
|
return /* @__PURE__ */ l("span", {
|
|
846
858
|
class: "sqc-avatar",
|
|
@@ -856,16 +868,16 @@ function Ce({ name: t, color: n, url: r, size: i = 16 }) {
|
|
|
856
868
|
src: r,
|
|
857
869
|
alt: "",
|
|
858
870
|
onError: () => o(r)
|
|
859
|
-
}) :
|
|
871
|
+
}) : Te(t)
|
|
860
872
|
});
|
|
861
873
|
}
|
|
862
|
-
function
|
|
874
|
+
function Te(e) {
|
|
863
875
|
let t = Array.from(e.trim())[0];
|
|
864
876
|
return t ? t.toLocaleUpperCase() : "?";
|
|
865
877
|
}
|
|
866
878
|
//#endregion
|
|
867
879
|
//#region src/components/AgentRail.tsx
|
|
868
|
-
function
|
|
880
|
+
function Ee({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
869
881
|
return /* @__PURE__ */ l("nav", {
|
|
870
882
|
class: "sqc-rail",
|
|
871
883
|
"aria-label": i,
|
|
@@ -877,7 +889,7 @@ function Te({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
877
889
|
"data-tip": e.name,
|
|
878
890
|
disabled: n,
|
|
879
891
|
onClick: () => r(e.handle),
|
|
880
|
-
children: [/* @__PURE__ */ l(
|
|
892
|
+
children: [/* @__PURE__ */ l(we, {
|
|
881
893
|
name: e.name,
|
|
882
894
|
color: e.color,
|
|
883
895
|
url: e.avatarUrl,
|
|
@@ -885,28 +897,28 @@ function Te({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
885
897
|
}), /* @__PURE__ */ l("span", {
|
|
886
898
|
class: "sqc-rail__label",
|
|
887
899
|
"aria-hidden": "true",
|
|
888
|
-
children:
|
|
900
|
+
children: De(e.handle)
|
|
889
901
|
})]
|
|
890
902
|
}, e.handle))
|
|
891
903
|
});
|
|
892
904
|
}
|
|
893
|
-
function
|
|
905
|
+
function De(e) {
|
|
894
906
|
let t = e.split(/[-_]/)[0] ?? e;
|
|
895
907
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
896
908
|
}
|
|
897
909
|
//#endregion
|
|
898
910
|
//#region src/components/Composer.tsx
|
|
899
|
-
var
|
|
900
|
-
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) {
|
|
901
913
|
let n = e.slice(0, t), r = n.lastIndexOf("@");
|
|
902
914
|
if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
|
|
903
915
|
let i = n.slice(r + 1);
|
|
904
|
-
return
|
|
916
|
+
return Ae.test(i) ? {
|
|
905
917
|
start: r,
|
|
906
918
|
query: i
|
|
907
919
|
} : null;
|
|
908
920
|
}
|
|
909
|
-
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: _ }) {
|
|
910
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(() => {
|
|
911
923
|
if (!S || !c || c.length === 0) return [];
|
|
912
924
|
let e = S.query.toLowerCase();
|
|
@@ -915,8 +927,8 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
915
927
|
let e = D.current;
|
|
916
928
|
if (!e) return;
|
|
917
929
|
e.style.height = "auto";
|
|
918
|
-
let t = e.scrollHeight >
|
|
919
|
-
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";
|
|
920
932
|
}, []);
|
|
921
933
|
v(() => {
|
|
922
934
|
s && D.current?.focus(), M();
|
|
@@ -924,7 +936,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
924
936
|
u && (x((e) => e || `@${u} `), requestAnimationFrame(M));
|
|
925
937
|
}, [u, M]);
|
|
926
938
|
let ne = i((e) => {
|
|
927
|
-
C(
|
|
939
|
+
C(je(e.value, e.selectionStart ?? e.value.length)), ee(0);
|
|
928
940
|
}, []), P = i((e) => {
|
|
929
941
|
let t = D.current;
|
|
930
942
|
if (!t || !S) return;
|
|
@@ -1034,7 +1046,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1034
1046
|
children: [
|
|
1035
1047
|
/* @__PURE__ */ l("span", {
|
|
1036
1048
|
class: "sqc-mention__icon",
|
|
1037
|
-
children: /* @__PURE__ */ l(
|
|
1049
|
+
children: /* @__PURE__ */ l(we, {
|
|
1038
1050
|
name: e.name,
|
|
1039
1051
|
color: e.color,
|
|
1040
1052
|
url: e.avatarUrl,
|
|
@@ -1081,7 +1093,7 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1081
1093
|
ref: te,
|
|
1082
1094
|
type: "file",
|
|
1083
1095
|
multiple: !0,
|
|
1084
|
-
accept:
|
|
1096
|
+
accept: ke,
|
|
1085
1097
|
class: "sqc-file-input",
|
|
1086
1098
|
onChange: (e) => {
|
|
1087
1099
|
F(e.currentTarget.files), e.currentTarget.value = "";
|
|
@@ -1143,14 +1155,14 @@ function je({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1143
1155
|
}
|
|
1144
1156
|
//#endregion
|
|
1145
1157
|
//#region src/components/RichText.tsx
|
|
1146
|
-
var
|
|
1147
|
-
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) {
|
|
1148
1160
|
let i = e[t].ordered, a = [], o = t;
|
|
1149
1161
|
for (; o < e.length && e[o].depth >= n;) {
|
|
1150
1162
|
let t = e[o];
|
|
1151
1163
|
if (t.depth === n && t.ordered !== i) break;
|
|
1152
1164
|
if (t.depth > n) {
|
|
1153
|
-
let [n, i] =
|
|
1165
|
+
let [n, i] = ze(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1154
1166
|
s ? s.nested.push(n) : a.push({
|
|
1155
1167
|
key: `${r}-${o}`,
|
|
1156
1168
|
text: null,
|
|
@@ -1167,7 +1179,7 @@ function Re(e, t, n, r) {
|
|
|
1167
1179
|
let s = a.map((e) => /* @__PURE__ */ l("li", { children: [e.text === null ? null : g(e.text, e.key), e.nested] }, e.key));
|
|
1168
1180
|
return [l(i ? "ol" : "ul", { children: s }, r), o];
|
|
1169
1181
|
}
|
|
1170
|
-
function
|
|
1182
|
+
function Be(e) {
|
|
1171
1183
|
let t = e.split("\n"), n = [], r = [], i = [], a = [], o = () => {
|
|
1172
1184
|
if (!r.length) return;
|
|
1173
1185
|
let e = `p${n.length}`;
|
|
@@ -1176,7 +1188,7 @@ function ze(e) {
|
|
|
1176
1188
|
if (!i.length) return;
|
|
1177
1189
|
let e = 0;
|
|
1178
1190
|
for (; e < i.length;) {
|
|
1179
|
-
let t = `l${n.length}`, [r, a] =
|
|
1191
|
+
let t = `l${n.length}`, [r, a] = ze(i, e, i[e].depth, t);
|
|
1180
1192
|
n.push(r), e = a;
|
|
1181
1193
|
}
|
|
1182
1194
|
i = [];
|
|
@@ -1189,10 +1201,10 @@ function ze(e) {
|
|
|
1189
1201
|
};
|
|
1190
1202
|
for (let e = 0; e < t.length; e += 1) {
|
|
1191
1203
|
let d = t[e];
|
|
1192
|
-
if (
|
|
1204
|
+
if (Re.test(d)) {
|
|
1193
1205
|
u();
|
|
1194
1206
|
let r = [];
|
|
1195
|
-
for (e += 1; e < t.length && !
|
|
1207
|
+
for (e += 1; e < t.length && !Re.test(t[e]);) r.push(t[e]), e += 1;
|
|
1196
1208
|
let i = `c${n.length}`;
|
|
1197
1209
|
n.push(/* @__PURE__ */ l("pre", { children: /* @__PURE__ */ l("code", { children: r.join("\n") }) }, i));
|
|
1198
1210
|
continue;
|
|
@@ -1201,23 +1213,23 @@ function ze(e) {
|
|
|
1201
1213
|
u();
|
|
1202
1214
|
continue;
|
|
1203
1215
|
}
|
|
1204
|
-
let f =
|
|
1216
|
+
let f = Fe.exec(d);
|
|
1205
1217
|
if (f) {
|
|
1206
1218
|
u();
|
|
1207
1219
|
let e = f[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", r = `h${n.length}`;
|
|
1208
1220
|
n.push(/* @__PURE__ */ l(t, { children: g(f[2], r) }, r));
|
|
1209
1221
|
continue;
|
|
1210
1222
|
}
|
|
1211
|
-
if (
|
|
1223
|
+
if (Ie.test(d)) {
|
|
1212
1224
|
u(), n.push(/* @__PURE__ */ l("hr", {}, `r${n.length}`));
|
|
1213
1225
|
continue;
|
|
1214
1226
|
}
|
|
1215
|
-
let p =
|
|
1227
|
+
let p = Le.exec(d);
|
|
1216
1228
|
if (p) {
|
|
1217
1229
|
o(), s(), a.push(p[1]);
|
|
1218
1230
|
continue;
|
|
1219
1231
|
}
|
|
1220
|
-
let m =
|
|
1232
|
+
let m = Ne.exec(d), h = m ? null : Pe.exec(d), _ = m ?? h;
|
|
1221
1233
|
if (_) {
|
|
1222
1234
|
o(), c(), i.push({
|
|
1223
1235
|
depth: _[1].replace(/\t/g, " ").length,
|
|
@@ -1230,7 +1242,7 @@ function ze(e) {
|
|
|
1230
1242
|
}
|
|
1231
1243
|
return u(), n;
|
|
1232
1244
|
}
|
|
1233
|
-
function
|
|
1245
|
+
function Ve(e) {
|
|
1234
1246
|
let t = o(null), { form: n, locked: i, language: a } = e;
|
|
1235
1247
|
return r(() => {
|
|
1236
1248
|
h();
|
|
@@ -1249,9 +1261,9 @@ function Be(e) {
|
|
|
1249
1261
|
children: n.fields.map((e) => /* @__PURE__ */ l("p", { children: e.label }, e.name))
|
|
1250
1262
|
});
|
|
1251
1263
|
}
|
|
1252
|
-
function
|
|
1264
|
+
function He(e, n, r) {
|
|
1253
1265
|
switch (e.kind) {
|
|
1254
|
-
case "markdown": return /* @__PURE__ */ l(t, { children:
|
|
1266
|
+
case "markdown": return /* @__PURE__ */ l(t, { children: Be(e.text) });
|
|
1255
1267
|
case "table": return /* @__PURE__ */ l("sqc-table", {
|
|
1256
1268
|
table: {
|
|
1257
1269
|
header: e.header,
|
|
@@ -1267,24 +1279,24 @@ function Ve(e, n, r) {
|
|
|
1267
1279
|
locked: r,
|
|
1268
1280
|
language: n.code
|
|
1269
1281
|
});
|
|
1270
|
-
case "form": return /* @__PURE__ */ l(
|
|
1282
|
+
case "form": return /* @__PURE__ */ l(Ve, {
|
|
1271
1283
|
form: e.form,
|
|
1272
1284
|
locked: r,
|
|
1273
1285
|
language: n.code
|
|
1274
1286
|
});
|
|
1275
1287
|
}
|
|
1276
1288
|
}
|
|
1277
|
-
function
|
|
1289
|
+
function Ue({ text: e, locale: n, live: r, confirmable: i }) {
|
|
1278
1290
|
let { blocks: a, confirm: o } = _(e, n.code, i === !0), s = !r;
|
|
1279
|
-
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", {
|
|
1280
1292
|
locked: s,
|
|
1281
1293
|
language: n.code
|
|
1282
1294
|
})] });
|
|
1283
1295
|
}
|
|
1284
1296
|
//#endregion
|
|
1285
1297
|
//#region src/components/MessageList.tsx
|
|
1286
|
-
var
|
|
1287
|
-
function
|
|
1298
|
+
var We = 80;
|
|
1299
|
+
function Ge({ at: e, locale: t }) {
|
|
1288
1300
|
let n = new Date(e);
|
|
1289
1301
|
return /* @__PURE__ */ l("time", {
|
|
1290
1302
|
class: "sqc-msg__time",
|
|
@@ -1295,7 +1307,7 @@ function We({ at: e, locale: t }) {
|
|
|
1295
1307
|
})
|
|
1296
1308
|
});
|
|
1297
1309
|
}
|
|
1298
|
-
function
|
|
1310
|
+
function Ke(e) {
|
|
1299
1311
|
let { call: t, locked: n, locale: i } = e, a = i.code, s = o(null);
|
|
1300
1312
|
r(() => {
|
|
1301
1313
|
h();
|
|
@@ -1334,7 +1346,7 @@ function Ge(e) {
|
|
|
1334
1346
|
]
|
|
1335
1347
|
});
|
|
1336
1348
|
}
|
|
1337
|
-
function
|
|
1349
|
+
function qe({ file: t, load: n }) {
|
|
1338
1350
|
let [r, i] = e(null);
|
|
1339
1351
|
return v(() => {
|
|
1340
1352
|
let e = null, r = !0;
|
|
@@ -1352,7 +1364,7 @@ function Ke({ file: t, load: n }) {
|
|
|
1352
1364
|
children: t.filename
|
|
1353
1365
|
});
|
|
1354
1366
|
}
|
|
1355
|
-
function
|
|
1367
|
+
function Je(e) {
|
|
1356
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]);
|
|
1357
1369
|
return r(() => {
|
|
1358
1370
|
h();
|
|
@@ -1372,13 +1384,13 @@ function qe(e) {
|
|
|
1372
1384
|
children: t.filename
|
|
1373
1385
|
});
|
|
1374
1386
|
}
|
|
1375
|
-
function
|
|
1387
|
+
function Ye({ files: e, load: t, language: n }) {
|
|
1376
1388
|
return e.length === 0 || !t ? null : /* @__PURE__ */ l("div", {
|
|
1377
1389
|
class: "sqc-attachments sqc-attachments--sent",
|
|
1378
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(
|
|
1390
|
+
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(qe, {
|
|
1379
1391
|
file: e,
|
|
1380
1392
|
load: t
|
|
1381
|
-
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(
|
|
1393
|
+
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(Je, {
|
|
1382
1394
|
file: e,
|
|
1383
1395
|
load: t,
|
|
1384
1396
|
language: n
|
|
@@ -1392,17 +1404,17 @@ function Je({ files: e, load: t, language: n }) {
|
|
|
1392
1404
|
}, e.id))
|
|
1393
1405
|
});
|
|
1394
1406
|
}
|
|
1395
|
-
function
|
|
1407
|
+
function Xe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onLoadAttachment: a }) {
|
|
1396
1408
|
let o = e.streaming && !e.content, s = !!e.approval;
|
|
1397
1409
|
return /* @__PURE__ */ l("div", {
|
|
1398
1410
|
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
1399
1411
|
children: [e.role === "assistant" && /* @__PURE__ */ l("div", {
|
|
1400
1412
|
class: "sqc-msg__who",
|
|
1401
|
-
children: [e.agent ? /* @__PURE__ */ l(
|
|
1413
|
+
children: [e.agent ? /* @__PURE__ */ l(we, {
|
|
1402
1414
|
name: e.agent.name,
|
|
1403
1415
|
color: e.agent.color,
|
|
1404
1416
|
url: e.agent.avatarUrl
|
|
1405
|
-
}) : /* @__PURE__ */ l(
|
|
1417
|
+
}) : /* @__PURE__ */ l(Qe, {}), e.authorName ?? e.agent?.name ?? n]
|
|
1406
1418
|
}), /* @__PURE__ */ l("div", {
|
|
1407
1419
|
class: "sqc-msg__bubble",
|
|
1408
1420
|
children: [o ? /* @__PURE__ */ l("span", {
|
|
@@ -1423,7 +1435,7 @@ function Ye({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1423
1435
|
}) : /* @__PURE__ */ l("div", {
|
|
1424
1436
|
class: "sqc-msg__body",
|
|
1425
1437
|
children: [
|
|
1426
|
-
/* @__PURE__ */ l(
|
|
1438
|
+
/* @__PURE__ */ l(Ue, {
|
|
1427
1439
|
text: e.content,
|
|
1428
1440
|
locale: t,
|
|
1429
1441
|
live: r,
|
|
@@ -1433,29 +1445,29 @@ function Ye({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1433
1445
|
class: "sqc-caret",
|
|
1434
1446
|
"aria-hidden": "true"
|
|
1435
1447
|
}),
|
|
1436
|
-
s && /* @__PURE__ */ l(
|
|
1448
|
+
s && /* @__PURE__ */ l(Ke, {
|
|
1437
1449
|
locale: t,
|
|
1438
1450
|
call: e.content.trim() === "" ? e.approval : void 0,
|
|
1439
1451
|
locked: !i
|
|
1440
1452
|
}),
|
|
1441
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(
|
|
1453
|
+
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(Ze, {
|
|
1442
1454
|
message: e,
|
|
1443
1455
|
locale: t
|
|
1444
1456
|
}),
|
|
1445
|
-
/* @__PURE__ */ l(
|
|
1457
|
+
/* @__PURE__ */ l(Ye, {
|
|
1446
1458
|
files: e.attachments ?? [],
|
|
1447
1459
|
load: a,
|
|
1448
1460
|
language: t.code
|
|
1449
1461
|
})
|
|
1450
1462
|
]
|
|
1451
|
-
}), !o && /* @__PURE__ */ l(
|
|
1463
|
+
}), !o && /* @__PURE__ */ l(Ge, {
|
|
1452
1464
|
at: e.createdAt,
|
|
1453
1465
|
locale: t
|
|
1454
1466
|
})]
|
|
1455
1467
|
})]
|
|
1456
1468
|
});
|
|
1457
1469
|
}
|
|
1458
|
-
function
|
|
1470
|
+
function Ze({ message: e, locale: n }) {
|
|
1459
1471
|
let r = e.offered ?? [];
|
|
1460
1472
|
return /* @__PURE__ */ l("p", {
|
|
1461
1473
|
class: "sqc-msg__unaddressed",
|
|
@@ -1472,7 +1484,7 @@ function Xe({ message: e, locale: n }) {
|
|
|
1472
1484
|
]
|
|
1473
1485
|
});
|
|
1474
1486
|
}
|
|
1475
|
-
function
|
|
1487
|
+
function Qe() {
|
|
1476
1488
|
return /* @__PURE__ */ l("svg", {
|
|
1477
1489
|
viewBox: "0 0 24 24",
|
|
1478
1490
|
fill: "none",
|
|
@@ -1484,7 +1496,7 @@ function Ze() {
|
|
|
1484
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" })
|
|
1485
1497
|
});
|
|
1486
1498
|
}
|
|
1487
|
-
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 }) {
|
|
1488
1500
|
let g = o(null), _ = o(!0);
|
|
1489
1501
|
r(() => {
|
|
1490
1502
|
let e = g.current;
|
|
@@ -1535,7 +1547,7 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1535
1547
|
let e = g.current;
|
|
1536
1548
|
if (!e) return;
|
|
1537
1549
|
let t = () => {
|
|
1538
|
-
_.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1550
|
+
_.current = e.scrollHeight - e.scrollTop - e.clientHeight < We;
|
|
1539
1551
|
};
|
|
1540
1552
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1541
1553
|
}, []), /* @__PURE__ */ l("div", {
|
|
@@ -1545,7 +1557,7 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1545
1557
|
"aria-live": "polite",
|
|
1546
1558
|
"aria-atomic": "false",
|
|
1547
1559
|
children: [
|
|
1548
|
-
e.map((r, i) => /* @__PURE__ */ l(
|
|
1560
|
+
e.map((r, i) => /* @__PURE__ */ l(Xe, {
|
|
1549
1561
|
message: r,
|
|
1550
1562
|
locale: t,
|
|
1551
1563
|
assistantName: n,
|
|
@@ -1572,28 +1584,28 @@ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1572
1584
|
}
|
|
1573
1585
|
//#endregion
|
|
1574
1586
|
//#region src/components/ChatbotWidget.tsx
|
|
1575
|
-
var
|
|
1576
|
-
function
|
|
1587
|
+
var et = { width: "min(392px, 100vw)" }, tt = /* @__PURE__ */ new Set(["sessionId"]);
|
|
1588
|
+
function nt(e) {
|
|
1577
1589
|
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1578
1590
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1579
1591
|
}
|
|
1580
|
-
function
|
|
1592
|
+
function rt(e) {
|
|
1581
1593
|
if (!e) return [];
|
|
1582
1594
|
let t = [];
|
|
1583
1595
|
for (let [n, r] of Object.entries(e)) {
|
|
1584
|
-
if (
|
|
1596
|
+
if (tt.has(n) || typeof r != "string" && !w(r)) continue;
|
|
1585
1597
|
let e = C(r);
|
|
1586
1598
|
e && t.push({
|
|
1587
|
-
label:
|
|
1599
|
+
label: nt(n),
|
|
1588
1600
|
value: e
|
|
1589
1601
|
});
|
|
1590
1602
|
}
|
|
1591
1603
|
return t;
|
|
1592
1604
|
}
|
|
1593
|
-
function
|
|
1605
|
+
function it(e, t) {
|
|
1594
1606
|
return e?.trim() ? e : t;
|
|
1595
1607
|
}
|
|
1596
|
-
function
|
|
1608
|
+
function at(t) {
|
|
1597
1609
|
let [n, r] = e(!1);
|
|
1598
1610
|
return v(() => {
|
|
1599
1611
|
if (t !== "auto" || typeof matchMedia != "function") return;
|
|
@@ -1603,9 +1615,9 @@ function it(t) {
|
|
|
1603
1615
|
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
1604
1616
|
}, [t]), t === "dark" ? "dark" : t === "light" ? "light" : n ? "dark" : "light";
|
|
1605
1617
|
}
|
|
1606
|
-
function
|
|
1618
|
+
function ot(t) {
|
|
1607
1619
|
a();
|
|
1608
|
-
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({
|
|
1609
1621
|
embedKey: t.embedKey,
|
|
1610
1622
|
user: t.user,
|
|
1611
1623
|
scope: t.scope,
|
|
@@ -1647,43 +1659,43 @@ function at(t) {
|
|
|
1647
1659
|
k,
|
|
1648
1660
|
O
|
|
1649
1661
|
]);
|
|
1650
|
-
let q = P.length >= 2,
|
|
1662
|
+
let q = P.length >= 2, J = w, ie = i(() => {
|
|
1651
1663
|
d(!1), ee();
|
|
1652
|
-
}, [ee]),
|
|
1664
|
+
}, [ee]), Y = o({
|
|
1653
1665
|
openPanel: G,
|
|
1654
1666
|
closePanel: K,
|
|
1655
|
-
send:
|
|
1656
|
-
reset:
|
|
1667
|
+
send: J,
|
|
1668
|
+
reset: ie,
|
|
1657
1669
|
sessionId: N
|
|
1658
1670
|
});
|
|
1659
|
-
|
|
1671
|
+
Y.current = {
|
|
1660
1672
|
openPanel: G,
|
|
1661
1673
|
closePanel: K,
|
|
1662
|
-
send:
|
|
1663
|
-
reset:
|
|
1674
|
+
send: J,
|
|
1675
|
+
reset: ie,
|
|
1664
1676
|
sessionId: N
|
|
1665
1677
|
};
|
|
1666
|
-
let
|
|
1667
|
-
open: () =>
|
|
1668
|
-
close: () =>
|
|
1669
|
-
toggle: () => W.current ?
|
|
1670
|
-
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(),
|
|
1671
1683
|
send: (e) => {
|
|
1672
|
-
|
|
1684
|
+
Y.current.openPanel(), Y.current.send(e);
|
|
1673
1685
|
},
|
|
1674
1686
|
isOpen: () => W.current,
|
|
1675
|
-
sessionId: () =>
|
|
1676
|
-
}),
|
|
1677
|
-
r(() => (
|
|
1687
|
+
sessionId: () => Y.current.sessionId
|
|
1688
|
+
}), oe = t.bind;
|
|
1689
|
+
r(() => (oe?.(ae.current), () => oe?.(null)), [oe]), v(() => {
|
|
1678
1690
|
if (!s) return;
|
|
1679
1691
|
let e = (e) => {
|
|
1680
1692
|
e.key === "Escape" && (e.stopPropagation(), K());
|
|
1681
1693
|
};
|
|
1682
1694
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1683
1695
|
}, [K, s]);
|
|
1684
|
-
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 = {
|
|
1685
1697
|
...t.accent ? { "--sqc-accent": t.accent } : {},
|
|
1686
|
-
"--sqc-width": t.width ??
|
|
1698
|
+
"--sqc-width": t.width ?? et.width
|
|
1687
1699
|
};
|
|
1688
1700
|
return /* @__PURE__ */ l("div", {
|
|
1689
1701
|
class: "sqc",
|
|
@@ -1691,7 +1703,7 @@ function at(t) {
|
|
|
1691
1703
|
"data-position": t.position ?? "bottom-right",
|
|
1692
1704
|
"data-layout": t.layout ?? "sidebar",
|
|
1693
1705
|
"data-open": s ? "true" : "false",
|
|
1694
|
-
style:
|
|
1706
|
+
style: le,
|
|
1695
1707
|
children: [/* @__PURE__ */ l("button", {
|
|
1696
1708
|
ref: p,
|
|
1697
1709
|
type: "button",
|
|
@@ -1705,7 +1717,7 @@ function at(t) {
|
|
|
1705
1717
|
children: /* @__PURE__ */ l("slot", {
|
|
1706
1718
|
name: "launcher-icon",
|
|
1707
1719
|
class: "sqc-slot-icon",
|
|
1708
|
-
children: /* @__PURE__ */ l(
|
|
1720
|
+
children: /* @__PURE__ */ l(Qe, {})
|
|
1709
1721
|
})
|
|
1710
1722
|
}), u && /* @__PURE__ */ l("span", {
|
|
1711
1723
|
class: "sqc-launcher__badge",
|
|
@@ -1724,7 +1736,7 @@ function at(t) {
|
|
|
1724
1736
|
/* @__PURE__ */ l("span", {
|
|
1725
1737
|
class: "sqc-header__icon",
|
|
1726
1738
|
"aria-hidden": "true",
|
|
1727
|
-
children: /* @__PURE__ */ l(
|
|
1739
|
+
children: /* @__PURE__ */ l(Qe, {})
|
|
1728
1740
|
}),
|
|
1729
1741
|
/* @__PURE__ */ l("div", {
|
|
1730
1742
|
class: "sqc-header__titles",
|
|
@@ -1733,13 +1745,13 @@ function at(t) {
|
|
|
1733
1745
|
children: _
|
|
1734
1746
|
}), /* @__PURE__ */ l("p", {
|
|
1735
1747
|
class: "sqc-header__sub",
|
|
1736
|
-
children:
|
|
1748
|
+
children: it(t.subheading, g.subheading)
|
|
1737
1749
|
})]
|
|
1738
1750
|
}),
|
|
1739
1751
|
/* @__PURE__ */ l("button", {
|
|
1740
1752
|
type: "button",
|
|
1741
1753
|
class: "sqc-icon-btn",
|
|
1742
|
-
onClick:
|
|
1754
|
+
onClick: ie,
|
|
1743
1755
|
"aria-label": g.newConversation,
|
|
1744
1756
|
"data-tip": g.newConversation,
|
|
1745
1757
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1773,7 +1785,7 @@ function at(t) {
|
|
|
1773
1785
|
]
|
|
1774
1786
|
}), /* @__PURE__ */ l("div", {
|
|
1775
1787
|
class: "sqc-panel__body",
|
|
1776
|
-
children: [q && /* @__PURE__ */ l(
|
|
1788
|
+
children: [q && /* @__PURE__ */ l(Ee, {
|
|
1777
1789
|
handles: P,
|
|
1778
1790
|
active: I || void 0,
|
|
1779
1791
|
disabled: A,
|
|
@@ -1782,31 +1794,31 @@ function at(t) {
|
|
|
1782
1794
|
}), /* @__PURE__ */ l("div", {
|
|
1783
1795
|
class: "sqc-panel__main",
|
|
1784
1796
|
children: [
|
|
1785
|
-
(t.showContext ?? !0) &&
|
|
1797
|
+
(t.showContext ?? !0) && X.length > 0 && /* @__PURE__ */ l("div", {
|
|
1786
1798
|
class: "sqc-context",
|
|
1787
1799
|
"aria-label": g.context.region,
|
|
1788
|
-
children:
|
|
1800
|
+
children: X.map((e) => /* @__PURE__ */ l("span", {
|
|
1789
1801
|
class: "sqc-chip",
|
|
1790
1802
|
title: `${e.label}: ${e.value}`,
|
|
1791
1803
|
children: [/* @__PURE__ */ l("b", { children: e.label }), e.value]
|
|
1792
1804
|
}, e.label))
|
|
1793
1805
|
}),
|
|
1794
|
-
/* @__PURE__ */ l(
|
|
1806
|
+
/* @__PURE__ */ l($e, {
|
|
1795
1807
|
messages: j,
|
|
1796
1808
|
locale: h,
|
|
1797
1809
|
assistantName: x,
|
|
1798
|
-
suggestions:
|
|
1799
|
-
showSuggestions: !
|
|
1810
|
+
suggestions: ce,
|
|
1811
|
+
showSuggestions: !se,
|
|
1800
1812
|
busy: A,
|
|
1801
1813
|
withHuman: M,
|
|
1802
|
-
onSuggestion:
|
|
1803
|
-
onChoice:
|
|
1814
|
+
onSuggestion: J,
|
|
1815
|
+
onChoice: J,
|
|
1804
1816
|
onDecide: T,
|
|
1805
1817
|
onCompose: () => f.current?.querySelector(".sqc-composer__input")?.focus(),
|
|
1806
1818
|
onLoadAttachment: U
|
|
1807
1819
|
}),
|
|
1808
|
-
/* @__PURE__ */ l(
|
|
1809
|
-
placeholder:
|
|
1820
|
+
/* @__PURE__ */ l(Me, {
|
|
1821
|
+
placeholder: it(t.placeholder, g.placeholder),
|
|
1810
1822
|
locale: h,
|
|
1811
1823
|
busy: A,
|
|
1812
1824
|
autoFocus: s,
|
|
@@ -1817,7 +1829,7 @@ function at(t) {
|
|
|
1817
1829
|
attachmentError: B ? g.attachments[B] : void 0,
|
|
1818
1830
|
onAttach: V,
|
|
1819
1831
|
onDetach: H,
|
|
1820
|
-
onSend:
|
|
1832
|
+
onSend: J,
|
|
1821
1833
|
onStop: E
|
|
1822
1834
|
}),
|
|
1823
1835
|
/* @__PURE__ */ l("p", {
|
|
@@ -1841,7 +1853,7 @@ function at(t) {
|
|
|
1841
1853
|
}
|
|
1842
1854
|
//#endregion
|
|
1843
1855
|
//#region src/styles.css?inline
|
|
1844
|
-
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 = [
|
|
1845
1857
|
"embed-key",
|
|
1846
1858
|
"context",
|
|
1847
1859
|
"user",
|
|
@@ -1861,21 +1873,21 @@ var ot = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480
|
|
|
1861
1873
|
"persist-open",
|
|
1862
1874
|
"show-context",
|
|
1863
1875
|
"locale"
|
|
1864
|
-
],
|
|
1865
|
-
function
|
|
1866
|
-
if (
|
|
1876
|
+
], ut;
|
|
1877
|
+
function dt() {
|
|
1878
|
+
if (ut !== void 0) return ut;
|
|
1867
1879
|
try {
|
|
1868
1880
|
let e = new CSSStyleSheet();
|
|
1869
|
-
e.replaceSync(
|
|
1881
|
+
e.replaceSync(st), ut = e;
|
|
1870
1882
|
} catch {
|
|
1871
|
-
|
|
1883
|
+
ut = null;
|
|
1872
1884
|
}
|
|
1873
|
-
return
|
|
1885
|
+
return ut;
|
|
1874
1886
|
}
|
|
1875
|
-
function
|
|
1876
|
-
typeof console < "u" && console.warn(`[${
|
|
1887
|
+
function ft(e, t) {
|
|
1888
|
+
typeof console < "u" && console.warn(`[${ct}] ${e}`, t ?? "");
|
|
1877
1889
|
}
|
|
1878
|
-
function
|
|
1890
|
+
function pt(e) {
|
|
1879
1891
|
if (!(!e || !e.trim())) try {
|
|
1880
1892
|
let t = JSON.parse(e);
|
|
1881
1893
|
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
@@ -1886,45 +1898,45 @@ function ft(e) {
|
|
|
1886
1898
|
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
1887
1899
|
};
|
|
1888
1900
|
}
|
|
1889
|
-
|
|
1901
|
+
ft("the \"user\" attribute needs an object with an id", e);
|
|
1890
1902
|
} catch (e) {
|
|
1891
|
-
|
|
1903
|
+
ft("the \"user\" attribute is not valid JSON", e);
|
|
1892
1904
|
}
|
|
1893
1905
|
}
|
|
1894
|
-
function
|
|
1906
|
+
function mt(e) {
|
|
1895
1907
|
if (!(!e || !e.trim())) try {
|
|
1896
1908
|
let t = JSON.parse(e);
|
|
1897
1909
|
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
1898
|
-
|
|
1910
|
+
ft("the `context` attribute must be a JSON object", e);
|
|
1899
1911
|
} catch (e) {
|
|
1900
|
-
|
|
1912
|
+
ft("the `context` attribute is not valid JSON", e);
|
|
1901
1913
|
}
|
|
1902
1914
|
}
|
|
1903
|
-
function
|
|
1915
|
+
function ht(e) {
|
|
1904
1916
|
if (!(!e || !e.trim())) {
|
|
1905
1917
|
if (e.trim().startsWith("[")) try {
|
|
1906
1918
|
let t = JSON.parse(e);
|
|
1907
1919
|
if (Array.isArray(t)) return t.map(String);
|
|
1908
1920
|
} catch (e) {
|
|
1909
|
-
|
|
1921
|
+
ft("the `suggestions` attribute is not valid JSON", e);
|
|
1910
1922
|
return;
|
|
1911
1923
|
}
|
|
1912
1924
|
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
1913
1925
|
}
|
|
1914
1926
|
}
|
|
1915
|
-
function
|
|
1927
|
+
function gt(e) {
|
|
1916
1928
|
if (e !== null) return e !== "false" && e !== "0";
|
|
1917
1929
|
}
|
|
1918
|
-
function
|
|
1930
|
+
function _t(e) {
|
|
1919
1931
|
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
1920
1932
|
}
|
|
1921
|
-
function
|
|
1933
|
+
function vt(e) {
|
|
1922
1934
|
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
1923
1935
|
}
|
|
1924
|
-
function
|
|
1936
|
+
function yt(e) {
|
|
1925
1937
|
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
1926
1938
|
}
|
|
1927
|
-
var
|
|
1939
|
+
var bt = [
|
|
1928
1940
|
"context",
|
|
1929
1941
|
"embedKey",
|
|
1930
1942
|
"user",
|
|
@@ -1932,7 +1944,7 @@ var yt = [
|
|
|
1932
1944
|
"getSubjectToken",
|
|
1933
1945
|
"agent"
|
|
1934
1946
|
];
|
|
1935
|
-
function
|
|
1947
|
+
function xt() {
|
|
1936
1948
|
var e, t, r, i, a, o, d, p, h, g, _, v, y, b, x;
|
|
1937
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 {
|
|
1938
1950
|
constructor() {
|
|
@@ -1946,14 +1958,14 @@ function bt() {
|
|
|
1946
1958
|
}), f(this, x, (e) => {
|
|
1947
1959
|
s(r, this, e), e && s(o, this, e.sessionId());
|
|
1948
1960
|
});
|
|
1949
|
-
let e = this.attachShadow({ mode: "open" }), n =
|
|
1961
|
+
let e = this.attachShadow({ mode: "open" }), n = dt();
|
|
1950
1962
|
if (n) e.adoptedStyleSheets = [n];
|
|
1951
1963
|
else {
|
|
1952
1964
|
let t = document.createElement("style");
|
|
1953
|
-
t.textContent =
|
|
1965
|
+
t.textContent = st, e.append(t);
|
|
1954
1966
|
}
|
|
1955
1967
|
s(t, this, document.createElement("div")), e.append(c(t, this));
|
|
1956
|
-
for (let e of
|
|
1968
|
+
for (let e of bt) {
|
|
1957
1969
|
if (!Object.hasOwn(this, e)) continue;
|
|
1958
1970
|
let t = this[e];
|
|
1959
1971
|
delete this[e], this[e] = t;
|
|
@@ -1968,14 +1980,14 @@ function bt() {
|
|
|
1968
1980
|
attributeChangedCallback(e, t, n) {
|
|
1969
1981
|
if (t !== n) {
|
|
1970
1982
|
if (e === "open" && c(r, this)) {
|
|
1971
|
-
|
|
1983
|
+
gt(n) ? c(r, this).open() : c(r, this).close();
|
|
1972
1984
|
return;
|
|
1973
1985
|
}
|
|
1974
1986
|
m(y, this, S).call(this);
|
|
1975
1987
|
}
|
|
1976
1988
|
}
|
|
1977
1989
|
get context() {
|
|
1978
|
-
return c(d, this) ??
|
|
1990
|
+
return c(d, this) ?? mt(this.getAttribute("context"));
|
|
1979
1991
|
}
|
|
1980
1992
|
set context(e) {
|
|
1981
1993
|
s(d, this, e), m(y, this, S).call(this);
|
|
@@ -1993,7 +2005,7 @@ function bt() {
|
|
|
1993
2005
|
s(h, this, e), m(y, this, S).call(this);
|
|
1994
2006
|
}
|
|
1995
2007
|
get user() {
|
|
1996
|
-
return c(p, this) ??
|
|
2008
|
+
return c(p, this) ?? pt(this.getAttribute("user"));
|
|
1997
2009
|
}
|
|
1998
2010
|
set user(e) {
|
|
1999
2011
|
s(p, this, e), m(y, this, S).call(this);
|
|
@@ -2011,7 +2023,7 @@ function bt() {
|
|
|
2011
2023
|
s(_, this, e), m(y, this, S).call(this);
|
|
2012
2024
|
}
|
|
2013
2025
|
get open() {
|
|
2014
|
-
return c(r, this)?.isOpen() ??
|
|
2026
|
+
return c(r, this)?.isOpen() ?? gt(this.getAttribute("open")) ?? !1;
|
|
2015
2027
|
}
|
|
2016
2028
|
set open(e) {
|
|
2017
2029
|
e ? this.openChat() : this.closeChat();
|
|
@@ -2033,12 +2045,12 @@ function bt() {
|
|
|
2033
2045
|
}
|
|
2034
2046
|
sendMessage(e) {
|
|
2035
2047
|
if (!c(r, this)) {
|
|
2036
|
-
|
|
2048
|
+
ft("sendMessage() called before the component was mounted — ignored");
|
|
2037
2049
|
return;
|
|
2038
2050
|
}
|
|
2039
2051
|
c(r, this).send(e);
|
|
2040
2052
|
}
|
|
2041
|
-
}, M(e, "observedAttributes",
|
|
2053
|
+
}, M(e, "observedAttributes", lt), e;
|
|
2042
2054
|
function S() {
|
|
2043
2055
|
c(i, this) || !c(a, this) || (s(i, this, !0), queueMicrotask(() => {
|
|
2044
2056
|
s(i, this, !1), c(a, this) && m(y, this, C).call(this);
|
|
@@ -2046,7 +2058,7 @@ function bt() {
|
|
|
2046
2058
|
}
|
|
2047
2059
|
function C() {
|
|
2048
2060
|
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
2049
|
-
n(/* @__PURE__ */ l(
|
|
2061
|
+
n(/* @__PURE__ */ l(ot, {
|
|
2050
2062
|
embedKey: this.embedKey,
|
|
2051
2063
|
context: this.context,
|
|
2052
2064
|
user: this.user,
|
|
@@ -2058,29 +2070,29 @@ function bt() {
|
|
|
2058
2070
|
assistantName: e("assistant-name"),
|
|
2059
2071
|
placeholder: e("placeholder"),
|
|
2060
2072
|
greeting: e("greeting"),
|
|
2061
|
-
suggestions:
|
|
2073
|
+
suggestions: ht(this.getAttribute("suggestions")),
|
|
2062
2074
|
width: e("width"),
|
|
2063
2075
|
accent: e("accent"),
|
|
2064
|
-
theme:
|
|
2065
|
-
position:
|
|
2066
|
-
layout:
|
|
2067
|
-
defaultOpen:
|
|
2068
|
-
persistOpen:
|
|
2069
|
-
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,
|
|
2070
2082
|
locale: e("locale"),
|
|
2071
2083
|
onEvent: c(b, this),
|
|
2072
2084
|
bind: c(x, this)
|
|
2073
2085
|
}), c(t, this));
|
|
2074
2086
|
}
|
|
2075
2087
|
}
|
|
2076
|
-
var
|
|
2077
|
-
function
|
|
2078
|
-
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));
|
|
2079
2091
|
}
|
|
2080
2092
|
//#endregion
|
|
2081
2093
|
//#region src/index.ts
|
|
2082
|
-
|
|
2094
|
+
Ct();
|
|
2083
2095
|
//#endregion
|
|
2084
|
-
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 };
|
|
2085
2097
|
|
|
2086
|
-
//# sourceMappingURL=src-
|
|
2098
|
+
//# sourceMappingURL=src-CwY6PP_H.js.map
|