@squadico/chatbot 1.5.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +4 -4
  2. package/dist/{answer-Bi8GWLyA.cjs → answer-BO2Hs9k1.cjs} +2 -2
  3. package/dist/{answer-Bi8GWLyA.cjs.map → answer-BO2Hs9k1.cjs.map} +1 -1
  4. package/dist/{answer-BDuY6oLY.js → answer-DF91dBOx.js} +2 -2
  5. package/dist/{answer-BDuY6oLY.js.map → answer-DF91dBOx.js.map} +1 -1
  6. package/dist/chatbot-widgets.global.js +3 -3
  7. package/dist/chatbot-widgets.global.js.map +1 -1
  8. package/dist/chatbot.global.js +11 -11
  9. package/dist/chatbot.global.js.map +1 -1
  10. package/dist/components/AgentRail.d.ts +3 -3
  11. package/dist/components/AgentRail.d.ts.map +1 -1
  12. package/dist/components/ChatbotWidget.d.ts.map +1 -1
  13. package/dist/extras-BeCZR-6X.cjs +4 -0
  14. package/dist/extras-BeCZR-6X.cjs.map +1 -0
  15. package/dist/{extras-BSCTuiit.js → extras-D94278IT.js} +135 -112
  16. package/dist/extras-D94278IT.js.map +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/lib/client.d.ts +4 -0
  20. package/dist/lib/client.d.ts.map +1 -1
  21. package/dist/lib/conversation.d.ts +10 -4
  22. package/dist/lib/conversation.d.ts.map +1 -1
  23. package/dist/lib/useChat.d.ts +10 -2
  24. package/dist/lib/useChat.d.ts.map +1 -1
  25. package/dist/react.cjs +1 -1
  26. package/dist/react.js +1 -1
  27. package/dist/{src-B7GLD1Xs.js → src-Bm_aRvFA.js} +604 -539
  28. package/dist/src-Bm_aRvFA.js.map +1 -0
  29. package/dist/src-DcPZdalT.cjs +7 -0
  30. package/dist/src-DcPZdalT.cjs.map +1 -0
  31. package/dist/types.d.ts +2 -0
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/widgets/approval/SqcApproval.d.ts.map +1 -1
  34. package/dist/widgets/extras-loader.d.ts +1 -1
  35. package/dist/widgets.cjs +1 -1
  36. package/dist/widgets.js +2 -2
  37. package/package.json +1 -1
  38. package/dist/extras-BAqWS9pU.cjs +0 -4
  39. package/dist/extras-BAqWS9pU.cjs.map +0 -1
  40. package/dist/extras-BSCTuiit.js.map +0 -1
  41. package/dist/lib/rail.d.ts +0 -20
  42. package/dist/lib/rail.d.ts.map +0 -1
  43. package/dist/src-B7GLD1Xs.js.map +0 -1
  44. package/dist/src-DuYhMbNf.cjs +0 -7
  45. package/dist/src-DuYhMbNf.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-BDuY6oLY.js";
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-DF91dBOx.js";
2
2
  //#region src/lib/context.ts
3
3
  var x = /* @__PURE__ */ new Set(["sessionId"]);
