@squadico/chatbot 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,7 @@ function w(e, t) {
45
45
  function T(e) {
46
46
  if (e.__P && e.__d) {
47
47
  var n = e.__v, r = n.__e, i = [], a = [], o = v({}, n);
48
- o.__v = n.__v + 1, t.vnode && t.vnode(o), ee(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? w(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, L(i, o, a), n.__e = n.__ = null, o.__e != r && E(o);
48
+ o.__v = n.__v + 1, t.vnode && t.vnode(o), I(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? w(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, L(i, o, a), n.__e = n.__ = null, o.__e != r && E(o);
49
49
  }
50
50
  }
51
51
  function E(e) {
@@ -65,13 +65,13 @@ function O() {
65
65
  }
66
66
  function k(e, t, n, r, i, a, o, s, c, l, u) {
67
67
  var d, f, p, g, _, v, y = r && r.__k || h, b = t.length;
68
- for (c = A(n, t, y, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && y[p.__i] || m, p.__i = d, v = ee(e, p, f, i, a, o, s, c, l, u), g = p.__e, p.ref && f.ref != p.ref && (f.ref && ne(f.ref, null, p), u.push(p.ref, p.__c || g, p)), _ == null && g != null && (_ = g), 4 & p.__u ? (c = j(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && v !== void 0 ? c = v : g && (c = g.nextSibling), p.__u &= -7);
68
+ for (c = A(n, t, y, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && y[p.__i] || m, p.__i = d, v = I(e, p, f, i, a, o, s, c, l, u), g = p.__e, p.ref && f.ref != p.ref && (f.ref && ne(f.ref, null, p), u.push(p.ref, p.__c || g, p)), _ == null && g != null && (_ = g), 4 & p.__u ? (c = j(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && v !== void 0 ? c = v : g && (c = g.nextSibling), p.__u &= -7);
69
69
  return n.__e = _, c;
70
70
  }
71
71
  function A(e, t, n, r, i) {
72
72
  var a, o, s, c, l, u = n.length, d = u, f = 0;
73
73
  for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = x(null, o, null, null, null) : _(o) ? o = e.__k[a] = x(S, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = x(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = M(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
74
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = w(s)), z(s, s));
74
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = w(s)), re(s, s));
75
75
  return r;
76
76
  }
77
77
  function j(e, t, n) {
@@ -125,14 +125,14 @@ function F(e) {
125
125
  }
126
126
  };
127
127
  }
128
- function ee(e, n, r, i, a, o, s, c, l, u) {
128
+ function I(e, n, r, i, a, o, s, c, l, u) {
129
129
  var d, f, p, m, g, b, x, T, E, D, O, A, j, M, N, P, F = n.type;
130
130
  if (n.constructor !== void 0) return null;
131
131
  128 & r.__u && (l = !!(32 & r.__u), o = [c = n.__e = r.__e]), (d = t.__b) && d(n);
132
132
  n: if (typeof F == "function") {
133
133
  f = s.length;
134
134
  try {
135
- if (E = n.props, D = F.prototype && F.prototype.render, O = (d = F.contextType) && i[d.__c], A = d ? O ? O.props.value : d.__ : i, r.__c ? T = (p = n.__c = r.__c).__ = p.__E : (D ? n.__c = p = new F(E, A) : (n.__c = p = new C(E, A), p.constructor = F, p.render = re), O && O.sub(p), p.state || (p.state = {}), p.__n = i, m = p.__d = !0, p.__h = [], p._sb = []), D && p.__s == null && (p.__s = p.state), D && F.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = v({}, p.__s)), v(p.__s, F.getDerivedStateFromProps(E, p.__s))), g = p.props, b = p.state, p.__v = n, m) D && F.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), D && p.componentDidMount != null && p.__h.push(p.componentDidMount);
135
+ if (E = n.props, D = F.prototype && F.prototype.render, O = (d = F.contextType) && i[d.__c], A = d ? O ? O.props.value : d.__ : i, r.__c ? T = (p = n.__c = r.__c).__ = p.__E : (D ? n.__c = p = new F(E, A) : (n.__c = p = new C(E, A), p.constructor = F, p.render = ie), O && O.sub(p), p.state || (p.state = {}), p.__n = i, m = p.__d = !0, p.__h = [], p._sb = []), D && p.__s == null && (p.__s = p.state), D && F.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = v({}, p.__s)), v(p.__s, F.getDerivedStateFromProps(E, p.__s))), g = p.props, b = p.state, p.__v = n, m) D && F.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), D && p.componentDidMount != null && p.__h.push(p.componentDidMount);
136
136
  else {
137
137
  if (D && F.getDerivedStateFromProps == null && E !== g && p.componentWillReceiveProps != null && p.componentWillReceiveProps(E, A), n.__v == r.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(E, p.__s, A)) {
138
138
  n.__v != r.__v && (p.props = E, p.state = p.__s, p.__d = !1), n.__e = r.__e, n.__k = r.__k, n.__k.some(function(e) {
@@ -156,13 +156,13 @@ function ee(e, n, r, i, a, o, s, c, l, u) {
156
156
  o != null && (o[o.indexOf(c)] = null), n.__e = c;
157
157
  } else if (o != null) for (P = o.length; P--;) y(o[P]);
158
158
  } else n.__e = r.__e;
159
- n.__k ?? (n.__k = r.__k || []), e.then || I(n), t.__e(e, n, r);
159
+ n.__k ?? (n.__k = r.__k || []), e.then || ee(n), t.__e(e, n, r);
160
160
  }
161
161
  } else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e = R(r.__e, n, r, i, a, o, s, l, u);
162
162
  return (d = t.diffed) && d(n), 128 & n.__u ? void 0 : c;
163
163
  }
164
- function I(e) {
165
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(I));
164
+ function ee(e) {
165
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ee));
166
166
  }
167
167
  function L(e, n, r) {
168
168
  for (var i = 0; i < r.length; i++) ne(r[i], r[++i], r[++i]);
@@ -212,7 +212,7 @@ function ne(e, n, r) {
212
212
  t.__e(e, r);
213
213
  }
214
214
  }
215
- function z(e, n, r) {
215
+ function re(e, n, r) {
216
216
  var i, a;
217
217
  if (t.unmount && t.unmount(e), (i = e.ref) && (i.current && i.current != e.__e || ne(i, null, n)), (i = e.__c) != null) {
218
218
  if (i.componentWillUnmount) try {
@@ -222,15 +222,15 @@ function z(e, n, r) {
222
222
  }
223
223
  i.base = i.__P = i.__n = null;
224
224
  }
225
- if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && z(i[a], n, r || typeof e.type != "function");
225
+ if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && re(i[a], n, r || typeof e.type != "function");
226
226
  r || y(e.__e), e.__c = e.__ = e.__e = void 0;
227
227
  }
228
- function re(e, t, n) {
228
+ function ie(e, t, n) {
229
229
  return this.constructor(e, n);
230
230
  }
231
- function ie(n, r, i) {
231
+ function ae(n, r, i) {
232
232
  var a, o, s, c;
233
- r == document && (r = document.documentElement), t.__ && t.__(n, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [], ee(r, n = (!a && i || r).__k = b(S, null, [n]), o || m, m, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? e.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), L(s, n, c), n.props.children = null;
233
+ r == document && (r = document.documentElement), t.__ && t.__(n, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [], I(r, n = (!a && i || r).__k = b(S, null, [n]), o || m, m, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? e.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), L(s, n, c), n.props.children = null;
234
234
  }
235
235
  e = h.slice, t = { __e: function(e, t, n, r) {
236
236
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
@@ -249,24 +249,24 @@ e = h.slice, t = { __e: function(e, t, n, r) {
249
249
  }, O.__r = 0, s = Math.random().toString(8), c = "__d" + s, l = "__a" + s, u = /(PointerCapture)$|Capture$/i, d = 0, f = F(!1), p = F(!0);
250
250
  //#endregion
251
251
  //#region node_modules/preact/hooks/dist/hooks.module.js
252
- var B, V, ae, oe, se = 0, ce = [], H = t, le = H.__b, ue = H.__r, de = H.diffed, fe = H.__c, pe = H.unmount, me = H.__;
253
- function he(e, t) {
254
- H.__h && H.__h(V, e, se || t), se = 0;
255
- var n = V.__H || (V.__H = {
252
+ var z, B, V, oe, H = 0, se = [], U = t, ce = U.__b, le = U.__r, ue = U.diffed, de = U.__c, fe = U.unmount, pe = U.__;
253
+ function me(e, t) {
254
+ U.__h && U.__h(B, e, H || t), H = 0;
255
+ var n = B.__H || (B.__H = {
256
256
  __: [],
257
257
  __h: []
258
258
  });
259
259
  return e >= n.__.length && n.__.push({}), n.__[e];
260
260
  }
261
- function U(e) {
262
- return se = 1, ge(we, e);
261
+ function W(e) {
262
+ return H = 1, he(we, e);
263
263
  }
264
- function ge(e, t, n) {
265
- var r = he(B++, 2);
264
+ function he(e, t, n) {
265
+ var r = me(z++, 2);
266
266
  if (r.t = e, !r.__c && (r.__ = [n ? n(t) : we(void 0, t), function(e) {
267
267
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
268
268
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
269
- }], r.__c = V, !V.__f)) {
269
+ }], r.__c = B, !B.__f)) {
270
270
  var i = function(e, t, n) {
271
271
  if (!r.__c.__H) return !0;
272
272
  var i = !1, o = r.__c.props !== e;
@@ -282,67 +282,67 @@ function ge(e, t, n) {
282
282
  }
283
283
  return !i || o;
284
284
  };
285
- V.__f = !0;
286
- var a = V.shouldComponentUpdate, o = V.componentWillUpdate;
287
- V.componentWillUpdate = function(e, t, n) {
285
+ B.__f = !0;
286
+ var a = B.shouldComponentUpdate, o = B.componentWillUpdate;
287
+ B.componentWillUpdate = function(e, t, n) {
288
288
  if (this.__e) {
289
289
  var r = a;
290
290
  a = void 0, i(e, t, n), a = r;
291
291
  }
292
292
  o && o.call(this, e, t, n);
293
- }, V.shouldComponentUpdate = i;
293
+ }, B.shouldComponentUpdate = i;
294
294
  }
295
295
  return r.__N || r.__;
296
296
  }
297
- function W(e, t) {
298
- var n = he(B++, 3);
299
- !H.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, V.__H.__h.push(n));
297
+ function G(e, t) {
298
+ var n = me(z++, 3);
299
+ !U.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, B.__H.__h.push(n));
300
300
  }
301
- function _e(e, t) {
302
- var n = he(B++, 4);
303
- !H.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, V.__h.push(n));
301
+ function ge(e, t) {
302
+ var n = me(z++, 4);
303
+ !U.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, B.__h.push(n));
304
304
  }
305
- function G(e) {
306
- return se = 5, K(function() {
305
+ function K(e) {
306
+ return H = 5, _e(function() {
307
307
  return { current: e };
308
308
  }, []);
309
309
  }
310
- function K(e, t) {
311
- var n = he(B++, 7);
310
+ function _e(e, t) {
311
+ var n = me(z++, 7);
312
312
  return Ce(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
313
313
  }
314
314
  function q(e, t) {
315
- return se = 8, K(function() {
315
+ return H = 8, _e(function() {
316
316
  return e;
317
317
  }, t);
318
318
  }
319
319
  function ve() {
320
- for (var e; e = ce.shift();) {
320
+ for (var e; e = se.shift();) {
321
321
  var t = e.__H;
322
322
  if (e.__P && t) try {
323
323
  t.__h.some(xe), t.__h.some(Se), t.__h = [];
324
324
  } catch (n) {
325
- t.__h = [], H.__e(n, e.__v);
325
+ t.__h = [], U.__e(n, e.__v);
326
326
  }
327
327
  }
328
328
  }
329
- H.__b = function(e) {
330
- V = null, le && le(e);
331
- }, H.__ = function(e, t) {
332
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), me && me(e, t);
333
- }, H.__r = function(e) {
334
- ue && ue(e), B = 0;
335
- var t = (V = e.__c).__H;
336
- t && (ae === V ? (t.__h = [], V.__h = [], t.__.some(function(e) {
329
+ U.__b = function(e) {
330
+ B = null, ce && ce(e);
331
+ }, U.__ = function(e, t) {
332
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), pe && pe(e, t);
333
+ }, U.__r = function(e) {
334
+ le && le(e), z = 0;
335
+ var t = (B = e.__c).__H;
336
+ t && (V === B ? (t.__h = [], B.__h = [], t.__.some(function(e) {
337
337
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
338
- })) : (t.__h.some(xe), t.__h.some(Se), t.__h = [], B = 0)), ae = V;
339
- }, H.diffed = function(e) {
340
- de && de(e);
338
+ })) : (t.__h.some(xe), t.__h.some(Se), t.__h = [], z = 0)), V = B;
339
+ }, U.diffed = function(e) {
340
+ ue && ue(e);
341
341
  var t = e.__c;
342
- t && t.__H && (t.__H.__h.length && (ce.push(t) !== 1 && oe === H.requestAnimationFrame || ((oe = H.requestAnimationFrame) || be)(ve)), t.__H.__.some(function(e) {
342
+ t && t.__H && (t.__H.__h.length && (se.push(t) !== 1 && oe === U.requestAnimationFrame || ((oe = U.requestAnimationFrame) || be)(ve)), t.__H.__.some(function(e) {
343
343
  e.u && (e.__H = e.u, e.u = void 0);
344
- })), ae = V = null;
345
- }, H.__c = function(e, t) {
344
+ })), V = B = null;
345
+ }, U.__c = function(e, t) {
346
346
  t.some(function(e) {
347
347
  try {
348
348
  e.__h.some(xe), e.__h = e.__h.filter(function(e) {
@@ -351,11 +351,11 @@ H.__b = function(e) {
351
351
  } catch (n) {
352
352
  t.some(function(e) {
353
353
  e.__h && (e.__h = []);
354
- }), t = [], H.__e(n, e.__v);
354
+ }), t = [], U.__e(n, e.__v);
355
355
  }
356
- }), fe && fe(e, t);
357
- }, H.unmount = function(e) {
358
- pe && pe(e);
356
+ }), de && de(e, t);
357
+ }, U.unmount = function(e) {
358
+ fe && fe(e);
359
359
  var t, n = e.__c;
360
360
  n && n.__H && (n.__H.__.some(function(e) {
361
361
  try {
@@ -363,7 +363,7 @@ H.__b = function(e) {
363
363
  } catch (e) {
364
364
  t = e;
365
365
  }
366
- }), n.__H = void 0, t && H.__e(t, n.__v));
366
+ }), n.__H = void 0, t && U.__e(t, n.__v));
367
367
  };
368
368
  var ye = typeof requestAnimationFrame == "function";
369
369
  function be(e) {
@@ -373,12 +373,12 @@ function be(e) {
373
373
  ye && (t = requestAnimationFrame(n));
374
374
  }
375
375
  function xe(e) {
376
- var t = V, n = e.__c;
377
- typeof n == "function" && (e.__c = void 0, n()), V = t;
376
+ var t = B, n = e.__c;
377
+ typeof n == "function" && (e.__c = void 0, n()), B = t;
378
378
  }
379
379
  function Se(e) {
380
- var t = V;
381
- e.__c = e.__(), V = t;
380
+ var t = B;
381
+ e.__c = e.__(), B = t;
382
382
  }
383
383
  function Ce(e, t) {
384
384
  return !e || e.length !== t.length || t.some(function(t, n) {
@@ -468,7 +468,8 @@ var Ae = "en", je = [
468
468
  handles: {
469
469
  picker: "Agents you can address",
470
470
  unknown: "Nobody answers to that name here:",
471
- instead: "You can address:"
471
+ instead: "You can address:",
472
+ rail: "Agents"
472
473
  },
473
474
  selection: {
474
475
  group: "Suggested choice",
@@ -538,7 +539,8 @@ var Ae = "en", je = [
538
539
  handles: {
539
540
  picker: "Agents que vous pouvez adresser",
540
541
  unknown: "Personne ne répond à ce nom ici :",
541
- instead: "Vous pouvez adresser :"
542
+ instead: "Vous pouvez adresser :",
543
+ rail: "Agents"
542
544
  },
543
545
  selection: {
544
546
  group: "Choix proposé",
@@ -608,7 +610,8 @@ var Ae = "en", je = [
608
610
  handles: {
609
611
  picker: "Agentes a los que puedes dirigirte",
610
612
  unknown: "Nadie responde a ese nombre aquí:",
611
- instead: "Puedes dirigirte a:"
613
+ instead: "Puedes dirigirte a:",
614
+ rail: "Agentes"
612
615
  },
613
616
  selection: {
614
617
  group: "Opción propuesta",
@@ -678,8 +681,20 @@ function Be(e, t) {
678
681
  return t === !1 ? e ?? !1 : Re() ?? e ?? !1;
679
682
  }
680
683
  //#endregion
684
+ //#region src/lib/rail.ts
685
+ function Ve(e, t) {
686
+ for (let t = e.length - 1; t >= 0; --t) {
687
+ let n = e[t];
688
+ if (n.role === "assistant" && n.agent) return n.agent.handle;
689
+ }
690
+ return t;
691
+ }
692
+ function He(e, t, n) {
693
+ return !t || t === n || e.trimStart().startsWith("@") ? e : `@${t} ${e}`;
694
+ }
695
+ //#endregion
681
696
  //#region src/lib/uid.ts
682
- function Ve() {
697
+ function Ue() {
683
698
  let e = globalThis.crypto;
684
699
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
685
700
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -692,36 +707,36 @@ function Ve() {
692
707
  }
693
708
  //#endregion
694
709
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
695
- function He(e) {
710
+ function We(e) {
696
711
  "@babel/helpers - typeof";
697
- return He = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
712
+ return We = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
698
713
  return typeof e;
699
714
  } : function(e) {
700
715
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
701
- }, He(e);
716
+ }, We(e);
702
717
  }
703
718
  //#endregion
704
719
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
705
- function Ue(e, t) {
706
- if (He(e) != "object" || !e) return e;
720
+ function Ge(e, t) {
721
+ if (We(e) != "object" || !e) return e;
707
722
  var n = e[Symbol.toPrimitive];
708
723
  if (n !== void 0) {
709
724
  var r = n.call(e, t || "default");
710
- if (He(r) != "object") return r;
725
+ if (We(r) != "object") return r;
711
726
  throw TypeError("@@toPrimitive must return a primitive value.");
712
727
  }
713
728
  return (t === "string" ? String : Number)(e);
714
729
  }
715
730
  //#endregion
716
731
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
717
- function We(e) {
718
- var t = Ue(e, "string");
719
- return He(t) == "symbol" ? t : t + "";
732
+ function Ke(e) {
733
+ var t = Ge(e, "string");
734
+ return We(t) == "symbol" ? t : t + "";
720
735
  }
721
736
  //#endregion
722
737
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
723
- function Ge(e, t, n) {
724
- return (t = We(t)) in e ? Object.defineProperty(e, t, {
738
+ function qe(e, t, n) {
739
+ return (t = Ke(t)) in e ? Object.defineProperty(e, t, {
725
740
  value: n,
726
741
  enumerable: !0,
727
742
  configurable: !0,
@@ -730,15 +745,15 @@ function Ge(e, t, n) {
730
745
  }
731
746
  //#endregion
732
747
  //#region src/lib/client.ts
733
- var Ke = "https://api.squadico.com", qe = 2e4, J = class extends Error {
748
+ var Je = "https://api.squadico.com", Ye = 2e4, J = class extends Error {
734
749
  constructor(e, t, n) {
735
- super(e), Ge(this, "status", void 0), Ge(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
750
+ super(e), qe(this, "status", void 0), qe(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
736
751
  }
737
752
  };
738
- function Je(e, t) {
753
+ function Xe(e, t) {
739
754
  return `${e.replace(/\/+$/, "")}${t}`;
740
755
  }
741
- function Ye(e, t) {
756
+ function Ze(e, t) {
742
757
  return {
743
758
  "Content-Type": "application/json",
744
759
  Accept: "text/event-stream, application/json",
@@ -746,21 +761,21 @@ function Ye(e, t) {
746
761
  ...t ? { "X-Subject-Token": t } : {}
747
762
  };
748
763
  }
749
- function Xe(e) {
764
+ function Qe(e) {
750
765
  if (!e || typeof e != "object") return;
751
766
  let { loc: t, msg: n } = e;
752
767
  if (typeof n != "string" || !n) return;
753
768
  let r = (Array.isArray(t) ? t.filter((e) => typeof e == "string") : []).at(-1);
754
769
  return r && r !== "body" ? `${r}: ${n}` : n;
755
770
  }
756
- async function Ze(e) {
771
+ async function $e(e) {
757
772
  let t = "", n;
758
773
  try {
759
774
  let r = await e.text();
760
775
  if (r) try {
761
776
  let e = JSON.parse(r), i = e.detail ?? e.message;
762
777
  if (Array.isArray(i)) {
763
- let e = i.map((e) => Xe(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
778
+ let e = i.map((e) => Qe(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
764
779
  t = e.length > 0 ? e.join(", ") : r;
765
780
  } else t = typeof i == "string" ? i : r;
766
781
  n = typeof e.code == "string" ? e.code : void 0;
@@ -770,20 +785,20 @@ async function Ze(e) {
770
785
  } catch {}
771
786
  return new J(t || `The API answered ${e.status}`, e.status, n);
772
787
  }
773
- function Qe(e) {
788
+ function et(e, t) {
774
789
  if (!e || typeof e != "object") return;
775
- let t = e;
776
- if (!(typeof t.handle != "string" || !t.handle)) return {
777
- handle: t.handle,
778
- name: typeof t.name == "string" ? t.name : t.handle,
779
- avatarEmoji: typeof t.avatar_emoji == "string" ? t.avatar_emoji : void 0,
780
- color: typeof t.color == "string" ? t.color : void 0
790
+ let n = e;
791
+ if (!(typeof n.handle != "string" || !n.handle)) return {
792
+ handle: n.handle,
793
+ name: typeof n.name == "string" ? n.name : n.handle,
794
+ avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ? Xe(t, n.avatar_url) : void 0,
795
+ color: typeof n.color == "string" ? n.color : void 0
781
796
  };
782
797
  }
783
- function $e(e) {
784
- return (Array.isArray(e) ? e : []).map(Qe).filter((e) => e !== void 0);
798
+ function tt(e, t) {
799
+ return (Array.isArray(e) ? e : []).map((e) => et(e, t)).filter((e) => e !== void 0);
785
800
  }
786
- function et(e) {
801
+ function nt(e) {
787
802
  if (!e || typeof e != "object") return;
788
803
  let t = e;
789
804
  if (!(typeof t.tool_call_id != "string" || !t.tool_call_id)) return {
@@ -792,26 +807,26 @@ function et(e) {
792
807
  arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
793
808
  };
794
809
  }
795
- var tt = /* @__PURE__ */ new Set(["user", "assistant"]);
796
- function nt(e) {
797
- if (typeof e.role != "string" || !tt.has(e.role) || typeof e.content != "string" || !e.content) return null;
798
- let t = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
810
+ var rt = /* @__PURE__ */ new Set(["user", "assistant"]);
811
+ function it(e, t) {
812
+ if (typeof e.role != "string" || !rt.has(e.role) || typeof e.content != "string" || !e.content) return null;
813
+ let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
799
814
  return {
800
- id: typeof e.id == "string" && e.id ? e.id : Ve(),
815
+ id: typeof e.id == "string" && e.id ? e.id : Ue(),
801
816
  role: e.role,
802
817
  content: e.content,
803
- createdAt: Number.isNaN(t) ? Date.now() : t,
804
- agent: Qe(e.agent),
805
- attachments: rt(e.attachments),
818
+ createdAt: Number.isNaN(n) ? Date.now() : n,
819
+ agent: et(e.agent, t),
820
+ attachments: at(e.attachments),
806
821
  authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
807
822
  };
808
823
  }
809
- function rt(e) {
824
+ function at(e) {
810
825
  if (!Array.isArray(e)) return;
811
- let t = e.map((e) => it(e)).filter((e) => e !== null);
826
+ let t = e.map((e) => ot(e)).filter((e) => e !== null);
812
827
  return t.length > 0 ? t : void 0;
813
828
  }
814
- function it(e) {
829
+ function ot(e) {
815
830
  if (!e || typeof e != "object") return null;
816
831
  let { id: t, kind: n, filename: r, content_type: i } = e;
817
832
  return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
@@ -821,20 +836,36 @@ function it(e) {
821
836
  contentType: typeof i == "string" ? i : "application/octet-stream"
822
837
  };
823
838
  }
824
- async function at(e) {
825
- let t = await fetch(Je(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
839
+ async function st(e) {
840
+ let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(Xe(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
841
+ method: "GET",
842
+ headers: Ze(),
843
+ signal: e.signal
844
+ });
845
+ if (!n.ok) throw await $e(n);
846
+ let r = await n.json();
847
+ return {
848
+ welcomeMessage: typeof r.welcome_message == "string" && r.welcome_message ? r.welcome_message : void 0,
849
+ agent: et(r.agent, e.apiUrl),
850
+ handles: tt(r.handles, e.apiUrl),
851
+ agentHandle: typeof r.agent_handle == "string" && r.agent_handle ? r.agent_handle : void 0,
852
+ branding: r.branding === !0
853
+ };
854
+ }
855
+ async function ct(e) {
856
+ let t = await fetch(Xe(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
826
857
  method: "POST",
827
- headers: Ye(),
858
+ headers: Ze(),
828
859
  body: JSON.stringify({
829
860
  ...e.user ? { user: e.user } : {},
830
861
  ...e.agent ? { agent: e.agent } : {}
831
862
  }),
832
863
  signal: e.signal
833
864
  });
834
- if (!t.ok) throw await Ze(t);
865
+ if (!t.ok) throw await $e(t);
835
866
  let n = await t.json();
836
867
  if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new J("The API opened a conversation without an id or a token");
837
- let r = (Array.isArray(n.messages) ? n.messages : []).map(nt).filter((e) => e !== null);
868
+ let r = (Array.isArray(n.messages) ? n.messages : []).map((t) => it(t, e.apiUrl)).filter((e) => e !== null);
838
869
  return {
839
870
  conversationId: n.id,
840
871
  visitorToken: n.visitor_token,
@@ -842,19 +873,19 @@ async function at(e) {
842
873
  agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
843
874
  welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
844
875
  messages: r,
845
- handles: $e(n.handles),
876
+ handles: tt(n.handles, e.apiUrl),
846
877
  agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
847
878
  withHuman: typeof n.handling == "string" && n.handling !== "agents",
848
879
  branding: n.branding === !0
849
880
  };
850
881
  }
851
- async function ot(e) {
852
- let t = await fetch(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
882
+ async function lt(e) {
883
+ let t = await fetch(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
853
884
  method: "GET",
854
- headers: Ye(e.visitorToken),
885
+ headers: Ze(e.visitorToken),
855
886
  signal: e.signal
856
887
  });
857
- if (!t.ok) throw await Ze(t);
888
+ if (!t.ok) throw await $e(t);
858
889
  let n = await t.json();
859
890
  if (typeof n.id != "string") throw new J("The API replayed a conversation without an id");
860
891
  return {
@@ -863,67 +894,67 @@ async function ot(e) {
863
894
  agentName: typeof n.agent_name == "string" ? n.agent_name : "",
864
895
  agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
865
896
  welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
866
- messages: (Array.isArray(n.messages) ? n.messages : []).map(nt).filter((e) => e !== null),
867
- handles: $e(n.handles),
897
+ messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => it(t, e.apiUrl)).filter((e) => e !== null),
898
+ handles: tt(n.handles, e.apiUrl),
868
899
  agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
869
900
  withHuman: typeof n.handling == "string" && n.handling !== "agents",
870
901
  branding: n.branding === !0
871
902
  };
872
903
  }
873
- async function st(e) {
904
+ async function ut(e) {
874
905
  let t = new FormData();
875
906
  t.append("file", e.file);
876
- let n = await fetch(ut(e), {
907
+ let n = await fetch(pt(e), {
877
908
  method: "POST",
878
909
  headers: { "X-Visitor-Token": e.visitorToken },
879
910
  body: t,
880
911
  signal: e.signal
881
912
  });
882
- if (!n.ok) throw await Ze(n);
883
- let r = it(await n.json());
913
+ if (!n.ok) throw await $e(n);
914
+ let r = ot(await n.json());
884
915
  if (!r) throw new J("The upload could not be read", n.status);
885
916
  return r;
886
917
  }
887
- async function ct(e) {
888
- let t = await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}`, {
918
+ async function dt(e) {
919
+ let t = await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}`, {
889
920
  method: "DELETE",
890
921
  headers: { "X-Visitor-Token": e.visitorToken },
891
922
  signal: e.signal
892
923
  });
893
- if (!t.ok) throw await Ze(t);
924
+ if (!t.ok) throw await $e(t);
894
925
  }
895
- async function lt(e) {
896
- let t = await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
926
+ async function ft(e) {
927
+ let t = await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
897
928
  headers: { "X-Visitor-Token": e.visitorToken },
898
929
  signal: e.signal
899
930
  });
900
- if (!t.ok) throw await Ze(t);
931
+ if (!t.ok) throw await $e(t);
901
932
  return t.blob();
902
933
  }
903
- function ut(e) {
904
- return Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
934
+ function pt(e) {
935
+ return Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
905
936
  }
906
- async function dt(e) {
907
- return pt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
937
+ async function mt(e) {
938
+ return gt(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
908
939
  content: e.message,
909
940
  attachment_ids: e.attachmentIds ?? [],
910
941
  ...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
911
942
  }, e);
912
943
  }
913
- async function ft(e) {
914
- return pt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
944
+ async function ht(e) {
945
+ return gt(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
915
946
  tool_call_id: e.toolCallId,
916
947
  approved: e.approved
917
948
  }, e);
918
949
  }
919
- async function pt(e, t, n) {
950
+ async function gt(e, t, n) {
920
951
  let r = await fetch(e, {
921
952
  method: "POST",
922
- headers: Ye(n.visitorToken, n.subjectToken),
953
+ headers: Ze(n.visitorToken, n.subjectToken),
923
954
  body: JSON.stringify(t),
924
955
  signal: n.signal
925
956
  });
926
- if (!r.ok) throw await Ze(r);
957
+ if (!r.ok) throw await $e(r);
927
958
  if (!r.body) throw new J("Answer with no stream body");
928
959
  let i = r.body.getReader(), a = new TextDecoder(), o = "", s = "", c = "", l, u, d = { answer: "" };
929
960
  try {
@@ -952,7 +983,7 @@ async function pt(e, t, n) {
952
983
  } catch {
953
984
  continue;
954
985
  }
955
- s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = Qe(i.agent), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = $e(i.handles))) : 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 = et(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
986
+ s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = et(i.agent, n.apiUrl), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = tt(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 = nt(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
956
987
  }
957
988
  if (l) break;
958
989
  }
@@ -964,11 +995,11 @@ async function pt(e, t, n) {
964
995
  }
965
996
  //#endregion
966
997
  //#region src/lib/conversation.ts
967
- var mt = "squadico-chatbot:conversation";
968
- function ht() {
998
+ var _t = "squadico-chatbot:conversation";
999
+ function vt() {
969
1000
  try {
970
1001
  if (typeof sessionStorage > "u") return;
971
- let e = sessionStorage.getItem(mt);
1002
+ let e = sessionStorage.getItem(_t);
972
1003
  if (!e) return;
973
1004
  let t = JSON.parse(e);
974
1005
  return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
@@ -981,110 +1012,162 @@ function ht() {
981
1012
  return;
982
1013
  }
983
1014
  }
984
- function gt(e) {
1015
+ function yt(e) {
985
1016
  try {
986
1017
  if (typeof sessionStorage > "u") return;
987
- sessionStorage.setItem(mt, JSON.stringify(e));
1018
+ sessionStorage.setItem(_t, JSON.stringify(e));
988
1019
  } catch {}
989
1020
  }
990
- function _t() {
1021
+ function bt() {
991
1022
  try {
992
1023
  if (typeof sessionStorage > "u") return;
993
- sessionStorage.removeItem(mt);
1024
+ sessionStorage.removeItem(_t);
994
1025
  } catch {}
995
1026
  }
996
- function vt(e, { embedKey: t, user: n }) {
1027
+ function xt(e, { embedKey: t, user: n }) {
997
1028
  return e.embedKey === t && e.user === n;
998
1029
  }
999
1030
  //#endregion
1000
1031
  //#region src/lib/useChat.ts
1001
- async function yt(e) {
1032
+ async function St(e) {
1002
1033
  if (e) try {
1003
1034
  return await e() || void 0;
1004
1035
  } catch {
1005
1036
  return;
1006
1037
  }
1007
1038
  }
1008
- function bt(e) {
1039
+ var Ct = "preview-welcome";
1040
+ function wt(e) {
1009
1041
  let t = e instanceof J ? e.status : void 0;
1010
1042
  return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
1011
1043
  }
1012
- var xt = 5e3;
1013
- function St(e) {
1044
+ var Tt = 5e3;
1045
+ function Et(e) {
1014
1046
  return e instanceof J && e.code === "conversation_retired";
1015
1047
  }
1016
- function Ct(e) {
1017
- let [t, n] = U([]), [r, i] = U(!1), [a, o] = U(""), [s, c] = U([]), [l, u] = U(""), [d, f] = U(null), [p, m] = U(!1), [h, g] = U(!1), [_, v] = U([]), [y, b] = U([]), [x, S] = U(null), C = G(null), w = G(e);
1018
- w.current = e;
1019
- let T = G(null), E = G(null), D = G(void 0), O = e.greeting, k = K(() => O ? {
1048
+ function Dt(e) {
1049
+ let [t, n] = W([]), [r, i] = W(!1), [a, o] = W(""), [s, c] = W([]), [l, u] = W(""), [d, f] = W(""), [p, m] = W(null), [h, g] = W(!1), [_, v] = W(!1), [y, b] = W([]), [x, S] = W([]), [C, w] = W(null), T = K(null), E = K(e);
1050
+ E.current = e;
1051
+ let D = K(null), O = K(null), k = K(null), A = K(null), j = K(void 0), M = e.greeting, N = _e(() => M ? {
1020
1052
  id: "greeting",
1021
1053
  role: "assistant",
1022
- content: O,
1054
+ content: M,
1023
1055
  createdAt: Date.now()
1024
- } : null, [O]), A = q((e) => {
1025
- w.current.onEvent?.(e);
1026
- }, []), j = q((e, t) => {
1056
+ } : null, [M]), P = q((e) => {
1057
+ E.current.onEvent?.(e);
1058
+ }, []), F = q((e, t) => {
1027
1059
  n((n) => n.map((n) => n.id === e ? {
1028
1060
  ...n,
1029
1061
  ...t
1030
1062
  } : n));
1031
- }, []), M = q((e, t) => {
1032
- let n = e instanceof J ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (w.current.locale ?? Ie(void 0)).t.error;
1033
- t && j(t, {
1063
+ }, []), I = q((e, t) => {
1064
+ let n = e instanceof J ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (E.current.locale ?? Ie(void 0)).t.error;
1065
+ t && F(t, {
1034
1066
  content: i,
1035
1067
  streaming: !1,
1036
1068
  error: !0
1037
- }), A({
1069
+ }), P({
1038
1070
  type: "chatbot-error",
1039
1071
  message: r,
1040
1072
  status: n,
1041
- sessionId: E.current?.sessionId ?? ""
1073
+ sessionId: O.current?.sessionId ?? ""
1042
1074
  }), typeof console < "u" && console.error("[squadico-chatbot]", r);
1043
- }, [A, j]), N = q(async () => {
1044
- if (E.current) return E.current;
1045
- if (T.current) return T.current;
1046
- let e = w.current;
1075
+ }, [P, F]), ee = q(() => {
1076
+ let e = E.current;
1047
1077
  if (!e.embedKey) throw new J("No embed key: nothing says which application to open");
1048
- let t = e.user, r = e.apiUrl ?? "https://api.squadico.com", i = e.embedKey, a = (r) => {
1049
- let a = {
1050
- sessionId: r.conversationId,
1051
- visitorToken: r.visitorToken
1052
- };
1053
- return E.current = a, D.current = t?.id, gt({
1054
- ...a,
1055
- embedKey: i,
1056
- user: t?.id
1057
- }), o(r.conversationId), c(r.handles), u(e.agent && r.agentHandle ? r.agentHandle : ""), m(!!r.withHuman), g(r.branding), r.messages.length > 0 && n((e) => [...r.messages, ...e]), a;
1058
- }, s = () => at({
1059
- apiUrl: r,
1060
- embedKey: i,
1061
- user: t,
1062
- agent: e.agent
1063
- }).then(a), l = ht(), d = l && vt(l, {
1064
- embedKey: i,
1065
- user: t?.id
1066
- }) ? ot({
1067
- apiUrl: r,
1068
- conversationId: l.sessionId,
1069
- visitorToken: l.visitorToken
1070
- }).then(a).catch(() => (_t(), s())) : s();
1071
- T.current = d;
1078
+ return {
1079
+ opts: e,
1080
+ apiUrl: e.apiUrl ?? "https://api.squadico.com",
1081
+ embedKey: e.embedKey,
1082
+ claim: e.user
1083
+ };
1084
+ }, []), L = q((e, t) => {
1085
+ let r = {
1086
+ sessionId: t.conversationId,
1087
+ visitorToken: t.visitorToken
1088
+ };
1089
+ return O.current = r, j.current = e.claim?.id, yt({
1090
+ ...r,
1091
+ embedKey: e.embedKey,
1092
+ user: e.claim?.id
1093
+ }), o(t.conversationId), c(t.handles), u(e.opts.agent && t.agentHandle ? t.agentHandle : ""), f(t.agentHandle ?? ""), g(!!t.withHuman), v(t.branding), n((e) => [...t.messages, ...e.filter((e) => e.id !== Ct)]), r;
1094
+ }, []), te = q((e) => {
1095
+ if (k.current) return k.current;
1096
+ let t = vt();
1097
+ if (!t || !xt(t, {
1098
+ embedKey: e.embedKey,
1099
+ user: e.claim?.id
1100
+ })) return Promise.resolve(null);
1101
+ let n = lt({
1102
+ apiUrl: e.apiUrl,
1103
+ conversationId: t.sessionId,
1104
+ visitorToken: t.visitorToken
1105
+ }).then((t) => L(e, t)).catch(() => (bt(), null)).finally(() => {
1106
+ k.current = null;
1107
+ });
1108
+ return k.current = n, n;
1109
+ }, [L]), R = q(async () => {
1110
+ if (O.current) return O.current;
1111
+ if (D.current) return D.current;
1112
+ let e = ee(), t = te(e).then((t) => t ?? ct({
1113
+ apiUrl: e.apiUrl,
1114
+ embedKey: e.embedKey,
1115
+ user: e.claim,
1116
+ agent: e.opts.agent
1117
+ }).then((t) => L(e, t)));
1118
+ D.current = t;
1072
1119
  try {
1073
- return await d;
1120
+ return await t;
1074
1121
  } finally {
1075
- T.current = null;
1122
+ D.current = null;
1076
1123
  }
1077
- }, []), P = q(() => {
1078
- E.current || T.current || N().catch((e) => M(e));
1079
- }, [N, M]), F = q((e, t, { retry: r = !1, carried: a = [] } = {}) => {
1080
- if (C.current) return;
1124
+ }, [
1125
+ L,
1126
+ te,
1127
+ ee
1128
+ ]), ne = q(() => {
1129
+ if (O.current || D.current || A.current) return;
1130
+ let e;
1131
+ try {
1132
+ e = ee();
1133
+ } catch (e) {
1134
+ I(e);
1135
+ return;
1136
+ }
1137
+ let t = te(e).then(async (t) => {
1138
+ if (t || O.current || D.current) return;
1139
+ let r = await st({
1140
+ apiUrl: e.apiUrl,
1141
+ embedKey: e.embedKey,
1142
+ agent: e.opts.agent
1143
+ });
1144
+ if (O.current || D.current) return;
1145
+ c(r.handles), u(e.opts.agent && r.agentHandle ? r.agentHandle : ""), f(r.agentHandle ?? ""), v(r.branding);
1146
+ let i = r.welcomeMessage;
1147
+ i && n((e) => e.length > 0 ? e : [{
1148
+ id: Ct,
1149
+ role: "assistant",
1150
+ content: i,
1151
+ createdAt: Date.now(),
1152
+ agent: r.agent
1153
+ }]);
1154
+ });
1155
+ A.current = t, t.catch((e) => {
1156
+ A.current = null, I(e);
1157
+ });
1158
+ }, [
1159
+ I,
1160
+ te,
1161
+ ee
1162
+ ]), re = q((e, t, { retry: r = !1, carried: a = [] } = {}) => {
1163
+ if (T.current) return;
1081
1164
  let o = new AbortController();
1082
- C.current = o, i(!0), f(null);
1083
- let s = Ve();
1165
+ T.current = o, i(!0), m(null);
1166
+ let s = Ue();
1084
1167
  n((t) => [
1085
1168
  ...t,
1086
1169
  {
1087
- id: Ve(),
1170
+ id: Ue(),
1088
1171
  role: "user",
1089
1172
  content: e,
1090
1173
  createdAt: Date.now(),
@@ -1098,27 +1181,27 @@ function Ct(e) {
1098
1181
  streaming: !0
1099
1182
  }
1100
1183
  ]), (async () => {
1101
- let i = await N();
1102
- A({
1184
+ let i = await R();
1185
+ P({
1103
1186
  type: "chatbot-message",
1104
1187
  role: "user",
1105
1188
  content: e,
1106
1189
  sessionId: i.sessionId
1107
1190
  });
1108
1191
  let a = "", c = (e) => {
1109
- a += e, j(s, { content: a });
1192
+ a += e, F(s, { content: a });
1110
1193
  }, l;
1111
1194
  try {
1112
1195
  l = await t(i, c, o.signal);
1113
1196
  } catch (e) {
1114
- if (!St(e) || (_t(), E.current = null, T.current = null, !r)) throw e;
1115
- i = await N(), a = "", j(s, { content: "" }), l = await t(i, c, o.signal);
1197
+ if (!Et(e) || (bt(), O.current = null, D.current = null, !r)) throw e;
1198
+ i = await R(), a = "", F(s, { content: "" }), l = await t(i, c, o.signal);
1116
1199
  }
1117
- if (l.withHuman && m(!0), l.held) {
1200
+ if (l.withHuman && g(!0), l.held) {
1118
1201
  n((e) => e.filter((e) => e.id !== s));
1119
1202
  return;
1120
1203
  }
1121
- j(s, {
1204
+ F(s, {
1122
1205
  content: l.answer,
1123
1206
  streaming: !1,
1124
1207
  agent: l.agent,
@@ -1126,7 +1209,7 @@ function Ct(e) {
1126
1209
  approval: l.approval,
1127
1210
  unknownHandle: l.unknownHandle,
1128
1211
  offered: l.offered
1129
- }), f(l.approval ?? null), A({
1212
+ }), m(l.approval ?? null), P({
1130
1213
  type: "chatbot-message",
1131
1214
  role: "assistant",
1132
1215
  content: l.answer,
@@ -1135,69 +1218,69 @@ function Ct(e) {
1135
1218
  });
1136
1219
  })().catch((e) => {
1137
1220
  if (o.signal.aborted) {
1138
- j(s, { streaming: !1 });
1221
+ F(s, { streaming: !1 });
1139
1222
  return;
1140
1223
  }
1141
- M(e, s);
1224
+ I(e, s);
1142
1225
  }).finally(() => {
1143
- C.current = null, i(!1);
1226
+ T.current = null, i(!1);
1144
1227
  });
1145
1228
  }, [
1146
- N,
1147
- A,
1148
- M,
1149
- j
1150
- ]), ee = q((e) => {
1229
+ R,
1230
+ P,
1231
+ I,
1232
+ F
1233
+ ]), ie = q((e) => {
1151
1234
  let t = e.trim();
1152
- if (!t && _.length === 0) return;
1153
- let n = _;
1154
- v([]), S(null), F(t, async (e, r, i) => dt({
1155
- subjectToken: await yt(w.current.getSubjectToken),
1156
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1235
+ if (!t && y.length === 0) return;
1236
+ let n = y;
1237
+ b([]), w(null), re(t, async (e, r, i) => mt({
1238
+ subjectToken: await St(E.current.getSubjectToken),
1239
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1157
1240
  conversationId: e.sessionId,
1158
1241
  visitorToken: e.visitorToken,
1159
1242
  message: t,
1160
1243
  attachmentIds: n.map((e) => e.id),
1161
- context: w.current.context ? ke(w.current.context) : void 0,
1244
+ context: E.current.context ? ke(E.current.context) : void 0,
1162
1245
  onToken: r,
1163
1246
  signal: i
1164
1247
  }), {
1165
1248
  retry: !0,
1166
1249
  carried: n
1167
1250
  });
1168
- }, [_, F]), I = q((e) => {
1169
- S(null), b((t) => [...t, e.name]), N().then((t) => st({
1170
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1251
+ }, [y, re]), ae = q((e) => {
1252
+ w(null), S((t) => [...t, e.name]), R().then((t) => ut({
1253
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1171
1254
  conversationId: t.sessionId,
1172
1255
  visitorToken: t.visitorToken,
1173
1256
  file: e
1174
- })).then((e) => v((t) => [...t, e])).catch((e) => S(bt(e))).finally(() => b((t) => {
1257
+ })).then((e) => b((t) => [...t, e])).catch((e) => w(wt(e))).finally(() => S((t) => {
1175
1258
  let n = t.indexOf(e.name);
1176
1259
  return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
1177
1260
  }));
1178
- }, [N]), L = q((e) => {
1179
- v((t) => t.filter((t) => t.id !== e));
1180
- let t = E.current;
1181
- t && ct({
1182
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1261
+ }, [R]), z = q((e) => {
1262
+ b((t) => t.filter((t) => t.id !== e));
1263
+ let t = O.current;
1264
+ t && dt({
1265
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1183
1266
  conversationId: t.sessionId,
1184
1267
  visitorToken: t.visitorToken,
1185
1268
  attachmentId: e
1186
1269
  }).catch(() => {});
1187
- }, []), te = q(async (e) => {
1188
- let t = E.current;
1270
+ }, []), B = q(async (e) => {
1271
+ let t = O.current;
1189
1272
  if (!t) throw new J("No conversation to read that file from");
1190
- return lt({
1191
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1273
+ return ft({
1274
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1192
1275
  conversationId: t.sessionId,
1193
1276
  visitorToken: t.visitorToken,
1194
1277
  attachmentId: e
1195
1278
  });
1196
- }, []), R = q((e, t) => {
1197
- let n = d;
1198
- n && F(t, async (t, r, i) => ft({
1199
- subjectToken: await yt(w.current.getSubjectToken),
1200
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1279
+ }, []), V = q((e, t) => {
1280
+ let n = p;
1281
+ n && re(t, async (t, r, i) => ht({
1282
+ subjectToken: await St(E.current.getSubjectToken),
1283
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1201
1284
  conversationId: t.sessionId,
1202
1285
  visitorToken: t.visitorToken,
1203
1286
  toolCallId: n.toolCallId,
@@ -1205,60 +1288,61 @@ function Ct(e) {
1205
1288
  onToken: r,
1206
1289
  signal: i
1207
1290
  }));
1208
- }, [d, F]), ne = q(() => {
1209
- C.current?.abort(), C.current = null, i(!1);
1210
- }, []), z = q(() => {
1211
- C.current?.abort(), C.current = null, E.current = null, T.current = null, D.current = void 0, _t(), i(!1), f(null), m(!1), o(""), u(""), n([]), A({
1291
+ }, [p, re]), oe = q(() => {
1292
+ T.current?.abort(), T.current = null, i(!1);
1293
+ }, []), H = q(() => {
1294
+ T.current?.abort(), T.current = null, O.current = null, D.current = null, k.current = null, A.current = null, j.current = void 0, bt(), i(!1), m(null), g(!1), o(""), u(""), f(""), n([]), P({
1212
1295
  type: "chatbot-reset",
1213
1296
  sessionId: ""
1214
1297
  });
1215
- }, [A]), re = e.humanPollMs ?? xt;
1216
- W(() => {
1217
- if (!p || !a) return;
1298
+ }, [P]), se = e.humanPollMs ?? Tt;
1299
+ G(() => {
1300
+ if (!h || !a) return;
1218
1301
  let e = setInterval(() => {
1219
- let e = E.current;
1220
- !e || C.current || ot({
1221
- apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
1302
+ let e = O.current;
1303
+ !e || T.current || lt({
1304
+ apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
1222
1305
  conversationId: e.sessionId,
1223
1306
  visitorToken: e.visitorToken
1224
1307
  }).then((e) => {
1225
- n(e.messages), m(!!e.withHuman);
1308
+ n(e.messages), g(!!e.withHuman);
1226
1309
  }).catch(() => {});
1227
- }, re);
1310
+ }, se);
1228
1311
  return () => clearInterval(e);
1229
1312
  }, [
1230
- p,
1313
+ h,
1231
1314
  a,
1232
- re
1315
+ se
1233
1316
  ]);
1234
- let ie = e.user?.id;
1235
- return W(() => {
1236
- E.current && D.current !== ie && z();
1237
- }, [ie, z]), {
1238
- messages: K(() => t.length === 0 && k ? [k] : t, [k, t]),
1317
+ let U = e.user?.id;
1318
+ return G(() => {
1319
+ O.current && j.current !== U && H();
1320
+ }, [U, H]), {
1321
+ messages: _e(() => t.length === 0 && N ? [N] : t, [N, t]),
1239
1322
  busy: r,
1240
1323
  sessionId: a,
1241
1324
  handles: s,
1242
1325
  addressee: l,
1243
- approval: d,
1244
- withHuman: p,
1245
- branding: h,
1246
- start: P,
1247
- send: ee,
1248
- attachments: _,
1249
- uploading: y,
1250
- attachmentError: x,
1251
- attach: I,
1252
- detach: L,
1253
- loadAttachment: te,
1254
- decide: R,
1255
- stop: ne,
1256
- reset: z
1326
+ agentHandle: d,
1327
+ approval: p,
1328
+ withHuman: h,
1329
+ branding: _,
1330
+ start: ne,
1331
+ send: ie,
1332
+ attachments: y,
1333
+ uploading: x,
1334
+ attachmentError: C,
1335
+ attach: ae,
1336
+ detach: z,
1337
+ loadAttachment: B,
1338
+ decide: V,
1339
+ stop: oe,
1340
+ reset: H
1257
1341
  };
1258
1342
  }
1259
1343
  //#endregion
1260
1344
  //#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
1261
- var wt = 0;
1345
+ var Ot = 0;
1262
1346
  Array.isArray;
1263
1347
  function Y(e, n, r, i, a, o) {
1264
1348
  n || (n = {});
@@ -1275,7 +1359,7 @@ function Y(e, n, r, i, a, o) {
1275
1359
  __e: null,
1276
1360
  __c: null,
1277
1361
  constructor: void 0,
1278
- __v: --wt,
1362
+ __v: --Ot,
1279
1363
  __i: -1,
1280
1364
  __u: 0,
1281
1365
  __source: a,
@@ -1285,19 +1369,75 @@ function Y(e, n, r, i, a, o) {
1285
1369
  return t.vnode && t.vnode(u), u;
1286
1370
  }
1287
1371
  //#endregion
1372
+ //#region src/components/Avatar.tsx
1373
+ function kt({ name: e, color: t, url: n, size: r = 16 }) {
1374
+ let [i, a] = W(void 0), o = !!n && i !== n;
1375
+ return /* @__PURE__ */ Y("span", {
1376
+ class: "sqc-avatar",
1377
+ "aria-hidden": "true",
1378
+ style: {
1379
+ width: `${r}px`,
1380
+ height: `${r}px`,
1381
+ fontSize: `${Math.round(r * .45)}px`,
1382
+ borderRadius: `${Math.round(r * .25)}px`,
1383
+ ...o || !t ? {} : { backgroundColor: t }
1384
+ },
1385
+ children: o ? /* @__PURE__ */ Y("img", {
1386
+ src: n,
1387
+ alt: "",
1388
+ onError: () => a(n)
1389
+ }) : At(e)
1390
+ });
1391
+ }
1392
+ function At(e) {
1393
+ let t = Array.from(e.trim())[0];
1394
+ return t ? t.toLocaleUpperCase() : "?";
1395
+ }
1396
+ //#endregion
1397
+ //#region src/components/AgentRail.tsx
1398
+ function jt({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
1399
+ return /* @__PURE__ */ Y("nav", {
1400
+ class: "sqc-rail",
1401
+ "aria-label": i,
1402
+ children: e.map((e) => /* @__PURE__ */ Y("button", {
1403
+ type: "button",
1404
+ class: "sqc-rail__item",
1405
+ "aria-label": e.name,
1406
+ "aria-pressed": e.handle === t,
1407
+ "data-tip": e.name,
1408
+ disabled: n,
1409
+ onClick: () => r(e.handle),
1410
+ children: [/* @__PURE__ */ Y(kt, {
1411
+ name: e.name,
1412
+ color: e.color,
1413
+ url: e.avatarUrl,
1414
+ size: 40
1415
+ }), /* @__PURE__ */ Y("span", {
1416
+ class: "sqc-rail__label",
1417
+ "aria-hidden": "true",
1418
+ children: Mt(e.handle)
1419
+ })]
1420
+ }, e.handle))
1421
+ });
1422
+ }
1423
+ function Mt(e) {
1424
+ let t = e.split(/[-_]/)[0] ?? e;
1425
+ return t.charAt(0).toUpperCase() + t.slice(1);
1426
+ }
1427
+ //#endregion
1288
1428
  //#region src/components/Composer.tsx
1289
- var Tt = 132, Et = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", Dt = /^[a-zA-Z0-9_-]*$/;
1290
- function Ot(e, t) {
1429
+ var Nt = 132, Pt = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", Ft = /^[a-zA-Z0-9_-]*$/;
1430
+ function It(e, t) {
1291
1431
  let n = e.slice(0, t), r = n.lastIndexOf("@");
1292
1432
  if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
1293
1433
  let i = n.slice(r + 1);
1294
- return Dt.test(i) ? {
1434
+ return Ft.test(i) ? {
1295
1435
  start: r,
1296
1436
  query: i
1297
1437
  } : null;
1298
1438
  }
1299
- function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addressee: a, attachments: o = [], uploading: s = [], attachmentError: c, onAttach: l, onDetach: u, onSend: d, onStop: f }) {
1300
- let [p, m] = U(""), [h, g] = U(null), [_, v] = U(0), [y, b] = U(!1), x = G(null), C = G(null), w = !!l, T = s.length > 0, E = K(() => {
1439
+ function Lt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addressee: a, attachments: o = [], uploading: s = [], attachmentError: c, onAttach: l, onDetach: u, onSend: d, onStop: f }) {
1440
+ let [p, m] = W(""), [h, g] = W(null), [_, v] = W(0), [y, b] = W(!1), x = K(null), C = K(null), w = !!l, T = s.length > 0, E = _e(() => {
1301
1441
  if (!h || !i || i.length === 0) return [];
1302
1442
  let e = h.query.toLowerCase();
1303
1443
  return i.filter((t) => t.handle.startsWith(e));
@@ -1305,16 +1445,16 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1305
1445
  let e = x.current;
1306
1446
  if (!e) return;
1307
1447
  e.style.height = "auto";
1308
- let t = e.scrollHeight > Tt;
1309
- e.style.height = `${Math.min(e.scrollHeight, Tt)}px`, e.style.overflowY = t ? "auto" : "hidden";
1448
+ let t = e.scrollHeight > Nt;
1449
+ e.style.height = `${Math.min(e.scrollHeight, Nt)}px`, e.style.overflowY = t ? "auto" : "hidden";
1310
1450
  }, []);
1311
- W(() => {
1451
+ G(() => {
1312
1452
  r && x.current?.focus(), O();
1313
- }, [r, O]), W(() => {
1453
+ }, [r, O]), G(() => {
1314
1454
  a && (m((e) => e || `@${a} `), requestAnimationFrame(O));
1315
1455
  }, [a, O]);
1316
1456
  let k = q((e) => {
1317
- g(Ot(e.value, e.selectionStart ?? e.value.length)), v(0);
1457
+ g(It(e.value, e.selectionStart ?? e.value.length)), v(0);
1318
1458
  }, []), A = q((e) => {
1319
1459
  let t = x.current;
1320
1460
  if (!t || !h) return;
@@ -1362,7 +1502,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1362
1502
  A,
1363
1503
  D,
1364
1504
  M
1365
- ]), P = qe - p.length;
1505
+ ]), P = Ye - p.length;
1366
1506
  return /* @__PURE__ */ Y("form", {
1367
1507
  class: `sqc-composer${y ? " sqc-composer--dropping" : ""}`,
1368
1508
  onSubmit: (e) => {
@@ -1424,8 +1564,12 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1424
1564
  children: [
1425
1565
  /* @__PURE__ */ Y("span", {
1426
1566
  class: "sqc-mention__icon",
1427
- "aria-hidden": "true",
1428
- children: e.avatarEmoji ?? "@"
1567
+ children: /* @__PURE__ */ Y(kt, {
1568
+ name: e.name,
1569
+ color: e.color,
1570
+ url: e.avatarUrl,
1571
+ size: 18
1572
+ })
1429
1573
  }),
1430
1574
  /* @__PURE__ */ Y("span", {
1431
1575
  class: "sqc-mention__handle",
@@ -1444,7 +1588,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1444
1588
  rows: 1,
1445
1589
  value: p,
1446
1590
  placeholder: e,
1447
- maxLength: qe,
1591
+ maxLength: Ye,
1448
1592
  "aria-label": t.t.composer.label,
1449
1593
  onInput: (e) => {
1450
1594
  m(e.currentTarget.value), k(e.currentTarget), O();
@@ -1467,7 +1611,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1467
1611
  ref: C,
1468
1612
  type: "file",
1469
1613
  multiple: !0,
1470
- accept: Et,
1614
+ accept: Pt,
1471
1615
  class: "sqc-file-input",
1472
1616
  onChange: (e) => {
1473
1617
  j(e.currentTarget.files), e.currentTarget.value = "";
@@ -1529,18 +1673,18 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
1529
1673
  }
1530
1674
  //#endregion
1531
1675
  //#region src/lib/confirm.ts
1532
- var At = {
1676
+ var Rt = {
1533
1677
  fr: /\br[ée]ponde?z? +«?\s*oui\b/i,
1534
1678
  en: /\b(?:reply|answer|respond) +[“"']?\s*yes\b/i,
1535
1679
  es: /\bresponda?e?d? +«?\s*s[íi]\b/i
1536
- }, jt = {
1680
+ }, zt = {
1537
1681
  fr: [
1538
1682
  /\b(?:confirmes?[- ]tu|confirmez[- ]vous)\b/i,
1539
1683
  /\b(?:valides?[- ]tu|validez[- ]vous)\b/i,
1540
1684
  /\b(?:es[- ]tu s[ûu]re?|[êe]tes[- ]vous s[ûu]re?s?)\b/i,
1541
1685
  /\b(?:dois[- ]je|puis[- ]je)\b/i,
1542
1686
  /\b(?:je continue|on continue|on y va|je lance)\b/i,
1543
- At.fr
1687
+ Rt.fr
1544
1688
  ],
1545
1689
  en: [
1546
1690
  /\bdo you confirm\b/i,
@@ -1548,7 +1692,7 @@ var At = {
1548
1692
  /\b(?:shall|should) I\b/i,
1549
1693
  /\bare you sure\b/i,
1550
1694
  /\b(?:shall we|should I) (?:proceed|continue|go ahead)\b/i,
1551
- At.en
1695
+ Rt.en
1552
1696
  ],
1553
1697
  es: [
1554
1698
  /\b(?:confirmas|confirma|confirm[áa]is)\b/i,
@@ -1556,26 +1700,26 @@ var At = {
1556
1700
  /\best[áa]s? seguro\b/i,
1557
1701
  /\b(?:contin[úu]o|procedo|lo lanzo|lo hago)\b/i,
1558
1702
  /\bquieres? que\b/i,
1559
- At.es
1703
+ Rt.es
1560
1704
  ]
1561
- }, Mt = /^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;
1562
- function Nt(e, t = "en") {
1563
- if (Mt.test(e)) return !1;
1705
+ }, Bt = /^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;
1706
+ function Vt(e, t = "en") {
1707
+ if (Bt.test(e)) return !1;
1564
1708
  let n = e.split("\n").map((e) => e.trim()).filter(Boolean), r = n[n.length - 1];
1565
- return !r || !r.includes("?") && !At[t].test(r) ? !1 : jt[t].some((e) => e.test(r));
1709
+ return !r || !r.includes("?") && !Rt[t].test(r) ? !1 : zt[t].some((e) => e.test(r));
1566
1710
  }
1567
1711
  //#endregion
1568
1712
  //#region src/components/Approval.tsx
1569
- var Pt = /^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;
1570
- function Ft(e) {
1571
- let t = e.replace(Pt, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
1713
+ var Ht = /^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;
1714
+ function Ut(e) {
1715
+ let t = e.replace(Ht, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
1572
1716
  return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
1573
1717
  }
1574
- function It(e, t) {
1718
+ function Wt(e, t) {
1575
1719
  return e === !0 ? t.t.confirm.yes : e === !1 ? t.t.confirm.no : typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
1576
1720
  }
1577
- function Lt({ locale: e, call: t, onDecide: n }) {
1578
- let { approval: r, confirm: i } = e.t, [a, o] = U(null), s = !!n && a === null, c = (e, t) => {
1721
+ function Gt({ locale: e, call: t, onDecide: n }) {
1722
+ let { approval: r, confirm: i } = e.t, [a, o] = W(null), s = !!n && a === null, c = (e, t) => {
1579
1723
  o(t), n?.(e, t);
1580
1724
  }, l = t ? Object.entries(t.arguments) : [];
1581
1725
  return /* @__PURE__ */ Y("div", {
@@ -1586,7 +1730,7 @@ function Lt({ locale: e, call: t, onDecide: n }) {
1586
1730
  t && /* @__PURE__ */ Y("p", {
1587
1731
  class: "sqc-approval__request",
1588
1732
  "data-testid": "sqc-approval-tool",
1589
- children: r.request.replace("{tool}", Ft(t.tool))
1733
+ children: r.request.replace("{tool}", Ut(t.tool))
1590
1734
  }),
1591
1735
  l.length > 0 && /* @__PURE__ */ Y("dl", {
1592
1736
  class: "sqc-approval__args",
@@ -1595,10 +1739,10 @@ function Lt({ locale: e, call: t, onDecide: n }) {
1595
1739
  class: "sqc-approval__arg",
1596
1740
  children: [/* @__PURE__ */ Y("dt", {
1597
1741
  class: "sqc-approval__arg-name",
1598
- children: Ft(t)
1742
+ children: Ut(t)
1599
1743
  }), /* @__PURE__ */ Y("dd", {
1600
1744
  class: "sqc-approval__arg-value",
1601
- children: It(n, e)
1745
+ children: Wt(n, e)
1602
1746
  })]
1603
1747
  }, t))
1604
1748
  }),
@@ -1625,8 +1769,8 @@ function Lt({ locale: e, call: t, onDecide: n }) {
1625
1769
  }
1626
1770
  //#endregion
1627
1771
  //#region src/components/Confirm.tsx
1628
- function Rt({ locale: e, onPick: t }) {
1629
- let [n, r] = U(null), i = !!t && n === null, { confirm: a } = e.t, o = [{
1772
+ function Kt({ locale: e, onPick: t }) {
1773
+ let [n, r] = W(null), i = !!t && n === null, { confirm: a } = e.t, o = [{
1630
1774
  value: a.yesValue,
1631
1775
  label: a.yes,
1632
1776
  kind: "yes"
@@ -1653,7 +1797,7 @@ function Rt({ locale: e, onPick: t }) {
1653
1797
  }
1654
1798
  //#endregion
1655
1799
  //#region src/components/Choices.tsx
1656
- function zt() {
1800
+ function qt() {
1657
1801
  return /* @__PURE__ */ Y("svg", {
1658
1802
  viewBox: "0 0 16 16",
1659
1803
  fill: "none",
@@ -1667,8 +1811,8 @@ function zt() {
1667
1811
  })
1668
1812
  });
1669
1813
  }
1670
- function Bt({ items: e, locale: t, onPick: n }) {
1671
- let [r, i] = U(null), a = !!n && r === null;
1814
+ function Jt({ items: e, locale: t, onPick: n }) {
1815
+ let [r, i] = W(null), a = !!n && r === null;
1672
1816
  return /* @__PURE__ */ Y("div", {
1673
1817
  class: "sqc-choices",
1674
1818
  role: "group",
@@ -1686,7 +1830,7 @@ function Bt({ items: e, locale: t, onPick: n }) {
1686
1830
  children: [/* @__PURE__ */ Y("span", {
1687
1831
  class: `sqc-choice__box${o ? " sqc-choice__box--on" : ""}`,
1688
1832
  "aria-hidden": "true",
1689
- children: o && /* @__PURE__ */ Y(zt, {})
1833
+ children: o && /* @__PURE__ */ Y(qt, {})
1690
1834
  }), /* @__PURE__ */ Y("span", {
1691
1835
  class: "sqc-choice__label",
1692
1836
  children: e.content
@@ -1697,38 +1841,38 @@ function Bt({ items: e, locale: t, onPick: n }) {
1697
1841
  }
1698
1842
  //#endregion
1699
1843
  //#region src/components/RichText.tsx
1700
- var Vt = /(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g, Ht = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/, Ut = /^(https?:|mailto:)/i;
1701
- function Wt(e, t, n) {
1702
- return Ut.test(e) ? /* @__PURE__ */ Y("a", {
1844
+ var Yt = /(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g, Xt = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/, Zt = /^(https?:|mailto:)/i;
1845
+ function Qt(e, t, n) {
1846
+ return Zt.test(e) ? /* @__PURE__ */ Y("a", {
1703
1847
  href: e,
1704
1848
  target: "_blank",
1705
1849
  rel: "noopener noreferrer",
1706
1850
  children: t
1707
1851
  }, n) : t;
1708
1852
  }
1709
- function Gt(e, t) {
1710
- let n = e.split(Vt), r = [];
1853
+ function $t(e, t) {
1854
+ let n = e.split(Yt), r = [];
1711
1855
  return n.forEach((e, n) => {
1712
1856
  if (!e) return;
1713
- let i = `${t}-${n}`, a = Ht.exec(e);
1714
- e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */ Y("strong", { children: e.slice(2, -2) }, i)) : e.startsWith("`") && e.endsWith("`") && e.length > 2 ? r.push(/* @__PURE__ */ Y("code", { children: e.slice(1, -1) }, i)) : e.startsWith("~~") && e.endsWith("~~") && e.length > 4 ? r.push(/* @__PURE__ */ Y("del", { children: e.slice(2, -2) }, i)) : a ? r.push(Wt(a[2], a[1], i)) : e.startsWith("*") && e.endsWith("*") && e.length > 2 ? r.push(/* @__PURE__ */ Y("em", { children: e.slice(1, -1) }, i)) : /^https?:\/\//.test(e) ? r.push(Wt(e, e, i)) : r.push(e);
1857
+ let i = `${t}-${n}`, a = Xt.exec(e);
1858
+ e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */ Y("strong", { children: e.slice(2, -2) }, i)) : e.startsWith("`") && e.endsWith("`") && e.length > 2 ? r.push(/* @__PURE__ */ Y("code", { children: e.slice(1, -1) }, i)) : e.startsWith("~~") && e.endsWith("~~") && e.length > 4 ? r.push(/* @__PURE__ */ Y("del", { children: e.slice(2, -2) }, i)) : a ? r.push(Qt(a[2], a[1], i)) : e.startsWith("*") && e.endsWith("*") && e.length > 2 ? r.push(/* @__PURE__ */ Y("em", { children: e.slice(1, -1) }, i)) : /^https?:\/\//.test(e) ? r.push(Qt(e, e, i)) : r.push(e);
1715
1859
  }), r;
1716
1860
  }
1717
- var Kt = /^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;
1718
- function qt(e) {
1861
+ var en = /^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;
1862
+ function tn(e) {
1719
1863
  return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g, "$1").replace(/\*\*|~~|`|\*/g, "").trim();
1720
1864
  }
1721
- var Jt = /^(\s*)[-*•]\s+/, Yt = /^(\s*)\d+[.)]\s+/, Xt = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, Zt = /^\s*([-*_])(?:\s*\1){2,}\s*$/, Qt = /^\s*>\s?(.*)$/, $t = /^\s*\|.*\|\s*$/, en = /^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/, tn = /^\s*```/;
1722
- function nn(e) {
1865
+ var nn = /^(\s*)[-*•]\s+/, rn = /^(\s*)\d+[.)]\s+/, an = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, on = /^\s*([-*_])(?:\s*\1){2,}\s*$/, sn = /^\s*>\s?(.*)$/, cn = /^\s*\|.*\|\s*$/, ln = /^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/, un = /^\s*```/;
1866
+ function dn(e) {
1723
1867
  return e.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((e) => e.trim());
1724
1868
  }
1725
- function rn(e, t, n, r) {
1869
+ function fn(e, t, n, r) {
1726
1870
  let i = e[t].ordered, a = [], o = t;
1727
1871
  for (; o < e.length && e[o].depth >= n;) {
1728
1872
  let t = e[o];
1729
1873
  if (t.depth === n && t.ordered !== i) break;
1730
1874
  if (t.depth > n) {
1731
- let [n, i] = rn(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
1875
+ let [n, i] = fn(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
1732
1876
  s ? s.nested.push(n) : a.push({
1733
1877
  key: `${r}-${o}`,
1734
1878
  text: null,
@@ -1742,48 +1886,48 @@ function rn(e, t, n, r) {
1742
1886
  nested: []
1743
1887
  }), o += 1;
1744
1888
  }
1745
- let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null : Gt(e.text, e.key), e.nested] }, e.key));
1889
+ let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null : $t(e.text, e.key), e.nested] }, e.key));
1746
1890
  return [Y(i ? "ol" : "ul", { children: s }, r), o];
1747
1891
  }
1748
- function an({ text: e, locale: t, onChoice: n }) {
1892
+ function pn({ text: e, locale: t, onChoice: n }) {
1749
1893
  let r = e.split("\n"), i = [], a = [], o = [], s = [], c = () => {
1750
1894
  if (!a.length) return;
1751
1895
  let e = `p${i.length}`;
1752
- i.push(/* @__PURE__ */ Y("p", { children: Gt(a.join("\n"), e) }, e)), a = [];
1896
+ i.push(/* @__PURE__ */ Y("p", { children: $t(a.join("\n"), e) }, e)), a = [];
1753
1897
  }, l = () => {
1754
1898
  if (!o.length) return;
1755
1899
  let e = 0;
1756
1900
  for (; e < o.length;) {
1757
- let t = `l${i.length}`, [n, r] = rn(o, e, o[e].depth, t);
1901
+ let t = `l${i.length}`, [n, r] = fn(o, e, o[e].depth, t);
1758
1902
  i.push(n), e = r;
1759
1903
  }
1760
1904
  o = [];
1761
1905
  }, u = () => {
1762
1906
  if (!s.length) return;
1763
1907
  let e = `q${i.length}`;
1764
- i.push(/* @__PURE__ */ Y("blockquote", { children: Gt(s.join("\n"), e) }, e)), s = [];
1908
+ i.push(/* @__PURE__ */ Y("blockquote", { children: $t(s.join("\n"), e) }, e)), s = [];
1765
1909
  }, d = () => {
1766
1910
  c(), l(), u();
1767
1911
  };
1768
1912
  for (let e = 0; e < r.length; e += 1) {
1769
1913
  let f = r[e];
1770
- if (tn.test(f)) {
1914
+ if (un.test(f)) {
1771
1915
  d();
1772
1916
  let t = [];
1773
- for (e += 1; e < r.length && !tn.test(r[e]);) t.push(r[e]), e += 1;
1917
+ for (e += 1; e < r.length && !un.test(r[e]);) t.push(r[e]), e += 1;
1774
1918
  let n = `c${i.length}`;
1775
1919
  i.push(/* @__PURE__ */ Y("pre", { children: /* @__PURE__ */ Y("code", { children: t.join("\n") }) }, n));
1776
1920
  continue;
1777
1921
  }
1778
- if ($t.test(f) && e + 1 < r.length && en.test(r[e + 1])) {
1922
+ if (cn.test(f) && e + 1 < r.length && ln.test(r[e + 1])) {
1779
1923
  d();
1780
- let t = nn(f), n = [];
1781
- for (e += 2; e < r.length && $t.test(r[e]);) n.push(nn(r[e])), e += 1;
1924
+ let t = dn(f), n = [];
1925
+ for (e += 2; e < r.length && cn.test(r[e]);) n.push(dn(r[e])), e += 1;
1782
1926
  --e;
1783
1927
  let a = `t${i.length}`;
1784
1928
  i.push(/* @__PURE__ */ Y("div", {
1785
1929
  class: "sqc-table",
1786
- children: /* @__PURE__ */ Y("table", { children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: t.map((e, t) => /* @__PURE__ */ Y("th", { children: Gt(e, `${a}-h${t}`) }, `${a}-h${t}`)) }) }), /* @__PURE__ */ Y("tbody", { children: n.map((e, n) => /* @__PURE__ */ Y("tr", { children: t.map((t, r) => /* @__PURE__ */ Y("td", { children: Gt(e[r] ?? "", `${a}-r${n}c${r}`) }, `${a}-r${n}c${r}`)) }, `${a}-r${n}`)) })] })
1930
+ children: /* @__PURE__ */ Y("table", { children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: t.map((e, t) => /* @__PURE__ */ Y("th", { children: $t(e, `${a}-h${t}`) }, `${a}-h${t}`)) }) }), /* @__PURE__ */ Y("tbody", { children: n.map((e, n) => /* @__PURE__ */ Y("tr", { children: t.map((t, r) => /* @__PURE__ */ Y("td", { children: $t(e[r] ?? "", `${a}-r${n}c${r}`) }, `${a}-r${n}c${r}`)) }, `${a}-r${n}`)) })] })
1787
1931
  }, a));
1788
1932
  continue;
1789
1933
  }
@@ -1791,43 +1935,43 @@ function an({ text: e, locale: t, onChoice: n }) {
1791
1935
  d();
1792
1936
  continue;
1793
1937
  }
1794
- if (Kt.test(f)) {
1938
+ if (en.test(f)) {
1795
1939
  d();
1796
1940
  let a = [];
1797
1941
  for (; e < r.length;) {
1798
- let t = Kt.exec(r[e]);
1942
+ let t = en.exec(r[e]);
1799
1943
  if (!t) break;
1800
1944
  let n = t[2].trim(), o = `o${i.length}-${a.length}`;
1801
1945
  a.push({
1802
- label: qt(n),
1946
+ label: tn(n),
1803
1947
  checked: t[1].toLowerCase() === "x",
1804
- content: Gt(n, o)
1948
+ content: $t(n, o)
1805
1949
  }), e += 1;
1806
1950
  }
1807
- --e, i.push(/* @__PURE__ */ Y(Bt, {
1951
+ --e, i.push(/* @__PURE__ */ Y(Jt, {
1808
1952
  items: a,
1809
1953
  locale: t,
1810
1954
  onPick: n
1811
1955
  }, `o${i.length}`));
1812
1956
  continue;
1813
1957
  }
1814
- let p = Xt.exec(f);
1958
+ let p = an.exec(f);
1815
1959
  if (p) {
1816
1960
  d();
1817
1961
  let e = p[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", n = `h${i.length}`;
1818
- i.push(/* @__PURE__ */ Y(t, { children: Gt(p[2], n) }, n));
1962
+ i.push(/* @__PURE__ */ Y(t, { children: $t(p[2], n) }, n));
1819
1963
  continue;
1820
1964
  }
1821
- if (Zt.test(f)) {
1965
+ if (on.test(f)) {
1822
1966
  d(), i.push(/* @__PURE__ */ Y("hr", {}, `r${i.length}`));
1823
1967
  continue;
1824
1968
  }
1825
- let m = Qt.exec(f);
1969
+ let m = sn.exec(f);
1826
1970
  if (m) {
1827
1971
  c(), l(), s.push(m[1]);
1828
1972
  continue;
1829
1973
  }
1830
- let h = Jt.exec(f), g = h ? null : Yt.exec(f), _ = h ?? g;
1974
+ let h = nn.exec(f), g = h ? null : rn.exec(f), _ = h ?? g;
1831
1975
  if (_) {
1832
1976
  c(), u(), o.push({
1833
1977
  depth: _[1].replace(/\t/g, " ").length,
@@ -1842,8 +1986,8 @@ function an({ text: e, locale: t, onChoice: n }) {
1842
1986
  }
1843
1987
  //#endregion
1844
1988
  //#region src/components/MessageList.tsx
1845
- var on = 80;
1846
- function sn({ at: e, locale: t }) {
1989
+ var mn = 80;
1990
+ function hn({ at: e, locale: t }) {
1847
1991
  let n = new Date(e);
1848
1992
  return /* @__PURE__ */ Y("time", {
1849
1993
  class: "sqc-msg__time",
@@ -1854,9 +1998,9 @@ function sn({ at: e, locale: t }) {
1854
1998
  })
1855
1999
  });
1856
2000
  }
1857
- function cn({ file: e, load: t }) {
1858
- let [n, r] = U(null);
1859
- return W(() => {
2001
+ function gn({ file: e, load: t }) {
2002
+ let [n, r] = W(null);
2003
+ return G(() => {
1860
2004
  let n = null, i = !0;
1861
2005
  return t(e.id).then((e) => {
1862
2006
  i && (n = URL.createObjectURL(e), r(n));
@@ -1872,10 +2016,10 @@ function cn({ file: e, load: t }) {
1872
2016
  children: e.filename
1873
2017
  });
1874
2018
  }
1875
- function ln({ files: e, load: t }) {
2019
+ function _n({ files: e, load: t }) {
1876
2020
  return e.length === 0 || !t ? null : /* @__PURE__ */ Y("div", {
1877
2021
  class: "sqc-attachments sqc-attachments--sent",
1878
- children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(cn, {
2022
+ children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(gn, {
1879
2023
  file: e,
1880
2024
  load: t
1881
2025
  }, e.id) : /* @__PURE__ */ Y("span", {
@@ -1888,17 +2032,17 @@ function ln({ files: e, load: t }) {
1888
2032
  }, e.id))
1889
2033
  });
1890
2034
  }
1891
- function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i, onLoadAttachment: a }) {
2035
+ function vn({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i, onLoadAttachment: a }) {
1892
2036
  let o = e.streaming && !e.content, s = !!e.approval;
1893
2037
  return /* @__PURE__ */ Y("div", {
1894
2038
  class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
1895
2039
  children: [e.role === "assistant" && /* @__PURE__ */ Y("div", {
1896
2040
  class: "sqc-msg__who",
1897
- children: [e.agent?.avatarEmoji ? /* @__PURE__ */ Y("span", {
1898
- class: "sqc-msg__emoji",
1899
- "aria-hidden": "true",
1900
- children: e.agent.avatarEmoji
1901
- }) : /* @__PURE__ */ Y(fn, {}), e.authorName ?? e.agent?.name ?? n]
2041
+ children: [e.agent ? /* @__PURE__ */ Y(kt, {
2042
+ name: e.agent.name,
2043
+ color: e.agent.color,
2044
+ url: e.agent.avatarUrl
2045
+ }) : /* @__PURE__ */ Y(bn, {}), e.authorName ?? e.agent?.name ?? n]
1902
2046
  }), /* @__PURE__ */ Y("div", {
1903
2047
  class: "sqc-msg__bubble",
1904
2048
  children: [o ? /* @__PURE__ */ Y("span", {
@@ -1912,7 +2056,7 @@ function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i,
1912
2056
  }) : /* @__PURE__ */ Y("div", {
1913
2057
  class: "sqc-msg__body",
1914
2058
  children: [
1915
- /* @__PURE__ */ Y(an, {
2059
+ /* @__PURE__ */ Y(pn, {
1916
2060
  text: e.content,
1917
2061
  locale: t,
1918
2062
  onChoice: r
@@ -1921,32 +2065,32 @@ function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i,
1921
2065
  class: "sqc-caret",
1922
2066
  "aria-hidden": "true"
1923
2067
  }),
1924
- s && /* @__PURE__ */ Y(Lt, {
2068
+ s && /* @__PURE__ */ Y(Gt, {
1925
2069
  locale: t,
1926
2070
  call: e.content.trim() === "" ? e.approval : void 0,
1927
2071
  onDecide: i
1928
2072
  }),
1929
- !s && !e.streaming && !e.error && Nt(e.content, t.code) && /* @__PURE__ */ Y(Rt, {
2073
+ e.role === "assistant" && !s && !e.streaming && !e.error && Vt(e.content, t.code) && /* @__PURE__ */ Y(Kt, {
1930
2074
  locale: t,
1931
2075
  onPick: r
1932
2076
  }),
1933
- e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(dn, {
2077
+ e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(yn, {
1934
2078
  message: e,
1935
2079
  locale: t
1936
2080
  }),
1937
- /* @__PURE__ */ Y(ln, {
2081
+ /* @__PURE__ */ Y(_n, {
1938
2082
  files: e.attachments ?? [],
1939
2083
  load: a
1940
2084
  })
1941
2085
  ]
1942
- }), !o && /* @__PURE__ */ Y(sn, {
2086
+ }), !o && /* @__PURE__ */ Y(hn, {
1943
2087
  at: e.createdAt,
1944
2088
  locale: t
1945
2089
  })]
1946
2090
  })]
1947
2091
  });
1948
2092
  }
1949
- function dn({ message: e, locale: t }) {
2093
+ function yn({ message: e, locale: t }) {
1950
2094
  let n = e.offered ?? [];
1951
2095
  return /* @__PURE__ */ Y("p", {
1952
2096
  class: "sqc-msg__unaddressed",
@@ -1963,7 +2107,7 @@ function dn({ message: e, locale: t }) {
1963
2107
  ]
1964
2108
  });
1965
2109
  }
1966
- function fn() {
2110
+ function bn() {
1967
2111
  return /* @__PURE__ */ Y("svg", {
1968
2112
  viewBox: "0 0 24 24",
1969
2113
  fill: "none",
@@ -1975,16 +2119,16 @@ function fn() {
1975
2119
  children: /* @__PURE__ */ Y("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" })
1976
2120
  });
1977
2121
  }
1978
- function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSuggestions: i, busy: a, withHuman: o, onSuggestion: s, onChoice: c, onDecide: l, onLoadAttachment: u }) {
1979
- let d = G(null), f = G(!0);
1980
- return _e(() => {
2122
+ function xn({ messages: e, locale: t, assistantName: n, suggestions: r, showSuggestions: i, busy: a, withHuman: o, onSuggestion: s, onChoice: c, onDecide: l, onLoadAttachment: u }) {
2123
+ let d = K(null), f = K(!0);
2124
+ return ge(() => {
1981
2125
  let e = d.current;
1982
2126
  e && f.current && (e.scrollTop = e.scrollHeight);
1983
- }, [e]), W(() => {
2127
+ }, [e]), G(() => {
1984
2128
  let e = d.current;
1985
2129
  if (!e) return;
1986
2130
  let t = () => {
1987
- f.current = e.scrollHeight - e.scrollTop - e.clientHeight < on;
2131
+ f.current = e.scrollHeight - e.scrollTop - e.clientHeight < mn;
1988
2132
  };
1989
2133
  return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1990
2134
  }, []), /* @__PURE__ */ Y("div", {
@@ -1994,7 +2138,7 @@ function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
1994
2138
  "aria-live": "polite",
1995
2139
  "aria-atomic": "false",
1996
2140
  children: [
1997
- e.map((r, i) => /* @__PURE__ */ Y(un, {
2141
+ e.map((r, i) => /* @__PURE__ */ Y(vn, {
1998
2142
  message: r,
1999
2143
  locale: t,
2000
2144
  assistantName: n,
@@ -2021,30 +2165,30 @@ function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
2021
2165
  }
2022
2166
  //#endregion
2023
2167
  //#region src/components/ChatbotWidget.tsx
2024
- var mn = { width: "min(392px, 100vw)" }, hn = /* @__PURE__ */ new Set(["sessionId"]);
2025
- function gn(e) {
2168
+ var Sn = { width: "min(392px, 100vw)" }, Cn = /* @__PURE__ */ new Set(["sessionId"]);
2169
+ function wn(e) {
2026
2170
  let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
2027
2171
  return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
2028
2172
  }
2029
- function _n(e) {
2173
+ function Tn(e) {
2030
2174
  if (!e) return [];
2031
2175
  let t = [];
2032
2176
  for (let [n, r] of Object.entries(e)) {
2033
- if (hn.has(n) || typeof r != "string" && !Oe(r)) continue;
2177
+ if (Cn.has(n) || typeof r != "string" && !Oe(r)) continue;
2034
2178
  let e = De(r);
2035
2179
  e && t.push({
2036
- label: gn(n),
2180
+ label: wn(n),
2037
2181
  value: e
2038
2182
  });
2039
2183
  }
2040
2184
  return t;
2041
2185
  }
2042
- function vn(e, t) {
2186
+ function En(e, t) {
2043
2187
  return e?.trim() ? e : t;
2044
2188
  }
2045
- function yn(e) {
2046
- let [t, n] = U(!1);
2047
- return W(() => {
2189
+ function Dn(e) {
2190
+ let [t, n] = W(!1);
2191
+ return G(() => {
2048
2192
  if (e !== "auto" || typeof matchMedia != "function") return;
2049
2193
  let t = matchMedia("(prefers-color-scheme: dark)");
2050
2194
  n(t.matches);
@@ -2052,8 +2196,8 @@ function yn(e) {
2052
2196
  return t.addEventListener("change", r), () => t.removeEventListener("change", r);
2053
2197
  }, [e]), e === "dark" ? "dark" : e === "light" ? "light" : t ? "dark" : "light";
2054
2198
  }
2055
- function bn(e) {
2056
- let t = e.persistOpen ?? !0, [n, r] = U(() => Be(e.defaultOpen, t)), [i, a] = U(!1), [o, s] = U(!1), c = G(null), l = G(null), u = yn(e.theme ?? "light"), d = K(() => Ie(e.locale), [e.locale]), f = d.t, p = vn(e.heading, f.heading), m = vn(e.assistantName, f.assistant), h = vn(e.greeting, f.greeting), g = e.onEvent, { send: _, reset: v, decide: y, stop: b, start: x, busy: S, messages: C, withHuman: w, branding: T, sessionId: E, handles: D, addressee: O, attachments: k, uploading: A, attachmentError: j, attach: M, detach: N, loadAttachment: P } = Ct({
2199
+ function On(e) {
2200
+ let t = e.persistOpen ?? !0, [n, r] = W(() => Be(e.defaultOpen, t)), [i, a] = W(!1), [o, s] = W(!1), c = K(null), l = K(null), u = Dn(e.theme ?? "light"), d = _e(() => Ie(e.locale), [e.locale]), f = d.t, p = En(e.heading, f.heading), m = En(e.assistantName, f.assistant), h = En(e.greeting, f.greeting), g = e.onEvent, { send: _, reset: v, decide: y, stop: b, start: x, busy: S, messages: C, withHuman: w, branding: T, sessionId: E, handles: D, addressee: O, agentHandle: k, attachments: A, uploading: j, attachmentError: M, attach: N, detach: P, loadAttachment: F } = Dt({
2057
2201
  embedKey: e.embedKey,
2058
2202
  user: e.user,
2059
2203
  getSubjectToken: e.getSubjectToken,
@@ -2063,13 +2207,13 @@ function bn(e) {
2063
2207
  locale: d,
2064
2208
  onEvent: g
2065
2209
  });
2066
- W(() => {
2210
+ G(() => {
2067
2211
  !n && C.some((e) => e.role === "assistant" && e.id !== "greeting") && s(!0);
2068
2212
  }, [C, n]);
2069
- let F = G(n);
2070
- F.current = n;
2213
+ let I = K(n);
2214
+ I.current = n;
2071
2215
  let ee = q(() => {
2072
- s(!1), !F.current && (F.current = !0, r(!0), t && ze(!0), g?.({
2216
+ s(!1), !I.current && (I.current = !0, r(!0), t && ze(!0), g?.({
2073
2217
  type: "chatbot-open",
2074
2218
  sessionId: E
2075
2219
  }));
@@ -2077,8 +2221,8 @@ function bn(e) {
2077
2221
  g,
2078
2222
  t,
2079
2223
  E
2080
- ]), I = q(() => {
2081
- F.current && (F.current = !1, r(!1), t && ze(!1), g?.({
2224
+ ]), L = q(() => {
2225
+ I.current && (I.current = !1, r(!1), t && ze(!1), g?.({
2082
2226
  type: "chatbot-close",
2083
2227
  sessionId: E
2084
2228
  }), l.current?.focus());
@@ -2087,48 +2231,58 @@ function bn(e) {
2087
2231
  t,
2088
2232
  E
2089
2233
  ]);
2090
- W(() => {
2234
+ G(() => {
2091
2235
  n && x();
2092
2236
  }, [n, x]);
2093
- let L = q((e) => {
2094
- a(!0), _(e);
2095
- }, [_]), te = q(() => {
2237
+ let te = D.length >= 2, R = Ve(C, k || void 0), [ne, re] = W(void 0), ie = K(void 0), ae = q((e) => {
2238
+ ie.current = e, re(e);
2239
+ }, []);
2240
+ G(() => {
2241
+ ie.current = void 0, re(void 0);
2242
+ }, [R]);
2243
+ let z = q((e) => {
2244
+ a(!0), _(te ? He(e, ie.current, R) : e);
2245
+ }, [
2246
+ _,
2247
+ te,
2248
+ R
2249
+ ]), B = q(() => {
2096
2250
  a(!1), s(!1), v();
2097
- }, [v]), R = G({
2251
+ }, [v]), V = K({
2098
2252
  openPanel: ee,
2099
- closePanel: I,
2100
- send: L,
2101
- reset: te,
2253
+ closePanel: L,
2254
+ send: z,
2255
+ reset: B,
2102
2256
  sessionId: E
2103
2257
  });
2104
- R.current = {
2258
+ V.current = {
2105
2259
  openPanel: ee,
2106
- closePanel: I,
2107
- send: L,
2108
- reset: te,
2260
+ closePanel: L,
2261
+ send: z,
2262
+ reset: B,
2109
2263
  sessionId: E
2110
2264
  };
2111
- let ne = G({
2112
- open: () => R.current.openPanel(),
2113
- close: () => R.current.closePanel(),
2114
- toggle: () => F.current ? R.current.closePanel() : R.current.openPanel(),
2115
- reset: () => R.current.reset(),
2265
+ let oe = K({
2266
+ open: () => V.current.openPanel(),
2267
+ close: () => V.current.closePanel(),
2268
+ toggle: () => I.current ? V.current.closePanel() : V.current.openPanel(),
2269
+ reset: () => V.current.reset(),
2116
2270
  send: (e) => {
2117
- R.current.openPanel(), R.current.send(e);
2271
+ V.current.openPanel(), V.current.send(e);
2118
2272
  },
2119
- isOpen: () => F.current,
2120
- sessionId: () => R.current.sessionId
2121
- }), z = e.bind;
2122
- _e(() => (z?.(ne.current), () => z?.(null)), [z]), W(() => {
2273
+ isOpen: () => I.current,
2274
+ sessionId: () => V.current.sessionId
2275
+ }), H = e.bind;
2276
+ ge(() => (H?.(oe.current), () => H?.(null)), [H]), G(() => {
2123
2277
  if (!n) return;
2124
2278
  let e = (e) => {
2125
- e.key === "Escape" && (e.stopPropagation(), I());
2279
+ e.key === "Escape" && (e.stopPropagation(), L());
2126
2280
  };
2127
2281
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
2128
- }, [I, n]);
2129
- let re = K(() => C.some((e) => e.id !== "greeting"), [C]), ie = K(() => _n(e.context), [e.context]), B = {
2282
+ }, [L, n]);
2283
+ let se = _e(() => C.some((e) => e.id !== "greeting"), [C]), U = _e(() => Tn(e.context), [e.context]), ce = {
2130
2284
  ...e.accent ? { "--sqc-accent": e.accent } : {},
2131
- "--sqc-width": e.width ?? mn.width
2285
+ "--sqc-width": e.width ?? Sn.width
2132
2286
  };
2133
2287
  return /* @__PURE__ */ Y("div", {
2134
2288
  class: "sqc",
@@ -2136,7 +2290,7 @@ function bn(e) {
2136
2290
  "data-position": e.position ?? "bottom-right",
2137
2291
  "data-layout": e.layout ?? "sidebar",
2138
2292
  "data-open": n ? "true" : "false",
2139
- style: B,
2293
+ style: ce,
2140
2294
  children: [/* @__PURE__ */ Y("button", {
2141
2295
  ref: l,
2142
2296
  type: "button",
@@ -2150,7 +2304,7 @@ function bn(e) {
2150
2304
  children: /* @__PURE__ */ Y("slot", {
2151
2305
  name: "launcher-icon",
2152
2306
  class: "sqc-slot-icon",
2153
- children: /* @__PURE__ */ Y(fn, {})
2307
+ children: /* @__PURE__ */ Y(bn, {})
2154
2308
  })
2155
2309
  }), o && /* @__PURE__ */ Y("span", {
2156
2310
  class: "sqc-launcher__badge",
@@ -2163,132 +2317,143 @@ function bn(e) {
2163
2317
  "aria-modal": "false",
2164
2318
  "aria-label": p,
2165
2319
  ...n ? {} : { inert: !0 },
2166
- children: [
2167
- /* @__PURE__ */ Y("header", {
2168
- class: "sqc-header",
2320
+ children: [/* @__PURE__ */ Y("header", {
2321
+ class: "sqc-header",
2322
+ children: [
2323
+ /* @__PURE__ */ Y("span", {
2324
+ class: "sqc-header__icon",
2325
+ "aria-hidden": "true",
2326
+ children: /* @__PURE__ */ Y(bn, {})
2327
+ }),
2328
+ /* @__PURE__ */ Y("div", {
2329
+ class: "sqc-header__titles",
2330
+ children: [/* @__PURE__ */ Y("p", {
2331
+ class: "sqc-header__heading",
2332
+ children: p
2333
+ }), /* @__PURE__ */ Y("p", {
2334
+ class: "sqc-header__sub",
2335
+ children: En(e.subheading, f.subheading)
2336
+ })]
2337
+ }),
2338
+ /* @__PURE__ */ Y("button", {
2339
+ type: "button",
2340
+ class: "sqc-icon-btn",
2341
+ onClick: B,
2342
+ "aria-label": f.newConversation,
2343
+ "data-tip": f.newConversation,
2344
+ children: /* @__PURE__ */ Y("svg", {
2345
+ viewBox: "0 0 24 24",
2346
+ fill: "none",
2347
+ stroke: "currentColor",
2348
+ "stroke-width": "1.8",
2349
+ children: /* @__PURE__ */ Y("path", {
2350
+ d: "M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4",
2351
+ "stroke-linecap": "round"
2352
+ })
2353
+ })
2354
+ }),
2355
+ /* @__PURE__ */ Y("button", {
2356
+ type: "button",
2357
+ class: "sqc-icon-btn",
2358
+ onClick: L,
2359
+ "aria-label": f.close,
2360
+ "data-tip": f.closeTitle,
2361
+ children: /* @__PURE__ */ Y("svg", {
2362
+ viewBox: "0 0 24 24",
2363
+ fill: "none",
2364
+ stroke: "currentColor",
2365
+ "stroke-width": "1.8",
2366
+ children: /* @__PURE__ */ Y("path", {
2367
+ d: "M6 6l12 12M18 6L6 18",
2368
+ "stroke-linecap": "round"
2369
+ })
2370
+ })
2371
+ })
2372
+ ]
2373
+ }), /* @__PURE__ */ Y("div", {
2374
+ class: "sqc-panel__body",
2375
+ children: [te && /* @__PURE__ */ Y(jt, {
2376
+ handles: D,
2377
+ active: ne ?? R,
2378
+ disabled: w,
2379
+ onPick: ae,
2380
+ label: f.handles.rail
2381
+ }), /* @__PURE__ */ Y("div", {
2382
+ class: "sqc-panel__main",
2169
2383
  children: [
2170
- /* @__PURE__ */ Y("span", {
2171
- class: "sqc-header__icon",
2172
- "aria-hidden": "true",
2173
- children: /* @__PURE__ */ Y(fn, {})
2384
+ U.length > 0 && /* @__PURE__ */ Y("div", {
2385
+ class: "sqc-context",
2386
+ "aria-label": f.context.region,
2387
+ children: U.map((e) => /* @__PURE__ */ Y("span", {
2388
+ class: "sqc-chip",
2389
+ title: `${e.label}: ${e.value}`,
2390
+ children: [/* @__PURE__ */ Y("b", { children: e.label }), e.value]
2391
+ }, e.label))
2174
2392
  }),
2175
- /* @__PURE__ */ Y("div", {
2176
- class: "sqc-header__titles",
2177
- children: [/* @__PURE__ */ Y("p", {
2178
- class: "sqc-header__heading",
2179
- children: p
2180
- }), /* @__PURE__ */ Y("p", {
2181
- class: "sqc-header__sub",
2182
- children: vn(e.subheading, f.subheading)
2183
- })]
2393
+ /* @__PURE__ */ Y(xn, {
2394
+ messages: C,
2395
+ locale: d,
2396
+ assistantName: m,
2397
+ suggestions: e.suggestions,
2398
+ showSuggestions: !i && !se,
2399
+ busy: S,
2400
+ withHuman: w,
2401
+ onSuggestion: z,
2402
+ onChoice: z,
2403
+ onDecide: y,
2404
+ onLoadAttachment: F
2184
2405
  }),
2185
- /* @__PURE__ */ Y("button", {
2186
- type: "button",
2187
- class: "sqc-icon-btn",
2188
- onClick: te,
2189
- "aria-label": f.newConversation,
2190
- "data-tip": f.newConversation,
2191
- children: /* @__PURE__ */ Y("svg", {
2192
- viewBox: "0 0 24 24",
2193
- fill: "none",
2194
- stroke: "currentColor",
2195
- "stroke-width": "1.8",
2196
- children: /* @__PURE__ */ Y("path", {
2197
- d: "M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4",
2198
- "stroke-linecap": "round"
2199
- })
2200
- })
2406
+ /* @__PURE__ */ Y(Lt, {
2407
+ placeholder: En(e.placeholder, f.placeholder),
2408
+ locale: d,
2409
+ busy: S,
2410
+ autoFocus: n,
2411
+ handles: D,
2412
+ addressee: O,
2413
+ attachments: A,
2414
+ uploading: j,
2415
+ attachmentError: M ? f.attachments[M] : void 0,
2416
+ onAttach: N,
2417
+ onDetach: P,
2418
+ onSend: z,
2419
+ onStop: b
2201
2420
  }),
2202
- /* @__PURE__ */ Y("button", {
2203
- type: "button",
2204
- class: "sqc-icon-btn",
2205
- onClick: I,
2206
- "aria-label": f.close,
2207
- "data-tip": f.closeTitle,
2208
- children: /* @__PURE__ */ Y("svg", {
2209
- viewBox: "0 0 24 24",
2210
- fill: "none",
2211
- stroke: "currentColor",
2212
- "stroke-width": "1.8",
2213
- children: /* @__PURE__ */ Y("path", {
2214
- d: "M6 6l12 12M18 6L6 18",
2215
- "stroke-linecap": "round"
2216
- })
2421
+ /* @__PURE__ */ Y("p", {
2422
+ class: "sqc-hint",
2423
+ children: f.hint
2424
+ }),
2425
+ T && /* @__PURE__ */ Y("p", {
2426
+ class: "sqc-powered",
2427
+ children: /* @__PURE__ */ Y("a", {
2428
+ href: "https://squadico.com",
2429
+ target: "_blank",
2430
+ rel: "noopener noreferrer",
2431
+ children: f.poweredBy
2217
2432
  })
2218
2433
  })
2219
2434
  ]
2220
- }),
2221
- ie.length > 0 && /* @__PURE__ */ Y("div", {
2222
- class: "sqc-context",
2223
- "aria-label": f.context.region,
2224
- children: ie.map((e) => /* @__PURE__ */ Y("span", {
2225
- class: "sqc-chip",
2226
- title: `${e.label}: ${e.value}`,
2227
- children: [/* @__PURE__ */ Y("b", { children: e.label }), e.value]
2228
- }, e.label))
2229
- }),
2230
- /* @__PURE__ */ Y(pn, {
2231
- messages: C,
2232
- locale: d,
2233
- assistantName: m,
2234
- suggestions: e.suggestions,
2235
- showSuggestions: !i && !re,
2236
- busy: S,
2237
- withHuman: w,
2238
- onSuggestion: L,
2239
- onChoice: L,
2240
- onDecide: y,
2241
- onLoadAttachment: P
2242
- }),
2243
- /* @__PURE__ */ Y(kt, {
2244
- placeholder: vn(e.placeholder, f.placeholder),
2245
- locale: d,
2246
- busy: S,
2247
- autoFocus: n,
2248
- handles: D,
2249
- addressee: O,
2250
- attachments: k,
2251
- uploading: A,
2252
- attachmentError: j ? f.attachments[j] : void 0,
2253
- onAttach: M,
2254
- onDetach: N,
2255
- onSend: L,
2256
- onStop: b
2257
- }),
2258
- /* @__PURE__ */ Y("p", {
2259
- class: "sqc-hint",
2260
- children: f.hint
2261
- }),
2262
- T && /* @__PURE__ */ Y("p", {
2263
- class: "sqc-powered",
2264
- children: /* @__PURE__ */ Y("a", {
2265
- href: "https://squadico.com",
2266
- target: "_blank",
2267
- rel: "noopener noreferrer",
2268
- children: f.poweredBy
2269
- })
2270
- })
2271
- ]
2435
+ })]
2436
+ })]
2272
2437
  })]
2273
2438
  });
2274
2439
  }
2275
2440
  //#endregion
2276
2441
  //#region src/styles.css?inline
2277
- var xn = ":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[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:flex-start}.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-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-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.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-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.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}@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-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{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}";
2442
+ var kn = ":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:flex-start}.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-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.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-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.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}@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-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}";
2278
2443
  //#endregion
2279
2444
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/checkPrivateRedeclaration.js
2280
- function Sn(e, t) {
2445
+ function An(e, t) {
2281
2446
  if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
2282
2447
  }
2283
2448
  //#endregion
2284
2449
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateMethodInitSpec.js
2285
- function Cn(e, t) {
2286
- Sn(e, t), t.add(e);
2450
+ function jn(e, t) {
2451
+ An(e, t), t.add(e);
2287
2452
  }
2288
2453
  //#endregion
2289
2454
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldInitSpec.js
2290
2455
  function X(e, t, n) {
2291
- Sn(e, t), t.set(e, n);
2456
+ An(e, t), t.set(e, n);
2292
2457
  }
2293
2458
  //#endregion
2294
2459
  //#region \0@oxc-project+runtime@0.147.0/helpers/esm/assertClassBrand.js
@@ -2308,7 +2473,7 @@ function $(e, t) {
2308
2473
  }
2309
2474
  //#endregion
2310
2475
  //#region src/element.tsx
2311
- var wn = "squadico-chatbot", Tn = [
2476
+ var Mn = "squadico-chatbot", Nn = [
2312
2477
  "embed-key",
2313
2478
  "context",
2314
2479
  "user",
@@ -2327,21 +2492,21 @@ var wn = "squadico-chatbot", Tn = [
2327
2492
  "open",
2328
2493
  "persist-open",
2329
2494
  "locale"
2330
- ], En;
2331
- function Dn() {
2332
- if (En !== void 0) return En;
2495
+ ], Pn;
2496
+ function Fn() {
2497
+ if (Pn !== void 0) return Pn;
2333
2498
  try {
2334
2499
  let e = new CSSStyleSheet();
2335
- e.replaceSync(xn), En = e;
2500
+ e.replaceSync(kn), Pn = e;
2336
2501
  } catch {
2337
- En = null;
2502
+ Pn = null;
2338
2503
  }
2339
- return En;
2504
+ return Pn;
2340
2505
  }
2341
- function On(e, t) {
2342
- typeof console < "u" && console.warn(`[${wn}] ${e}`, t ?? "");
2506
+ function In(e, t) {
2507
+ typeof console < "u" && console.warn(`[${Mn}] ${e}`, t ?? "");
2343
2508
  }
2344
- function kn(e) {
2509
+ function Ln(e) {
2345
2510
  if (!(!e || !e.trim())) try {
2346
2511
  let t = JSON.parse(e);
2347
2512
  if (t && typeof t == "object" && !Array.isArray(t)) {
@@ -2352,56 +2517,56 @@ function kn(e) {
2352
2517
  digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
2353
2518
  };
2354
2519
  }
2355
- On("the \"user\" attribute needs an object with an id", e);
2520
+ In("the \"user\" attribute needs an object with an id", e);
2356
2521
  } catch (e) {
2357
- On("the \"user\" attribute is not valid JSON", e);
2522
+ In("the \"user\" attribute is not valid JSON", e);
2358
2523
  }
2359
2524
  }
2360
- function An(e) {
2525
+ function Rn(e) {
2361
2526
  if (!(!e || !e.trim())) try {
2362
2527
  let t = JSON.parse(e);
2363
2528
  if (t && typeof t == "object" && !Array.isArray(t)) return t;
2364
- On("the `context` attribute must be a JSON object", e);
2529
+ In("the `context` attribute must be a JSON object", e);
2365
2530
  } catch (e) {
2366
- On("the `context` attribute is not valid JSON", e);
2531
+ In("the `context` attribute is not valid JSON", e);
2367
2532
  }
2368
2533
  }
2369
- function jn(e) {
2534
+ function zn(e) {
2370
2535
  if (!(!e || !e.trim())) {
2371
2536
  if (e.trim().startsWith("[")) try {
2372
2537
  let t = JSON.parse(e);
2373
2538
  if (Array.isArray(t)) return t.map(String);
2374
2539
  } catch (e) {
2375
- On("the `suggestions` attribute is not valid JSON", e);
2540
+ In("the `suggestions` attribute is not valid JSON", e);
2376
2541
  return;
2377
2542
  }
2378
2543
  return e.split("|").map((e) => e.trim()).filter(Boolean);
2379
2544
  }
2380
2545
  }
2381
- function Mn(e) {
2546
+ function Bn(e) {
2382
2547
  if (e !== null) return e !== "false" && e !== "0";
2383
2548
  }
2384
- function Nn(e) {
2549
+ function Vn(e) {
2385
2550
  return e === "dark" || e === "light" || e === "auto" ? e : void 0;
2386
2551
  }
2387
- function Pn(e) {
2552
+ function Hn(e) {
2388
2553
  return e === "bottom-left" || e === "bottom-right" ? e : void 0;
2389
2554
  }
2390
- function Fn(e) {
2555
+ function Un(e) {
2391
2556
  return e === "floating" || e === "sidebar" ? e : void 0;
2392
2557
  }
2393
- var In = [
2558
+ var Wn = [
2394
2559
  "context",
2395
2560
  "embedKey",
2396
2561
  "user",
2397
2562
  "getSubjectToken",
2398
2563
  "agent"
2399
2564
  ];
2400
- function Ln() {
2565
+ function Gn() {
2401
2566
  var e, t, n, r, i, a, o, s, c, l, u, d, f, p;
2402
2567
  return t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakSet(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
2403
2568
  constructor() {
2404
- super(), Cn(this, d), X(this, t, void 0), X(this, n, null), X(this, r, !1), X(this, i, !1), X(this, a, ""), X(this, o, void 0), X(this, s, void 0), X(this, c, void 0), X(this, l, void 0), X(this, u, void 0), X(this, f, (e) => {
2569
+ super(), jn(this, d), X(this, t, void 0), X(this, n, null), X(this, r, !1), X(this, i, !1), X(this, a, ""), X(this, o, void 0), X(this, s, void 0), X(this, c, void 0), X(this, l, void 0), X(this, u, void 0), X(this, f, (e) => {
2405
2570
  let { type: t, ...n } = e;
2406
2571
  Q(a, this, n.sessionId), this.dispatchEvent(new CustomEvent(t, {
2407
2572
  detail: n,
@@ -2411,14 +2576,14 @@ function Ln() {
2411
2576
  }), X(this, p, (e) => {
2412
2577
  Q(n, this, e), e && Q(a, this, e.sessionId());
2413
2578
  });
2414
- let e = this.attachShadow({ mode: "open" }), m = Dn();
2579
+ let e = this.attachShadow({ mode: "open" }), m = Fn();
2415
2580
  if (m) e.adoptedStyleSheets = [m];
2416
2581
  else {
2417
2582
  let t = document.createElement("style");
2418
- t.textContent = xn, e.append(t);
2583
+ t.textContent = kn, e.append(t);
2419
2584
  }
2420
2585
  Q(t, this, document.createElement("div")), e.append($(t, this));
2421
- for (let e of In) {
2586
+ for (let e of Wn) {
2422
2587
  if (!Object.hasOwn(this, e)) continue;
2423
2588
  let t = this[e];
2424
2589
  delete this[e], this[e] = t;
@@ -2428,19 +2593,19 @@ function Ln() {
2428
2593
  Q(i, this, !0), Z(d, this, h).call(this);
2429
2594
  }
2430
2595
  disconnectedCallback() {
2431
- Q(i, this, !1), ie(null, $(t, this)), Q(n, this, null);
2596
+ Q(i, this, !1), ae(null, $(t, this)), Q(n, this, null);
2432
2597
  }
2433
2598
  attributeChangedCallback(e, t, r) {
2434
2599
  if (t !== r) {
2435
2600
  if (e === "open" && $(n, this)) {
2436
- Mn(r) ? $(n, this).open() : $(n, this).close();
2601
+ Bn(r) ? $(n, this).open() : $(n, this).close();
2437
2602
  return;
2438
2603
  }
2439
2604
  Z(d, this, m).call(this);
2440
2605
  }
2441
2606
  }
2442
2607
  get context() {
2443
- return $(o, this) ?? An(this.getAttribute("context"));
2608
+ return $(o, this) ?? Rn(this.getAttribute("context"));
2444
2609
  }
2445
2610
  set context(e) {
2446
2611
  Q(o, this, e), Z(d, this, m).call(this);
@@ -2452,7 +2617,7 @@ function Ln() {
2452
2617
  Q(u, this, e), Z(d, this, m).call(this);
2453
2618
  }
2454
2619
  get user() {
2455
- return $(s, this) ?? kn(this.getAttribute("user"));
2620
+ return $(s, this) ?? Ln(this.getAttribute("user"));
2456
2621
  }
2457
2622
  set user(e) {
2458
2623
  Q(s, this, e), Z(d, this, m).call(this);
@@ -2470,7 +2635,7 @@ function Ln() {
2470
2635
  Q(l, this, e), Z(d, this, m).call(this);
2471
2636
  }
2472
2637
  get open() {
2473
- return $(n, this)?.isOpen() ?? Mn(this.getAttribute("open")) ?? !1;
2638
+ return $(n, this)?.isOpen() ?? Bn(this.getAttribute("open")) ?? !1;
2474
2639
  }
2475
2640
  set open(e) {
2476
2641
  e ? this.openChat() : this.closeChat();
@@ -2492,12 +2657,12 @@ function Ln() {
2492
2657
  }
2493
2658
  sendMessage(e) {
2494
2659
  if (!$(n, this)) {
2495
- On("sendMessage() called before the component was mounted — ignored");
2660
+ In("sendMessage() called before the component was mounted — ignored");
2496
2661
  return;
2497
2662
  }
2498
2663
  $(n, this).send(e);
2499
2664
  }
2500
- }, Ge(e, "observedAttributes", Tn), e;
2665
+ }, qe(e, "observedAttributes", Nn), e;
2501
2666
  function m() {
2502
2667
  $(r, this) || !$(i, this) || (Q(r, this, !0), queueMicrotask(() => {
2503
2668
  Q(r, this, !1), $(i, this) && Z(d, this, h).call(this);
@@ -2505,7 +2670,7 @@ function Ln() {
2505
2670
  }
2506
2671
  function h() {
2507
2672
  let e = (e) => this.getAttribute(e) ?? void 0;
2508
- ie(/* @__PURE__ */ Y(bn, {
2673
+ ae(/* @__PURE__ */ Y(On, {
2509
2674
  embedKey: this.embedKey,
2510
2675
  context: this.context,
2511
2676
  user: this.user,
@@ -2516,28 +2681,28 @@ function Ln() {
2516
2681
  assistantName: e("assistant-name"),
2517
2682
  placeholder: e("placeholder"),
2518
2683
  greeting: e("greeting"),
2519
- suggestions: jn(this.getAttribute("suggestions")),
2684
+ suggestions: zn(this.getAttribute("suggestions")),
2520
2685
  width: e("width"),
2521
2686
  accent: e("accent"),
2522
- theme: Nn(this.getAttribute("theme")),
2523
- position: Pn(this.getAttribute("position")),
2524
- layout: Fn(this.getAttribute("layout")),
2525
- defaultOpen: Mn(this.getAttribute("open")) ?? !1,
2526
- persistOpen: Mn(this.getAttribute("persist-open")) ?? !0,
2687
+ theme: Vn(this.getAttribute("theme")),
2688
+ position: Hn(this.getAttribute("position")),
2689
+ layout: Un(this.getAttribute("layout")),
2690
+ defaultOpen: Bn(this.getAttribute("open")) ?? !1,
2691
+ persistOpen: Bn(this.getAttribute("persist-open")) ?? !0,
2527
2692
  locale: e("locale"),
2528
2693
  onEvent: $(f, this),
2529
2694
  bind: $(p, this)
2530
2695
  }), $(t, this));
2531
2696
  }
2532
2697
  }
2533
- var Rn;
2534
- function zn(e = wn) {
2535
- typeof window > "u" || typeof HTMLElement > "u" || (Rn ?? (Rn = Ln()), window.customElements.get(e) || window.customElements.define(e, Rn));
2698
+ var Kn;
2699
+ function qn(e = Mn) {
2700
+ typeof window > "u" || typeof HTMLElement > "u" || (Kn ?? (Kn = Gn()), window.customElements.get(e) || window.customElements.define(e, Kn));
2536
2701
  }
2537
2702
  //#endregion
2538
2703
  //#region src/index.ts
2539
- zn();
2704
+ qn();
2540
2705
  //#endregion
2541
- export { qe as a, je as c, J as i, zn as n, Be as o, Ke as r, Ae as s, wn as t };
2706
+ export { Ye as a, je as c, J as i, qn as n, Be as o, Je as r, Ae as s, Mn as t };
2542
2707
 
2543
- //# sourceMappingURL=src-2UbcV1gc.js.map
2708
+ //# sourceMappingURL=src-2GKPJcbZ.js.map