4
4
  function S(e) {
@@ -17,7 +17,7 @@ function C(e) {
17
17
  function w(e) {
18
18
  return !!e && typeof e == "object" && !Array.isArray(e);
19
19
  }
20
- function T(e) {
20
+ function ee(e) {
21
21
  let t = {};
22
22
  for (let [n, r] of Object.entries(e)) {
23
23
  if (x.has(n) || !w(r)) {
@@ -31,11 +31,11 @@ function T(e) {
31
31
  }
32
32
  //#endregion
33
33
  //#region src/lib/openState.ts
34
- var ee = "squadico-chatbot:open";
34
+ var T = "squadico-chatbot:open";
35
35
  function E() {
36
36
  try {
37
37
  if (typeof sessionStorage > "u") return;
38
- let e = sessionStorage.getItem(ee);
38
+ let e = sessionStorage.getItem(T);
39
39
  return e === "1" || e !== "0" && void 0;
40
40
  } catch {
41
41
  return;
@@ -44,27 +44,15 @@ function E() {
44
44
  function D(e) {
45
45
  try {
46
46
  if (typeof sessionStorage > "u") return;
47
- sessionStorage.setItem(ee, e ? "1" : "0");
47
+ sessionStorage.setItem(T, e ? "1" : "0");
48
48
  } catch {}
49
49
  }
50
- function O(e, t) {
50
+ function te(e, t) {
51
51
  return t === !1 ? e ?? !1 : E() ?? e ?? !1;
52
52
  }
53
53
  //#endregion
54
- //#region src/lib/rail.ts
55
- function k(e, t) {
56
- for (let t = e.length - 1; t >= 0; --t) {
57
- let n = e[t];
58
- if (n.role === "assistant" && n.agent) return n.agent.handle;
59
- }
60
- return t;
61
- }
62
- function A(e, t, n) {
63
- return !t || t === n || e.trimStart().startsWith("@") ? e : `@${t} ${e}`;
64
- }
65
- //#endregion
66
54
  //#region src/lib/uid.ts
67
- function j() {
55
+ function O() {
68
56
  let e = globalThis.crypto;
69
57
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
70
58
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -77,36 +65,36 @@ function j() {
77
65
  }
78
66
  //#endregion
79
67
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
80
- function M(e) {
68
+ function k(e) {
81
69
  "@babel/helpers - typeof";
82
- return M = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
70
+ return k = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
83
71
  return typeof e;
84
72
  } : function(e) {
85
73
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
86
- }, M(e);
74
+ }, k(e);
87
75
  }
88
76
  //#endregion
89
77
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
90
- function N(e, t) {
91
- if (M(e) != "object" || !e) return e;
78
+ function A(e, t) {
79
+ if (k(e) != "object" || !e) return e;
92
80
  var n = e[Symbol.toPrimitive];
93
81
  if (n !== void 0) {
94
82
  var r = n.call(e, t || "default");
95
- if (M(r) != "object") return r;
83
+ if (k(r) != "object") return r;
96
84
  throw TypeError("@@toPrimitive must return a primitive value.");
97
85
  }
98
86
  return (t === "string" ? String : Number)(e);
99
87
  }
100
88
  //#endregion
101
89
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
102
- function P(e) {
103
- var t = N(e, "string");
104
- return M(t) == "symbol" ? t : t + "";
90
+ function j(e) {
91
+ var t = A(e, "string");
92
+ return k(t) == "symbol" ? t : t + "";
105
93
  }
106
94
  //#endregion
107
95
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
108
- function F(e, t, n) {
109
- return (t = P(t)) in e ? Object.defineProperty(e, t, {
96
+ function M(e, t, n) {
97
+ return (t = j(t)) in e ? Object.defineProperty(e, t, {
110
98
  value: n,
111
99
  enumerable: !0,
112
100
  configurable: !0,
@@ -115,15 +103,18 @@ function F(e, t, n) {
115
103
  }
116
104
  //#endregion
117
105
  //#region src/lib/client.ts
118
- var I = "https://api.squadico.com", L = 2e4, R = class extends Error {
106
+ var ne = "https://api.squadico.com", N = 2e4, P = class extends Error {
119
107
  constructor(e, t, n) {
120
- super(e), F(this, "status", void 0), F(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
108
+ super(e), M(this, "status", void 0), M(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
121
109
  }
122
110
  };
123
- function z(e, t) {
111
+ function F(e) {
112
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string" && e.trim() !== "") : [];
113
+ }
114
+ function I(e, t) {
124
115
  return `${e.replace(/\/+$/, "")}${t}`;
125
116
  }
126
- function B(e, t) {
117
+ function L(e, t) {
127
118
  return {
128
119
  "Content-Type": "application/json",
129
120
  Accept: "text/event-stream, application/json",
@@ -131,21 +122,21 @@ function B(e, t) {
131
122
  ...t ? { "X-Subject-Token": t } : {}
132
123
  };
133
124
  }
134
- function te(e) {
125
+ function R(e) {
135
126
  if (!e || typeof e != "object") return;
136
127
  let { loc: t, msg: n } = e;
137
128
  if (typeof n != "string" || !n) return;
138
129
  let r = (Array.isArray(t) ? t.filter((e) => typeof e == "string") : []).at(-1);
139
130
  return r && r !== "body" ? `${r}: ${n}` : n;
140
131
  }
141
- async function V(e) {
132
+ async function z(e) {
142
133
  let t = "", n;
143
134
  try {
144
135
  let r = await e.text();
145
136
  if (r) try {
146
137
  let e = JSON.parse(r), i = e.detail ?? e.message;
147
138
  if (Array.isArray(i)) {
148
- let e = i.map((e) => te(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
139
+ let e = i.map((e) => R(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
149
140
  t = e.length > 0 ? e.join(", ") : r;
150
141
  } else t = typeof i == "string" ? i : r;
151
142
  n = typeof e.code == "string" ? e.code : void 0;
@@ -153,59 +144,61 @@ async function V(e) {
153
144
  t = r;
154
145
  }
155
146
  } catch {}
156
- return new R(t || `The API answered ${e.status}`, e.status, n);
147
+ return new P(t || `The API answered ${e.status}`, e.status, n);
157
148
  }
158
- function H(e, t) {
149
+ function B(e, t) {
159
150
  if (!e || typeof e != "object") return;
160
151
  let n = e;
161
152
  if (!(typeof n.handle != "string" || !n.handle)) return {
162
153
  handle: n.handle,
163
154
  name: typeof n.name == "string" ? n.name : n.handle,
164
- avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ? z(t, n.avatar_url) : void 0,
155
+ avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ? I(t, n.avatar_url) : void 0,
165
156
  color: typeof n.color == "string" ? n.color : void 0
166
157
  };
167
158
  }
168
- function U(e, t) {
169
- return (Array.isArray(e) ? e : []).map((e) => H(e, t)).filter((e) => e !== void 0);
159
+ function V(e, t) {
160
+ return (Array.isArray(e) ? e : []).map((e) => B(e, t)).filter((e) => e !== void 0);
170
161
  }
171
- var W = [
162
+ var H = [
172
163
  "knowledge",
173
164
  "skill",
174
165
  "delegation",
175
166
  "tool"
176
167
  ];
177
- function G(e) {
178
- return W.find((t) => t === e) ?? "tool";
168
+ function U(e) {
169
+ return H.find((t) => t === e) ?? "tool";
179
170
  }
180
- function K(e) {
171
+ function re(e) {
181
172
  if (!e || typeof e != "object") return;
182
173
  let t = e;
183
- if (!(typeof t.tool_call_id != "string" || !t.tool_call_id)) return {
174
+ if (typeof t.tool_call_id != "string" || !t.tool_call_id) return;
175
+ let n = {
184
176
  toolCallId: t.tool_call_id,
185
177
  tool: typeof t.tool == "string" ? t.tool : "",
186
178
  arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
187
179
  };
180
+ return t.labels && typeof t.labels == "object" && (n.labels = Object.fromEntries(Object.entries(t.labels).filter((e) => typeof e[1] == "string"))), n;
188
181
  }
189
- var q = /* @__PURE__ */ new Set(["user", "assistant"]);
190
- function J(e, t) {
191
- if (typeof e.role != "string" || !q.has(e.role) || typeof e.content != "string" || !e.content) return null;
182
+ var W = /* @__PURE__ */ new Set(["user", "assistant"]);
183
+ function G(e, t) {
184
+ if (typeof e.role != "string" || !W.has(e.role) || typeof e.content != "string" || !e.content) return null;
192
185
  let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
193
186
  return {
194
- id: typeof e.id == "string" && e.id ? e.id : j(),
187
+ id: typeof e.id == "string" && e.id ? e.id : O(),
195
188
  role: e.role,
196
189
  content: e.content,
197
190
  createdAt: Number.isNaN(n) ? Date.now() : n,
198
- agent: H(e.agent, t),
199
- attachments: Y(e.attachments),
191
+ agent: B(e.agent, t),
192
+ attachments: K(e.attachments),
200
193
  authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
201
194
  };
202
195
  }
203
- function Y(e) {
196
+ function K(e) {
204
197
  if (!Array.isArray(e)) return;
205
- let t = e.map((e) => X(e)).filter((e) => e !== null);
198
+ let t = e.map((e) => q(e)).filter((e) => e !== null);
206
199
  return t.length > 0 ? t : void 0;
207
200
  }
208
- function X(e) {
201
+ function q(e) {
209
202
  if (!e || typeof e != "object") return null;
210
203
  let { id: t, kind: n, filename: r, content_type: i } = e;
211
204
  return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
@@ -215,129 +208,132 @@ function X(e) {
215
208
  contentType: typeof i == "string" ? i : "application/octet-stream"
216
209
  };
217
210
  }
218
- async function ne(e) {
219
- let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(z(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
211
+ async function ie(e) {
212
+ let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(I(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
220
213
  method: "GET",
221
- headers: B(),
214
+ headers: L(),
222
215
  signal: e.signal
223
216
  });
224
- if (!n.ok) throw await V(n);
217
+ if (!n.ok) throw await z(n);
225
218
  let r = await n.json();
226
219
  return {
227
220
  welcomeMessage: typeof r.welcome_message == "string" && r.welcome_message ? r.welcome_message : void 0,
228
- agent: H(r.agent, e.apiUrl),
229
- handles: U(r.handles, e.apiUrl),
221
+ welcomeSuggestions: F(r.welcome_suggestions),
222
+ agent: B(r.agent, e.apiUrl),
223
+ handles: V(r.handles, e.apiUrl),
230
224
  agentHandle: typeof r.agent_handle == "string" && r.agent_handle ? r.agent_handle : void 0,
231
225
  branding: r.branding === !0
232
226
  };
233
227
  }
234
- async function re(e) {
235
- let t = await fetch(z(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
228
+ async function ae(e) {
229
+ let t = await fetch(I(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
236
230
  method: "POST",
237
- headers: B(),
231
+ headers: L(),
238
232
  body: JSON.stringify({
239
233
  ...e.user ? { user: e.user } : {},
240
234
  ...e.agent ? { agent: e.agent } : {}
241
235
  }),
242
236
  signal: e.signal
243
237
  });
244
- if (!t.ok) throw await V(t);
238
+ if (!t.ok) throw await z(t);
245
239
  let n = await t.json();
246
- if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new R("The API opened a conversation without an id or a token");
247
- let r = (Array.isArray(n.messages) ? n.messages : []).map((t) => J(t, e.apiUrl)).filter((e) => e !== null);
240
+ 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) => G(t, e.apiUrl)).filter((e) => e !== null);
248
242
  return {
249
243
  conversationId: n.id,
250
244
  visitorToken: n.visitor_token,
251
245
  agentName: typeof n.agent_name == "string" ? n.agent_name : "",
252
246
  agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
253
247
  welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
248
+ welcomeSuggestions: F(n.welcome_suggestions),
254
249
  messages: r,
255
- handles: U(n.handles, e.apiUrl),
250
+ handles: V(n.handles, e.apiUrl),
256
251
  agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
257
252
  withHuman: typeof n.handling == "string" && n.handling !== "agents",
258
253
  branding: n.branding === !0
259
254
  };
260
255
  }
261
- async function ie(e) {
262
- let t = await fetch(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
256
+ async function J(e) {
257
+ let t = await fetch(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
263
258
  method: "GET",
264
- headers: B(e.visitorToken),
259
+ headers: L(e.visitorToken),
265
260
  signal: e.signal
266
261
  });
267
- if (!t.ok) throw await V(t);
262
+ if (!t.ok) throw await z(t);
268
263
  let n = await t.json();
269
- if (typeof n.id != "string") throw new R("The API replayed a conversation without an id");
264
+ if (typeof n.id != "string") throw new P("The API replayed a conversation without an id");
270
265
  return {
271
266
  conversationId: n.id,
272
267
  visitorToken: e.visitorToken,
273
268
  agentName: typeof n.agent_name == "string" ? n.agent_name : "",
274
269
  agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
275
270
  welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
276
- messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => J(t, e.apiUrl)).filter((e) => e !== null),
277
- handles: U(n.handles, e.apiUrl),
271
+ welcomeSuggestions: F(n.welcome_suggestions),
272
+ messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => G(t, e.apiUrl)).filter((e) => e !== null),
273
+ handles: V(n.handles, e.apiUrl),
278
274
  agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
279
275
  withHuman: typeof n.handling == "string" && n.handling !== "agents",
280
276
  branding: n.branding === !0
281
277
  };
282
278
  }
283
- async function ae(e) {
279
+ async function oe(e) {
284
280
  let t = new FormData();
285
281
  t.append("file", e.file);
286
- let n = await fetch(Z(e), {
282
+ let n = await fetch(Y(e), {
287
283
  method: "POST",
288
284
  headers: { "X-Visitor-Token": e.visitorToken },
289
285
  body: t,
290
286
  signal: e.signal
291
287
  });
292
- if (!n.ok) throw await V(n);
293
- let r = X(await n.json());
294
- if (!r) throw new R("The upload could not be read", n.status);
288
+ if (!n.ok) throw await z(n);
289
+ let r = q(await n.json());
290
+ if (!r) throw new P("The upload could not be read", n.status);
295
291
  return r;
296
292
  }
297
- async function oe(e) {
298
- let t = await fetch(`${Z(e)}/${encodeURIComponent(e.attachmentId)}`, {
293
+ async function se(e) {
294
+ let t = await fetch(`${Y(e)}/${encodeURIComponent(e.attachmentId)}`, {
299
295
  method: "DELETE",
300
296
  headers: { "X-Visitor-Token": e.visitorToken },
301
297
  signal: e.signal
302
298
  });
303
- if (!t.ok) throw await V(t);
299
+ if (!t.ok) throw await z(t);
304
300
  }
305
- async function se(e) {
306
- let t = await fetch(`${Z(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
301
+ async function ce(e) {
302
+ let t = await fetch(`${Y(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
307
303
  headers: { "X-Visitor-Token": e.visitorToken },
308
304
  signal: e.signal
309
305
  });
310
- if (!t.ok) throw await V(t);
306
+ if (!t.ok) throw await z(t);
311
307
  return t.blob();
312
308
  }
313
- function Z(e) {
314
- return z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
309
+ function Y(e) {
310
+ return I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
315
311
  }
316
- async function ce(e) {
317
- return le(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
312
+ async function le(e) {
313
+ return X(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
318
314
  content: e.message,
319
315
  attachment_ids: e.attachmentIds ?? [],
320
316
  ...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
321
317
  }, e);
322
318
  }
323
- async function Q(e) {
324
- return le(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
319
+ async function ue(e) {
320
+ return X(I(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
325
321
  tool_call_id: e.toolCallId,
326
322
  approved: e.approved
327
323
  }, e);
328
324
  }
329
- async function le(e, t, n) {
325
+ async function X(e, t, n) {
330
326
  let r = await fetch(e, {
331
327
  method: "POST",
332
- headers: B(n.visitorToken, n.subjectToken),
328
+ headers: L(n.visitorToken, n.subjectToken),
333
329
  body: JSON.stringify({
334
330
  ...t,
335
331
  widgets: 1
336
332
  }),
337
333
  signal: n.signal
338
334
  });
339
- if (!r.ok) throw await V(r);
340
- if (!r.body) throw new R("Answer with no stream body");
335
+ if (!r.ok) throw await z(r);
336
+ if (!r.body) throw new P("Answer with no stream body");
341
337
  let i = r.body.getReader(), a = new TextDecoder(), o = "", s = "", c = "", l, u, d = { answer: "" };
342
338
  try {
343
339
  for (;;) {
@@ -365,103 +361,161 @@ async function le(e, t, n) {
365
361
  } catch {
366
362
  continue;
367
363
  }
368
- s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "progress" ? n.onProgress?.(G(i.activity)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = H(i.agent, n.apiUrl), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = U(i.handles, n.apiUrl))) : s === "handoff" ? (typeof i.to_agent_name == "string" && (u = i.to_agent_name), c = "") : s === "escalated" ? d.withHuman = !0 : s === "held" ? (d.held = !0, d.withHuman = !0) : s === "approval_required" ? d.approval = K(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
364
+ s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "progress" ? n.onProgress?.(U(i.activity)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = B(i.agent, n.apiUrl), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = V(i.handles, n.apiUrl))) : s === "handoff" ? (typeof i.to_agent_name == "string" && (u = i.to_agent_name), c = "") : s === "escalated" ? d.withHuman = !0 : s === "held" ? (d.held = !0, d.withHuman = !0) : s === "approval_required" ? d.approval = re(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
369
365
  }
370
366
  if (l) break;
371
367
  }
372
368
  } finally {
373
369
  i.cancel().catch(() => void 0);
374
370
  }
375
- if (l) throw new R(l);
371
+ if (l) throw new P(l);
376
372
  return !d.answer && !d.approval && (d.answer = c), u && !d.agent && (d.authorName = u), d;
377
373
  }
378
374
  //#endregion
379
375
  //#region src/lib/conversation.ts
380
- var $ = "squadico-chatbot:conversation";
381
- function ue() {
376
+ var Z = "squadico-chatbot:conversation";
377
+ function Q() {
382
378
  try {
383
379
  if (typeof sessionStorage > "u") return;
384
- let e = sessionStorage.getItem($);
380
+ let e = sessionStorage.getItem(Z);
385
381
  if (!e) return;
386
382
  let t = JSON.parse(e);
387
- return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
388
- sessionId: t.sessionId,
389
- visitorToken: t.visitorToken,
390
- embedKey: t.embedKey,
391
- user: typeof t.user == "string" ? t.user : void 0,
392
- scope: typeof t.scope == "string" ? t.scope : void 0
393
- };
383
+ return t && typeof t == "object" ? t : void 0;
394
384
  } catch {
395
385
  return;
396
386
  }
397
387
  }
398
- function de(e) {
388
+ function $(e) {
399
389
  try {
400
390
  if (typeof sessionStorage > "u") return;
401
- sessionStorage.setItem($, JSON.stringify(e));
391
+ sessionStorage.setItem(Z, JSON.stringify(e));
402
392
  } catch {}
403
393
  }
404
- function fe() {
394
+ function de(e) {
395
+ if (!e || typeof e != "object") return;
396
+ let { sessionId: t, visitorToken: n } = e;
397
+ return typeof t == "string" && t && typeof n == "string" && n ? {
398
+ sessionId: t,
399
+ visitorToken: n
400
+ } : void 0;
401
+ }
402
+ function fe(e) {
403
+ let t = Q();
404
+ if (!t || typeof t.embedKey != "string" || !t.embedKey) return;
405
+ let n = typeof t.agent == "string" ? t.agent : void 0, r = de(e === void 0 || n === void 0 || e === n ? t : t.threads?.[e]);
406
+ if (r) return {
407
+ ...r,
408
+ embedKey: t.embedKey,
409
+ user: typeof t.user == "string" ? t.user : void 0,
410
+ scope: typeof t.scope == "string" ? t.scope : void 0,
411
+ agent: e ?? n
412
+ };
413
+ }
414
+ function pe(e) {
415
+ let t = Q(), n = t && he(t, e) ? t.threads ?? {} : {}, r = e.agent ? {
416
+ ...n,
417
+ [e.agent]: {
418
+ sessionId: e.sessionId,
419
+ visitorToken: e.visitorToken
420
+ }
421
+ } : n;
422
+ $({
423
+ ...e,
424
+ threads: r
425
+ });
426
+ }
427
+ function me(e) {
428
+ if (e !== void 0) {
429
+ let t = Q();
430
+ if (!t) return;
431
+ let n = { ...t.threads ?? {} };
432
+ delete n[e], $(t.agent === void 0 || t.agent === e ? {
433
+ embedKey: t.embedKey,
434
+ user: t.user,
435
+ scope: t.scope,
436
+ threads: n
437
+ } : {
438
+ ...t,
439
+ threads: n
440
+ });
441
+ return;
442
+ }
405
443
  try {
406
444
  if (typeof sessionStorage > "u") return;
407
- sessionStorage.removeItem($);
445
+ sessionStorage.removeItem(Z);
408
446
  } catch {}
409
447
  }
410
- function pe(e, { embedKey: t, user: n, scope: r }) {
448
+ function he(e, { embedKey: t, user: n, scope: r }) {
411
449
  return e.embedKey === t && e.user === n && e.scope === r;
412
450
  }
413
451
  //#endregion
414
452
  //#region src/lib/useChat.ts
415
- async function me(e) {
453
+ async function ge(e) {
416
454
  if (e) try {
417
455
  return await e() || void 0;
418
456
  } catch {
419
457
  return;
420
458
  }
421
459
  }
422
- var he = "preview-welcome";
423
- function ge(e, t) {
460
+ var _e = "preview-welcome";
461
+ function ve(e, t) {
424
462
  return e === void 0 && t === void 0 ? void 0 : JSON.stringify([e, t]);
425
463
  }
426
- function _e(e) {
427
- let t = e instanceof R ? e.status : void 0;
428
- return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
429
- }
430
- var ve = 5e3;
431
464
  function ye(e) {
432
- return e instanceof R && e.code === "conversation_retired";
465
+ let t = e instanceof P ? e.status : void 0;
466
+ return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
433
467
  }
434
- function be(t) {
435
- 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(!1), [ee, E] = e(!1), [D, O] = e([]), [k, A] = e([]), [M, N] = e(null), P = o(null), F = o(t);
436
- F.current = t;
437
- let I = o(null), L = o(null), z = o(null), B = o(null), te = o(void 0), V = t.greeting, H = y(() => V ? {
468
+ var be = 5e3;
469
+ function xe(e) {
470
+ return e instanceof P && e.code === "conversation_retired";
471
+ }
472
+ function Se(t) {
473
+ 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
+ I.current = t;
475
+ 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({
476
+ conversation: null,
477
+ messages: [],
478
+ welcomeSuggestions: [],
479
+ approval: null,
480
+ withHuman: !1,
481
+ attachments: []
482
+ });
483
+ W.current = {
484
+ conversation: R.current,
485
+ messages: n,
486
+ welcomeSuggestions: C,
487
+ approval: x,
488
+ withHuman: T,
489
+ attachments: k
490
+ };
491
+ let G = t.greeting, K = y(() => G ? {
438
492
  id: "greeting",
439
493
  role: "assistant",
440
- content: V,
494
+ content: G,
441
495
  createdAt: Date.now()
442
- } : null, [V]), U = i((e) => {
443
- F.current.onEvent?.(e);
444
- }, []), W = i((e, t) => {
496
+ } : null, [G]), q = i((e) => {
497
+ I.current.onEvent?.(e);
498
+ }, []), Y = i((e, t) => {
445
499
  r((n) => n.map((n) => n.id === e ? {
446
500
  ...n,
447
501
  ...t
448
502
  } : n));
449
- }, []), G = i((e, t) => {
450
- let n = e instanceof R ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (F.current.locale ?? b(void 0)).t.error;
451
- t && W(t, {
503
+ }, []), X = i((e, t) => {
504
+ 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 && Y(t, {
452
506
  content: i,
453
507
  streaming: !1,
454
508
  error: !0,
455
509
  activity: void 0
456
- }), U({
510
+ }), q({
457
511
  type: "chatbot-error",
458
512
  message: r,
459
513
  status: n,
460
- sessionId: L.current?.sessionId ?? ""
514
+ sessionId: R.current?.sessionId ?? ""
461
515
  }), typeof console < "u" && console.error("[squadico-chatbot]", r);
462
- }, [U, W]), K = i(() => {
463
- let e = F.current;
464
- if (!e.embedKey) throw new R("No embed key: nothing says which application to open");
516
+ }, [q, Y]), Z = i(() => {
517
+ let e = I.current;
518
+ if (!e.embedKey) throw new P("No embed key: nothing says which application to open");
465
519
  return {
466
520
  opts: e,
467
521
  apiUrl: e.apiUrl ?? "https://api.squadico.com",
@@ -469,95 +523,98 @@ function be(t) {
469
523
  claim: e.user,
470
524
  scope: e.scope
471
525
  };
472
- }, []), q = i((e, t) => {
473
- let n = {
526
+ }, []), Q = i((e, t, n) => {
527
+ let i = {
474
528
  sessionId: t.conversationId,
475
529
  visitorToken: t.visitorToken
476
530
  };
477
- return L.current = n, te.current = ge(e.claim?.id, e.scope), de({
478
- ...n,
531
+ R.current = i, V.current = ve(e.claim?.id, e.scope);
532
+ let a = n ?? H.current ?? t.agentHandle;
533
+ return H.current = a, U.current ?? (U.current = a), pe({
534
+ ...i,
479
535
  embedKey: e.embedKey,
480
536
  user: e.claim?.id,
481
- scope: e.scope
482
- }), l(t.conversationId), p(t.handles), h(e.opts.agent && t.agentHandle ? t.agentHandle : ""), _(t.agentHandle ?? ""), w(!!t.withHuman), E(t.branding), r((e) => [...t.messages, ...e.filter((e) => e.id !== he)]), n;
483
- }, []), J = i((e) => {
537
+ scope: e.scope,
538
+ 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 !== _e)]), i;
540
+ }, []), $ = i((e) => {
484
541
  if (z.current) return z.current;
485
- let t = ue();
486
- if (!t || !pe(t, {
542
+ let t = H.current, n = fe(t);
543
+ if (!n || !he(n, {
487
544
  embedKey: e.embedKey,
488
545
  user: e.claim?.id,
489
546
  scope: e.scope
490
547
  })) return Promise.resolve(null);
491
- let n = ie({
548
+ let r = J({
492
549
  apiUrl: e.apiUrl,
493
- conversationId: t.sessionId,
494
- visitorToken: t.visitorToken
495
- }).then((t) => q(e, t)).catch(() => (fe(), null)).finally(() => {
550
+ conversationId: n.sessionId,
551
+ visitorToken: n.visitorToken
552
+ }).then((r) => H.current === t ? Q(e, r, n.agent) : null).catch(() => (me(n.agent), null)).finally(() => {
496
553
  z.current = null;
497
554
  });
498
- return z.current = n, n;
499
- }, [q]), Y = i(async () => {
555
+ return z.current = r, r;
556
+ }, [Q]), de = i(async () => {
557
+ if (R.current) return R.current;
500
558
  if (L.current) return L.current;
501
- if (I.current) return I.current;
502
- let e = K(), t = J(e).then((t) => t ?? re({
559
+ let e = Z(), t = $(e).then((t) => t ?? ae({
503
560
  apiUrl: e.apiUrl,
504
561
  embedKey: e.embedKey,
505
562
  user: e.claim,
506
- agent: e.opts.agent
507
- }).then((t) => q(e, t)));
508
- I.current = t;
563
+ agent: H.current && H.current !== U.current ? H.current : e.opts.agent
564
+ }).then((t) => Q(e, t)));
565
+ L.current = t;
509
566
  try {
510
567
  return await t;
511
568
  } finally {
512
- I.current = null;
569
+ L.current = null;
513
570
  }
514
571
  }, [
515
- q,
516
- J,
517
- K
518
- ]), X = i(() => {
519
- if (L.current || I.current || B.current) return;
572
+ Q,
573
+ $,
574
+ Z
575
+ ]), Se = i(() => {
576
+ if (R.current || L.current || B.current) return;
520
577
  let e;
521
578
  try {
522
- e = K();
579
+ e = Z();
523
580
  } catch (e) {
524
- G(e);
581
+ X(e);
525
582
  return;
526
583
  }
527
- let t = J(e).then(async (t) => {
528
- if (t || L.current || I.current) return;
529
- let n = await ne({
584
+ let t = H.current, n = $(e).then(async (n) => {
585
+ if (n || R.current || L.current) return;
586
+ let i = await ie({
530
587
  apiUrl: e.apiUrl,
531
588
  embedKey: e.embedKey,
532
- agent: e.opts.agent
589
+ agent: t ?? e.opts.agent
533
590
  });
534
- if (L.current || I.current) return;
535
- p(n.handles), h(e.opts.agent && n.agentHandle ? n.agentHandle : ""), _(n.agentHandle ?? ""), E(n.branding);
536
- let i = n.welcomeMessage;
537
- i && r((e) => e.length > 0 ? e : [{
538
- id: he,
591
+ if (R.current || L.current || H.current !== t) return;
592
+ 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
+ let a = i.welcomeMessage;
594
+ a && r((e) => e.length > 0 ? e : [{
595
+ id: _e,
539
596
  role: "assistant",
540
- content: i,
597
+ content: a,
541
598
  createdAt: Date.now(),
542
- agent: n.agent
599
+ agent: i.agent
543
600
  }]);
544
601
  });
545
- B.current = t, t.catch((e) => {
546
- B.current = null, G(e);
602
+ B.current = n, n.catch((e) => {
603
+ B.current = null, X(e);
547
604
  });
548
605
  }, [
549
- G,
550
- J,
551
- K
552
- ]), Z = i((e, t, { retry: n = !1, carried: i = [] } = {}) => {
553
- if (P.current) return;
606
+ X,
607
+ $,
608
+ Z
609
+ ]), Ce = i((e, t, { retry: n = !1, carried: i = [] } = {}) => {
610
+ if (F.current) return;
554
611
  let a = new AbortController();
555
- P.current = a, s(!0), S(null);
556
- let o = j();
612
+ F.current = a, s(!0), S(null);
613
+ let o = O();
557
614
  r((t) => [
558
615
  ...t,
559
616
  {
560
- id: j(),
617
+ id: O(),
561
618
  role: "user",
562
619
  content: e,
563
620
  createdAt: Date.now(),
@@ -571,35 +628,35 @@ function be(t) {
571
628
  streaming: !0
572
629
  }
573
630
  ]), (async () => {
574
- let i = await Y();
575
- U({
631
+ let i = await de();
632
+ q({
576
633
  type: "chatbot-message",
577
634
  role: "user",
578
635
  content: e,
579
636
  sessionId: i.sessionId
580
637
  });
581
638
  let s = "", c = (e) => {
582
- s += e, W(o, {
639
+ s += e, Y(o, {
583
640
  content: s,
584
641
  activity: void 0
585
642
  });
586
643
  }, l = (e) => {
587
- s || W(o, { activity: e });
644
+ s || Y(o, { activity: e });
588
645
  }, u;
589
646
  try {
590
647
  u = await t(i, c, a.signal, l);
591
648
  } catch (e) {
592
- if (!ye(e) || (fe(), L.current = null, I.current = null, !n)) throw e;
593
- i = await Y(), s = "", W(o, {
649
+ if (!xe(e) || (me(H.current), R.current = null, L.current = null, !n)) throw e;
650
+ i = await de(), s = "", Y(o, {
594
651
  content: "",
595
652
  activity: void 0
596
653
  }), u = await t(i, c, a.signal, l);
597
654
  }
598
- if (u.withHuman && w(!0), u.held) {
655
+ if (u.withHuman && E(!0), u.held) {
599
656
  r((e) => e.filter((e) => e.id !== o));
600
657
  return;
601
658
  }
602
- W(o, {
659
+ Y(o, {
603
660
  content: u.answer,
604
661
  streaming: !1,
605
662
  activity: void 0,
@@ -608,7 +665,7 @@ function be(t) {
608
665
  approval: u.approval,
609
666
  unknownHandle: u.unknownHandle,
610
667
  offered: u.offered
611
- }), S(u.approval ?? null), U({
668
+ }), S(u.approval ?? null), q({
612
669
  type: "chatbot-message",
613
670
  role: "assistant",
614
671
  content: u.answer,
@@ -617,33 +674,33 @@ function be(t) {
617
674
  });
618
675
  })().catch((e) => {
619
676
  if (a.signal.aborted) {
620
- W(o, {
677
+ Y(o, {
621
678
  streaming: !1,
622
679
  activity: void 0
623
680
  });
624
681
  return;
625
682
  }
626
- G(e, o);
683
+ X(e, o);
627
684
  }).finally(() => {
628
- P.current = null, s(!1);
685
+ F.current = null, s(!1);
629
686
  });
630
687
  }, [
631
- Y,
632
- U,
633
- G,
634
- W
635
- ]), le = i((e) => {
688
+ de,
689
+ q,
690
+ X,
691
+ Y
692
+ ]), we = i((e) => {
636
693
  let t = e.trim();
637
- if (!t && D.length === 0) return;
638
- let n = D;
639
- O([]), N(null), Z(t, async (e, r, i, a) => ce({
640
- subjectToken: await me(F.current.getSubjectToken),
641
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
694
+ if (!t && k.length === 0) return;
695
+ let n = k;
696
+ A([]), N(null), Ce(t, async (e, r, i, a) => le({
697
+ subjectToken: await ge(I.current.getSubjectToken),
698
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
642
699
  conversationId: e.sessionId,
643
700
  visitorToken: e.visitorToken,
644
701
  message: t,
645
702
  attachmentIds: n.map((e) => e.id),
646
- context: F.current.context ? T(F.current.context) : void 0,
703
+ context: I.current.context ? ee(I.current.context) : void 0,
647
704
  onToken: r,
648
705
  onProgress: a,
649
706
  signal: i
@@ -651,39 +708,39 @@ function be(t) {
651
708
  retry: !0,
652
709
  carried: n
653
710
  });
654
- }, [D, Z]), $ = i((e) => {
655
- N(null), A((t) => [...t, e.name]), Y().then((t) => ae({
656
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
711
+ }, [k, Ce]), Te = i((e) => {
712
+ N(null), M((t) => [...t, e.name]), de().then((t) => oe({
713
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
657
714
  conversationId: t.sessionId,
658
715
  visitorToken: t.visitorToken,
659
716
  file: e
660
- })).then((e) => O((t) => [...t, e])).catch((e) => N(_e(e))).finally(() => A((t) => {
717
+ })).then((e) => A((t) => [...t, e])).catch((e) => N(ye(e))).finally(() => M((t) => {
661
718
  let n = t.indexOf(e.name);
662
719
  return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
663
720
  }));
664
- }, [Y]), be = i((e) => {
665
- O((t) => t.filter((t) => t.id !== e));
666
- let t = L.current;
667
- t && oe({
668
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
721
+ }, [de]), Ee = i((e) => {
722
+ A((t) => t.filter((t) => t.id !== e));
723
+ let t = R.current;
724
+ t && se({
725
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
669
726
  conversationId: t.sessionId,
670
727
  visitorToken: t.visitorToken,
671
728
  attachmentId: e
672
729
  }).catch(() => {});
673
- }, []), xe = i(async (e) => {
674
- let t = L.current;
675
- if (!t) throw new R("No conversation to read that file from");
676
- return se({
677
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
730
+ }, []), De = i(async (e) => {
731
+ let t = R.current;
732
+ if (!t) throw new P("No conversation to read that file from");
733
+ return ce({
734
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
678
735
  conversationId: t.sessionId,
679
736
  visitorToken: t.visitorToken,
680
737
  attachmentId: e
681
738
  });
682
- }, []), Se = i((e, t) => {
739
+ }, []), Oe = i((e, t) => {
683
740
  let n = x;
684
- n && Z(t, async (t, r, i, a) => Q({
685
- subjectToken: await me(F.current.getSubjectToken),
686
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
741
+ n && Ce(t, async (t, r, i, a) => ue({
742
+ subjectToken: await ge(I.current.getSubjectToken),
743
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
687
744
  conversationId: t.sessionId,
688
745
  visitorToken: t.visitorToken,
689
746
  toolCallId: n.toolCallId,
@@ -692,78 +749,98 @@ function be(t) {
692
749
  onProgress: a,
693
750
  signal: i
694
751
  }));
695
- }, [x, Z]), Ce = i(() => {
696
- P.current?.abort(), P.current = null, s(!1);
697
- }, []), we = i(() => {
698
- P.current?.abort(), P.current = null, L.current = null, I.current = null, z.current = null, B.current = null, te.current = void 0, fe(), s(!1), S(null), w(!1), l(""), d((e) => e + 1), h(""), _(""), r([]), U({
752
+ }, [x, Ce]), ke = i(() => {
753
+ F.current?.abort(), F.current = null, s(!1);
754
+ }, []), 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(), me(), s(!1), S(null), E(!1), l(""), d((e) => e + 1), h(""), A([]), r([]), w([]), q({
699
756
  type: "chatbot-reset",
700
757
  sessionId: ""
701
758
  });
702
- }, [U]), Te = t.humanPollMs ?? ve;
759
+ }, [q]), je = i((e) => {
760
+ if (F.current || L.current || e === H.current) return;
761
+ H.current !== void 0 && re.current.set(H.current, W.current), H.current = e, _(e), N(null);
762
+ let t = re.current.get(e);
763
+ 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
+ try {
765
+ let n = Z();
766
+ pe({
767
+ ...t.conversation,
768
+ embedKey: n.embedKey,
769
+ user: n.claim?.id,
770
+ scope: n.scope,
771
+ agent: e
772
+ });
773
+ } catch {}
774
+ return;
775
+ }
776
+ Se();
777
+ }, [Se, Z]), Me = t.humanPollMs ?? be;
703
778
  v(() => {
704
- if (!C || !c) return;
779
+ if (!T || !c) return;
705
780
  let e = setInterval(() => {
706
- let e = L.current;
707
- !e || P.current || ie({
708
- apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
781
+ let e = R.current;
782
+ !e || F.current || J({
783
+ apiUrl: I.current.apiUrl ?? "https://api.squadico.com",
709
784
  conversationId: e.sessionId,
710
785
  visitorToken: e.visitorToken
711
- }).then((e) => {
712
- r(e.messages), w(!!e.withHuman);
786
+ }).then((t) => {
787
+ R.current === e && (r(t.messages), E(!!t.withHuman));
713
788
  }).catch(() => {});
714
- }, Te);
789
+ }, Me);
715
790
  return () => clearInterval(e);
716
791
  }, [
717
- C,
792
+ T,
718
793
  c,
719
- Te
794
+ Me
720
795
  ]);
721
- let Ee = ge(t.user?.id, t.scope);
796
+ let Ne = ve(t.user?.id, t.scope);
722
797
  return v(() => {
723
- if (L.current) {
724
- te.current !== Ee && we();
798
+ if (R.current) {
799
+ V.current !== Ne && Ae();
725
800
  return;
726
801
  }
727
- if (!B.current || I.current) return;
802
+ if (!B.current || L.current) return;
728
803
  let e;
729
804
  try {
730
- e = K();
805
+ e = Z();
731
806
  } catch {
732
807
  return;
733
808
  }
734
- J(e);
809
+ $(e);
735
810
  }, [
736
- Ee,
737
- we,
738
- J,
739
- K
811
+ Ne,
812
+ Ae,
813
+ $,
814
+ Z
740
815
  ]), {
741
- messages: y(() => n.length === 0 && H ? [H] : n, [H, n]),
816
+ messages: y(() => n.length === 0 && K ? [K] : n, [K, n]),
742
817
  busy: a,
743
818
  sessionId: c,
744
819
  resets: u,
745
820
  handles: f,
746
821
  addressee: m,
747
822
  agentHandle: g,
823
+ welcomeSuggestions: C,
748
824
  approval: x,
749
- withHuman: C,
750
- branding: ee,
751
- start: X,
752
- send: le,
753
- attachments: D,
754
- uploading: k,
755
- attachmentError: M,
756
- attach: $,
757
- detach: be,
758
- loadAttachment: xe,
759
- decide: Se,
760
- stop: Ce,
761
- reset: we
825
+ withHuman: T,
826
+ branding: D,
827
+ start: Se,
828
+ send: we,
829
+ attachments: k,
830
+ uploading: j,
831
+ attachmentError: ne,
832
+ attach: Te,
833
+ detach: Ee,
834
+ loadAttachment: De,
835
+ decide: Oe,
836
+ stop: ke,
837
+ reset: Ae,
838
+ switchTo: je
762
839
  };
763
840
  }
764
841
  //#endregion
765
842
  //#region src/components/Avatar.tsx
766
- function xe({ name: t, color: n, url: r, size: i = 16 }) {
843
+ function Ce({ name: t, color: n, url: r, size: i = 16 }) {
767
844
  let [a, o] = e(void 0), s = !!r && a !== r;
768
845
  return /* @__PURE__ */ l("span", {
769
846
  class: "sqc-avatar",
@@ -779,16 +856,16 @@ function xe({ name: t, color: n, url: r, size: i = 16 }) {
779
856
  src: r,
780
857
  alt: "",
781
858
  onError: () => o(r)
782
- }) : Se(t)
859
+ }) : we(t)
783
860
  });
784
861
  }
785
- function Se(e) {
862
+ function we(e) {
786
863
  let t = Array.from(e.trim())[0];
787
864
  return t ? t.toLocaleUpperCase() : "?";
788
865
  }
789
866
  //#endregion
790
867
  //#region src/components/AgentRail.tsx
791
- function Ce({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
868
+ function Te({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
792
869
  return /* @__PURE__ */ l("nav", {
793
870
  class: "sqc-rail",
794
871
  "aria-label": i,
@@ -800,7 +877,7 @@ function Ce({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
800
877
  "data-tip": e.name,
801
878
  disabled: n,
802
879
  onClick: () => r(e.handle),
803
- children: [/* @__PURE__ */ l(xe, {
880
+ children: [/* @__PURE__ */ l(Ce, {
804
881
  name: e.name,
805
882
  color: e.color,
806
883
  url: e.avatarUrl,
@@ -808,79 +885,79 @@ function Ce({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
808
885
  }), /* @__PURE__ */ l("span", {
809
886
  class: "sqc-rail__label",
810
887
  "aria-hidden": "true",
811
- children: we(e.handle)
888
+ children: Ee(e.handle)
812
889
  })]
813
890
  }, e.handle))
814
891
  });
815
892
  }
816
- function we(e) {
893
+ function Ee(e) {
817
894
  let t = e.split(/[-_]/)[0] ?? e;
818
895
  return t.charAt(0).toUpperCase() + t.slice(1);
819
896
  }
820
897
  //#endregion
821
898
  //#region src/components/Composer.tsx
822
- var Te = 132, Ee = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", De = /^[a-zA-Z0-9_-]*$/;
823
- function Oe(e, t) {
899
+ var De = 132, Oe = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", ke = /^[a-zA-Z0-9_-]*$/;
900
+ function Ae(e, t) {
824
901
  let n = e.slice(0, t), r = n.lastIndexOf("@");
825
902
  if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
826
903
  let i = n.slice(r + 1);
827
- return De.test(i) ? {
904
+ return ke.test(i) ? {
828
905
  start: r,
829
906
  query: i
830
907
  } : null;
831
908
  }
832
- function ke({ 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: _ }) {
833
- let [b, x] = e(""), [S, C] = e(null), [w, T] = e(0), [ee, E] = e(!1), D = o(null), O = o(null), k = !!m, A = f.length > 0, j = y(() => {
909
+ function je({ 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
+ 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(() => {
834
911
  if (!S || !c || c.length === 0) return [];
835
912
  let e = S.query.toLowerCase();
836
913
  return c.filter((t) => t.handle.startsWith(e));
837
- }, [c, S]), M = j.length > 0, N = i(() => {
914
+ }, [c, S]), j = A.length > 0, M = i(() => {
838
915
  let e = D.current;
839
916
  if (!e) return;
840
917
  e.style.height = "auto";
841
- let t = e.scrollHeight > Te;
842
- e.style.height = `${Math.min(e.scrollHeight, Te)}px`, e.style.overflowY = t ? "auto" : "hidden";
918
+ let t = e.scrollHeight > De;
919
+ e.style.height = `${Math.min(e.scrollHeight, De)}px`, e.style.overflowY = t ? "auto" : "hidden";
843
920
  }, []);
844
921
  v(() => {
845
- s && D.current?.focus(), N();
846
- }, [s, N]), v(() => {
847
- u && (x((e) => e || `@${u} `), requestAnimationFrame(N));
848
- }, [u, N]);
849
- let P = i((e) => {
850
- C(Oe(e.value, e.selectionStart ?? e.value.length)), T(0);
851
- }, []), F = i((e) => {
922
+ s && D.current?.focus(), M();
923
+ }, [s, M]), v(() => {
924
+ u && (x((e) => e || `@${u} `), requestAnimationFrame(M));
925
+ }, [u, M]);
926
+ let ne = i((e) => {
927
+ C(Ae(e.value, e.selectionStart ?? e.value.length)), ee(0);
928
+ }, []), P = i((e) => {
852
929
  let t = D.current;
853
930
  if (!t || !S) return;
854
931
  let n = t.selectionStart ?? t.value.length, r = `${b.slice(0, S.start)}@${e} ${b.slice(n)}`, i = S.start + e.length + 2;
855
932
  x(r), C(null), requestAnimationFrame(() => {
856
- t.focus(), t.setSelectionRange(i, i), N();
933
+ t.focus(), t.setSelectionRange(i, i), M();
857
934
  });
858
935
  }, [
859
- N,
936
+ M,
860
937
  S,
861
938
  b
862
- ]), I = i((e) => {
939
+ ]), F = i((e) => {
863
940
  if (!(!m || !e)) for (let t of Array.from(e)) m(t);
864
- }, [m]), R = i(() => {
941
+ }, [m]), I = i(() => {
865
942
  let e = b.trim();
866
- !e && d.length === 0 || a || A || (g(e), x(""), C(null), requestAnimationFrame(N));
943
+ !e && d.length === 0 || a || k || (g(e), x(""), C(null), requestAnimationFrame(M));
867
944
  }, [
868
945
  d.length,
869
946
  a,
870
- N,
947
+ M,
871
948
  g,
872
949
  b,
873
- A
874
- ]), z = i((e) => {
875
- if (M && !e.isComposing) {
950
+ k
951
+ ]), L = i((e) => {
952
+ if (j && !e.isComposing) {
876
953
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
877
954
  e.preventDefault();
878
- let t = e.key === "ArrowDown" ? 1 : j.length - 1;
879
- T((e) => (e + t) % j.length);
955
+ let t = e.key === "ArrowDown" ? 1 : A.length - 1;
956
+ ee((e) => (e + t) % A.length);
880
957
  return;
881
958
  }
882
959
  if (e.key === "Enter" || e.key === "Tab") {
883
- e.preventDefault(), F((j[w] ?? j[0]).handle);
960
+ e.preventDefault(), P((A[w] ?? A[0]).handle);
884
961
  return;
885
962
  }
886
963
  if (e.key === "Escape") {
@@ -888,28 +965,28 @@ function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
888
965
  return;
889
966
  }
890
967
  }
891
- e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), R());
968
+ e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), I());
892
969
  }, [
893
970
  w,
971
+ A,
972
+ P,
894
973
  j,
895
- F,
896
- M,
897
- R
898
- ]), B = L - b.length;
974
+ I
975
+ ]), R = N - b.length;
899
976
  return /* @__PURE__ */ l("form", {
900
- class: `sqc-composer${ee ? " sqc-composer--dropping" : ""}`,
977
+ class: `sqc-composer${T ? " sqc-composer--dropping" : ""}`,
901
978
  onSubmit: (e) => {
902
- e.preventDefault(), R();
979
+ e.preventDefault(), I();
903
980
  },
904
981
  onDragOver: (e) => {
905
- k && (e.preventDefault(), E(!0));
982
+ O && (e.preventDefault(), E(!0));
906
983
  },
907
984
  onDragLeave: () => E(!1),
908
985
  onDrop: (e) => {
909
- k && (e.preventDefault(), E(!1), I(e.dataTransfer?.files ?? null));
986
+ O && (e.preventDefault(), E(!1), F(e.dataTransfer?.files ?? null));
910
987
  },
911
988
  children: [
912
- (d.length > 0 || A || p) && /* @__PURE__ */ l("div", {
989
+ (d.length > 0 || k || p) && /* @__PURE__ */ l("div", {
913
990
  class: "sqc-attachments",
914
991
  children: [
915
992
  d.map((e) => /* @__PURE__ */ l("span", {
@@ -943,21 +1020,21 @@ function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
943
1020
  /* @__PURE__ */ l("div", {
944
1021
  class: "sqc-composer__field",
945
1022
  children: [
946
- M && /* @__PURE__ */ l("ul", {
1023
+ j && /* @__PURE__ */ l("ul", {
947
1024
  class: "sqc-mentions",
948
1025
  role: "listbox",
949
1026
  "aria-label": r.t.handles.picker,
950
- children: j.map((e, t) => /* @__PURE__ */ l("li", {
1027
+ children: A.map((e, t) => /* @__PURE__ */ l("li", {
951
1028
  role: "option",
952
1029
  "aria-selected": t === w,
953
1030
  class: `sqc-mention${t === w ? " sqc-mention--active" : ""}`,
954
1031
  onMouseDown: (e) => e.preventDefault(),
955
- onMouseEnter: () => T(t),
956
- onClick: () => F(e.handle),
1032
+ onMouseEnter: () => ee(t),
1033
+ onClick: () => P(e.handle),
957
1034
  children: [
958
1035
  /* @__PURE__ */ l("span", {
959
1036
  class: "sqc-mention__icon",
960
- children: /* @__PURE__ */ l(xe, {
1037
+ children: /* @__PURE__ */ l(Ce, {
961
1038
  name: e.name,
962
1039
  color: e.color,
963
1040
  url: e.avatarUrl,
@@ -981,38 +1058,38 @@ function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
981
1058
  rows: 1,
982
1059
  value: b,
983
1060
  placeholder: n,
984
- maxLength: L,
1061
+ maxLength: N,
985
1062
  "aria-label": r.t.composer.label,
986
1063
  onInput: (e) => {
987
- x(e.currentTarget.value), P(e.currentTarget), N();
1064
+ x(e.currentTarget.value), ne(e.currentTarget), M();
988
1065
  },
989
- onKeyDown: z,
990
- onClick: (e) => P(e.currentTarget),
1066
+ onKeyDown: L,
1067
+ onClick: (e) => ne(e.currentTarget),
991
1068
  onPaste: (e) => {
992
1069
  let t = e.clipboardData?.files;
993
- !k || !t || t.length === 0 || (e.preventDefault(), I(t));
1070
+ !O || !t || t.length === 0 || (e.preventDefault(), F(t));
994
1071
  }
995
1072
  }),
996
- B <= 200 && /* @__PURE__ */ l("span", {
1073
+ R <= 200 && /* @__PURE__ */ l("span", {
997
1074
  class: "sqc-composer__count",
998
1075
  "aria-live": "polite",
999
- children: B
1076
+ children: R
1000
1077
  })
1001
1078
  ]
1002
1079
  }),
1003
- k && /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l("input", {
1004
- ref: O,
1080
+ O && /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l("input", {
1081
+ ref: te,
1005
1082
  type: "file",
1006
1083
  multiple: !0,
1007
- accept: Ee,
1084
+ accept: Oe,
1008
1085
  class: "sqc-file-input",
1009
1086
  onChange: (e) => {
1010
- I(e.currentTarget.files), e.currentTarget.value = "";
1087
+ F(e.currentTarget.files), e.currentTarget.value = "";
1011
1088
  }
1012
1089
  }), /* @__PURE__ */ l("button", {
1013
1090
  type: "button",
1014
1091
  class: "sqc-btn sqc-btn--attach",
1015
- onClick: () => O.current?.click(),
1092
+ onClick: () => te.current?.click(),
1016
1093
  "aria-label": r.t.composer.attach,
1017
1094
  title: r.t.composer.attachTitle,
1018
1095
  children: /* @__PURE__ */ l("svg", {
@@ -1047,7 +1124,7 @@ function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
1047
1124
  }) : /* @__PURE__ */ l("button", {
1048
1125
  type: "submit",
1049
1126
  class: "sqc-btn sqc-btn--send",
1050
- disabled: !b.trim() && d.length === 0 || A,
1127
+ disabled: !b.trim() && d.length === 0 || k,
1051
1128
  "aria-label": r.t.composer.send,
1052
1129
  title: r.t.composer.sendTitle,
1053
1130
  children: /* @__PURE__ */ l("svg", {
@@ -1066,14 +1143,14 @@ function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
1066
1143
  }
1067
1144
  //#endregion
1068
1145
  //#region src/components/RichText.tsx
1069
- var Ae = /^(\s*)[-*•]\s+/, je = /^(\s*)\d+[.)]\s+/, Me = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, Ne = /^\s*([-*_])(?:\s*\1){2,}\s*$/, Pe = /^\s*>\s?(.*)$/, Fe = /^\s*```/;
1070
- function Ie(e, t, n, r) {
1146
+ var Me = /^(\s*)[-*•]\s+/, Ne = /^(\s*)\d+[.)]\s+/, Pe = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, Fe = /^\s*([-*_])(?:\s*\1){2,}\s*$/, Ie = /^\s*>\s?(.*)$/, Le = /^\s*```/;
1147
+ function Re(e, t, n, r) {
1071
1148
  let i = e[t].ordered, a = [], o = t;
1072
1149
  for (; o < e.length && e[o].depth >= n;) {
1073
1150
  let t = e[o];
1074
1151
  if (t.depth === n && t.ordered !== i) break;
1075
1152
  if (t.depth > n) {
1076
- let [n, i] = Ie(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
1153
+ let [n, i] = Re(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
1077
1154
  s ? s.nested.push(n) : a.push({
1078
1155
  key: `${r}-${o}`,
1079
1156
  text: null,
@@ -1090,7 +1167,7 @@ function Ie(e, t, n, r) {
1090
1167
  let s = a.map((e) => /* @__PURE__ */ l("li", { children: [e.text === null ? null : g(e.text, e.key), e.nested] }, e.key));
1091
1168
  return [l(i ? "ol" : "ul", { children: s }, r), o];
1092
1169
  }
1093
- function Le(e) {
1170
+ function ze(e) {
1094
1171
  let t = e.split("\n"), n = [], r = [], i = [], a = [], o = () => {
1095
1172
  if (!r.length) return;
1096
1173
  let e = `p${n.length}`;
@@ -1099,7 +1176,7 @@ function Le(e) {
1099
1176
  if (!i.length) return;
1100
1177
  let e = 0;
1101
1178
  for (; e < i.length;) {
1102
- let t = `l${n.length}`, [r, a] = Ie(i, e, i[e].depth, t);
1179
+ let t = `l${n.length}`, [r, a] = Re(i, e, i[e].depth, t);
1103
1180
  n.push(r), e = a;
1104
1181
  }
1105
1182
  i = [];
@@ -1112,10 +1189,10 @@ function Le(e) {
1112
1189
  };
1113
1190
  for (let e = 0; e < t.length; e += 1) {
1114
1191
  let d = t[e];
1115
- if (Fe.test(d)) {
1192
+ if (Le.test(d)) {
1116
1193
  u();
1117
1194
  let r = [];
1118
- for (e += 1; e < t.length && !Fe.test(t[e]);) r.push(t[e]), e += 1;
1195
+ for (e += 1; e < t.length && !Le.test(t[e]);) r.push(t[e]), e += 1;
1119
1196
  let i = `c${n.length}`;
1120
1197
  n.push(/* @__PURE__ */ l("pre", { children: /* @__PURE__ */ l("code", { children: r.join("\n") }) }, i));
1121
1198
  continue;
@@ -1124,23 +1201,23 @@ function Le(e) {
1124
1201
  u();
1125
1202
  continue;
1126
1203
  }
1127
- let f = Me.exec(d);
1204
+ let f = Pe.exec(d);
1128
1205
  if (f) {
1129
1206
  u();
1130
1207
  let e = f[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", r = `h${n.length}`;
1131
1208
  n.push(/* @__PURE__ */ l(t, { children: g(f[2], r) }, r));
1132
1209
  continue;
1133
1210
  }
1134
- if (Ne.test(d)) {
1211
+ if (Fe.test(d)) {
1135
1212
  u(), n.push(/* @__PURE__ */ l("hr", {}, `r${n.length}`));
1136
1213
  continue;
1137
1214
  }
1138
- let p = Pe.exec(d);
1215
+ let p = Ie.exec(d);
1139
1216
  if (p) {
1140
1217
  o(), s(), a.push(p[1]);
1141
1218
  continue;
1142
1219
  }
1143
- let m = Ae.exec(d), h = m ? null : je.exec(d), _ = m ?? h;
1220
+ let m = Me.exec(d), h = m ? null : Ne.exec(d), _ = m ?? h;
1144
1221
  if (_) {
1145
1222
  o(), c(), i.push({
1146
1223
  depth: _[1].replace(/\t/g, " ").length,
@@ -1153,7 +1230,7 @@ function Le(e) {
1153
1230
  }
1154
1231
  return u(), n;
1155
1232
  }
1156
- function Re(e) {
1233
+ function Be(e) {
1157
1234
  let t = o(null), { form: n, locked: i, language: a } = e;
1158
1235
  return r(() => {
1159
1236
  h();
@@ -1172,9 +1249,9 @@ function Re(e) {
1172
1249
  children: n.fields.map((e) => /* @__PURE__ */ l("p", { children: e.label }, e.name))
1173
1250
  });
1174
1251
  }
1175
- function ze(e, n, r) {
1252
+ function Ve(e, n, r) {
1176
1253
  switch (e.kind) {
1177
- case "markdown": return /* @__PURE__ */ l(t, { children: Le(e.text) });
1254
+ case "markdown": return /* @__PURE__ */ l(t, { children: ze(e.text) });
1178
1255
  case "table": return /* @__PURE__ */ l("sqc-table", {
1179
1256
  table: {
1180
1257
  header: e.header,
@@ -1190,24 +1267,24 @@ function ze(e, n, r) {
1190
1267
  locked: r,
1191
1268
  language: n.code
1192
1269
  });
1193
- case "form": return /* @__PURE__ */ l(Re, {
1270
+ case "form": return /* @__PURE__ */ l(Be, {
1194
1271
  form: e.form,
1195
1272
  locked: r,
1196
1273
  language: n.code
1197
1274
  });
1198
1275
  }
1199
1276
  }
1200
- function Be({ text: e, locale: n, live: r, confirmable: i }) {
1277
+ function He({ text: e, locale: n, live: r, confirmable: i }) {
1201
1278
  let { blocks: a, confirm: o } = _(e, n.code, i === !0), s = !r;
1202
- return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children: ze(e, n, s) }, `b${r}`)), o && /* @__PURE__ */ l("sqc-confirm", {
1279
+ return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children: Ve(e, n, s) }, `b${r}`)), o && /* @__PURE__ */ l("sqc-confirm", {
1203
1280
  locked: s,
1204
1281
  language: n.code
1205
1282
  })] });
1206
1283
  }
1207
1284
  //#endregion
1208
1285
  //#region src/components/MessageList.tsx
1209
- var Ve = 80;
1210
- function He({ at: e, locale: t }) {
1286
+ var Ue = 80;
1287
+ function We({ at: e, locale: t }) {
1211
1288
  let n = new Date(e);
1212
1289
  return /* @__PURE__ */ l("time", {
1213
1290
  class: "sqc-msg__time",
@@ -1218,7 +1295,7 @@ function He({ at: e, locale: t }) {
1218
1295
  })
1219
1296
  });
1220
1297
  }
1221
- function Ue(e) {
1298
+ function Ge(e) {
1222
1299
  let { call: t, locked: n, locale: i } = e, a = i.code, s = o(null);
1223
1300
  r(() => {
1224
1301
  h();
@@ -1257,7 +1334,7 @@ function Ue(e) {
1257
1334
  ]
1258
1335
  });
1259
1336
  }
1260
- function We({ file: t, load: n }) {
1337
+ function Ke({ file: t, load: n }) {
1261
1338
  let [r, i] = e(null);
1262
1339
  return v(() => {
1263
1340
  let e = null, r = !0;
@@ -1275,7 +1352,7 @@ function We({ file: t, load: n }) {
1275
1352
  children: t.filename
1276
1353
  });
1277
1354
  }
1278
- function Ge(e) {
1355
+ function qe(e) {
1279
1356
  let { file: t, load: n, language: i } = e, a = o(null), s = y(() => n(t.id).then((e) => e.text()).catch(() => ""), [t.id, n]);
1280
1357
  return r(() => {
1281
1358
  h();
@@ -1295,13 +1372,13 @@ function Ge(e) {
1295
1372
  children: t.filename
1296
1373
  });
1297
1374
  }
1298
- function Ke({ files: e, load: t, language: n }) {
1375
+ function Je({ files: e, load: t, language: n }) {
1299
1376
  return e.length === 0 || !t ? null : /* @__PURE__ */ l("div", {
1300
1377
  class: "sqc-attachments sqc-attachments--sent",
1301
- children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(We, {
1378
+ children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(Ke, {
1302
1379
  file: e,
1303
1380
  load: t
1304
- }, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(Ge, {
1381
+ }, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(qe, {
1305
1382
  file: e,
1306
1383
  load: t,
1307
1384
  language: n
@@ -1315,17 +1392,17 @@ function Ke({ files: e, load: t, language: n }) {
1315
1392
  }, e.id))
1316
1393
  });
1317
1394
  }
1318
- function qe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onLoadAttachment: a }) {
1395
+ function Ye({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onLoadAttachment: a }) {
1319
1396
  let o = e.streaming && !e.content, s = !!e.approval;
1320
1397
  return /* @__PURE__ */ l("div", {
1321
1398
  class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
1322
1399
  children: [e.role === "assistant" && /* @__PURE__ */ l("div", {
1323
1400
  class: "sqc-msg__who",
1324
- children: [e.agent ? /* @__PURE__ */ l(xe, {
1401
+ children: [e.agent ? /* @__PURE__ */ l(Ce, {
1325
1402
  name: e.agent.name,
1326
1403
  color: e.agent.color,
1327
1404
  url: e.agent.avatarUrl
1328
- }) : /* @__PURE__ */ l(Ye, {}), e.authorName ?? e.agent?.name ?? n]
1405
+ }) : /* @__PURE__ */ l(Ze, {}), e.authorName ?? e.agent?.name ?? n]
1329
1406
  }), /* @__PURE__ */ l("div", {
1330
1407
  class: "sqc-msg__bubble",
1331
1408
  children: [o ? /* @__PURE__ */ l("span", {
@@ -1346,7 +1423,7 @@ function qe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
1346
1423
  }) : /* @__PURE__ */ l("div", {
1347
1424
  class: "sqc-msg__body",
1348
1425
  children: [
1349
- /* @__PURE__ */ l(Be, {
1426
+ /* @__PURE__ */ l(He, {
1350
1427
  text: e.content,
1351
1428
  locale: t,
1352
1429
  live: r,
@@ -1356,29 +1433,29 @@ function qe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
1356
1433
  class: "sqc-caret",
1357
1434
  "aria-hidden": "true"
1358
1435
  }),
1359
- s && /* @__PURE__ */ l(Ue, {
1436
+ s && /* @__PURE__ */ l(Ge, {
1360
1437
  locale: t,
1361
1438
  call: e.content.trim() === "" ? e.approval : void 0,
1362
1439
  locked: !i
1363
1440
  }),
1364
- e.unknownHandle && !e.streaming && /* @__PURE__ */ l(Je, {
1441
+ e.unknownHandle && !e.streaming && /* @__PURE__ */ l(Xe, {
1365
1442
  message: e,
1366
1443
  locale: t
1367
1444
  }),
1368
- /* @__PURE__ */ l(Ke, {
1445
+ /* @__PURE__ */ l(Je, {
1369
1446
  files: e.attachments ?? [],
1370
1447
  load: a,
1371
1448
  language: t.code
1372
1449
  })
1373
1450
  ]
1374
- }), !o && /* @__PURE__ */ l(He, {
1451
+ }), !o && /* @__PURE__ */ l(We, {
1375
1452
  at: e.createdAt,
1376
1453
  locale: t
1377
1454
  })]
1378
1455
  })]
1379
1456
  });
1380
1457
  }
1381
- function Je({ message: e, locale: n }) {
1458
+ function Xe({ message: e, locale: n }) {
1382
1459
  let r = e.offered ?? [];
1383
1460
  return /* @__PURE__ */ l("p", {
1384
1461
  class: "sqc-msg__unaddressed",
@@ -1395,7 +1472,7 @@ function Je({ message: e, locale: n }) {
1395
1472
  ]
1396
1473
  });
1397
1474
  }
1398
- function Ye() {
1475
+ function Ze() {
1399
1476
  return /* @__PURE__ */ l("svg", {
1400
1477
  viewBox: "0 0 24 24",
1401
1478
  fill: "none",
@@ -1407,7 +1484,7 @@ function Ye() {
1407
1484
  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" })
1408
1485
  });
1409
1486
  }
1410
- function Xe({ messages: e, locale: t, assistantName: n, suggestions: i, showSuggestions: a, busy: s, withHuman: c, onSuggestion: u, onChoice: d, onDecide: f, onCompose: m, onLoadAttachment: h }) {
1487
+ function Qe({ messages: e, locale: t, assistantName: n, suggestions: i, showSuggestions: a, busy: s, withHuman: c, onSuggestion: u, onChoice: d, onDecide: f, onCompose: m, onLoadAttachment: h }) {
1411
1488
  let g = o(null), _ = o(!0);
1412
1489
  r(() => {
1413
1490
  let e = g.current;
@@ -1458,7 +1535,7 @@ function Xe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
1458
1535
  let e = g.current;
1459
1536
  if (!e) return;
1460
1537
  let t = () => {
1461
- _.current = e.scrollHeight - e.scrollTop - e.clientHeight < Ve;
1538
+ _.current = e.scrollHeight - e.scrollTop - e.clientHeight < Ue;
1462
1539
  };
1463
1540
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1464
1541
  }, []), /* @__PURE__ */ l("div", {
@@ -1468,7 +1545,7 @@ function Xe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
1468
1545
  "aria-live": "polite",
1469
1546
  "aria-atomic": "false",
1470
1547
  children: [
1471
- e.map((r, i) => /* @__PURE__ */ l(qe, {
1548
+ e.map((r, i) => /* @__PURE__ */ l(Ye, {
1472
1549
  message: r,
1473
1550
  locale: t,
1474
1551
  assistantName: n,
@@ -1495,28 +1572,28 @@ function Xe({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
1495
1572
  }
1496
1573
  //#endregion
1497
1574
  //#region src/components/ChatbotWidget.tsx
1498
- var Ze = { width: "min(392px, 100vw)" }, Qe = /* @__PURE__ */ new Set(["sessionId"]);
1499
- function $e(e) {
1575
+ var $e = { width: "min(392px, 100vw)" }, et = /* @__PURE__ */ new Set(["sessionId"]);
1576
+ function tt(e) {
1500
1577
  let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
1501
1578
  return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
1502
1579
  }
1503
- function et(e) {
1580
+ function nt(e) {
1504
1581
  if (!e) return [];
1505
1582
  let t = [];
1506
1583
  for (let [n, r] of Object.entries(e)) {
1507
- if (Qe.has(n) || typeof r != "string" && !w(r)) continue;
1584
+ if (et.has(n) || typeof r != "string" && !w(r)) continue;
1508
1585
  let e = C(r);
1509
1586
  e && t.push({
1510
- label: $e(n),
1587
+ label: tt(n),
1511
1588
  value: e
1512
1589
  });
1513
1590
  }
1514
1591
  return t;
1515
1592
  }
1516
- function tt(e, t) {
1593
+ function rt(e, t) {
1517
1594
  return e?.trim() ? e : t;
1518
1595
  }
1519
- function nt(t) {
1596
+ function it(t) {
1520
1597
  let [n, r] = e(!1);
1521
1598
  return v(() => {
1522
1599
  if (t !== "auto" || typeof matchMedia != "function") return;
@@ -1526,132 +1603,120 @@ function nt(t) {
1526
1603
  return e.addEventListener("change", n), () => e.removeEventListener("change", n);
1527
1604
  }, [t]), t === "dark" ? "dark" : t === "light" ? "light" : n ? "dark" : "light";
1528
1605
  }
1529
- function rt(t) {
1606
+ function at(t) {
1530
1607
  a();
1531
- let n = t.persistOpen ?? !0, [s, c] = e(() => O(t.defaultOpen, n)), [u, d] = e(!1), [f, p] = e(!1), m = o(null), h = o(null), g = nt(t.theme ?? "light"), _ = y(() => b(t.locale), [t.locale]), x = _.t, S = tt(t.heading, x.heading), C = tt(t.assistantName, x.assistant), w = tt(t.greeting, x.greeting), T = t.onEvent, { send: ee, reset: E, decide: j, stop: M, start: N, resets: P, busy: F, messages: I, withHuman: L, branding: R, sessionId: z, handles: B, addressee: te, agentHandle: V, attachments: H, uploading: U, attachmentError: W, attach: G, detach: K, loadAttachment: q } = be({
1608
+ let n = t.persistOpen ?? !0, [s, c] = e(() => te(t.defaultOpen, n)), [u, d] = e(!1), f = o(null), p = o(null), m = it(t.theme ?? "light"), h = y(() => b(t.locale), [t.locale]), g = h.t, _ = rt(t.heading, g.heading), x = rt(t.assistantName, g.assistant), S = rt(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 } = Se({
1532
1609
  embedKey: t.embedKey,
1533
1610
  user: t.user,
1534
1611
  scope: t.scope,
1535
1612
  getSubjectToken: t.getSubjectToken,
1536
1613
  agent: t.agent,
1537
1614
  context: t.context,
1538
- greeting: w,
1539
- locale: _,
1540
- onEvent: T
1615
+ greeting: S,
1616
+ locale: h,
1617
+ onEvent: C
1541
1618
  });
1542
1619
  v(() => {
1543
- !s && I.some((e) => e.role === "assistant" && e.id !== "greeting") && p(!0);
1544
- }, [I, s]);
1545
- let J = o(s);
1546
- J.current = s;
1547
- let Y = i(() => {
1548
- p(!1), !J.current && (J.current = !0, c(!0), n && D(!0), T?.({
1620
+ !s && j.some((e) => e.role === "assistant" && e.id !== "greeting") && d(!0);
1621
+ }, [j, s]);
1622
+ let W = o(s);
1623
+ W.current = s;
1624
+ let G = i(() => {
1625
+ d(!1), !W.current && (W.current = !0, c(!0), n && D(!0), C?.({
1549
1626
  type: "chatbot-open",
1550
- sessionId: z
1627
+ sessionId: N
1551
1628
  }));
1552
1629
  }, [
1553
- T,
1630
+ C,
1554
1631
  n,
1555
- z
1556
- ]), X = i(() => {
1557
- J.current && (J.current = !1, c(!1), n && D(!1), T?.({
1632
+ N
1633
+ ]), K = i(() => {
1634
+ W.current && (W.current = !1, c(!1), n && D(!1), C?.({
1558
1635
  type: "chatbot-close",
1559
- sessionId: z
1560
- }), h.current?.focus());
1636
+ sessionId: N
1637
+ }), p.current?.focus());
1561
1638
  }, [
1562
- T,
1639
+ C,
1563
1640
  n,
1564
- z
1641
+ N
1565
1642
  ]);
1566
1643
  v(() => {
1567
- s && N();
1644
+ s && O();
1568
1645
  }, [
1569
1646
  s,
1570
- P,
1571
- N
1647
+ k,
1648
+ O
1572
1649
  ]);
1573
- let ne = B.length >= 2, re = k(I, V || void 0), [ie, ae] = e(void 0), oe = o(void 0), se = i((e) => {
1574
- oe.current = e, ae(e);
1575
- }, []);
1576
- v(() => {
1577
- oe.current = void 0, ae(void 0);
1578
- }, [re]);
1579
- let Z = i((e) => {
1580
- d(!0), ee(ne ? A(e, oe.current, re) : e);
1581
- }, [
1582
- ee,
1583
- ne,
1584
- re
1585
- ]), ce = i(() => {
1586
- d(!1), p(!1), E();
1587
- }, [E]), Q = o({
1588
- openPanel: Y,
1589
- closePanel: X,
1590
- send: Z,
1591
- reset: ce,
1592
- sessionId: z
1650
+ let q = P.length >= 2, ie = w, ae = i(() => {
1651
+ d(!1), ee();
1652
+ }, [ee]), J = o({
1653
+ openPanel: G,
1654
+ closePanel: K,
1655
+ send: ie,
1656
+ reset: ae,
1657
+ sessionId: N
1593
1658
  });
1594
- Q.current = {
1595
- openPanel: Y,
1596
- closePanel: X,
1597
- send: Z,
1598
- reset: ce,
1599
- sessionId: z
1659
+ J.current = {
1660
+ openPanel: G,
1661
+ closePanel: K,
1662
+ send: ie,
1663
+ reset: ae,
1664
+ sessionId: N
1600
1665
  };
1601
- let le = o({
1602
- open: () => Q.current.openPanel(),
1603
- close: () => Q.current.closePanel(),
1604
- toggle: () => J.current ? Q.current.closePanel() : Q.current.openPanel(),
1605
- reset: () => Q.current.reset(),
1666
+ let oe = o({
1667
+ open: () => J.current.openPanel(),
1668
+ close: () => J.current.closePanel(),
1669
+ toggle: () => W.current ? J.current.closePanel() : J.current.openPanel(),
1670
+ reset: () => J.current.reset(),
1606
1671
  send: (e) => {
1607
- Q.current.openPanel(), Q.current.send(e);
1672
+ J.current.openPanel(), J.current.send(e);
1608
1673
  },
1609
- isOpen: () => J.current,
1610
- sessionId: () => Q.current.sessionId
1611
- }), $ = t.bind;
1612
- r(() => ($?.(le.current), () => $?.(null)), [$]), v(() => {
1674
+ isOpen: () => W.current,
1675
+ sessionId: () => J.current.sessionId
1676
+ }), se = t.bind;
1677
+ r(() => (se?.(oe.current), () => se?.(null)), [se]), v(() => {
1613
1678
  if (!s) return;
1614
1679
  let e = (e) => {
1615
- e.key === "Escape" && (e.stopPropagation(), X());
1680
+ e.key === "Escape" && (e.stopPropagation(), K());
1616
1681
  };
1617
1682
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1618
- }, [X, s]);
1619
- let ue = y(() => I.some((e) => e.id !== "greeting"), [I]), de = y(() => et(t.context), [t.context]), fe = {
1683
+ }, [K, s]);
1684
+ let ce = y(() => j.some((e) => e.role === "user"), [j]), Y = L.length > 0 ? L : t.suggestions, le = y(() => nt(t.context), [t.context]), ue = {
1620
1685
  ...t.accent ? { "--sqc-accent": t.accent } : {},
1621
- "--sqc-width": t.width ?? Ze.width
1686
+ "--sqc-width": t.width ?? $e.width
1622
1687
  };
1623
1688
  return /* @__PURE__ */ l("div", {
1624
1689
  class: "sqc",
1625
- "data-theme": g,
1690
+ "data-theme": m,
1626
1691
  "data-position": t.position ?? "bottom-right",
1627
1692
  "data-layout": t.layout ?? "sidebar",
1628
1693
  "data-open": s ? "true" : "false",
1629
- style: fe,
1694
+ style: ue,
1630
1695
  children: [/* @__PURE__ */ l("button", {
1631
- ref: h,
1696
+ ref: p,
1632
1697
  type: "button",
1633
1698
  class: "sqc-launcher",
1634
- "aria-label": S,
1699
+ "aria-label": _,
1635
1700
  "aria-expanded": s,
1636
1701
  "aria-haspopup": "dialog",
1637
- onClick: Y,
1702
+ onClick: G,
1638
1703
  children: [/* @__PURE__ */ l("span", {
1639
1704
  class: "sqc-launcher__icon",
1640
1705
  children: /* @__PURE__ */ l("slot", {
1641
1706
  name: "launcher-icon",
1642
1707
  class: "sqc-slot-icon",
1643
- children: /* @__PURE__ */ l(Ye, {})
1708
+ children: /* @__PURE__ */ l(Ze, {})
1644
1709
  })
1645
- }), f && /* @__PURE__ */ l("span", {
1710
+ }), u && /* @__PURE__ */ l("span", {
1646
1711
  class: "sqc-launcher__badge",
1647
1712
  "aria-hidden": "true"
1648
1713
  })]
1649
1714
  }), /* @__PURE__ */ l("aside", {
1650
- ref: m,
1715
+ ref: f,
1651
1716
  class: "sqc-panel",
1652
1717
  role: "dialog",
1653
1718
  "aria-modal": "false",
1654
- "aria-label": S,
1719
+ "aria-label": _,
1655
1720
  ...s ? {} : { inert: !0 },
1656
1721
  children: [/* @__PURE__ */ l("header", {
1657
1722
  class: "sqc-header",
@@ -1659,24 +1724,24 @@ function rt(t) {
1659
1724
  /* @__PURE__ */ l("span", {
1660
1725
  class: "sqc-header__icon",
1661
1726
  "aria-hidden": "true",
1662
- children: /* @__PURE__ */ l(Ye, {})
1727
+ children: /* @__PURE__ */ l(Ze, {})
1663
1728
  }),
1664
1729
  /* @__PURE__ */ l("div", {
1665
1730
  class: "sqc-header__titles",
1666
1731
  children: [/* @__PURE__ */ l("p", {
1667
1732
  class: "sqc-header__heading",
1668
- children: S
1733
+ children: _
1669
1734
  }), /* @__PURE__ */ l("p", {
1670
1735
  class: "sqc-header__sub",
1671
- children: tt(t.subheading, x.subheading)
1736
+ children: rt(t.subheading, g.subheading)
1672
1737
  })]
1673
1738
  }),
1674
1739
  /* @__PURE__ */ l("button", {
1675
1740
  type: "button",
1676
1741
  class: "sqc-icon-btn",
1677
- onClick: ce,
1678
- "aria-label": x.newConversation,
1679
- "data-tip": x.newConversation,
1742
+ onClick: ae,
1743
+ "aria-label": g.newConversation,
1744
+ "data-tip": g.newConversation,
1680
1745
  children: /* @__PURE__ */ l("svg", {
1681
1746
  viewBox: "0 0 24 24",
1682
1747
  fill: "none",
@@ -1691,9 +1756,9 @@ function rt(t) {
1691
1756
  /* @__PURE__ */ l("button", {
1692
1757
  type: "button",
1693
1758
  class: "sqc-icon-btn",
1694
- onClick: X,
1695
- "aria-label": x.close,
1696
- "data-tip": x.closeTitle,
1759
+ onClick: K,
1760
+ "aria-label": g.close,
1761
+ "data-tip": g.closeTitle,
1697
1762
  children: /* @__PURE__ */ l("svg", {
1698
1763
  viewBox: "0 0 24 24",
1699
1764
  fill: "none",
@@ -1708,64 +1773,64 @@ function rt(t) {
1708
1773
  ]
1709
1774
  }), /* @__PURE__ */ l("div", {
1710
1775
  class: "sqc-panel__body",
1711
- children: [ne && /* @__PURE__ */ l(Ce, {
1712
- handles: B,
1713
- active: ie ?? re,
1714
- disabled: L,
1715
- onPick: se,
1716
- label: x.handles.rail
1776
+ children: [q && /* @__PURE__ */ l(Te, {
1777
+ handles: P,
1778
+ active: I || void 0,
1779
+ disabled: A,
1780
+ onPick: re,
1781
+ label: g.handles.rail
1717
1782
  }), /* @__PURE__ */ l("div", {
1718
1783
  class: "sqc-panel__main",
1719
1784
  children: [
1720
- (t.showContext ?? !0) && de.length > 0 && /* @__PURE__ */ l("div", {
1785
+ (t.showContext ?? !0) && le.length > 0 && /* @__PURE__ */ l("div", {
1721
1786
  class: "sqc-context",
1722
- "aria-label": x.context.region,
1723
- children: de.map((e) => /* @__PURE__ */ l("span", {
1787
+ "aria-label": g.context.region,
1788
+ children: le.map((e) => /* @__PURE__ */ l("span", {
1724
1789
  class: "sqc-chip",
1725
1790
  title: `${e.label}: ${e.value}`,
1726
1791
  children: [/* @__PURE__ */ l("b", { children: e.label }), e.value]
1727
1792
  }, e.label))
1728
1793
  }),
1729
- /* @__PURE__ */ l(Xe, {
1730
- messages: I,
1731
- locale: _,
1732
- assistantName: C,
1733
- suggestions: t.suggestions,
1734
- showSuggestions: !u && !ue,
1735
- busy: F,
1736
- withHuman: L,
1737
- onSuggestion: Z,
1738
- onChoice: Z,
1739
- onDecide: j,
1740
- onCompose: () => m.current?.querySelector(".sqc-composer__input")?.focus(),
1741
- onLoadAttachment: q
1794
+ /* @__PURE__ */ l(Qe, {
1795
+ messages: j,
1796
+ locale: h,
1797
+ assistantName: x,
1798
+ suggestions: Y,
1799
+ showSuggestions: !ce,
1800
+ busy: A,
1801
+ withHuman: M,
1802
+ onSuggestion: ie,
1803
+ onChoice: ie,
1804
+ onDecide: T,
1805
+ onCompose: () => f.current?.querySelector(".sqc-composer__input")?.focus(),
1806
+ onLoadAttachment: U
1742
1807
  }),
1743
- /* @__PURE__ */ l(ke, {
1744
- placeholder: tt(t.placeholder, x.placeholder),
1745
- locale: _,
1746
- busy: F,
1808
+ /* @__PURE__ */ l(je, {
1809
+ placeholder: rt(t.placeholder, g.placeholder),
1810
+ locale: h,
1811
+ busy: A,
1747
1812
  autoFocus: s,
1748
- handles: B,
1749
- addressee: te,
1750
- attachments: H,
1751
- uploading: U,
1752
- attachmentError: W ? x.attachments[W] : void 0,
1753
- onAttach: G,
1754
- onDetach: K,
1755
- onSend: Z,
1756
- onStop: M
1813
+ handles: P,
1814
+ addressee: F,
1815
+ attachments: R,
1816
+ uploading: z,
1817
+ attachmentError: B ? g.attachments[B] : void 0,
1818
+ onAttach: V,
1819
+ onDetach: H,
1820
+ onSend: ie,
1821
+ onStop: E
1757
1822
  }),
1758
1823
  /* @__PURE__ */ l("p", {
1759
1824
  class: "sqc-hint",
1760
- children: x.hint
1825
+ children: g.hint
1761
1826
  }),
1762
- R && /* @__PURE__ */ l("p", {
1827
+ ne && /* @__PURE__ */ l("p", {
1763
1828
  class: "sqc-powered",
1764
1829
  children: /* @__PURE__ */ l("a", {
1765
1830
  href: "https://squadico.com",
1766
1831
  target: "_blank",
1767
1832
  rel: "noopener noreferrer",
1768
- children: x.poweredBy
1833
+ children: g.poweredBy
1769
1834
  })
1770
1835
  })
1771
1836
  ]
@@ -1776,7 +1841,7 @@ function rt(t) {
1776
1841
  }
1777
1842
  //#endregion
1778
1843
  //#region src/styles.css?inline
1779
- var it = ":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}", at = "squadico-chatbot", ot = [
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 = [
1780
1845
  "embed-key",
1781
1846
  "context",
1782
1847
  "user",
@@ -1796,21 +1861,21 @@ var it = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480
1796
1861
  "persist-open",
1797
1862
  "show-context",
1798
1863
  "locale"
1799
- ], st;
1800
- function ct() {
1801
- if (st !== void 0) return st;
1864
+ ], lt;
1865
+ function ut() {
1866
+ if (lt !== void 0) return lt;
1802
1867
  try {
1803
1868
  let e = new CSSStyleSheet();
1804
- e.replaceSync(it), st = e;
1869
+ e.replaceSync(ot), lt = e;
1805
1870
  } catch {
1806
- st = null;
1871
+ lt = null;
1807
1872
  }
1808
- return st;
1873
+ return lt;
1809
1874
  }
1810
- function lt(e, t) {
1811
- typeof console < "u" && console.warn(`[${at}] ${e}`, t ?? "");
1875
+ function dt(e, t) {
1876
+ typeof console < "u" && console.warn(`[${st}] ${e}`, t ?? "");
1812
1877
  }
1813
- function ut(e) {
1878
+ function ft(e) {
1814
1879
  if (!(!e || !e.trim())) try {
1815
1880
  let t = JSON.parse(e);
1816
1881
  if (t && typeof t == "object" && !Array.isArray(t)) {
@@ -1821,45 +1886,45 @@ function ut(e) {
1821
1886
  digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
1822
1887
  };
1823
1888
  }
1824
- lt("the \"user\" attribute needs an object with an id", e);
1889
+ dt("the \"user\" attribute needs an object with an id", e);
1825
1890
  } catch (e) {
1826
- lt("the \"user\" attribute is not valid JSON", e);
1891
+ dt("the \"user\" attribute is not valid JSON", e);
1827
1892
  }
1828
1893
  }
1829
- function dt(e) {
1894
+ function pt(e) {
1830
1895
  if (!(!e || !e.trim())) try {
1831
1896
  let t = JSON.parse(e);
1832
1897
  if (t && typeof t == "object" && !Array.isArray(t)) return t;
1833
- lt("the `context` attribute must be a JSON object", e);
1898
+ dt("the `context` attribute must be a JSON object", e);
1834
1899
  } catch (e) {
1835
- lt("the `context` attribute is not valid JSON", e);
1900
+ dt("the `context` attribute is not valid JSON", e);
1836
1901
  }
1837
1902
  }
1838
- function ft(e) {
1903
+ function mt(e) {
1839
1904
  if (!(!e || !e.trim())) {
1840
1905
  if (e.trim().startsWith("[")) try {
1841
1906
  let t = JSON.parse(e);
1842
1907
  if (Array.isArray(t)) return t.map(String);
1843
1908
  } catch (e) {
1844
- lt("the `suggestions` attribute is not valid JSON", e);
1909
+ dt("the `suggestions` attribute is not valid JSON", e);
1845
1910
  return;
1846
1911
  }
1847
1912
  return e.split("|").map((e) => e.trim()).filter(Boolean);
1848
1913
  }
1849
1914
  }
1850
- function pt(e) {
1915
+ function ht(e) {
1851
1916
  if (e !== null) return e !== "false" && e !== "0";
1852
1917
  }
1853
- function mt(e) {
1918
+ function gt(e) {
1854
1919
  return e === "dark" || e === "light" || e === "auto" ? e : void 0;
1855
1920
  }
1856
- function ht(e) {
1921
+ function _t(e) {
1857
1922
  return e === "bottom-left" || e === "bottom-right" ? e : void 0;
1858
1923
  }
1859
- function gt(e) {
1924
+ function vt(e) {
1860
1925
  return e === "floating" || e === "sidebar" ? e : void 0;
1861
1926
  }
1862
- var _t = [
1927
+ var yt = [
1863
1928
  "context",
1864
1929
  "embedKey",
1865
1930
  "user",
@@ -1867,7 +1932,7 @@ var _t = [
1867
1932
  "getSubjectToken",
1868
1933
  "agent"
1869
1934
  ];
1870
- function vt() {
1935
+ function bt() {
1871
1936
  var e, t, r, i, a, o, d, p, h, g, _, v, y, b, x;
1872
1937
  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 {
1873
1938
  constructor() {
@@ -1881,14 +1946,14 @@ function vt() {
1881
1946
  }), f(this, x, (e) => {
1882
1947
  s(r, this, e), e && s(o, this, e.sessionId());
1883
1948
  });
1884
- let e = this.attachShadow({ mode: "open" }), n = ct();
1949
+ let e = this.attachShadow({ mode: "open" }), n = ut();
1885
1950
  if (n) e.adoptedStyleSheets = [n];
1886
1951
  else {
1887
1952
  let t = document.createElement("style");
1888
- t.textContent = it, e.append(t);
1953
+ t.textContent = ot, e.append(t);
1889
1954
  }
1890
1955
  s(t, this, document.createElement("div")), e.append(c(t, this));
1891
- for (let e of _t) {
1956
+ for (let e of yt) {
1892
1957
  if (!Object.hasOwn(this, e)) continue;
1893
1958
  let t = this[e];
1894
1959
  delete this[e], this[e] = t;
@@ -1903,14 +1968,14 @@ function vt() {
1903
1968
  attributeChangedCallback(e, t, n) {
1904
1969
  if (t !== n) {
1905
1970
  if (e === "open" && c(r, this)) {
1906
- pt(n) ? c(r, this).open() : c(r, this).close();
1971
+ ht(n) ? c(r, this).open() : c(r, this).close();
1907
1972
  return;
1908
1973
  }
1909
1974
  m(y, this, S).call(this);
1910
1975
  }
1911
1976
  }
1912
1977
  get context() {
1913
- return c(d, this) ?? dt(this.getAttribute("context"));
1978
+ return c(d, this) ?? pt(this.getAttribute("context"));
1914
1979
  }
1915
1980
  set context(e) {
1916
1981
  s(d, this, e), m(y, this, S).call(this);
@@ -1928,7 +1993,7 @@ function vt() {
1928
1993
  s(h, this, e), m(y, this, S).call(this);
1929
1994
  }
1930
1995
  get user() {
1931
- return c(p, this) ?? ut(this.getAttribute("user"));
1996
+ return c(p, this) ?? ft(this.getAttribute("user"));
1932
1997
  }
1933
1998
  set user(e) {
1934
1999
  s(p, this, e), m(y, this, S).call(this);
@@ -1946,7 +2011,7 @@ function vt() {
1946
2011
  s(_, this, e), m(y, this, S).call(this);
1947
2012
  }
1948
2013
  get open() {
1949
- return c(r, this)?.isOpen() ?? pt(this.getAttribute("open")) ?? !1;
2014
+ return c(r, this)?.isOpen() ?? ht(this.getAttribute("open")) ?? !1;
1950
2015
  }
1951
2016
  set open(e) {
1952
2017
  e ? this.openChat() : this.closeChat();
@@ -1968,12 +2033,12 @@ function vt() {
1968
2033
  }
1969
2034
  sendMessage(e) {
1970
2035
  if (!c(r, this)) {
1971
- lt("sendMessage() called before the component was mounted — ignored");
2036
+ dt("sendMessage() called before the component was mounted — ignored");
1972
2037
  return;
1973
2038
  }
1974
2039
  c(r, this).send(e);
1975
2040
  }
1976
- }, F(e, "observedAttributes", ot), e;
2041
+ }, M(e, "observedAttributes", ct), e;
1977
2042
  function S() {
1978
2043
  c(i, this) || !c(a, this) || (s(i, this, !0), queueMicrotask(() => {
1979
2044
  s(i, this, !1), c(a, this) && m(y, this, C).call(this);
@@ -1981,7 +2046,7 @@ function vt() {
1981
2046
  }
1982
2047
  function C() {
1983
2048
  let e = (e) => this.getAttribute(e) ?? void 0;
1984
- n(/* @__PURE__ */ l(rt, {
2049
+ n(/* @__PURE__ */ l(at, {
1985
2050
  embedKey: this.embedKey,
1986
2051
  context: this.context,
1987
2052
  user: this.user,
@@ -1993,29 +2058,29 @@ function vt() {
1993
2058
  assistantName: e("assistant-name"),
1994
2059
  placeholder: e("placeholder"),
1995
2060
  greeting: e("greeting"),
1996
- suggestions: ft(this.getAttribute("suggestions")),
2061
+ suggestions: mt(this.getAttribute("suggestions")),
1997
2062
  width: e("width"),
1998
2063
  accent: e("accent"),
1999
- theme: mt(this.getAttribute("theme")),
2000
- position: ht(this.getAttribute("position")),
2001
- layout: gt(this.getAttribute("layout")),
2002
- defaultOpen: pt(this.getAttribute("open")) ?? !1,
2003
- persistOpen: pt(this.getAttribute("persist-open")) ?? !0,
2004
- showContext: pt(this.getAttribute("show-context")) ?? !0,
2064
+ theme: gt(this.getAttribute("theme")),
2065
+ position: _t(this.getAttribute("position")),
2066
+ layout: vt(this.getAttribute("layout")),
2067
+ defaultOpen: ht(this.getAttribute("open")) ?? !1,
2068
+ persistOpen: ht(this.getAttribute("persist-open")) ?? !0,
2069
+ showContext: ht(this.getAttribute("show-context")) ?? !0,
2005
2070
  locale: e("locale"),
2006
2071
  onEvent: c(b, this),
2007
2072
  bind: c(x, this)
2008
2073
  }), c(t, this));
2009
2074
  }
2010
2075
  }
2011
- var yt;
2012
- function bt(e = at) {
2013
- typeof window > "u" || typeof HTMLElement > "u" || (yt ?? (yt = vt()), window.customElements.get(e) || window.customElements.define(e, yt));
2076
+ var xt;
2077
+ function St(e = st) {
2078
+ typeof window > "u" || typeof HTMLElement > "u" || (xt ?? (xt = bt()), window.customElements.get(e) || window.customElements.define(e, xt));
2014
2079
  }
2015
2080
  //#endregion
2016
2081
  //#region src/index.ts
2017
- bt();
2082
+ St();
2018
2083
  //#endregion
2019
- export { L as a, R as i, bt as n, O as o, I as r, at as t };
2084
+ export { N as a, P as i, St as n, te as o, ne as r, st as t };
2020
2085
 
2021
- //# sourceMappingURL=src-B7GLD1Xs.js.map
2086
+ //# sourceMappingURL=src-Bm_aRvFA.js.map